PlaceholderParser.xsp 907 B

123456789101112131415161718192021222324252627282930313233
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include <vector>
  5. #include "libslic3r/PlaceholderParser.hpp"
  6. %}
  7. %name{Slic3r::GCode::PlaceholderParser} class PlaceholderParser {
  8. PlaceholderParser();
  9. ~PlaceholderParser();
  10. void apply_config(DynamicPrintConfig *config)
  11. %code%{ THIS->apply_config(*config); %};
  12. void set(std::string key, int value);
  13. std::string process(std::string str) const
  14. %code%{
  15. try {
  16. RETVAL = THIS->process(str, 0);
  17. } catch (std::exception& e) {
  18. croak("%s\n", e.what());
  19. }
  20. %};
  21. bool evaluate_boolean_expression(const char *str) const
  22. %code%{
  23. try {
  24. RETVAL = THIS->evaluate_boolean_expression(str, THIS->config());
  25. } catch (std::exception& e) {
  26. croak("%s\n", e.what());
  27. }
  28. %};
  29. };