Back to index

php5  5.3.10
skeleton.c
Go to the documentation of this file.
00001 /* __header_here__ */
00002 
00003 #ifdef HAVE_CONFIG_H
00004 #include "config.h"
00005 #endif
00006 
00007 #include "php.h"
00008 #include "php_ini.h"
00009 #include "ext/standard/info.h"
00010 #include "php_extname.h"
00011 
00012 /* If you declare any globals in php_extname.h uncomment this:
00013 ZEND_DECLARE_MODULE_GLOBALS(extname)
00014 */
00015 
00016 /* True global resources - no need for thread safety here */
00017 static int le_extname;
00018 
00019 /* {{{ extname_functions[]
00020  *
00021  * Every user visible function must have an entry in extname_functions[].
00022  */
00023 const zend_function_entry extname_functions[] = {
00024        PHP_FE(confirm_extname_compiled,   NULL)         /* For testing, remove later. */
00025        /* __function_entries_here__ */
00026        PHP_FE_END    /* Must be the last line in extname_functions[] */
00027 };
00028 /* }}} */
00029 
00030 /* {{{ extname_module_entry
00031  */
00032 zend_module_entry extname_module_entry = {
00033 #if ZEND_MODULE_API_NO >= 20010901
00034        STANDARD_MODULE_HEADER,
00035 #endif
00036        "extname",
00037        extname_functions,
00038        PHP_MINIT(extname),
00039        PHP_MSHUTDOWN(extname),
00040        PHP_RINIT(extname),         /* Replace with NULL if there's nothing to do at request start */
00041        PHP_RSHUTDOWN(extname),     /* Replace with NULL if there's nothing to do at request end */
00042        PHP_MINFO(extname),
00043 #if ZEND_MODULE_API_NO >= 20010901
00044        "0.1", /* Replace with version number for your extension */
00045 #endif
00046        STANDARD_MODULE_PROPERTIES
00047 };
00048 /* }}} */
00049 
00050 #ifdef COMPILE_DL_EXTNAME
00051 ZEND_GET_MODULE(extname)
00052 #endif
00053 
00054 /* {{{ PHP_INI
00055  */
00056 /* Remove comments and fill if you need to have entries in php.ini
00057 PHP_INI_BEGIN()
00058     STD_PHP_INI_ENTRY("extname.global_value",      "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_extname_globals, extname_globals)
00059     STD_PHP_INI_ENTRY("extname.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_extname_globals, extname_globals)
00060 PHP_INI_END()
00061 */
00062 /* }}} */
00063 
00064 /* {{{ php_extname_init_globals
00065  */
00066 /* Uncomment this function if you have INI entries
00067 static void php_extname_init_globals(zend_extname_globals *extname_globals)
00068 {
00069        extname_globals->global_value = 0;
00070        extname_globals->global_string = NULL;
00071 }
00072 */
00073 /* }}} */
00074 
00075 /* {{{ PHP_MINIT_FUNCTION
00076  */
00077 PHP_MINIT_FUNCTION(extname)
00078 {
00079        /* If you have INI entries, uncomment these lines 
00080        REGISTER_INI_ENTRIES();
00081        */
00082        return SUCCESS;
00083 }
00084 /* }}} */
00085 
00086 /* {{{ PHP_MSHUTDOWN_FUNCTION
00087  */
00088 PHP_MSHUTDOWN_FUNCTION(extname)
00089 {
00090        /* uncomment this line if you have INI entries
00091        UNREGISTER_INI_ENTRIES();
00092        */
00093        return SUCCESS;
00094 }
00095 /* }}} */
00096 
00097 /* Remove if there's nothing to do at request start */
00098 /* {{{ PHP_RINIT_FUNCTION
00099  */
00100 PHP_RINIT_FUNCTION(extname)
00101 {
00102        return SUCCESS;
00103 }
00104 /* }}} */
00105 
00106 /* Remove if there's nothing to do at request end */
00107 /* {{{ PHP_RSHUTDOWN_FUNCTION
00108  */
00109 PHP_RSHUTDOWN_FUNCTION(extname)
00110 {
00111        return SUCCESS;
00112 }
00113 /* }}} */
00114 
00115 /* {{{ PHP_MINFO_FUNCTION
00116  */
00117 PHP_MINFO_FUNCTION(extname)
00118 {
00119        php_info_print_table_start();
00120        php_info_print_table_header(2, "extname support", "enabled");
00121        php_info_print_table_end();
00122 
00123        /* Remove comments if you have entries in php.ini
00124        DISPLAY_INI_ENTRIES();
00125        */
00126 }
00127 /* }}} */
00128 
00129 
00130 /* Remove the following function when you have succesfully modified config.m4
00131    so that your module can be compiled into PHP, it exists only for testing
00132    purposes. */
00133 
00134 /* Every user-visible function in PHP should document itself in the source */
00135 /* {{{ proto string confirm_extname_compiled(string arg)
00136    Return a string to confirm that the module is compiled in */
00137 PHP_FUNCTION(confirm_extname_compiled)
00138 {
00139        char *arg = NULL;
00140        int arg_len, len;
00141        char *strg;
00142 
00143        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
00144               return;
00145        }
00146 
00147        len = spprintf(&strg, 0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg);
00148        RETURN_STRINGL(strg, len, 0);
00149 }
00150 /* }}} */
00151 /* The previous line is meant for vim and emacs, so it can correctly fold and 
00152    unfold functions in source code. See the corresponding marks just before 
00153    function definition, where the functions purpose is also documented. Please 
00154    follow this convention for the convenience of others editing your code.
00155 */
00156 
00157 /* __function_stubs_here__ */
00158 
00159 /*
00160  * Local variables:
00161  * tab-width: 4
00162  * c-basic-offset: 4
00163  * End:
00164  * vim600: noet sw=4 ts=4 fdm=marker
00165  * vim<600: noet sw=4 ts=4
00166  */