GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#include <map>
#include <string>
#include "lo-error.h"
#include "oct-env.h"
#include "oct-passwd.h"
#include "str-vec.h"
#include <cstdio>
#include <cstdarg>
#include <cstdlib>
#include <cerrno>
#include <cassert>
#include <sys/types.h>
#include <unistd.h>
#include "sysdir.h"
#include "statdefs.h"
#include <cctype>
#include <ctime>
Go to the source code of this file.
Classes | |
struct | cache_entry |
struct | hash_element_type |
struct | hash_table_type |
struct | kpse_format_info_type |
class | kpse_path_iterator |
struct | str_llist_elt |
Macros | |
#define | _POSIX_NAME_MAX 255 |
#define | _POSIX_PATH_MAX 255 |
#define | brace_whitespace(c) (! (c) || (c) == ' ' || (c) == '\t' || (c) == '\n') |
#define | DEBUGF(str) DEBUGF_START (); gnulib::fputs (str, stderr); DEBUGF_END () |
#define | DEBUGF1(str, e1) DEBUGF_START (); gnulib::fprintf (stderr, str, e1); DEBUGF_END () |
#define | DEBUGF2(str, e1, e2) DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2); DEBUGF_END () |
#define | DEBUGF3(str, e1, e2, e3) DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2, e3); DEBUGF_END () |
#define | DEBUGF4(str, e1, e2, e3, e4) DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2, e3, e4); DEBUGF_END () |
#define | DEBUGF_END() gnulib::fflush (stderr); } while (0) |
#define | DEBUGF_START() do { gnulib::fputs ("kdebug:", stderr) |
#define | DIR_SEP '/' |
#define | DIR_SEP_STRING "/" |
#define | ENV_SEP ':' |
#define | ENV_SEP_STRING ":" |
#define | EXPAND_DEFAULT(try_path, source_string) |
#define | FATAL(str) |
#define | FATAL_PERROR(str) |
#define | IS_DEVICE_SEP(ch) 0 |
#define | IS_DIR_SEP(ch) ((ch) == DIR_SEP) |
#define | IS_ENV_SEP(ch) ((ch) == ENV_SEP) |
#define | IS_VAR_BEGIN_DELIMITER(c) ((c) == '{') |
#define | IS_VAR_CHAR(c) (isalnum (c) || (c) == '_') |
#define | IS_VAR_END_DELIMITER(c) ((c) == '}') |
#define | IS_VAR_START(c) ((c) == '$') |
#define | KPATHSEA 32 |
#define | KPSE_DEBUG |
#define | KPSE_DEBUG_EXPAND 4 /* path element expansion */ |
#define | KPSE_DEBUG_FOPEN 2 /* fopen/fclose calls */ |
#define | KPSE_DEBUG_HASH 1 /* hash lookups */ |
#define | KPSE_DEBUG_P(bit) (kpathsea_debug & (1 << (bit))) |
#define | KPSE_DEBUG_PATHS 3 /* search path initializations */ |
#define | KPSE_DEBUG_SEARCH 5 /* searches */ |
#define | KPSE_DEBUG_STAT 0 /* stat calls */ |
#define | KPSE_DEBUG_VARS 6 /* variable values */ |
#define | KPSE_LAST_DEBUG KPSE_DEBUG_VARS |
#define | NAME_BEGINS_WITH_DEVICE(name) 0 |
#define | NAME_MAX _POSIX_NAME_MAX |
#define | PATH_MAX _POSIX_PATH_MAX |
#define | ST_NLINK_TRICK |
#define | STR_LLIST(sl) ((sl).str) |
#define | STR_LLIST_MOVED(sl) ((sl).moved) |
#define | STR_LLIST_NEXT(sl) ((sl).next) |
Typedefs | |
typedef str_llist_elt | str_llist_elt_type |
typedef str_llist_elt * | str_llist_type |
Functions | |
static string_vector | absolute_search (const std::string &name) |
static string_vector | array_concat (const string_vector &arr1, const string_vector &arr2) |
static string_vector | brace_expand (const std::string &) |
static int | brace_gobbler (const std::string &, int &, int) |
static void | cache (const std::string key, str_llist_type *value) |
static str_llist_type * | cached (const std::string &key) |
static void | checked_dir_list_add (str_llist_type *l, const std::string &dir) |
static int | dir_links (const std::string &fn) |
static void | dir_list_add (str_llist_type *l, const std::string &dir) |
static string_vector | dir_list_search (str_llist_type *dirs, const std::string &name, bool search_all) |
static bool | dir_p (const std::string &fn) |
static void | do_subdir (str_llist_type *str_list_ptr, const std::string &elt, unsigned elt_length, const std::string &post) |
static bool | elt_in_db (const std::string &db_dir, const std::string &path_elt) |
static void | expand (std::string &expansion, const std::string &var) |
static string_vector | expand_amble (const std::string &) |
static void | expand_elt (str_llist_type *, const std::string &, unsigned) |
static void | expanding (const std::string &var, bool xp) |
static bool | expanding_p (const std::string &var) |
static string_vector | find_first_of (const std::string &path, const string_vector &names, bool must_exist, bool all) |
static string_vector | hash_lookup (hash_table_type table, const std::string &key) |
static bool | kpse_absolute_p (const std::string &filename, int relative_ok) |
static string_vector | kpse_all_path_find_first_of (const std::string &path, const string_vector &names) |
static string_vector | kpse_all_path_search (const std::string &path, const std::string &name) |
static std::string | kpse_brace_expand (const std::string &path) |
static std::string | kpse_brace_expand_element (const std::string &elt) |
static string_vector | kpse_db_search (const std::string &name, const std::string &path_elt, bool all) |
static str_llist_type * | kpse_element_dirs (const std::string &elt) |
static std::string | kpse_expand (const std::string &s) |
static std::string | kpse_expand_default (const std::string &path, const std::string &dflt) |
static std::string | kpse_expand_kpse_dot (const std::string &path) |
static unsigned | kpse_hash (hash_table_type table, const std::string &key) |
static bool | kpse_is_env_sep (char c) |
static std::string | kpse_path_expand (const std::string &path) |
static std::string | kpse_path_find_first_of (const std::string &path, const string_vector &names, bool must_exist) |
static std::string | kpse_path_search (const std::string &path, const std::string &name, bool must_exist) |
static std::string | kpse_readable_file (const std::string &name) |
static std::string | kpse_tilde_expand (const std::string &name) |
static std::string | kpse_truncate_filename (const std::string &name) |
static std::string | kpse_var_expand (const std::string &src) |
static std::string | kpse_var_value (const std::string &var) |
static void | log_search (const string_vector &filenames) |
static bool | match (const std::string &filename_arg, const std::string &path_elt_arg) |
static string_vector | path_find_first_of (const std::string &path, const string_vector &names, bool, bool all) |
static string_vector | path_search (const std::string &path, const std::string &name, bool, bool all) |
static bool | READABLE (const std::string &fn, struct stat &st) |
static string_vector | search (const std::string &path, const std::string &original_name, bool must_exist, bool all) |
static void | str_llist_add (str_llist_type *l, const std::string &str) |
static void | str_llist_float (str_llist_type *l, str_llist_elt_type *mover) |
static void | xclosedir (DIR *d) |
static FILE * | xfopen (const std::string &filename, const char *mode) |
Variables | |
static hash_table_type | alias_db |
static int | brace_arg_separator = ',' |
static unsigned | cache_length = 0 |
static hash_table_type | db |
static string_vector | db_dir_list |
static std::map< std::string, bool > | expansions |
static bool | first_search = true |
static unsigned int | kpathsea_debug = 0 |
static kpse_format_info_type | kpse_format_info |
static cache_entry * | the_cache = 0 |
#define brace_whitespace | ( | c | ) | (! (c) || (c) == ' ' || (c) == '\t' || (c) == '\n') |
Definition at line 1487 of file kpse.cc.
Referenced by brace_gobbler().
#define DEBUGF | ( | str | ) | DEBUGF_START (); gnulib::fputs (str, stderr); DEBUGF_END () |
#define DEBUGF1 | ( | str, | |
e1 | |||
) | DEBUGF_START (); gnulib::fprintf (stderr, str, e1); DEBUGF_END () |
Definition at line 222 of file kpse.cc.
Referenced by hash_lookup(), kpse_element_dirs(), and search().
#define DEBUGF2 | ( | str, | |
e1, | |||
e2 | |||
) | DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2); DEBUGF_END () |
Definition at line 224 of file kpse.cc.
Referenced by dir_links(), and kpse_var_value().
#define DEBUGF3 | ( | str, | |
e1, | |||
e2, | |||
e3 | |||
) | DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2, e3); DEBUGF_END () |
Definition at line 226 of file kpse.cc.
Referenced by kpse_db_search(), and xfopen().
#define DEBUGF4 | ( | str, | |
e1, | |||
e2, | |||
e3, | |||
e4 | |||
) | DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2, e3, e4); DEBUGF_END () |
#define DEBUGF_START | ( | ) | do { gnulib::fputs ("kdebug:", stderr) |
#define DIR_SEP_STRING "/" |
Definition at line 111 of file kpse.cc.
Referenced by dir_list_add(), do_subdir(), and kpse_expand_kpse_dot().
#define ENV_SEP ':' |
Definition at line 170 of file kpse.cc.
Referenced by expand_amble(), and kpse_path_expand().
#define ENV_SEP_STRING ":" |
Definition at line 171 of file kpse.cc.
Referenced by kpse_brace_expand(), kpse_brace_expand_element(), kpse_expand_kpse_dot(), and kpse_path_expand().
#define EXPAND_DEFAULT | ( | try_path, | |
source_string | |||
) |
#define FATAL | ( | str | ) |
Definition at line 293 of file kpse.cc.
Referenced by xclosedir().
#define FATAL_PERROR | ( | str | ) |
#define IS_DEVICE_SEP | ( | ch | ) | 0 |
Definition at line 119 of file kpse.cc.
Referenced by dir_list_add(), do_subdir(), kpse_absolute_p(), and kpse_truncate_filename().
#define IS_DIR_SEP | ( | ch | ) | ((ch) == DIR_SEP) |
Definition at line 116 of file kpse.cc.
Referenced by dir_list_add(), do_subdir(), expand_elt(), kpse_absolute_p(), kpse_expand_kpse_dot(), kpse_path_expand(), kpse_tilde_expand(), kpse_truncate_filename(), match(), path_find_first_of(), and path_search().
#define IS_ENV_SEP | ( | ch | ) | ((ch) == ENV_SEP) |
Definition at line 176 of file kpse.cc.
Referenced by kpse_expand_default(), and kpse_is_env_sep().
#define IS_VAR_BEGIN_DELIMITER | ( | c | ) | ((c) == '{') |
Definition at line 2573 of file kpse.cc.
Referenced by kpse_var_expand().
#define IS_VAR_CHAR | ( | c | ) | (isalnum (c) || (c) == '_') |
Definition at line 2570 of file kpse.cc.
Referenced by kpse_var_expand().
#define IS_VAR_END_DELIMITER | ( | c | ) | ((c) == '}') |
Definition at line 2576 of file kpse.cc.
Referenced by kpse_var_expand().
#define IS_VAR_START | ( | c | ) | ((c) == '$') |
Definition at line 2567 of file kpse.cc.
Referenced by kpse_var_expand().
#define KPSE_DEBUG_EXPAND 4 /* path element expansion */ |
Definition at line 211 of file kpse.cc.
Referenced by kpse_element_dirs().
#define KPSE_DEBUG_FOPEN 2 /* fopen/fclose calls */ |
#define KPSE_DEBUG_HASH 1 /* hash lookups */ |
Definition at line 208 of file kpse.cc.
Referenced by hash_lookup().
#define KPSE_DEBUG_P | ( | bit | ) | (kpathsea_debug & (1 << (bit))) |
Definition at line 205 of file kpse.cc.
Referenced by dir_links(), find_first_of(), hash_lookup(), kpse_db_search(), kpse_element_dirs(), kpse_var_value(), log_search(), search(), and xfopen().
#define KPSE_DEBUG_PATHS 3 /* search path initializations */ |
#define KPSE_DEBUG_SEARCH 5 /* searches */ |
Definition at line 212 of file kpse.cc.
Referenced by find_first_of(), kpse_db_search(), log_search(), and search().
#define KPSE_DEBUG_STAT 0 /* stat calls */ |
Definition at line 207 of file kpse.cc.
Referenced by dir_links().
#define KPSE_DEBUG_VARS 6 /* variable values */ |
Definition at line 213 of file kpse.cc.
Referenced by kpse_var_value().
#define KPSE_LAST_DEBUG KPSE_DEBUG_VARS |
#define NAME_BEGINS_WITH_DEVICE | ( | name | ) | 0 |
Definition at line 122 of file kpse.cc.
Referenced by kpse_path_expand(), path_find_first_of(), and path_search().
#define NAME_MAX _POSIX_NAME_MAX |
Definition at line 156 of file kpse.cc.
Referenced by kpse_truncate_filename().
#define PATH_MAX _POSIX_PATH_MAX |
Definition at line 194 of file kpse.cc.
Referenced by octave_canonicalize_file_name(), and KPty::open().
#define STR_LLIST | ( | sl | ) | ((sl).str) |
Definition at line 326 of file kpse.cc.
Referenced by dir_path::all_directories(), dir_list_search(), kpse_element_dirs(), kpse_path_expand(), path_find_first_of(), and str_llist_add().
#define STR_LLIST_MOVED | ( | sl | ) | ((sl).moved) |
Definition at line 327 of file kpse.cc.
Referenced by str_llist_add(), and str_llist_float().
#define STR_LLIST_NEXT | ( | sl | ) | ((sl).next) |
Definition at line 328 of file kpse.cc.
Referenced by dir_path::all_directories(), dir_list_search(), kpse_element_dirs(), kpse_path_expand(), path_find_first_of(), str_llist_add(), and str_llist_float().
typedef str_llist_elt str_llist_elt_type |
typedef str_llist_elt* str_llist_type |
|
static |
Definition at line 770 of file kpse.cc.
References string_vector::append(), and kpse_readable_file().
Referenced by find_first_of(), and search().
|
static |
Definition at line 1504 of file kpse.cc.
References string_vector::empty(), and Array< T >::length().
Referenced by brace_expand().
|
static |
Definition at line 1533 of file kpse.cc.
References array_concat(), brace_gobbler(), and expand_amble().
Referenced by expand_amble(), and kpse_brace_expand_element().
Definition at line 1613 of file kpse.cc.
References brace_whitespace.
Referenced by brace_expand(), and expand_amble().
|
static |
Definition at line 2101 of file kpse.cc.
References cache_length, cache_entry::key, the_cache, and cache_entry::value.
Referenced by kpse_element_dirs().
|
static |
Definition at line 2124 of file kpse.cc.
References cache_length, and cache_entry::value.
Referenced by kpse_element_dirs().
|
static |
Definition at line 2069 of file kpse.cc.
References dir_list_add(), and dir_p().
Referenced by expand_elt().
|
static |
Definition at line 2159 of file kpse.cc.
References DEBUGF2, KPSE_DEBUG_P, KPSE_DEBUG_STAT, and stat().
Referenced by do_subdir().
|
static |
Definition at line 2039 of file kpse.cc.
References DIR_SEP_STRING, IS_DEVICE_SEP, IS_DIR_SEP, and str_llist_add().
Referenced by checked_dir_list_add(), and do_subdir().
|
static |
Definition at line 737 of file kpse.cc.
References string_vector::append(), kpse_readable_file(), STR_LLIST, str_llist_float(), and STR_LLIST_NEXT.
Referenced by path_find_first_of(), and path_search().
|
static |
|
static |
Definition at line 2188 of file kpse.cc.
References dir_links(), dir_list_add(), DIR_SEP_STRING, dirent, expand_elt(), IS_DEVICE_SEP, IS_DIR_SEP, and xclosedir().
Referenced by expand_elt().
|
static |
Definition at line 1815 of file kpse.cc.
Referenced by kpse_db_search().
|
static |
Definition at line 2541 of file kpse.cc.
References expanding(), expanding_p(), octave_env::getenv(), and kpse_var_expand().
Referenced by kpse_var_expand().
|
static |
Definition at line 1578 of file kpse.cc.
References string_vector::append(), brace_expand(), brace_gobbler(), c1, string_vector::empty(), ENV_SEP, and Array< T >::length().
Referenced by brace_expand().
|
static |
Definition at line 2332 of file kpse.cc.
References checked_dir_list_add(), do_subdir(), and IS_DIR_SEP.
Referenced by do_subdir(), and kpse_element_dirs().
|
static |
|
static |
Definition at line 1070 of file kpse.cc.
References absolute_search(), string_vector::empty(), kpse_absolute_p(), KPSE_DEBUG_P, KPSE_DEBUG_SEARCH, Array< T >::length(), log_search(), and path_find_first_of().
Referenced by kpse_all_path_find_first_of(), and kpse_path_find_first_of().
|
static |
Definition at line 411 of file kpse.cc.
References string_vector::append(), hash_table_type::buckets, DEBUGF1, string_vector::empty(), hash_element_type::key, KPSE_DEBUG_HASH, KPSE_DEBUG_P, kpse_hash(), Array< T >::length(), hash_element_type::next, and hash_element_type::value.
Referenced by kpse_db_search().
Definition at line 645 of file kpse.cc.
References IS_DEVICE_SEP, and IS_DIR_SEP.
Referenced by find_first_of(), kpse_expand_kpse_dot(), log_search(), and search().
|
static |
Definition at line 1173 of file kpse.cc.
References find_first_of().
Referenced by dir_path::find_all_first_of().
|
static |
|
static |
Definition at line 1369 of file kpse.cc.
References ENV_SEP_STRING, kpse_brace_expand_element(), kpse_expand_kpse_dot(), and kpse_var_expand().
Referenced by kpse_path_expand().
|
static |
Definition at line 1334 of file kpse.cc.
References brace_expand(), ENV_SEP_STRING, expansions, kpse_expand(), Array< T >::length(), and x.
Referenced by kpse_brace_expand().
|
static |
Definition at line 1849 of file kpse.cc.
References string_vector::append(), hash_table_type::buckets, DEBUGF3, elt_in_db(), hash_lookup(), KPSE_DEBUG_P, KPSE_DEBUG_SEARCH, kpse_readable_file(), Array< T >::length(), match(), and string_vector::resize().
Referenced by path_find_first_of(), and path_search().
|
static |
Definition at line 2384 of file kpse.cc.
References cache(), cached(), DEBUGF1, expand_elt(), KPSE_DEBUG_EXPAND, KPSE_DEBUG_P, STR_LLIST, and STR_LLIST_NEXT.
Referenced by dir_path::all_directories(), kpse_path_expand(), path_find_first_of(), and path_search().
|
static |
Definition at line 1280 of file kpse.cc.
References kpse_tilde_expand(), and kpse_var_expand().
Referenced by kpse_brace_expand_element(), and search().
|
static |
|
static |
Definition at line 1293 of file kpse.cc.
References DIR_SEP_STRING, ENV_SEP_STRING, octave_env::getenv(), IS_DIR_SEP, and kpse_absolute_p().
Referenced by kpse_brace_expand().
|
static |
Definition at line 394 of file kpse.cc.
References hash_table_type::size.
Referenced by hash_lookup().
Definition at line 349 of file kpse.cc.
References IS_ENV_SEP.
Referenced by kpse_path_iterator::next(), and kpse_path_iterator::set_end().
|
static |
Definition at line 1406 of file kpse.cc.
References ENV_SEP, ENV_SEP_STRING, IS_DIR_SEP, kpse_brace_expand(), kpse_element_dirs(), NAME_BEGINS_WITH_DEVICE, STR_LLIST, and STR_LLIST_NEXT.
Referenced by dir_path::init().
|
static |
Definition at line 1157 of file kpse.cc.
References string_vector::empty(), and find_first_of().
Referenced by dir_path::find_first_of().
|
static |
Definition at line 937 of file kpse.cc.
References string_vector::empty(), and search().
Referenced by dir_path::find_first().
|
static |
Definition at line 600 of file kpse.cc.
References kpse_truncate_filename(), READABLE(), and stat().
Referenced by absolute_search(), dir_list_search(), and kpse_db_search().
|
static |
Definition at line 1189 of file kpse.cc.
References octave_passwd::dir(), octave_env::getenv(), octave_passwd::getpwnam(), and IS_DIR_SEP.
Referenced by kpse_expand().
|
static |
Definition at line 538 of file kpse.cc.
References IS_DEVICE_SEP, IS_DIR_SEP, and NAME_MAX.
Referenced by kpse_readable_file().
|
static |
Definition at line 2583 of file kpse.cc.
References expand(), IS_VAR_BEGIN_DELIMITER, IS_VAR_CHAR, IS_VAR_END_DELIMITER, and IS_VAR_START.
Referenced by expand(), kpse_brace_expand(), kpse_expand(), and kpse_var_value().
|
static |
Definition at line 516 of file kpse.cc.
References DEBUGF2, octave_env::getenv(), KPSE_DEBUG_P, KPSE_DEBUG_VARS, and kpse_var_expand().
Referenced by log_search().
|
static |
Definition at line 683 of file kpse.cc.
References string_vector::empty(), kpse_absolute_p(), KPSE_DEBUG_P, KPSE_DEBUG_SEARCH, kpse_var_value(), Array< T >::length(), and xfopen().
Referenced by find_first_of(), and search().
|
static |
Definition at line 1734 of file kpse.cc.
References IS_DIR_SEP.
Referenced by Array< T >::assign(), dim_vector::concat(), do_find_bkpt_list(), ft_manager::do_get_font(), do_numeric_lookup(), radio_property::do_set(), color_property::do_set(), double_radio_property::do_set(), extract_keyword(), Fblkmm(), Fdot(), Flookup(), find_files_dialog::is_match(), kpse_db_search(), tree_switch_case::label_matches(), and glob_match::match().
|
static |
Definition at line 962 of file kpse.cc.
References string_vector::append(), dir_list_search(), string_vector::empty(), IS_DIR_SEP, kpse_db_search(), kpse_element_dirs(), Array< T >::length(), NAME_BEGINS_WITH_DEVICE, STR_LLIST, str_llist_add(), and STR_LLIST_NEXT.
Referenced by find_first_of().
|
static |
Definition at line 786 of file kpse.cc.
References string_vector::append(), dir_list_search(), string_vector::empty(), IS_DIR_SEP, kpse_db_search(), kpse_element_dirs(), and NAME_BEGINS_WITH_DEVICE.
Referenced by search().
|
static |
Definition at line 872 of file kpse.cc.
References absolute_search(), DEBUGF1, DEBUGF4, kpse_absolute_p(), KPSE_DEBUG_P, KPSE_DEBUG_SEARCH, kpse_expand(), log_search(), and path_search().
Referenced by kpse_all_path_search(), and kpse_path_search().
|
static |
Definition at line 2442 of file kpse.cc.
References STR_LLIST, STR_LLIST_MOVED, and STR_LLIST_NEXT.
Referenced by dir_list_add(), and path_find_first_of().
|
static |
Definition at line 2468 of file kpse.cc.
References STR_LLIST_MOVED, and STR_LLIST_NEXT.
Referenced by dir_list_search().
|
static |
|
static |
Definition at line 358 of file kpse.cc.
References DEBUGF3, f, FATAL_PERROR, KPSE_DEBUG_FOPEN, and KPSE_DEBUG_P.
Referenced by log_search().
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 2520 of file kpse.cc.
Referenced by kpse_brace_expand_element().
|
static |
Definition at line 234 of file kpse.cc.
Referenced by dir_path::init().
|
static |
|
static |