|
version 1.1, 2012/02/21 23:47:51
|
version 1.1.1.2, 2014/06/15 20:03:41
|
|
Line 31 HOW TO USE IT
|
Line 31 HOW TO USE IT
|
| |
|
| ./buildconf; ./configure --enable-module_name; make |
./buildconf; ./configure --enable-module_name; make |
| |
|
| |
The definition of PHP_MODULE_NAME_VERSION will be present in the |
| |
php_module_name.h and injected into the zend_module_entry definition. This |
| |
is required by the PECL website for the version string conformity checks |
| |
against package.xml |
| |
|
| But if you already have planned the overall scheme of your module, what |
But if you already have planned the overall scheme of your module, what |
| functions it will contain, their return types and the arguments they take |
functions it will contain, their return types and the arguments they take |
| (a very good idea) and don't want to bother yourself with creating function |
(a very good idea) and don't want to bother yourself with creating function |
|
Line 40 HOW TO USE IT
|
Line 45 HOW TO USE IT
|
| |
|
| --proto=filename. |
--proto=filename. |
| |
|
| |
SOURCE AND HEADER FILE NAME |
| |
|
| |
./ext_skel generates 'module_name.c' and 'php_module_name.h' as main source |
| |
and header files. Keep these names. |
| |
|
| |
Module functions (User functions) must be named |
| |
|
| |
module_name_function() |
| |
|
| |
When you need to expose module functions to other modules, expose functions |
| |
strictly needed by others. Exposed internal function must be named |
| |
|
| |
php_module_name_function() |
| |
|
| |
See also CODING_STANDARDS. |
| |
|
| |
|
| FORMAT OF FUNCTION DEFINITIONS FILE |
FORMAT OF FUNCTION DEFINITIONS FILE |
| |
|
| All the definitions must be on one line. In it's simplest form, it's just |
All the definitions must be on one line. In it's simplest form, it's just |
| the function name, e.g. |
the function name, e.g. |
| |
|
| my_function | module_name_function |
| |
|
| but then you'll be left with an almost empty function body without any |
but then you'll be left with an almost empty function body without any |
| argument handling. |
argument handling. |
|
Line 67 FORMAT OF FUNCTION DEFINITIONS FILE
|
Line 89 FORMAT OF FUNCTION DEFINITIONS FILE
|
| |
|
| An example: |
An example: |
| |
|
| my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st | module_name_function(int arg1, int arg2 [, int arg3 [, int arg4]]) |
| |
|
| |
Arguments arg1 and arg2 are required. |
| Arguments arg3 and arg4 are optional. |
Arguments arg3 and arg4 are optional. |
| |
|
| If possible, the function definition should also contain it's return type |
If possible, the function definition should also contain it's return type |
|
Line 128 EXAMPLE
|
Line 151 EXAMPLE
|
| |
|
| The following _one_ line |
The following _one_ line |
| |
|
| bool my_drawtext(resource image, string text, resource font, int x, int y [, int color]) | bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color]) |
| |
|
| will create this function definition for you (note that there are a few |
will create this function definition for you (note that there are a few |
| question marks to be replaced by you, and you must of course add your own |
question marks to be replaced by you, and you must of course add your own |
| value definitions too): |
value definitions too): |
| |
|
| /* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y [, int color]) | /* {{{ proto bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color]) |
| */ |
*/ |
| PHP_FUNCTION(my_drawtext) | PHP_FUNCTION(module_name_drawtext) |
| { |
{ |
| char *text = NULL; |
char *text = NULL; |
| int argc = ZEND_NUM_ARGS(); |
int argc = ZEND_NUM_ARGS(); |
|
Line 159 PHP_FUNCTION(my_drawtext)
|
Line 182 PHP_FUNCTION(my_drawtext)
|
| ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id); |
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id); |
| } |
} |
| |
|
| php_error(E_WARNING, "my_drawtext: not yet implemented"); | php_error(E_WARNING, "module_name_drawtext: not yet implemented"); |
| } |
} |
| /* }}} */ |
/* }}} */ |
| |
|