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

/trunk/Examples/d/constants/example.i

#
Swig | 32 lines | 13 code | 10 blank | 9 comment | 0 complexity | ee5c48920f03321c9c91ce4e4f7df908 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 D code to use the C constant values rather than
  4. retrieving them at runtime. You can also try disabling the feature and
  5. compare the generated code. */
  6. %dmanifestconst;
  7. /* A few preprocessor macros */
  8. #define ICONST 42
  9. #define FCONST 2.1828
  10. #define CCONST 'x'
  11. #define CCONST2 '\n'
  12. #define SCONST "Hello World"
  13. #define SCONST2 "\"Hello World\""
  14. /* This should work just fine */
  15. #define EXPR ICONST + 3*(FCONST)
  16. /* This shouldn't do anything */
  17. #define EXTERN extern
  18. /* Neither should this (BAR isn't defined) */
  19. #define FOO (ICONST + BAR)
  20. /* The following directives also produce constants */
  21. %constant int iconst = 37;
  22. %constant double fconst = 3.14;