#include <cerrno>
#include <cstring>
#include <fstream>
#include <limits>
#include <ostream>
#include <string>
#include "dir-ops.h"
#include "file-ops.h"
#include "file-stat.h"
#include "lo-mappers.h"
#include "lo-utils.h"
#include "nanosleep-wrapper.h"
#include "oct-cmplx.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "oct-string.h"
#include "pathsearch.h"
#include "quit.h"
#include "str-vec.h"
#include "strcase-wrappers.h"
#include "vasprintf-wrapper.h"
#include "Cell.h"
#include "defun.h"
#include "error.h"
#include "errwarn.h"
#include "graphics.h"
#include "interpreter-private.h"
#include "interpreter.h"
#include "lex.h"
#include "load-path.h"
#include "oct-errno.h"
#include "oct-hist.h"
#include "ovl.h"
#include "ov-range.h"
#include "pager.h"
#include "parse.h"
#include "sysdep.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
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) |
std::string | asprintf (const char *fmt,...) |
void | check_dimensions (dim_vector &dim, const char *warnfor) |
static void | check_dimensions (octave_idx_type &nr, octave_idx_type &nc, 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_arg) |
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) |
OCTAVE_EXPORT octave_value_list | F__make_valid_name__ (const octave_value_list &args, int) |
std::string | fcn_file_in_path (const std::string &name) |
OCTAVE_EXPORT octave_value_list | Fdir_in_loadpath (octave::interpreter &interp, 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 (octave::interpreter &interp, 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 | Fis_same_file (const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fisindex (octave::interpreter &interp, 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) |
std::size_t | format (std::ostream &os, const char *fmt,...) |
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) |
bool | make_valid_name (std::string &str, const make_valid_name_options &options) |
Modify str to be a valid variable name. More... | |
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) |
void | sleep (double seconds, bool do_graphics_events) |
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) |
int almost_match | ( | const std::string & | std, |
const std::string & | s, | ||
int | min_match_len, | ||
int | case_sens | ||
) |
Definition at line 408 of file utils.cc.
References octave_strncasecmp(), and strncmp().
Referenced by keyword_almost_match().
std::string asprintf | ( | const char * | fmt, |
... | |||
) |
Definition at line 1513 of file utils.cc.
References vasprintf().
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().
|
static |
Definition at line 1311 of file utils.cc.
References warning_with_id().
Referenced by Fcell(), fill_matrix(), and get_dimensions().
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().
octave_idx_type dims_to_numel | ( | const dim_vector & | dims, |
const octave_value_list & | idx_arg | ||
) |
Definition at line 1404 of file utils.cc.
References error(), octave_value::index_vector(), octave_value::is_magic_colon(), octave_value::isnumeric(), len, idx_vector::length(), octave_value_list::length(), dim_vector::numel(), octave_value::numel(), and dim_vector::redim().
Referenced by Fnumel(), and octave_base_value::xnumel().
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().
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 | ||
) |
Definition at line 1663 of file utils.cc.
References octave_value::cell_value(), Array< T, Alloc >::dims(), error(), octave_value::iscell(), octave_value_list::length(), n, numel(), Array< T, Alloc >::numel(), OCTAVE_LOCAL_BUFFER, and octave_value_list::resize().
Referenced by do_simple_cellfun(), Fstrfind(), and Fstrrep().
std::string do_string_escapes | ( | const std::string & | s | ) |
Definition at line 804 of file utils.cc.
References len, min(), and warning().
Referenced by Fdlmread(), Fdo_string_escapes(), stream::oscanf(), textscan::parse_options(), stream::printf(), stream::scanf(), and textscan_internal().
OCTAVE_EXPORT octave_value_list F__make_valid_name__ | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 266 of file utils.cc.
References Array< T, Alloc >::dims(), error(), make_valid_name(), Array< T, Alloc >::numel(), ovl(), and print_usage().
std::string fcn_file_in_path | ( | const std::string & | name | ) |
Definition at line 742 of file utils.cc.
References __get_load_path__(), absolute_pathname(), load_path::find_fcn_file(), and len.
Referenced by do_dbtype(), tree_evaluator::echo(), get_help_from_file(), and octave_user_function::mark_as_system_fcn_file().
OCTAVE_EXPORT octave_value_list Fdir_in_loadpath | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 1193 of file utils.cc.
References load_path::find_dir(), load_path::find_matching_dirs(), ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fdo_string_escapes | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 938 of file utils.cc.
References do_string_escapes(), ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Ferrno | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 1247 of file utils.cc.
References octave_errno::get(), octave_errno::lookup(), print_usage(), octave_errno::set(), and octave_value::string_value().
OCTAVE_EXPORT octave_value_list Ferrno_list | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 1297 of file utils.cc.
References octave_errno::list(), ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Ffile_in_loadpath | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 569 of file utils.cc.
References string_vector::empty(), error(), load_path::find_all_first_of(), load_path::find_first_of(), make_absolute(), ovl(), and print_usage().
Referenced by main_window::handle_edit_mfile_request().
OCTAVE_EXPORT octave_value_list Ffile_in_path | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 642 of file utils.cc.
References string_vector::empty(), error(), make_absolute(), ovl(), print_usage(), search_path_for_all_files(), and search_path_for_file().
std::string file_in_path | ( | const std::string & | name, |
const std::string & | suffix | ||
) |
Definition at line 691 of file utils.cc.
References __get_load_path__(), load_path::find_file(), and make_absolute().
Referenced by interpreter::execute_startup_files(), and symbol_exist().
std::string find_data_file_in_load_path | ( | const std::string & | fcn, |
const std::string & | file, | ||
bool | require_regular_file | ||
) |
Definition at line 703 of file utils.cc.
References __get_load_path__(), absolute_pathname(), load_path::find_file(), make_absolute(), and warn_data_file_in_path().
Referenced by do_stream_open(), Fdlmread(), and find_file_to_load().
OCTAVE_EXPORT octave_value_list Fis_absolute_filename | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 1109 of file utils.cc.
References absolute_pathname(), ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fis_rooted_relative_filename | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 1130 of file utils.cc.
References ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fis_same_file | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 322 of file utils.cc.
References octave_value::cellstr_value(), Array< T, Alloc >::dims(), error(), octave_value::is_string(), Array< T, Alloc >::numel(), print_usage(), same_file(), and octave_value::string_value().
OCTAVE_EXPORT octave_value_list Fisindex | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 1620 of file utils.cc.
References idx_vector::extent(), n, and print_usage().
OCTAVE_EXPORT octave_value_list Fisstudent | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 1751 of file utils.cc.
References ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fisvarname | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 103 of file utils.cc.
References iskeyword(), print_usage(), octave_value::string_value(), and valid_identifier().
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 | |||
) |
Definition at line 1155 of file utils.cc.
References make_absolute(), ovl(), and print_usage().
std::size_t format | ( | std::ostream & | os, |
const char * | fmt, | ||
... | |||
) |
Definition at line 1473 of file utils.cc.
References vformat().
Referenced by Table::columnformat(), symbol_info_accumulator::display(), symbol_info_list::display(), do_printf_conv(), variable_editor_stack::do_save(), F__magick_finfo__(), Faudiodevinfo(), formatComplex(), opengl_functions::glDrawPixels(), opengl_functions::glReadPixels(), opengl_functions::glTexImage2D(), itemFor(), load_save_system::load(), symbol_info_list::parse_whos_line_format(), qStringValueFor(), load_save_system::save(), variable_editor_stack::save(), load_save_system::save_header_format_string(), documentation::select_all_occurrences(), set_format_style(), Table::updateColumnname(), Table::updateData(), Table::updateDataColumn(), and Table::updateRowname().
OCTAVE_EXPORT octave_value_list Fundo_string_escapes | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 1072 of file utils.cc.
References ovl(), print_usage(), and undo_string_escapes().
void get_dimensions | ( | const octave_value & | a, |
const char * | warn_for, | ||
dim_vector & | dim | ||
) |
Definition at line 1342 of file utils.cc.
References check_dimensions(), octave_value::dims(), error(), dim_vector::isvector(), n, dim_vector::numel(), Array< T, Alloc >::numel(), octave_value::octave_idx_type_vector_value(), and dim_vector::resize().
Referenced by Fcell(), Feye(), fill_matrix(), and Fsparse().
void get_dimensions | ( | const octave_value & | a, |
const char * | warn_for, | ||
octave_idx_type & | nr, | ||
octave_idx_type & | nc | ||
) |
Definition at line 1371 of file utils.cc.
References check_dimensions(), octave_value::columns(), error(), octave_value::idx_type_value(), octave_value::is_scalar_type(), octave_value::octave_idx_type_vector_value(), and octave_value::rows().
void get_dimensions | ( | const octave_value & | a, |
const octave_value & | b, | ||
const char * | warn_for, | ||
octave_idx_type & | nr, | ||
octave_idx_type & | nc | ||
) |
Definition at line 1394 of file utils.cc.
References check_dimensions(), octave_value::idx_type_value(), and octave_value::isempty().
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 | ||
) |
Definition at line 423 of file utils.cc.
References almost_match(), and strsave().
Referenced by set_DASPK_options(), set_DASRT_options(), set_DASSL_options(), set_LSODE_options(), set_Quad_options(), show_DASPK_options(), show_DASRT_options(), show_DASSL_options(), show_LSODE_options(), and show_Quad_options().
|
static |
Definition at line 536 of file utils.cc.
References len, and string_vector::numel().
Referenced by bp_file_info::bp_file_info(), tree_evaluator::check_autoload_file(), contents_file_in_path(), history_system::default_file(), tree_evaluator::echo(), interpreter::execute_startup_files(), F__parse_file__(), Ffile_in_loadpath(), Ffile_in_path(), file_in_path(), find_data_file_in_load_path(), Fmake_absolute_filename(), Furlwrite(), file_editor::handle_file_remove(), load_fcn_from_file(), qt_interpreter_events::prompt_new_edit_file(), read_mat5_binary_element(), search_path_for_all_files(), search_path_for_file(), tree_evaluator::source_file(), and file_stat::update_internal().
bool make_valid_name | ( | std::string & | str, |
const make_valid_name_options & | options | ||
) |
Modify str
to be a valid variable name.
str | input string |
options | see also help matlab.lang.makeValidName . |
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__().
bool same_file | ( | const std::string & | f, |
const std::string & | g | ||
) |
Definition at line 294 of file utils.cc.
References f, and same_file_internal().
Referenced by load_path::contains_canonical(), load_path::contains_file_in_dir(), interpreter::execute_startup_files(), file_editor::find_tab_widget(), Fis_same_file(), out_of_date_check(), and load_path::remove().
string_vector search_path_for_all_files | ( | const std::string & | path, |
const string_vector & | names | ||
) |
Definition at line 521 of file utils.cc.
References directory_path::find_all_first_of(), len, make_absolute(), string_vector::numel(), and string_vector::std_list().
Referenced by Ffile_in_path().
std::string search_path_for_file | ( | const std::string & | path, |
const string_vector & | names | ||
) |
Definition at line 511 of file utils.cc.
References directory_path::find_first_of(), make_absolute(), and string_vector::std_list().
Referenced by Ffile_in_path(), and have_gnuplot_binary().
void sleep | ( | double | seconds, |
bool | do_graphics_events | ||
) |
Definition at line 1532 of file utils.cc.
References __get_gh_manager__(), flush_stdout(), isinf(), kbhit(), and octave_nanosleep_wrapper().
Referenced by Fpause(), Fwaitfor(), debugger::server_loop(), and tree_evaluator::server_loop().
const char* undo_string_escape | ( | char | c | ) |
Definition at line 986 of file utils.cc.
Referenced by octave_lex(), and undo_string_escapes().
std::string undo_string_escapes | ( | const std::string & | s | ) |
Definition at line 1033 of file utils.cc.
References undo_string_escape().
Referenced by octave_char_matrix_str::edit_display(), Fundo_string_escapes(), base_parser::make_constant(), octave_print_internal(), scanf_format_list::printme(), printf_format_list::printme(), and textscan_format_list::printme().
bool valid_identifier | ( | const char * | s | ) |
Definition at line 78 of file utils.cc.
Referenced by make_valid_name_options::make_valid_name_options(), tree_evaluator::assignin(), file_editor_tab::check_valid_identifier(), Farrayfun(), Fcellfun(), Fdisplay(), Fisvarname(), load_path::dir_info::get_file_list(), hdf5_read_next_data_internal(), make_valid_name(), maybe_warn_invalid_field_name(), read_mat_ascii_data(), read_text_data(), main_window::run_file_in_terminal(), and valid_identifier().
bool valid_identifier | ( | const std::string & | s | ) |
Definition at line 90 of file utils.cc.
References valid_identifier().
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().
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().