The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6fcc22a1f8
commit
516036631c
1508 changed files with 125983 additions and 44037 deletions
9
SWIG/Examples/pike/constants/.cvsignore
Executable file
9
SWIG/Examples/pike/constants/.cvsignore
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
*_wrap.c
|
||||
*_wrap.cxx
|
||||
example.dll
|
||||
example.dsw
|
||||
example.ncb
|
||||
example.opt
|
||||
example.plg
|
||||
Release
|
||||
Debug
|
||||
18
SWIG/Examples/pike/constants/Makefile
Executable file
18
SWIG/Examples/pike/constants/Makefile
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
TOP = ../..
|
||||
SWIG = $(TOP)/../swig
|
||||
SRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
|
||||
all::
|
||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
|
||||
|
||||
static::
|
||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
|
||||
|
||||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile pike_clean
|
||||
|
||||
check: all
|
||||
27
SWIG/Examples/pike/constants/example.i
Executable file
27
SWIG/Examples/pike/constants/example.i
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
/* A few preprocessor macros */
|
||||
|
||||
#define ICONST 42
|
||||
#define FCONST 2.1828
|
||||
#define CCONST 'x'
|
||||
#define CCONST2 '\n'
|
||||
#define SCONST "Hello World"
|
||||
#define SCONST2 "\"Hello World\""
|
||||
|
||||
/* This should work just fine */
|
||||
#define EXPR ICONST + 3*(FCONST)
|
||||
|
||||
/* This shouldn't do anything */
|
||||
#define EXTERN extern
|
||||
|
||||
/* Neither should this (BAR isn't defined) */
|
||||
#define FOO (ICONST + BAR)
|
||||
|
||||
/* The following directives also produce constants */
|
||||
|
||||
%constant int iconst = 37;
|
||||
%constant double fconst = 3.14;
|
||||
|
||||
|
||||
24
SWIG/Examples/pike/constants/runme.pike
Executable file
24
SWIG/Examples/pike/constants/runme.pike
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
int main()
|
||||
{
|
||||
write(sprintf("ICONST = %d (should be 42)\n", .example.ICONST));
|
||||
write(sprintf("FCONST = %f (should be 2.1828)\n", .example.FCONST));
|
||||
write(sprintf("CCONST = %c (should be 'x')\n", .example.CCONST));
|
||||
write(sprintf("CCONST2 = %c (this should be on a new line)\n", .example.CCONST2));
|
||||
write(sprintf("SCONST = %s (should be 'Hello World')\n", .example.SCONST));
|
||||
write(sprintf("SCONST2 = %s (should be '\"Hello World\"')\n", .example.SCONST2));
|
||||
write(sprintf("EXPR = %f (should be 48.5484)\n", .example.EXPR));
|
||||
write(sprintf("iconst = %d (should be 37)\n", .example.iconst));
|
||||
write(sprintf("fconst = %f (should be 3.14)\n", .example.fconst));
|
||||
|
||||
if (search(indices(.example), "EXTERN") == -1)
|
||||
write("EXTERN isn't defined (good)\n");
|
||||
else
|
||||
write("EXTERN is defined (bad)\n");
|
||||
|
||||
if (search(indices(.example), "FOO") == -1)
|
||||
write("FOO isn't defined (good)\n");
|
||||
else
|
||||
write("FOO is defined (bad)\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue