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

/tags/rel-1.3.35/Examples/octave/operator/example.i

#
Swig | 24 lines | 16 code | 5 blank | 3 comment | 0 complexity | 50ea2f09ac7aad81fce2aa21c5590d7b 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. #pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ
  4. %{
  5. #include "example.h"
  6. %}
  7. /* Now grab the original header file */
  8. %include "example.h"
  9. /* An output method that turns a complex into a short string */
  10. %extend ComplexVal {
  11. char *__str() {
  12. static char temp[512];
  13. sprintf(temp,"(%g,%g)", $self->re(), $self->im());
  14. return temp;
  15. }
  16. ComplexVal __paren(int j) {
  17. return ComplexVal($self->re()*j,$self->im()*j);
  18. }
  19. };