PageRenderTime 34ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/tags/rel-1-3-15/SWIG/Examples/test-suite/arrays.i

#
Swig | 52 lines | 39 code | 9 blank | 4 comment | 0 complexity | 29f3db1a09d86d56ec8e9efca1cba57f MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /*
  2. This test case tests that various types of arrays are working.
  3. */
  4. %module arrays
  5. %pragma make_default
  6. %inline %{
  7. #define ARRAY_LEN 2
  8. typedef enum {One, Two, Three, Four, Five} finger;
  9. typedef struct {
  10. double double_field;
  11. } SimpleStruct;
  12. typedef struct {
  13. char array_c [ARRAY_LEN];
  14. signed char array_sc[ARRAY_LEN];
  15. unsigned char array_uc[ARRAY_LEN];
  16. short array_s [ARRAY_LEN];
  17. unsigned short array_us[ARRAY_LEN];
  18. int array_i [ARRAY_LEN];
  19. unsigned int array_ui[ARRAY_LEN];
  20. long array_l [ARRAY_LEN];
  21. unsigned long array_ul[ARRAY_LEN];
  22. long long array_ll[ARRAY_LEN];
  23. float array_f [ARRAY_LEN];
  24. double array_d [ARRAY_LEN];
  25. SimpleStruct array_struct[ARRAY_LEN];
  26. SimpleStruct* array_structpointers[ARRAY_LEN];
  27. int* array_ipointers [ARRAY_LEN];
  28. finger array_enum[ARRAY_LEN];
  29. finger* array_enumpointers[ARRAY_LEN];
  30. const int array_const_i[ARRAY_LEN];
  31. } ArrayStruct;
  32. void fn_taking_arrays(SimpleStruct array_struct[ARRAY_LEN]) {}
  33. /* Pointer helper functions used in the Java run test */
  34. int* newintpointer() {
  35. return (int*)malloc(sizeof(int));
  36. }
  37. void setintfrompointer(int* intptr, int value) {
  38. *intptr = value;
  39. }
  40. int getintfrompointer(int* intptr) {
  41. return *intptr;
  42. }
  43. %}