GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
kpse.cc File Reference
#include <cctype>
#include <cerrno>
#include <cstdlib>
#include <map>
#include <fstream>
#include <iostream>
#include <string>
#include "dir-ops.h"
#include "file-ops.h"
#include "file-stat.h"
#include "kpse.h"
#include "oct-env.h"
#include "oct-password.h"
#include "oct-time.h"
#include "pathsearch.h"
#include "unistd-wrappers.h"
Include dependency graph for kpse.cc:

Go to the source code of this file.

Macros

#define brace_whitespace(c)   (! (c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
 
#define DIR_SEP_STRING   octave::sys::file_ops::dir_sep_str ()
 
#define ENV_SEP   octave::directory_path::path_sep_char ()
 
#define ENV_SEP_STRING   octave::directory_path::path_sep_str ()
 
#define IS_DEVICE_SEP(ch)   octave::sys::file_ops::is_dev_sep (ch)
 
#define IS_DIR_SEP(ch)   octave::sys::file_ops::is_dir_sep (ch)
 
#define IS_ENV_SEP(ch)   octave::directory_path::is_path_sep (ch)
 
#define KPSE_DEBUG
 
#define KPSE_DEBUG_EXPAND   1
 
#define KPSE_DEBUG_P(bit)   (kpse_debug & (1 << (bit)))
 
#define KPSE_DEBUG_SEARCH   2
 
#define KPSE_DEBUG_STAT   0
 
#define KPSE_DEBUG_VARS   3
 
#define KPSE_LAST_DEBUG   KPSE_DEBUG_VARS
 
#define NAME_BEGINS_WITH_DEVICE(name)    (name.length () > 0 && IS_DEVICE_SEP ((name)[1]))
 

Functions

static std::list< std::string > absolute_search (const std::string &name)
 
static std::list< std::string > array_concat (const std::list< std::string > &arr1, const std::list< std::string > &arr2)
 
static std::list< std::string > brace_expand (const std::string &text)
 
static int brace_gobbler (const std::string &, int &, int)
 
static bool dir_p (const std::string &fn)
 
static std::list< std::string > dir_search (const std::string &dir, const std::string &name, bool search_all)
 
static std::list< std::string > expand_amble (const std::string &)
 
static std::list< std::string > find_first_of (const std::string &path, const std::list< std::string > &names, bool all)
 
static bool kpse_absolute_p (const std::string &filename, int relative_ok)
 
std::list< std::string > kpse_all_path_find_first_of (const std::string &path, const std::list< std::string > &names)
 
std::list< std::string > kpse_all_path_search (const std::string &path, const std::string &name)
 
std::string kpse_element_dir (const std::string &elt)
 
std::string kpse_path_expand (const std::string &path)
 
std::string kpse_path_find_first_of (const std::string &path, const std::list< std::string > &names)
 
std::string kpse_path_search (const std::string &path, const std::string &name)
 
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 void log_search (const std::list< std::string > &filenames)
 
std::list< std::string > path_find_first_of (const std::string &path, const std::list< std::string > &names, bool all)
 
static std::list< std::string > path_search (const std::string &path, const std::string &name, bool all)
 
static bool READABLE (const std::string &fn)
 
static std::list< std::string > search (const std::string &path, const std::string &original_name, bool all)
 

Variables

static int brace_arg_separator = ','
 
static bool first_search = true
 
unsigned int kpse_debug = 0
 

Macro Definition Documentation

◆ brace_whitespace

#define brace_whitespace (   c)    (! (c) || (c) == ' ' || (c) == '\t' || (c) == '\n')

Definition at line 827 of file kpse.cc.

◆ DIR_SEP_STRING

#define DIR_SEP_STRING   octave::sys::file_ops::dir_sep_str ()

Definition at line 68 of file kpse.cc.

◆ ENV_SEP

#define ENV_SEP   octave::directory_path::path_sep_char ()

Definition at line 71 of file kpse.cc.

◆ ENV_SEP_STRING

#define ENV_SEP_STRING   octave::directory_path::path_sep_str ()

Definition at line 72 of file kpse.cc.

◆ IS_DEVICE_SEP

#define IS_DEVICE_SEP (   ch)    octave::sys::file_ops::is_dev_sep (ch)

Definition at line 64 of file kpse.cc.

◆ IS_DIR_SEP

#define IS_DIR_SEP (   ch)    octave::sys::file_ops::is_dir_sep (ch)

Definition at line 69 of file kpse.cc.

◆ IS_ENV_SEP

#define IS_ENV_SEP (   ch)    octave::directory_path::is_path_sep (ch)

Definition at line 73 of file kpse.cc.

◆ KPSE_DEBUG

#define KPSE_DEBUG

Definition at line 79 of file kpse.cc.

◆ KPSE_DEBUG_EXPAND

#define KPSE_DEBUG_EXPAND   1

Definition at line 85 of file kpse.cc.

◆ KPSE_DEBUG_P

#define KPSE_DEBUG_P (   bit)    (kpse_debug & (1 << (bit)))

Definition at line 82 of file kpse.cc.

◆ KPSE_DEBUG_SEARCH

#define KPSE_DEBUG_SEARCH   2

Definition at line 86 of file kpse.cc.

◆ KPSE_DEBUG_STAT

#define KPSE_DEBUG_STAT   0

Definition at line 84 of file kpse.cc.

◆ KPSE_DEBUG_VARS

#define KPSE_DEBUG_VARS   3

Definition at line 87 of file kpse.cc.

◆ KPSE_LAST_DEBUG

#define KPSE_LAST_DEBUG   KPSE_DEBUG_VARS

Definition at line 88 of file kpse.cc.

◆ NAME_BEGINS_WITH_DEVICE

