Initial commit: Klammertext source distribution
Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
56
sks/kutil/klammer_base.cpp
Normal file
56
sks/kutil/klammer_base.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "error.h"
|
||||
#include "klammer_base.h"
|
||||
#include "show.h"
|
||||
|
||||
std::string Klammer_base::get(std::string name)
|
||||
{
|
||||
//std::cout << "GET " << name << "\n";
|
||||
std::string result = m_machine.m_state.value(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string Klammer_base::get(const char* name)
|
||||
{
|
||||
// msg() << "GETc " << name << "\n";
|
||||
std::string sname { name };
|
||||
std::string result = m_machine.m_state.value(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::string Klammer_base::html()
|
||||
{
|
||||
return "[html target undefined]";
|
||||
}
|
||||
|
||||
std::string Klammer_base::tex()
|
||||
{
|
||||
return "[tex target undefined]";
|
||||
}
|
||||
|
||||
std::string Klammer_base::txt()
|
||||
{
|
||||
return "[txt target undefined]";
|
||||
}
|
||||
|
||||
std::string Klammer_base::result()
|
||||
{
|
||||
std::string target = get("K_target");
|
||||
if (target == "html")
|
||||
return html();
|
||||
else if (target == "tex" or target == "pdf")
|
||||
return tex();
|
||||
else if (target == "txt")
|
||||
return txt();
|
||||
else
|
||||
throw Target_error("Unknown target: " + target);
|
||||
}
|
||||
|
||||
void Klammer_base::show(std::string klammer_name)
|
||||
{
|
||||
std::cout << "Arguments of klammer \"" << klammer_name << "\"\n"
|
||||
<< m_machine.m_state.describe() << "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user