root/ext/skeleton/skeleton.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. PHP_FUNCTION
  2. PHP_MINIT_FUNCTION
  3. PHP_MSHUTDOWN_FUNCTION
  4. PHP_RINIT_FUNCTION
  5. PHP_RSHUTDOWN_FUNCTION
  6. PHP_MINFO_FUNCTION

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

/* [<][>][^][v][top][bottom][index][help] */