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

« back to all changes in this revision

Viewing changes to Examples/php4/value/example.i

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:16:04 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205011604-ygx904it6413k3go
Tags: 1.3.27-1ubuntu1
Resynchronise with Debian again, for the new subversion packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#include "example.h"
6
6
%}
7
7
 
8
 
/* Some functions that manipulate Vectors by value */
9
 
extern double dot_product(Vector a, Vector b);
10
 
extern Vector vector_add(Vector a, Vector b);
11
 
 
12
 
/* Include this because the vector_add() function will leak memory */
13
 
void   free(void *);
 
8
%include "example.h"
14
9
 
15
10
/* Some helper functions for our interface */
16
11
%inline %{
17
12
 
18
 
Vector *new_Vector(double x, double y, double z) {
19
 
        /* We use the Zend memory manager */
20
 
   Vector *v = (Vector *) emalloc(sizeof(Vector));
21
 
   v->x = x;
22
 
   v->y = y;
23
 
   v->z = z;
24
 
   return v;
25
 
}
26
 
 
27
13
void vector_print(Vector *v) {
28
14
  printf("Vector %x = (%g, %g, %g)\n", v, v->x, v->y, v->z);
29
15
}