Klammertext runs natively on Windows; a Windows source-install guide; the bundled sh for @eval :shell
Assembled from klammertext-dev f344a37d772c. The commands, the library,
the Standard Klammer Set, the reflection klammerset and the Python
binding build and run natively on Windows (MSYS2 UCRT64 gcc, python.org
Python), and both test tiers pass there. doc/install/windows_source_install.md
is the fifth install guide: a source install parallel to the Linux and
macOS ones, verified by following it on a pristine Windows 11.
Behaviour on every system: paths Klammertext prints use forward slashes;
output is LF; the command line is UTF-8 on Windows; @eval :shell is a
POSIX shell command everywhere -- on Windows it runs the sh Klammertext
ships, BusyBox for Windows (win/busybox/, GPLv2, with its licence and the
source pointer). KLAMMERTEXT_FONTS and KLAMMERTEXT_KLAMMERSETS are lists in
the system's PATH convention (';' on Windows). On Linux and macOS nothing
observable changes.
This commit is contained in:
1 parent
f9af1ff869
commit
830b19394d
55 files changed
+1182
-153
No files matched your search
+22
@@ -7,6 +7,8 @@
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <tuple>
|
||||
|
||||
class Locator; // locator.h; a full include would cycle through util.h
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -85,6 +87,26 @@ std::pair<std::string,std::string> extract_parameter_type(const std::string& par
|
||||
std::tuple<std::string, std::string, bool> regex_split_prefix(const std::regex& pattern, const std::string& text);
|
||||
std::vector<std::string> dlist_split(const std::string& s);
|
||||
std::string get_env_var(const std::string& var);
|
||||
// A POSIX sh command as popen()/system() must receive it. On Linux and
|
||||
// macOS line() is the text itself. On Windows popen() runs cmd.exe, which
|
||||
// cannot carry a quoted string with an embedded newline, so the command is
|
||||
// written to a script file and line() runs the sh Klammertext ships
|
||||
// (win/busybox/) on that file; the file lives as long as this object. exec()
|
||||
// uses it, so every command Klammertext composes runs under sh on every
|
||||
// system; code that calls popen()/system() itself (eval.cpp,
|
||||
// tst/klammer_test) uses it too.
|
||||
class Shell_command
|
||||
{
|
||||
public:
|
||||
Shell_command(const std::string& sh_command, const Locator& loc);
|
||||
~Shell_command();
|
||||
Shell_command(const Shell_command&) = delete;
|
||||
Shell_command& operator=(const Shell_command&) = delete;
|
||||
const std::string& line() const { return m_line; }
|
||||
private:
|
||||
std::string m_line {};
|
||||
std::string m_script {}; // the script file, Windows only
|
||||
};
|
||||
std::string freplace(const std::string& src, const std::regex& pattern,
|
||||
const std::function<std::string(std::smatch)>& func);
|
||||
std::string exec(const char* cmd);
|
||||
|
||||
Reference in new issue
Block a user