Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial check-in.

  • Loading branch information...
commit 040130738bdd7315736c8e9ae7ad735b9e4fccf3 0 parents
Andrei Zmievski authored
44 .cvsignore
@@ -0,0 +1,44 @@
+*.lo
+*.la
+.deps
+.libs
+Makefile
+Makefile.fragments
+Makefile.global
+Makefile.objects
+acinclude.m4
+aclocal.m4
+autom4te.cache
+build
+config.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.nice
+config.status
+config.sub
+configure
+configure.in
+conftest
+conftest.c
+include
+install-sh
+libtool
+ltmain.sh
+missing
+mkinstalldirs
+modules
+scan_makefile_in.awk
+*.dsw
+*.plg
+*.opt
+*.ncb
+Release
+Release_inline
+Debug
+Release_TS
+Release_TSDbg
+Release_TS_inline
+Debug_TS
+bloomy*.tgz
5 EXPERIMENTAL
@@ -0,0 +1,5 @@
+this extension is experimental,
+its functions may change their names
+or move to extension all together
+so do not rely to much on them
+you have been warned!
70 README
@@ -0,0 +1,70 @@
+This is a standalone PHP extension created using CodeGen_PECL 1.1.2
+
+HACKING
+=======
+
+There are two ways to modify an extension created using CodeGen_PECL:
+
+1) you can modify the generated code as with any other PHP extension
+
+2) you can add custom code to the CodeGen_PECL XML source and re-run pecl-gen
+
+The 2nd approach may look a bit complicated but you have be aware that any
+manual changes to the generated code will be lost if you ever change the
+XML specs and re-run PECL-Gen. All changes done before have to be applied
+to the newly generated code again.
+Adding code snippets to the XML source itself on the other hand may be a
+bit more complicated but this way your custom code will always be in the
+generated code no matter how often you rerun CodeGen_PECL.
+
+
+BUILDING ON UNIX etc.
+=====================
+
+To compile your new extension, you will have to execute the following steps:
+
+1. $ ./phpize
+2. $ ./configure [--enable--bloomy]
+3. $ make
+4. $ make test
+5. $ [sudo] make install
+
+
+
+BUILDING ON WINDOWS
+===================
+
+The extension provides the VisualStudio V6 project file
+
+ bloomy.dsp
+To compile the extension you open this file using VisualStudio,
+select the apropriate configuration for your installation
+(either "Release_TS" or "Debug_TS") and create "php_bloomy.dll"
+
+After successfull compilation you have to copy the newly
+created "bloomy.dll" to the PHP
+extension directory (default: C:\PHP\extensions).
+
+
+TESTING
+=======
+
+You can now load the extension using a php.ini directive
+
+ extension="bloomy.[so|dll]"
+
+or load it at runtime using the dl() function
+
+ dl("bloomy.[so|dll]");
+
+The extension should now be available, you can test this
+using the extension_loaded() function:
+
+ if (extension_loaded("bloomy"))
+ echo "bloomy loaded :)";
+ else
+ echo "something is wrong :(";
+
+The extension will also add its own block to the output
+of phpinfo();
+
138 bloom.c
@@ -0,0 +1,138 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2009 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Andrei Zmievski <andrei@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+
+#include "bloom.h"
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#define BITS_PER_CHAR 8
+#define MAX_HASHES 50
+
+struct _filter_spec_t {
+ size_t filter_size;
+ uint8_t num_hashes;
+};
+
+struct _bloom_t {
+ uint8_t *filter;
+ struct _filter_spec_t spec;
+
+ double max_error_rate;
+ size_t num_elements;
+
+ uint32_t salt1;
+ uint32_t salt2;
+};
+
+static void bloom_calc_salts(bloom_t *bloom)
+{
+ if (!bloom) {
+ return;
+ }
+}
+
+bloom_return bloom_init(bloom_t *bloom, size_t num_elements, double max_error_rate)
+{
+ filter_spec_t spec;
+ bloom_return status;
+
+ if (!bloom) {
+ return BLOOM_BADARG;
+ }
+
+ if (num_elements == 0 ||
+ num_elements > SIZE_MAX ||
+ max_error_rate <= 0.0 ||
+ max_error_rate >= 1.0) {
+
+ return BLOOM_BADARG;
+ }
+
+ memset(bloom, 0, sizeof(*bloom));
+
+ status = bloom_calc_optimal(&spec, num_elements, max_error_rate);
+ if (status != BLOOM_SUCCESS) {
+ return status;
+ }
+
+ bloom->filter = (uint8_t *)ecalloc(spec.filter_size / BITS_PER_CHAR, sizeof(uint8_t));
+ bloom->spec = spec;
+ bloom->max_error_rate = max_error_rate;
+
+ return BLOOM_SUCCESS;
+}
+
+void bloom_clean(bloom_t *bloom)
+{
+ if (!bloom) {
+ return BLOOM_BADARG;
+ }
+
+ efree(bloom->filter);
+}
+
+bloom_return bloom_add(bloom_t *bloom, const char *data, size_t data_len)
+{
+}
+
+bloom_return bloom_contains(bloom_t *bloom, const char *data, size_t data_len)
+{
+}
+
+bloom_return bloom_calc_optimal(filter_spec_t *spec, size_t num_elements, double max_error_rate)
+{
+ double h;
+ double curr_size = 0.0;
+ double opt_size = (double)SIZE_MAX;
+ double opt_h = 0.0;
+ size_t filter_size;
+ uint8_t num_hashes;
+
+ if (!spec) {
+ return BLOOM_FAILURE;
+ }
+
+ for (h = 0.0; h < (double)MAX_HASHES; h++) {
+ if ((curr_size = ((-h * num_elements) / log(1 - pow(max_error_rate, 1 / h)))) < opt_size) {
+ opt_size = curr_size;
+ opt_h = h;
+ }
+ }
+
+ if (opt_h == 0.0) {
+ return BLOOM_BAD_FILTER_SIZE;
+ }
+
+ filter_size = (size_t)opt_size;
+ filter_size += ((filter_size % BITS_PER_CHAR) > 0 ? BITS_PER_CHAR - (filter_size % BITS_PER_CHAR) : 0);
+ num_hashes = (size_t)opt_h;
+
+ spec->filter_size = filter_size;
+ spec->num_hashes = num_hashes;
+
+ return BLOOM_SUCCESS;
+}
+
+int main()
+{
+ filter_spec_t spec;
+
+ bloom_calc_optimal(&spec, 1000000, 0.01);
+ printf("filter size = %d\nhashes = %d\n", spec.filter_size, spec.num_hashes);
+ return 0;
+}
41 bloom.h
@@ -0,0 +1,41 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2009 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Andrei Zmievski <andrei@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef _BLOOM_H_
+#define _BLOOM_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+
+typedef struct _bloom_t bloom_t;
+typedef struct _filter_spec_t filter_spec_t;
+
+typedef enum {
+ BLOOM_SUCCESS,
+ BLOOM_FAILURE,
+ BLOOM_BADARG,
+ BLOOM_BAD_FILTER_SIZE
+} bloom_return;
+
+bloom_return bloom_init(bloom_t *bloom, size_t num_elements, double max_error_rate);
+void bloom_clean(bloom_t *bloom);
+
+bloom_return bloom_add(bloom_t *bloom, const char *data, size_t data_len);
+bloom_return bloom_contains(bloom_t *blook, const char *data, size_t data_len);
+
+bloom_return bloom_calc_optimal(filter_spec_t *spec, size_t num_elements, double max_error_rate);
+
+#endif /* _BLOOM_H_ */
112 bloomy.dsp
@@ -0,0 +1,112 @@
+# Microsoft Developer Studio Project File - Name="bloomy" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=bloomy - Win32 Debug_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "bloomy.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "bloomy.mak" CFG="bloomy - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "bloomy - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "bloomy - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "bloomy - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BLOOMY_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_BLOOMY" /D ZTS=1 /D HAVE_BLOOMY=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_bloomy.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
+
+!ELSEIF "$(CFG)" == "bloomy - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BLOOMY_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_BLOOMY" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_BLOOMY=1 /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_bloomy.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "bloomy - Win32 Release_TS"
+# Name "bloomy - Win32 Debug_TS"
+
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+
+# Begin Source File
+
+SOURCE=./bloomy.c
+# End Source File
+
+# End Group
+
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+# Begin Source File
+
+SOURCE=.\php_bloomy.h
+# End Source File
+# End Group
+# End Target
+# End Project
29 config.m4
@@ -0,0 +1,29 @@
+dnl
+dnl $ Id: $
+dnl vim:se ts=2 sw=2 et:
+
+PHP_ARG_ENABLE(bloomy, whether to enable bloomy functions,
+[ --enable-bloomy Enable bloomy support])
+
+if test "$PHP_BLOOMY" != "no"; then
+ export OLD_CPPFLAGS="$CPPFLAGS"
+ export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_BLOOMY"
+
+ AC_MSG_CHECKING(PHP version)
+ AC_TRY_COMPILE([#include <php_version.h>], [
+#if PHP_VERSION_ID < 50000
+#error this extension requires at least PHP version 4.0.0
+#endif
+],
+[AC_MSG_RESULT(ok)],
+[AC_MSG_ERROR([need at least PHP 5.0.0])])
+
+ export CPPFLAGS="$OLD_CPPFLAGS"
+
+ PHP_SUBST(BLOOMY_SHARED_LIBADD)
+ AC_DEFINE(HAVE_BLOOMY, 1, [ ])
+
+ PHP_NEW_EXTENSION(bloomy, php_bloomy.c bloom.c, $ext_shared)
+
+fi
+
8 config.w32
@@ -0,0 +1,8 @@
+// $ Id: $
+// vim:ft=javascript
+
+ARG_ENABLE('bloomy' , 'The unknown extension', 'no');
+if (PHP_BLOOMY == "yes") {
+ EXTENSION("bloomy", "bloomy.c");
+ AC_DEFINE("HAVE_BLOOMY", 1, "bloomy support");
+}
62 package.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+
+ <name>bloomy</name>
+ <channel>pecl.php.net</channel>
+
+ <summary>The unknown extension</summary>
+
+ <description>
+
+ </description>
+
+
+ <date>2009-03-16</date>
+ <version>
+ <release>0.0.1dev</release>
+ <api>0.0.1dev</api>
+ </version>
+ <stability>
+ <release>devel</release>
+ <api>devel</api>
+ </stability>
+
+ <license>unknown</license>
+
+ <notes>
+none
+ </notes>
+
+ <contents>
+ <dir name="/">
+ <file role='doc' name='EXPERIMENTAL'/>
+ <file role='src' name='config.m4'/>
+ <file role='src' name='bloomy.dsp'/>
+ <file role='src' name='config.w32'/>
+ <file role='src' name='bloomy.c'/>
+ <file role='src' name='php_bloomy.h'/>
+ </dir>
+ </contents>
+
+ <dependencies>
+ <required>
+ <php>
+ <min>4.0.0</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.0a1</min>
+ </pearinstaller>
+ </required>
+ </dependencies>
+
+ <providesextension>bloomy</providesextension>
+
+ <extsrcrelease/>
+
+</package>
115 php_bloomy.c
@@ -0,0 +1,115 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2009 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Andrei Zmievski <andrei@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $ Id: $ */
+
+#include "php_bloomy.h"
+
+#if HAVE_BLOOMY
+
+/* {{{ bloomy_functions[] */
+function_entry bloomy_functions[] = {
+ { NULL, NULL, NULL }
+};
+/* }}} */
+
+
+/* {{{ bloomy_module_entry
+ */
+zend_module_entry bloomy_module_entry = {
+ STANDARD_MODULE_HEADER,
+ "bloomy",
+ bloomy_functions,
+ PHP_MINIT(bloomy), /* Replace with NULL if there is nothing to do at php startup */
+ PHP_MSHUTDOWN(bloomy), /* Replace with NULL if there is nothing to do at php shutdown */
+ PHP_RINIT(bloomy), /* Replace with NULL if there is nothing to do at request start */
+ PHP_RSHUTDOWN(bloomy), /* Replace with NULL if there is nothing to do at request end */
+ PHP_MINFO(bloomy),
+ "0.0.1dev",
+ STANDARD_MODULE_PROPERTIES
+};
+/* }}} */
+
+#ifdef COMPILE_DL_BLOOMY
+ZEND_GET_MODULE(bloomy)
+#endif
+
+
+/* {{{ PHP_MINIT_FUNCTION */
+PHP_MINIT_FUNCTION(bloomy)
+{
+
+ /* add your stuff here */
+
+ return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
+PHP_MSHUTDOWN_FUNCTION(bloomy)
+{
+
+ /* add your stuff here */
+
+ return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_RINIT_FUNCTION */
+PHP_RINIT_FUNCTION(bloomy)
+{
+ /* add your stuff here */
+
+ return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_RSHUTDOWN_FUNCTION */
+PHP_RSHUTDOWN_FUNCTION(bloomy)
+{
+ /* add your stuff here */
+
+ return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_MINFO_FUNCTION */
+PHP_MINFO_FUNCTION(bloomy)
+{
+ php_info_print_box_start(0);
+ php_printf("<p>The unknown extension</p>\n");
+ php_printf("<p>Version 0.0.1devdevel (2009-03-16)</p>\n");
+ php_info_print_box_end();
+ /* add your stuff here */
+
+}
+/* }}} */
+
+#endif /* HAVE_BLOOMY */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
94 php_bloomy.h
@@ -0,0 +1,94 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2009 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Andrei Zmievski <andrei@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $ Id: $ */
+
+#ifndef PHP_BLOOMY_H
+#define PHP_BLOOMY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <php.h>
+
+#ifdef HAVE_BLOOMY
+
+#include <php_ini.h>
+#include <SAPI.h>
+#include <ext/standard/info.h>
+#include <Zend/zend_extensions.h>
+#ifdef __cplusplus
+} // extern "C"
+#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern zend_module_entry bloomy_module_entry;
+#define phpext_bloomy_ptr &bloomy_module_entry
+
+#ifdef PHP_WIN32
+#define PHP_BLOOMY_API __declspec(dllexport)
+#else
+#define PHP_BLOOMY_API
+#endif
+
+PHP_MINIT_FUNCTION(bloomy);
+PHP_MSHUTDOWN_FUNCTION(bloomy);
+PHP_RINIT_FUNCTION(bloomy);
+PHP_RSHUTDOWN_FUNCTION(bloomy);
+PHP_MINFO_FUNCTION(bloomy);
+
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource))
+
+#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC)
+
+#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC)
+
+#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC)
+#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC)
+
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* PHP_HAVE_BLOOMY */
+
+#endif /* PHP_BLOOMY_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
Please sign in to comment.
Something went wrong with that request. Please try again.