skeleton.c 3.9 KB

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