Klammerset: the @@@klammerset construct, its search path, and const correctness
The @@@klammerset system command formally declares a klammerset — a named, logically related group of klammer definitions — with an operative, idempotent declaration (:requires and :files load in order at the declaration point, relative to the declaring file). A bare symbol given to ktext -k, kdesc --input, or :requires resolves to x/x.k on the search path: the document's directory, then KLAMMERTEXT_KLAMMERSETS, then KLAMMERTEXT_HOME; kdesc --klammerset lists the available sets. sks/sks.k is the first declared klammerset, so `-k sks` loads the SKS by name. The engine's lookup classes were renamed *_set → *_registry to keep the two concepts apart, and the whole C++ tree now follows standard const-correctness conventions. tst/ gains klammerset_test.sh (18 cases). (from dev 64b1abf23e56)
This commit is contained in:
13
mac/file.cpp
13
mac/file.cpp
@@ -440,7 +440,7 @@ strings_t get_sks_directories(const std::string& s, bool include_argument)
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string cache_directory(std::string subdirectory, std::string parent_directory)
|
||||
std::string cache_directory(const std::string& subdirectory, std::string parent_directory)
|
||||
{
|
||||
if (parent_directory.empty()) {
|
||||
// /dev/shm is a fast RAM-backed tmpfs on Linux; it does not exist on
|
||||
@@ -475,7 +475,7 @@ bool in_modification_order(std::string filename1, std::string filename2)
|
||||
}
|
||||
}
|
||||
|
||||
void write_to_cache(std::string cache_dir, std::string basename, std::string text)
|
||||
void write_to_cache(const std::string& cache_dir, const std::string& basename, const std::string& text)
|
||||
{
|
||||
if (!file_exists(cache_dir)) {
|
||||
//std::cout << "Creating cache directory: " << cache_dir << "\n";
|
||||
@@ -486,14 +486,14 @@ void write_to_cache(std::string cache_dir, std::string basename, std::string tex
|
||||
string_to_file(output_filename, text);
|
||||
}
|
||||
|
||||
std::string read_from_cache(std::string cache_dir, std::string basename)
|
||||
std::string read_from_cache(const std::string& cache_dir, const std::string& basename)
|
||||
{
|
||||
std::string input_filename = cache_dir + "/" + basename;
|
||||
// msg() << "Reading file from cache: " << input_filename << "\n";
|
||||
return string_from_file(input_filename);
|
||||
}
|
||||
|
||||
bool cache_requires_update(std::string cache_dir, std::string file_to_cache, std::string basename)
|
||||
bool cache_requires_update(const std::string& cache_dir, const std::string& file_to_cache, const std::string& basename)
|
||||
{
|
||||
std::string cache_filename = cache_dir + "/" + basename;
|
||||
return !in_modification_order(file_to_cache, cache_filename);
|
||||
@@ -662,11 +662,12 @@ void copy_file_stream(const fs::path& src, const fs::path& dst)
|
||||
}
|
||||
|
||||
void copy_preserving_basename(
|
||||
strings_t filenames, std::string output_directory, std::string link_directory)
|
||||
const strings_t& filenames, const std::string& output_directory,
|
||||
const std::string& link_directory)
|
||||
{
|
||||
fs::path outdir(output_directory + "/" + link_directory);
|
||||
fs::create_directories(outdir);
|
||||
for (std::string filename : filenames) {
|
||||
for (const std::string& filename : filenames) {
|
||||
fs::path pname(filename);
|
||||
auto out_path = outdir / pname.filename();
|
||||
// Preserve the previous copy_options::update_existing behavior: skip
|
||||
|
||||
Reference in New Issue
Block a user