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:
Dave Beazley 2002-11-30 22:01:28 +00:00
commit 516036631c
1508 changed files with 125983 additions and 44037 deletions

View file

@ -0,0 +1,9 @@
*_wrap.c
*_wrap.cxx
example.dll
example.dsw
example.ncb
example.opt
example.plg
Release
Debug

View 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

View 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;

View 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;
}