Navigation

Operators and Keywords

Function List:

C++ API

utils.cc File Reference

#include <cerrno>
#include <climits>
#include <cstring>
#include <fstream>
#include <iostream>
#include <string>
#include "quit.h"
#include "dir-ops.h"
#include "file-ops.h"
#include "file-stat.h"
#include "lo-mappers.h"
#include "oct-cmplx.h"
#include "oct-env.h"
#include "pathsearch.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 "load-path.h"
#include "oct-errno.h"
#include "oct-hist.h"
#include "oct-obj.h"
#include "pager.h"
#include "sysdep.h"
#include "toplev.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"

Include dependency graph for utils.cc:


Defines

#define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_FOR_VSNPRINTF
#define SAVE_ARGS(saved_args, args)   saved_args = args

Functions

bool valid_identifier (const char *s)
bool valid_identifier (const std::string &s)
 DEFUN (isvarname, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} isvarname (@var{name})\n\ Return true if @var{name} is a valid variable name\n\ @end deftypefn")
bool same_file (const std::string &f, const std::string &g)
int almost_match (const std::string &std, const std::string &s, int min_match_len, int case_sens)
int keyword_almost_match (const char *const *std, int *min_len, const std::string &s, int min_toks_to_match, int max_toks)
int empty_arg (const char *, octave_idx_type nr, octave_idx_type nc)
std::string search_path_for_file (const std::string &path, const string_vector &names)
string_vector search_path_for_all_files (const std::string &path, const string_vector &names)
 DEFUN (file_in_loadpath, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} file_in_loadpath (@var{file})\n\ @deftypefnx {Built-in Function} {} file_in_loadpath (@var{file}, \"all\")\n\ \n\ Return the absolute name of @var{file} if it can be found in\n\ the list of directories specified by @code{path}.\n\ If no file is found, return an empty matrix.\n\ \n\ If the first argument is a cell array of strings, search each\n\ directory of the loadpath for element of the cell array and return\n\ the first that matches.\n\ \n\ If the second optional argument @code{\"all\"} is supplied, return\n\ a cell array containing the list of all files that have the same\n\ name in the path. If no files are found, return an empty cell array.\n\ @seealso{file_in_path, path}\n\ @end deftypefn")
 DEFUN (file_in_path, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} file_in_path (@var{path}, @var{file})\n\ @deftypefnx {Built-in Function} {} file_in_path (@var{path}, @var{file}, \"all\")\n\ Return the absolute name of @var{file} if it can be found in\n\ @var{path}. The value of @var{path} should be a colon-separated list of\n\ directories in the format described for @code{path}. If no file\n\ is found, return an empty matrix. For example,\n\ \n\ @example\n\ @group\n\ file_in_path (EXEC_PATH, \"sh\")\n\ @result{} \"/bin/sh\"\n\ @end group\n\ @end example\n\ \n\ If the second argument is a cell array of strings, search each\n\ directory of the path for element of the cell array and return\n\ the first that matches.\n\ \n\ If the third optional argument @code{\"all\"} is supplied, return\n\ a cell array containing the list of all files that have the same\n\ name in the path. If no files are found, return an empty cell array.\n\ @seealso{file_in_loadpath}\n\ @end deftypefn")
std::string file_in_path (const std::string &name, const std::string &suffix)
std::string fcn_file_in_path (const std::string &name)
std::string contents_file_in_path (const std::string &dir)
std::string oct_file_in_path (const std::string &name)
std::string mex_file_in_path (const std::string &name)
std::string do_string_escapes (const std::string &s)
 DEFUN (do_string_escapes, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} do_string_escapes (@var{string})\n\ Convert special characters in @var{string} to their escaped forms.\n\ @end deftypefn")
