[svn:PHP-Sandwich] rev 1022 - PHP-Sandwich/trunk

[email protected] 26 Apr 2005 04:31:33 -0000
Newsgroups perl.php.sandwich.dev
Message-ID <[email protected]>
Author: shughes
Date: Mon Apr 25 21:31:33 2005
New Revision: 1022

Added:
   PHP-Sandwich/trunk/phpfuncs.c
Modified:
   PHP-Sandwich/trunk/Makefile.PL
   PHP-Sandwich/trunk/phpinterp.c
Log:
add basic php externsion to the build with a single 
test function...


Modified: PHP-Sandwich/trunk/Makefile.PL
==============================================================================
--- PHP-Sandwich/trunk/Makefile.PL	(original)
+++ PHP-Sandwich/trunk/Makefile.PL	Mon Apr 25 21:31:33 2005
@@ -14,7 +14,7 @@
 @lddlflags  = ($Config{lddlflags});
 push @lddlflags, `$phpdir/bin/php-config --ldflags`;
 
-@ofiles = ('PHP.o', 'phpinterp.o');
+@ofiles = ('PHP.o', 'phpinterp.o', 'phpfuncs.o');
 
 WriteMakefile(
         CC              => $ENV{CC},

Added: PHP-Sandwich/trunk/phpfuncs.c
==============================================================================
--- (empty file)
+++ PHP-Sandwich/trunk/phpfuncs.c	Mon Apr 25 21:31:33 2005
@@ -0,0 +1,38 @@
+#include "phpinterp.h"
+
+
+PHP_MINFO_FUNCTION(sandwich)
+{
+  php_info_print_table_start();
+  php_info_print_table_row(2, "Loaded Modules", "Perl Sandwich");
+  php_info_print_table_end();
+}
+
+
+PHP_FUNCTION(sandwich_test)
+{
+    RETURN_STRING("mmmm... peanut butter", 1);
+}
+
+static function_entry sandwich_functions[] = {
+  PHP_FE(sandwich_test, NULL)
+  {NULL, NULL, NULL}
+};
+
+
+zend_module_entry sandwich_module_entry = {
+  STANDARD_MODULE_HEADER,
+  "sandwich",
+  sandwich_functions,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  PHP_MINFO(sandwich),
+  NULL,
+  STANDARD_MODULE_PROPERTIES
+};
+
+
+
+/* vim: set ts=2 sts=2 ai bs=2 expandtab : */

Modified: PHP-Sandwich/trunk/phpinterp.c
==============================================================================
--- PHP-Sandwich/trunk/phpinterp.c	(original)
+++ PHP-Sandwich/trunk/phpinterp.c	Mon Apr 25 21:31:33 2005
@@ -64,6 +64,8 @@
   STANDARD_SAPI_MODULE_PROPERTIES
 };
 
+extern zend_module_entry sandwich_module_entry;
+
 static int ze_started = 0;
 
 int sandwich_php_interpreter_create()
@@ -79,7 +81,7 @@
   }
   pthread_key_create(&sandwich_per_thread_info_key, NULL);
 
-  if (!tsrm_startup(128, 32, TSRM_ERROR_LEVEL_CORE, "/opt/ecelerity/var/log/TSRM.log")) {
+  if (!tsrm_startup(128, 32, TSRM_ERROR_LEVEL_CORE, "/tmp/TSRM.log")) {
     Perl_croak("Failed to init PHP TSRM!\n");
     return -1;
   }
@@ -93,11 +95,11 @@
   sandwich_sapi.php_ini_path_override = "/opt/ecelerity/3rdParty/lib/php.ini";
   sapi_startup(&sandwich_sapi);
   ze_started = 1;
-  /* if (FAILURE == php_module_startup(&sandwich_sapi, &ec_php_ext_module, 1)) { */
-  if (FAILURE == php_module_startup(&sandwich_sapi, NULL, 0)) {
+  if (FAILURE == php_module_startup(&sandwich_sapi, &sandwich_module_entry, 1)) {
     fprintf(stderr, "Failed to initialize PHP\n");
     return -1;
   }
+  
   return 0;
 }