PageRenderTime 44ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Examples/tcl/operator/example.i

#
Swig | 28 lines | 13 code | 8 blank | 7 comment | 0 complexity | 5ebfdaaa06507495cd02fe6728a1e75b 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. %{
  4. #include "example.h"
  5. %}
  6. /* This header file is a little tough to handle because it has overloaded
  7. operators and constructors. We're going to try and deal with that here */
  8. /* This turns the copy constructor in a function ComplexCopy() that can
  9. be called */
  10. %rename(ComplexCopy) Complex::Complex(Complex const &);
  11. /* Now grab the original header file */
  12. %include "example.h"
  13. /* An output method that turns a complex into a short string */
  14. %extend Complex {
  15. char *str() {
  16. static char temp[512];
  17. sprintf(temp,"(%g,%g)", self->re(), self->im());
  18. return temp;
  19. }
  20. };