~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Examples/test-suite/simple_array.i

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%module simple_array
 
2
 
 
3
extern int x[10];
 
4
extern double y[7];
 
5
 
 
6
 
 
7
%inline %{
 
8
 
 
9
struct BarArray {
 
10
  int i;
 
11
  double d;
 
12
};
 
13
 
 
14
extern struct BarArray bars[2]; 
 
15
 
 
16
int x[10];
 
17
double y[7];
 
18
struct BarArray bars[2]; 
 
19
 
 
20
void
 
21
initArray()
 
22
{
 
23
  int i, n;
 
24
 
 
25
  n = sizeof(x)/sizeof(x[0]);
 
26
  for(i = 0; i < n; i++) 
 
27
    x[i] = i;
 
28
 
 
29
  n = sizeof(y)/sizeof(y[0]);
 
30
  for(i = 0; i < n; i++) 
 
31
    y[i] = ((double) i)/ ((double) n);
 
32
 
 
33
  n = sizeof(bars)/sizeof(bars[0]);
 
34
  for(i = 0; i < n; i++)  {
 
35
    bars[i].i = x[i+2];
 
36
    bars[i].d = y[i+2];
 
37
  }
 
38
 
 
39
  return;
 
40
}
 
41
 
 
42
%}