GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
utils.h File Reference
#include "octave-config.h"
#include <cstdarg>
#include <iosfwd>
#include <string>
#include <list>
#include "dMatrix.h"
#include "lo-utils.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  make_valid_name_options
 Helper class for make_valid_name function calls. More...
 

Functions

OCTINTERP_API int almost_match (const std::string &std, const std::string &s, int min_match_len=1, int case_sens=1)
 
OCTINTERP_API std::string asprintf (const char *fmt,...)
 
OCTINTERP_API void check_dimensions (dim_vector &dim, const char *warnfor)
 
OCTINTERP_API std::string contents_file_in_path (const std::string &)
 
OCTINTERP_API octave_idx_type dims_to_numel (const dim_vector &dims, const octave_value_list &idx)
 
OCTINTERP_API octave_value do_simple_cellfun (octave_value_list(*fcn)(const octave_value_list &, int), const char *fcn_name, const octave_value_list &args)
 
OCTINTERP_API octave_value_list do_simple_cellfun (octave_value_list(*fcn)(const octave_value_list &, int), const char *fcn_name, const octave_value_list &args, int nargout)
 
OCTINTERP_API std::string do_string_escapes (const std::string &s)
 
OCTINTERP_API std::string fcn_file_in_path (const std::string &)
 
OCTINTERP_API std::string file_in_path (const std::string &, const std::string &)
 
OCTINTERP_API std::string find_data_file_in_load_path (const std::string &fcn, const std::string &file, bool require_regular_file=false)
 
OCTINTERP_API FloatMatrix float_identity_matrix (octave_idx_type nr, octave_idx_type nc)
 
OCTINTERP_API std::size_t format (std::ostream &os, const char *fmt,...)
 
OCTINTERP_API void get_dimensions (const octave_value &a, const char *warn_for, dim_vector &dim)
 
OCTINTERP_API void get_dimensions (const octave_value &a, const char *warn_for, octave_idx_type &nr, octave_idx_type &nc)
 
OCTINTERP_API void get_dimensions (const octave_value &a, const octave_value &b, const char *warn_for, octave_idx_type &nr, octave_idx_type &nc)
 
OCTINTERP_API Matrix identity_matrix (octave_idx_type nr, octave_idx_type nc)
 
OCTINTERP_API int keyword_almost_match (const char *const *std, int *min_len, const std::string &s, int min_toks_to_match, int max_toks)
 
OCTINTERP_API bool make_valid_name (std::string &str, const make_valid_name_options &options)
 Modify str to be a valid variable name. More...
 
OCTINTERP_API bool same_file (const std::string &f, const std::string &g)
 
OCTINTERP_API string_vector search_path_for_all_files (const std::string &, const string_vector &)
 
OCTINTERP_API std::string search_path_for_file (const std::string &, const string_vector &)
 
OCTINTERP_API void sleep (double seconds, bool do_graphics_events=false)
 
OCTINTERP_API const char * undo_string_escape (char c)
 
OCTINTERP_API std::string undo_string_escapes (const std::string &s)
 
OCTINTERP_API bool valid_identifier (const char *s)
 
OCTINTERP_API bool valid_identifier (const std::string &s)
 
OCTINTERP_API std::string vasprintf (const char *fmt, va_list args)
 
OCTINTERP_API std::size_t vformat (std::ostream &os, const char *fmt, va_list args)
 

Function Documentation

◆ almost_match()

OCTINTERP_API int almost_match ( const std::string &  std,
const std::string &  s,
int  min_match_len = 1,
int  case_sens = 1 
)

Definition at line 408 of file utils.cc.

References octave_strncasecmp(), and strncmp().

Referenced by keyword_almost_match().

◆ asprintf()

OCTINTERP_API std::string asprintf ( const char *  fmt,
  ... 
)

Definition at line 1513 of file utils.cc.

References vasprintf().

◆ check_dimensions()

OCTINTERP_API void check_dimensions ( dim_vector dim,
const char *  warnfor 
)

Definition at line 1324 of file utils.cc.

References dim_vector::ndims(), and warning_with_id().

◆ contents_file_in_path()

OCTINTERP_API std::string contents_file_in_path ( const std::string &  dir)

Definition at line 782 of file utils.cc.

References __get_load_path__(), concat(), load_path::find_dir(), and make_absolute().

◆ dims_to_numel()