#define NAME_BEGINS_WITH_DEVICE (   name)     (name.length () > 0 && IS_DEVICE_SEP ((name)[1]))

Definition at line 65 of file kpse.cc.

Function Documentation

◆ absolute_search()

static std::list<std::string> absolute_search ( const std::string &  name)
static

Definition at line 311 of file kpse.cc.

References kpse_readable_file().

Referenced by find_first_of(), and search().

◆ array_concat()

static std::list<std::string> array_concat ( const std::list< std::string > &  arr1,
const std::list< std::string > &  arr2 
)
static

Definition at line 844 of file kpse.cc.

Referenced by brace_expand().

◆ brace_expand()

static std::list<std::string> brace_expand ( const std::string &  text)
static

Definition at line 868 of file kpse.cc.

References array_concat(), brace_gobbler(), and expand_amble().

Referenced by expand_amble().

◆ brace_gobbler()

static int brace_gobbler ( const std::string &  text,
int &  indx,
int  satisfy 
)
static

Definition at line 949 of file kpse.cc.

References brace_whitespace.

Referenced by brace_expand(), and expand_amble().

◆ dir_p()

static bool dir_p ( const std::string &  fn)
static

Definition at line 1022 of file kpse.cc.

Referenced by kpse_element_dir().

◆ dir_search()

static std::list<std::string> dir_search ( const std::string &  dir,
const std::string &  name,
bool  search_all 
)
static

Definition at line 287 of file kpse.cc.

References kpse_readable_file().

Referenced by path_find_first_of(), and path_search().

◆ expand_amble()

static std::list< std::string > expand_amble ( const std::string &  text)
static

Definition at line 914 of file kpse.cc.

References brace_arg_separator, brace_expand(), brace_gobbler(), and ENV_SEP.

Referenced by brace_expand().

◆ find_first_of()

static std::list<std::string> find_first_of ( const std::string &  path,
const std::list< std::string > &  names,
bool  all 
)
static

◆ kpse_absolute_p()

static bool kpse_absolute_p ( const std::string &  filename,
int  relative_ok 
)
static

Definition at line 246 of file kpse.cc.

References absolute_pathname().

Referenced by find_first_of(), and search().

◆ kpse_all_path_find_first_of()

std::list<std::string> kpse_all_path_find_first_of ( const std::string &  path,
const std::list< std::string > &  names 
)

Definition at line 747 of file kpse.cc.

References find_first_of().

Referenced by directory_path::find_all_first_of().

◆ kpse_all_path_search()

std::list< std::string > kpse_all_path_search ( const std::string &  path,
const std::string &  name 
)

Definition at line 567 of file kpse.cc.

References search().

Referenced by directory_path::find_all().

◆ kpse_element_dir()

std::string kpse_element_dir ( const std::string &  elt)

◆ kpse_path_expand()

std::string kpse_path_expand ( const std::string &  path)

◆ kpse_path_find_first_of()

std::string kpse_path_find_first_of ( const std::string &  path,
const std::list< std::string > &  names 
)

Definition at line 731 of file kpse.cc.

References find_first_of().

Referenced by directory_path::find_first_of().

◆ kpse_path_search()

std::string kpse_path_search ( const std::string &  path,
const std::string &  name 
)

Definition at line 556 of file kpse.cc.

References search().

Referenced by directory_path::find_first().

◆ kpse_readable_file()

static std::string kpse_readable_file ( const std::string &  name)
static

Definition at line 205 of file kpse.cc.

References kpse_truncate_filename(), and READABLE().

Referenced by absolute_search(), and dir_search().

◆ kpse_tilde_expand()

static std::string kpse_tilde_expand ( const std::string &  name)
static

Definition at line 396 of file kpse.cc.

References IS_DIR_SEP.

Referenced by kpse_path_expand(), and search().

◆ kpse_truncate_filename()

static std::string kpse_truncate_filename ( const std::string &  name)
static

Definition at line 132 of file kpse.cc.

References IS_DEVICE_SEP, and IS_DIR_SEP.

Referenced by kpse_readable_file().

◆ log_search()

static void log_search ( const std::list< std::string > &  filenames)
static

Definition at line 264 of file kpse.cc.

References KPSE_DEBUG_P, and KPSE_DEBUG_SEARCH.

Referenced by find_first_of(), and search().

◆ path_find_first_of()

std::list<std::string> path_find_first_of ( const std::string &  path,
const std::list< std::string > &  names,
bool  all 
)

Definition at line 577 of file kpse.cc.

References dir_search(), first_search, IS_DIR_SEP, kpse_element_dir(), NAME_BEGINS_WITH_DEVICE, and pi.

Referenced by find_first_of().

◆ path_search()

static std::list<std::string> path_search ( const std::string &  path,
const std::string &  name,
bool  all 
)
static

Definition at line 327 of file kpse.cc.

References dir_search(), first_search, IS_DIR_SEP, kpse_element_dir(), NAME_BEGINS_WITH_DEVICE, and pi.

Referenced by search().

◆ READABLE()

static bool READABLE ( const std::string &  fn)
inlinestatic

Definition at line 170 of file kpse.cc.

References octave_access_r_ok(), octave_access_wrapper(), and u8_to_wstring().

Referenced by kpse_readable_file().

◆ search()

static std::list<std::string> search ( const std::string &  path,
const std::string &  original_name,
bool  all 
)
static

Variable Documentation

◆ brace_arg_separator

int brace_arg_separator = ','
static

Definition at line 907 of file kpse.cc.

Referenced by expand_amble().

◆ first_search

bool first_search = true
static

Definition at line 259 of file kpse.cc.

Referenced by find_first_of(), path_find_first_of(), path_search(), and search().

◆ kpse_debug

unsigned int kpse_debug = 0

Definition at line 92 of file kpse.cc.

Referenced by directory_path::init().