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:
35
mac/error.cpp
Normal file
35
mac/error.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "error.h"
|
||||
#include "show.h"
|
||||
#include "util.h"
|
||||
#include "file.h"
|
||||
|
||||
bool display_source(const std::string& filename_arg)
|
||||
{
|
||||
if (filename_arg.empty()) {
|
||||
return false;
|
||||
} else {
|
||||
fs::path filename = fs::path(filename_arg).filename();
|
||||
return sks_commands.count(filename) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Error::print_message(const std::string& epilog)
|
||||
{
|
||||
if (epilog != "")
|
||||
//desc += " " + epilog + "\n";
|
||||
m_desc += epilog + "\n";
|
||||
if (m_just)
|
||||
m_desc = justify(m_desc, 80, 0);
|
||||
std::cerr << "\n" << red << command_name << " (" << m_type << " error)";
|
||||
if (display_source(m_loc.m_filename)) {
|
||||
std::cerr << ":\n " << m_loc.m_filename;
|
||||
}
|
||||
if (m_loc.m_line > -1) {
|
||||
std::cerr << ", line " << m_loc.m_line;
|
||||
}
|
||||
if (m_loc.m_chr > -1) {
|
||||
std::cerr << ", character " << m_loc.m_chr + 1;
|
||||
}
|
||||
std::cerr << ":\n\n" << m_desc << reset << "\n";
|
||||
std::cout << reset;
|
||||
}
|
||||
Reference in New Issue
Block a user