summaryrefslogtreecommitdiff
path: root/Examples/php/pragmas
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/php/pragmas')
-rw-r--r--Examples/php/pragmas/Makefile24
-rw-r--r--Examples/php/pragmas/example.i31
-rw-r--r--Examples/php/pragmas/include.php7
-rwxr-xr-xExamples/php/pragmas/runme.php5
4 files changed, 67 insertions, 0 deletions
diff --git a/Examples/php/pragmas/Makefile b/Examples/php/pragmas/Makefile
new file mode 100644
index 0000000..23e2675
--- /dev/null
+++ b/Examples/php/pragmas/Makefile
@@ -0,0 +1,24 @@
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+SRCS =
+TARGET = example
+INTERFACE = example.i
+LIBS =
+SWIGOPT =
+
+all::
+ $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
+ php
+
+static::
+ $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
+ php_static
+
+clean::
+ $(MAKE) -f $(TOP)/Makefile php_clean
+ rm -f $(TARGET).php
+
+check: all
+ $(MAKE) -f $(TOP)/Makefile php_run
diff --git a/Examples/php/pragmas/example.i b/Examples/php/pragmas/example.i
new file mode 100644
index 0000000..c7e8bf3
--- /dev/null
+++ b/Examples/php/pragmas/example.i
@@ -0,0 +1,31 @@
+/* File : example.i */
+%module example
+
+%init{
+ zend_printf("This was %%init\n");
+}
+
+%minit{
+ zend_printf("This was %%minit\n");
+}
+
+%mshutdown{
+ zend_printf("This was %%shutdown\n");
+}
+
+%rinit{
+ zend_printf("This was %%rinit\n");
+}
+
+%rshutdown{
+ zend_printf("This was %%rshutdown\n");
+}
+
+%pragma(php) include="include.php";
+
+%pragma(php) code="
+# This code is inserted into example.php
+echo \"this was php code\\n\";
+"
+
+%pragma(php) phpinfo="php_info_print_table_start();"
diff --git a/Examples/php/pragmas/include.php b/Examples/php/pragmas/include.php
new file mode 100644
index 0000000..e19880a
--- /dev/null
+++ b/Examples/php/pragmas/include.php
@@ -0,0 +1,7 @@
+<?php
+
+# This code is inserted into example.php
+echo "this is include.php\n";
+
+
+?>
diff --git a/Examples/php/pragmas/runme.php b/Examples/php/pragmas/runme.php
new file mode 100755
index 0000000..538548b
--- /dev/null
+++ b/Examples/php/pragmas/runme.php
@@ -0,0 +1,5 @@
+<?php
+
+require "example.php";
+
+?>