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