File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / skeleton / skeleton.c
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 20:03:55 2014 UTC (10 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29, HEAD
php 5.4.29

    1: /* __header_here__ */
    2: 
    3: #ifdef HAVE_CONFIG_H
    4: #include "config.h"
    5: #endif
    6: 
    7: #include "php.h"
    8: #include "php_ini.h"
    9: #include "ext/standard/info.h"
   10: #include "php_extname.h"
   11: 
   12: /* If you declare any globals in php_extname.h uncomment this:
   13: ZEND_DECLARE_MODULE_GLOBALS(extname)
   14: */
   15: 
   16: /* True global resources - no need for thread safety here */
   17: static int le_extname;
   18: 
   19: /* {{{ extname_functions[]
   20:  *
   21:  * Every user visible function must have an entry in extname_functions[].
   22:  */
   23: const zend_function_entry extname_functions[] = {
   24: 	PHP_FE(confirm_extname_compiled,	NULL)		/* For testing, remove later. */
   25: 	/* __function_entries_here__ */
   26: 	PHP_FE_END	/* Must be the last line in extname_functions[] */
   27: };
   28: /* }}} */
   29: 
   30: /* {{{ extname_module_entry
   31:  */
   32: zend_module_entry extname_module_entry = {
   33: #if ZEND_MODULE_API_NO >= 20010901
   34: 	STANDARD_MODULE_HEADER,
   35: #endif
   36: 	"extname",
   37: 	extname_functions,
   38: 	PHP_MINIT(extname),
   39: 	PHP_MSHUTDOWN(extname),
   40: 	PHP_RINIT(extname),		/* Replace with NULL if there's nothing to do at request start */
   41: 	PHP_RSHUTDOWN(extname),	/* Replace with NULL if there's nothing to do at request end */
   42: 	PHP_MINFO(extname),
   43: #if ZEND_MODULE_API_NO >= 20010901
   44: 	PHP_EXTNAME_VERSION,
   45: #endif
   46: 	STANDARD_MODULE_PROPERTIES
   47: };
   48: /* }}} */
   49: 
   50: #ifdef COMPILE_DL_EXTNAME
   51: ZEND_GET_MODULE(extname)
   52: #endif
   53: 
   54: /* {{{ PHP_INI
   55:  */
   56: /* Remove comments and fill if you need to have entries in php.ini
   57: PHP_INI_BEGIN()
   58:     STD_PHP_INI_ENTRY("extname.global_value",      "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_extname_globals, extname_globals)
   59:     STD_PHP_INI_ENTRY("extname.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_extname_globals, extname_globals)
   60: PHP_INI_END()
   61: */
   62: /* }}} */
   63: 
   64: /* {{{ php_extname_init_globals
   65:  */
   66: /* Uncomment this function if you have INI entries
   67: static void php_extname_init_globals(zend_extname_globals *extname_globals)
   68: {
   69: 	extname_globals->global_value = 0;
   70: 	extname_globals->global_string = NULL;
   71: }
   72: */
   73: /* }}} */
   74: 
   75: /* {{{ PHP_MINIT_FUNCTION
   76:  */
   77: PHP_MINIT_FUNCTION(extname)
   78: {
   79: 	/* If you have INI entries, uncomment these lines 
   80: 	REGISTER_INI_ENTRIES();
   81: 	*/
   82: 	return SUCCESS;
   83: }
   84: /* }}} */
   85: 
   86: /* {{{ PHP_MSHUTDOWN_FUNCTION
   87:  */
   88: PHP_MSHUTDOWN_FUNCTION(extname)
   89: {
   90: 	/* uncomment this line if you have INI entries
   91: 	UNREGISTER_INI_ENTRIES();
   92: 	*/
   93: 	return SUCCESS;
   94: }
   95: /* }}} */
   96: 
   97: /* Remove if there's nothing to do at request start */
   98: /* {{{ PHP_RINIT_FUNCTION
   99:  */
  100: PHP_RINIT_FUNCTION(extname)
  101: {
  102: 	return SUCCESS;
  103: }
  104: /* }}} */
  105: 
  106: /* Remove if there's nothing to do at request end */
  107: /* {{{ PHP_RSHUTDOWN_FUNCTION
  108:  */
  109: PHP_RSHUTDOWN_FUNCTION(extname)
  110: {
  111: 	return SUCCESS;
  112: }
  113: /* }}} */
  114: 
  115: /* {{{ PHP_MINFO_FUNCTION
  116:  */
  117: PHP_MINFO_FUNCTION(extname)
  118: {
  119: 	php_info_print_table_start();
  120: 	php_info_print_table_header(2, "extname support", "enabled");
  121: 	php_info_print_table_end();
  122: 
  123: 	/* Remove comments if you have entries in php.ini
  124: 	DISPLAY_INI_ENTRIES();
  125: 	*/
  126: }
  127: /* }}} */
  128: 
  129: 
  130: /* Remove the following function when you have successfully modified config.m4
  131:    so that your module can be compiled into PHP, it exists only for testing
  132:    purposes. */
  133: 
  134: /* Every user-visible function in PHP should document itself in the source */
  135: /* {{{ proto string confirm_extname_compiled(string arg)
  136:    Return a string to confirm that the module is compiled in */
  137: PHP_FUNCTION(confirm_extname_compiled)
  138: {
  139: 	char *arg = NULL;
  140: 	int arg_len, len;
  141: 	char *strg;
  142: 
  143: 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
  144: 		return;
  145: 	}
  146: 
  147: 	len = spprintf(&strg, 0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg);
  148: 	RETURN_STRINGL(strg, len, 0);
  149: }
  150: /* }}} */
  151: /* The previous line is meant for vim and emacs, so it can correctly fold and 
  152:    unfold functions in source code. See the corresponding marks just before 
  153:    function definition, where the functions purpose is also documented. Please 
  154:    follow this convention for the convenience of others editing your code.
  155: */
  156: 
  157: /* __function_stubs_here__ */
  158: 
  159: /*
  160:  * Local variables:
  161:  * tab-width: 4
  162:  * c-basic-offset: 4
  163:  * End:
  164:  * vim600: noet sw=4 ts=4 fdm=marker
  165:  * vim<600: noet sw=4 ts=4
  166:  */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>