[cvs-annodex] commit (/annodex): phpannodex/trunk/src/phpannodex.c
phpannodex/trunk/src/phpanx_general.c
phpannodex/trunk/src/phpanx_util.c
phpannodex/trunk/src/phpanx_util.h
ctford
nobody at lists.annodex.net
Thu Dec 15 10:04:43 EST 2005
Update of /annodex (new revision 1706)
Modified files:
phpannodex/trunk/src/phpannodex.c
phpannodex/trunk/src/phpanx_general.c
phpannodex/trunk/src/phpanx_util.c
phpannodex/trunk/src/phpanx_util.h
Log Message:
anx_new() now returns a resource rather than a pointer cast to a long. However, I seem to have somehow broken the struc to object conversion bits.
Modified: phpannodex/trunk/src/phpannodex.c
===================================================================
--- phpannodex/trunk/src/phpannodex.c 2005-12-14 03:53:54 UTC (rev 1705)
+++ phpannodex/trunk/src/phpannodex.c 2005-12-14 23:04:43 UTC (rev 1706)
@@ -10,9 +10,10 @@
#include "phpanx_write.h"
#include "phpanx_constants.h"
#include "phpanx_types.h"
+#include "phpanx_util.h"
#define LE_ANX_HANDLE_NAME "Annodex file handle"
-static int le_anx_handle;
+
static void anx_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC);
/* This array tells php what functions this extension provides. The functions
Modified: phpannodex/trunk/src/phpanx_general.c
===================================================================
--- phpannodex/trunk/src/phpanx_general.c 2005-12-14 03:53:54 UTC (rev 1705)
+++ phpannodex/trunk/src/phpanx_general.c 2005-12-14 23:04:43 UTC (rev 1706)
@@ -1,6 +1,7 @@
#include "php.h"
#include "phpanx_general.h"
+#include "phpanx_util.h"
#include <annodex/annodex.h>
PHP_FUNCTION(anx_last_error)
@@ -64,7 +65,9 @@
PHP_FUNCTION(anx_new)
{
int mode;
- long ptr_long;
+ ANNODEX* anx;
+ zval* anx_resource;
+ int resource_id;
/* Process arguments */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
@@ -73,9 +76,16 @@
}
/* Call Annodex function */
- ptr_long = (long) anx_new(mode);
+ anx = anx_new(mode);
- RETURN_LONG(ptr_long);
+ MAKE_STD_ZVAL( anx_resource );
+
+ resource_id = ZEND_REGISTER_RESOURCE( anx_resource, anx, le_anx_handle);
+
+php_printf("in anx new <br>");
+
+ RETURN_RESOURCE( resource_id );
+ //RETURN_LONG(ptr_long);
}
PHP_FUNCTION(anx_close)
Modified: phpannodex/trunk/src/phpanx_util.c
===================================================================
--- phpannodex/trunk/src/phpanx_util.c 2005-12-14 03:53:54 UTC (rev 1705)
+++ phpannodex/trunk/src/phpanx_util.c 2005-12-14 23:04:43 UTC (rev 1706)
@@ -2,6 +2,8 @@
#include "phpanx_util.h"
#include <string.h>
+int le_anx_handle;
+
char* empty_to_null( char* string ) {
if( strlen(string) == 0 ) {
Modified: phpannodex/trunk/src/phpanx_util.h
===================================================================
--- phpannodex/trunk/src/phpanx_util.h 2005-12-14 03:53:54 UTC (rev 1705)
+++ phpannodex/trunk/src/phpanx_util.h 2005-12-14 23:04:43 UTC (rev 1706)
@@ -9,5 +9,6 @@
zval_copy_ctor( return_value ); \
char* empty_to_null( char* string );
+extern int le_anx_handle;
#endif
--
ctford
More information about the cvs-annodex
mailing list