PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/tcl/operator/example.i

#
Swig | 28 lines | 13 code | 8 blank | 7 comment | 0 complexity | 49c501d05e6bc7b962be1a82a725a05c MD5 | raw file
 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