bb61de8379
at the placeholder parser. Implemented a new PlaceholderParser::evaluate_boolean_expression() functionality to evaluate just a boolean expression using the full expressive power of the macro processing syntax. This function will now be used for deciding, which print or filament preset is compatible with which printer preset.
34 lines
891 B
Plaintext
34 lines
891 B
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <xsinit.h>
|
|
#include <vector>
|
|
#include "libslic3r/PlaceholderParser.hpp"
|
|
%}
|
|
|
|
%name{Slic3r::GCode::PlaceholderParser} class PlaceholderParser {
|
|
PlaceholderParser();
|
|
~PlaceholderParser();
|
|
|
|
void apply_config(DynamicPrintConfig *config)
|
|
%code%{ THIS->apply_config(*config); %};
|
|
void set(std::string key, int value);
|
|
std::string process(std::string str) const
|
|
%code%{
|
|
try {
|
|
RETVAL = THIS->process(str, 0);
|
|
} catch (std::exception& e) {
|
|
croak(e.what());
|
|
}
|
|
%};
|
|
|
|
bool evaluate_boolean_expression(const char *str) const
|
|
%code%{
|
|
try {
|
|
RETVAL = THIS->evaluate_boolean_expression(str, THIS->config());
|
|
} catch (std::exception& e) {
|
|
croak(e.what());
|
|
}
|
|
%};
|
|
};
|