2026-07-18 18:48:23 +02:00
|
|
|
#include <string>
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
#include "error.h"
|
|
|
|
|
#include "klammer_base.h"
|
|
|
|
|
#include "show.h"
|
|
|
|
|
|
2026-07-30 23:50:07 +02:00
|
|
|
std::string Klammer_base::get(const std::string& name)
|
2026-07-18 18:48:23 +02:00
|
|
|
{
|
|
|
|
|
//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);
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 23:50:07 +02:00
|
|
|
void Klammer_base::show(const std::string& klammer_name)
|
2026-07-18 18:48:23 +02:00
|
|
|
{
|
|
|
|
|
std::cout << "Arguments of klammer \"" << klammer_name << "\"\n"
|
|
|
|
|
<< m_machine.m_state.describe() << "\n";
|
|
|
|
|
}
|