Hi.

Just seeing if I can get a small extension upgraded from 5.3 to 5.4
(the pecl/inclued extension). This is my attempt to learn more about
internals and hopefully increase my contribution to the project.

Prior to doing any work, I'm getting these errors ...

..\pecl\inclued\inclued.c(116) : error C2039: 'filename' : is not a
member of '_zend_class_entry'
        D:\BuildPHP\PHP_5_4\PHP_5_4\Zend\zend.h(462) : see declaration
of '_zend_class_entry'

..\pecl\inclued\inclued.c(116) : error C2198: 'add_assoc_string_ex' :
too few arguments for call

..\pecl\inclued\inclued.c(117) : error C2039: 'line_start' : is not a
member of '_zend_class_entry'
        D:\BuildPHP\PHP_5_4\PHP_5_4\Zend\zend.h(462) : see declaration
of '_zend_class_entry'

..\pecl\inclued\inclued.c(117) : error C2198: 'add_assoc_long_ex' :
too few arguments for call

..\pecl\inclued\inclued.c(130) : error C2039: 'filename' : is not a
member of '_zend_class_entry'
        D:\BuildPHP\PHP_5_4\PHP_5_4\Zend\zend.h(462) : see declaration
of '_zend_class_entry'

..\pecl\inclued\inclued.c(130) : error C2198: 'add_assoc_string_ex' :
too few arguments for call

..\pecl\inclued\inclued.c(131) : error C2039: 'line_start' : is not a
member of '_zend_class_entry'
        D:\BuildPHP\PHP_5_4\PHP_5_4\Zend\zend.h(462) : see declaration
of '_zend_class_entry'

..\pecl\inclued\inclued.c(131) : error C2198: 'add_assoc_long_ex' :
too few arguments for call

So, filename and line_start are missing and should be
user.info.filename and info.user.line_start.

At this stage, I'm guessing that the add_assoc_string_ex errors are a
knock-on effect as I can't see any difference in the macro
definitions.


So, I assume there has to be a #define to separate ...

                add_assoc_string_ex(class_entry, "filename", sizeof("filename"),
ce->filename, 1);
and
                add_assoc_string_ex(class_entry, "filename", sizeof("filename"),
ce->info.user.filename, 1);

http://svn.php.net/viewvc/pecl/apc/trunk/apc_zend.h?r1=303382&r2=303383&;
introduced a set of macros to cover some of the elements of
zend_class_entry, but not for all of the elements of info.user, but
contains an adequate pattern to implement the rest of the elements.

Adding ...

#if ZEND_MODULE_API_NO >= 20100409
#define ZEND_ENGINE_2_4
#endif
...
#if defined(ZEND_ENGINE_2_4)
#define ZEND_CE_FILENAME(ce)  (ce)->info.user.filename
#define ZEND_CE_LINESTART(ce) (ce)->info.user.line_start
#else
#define ZEND_CE_FILENAME(ce)  (ce)->filename
#define ZEND_CE_LINESTART(ce) (ce)->line_start
#endif

to inclued_zend.h (I don't know if I should put these in
inclued_zend.h or php_include.h) and using these macros in inclued.c
would be a start, but there are 2 ways I've found of determining the
ZEND_ENGINE value.

http://lxr.php.net/opengrok/xref/PECL/bcompiler/php_bcompiler.h#54,
http://lxr.php.net/opengrok/xref/PECL/apc/apc_php.h#51 (others
extensions also use #if ZEND_MODULE_API_NO >= 20100409 ...).


As several extensions have had to implement these #defines to
distinguish between the different zend engine versions, should these
"level playing field" macros be moved (and completed) form the
extension to core?

OOI. Applying those changes allows inclued.c to compile, but now
leaves me with errors in inclued_zend.c. These seem to be similar in
issue but relate to the znode structures.



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to