update swig on windows
This commit is contained in:
20
winx64/bin/swigwin-4.0.0/Examples/php/constants/Makefile
Normal file
20
winx64/bin/swigwin-4.0.0/Examples/php/constants/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
LIBS =
|
||||
SWIGOPT =
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
|
||||
php
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean
|
||||
26
winx64/bin/swigwin-4.0.0/Examples/php/constants/example.i
Normal file
26
winx64/bin/swigwin-4.0.0/Examples/php/constants/example.i
Normal file
@@ -0,0 +1,26 @@
|
||||
/* 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 statements also produce constants */
|
||||
%constant int iconst = 37;
|
||||
%constant double fconst = 3.14;
|
||||
|
||||
|
||||
24
winx64/bin/swigwin-4.0.0/Examples/php/constants/runme.php
Normal file
24
winx64/bin/swigwin-4.0.0/Examples/php/constants/runme.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require "example.php";
|
||||
|
||||
print "ICONST = " . ICONST . " (should be 42)\n";
|
||||
print "FCONST = " . FCONST . " (should be 2.1828)\n";
|
||||
print "CCONST = " . CCONST . " (should be 'x')\n";
|
||||
print "CCONST2 = " . CCONST2 . " (this should be on a new line)\n";
|
||||
print "SCONST = " . SCONST . " (should be 'Hello World')\n";
|
||||
print "SCONST2 = " . SCONST2 . " (should be '\"Hello World\"')\n";
|
||||
print "EXPR = " . EXPR . " (should be 48.5484)\n";
|
||||
print "iconst = " . iconst . " (should be 37)\n";
|
||||
print "fconst = " . fconst . " (should be 3.14)\n";
|
||||
|
||||
$c = get_defined_constants();
|
||||
if (array_key_exists("EXTERN", $c)) {
|
||||
print "EXTERN = " . $c["EXTERN"] . " (Arg! This shouldn't print anything)\n";
|
||||
}
|
||||
if (array_key_exists("FOO", $c)) {
|
||||
print "FOO = " . $c["FOO"] . " (Arg! This shouldn't print anything)\n";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user