const char * undo_string_escape (char c)
std::string undo_string_escapes (const std::string &s)
 DEFUN (undo_string_escapes, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} undo_string_escapes (@var{s})\n\ Converts special characters in strings back to their escaped forms. For\n\ example, the expression\n\ \n\ @example\n\ bell = \"\\a\";\n\ @end example\n\ \n\ @noindent\n\ assigns the value of the alert character (control-g, ASCII code 7) to\n\ the string variable @code{bell}. If this string is printed, the\n\ system will ring the terminal bell (if it is possible). This is\n\ normally the desired outcome. However, sometimes it is useful to be\n\ able to print the original representation of the string, with the\n\ special characters replaced by their escape sequences. For example,\n\ \n\ @example\n\ @group\n\ octave:13> undo_string_escapes (bell)\n\ ans = \\a\n\ @end group\n\ @end example\n\ \n\ @noindent\n\ replaces the unprintable alert character with its printable\n\ representation.\n\ @end deftypefn")
 DEFUN (is_absolute_filename, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} is_absolute_filename (@var{file})\n\ Return true if @var{file} is an absolute filename.\n\ @end deftypefn")
 DEFUN (is_rooted_relative_filename, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} is_rooted_relative_filename (@var{file})\n\ Return true if @var{file} is a rooted-relative filename.\n\ @end deftypefn")
 DEFUN (make_absolute_filename, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} make_absolute_filename (@var{file})\n\ Return the full name of @var{file}, relative to the current directory.\n\ @end deftypefn")
 DEFUN (find_dir_in_path, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} find_dir_in_path (@var{dir})\n\ Return the full name of the path element matching @var{dir}. The\n\ match is performed at the end of each path element. For example, if\n\ @var{dir} is @code{\"foo/bar\"}, it matches the path element\n\ @code{\"/some/dir/foo/bar\"}, but not @code{\"/some/dir/foo/bar/baz\"}\n\ or @code{\"/some/dir/allfoo/bar\"}.\n\ @end deftypefn")
 DEFUNX ("errno", Ferrno, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{err} =} errno ()\n\ @deftypefnx {Built-in Function} {@var{err} =} errno (@var{val})\n\ @deftypefnx {Built-in Function} {@var{err} =} errno (@var{name})\n\ Return the current value of the system-dependent variable errno,\n\ set its value to @var{val} and return the previous value, or return\n\ the named error code given @var{name} as a character string, or -1\n\ if @var{name} is not found.\n\ @end deftypefn")
 DEFUN (errno_list, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} errno_list ()\n\ Return a structure containing the system-dependent errno values.\n\ @end deftypefn")
void check_dimensions (dim_vector &dim, const char *warnfor)
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)
octave_idx_type dims_to_numel (const dim_vector &dims, const octave_value_list &idx)
Matrix identity_matrix (octave_idx_type nr, octave_idx_type nc)
FloatMatrix float_identity_matrix (octave_idx_type nr, octave_idx_type nc)
int octave_format (std::ostream &os, const char *fmt,...)
int octave_vformat (std::ostream &os, const char *fmt, va_list args)
char * octave_vsnprintf (const char *fmt, va_list args)
char * octave_snprintf (const char *fmt,...)
void octave_sleep (double seconds)
 DEFUN (isindex, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} isindex (@var{ind}, @var{n})\n\ Returns true if @var{ind} is a valid index. Valid indices can be\n\ either positive integers (though possibly real data), or logical arrays.\n\ If present, @var{n} specifies the extent of the dimension to be indexed.\n\ Note that, if possible, the internal conversion result is cached so that\n\ subsequent indexing will not perform the checking again.\n\ @end deftypefn")

Define Documentation

#define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_FOR_VSNPRINTF

#define SAVE_ARGS ( saved_args,
args   )     saved_args = args


Function Documentation

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

void check_dimensions ( dim_vector dim,
const char *  warnfor 
)

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

DEFUN ( isindex  ,
args   
)

DEFUN ( errno_list  ,
args   
)

DEFUN ( find_dir_in_path  ,
args   
)

DEFUN ( make_absolute_filename  ,
args   
)

DEFUN ( is_rooted_relative_filename  ,
args   
)

DEFUN ( is_absolute_filename  ,
args   
)

DEFUN ( undo_string_escapes  ,
args   
)

DEFUN ( do_string_escapes  ,
args   
)

DEFUN ( file_in_path  ,
args   
)

DEFUN ( file_in_loadpath  ,
args   
)

DEFUN ( isvarname  ,
args   
)

DEFUNX ( "errno"  ,
Ferrno  ,
args   
)

octave_idx_type dims_to_numel ( const dim_vector dims,
const octave_value_list idx 
)

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  ) 

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

FloatMatrix float_identity_matrix ( 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 
)

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 char *  warn_for,
dim_vector dim 
)

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 
)

std::string mex_file_in_path ( const std::string name  ) 

std::string oct_file_in_path ( const std::string name  ) 

int octave_format ( std::ostream os,
const char *  fmt,
  ... 
)

void octave_sleep ( double  seconds  ) 

char* octave_snprintf ( const char *  fmt,
  ... 
)

int octave_vformat ( std::ostream os,
const char *  fmt,
va_list  args 
)

char* octave_vsnprintf ( 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 char* undo_string_escape ( char  c  ) 

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

bool valid_identifier ( const std::string s  ) 

bool valid_identifier ( const char *  s  )