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:
@@ -11,7 +11,7 @@
|
||||
#include "log.h"
|
||||
#include "file.h"
|
||||
|
||||
bool strbool(std::string s, Locator loc)
|
||||
bool strbool(const std::string& s, const Locator& loc)
|
||||
{
|
||||
std::vector<std::string> values = {"false", "False", "0", "true", "True", "1"};
|
||||
if (is_not_in(s, values)) {
|
||||
@@ -136,7 +136,7 @@ void Document_class::save_string_input_as_file()
|
||||
}
|
||||
|
||||
|
||||
fs::path parse_input_filename(std::string s, std::string input_dir)
|
||||
fs::path parse_input_filename(const std::string& s, const std::string& input_dir)
|
||||
{
|
||||
fs::path p(s);
|
||||
if (p.extension() != ".kt") {
|
||||
@@ -160,13 +160,13 @@ fs::path parse_input_filename(std::string s, std::string input_dir)
|
||||
return p;
|
||||
}
|
||||
|
||||
void Document_class::write(std::string filename, std::string contents)
|
||||
void Document_class::write(const std::string& filename, const std::string& contents)
|
||||
{
|
||||
write_file(filename, contents, write_files);
|
||||
}
|
||||
|
||||
|
||||
void write_file(std::string filename, std::string contents, bool write_p)
|
||||
void write_file(const std::string& filename, const std::string& contents, bool write_p)
|
||||
{
|
||||
if (write_p) {
|
||||
string_to_file(filename, contents);
|
||||
@@ -177,14 +177,14 @@ void write_file(std::string filename, std::string contents, bool write_p)
|
||||
|
||||
|
||||
/*
|
||||
void output_msg(std::string msg)
|
||||
void output_msg(const std::string& msg)
|
||||
{
|
||||
std::cout << red;
|
||||
(void)K::log(1, msg);
|
||||
std::cout << black;
|
||||
}
|
||||
|
||||
void Document_class::create_directory(std::string directory)
|
||||
void Document_class::create_directory(const std::string& directory)
|
||||
{
|
||||
if (write_files) {
|
||||
fs::create_directories(directory);
|
||||
|
||||
Reference in New Issue
Block a user