rid
rid

Reputation: 63542

Where are things like zval defined?

I'm trying to develop a PHP extension using Eclipse and CDT, but the extension code is reported as full of syntax errors and warnings. I managed to get rid of part of them by telling CDT to look for the PHP include directory and the main directory from the PHP source code, which resolved all the includes, but there are still a lot of problems.

Specifically, where do I find the definition for zval, SUCCESS, FAILURE, STANDARD_MODULE_PROPERTIES, zend_module_entry, zend_function_entry and zend_parse_parameters? How do I get CDT to not mark <module name>, <module name>_functions and return_value as an unresolvable symbols?

Is there a better way to develop a PHP extension using an IDE?

Upvotes: 1

Views: 522

Answers (1)

Morpfh
Morpfh

Reputation: 4093

For where to find:

typedef struct _zval_struct zval;                     : ./Zend/zend.h
struct _zval_struct {                                 : ./Zend/zend.h
SUCCESS                                               : ./Zend/zend.h
FAILURE                                               : ./Zend/zend.h
STANDARD_MODULE_PROPERTIES                            : ./Zend/zend_modules.h
typedef struct _zend_module_entry zend_module_entry;  : ./Zend/zend_modules.h
struct _zend_module_entry { :                         : ./Zend/zend_modules.h
typedef struct _zend_function_entry {
…
} zend_function_entry;                                : ./Zend/zend_API.h
zend_parse_parameters(                                : ./Zend/zend_API.c

If you want to look at PHP source code like that i suggest you use i.e. Vim in combination with cscope. Then all you have to do is have the marker on i.e. zval, enter two keys and it jumps to the definition.


From a quick google it looks like Eclipse also has some cscope support or the like. Search workspace? It would require you to load the PHP source in to workspace tho I guess.

When it comes to CDT I have no idea. Never used it.


Edit:

Had a look at it out of curiosity and need to get to know CDT.

  • Created a standard C project.
  • Right click project
    • Paths and Symbols
      • Source location; added PHP directory.
  • Right click project
    • Index
      • Rebuild (Big source so takes a while)

Now I can say i.e. zend_parse_param CtrlSpace and get auto completion. Or zend_parse_parameters( CtrlSpace.

Or select Search -> C/C++... and select i.e. "Definitions", text "zval" -> search and get definitions.

Or type zva CtrlSpace and get zval etc.

You can also right click PHP source in Project Explorer and select i.e. Exclude from build etc.

Upvotes: 2

Related Questions