/tags/rel-1-3-26/SWIG/Lib/guile/std_common.i

# · Swig · 25 lines · 20 code · 5 blank · 0 comment · 0 complexity · fa27d49cef1b0c8b58ec30faa35be265 MD5 · raw file

  1. //
  2. // SWIG typemaps for STL - common utilities
  3. // Luigi Ballabio
  4. // Aug 3, 2002
  5. //
  6. // Guile implementation
  7. %include <std/std_except.i>
  8. %apply size_t { std::size_t };
  9. #define SWIG_bool2scm(b) gh_bool2scm(b ? 1 : 0)
  10. #define SWIG_string2scm(s) gh_str02scm(s.c_str())
  11. %{
  12. #include <string>
  13. inline std::string SWIG_scm2string(SCM x) {
  14. char* temp;
  15. temp = SWIG_scm2str(x);
  16. std::string s(temp);
  17. if (temp) SWIG_free(temp);
  18. return s;
  19. }
  20. %}