PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/java/constants/example.i

#
Swig | 30 lines | 13 code | 10 blank | 7 comment | 0 complexity | ec52148301079a7cc885d304db08d6d2 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* File : example.i */
  2. %module example
  3. /* Force the generated Java code to use the C constant values rather than making a JNI call */
  4. %javaconst(1);
  5. /* A few preprocessor macros */
  6. #define ICONST 42
  7. #define FCONST 2.1828
  8. #define CCONST 'x'
  9. #define CCONST2 '\n'
  10. #define SCONST "Hello World"
  11. #define SCONST2 "\"Hello World\""
  12. /* This should work just fine */
  13. #define EXPR ICONST + 3*(FCONST)
  14. /* This shouldn't do anything */
  15. #define EXTERN extern
  16. /* Neither should this (BAR isn't defined) */
  17. #define FOO (ICONST + BAR)
  18. /* The following directives also produce constants */
  19. %constant int iconst = 37;
  20. %constant double fconst = 3.14;