PageRenderTime 43ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/char_binary.i

#
Swig | 29 lines | 18 code | 8 blank | 3 comment | 0 complexity | abb104e713df1509a3e6b8f8f909b283 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /*
  2. A test case for testing non null terminated char pointers.
  3. */
  4. %module char_binary
  5. %apply (char *STRING, size_t LENGTH) { (const char *str, size_t len) }
  6. %inline %{
  7. struct Test {
  8. size_t strlen(const char *str, size_t len) {
  9. return len;
  10. }
  11. };
  12. typedef char namet[5];
  13. namet var_namet;
  14. typedef char* pchar;
  15. pchar var_pchar;
  16. %}
  17. // Remove string handling typemaps and treat as pointer
  18. %typemap(freearg) SWIGTYPE * ""
  19. %apply SWIGTYPE * { char * }
  20. %include "carrays.i"
  21. %array_functions(char, pchar);