Updated examples to function correctly with new php4 module. Added
some supplemental examples for cpointer, overloading and references using proxies. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7391 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
bc9db8b383
commit
501bd53c4b
44 changed files with 506 additions and 131 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
${SWIG:=swig} -php4 -phpfull -noproxy -withc example.c example.i
|
||||
phpize && ./configure && make clean && make
|
||||
${SWIG:=swig} -php4 -make -noproxy -withc example.c example.i
|
||||
make
|
||||
php -d extension_dir=. runme.php4
|
||||
|
|
|
|||
|
|
@ -4,3 +4,26 @@ typedef struct {
|
|||
int x,y;
|
||||
} Point;
|
||||
|
||||
/* Some global variable declarations */
|
||||
extern int ivar;
|
||||
extern short svar;
|
||||
extern long lvar;
|
||||
extern unsigned int uivar;
|
||||
extern unsigned short usvar;
|
||||
extern unsigned long ulvar;
|
||||
extern signed char scvar;
|
||||
extern unsigned char ucvar;
|
||||
extern char cvar;
|
||||
extern float fvar;
|
||||
extern double dvar;
|
||||
extern char *strvar;
|
||||
extern const char cstrvar[];
|
||||
extern int *iptrvar;
|
||||
extern char name[256];
|
||||
|
||||
extern Point *ptptr;
|
||||
extern Point pt;
|
||||
|
||||
extern int status;
|
||||
extern char path[256];
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
%}
|
||||
|
||||
/* Some global variable declarations */
|
||||
%inline %{
|
||||
extern int ivar;
|
||||
extern short svar;
|
||||
extern long lvar;
|
||||
|
|
@ -24,27 +23,22 @@ extern char name[256];
|
|||
|
||||
extern Point *ptptr;
|
||||
extern Point pt;
|
||||
%}
|
||||
|
||||
/* Some read-only variables */
|
||||
|
||||
%immutable;
|
||||
|
||||
%inline %{
|
||||
extern int status;
|
||||
extern char path[256];
|
||||
%}
|
||||
|
||||
%mutable;
|
||||
|
||||
/* Some helper functions to make it easier to test */
|
||||
%inline %{
|
||||
extern void print_vars();
|
||||
extern int *new_int(int value);
|
||||
extern int value_ent(int *value);
|
||||
|
||||
extern Point *new_Point(int x, int y);
|
||||
extern char *Point_print(Point *p);
|
||||
extern void pt_print();
|
||||
%}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
require "example.php";
|
||||
/* Try to set the values of some global variables */
|
||||
$a = "42.14";
|
||||
|
||||
ivar_set(42);
|
||||
ivar_set($a);
|
||||
echo "a = $a\n";
|
||||
svar_set(-31000);
|
||||
lvar_set(65537);
|
||||
uivar_set(123456);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue