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 <sys/types.h>
#include <unistd.h>
#include "quit.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 "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 "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:

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\ @seealso{exist, who}\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 character string.\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 character string. 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\ Convert 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\ @seealso{is_rooted_relative_filename, make_absolute_filename, isdir}\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\ @seealso{is_absolute_filename, make_absolute_filename, isdir}\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}, \"all\")\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\ \n\ The second argument is optional. If it is supplied, return a cell array\n\ containing all the directory names that match.\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)
void decode_subscripts (const char *name, const octave_value &arg, std::string &type_string, std::list< 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})\n\ @deftypefnx {Built-in Function} {} isindex (@var{ind}, @var{n})\n\ Return true if @var{ind} is a valid index. Valid indices are\n\ either positive integers (although possibly of real data type), or logical\n\ arrays. If present, @var{n} specifies the maximum extent of the dimension\n\ to be indexed. When possible the internal result is cached so that\n\ subsequent indexing using @var{ind} will not perform the check again.\n\ @end deftypefn")
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)

Define Documentation

#define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_FOR_VSNPRINTF
Value:
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \
  delete [] buf; \
  buf = 0; \
  size = initial_size; \
  octave_rethrow_exception (); \
  BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2
#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  ) 
void decode_subscripts ( const char *  name,
const octave_value arg,
std::string &  type_string,
std::list< octave_value_list > &  idx 
)
DEFUN ( isvarname  ,
args   
)
DEFUN ( do_string_escapes  ,
args   
)
DEFUN ( file_in_loadpath  ,
args   
)
DEFUN ( isindex  ,
args   
)
DEFUN ( undo_string_escapes  ,
args   
)
DEFUN ( is_absolute_filename  ,
args   
)
DEFUN ( is_rooted_relative_filename  ,
args   
)
DEFUN ( make_absolute_filename  ,
args   
)
DEFUN ( find_dir_in_path  ,
args   
)
DEFUN ( file_in_path  ,
args   
)
DEFUN ( errno_list  ,
args   
)
DEFUNX ( "errno"  ,
Ferrno  ,
args   
)
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 
)
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 char *  s  ) 
bool valid_identifier ( const std::string &  s  ) 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines