PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/test-suite/unions.i

#
Swig | 34 lines | 22 code | 7 blank | 5 comment | 0 complexity | 88d30859b858653d7efd689f644c9cc4 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /*
  2. This testcase checks that unions can be set and read.
  3. */
  4. %module unions
  5. %inline %{
  6. typedef struct SmallStruct {
  7. short jill;
  8. } SmallStruct;
  9. typedef struct BigStruct {
  10. int jack;
  11. SmallStruct smallstruct;
  12. } BigStruct;
  13. /* This union is just to check the parser */
  14. typedef union {
  15. BigStruct bs;
  16. SmallStruct ss;
  17. } UnionTest;
  18. /* This union checks the parser and will be used in a runtime test */
  19. typedef struct {
  20. union
  21. {
  22. BigStruct big;
  23. SmallStruct small;
  24. } uni;
  25. int number;
  26. } EmbeddedUnionTest;
  27. %}