◆ do_simple_cellfun() [1/2]

OCTINTERP_API octave_value do_simple_cellfun ( octave_value_list(*)(const octave_value_list &, int)  fcn,
const char *  fcn_name,
const octave_value_list args 
)

Definition at line 1731 of file utils.cc.

References do_simple_cellfun(), and octave_value_list::length().

◆ do_simple_cellfun() [2/2]

OCTINTERP_API octave_value_list do_simple_cellfun ( octave_value_list(*)(const octave_value_list &, int)  fcn,
const char *  fcn_name,
const octave_value_list args,
int  nargout 
)

◆ do_string_escapes()

OCTINTERP_API std::string do_string_escapes ( const std::string &  s)

◆ fcn_file_in_path()

OCTINTERP_API std::string fcn_file_in_path ( const std::string &  name)

◆ file_in_path()

OCTINTERP_API std::string file_in_path ( const std::string &  name,
const std::string &  suffix 
)

◆ find_data_file_in_load_path()

OCTINTERP_API std::string find_data_file_in_load_path ( const std::string &  fcn,
const std::string &  file,
bool  require_regular_file = false 
)

◆ float_identity_matrix()

OCTINTERP_API FloatMatrix float_identity_matrix ( octave_idx_type  nr,
octave_idx_type  nc 
)

Definition at line 1458 of file utils.cc.

References m, min(), and n.

◆ format()

◆ get_dimensions() [1/3]

OCTINTERP_API void get_dimensions ( const octave_value a,
const char *  warn_for,
dim_vector dim 
)

◆ get_dimensions() [2/3]

OCTINTERP_API void get_dimensions ( const octave_value a,
const char *  warn_for,
octave_idx_type nr,
octave_idx_type nc 
)

◆ get_dimensions() [3/3]

OCTINTERP_API void get_dimensions ( const octave_value a,
const octave_value b,
const char *  warn_for,
octave_idx_type nr,
octave_idx_type nc 
)

◆ identity_matrix()

OCTINTERP_API Matrix identity_matrix ( octave_idx_type  nr,
octave_idx_type  nc 
)

Definition at line 1443 of file utils.cc.

References m, min(), and n.

◆ keyword_almost_match()

OCTINTERP_API int keyword_almost_match ( const char *const *  std,
int *  min_len,
const std::string &  s,
int  min_toks_to_match,
int  max_toks 
)

◆ make_valid_name()

OCTINTERP_API bool make_valid_name ( std::string &  str,
const make_valid_name_options options 
)

Modify str to be a valid variable name.

Parameters
strinput string
optionssee also help matlab.lang.makeValidName.
Returns
true, if str was modified.

Definition at line 135 of file utils.cc.

References make_valid_name_options::get_prefix(), make_valid_name_options::get_replacement_style(), iskeyword(), valid_identifier(), and x.

Referenced by F__make_valid_name__().

◆ same_file()

OCTINTERP_API bool same_file ( const std::string &  f,
const std::string &  g 
)

◆ search_path_for_all_files()

OCTINTERP_API string_vector search_path_for_all_files ( const std::string &  path,
const string_vector names 
)

◆ search_path_for_file()

OCTINTERP_API std::string search_path_for_file ( const std::string &  path,
const string_vector names 
)

◆ sleep()

OCTINTERP_API void sleep ( double  seconds,
bool  do_graphics_events = false 
)

◆ undo_string_escape()

OCTINTERP_API const char* undo_string_escape ( char  c)

Definition at line 986 of file utils.cc.

Referenced by octave_lex(), and undo_string_escapes().

◆ undo_string_escapes()

◆ valid_identifier() [1/2]

◆ valid_identifier() [2/2]

OCTINTERP_API bool valid_identifier ( const std::string &  s)

Definition at line 90 of file utils.cc.

References valid_identifier().

◆ vasprintf()

OCTINTERP_API std::string vasprintf ( const char *  fmt,
va_list  args 
)

Definition at line 1496 of file utils.cc.

References free(), and octave_vasprintf_wrapper().

Referenced by asprintf(), octave_vasprintf_wrapper(), and vformat().

◆ vformat()

OCTINTERP_API std::size_t vformat ( std::ostream &  os,
const char *  fmt,
va_list  args 
)

Definition at line 1487 of file utils.cc.

References vasprintf().

Referenced by format(), format_message(), and mexPrintf().