GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
utils.cc File Reference
#include <cerrno>
#include <cstring>
#include <fstream>
#include <iostream>
#include <limits>
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include "vasnprintf.h"
#include "dir-ops.h"
#include "file-ops.h"
#include "file-stat.h"
#include "lo-mappers.h"
#include "lo-utils.h"
#include "oct-cmplx.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "pathsearch.h"
#include "quit.h"
#include "str-vec.h"
#include "Cell.h"
#include <defaults.h>
#include "defun.h"
#include "dirfns.h"
#include "error.h"
#include "gripes.h"
#include "input.h"
#include "lex.h"
#include "load-path.h"
#include "oct-errno.h"
#include "oct-hist.h"
#include "oct-obj.h"
#include "ov-range.h"
#include "pager.h"
#include "parse.h"
#include "sysdep.h"
#include "toplev.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
Include dependency graph for utils.cc:

Go to the source code of this file.

Functions

int almost_match (const std::string &std, const std::string &s, int min_match_len, int case_sens)
 
static void check_dimensions (octave_idx_type &nr, octave_idx_type &nc, const char *warnfor)
 
void check_dimensions (dim_vector &dim, const char *warnfor)
 
std::string contents_file_in_path (const std::string &dir)
 
octave_idx_type dims_to_numel (const dim_vector &dims, const octave_value_list &idx)
 
octave_value_list do_simple_cellfun (octave_value_list(*fun)(const octave_value_list &, int), const char *fun_name, const octave_value_list &args, int nargout)
 
octave_value do_simple_cellfun (octave_value_list(*fun)(const octave_value_list &, int), const char *fun_name, const octave_value_list &args)
 
std::string do_string_escapes (const std::string &s)
 
int empty_arg (const char *, octave_idx_type nr, octave_idx_type nc)
 
std::string fcn_file_in_path (const std::string &name)
 
