Updates to the 'simple' example for the Pike module.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4752 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6f5e5ddf39
commit
3684a6a3a7
3 changed files with 8 additions and 8 deletions
|
|
@ -4,15 +4,15 @@ SRCS = example.c
|
||||||
TARGET = example
|
TARGET = example
|
||||||
INTERFACE = example.i
|
INTERFACE = example.i
|
||||||
|
|
||||||
all::
|
all:
|
||||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
|
||||||
|
|
||||||
static::
|
static:
|
||||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
|
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
|
||||||
|
|
||||||
clean::
|
clean:
|
||||||
$(MAKE) -f $(TOP)/Makefile pike_clean
|
$(MAKE) -f $(TOP)/Makefile pike_clean
|
||||||
|
|
||||||
check: all
|
check: all
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
%module example
|
%module example
|
||||||
|
|
||||||
extern int gcd(int x, int y);
|
extern int gcd(int x, int y);
|
||||||
/* extern double Foo; */
|
extern double Foo;
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,17 @@ int main()
|
||||||
int x = 42;
|
int x = 42;
|
||||||
int y = 105;
|
int y = 105;
|
||||||
int g = .example.gcd(x, y);
|
int g = .example.gcd(x, y);
|
||||||
write(sprintf("The gcd of %d and %d is %d\n", x, y, g));
|
write("The gcd of %d and %d is %d\n", x, y, g);
|
||||||
|
|
||||||
/* Manipulate the Foo global variable */
|
/* Manipulate the Foo global variable */
|
||||||
/* Output its current value */
|
/* Output its current value */
|
||||||
/* write(sprintf("Foo = %f\n", .example.Foo_get())); */
|
write("Foo = %f\n", .example->Foo_get());
|
||||||
|
|
||||||
/* Change its value */
|
/* Change its value */
|
||||||
/* .example.Foo_set(3.1415926); */
|
.example->Foo_set(3.1415926);
|
||||||
|
|
||||||
/* See if the change took effect */
|
/* See if the change took effect */
|
||||||
/* write(sprintf("Foo = %f\n", .example.Foo_get())); */
|
write("Foo = %f\n", .example->Foo_get());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue