/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
- /* File : example.i */
- %module example
- #pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ
- %{
- #include "example.h"
- %}
- /* Now grab the original header file */
- %include "example.h"
- /* An output method that turns a complex into a short string */
- %extend ComplexVal {
- char *__str() {
- static char temp[512];
- sprintf(temp,"(%g,%g)", $self->re(), $self->im());
- return temp;
- }
- ComplexVal __paren(int j) {
- return ComplexVal($self->re()*j,$self->im()*j);
- }
- };