OCTAVE_EXPORT octave_value_list Fdir_in_loadpath (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fdo_string_escapes (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ferrno (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ferrno_list (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffile_in_loadpath (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Ffile_in_path (const octave_value_list &args, int)
 
std::string file_in_path (const std::string &name, const std::string &suffix)
 
std::string find_data_file_in_load_path (const std::string &fcn, const std::string &file, bool require_regular_file)
 
OCTAVE_EXPORT octave_value_list Fis_absolute_filename (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fis_rooted_relative_filename (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fisindex (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fisstudent (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fisvarname (const octave_value_list &args, int)
 
FloatMatrix float_identity_matrix (octave_idx_type nr, octave_idx_type nc)
 
OCTAVE_EXPORT octave_value_list Fmake_absolute_filename (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fundo_string_escapes (const octave_value_list &args, int)
 
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)
 
static string_vector make_absolute (const string_vector &sv)
 
std::string mex_file_in_path (const std::string &name)
 
std::string oct_file_in_path (const std::string &name)
 
std::string octave_asprintf (const char *fmt,...)
 
size_t octave_format (std::ostream &os, const char *fmt,...)
 
void octave_sleep (double seconds)
 
std::string octave_vasprintf (const char *fmt, va_list args)
 
size_t octave_vformat (std::ostream &os, const char *fmt, va_list args)
 
bool same_file (const std::string &f, const std::string &g)
 
string_vector search_path_for_all_files (const std::string &path, const string_vector &names)
 
std::string search_path_for_file (const std::string &path, const string_vector &names)
 
const charundo_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)
 

Function Documentation

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

Definition at line 139 of file utils.cc.

References octave_strncasecmp().

Referenced by keyword_almost_match().

static void check_dimensions ( octave_idx_type nr,
octave_idx_type nc,
const char warnfor 
)
static

Definition at line 1108 of file utils.cc.

References warning_with_id().

Referenced by Fcell(), fill_matrix(), and get_dimensions().

void check_dimensions ( dim_vector dim,
const char warnfor 
)

Definition at line 1121 of file utils.cc.

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

std::string contents_file_in_path ( const std::string &  dir)
octave_idx_type dims_to_numel ( const dim_vector dims,
const octave_value_list idx 
)
octave_value_list do_simple_cellfun ( octave_value_list(*)(const octave_value_list &, int fun,
const char fun_name,
const octave_value_list args,
int  nargout 
)
octave_value do_simple_cellfun ( octave_value_list(*)(const octave_value_list &, int fun,
const char fun_name,
const octave_value_list args 
)

Definition at line 1517 of file utils.cc.

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

std::string do_string_escapes ( const std::string &  s)
int empty_arg ( const char ,
octave_idx_type  nr,
octave_idx_type  nc 
)

Definition at line 246 of file utils.cc.

Referenced by Fdet(), Feig(), Fhess(), Finv(), Flu(), Fpinv(), Fqz(), Fsylvester(), Gchol(), and Gqr().

std::string fcn_file_in_path ( const std::string &  name)
OCTAVE_EXPORT octave_value_list Fdir_in_loadpath ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fdo_string_escapes ( const octave_value_list args,
int   
)

Definition at line 708 of file utils.cc.

References do_string_escapes(), error(), octave_value::length(), and print_usage().

OCTAVE_EXPORT octave_value_list Ferrno ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ferrno_list ( const octave_value_list args,
int   
)

Definition at line 1089 of file utils.cc.

References octave_errno::list(), and print_usage().

OCTAVE_EXPORT octave_value_list Ffile_in_loadpath ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Ffile_in_path ( const octave_value_list args,
int   
)
std::string file_in_path ( const std::string &  name,
const std::string &  suffix 
)

Definition at line 452 of file utils.cc.

References load_path::find_file(), and octave_env::make_absolute().

Referenced by install_utils_fcns(), and symbol_exist().

std::string find_data_file_in_load_path ( const std::string &  fcn,
const std::string &  file,
bool  require_regular_file 
)
OCTAVE_EXPORT octave_value_list Fis_absolute_filename ( const octave_value_list args,
int   
)

Definition at line 887 of file utils.cc.

References octave_env::absolute_pathname(), and print_usage().

OCTAVE_EXPORT octave_value_list Fis_rooted_relative_filename ( const octave_value_list args,
int   
)

Definition at line 912 of file utils.cc.

References print_usage(), and octave_env::rooted_relative_pathname().

OCTAVE_EXPORT octave_value_list Fisindex ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fisstudent ( const octave_value_list args,
int   
)

Definition at line 1543 of file utils.cc.

References octave_value(), and print_usage().

OCTAVE_EXPORT octave_value_list Fisvarname ( const octave_value_list args,
int   
)

Definition at line 100 of file utils.cc.

References is_keyword(), octave_value::length(), print_usage(), and valid_identifier().

FloatMatrix float_identity_matrix ( octave_idx_type  nr,
octave_idx_type  nc 
)

Definition at line 1270 of file utils.cc.

References min().

OCTAVE_EXPORT octave_value_list Fmake_absolute_filename ( const octave_value_list args,
int   
)

Definition at line 940 of file utils.cc.

References error(), error_state, octave_env::make_absolute(), and print_usage().

OCTAVE_EXPORT octave_value_list Fundo_string_escapes ( const octave_value_list args,
int   
)

Definition at line 841 of file utils.cc.

References error(), octave_value::length(), print_usage(), and undo_string_escapes().

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 
)

Definition at line 1254 of file utils.cc.

References min().

int keyword_almost_match ( const char *const *  std,
int min_len,
const std::string &  s,
int  min_toks_to_match,
int  max_toks 
)
static string_vector make_absolute ( const string_vector sv)
static

Definition at line 279 of file utils.cc.

References Array< T >::length(), and octave_env::make_absolute().

Referenced by Ffile_in_loadpath(), and Ffile_in_path().

std::string mex_file_in_path ( const std::string &  name)
std::string oct_file_in_path ( const std::string &  name)
std::string octave_asprintf ( const char fmt,
  ... 
)

Definition at line 1329 of file utils.cc.

References octave_vasprintf().

size_t octave_format ( std::ostream &  os,
const char fmt,
  ... 
)

Definition at line 1286 of file utils.cc.

References octave_vformat().

Referenced by do_printf_conv().

void octave_sleep ( double  seconds)

Definition at line 1344 of file utils.cc.

References max(), octave_sleep(), and octave_usleep().

Referenced by octave_sleep().

std::string octave_vasprintf ( const char fmt,
va_list  args 
)

Definition at line 1311 of file utils.cc.

References free().

Referenced by octave_asprintf(), and octave_vformat().

size_t octave_vformat ( std::ostream &  os,
const char fmt,
va_list  args 
)

Definition at line 1301 of file utils.cc.

References octave_vasprintf().

Referenced by mexPrintf(), octave_format(), verror(), and vwarning().

bool same_file ( const std::string &  f,
const std::string &  g 
)
string_vector search_path_for_all_files ( const std::string &  path,
const string_vector names 
)

Definition at line 264 of file utils.cc.

References dir_path::find_all_first_of(), Array< T >::length(), and octave_env::make_absolute().

Referenced by Ffile_in_path().

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

Definition at line 254 of file utils.cc.

References dir_path::find_first_of(), and octave_env::make_absolute().

Referenced by Ffile_in_path(), and have_gnuplot_binary().

const char* undo_string_escape ( char  c)

Definition at line 754 of file utils.cc.

Referenced by octave_lex(), and undo_string_escapes().

std::string undo_string_escapes ( const std::string &  s)
bool valid_identifier ( const char s)
bool valid_identifier ( const std::string &  s)

Definition at line 90 of file utils.cc.

References valid_identifier().