00001 /* 00002 00003 Copyright (c) 2003, Braulio José Solano Rojas, OpenIsis Verein 00004 All rights reserved. 00005 00006 Redistribution and use in source and binary forms, with or without modification, are 00007 permitted provided that the following conditions are met: 00008 00009 * Redistributions of source code must retain the above copyright notice, this list of 00010 conditions and the following disclaimer. 00011 * Redistributions in binary form must reproduce the above copyright notice, this list of 00012 conditions and the following disclaimer in the documentation and/or other materials 00013 provided with the distribution. 00014 * Neither the name of the "OpenIsis Verein" nor the names of its contributors may 00015 be used to endorse or promote products derived from this software without specific 00016 prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00019 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00020 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00023 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00027 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00029 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00030 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 00032 */ 00033 00034 #ifndef PHP_ISIS_H 00035 #define PHP_ISIS_H 00036 00037 extern zend_module_entry isis_module_entry; 00038 #define phpext_isis_ptr &isis_module_entry 00039 00040 #ifdef PHP_WIN32 00041 #define PHP_ISIS_API __declspec(dllexport) 00042 #else 00043 #define PHP_ISIS_API 00044 #endif 00045 00046 #ifdef ZTS 00047 #include "TSRM.h" 00048 #endif 00049 00050 #include "openisis.h" 00051 00052 /* Resources types */ 00053 typedef struct 00054 { 00055 long index; 00056 OpenIsisSet set; 00057 int dbid; 00058 } 00059 isis_result; 00060 00061 typedef struct 00062 { 00063 int id; 00064 char *dbname; 00065 } 00066 isis_dbid; 00067 00068 00069 ZEND_MINIT_FUNCTION(isis); 00070 ZEND_MSHUTDOWN_FUNCTION(isis); 00071 ZEND_RINIT_FUNCTION(isis); 00072 ZEND_RSHUTDOWN_FUNCTION(isis); 00073 ZEND_MINFO_FUNCTION(isis); 00074 00075 /* Functions */ 00076 ZEND_FUNCTION(isis_open); 00077 ZEND_FUNCTION(isis_close); 00078 ZEND_FUNCTION(isis_search); 00079 ZEND_FUNCTION(isis_query); 00080 ZEND_FUNCTION(isis_terms); 00081 ZEND_FUNCTION(isis_fetch_array); 00082 ZEND_FUNCTION(isis_fetch_flat_array); 00083 ZEND_FUNCTION(isis_fetch_flat_array_from_mfn); 00084 ZEND_FUNCTION(isis_num_rows); 00085 ZEND_FUNCTION(isis_data_seek); 00086 ZEND_FUNCTION(isis_mfn_data_seek); 00087 ZEND_FUNCTION(isis_free_result); 00088 ZEND_FUNCTION(isis_write); 00089 ZEND_FUNCTION(isis_last_mfn); 00090 static void isis_result_destructor(isis_result *result); 00091 static void isis_dbid_destructor(isis_dbid *dbid); 00092 00093 ZEND_BEGIN_MODULE_GLOBALS(isis) 00094 char *default_dir; 00095 char *default_database; 00096 ZEND_END_MODULE_GLOBALS(isis) 00097 00098 /* In every utility function you add that needs to use variables 00099 in php_isis_globals, call TSRM_FETCH(); after declaring other 00100 variables used by that function, or better yet, pass in TSRMG_CC 00101 after the last function argument and declare your utility function 00102 with TSRMG_DC after the last declared argument. Always refer to 00103 the globals in your function as ISIS_G(variable). You are 00104 encouraged to rename these macros something shorter, see 00105 examples in any other php module directory. 00106 */ 00107 00108 #ifdef ZTS 00109 #define ISIS_G(v) TSRMG(isis_globals_id, zend_isis_globals *, v) 00110 #else 00111 #define ISIS_G(v) (isis_globals.v) 00112 #endif 00113 00114 #endif /* PHP_ISIS_H */ 00115 00116 00117 /* 00118 * Local variables: 00119 * tab-width: 4 00120 * c-basic-offset: 4 00121 * indent-tabs-mode: t 00122 * End: 00123 */