GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
utils.h File Reference
#include "octave-config.h"
#include <cstdarg>
#include <iosfwd>
#include <string>
#include <list>
#include "dMatrix.h"
#include "lo-utils.h"

Go to the source code of this file.

Classes

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

Functions

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

Function Documentation

◆ almost_match()

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

Definition at line 412 of file utils.cc.

References octave_strncasecmp(), and strncmp().

Referenced by keyword_almost_match().

◆ asprintf()

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

Definition at line 1557 of file utils.cc.

References vasprintf().

◆ check_dimensions()

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

Definition at line 1358 of file utils.cc.

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

Referenced by Fcell().

◆ contents_file_in_path()

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

Definition at line 788 of file utils.cc.

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

◆ dims_to_numel()

◆ display_file_lines()

void display_file_lines ( std::ostream &  os,
const std::string &  file_name,
int  start,
int  end,
int  target_line,
const std::string &  marker,
const std::string &  who 
)
extern

Definition at line 807 of file utils.cc.

Referenced by stack_frame::debug_list(), and stack_frame::debug_type().

◆ do_simple_cellfun() [1/2]

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

Definition at line 1776 of file utils.cc.

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

◆ do_simple_cellfun() [2/2]

◆ do_string_escapes()

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

Definition at line 838 of file utils.cc.

References len, and warning().

Referenced by Fdlmread(), Fdo_string_escapes(), stream::oscanf(), stream::printf(), and stream::scanf().

◆ fcn_file_in_path()

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

Definition at line 749 of file utils.cc.

References __get_load_path__(), load_path::find_fcn_file(), and len.

Referenced by tree_evaluator::echo(), and get_help_from_file().

◆ file_in_path()

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

Definition at line 698 of file utils.cc.

References __get_load_path__(), and load_path::find_file().

◆ find_data_file_in_load_path()

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

Definition at line 711 of file utils.cc.

References __get_load_path__(), load_path::find_file(), and warn_data_file_in_path().

Referenced by Fdlmread().

◆ float_identity_matrix()

FloatMatrix float_identity_matrix ( octave_idx_type  nr,
octave_idx_type  nc 
)
extern

Definition at line 1498 of file utils.cc.

◆ format()

◆ get_dimensions() [1/3]

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

◆ get_dimensions() [2/3]

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

◆ get_dimensions() [3/3]

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

Definition at line 1431 of file utils.cc.

References octave_value::idx_type_value(), and octave_value::isempty().

◆ identity_matrix()

Matrix identity_matrix ( octave_idx_type  nr,
octave_idx_type  nc 
)
extern

Definition at line 1482 of file utils.cc.

◆ keyword_almost_match()

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

Definition at line 428 of file utils.cc.

References almost_match(), and strsave().

◆ make_valid_name()

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

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 137 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()

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

Definition at line 437 of file lo-sysdep.cc.

References f.

Referenced by rename().

◆ search_path_for_all_files()

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

◆ search_path_for_file()

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

Definition at line 517 of file utils.cc.

References directory_path::find_first_of(), and string_vector::std_list().

Referenced by Ffile_in_path().

◆ sleep()

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

◆ undo_string_escape()

const char * undo_string_escape ( char  c)
extern

Definition at line 1020 of file utils.cc.

Referenced by undo_string_escapes().

◆ undo_string_escapes()

std::string undo_string_escapes ( const std::string &  s)
extern

Definition at line 1065 of file utils.cc.

References undo_string_escape().

Referenced by Fundo_string_escapes(), and base_parser::make_constant().

◆ valid_identifier() [1/2]

◆ valid_identifier() [2/2]

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

Definition at line 92 of file utils.cc.

References valid_identifier().

◆ vasprintf()

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

Definition at line 1539 of file utils.cc.

References free(), and octave_vasprintf_wrapper().

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

◆ vformat()

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

Definition at line 1529 of file utils.cc.

References vasprintf().

Referenced by format().