> De : Pierre Joye [mailto:pierre....@gmail.com] > What do you think about the creation of an example extension covering > almost everything one would do in an extension? > > The class, methods or functions do not have to be useful but to have simple > clear examples to display the differences with extensive comments. > > Doing so has the big advantage of being self contained and anyone can > contribute easily. It is also easier for someone to actually play with it > than with a diff.
Maybe php-ext-gen can be useful here. It is a PHP extension generator I just wrote, with the objective to avoid splitting extension source trees to two independent branches, as differences between PHP 5 & 7 are beyond what macros can do. The other objective is to make it easier to write a typical 'bridge' extension without knowing much to the PHP API (without manipulating any zval). It could be an ideal environment for an example extension. The current version already abstracts and generates code for argument parsing, return types, ini settings, resources, functions, constants. The source for this is a Yaml or Json synthetic description and C code reduced to the bare minimum. It is based on pluggable generators, the primary scope being PHP5, PHP7, and HHVM. Currently, the only implemented generator is PHP 5, but PHP 7 will be easy to implement (it is based on twig templates). The project is at https://github.com/flaupretre/php-ext-gen. Look in the examples subdir, the wiki, and tell me what you think. Cheers François -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php