Changeset 1477 in svn for trunk/xcache.c


Ignore:
Timestamp:
2013-11-23T01:46:42Z (22 months ago)
Author:
Xuefer
Message:

adds reflection info for APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r1476 r1477  
    177177/* }}} */
    178178
    179 /* {{{ proto int xcache_get_refcount(mixed &variable)
    180    XCache internal uses only: Get reference count of referenced variable */
    181 #ifdef ZEND_BEGIN_ARG_INFO_EX
    182 ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_refcount, 0, 0, 1)
    183     ZEND_ARG_INFO(1, variable)
    184 ZEND_END_ARG_INFO()
    185 #else
    186 static unsigned char arginfo_xcache_get_refcount[] = { 1, BYREF_FORCE };
    187 #endif
    188 
    189 PHP_FUNCTION(xcache_get_refcount)
    190 {
    191     zval *variable;
    192     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
    193         RETURN_NULL();
    194     }
    195 
    196     RETURN_LONG(Z_REFCOUNT(*variable) - 1);
    197 }
    198 /* }}} */
    199 /* {{{ proto int xcache_get_cowcount(mixed value)
    200    XCache internal uses only: Get reference count of copy-on-write variable or data */
    201 #ifdef ZEND_BEGIN_ARG_INFO_EX
    202 ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_cowcount, 0, 0, 1)
    203     ZEND_ARG_INFO(0, variable)
    204 ZEND_END_ARG_INFO()
    205 #else
    206 static unsigned char arginfo_xcache_get_cowcount[] = { 1, BYREF_NONE };
    207 #endif
    208 
    209 PHP_FUNCTION(xcache_get_cowcount)
    210 {
    211     zval *variable;
    212     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
    213         RETURN_NULL();
    214     }
    215 
    216     RETURN_LONG(Z_REFCOUNT(*variable) - 1);
    217 }
    218 /* }}} */
    219 /* {{{ proto bool xcache_get_isref(mixed variable)
    220    XCache internal uses only: Check if variable data is marked referenced */
    221 #ifdef ZEND_BEGIN_ARG_INFO_EX
    222 ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_isref, 0, 0, 1)
    223     ZEND_ARG_INFO(1, variable)
    224 ZEND_END_ARG_INFO()
    225 #else
    226 static unsigned char arginfo_xcache_get_isref[] = { 1, BYREF_FORCE };
    227 #endif
    228 
    229 PHP_FUNCTION(xcache_get_isref)
    230 {
    231     zval *variable;
    232     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
    233         RETURN_NULL();
    234     }
    235 
    236     RETURN_BOOL(Z_ISREF(*variable) && Z_REFCOUNT(*variable) >= 3);
    237 }
    238 /* }}} */
    239179#ifdef HAVE_XCACHE_DPRINT
    240180/* {{{ proto bool  xcache_dprint(mixed value)
    241    Prints variable (or value) internal struct (debug only) */
     181   Prints internal struct of an zval (debug only) */
    242182#include "xc_processor.h"
     183
     184#ifdef ZEND_BEGIN_ARG_INFO_EX
     185ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_dprint, 0, 0, 1)
     186    ZEND_ARG_INFO(0, value)
     187ZEND_END_ARG_INFO()
     188#else
     189static unsigned char arginfo_xcache_dprint[] = { 1, BYREF_NONE };
     190#endif
     191
    243192PHP_FUNCTION(xcache_dprint)
    244193{
     
    252201/* }}} */
    253202#endif
     203#ifdef HAVE_XCACHE_ASSEMBLER
    254204/* {{{ proto string xcache_asm(string filename)
    255205 */
    256 #ifdef HAVE_XCACHE_ASSEMBLER
    257206PHP_FUNCTION(xcache_asm)
    258207{
    259208}
    260 #endif
    261 /* }}} */
     209/* }}} */
     210#endif
     211#ifdef HAVE_XCACHE_ENCODER
    262212/* {{{ proto string xcache_encode(string filename)
    263213   Encode php file into XCache opcode encoded format */
    264 #ifdef HAVE_XCACHE_ENCODER
    265214PHP_FUNCTION(xcache_encode)
    266215{
    267216}
    268 #endif
    269 /* }}} */
     217/* }}} */
     218#endif
     219#ifdef HAVE_XCACHE_DECODER
    270220/* {{{ proto bool xcache_decode_file(string filename)
    271221   Decode(load) opcode from XCache encoded format file */
    272 #ifdef HAVE_XCACHE_DECODER
    273222PHP_FUNCTION(xcache_decode_file)
    274223{
    275224}
    276 #endif
    277225/* }}} */
    278226/* {{{ proto bool xcache_decode_string(string data)
    279227   Decode(load) opcode from XCache encoded format data */
    280 #ifdef HAVE_XCACHE_DECODER
    281228PHP_FUNCTION(xcache_decode_string)
    282229{
    283230}
    284 #endif
    285 /* }}} */
     231/* }}} */
     232#endif
    286233/* {{{ xc_call_getter */
    287234typedef const char *(xc_name_getter_t)(zend_uchar type);
     
    309256/* }}} */
    310257/* {{{ proto string xcache_get_op_type(int op_type) */
     258#ifdef ZEND_BEGIN_ARG_INFO_EX
     259ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_op_type, 0, 0, 1)
     260    ZEND_ARG_INFO(0, op_type)
     261ZEND_END_ARG_INFO()
     262#else
     263static unsigned char arginfo_xcache_get_op_type[] = { 1, BYREF_NONE };
     264#endif
     265
    311266PHP_FUNCTION(xcache_get_op_type)
    312267{
     
    315270/* }}} */
    316271/* {{{ proto string xcache_get_data_type(int type) */
     272#ifdef ZEND_BEGIN_ARG_INFO_EX
     273ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_data_type, 0, 0, 1)
     274    ZEND_ARG_INFO(0, type)
     275ZEND_END_ARG_INFO()
     276#else
     277static unsigned char arginfo_xcache_get_data_type[] = { 1, BYREF_NONE };
     278#endif
     279
    317280PHP_FUNCTION(xcache_get_data_type)
    318281{
     
    321284/* }}} */
    322285/* {{{ proto string xcache_get_opcode(int opcode) */
     286#ifdef ZEND_BEGIN_ARG_INFO_EX
     287ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_opcode, 0, 0, 1)
     288    ZEND_ARG_INFO(0, opcode)
     289ZEND_END_ARG_INFO()
     290#else
     291static unsigned char arginfo_xcache_get_opcode[] = { 1, BYREF_NONE };
     292#endif
     293
    323294PHP_FUNCTION(xcache_get_opcode)
    324295{
     
    327298/* }}} */
    328299/* {{{ proto string xcache_get_op_spec(int op_type) */
     300#ifdef ZEND_BEGIN_ARG_INFO_EX
     301ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_op_spec, 0, 0, 1)
     302    ZEND_ARG_INFO(0, op_type)
     303ZEND_END_ARG_INFO()
     304#else
     305static unsigned char arginfo_xcache_get_op_spec[] = { 1, BYREF_NONE };
     306#endif
     307
    329308PHP_FUNCTION(xcache_get_op_spec)
    330309{
     
    333312/* }}} */
    334313/* {{{ proto string xcache_get_opcode_spec(int opcode) */
     314#ifdef ZEND_BEGIN_ARG_INFO_EX
     315ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_opcode_spec, 0, 0, 1)
     316    ZEND_ARG_INFO(0, opcode)
     317ZEND_END_ARG_INFO()
     318#else
     319static unsigned char arginfo_xcache_get_opcode_spec[] = { 1, BYREF_NONE };
     320#endif
     321
    335322PHP_FUNCTION(xcache_get_opcode_spec)
    336323{
     
    357344/* {{{ proto mixed xcache_get_special_value(zval value)
    358345   XCache internal use only: For decompiler to get static value with type fixed */
     346#ifdef ZEND_BEGIN_ARG_INFO_EX
     347ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_special_value, 0, 0, 1)
     348    ZEND_ARG_INFO(0, value)
     349ZEND_END_ARG_INFO()
     350#else
     351static unsigned char arginfo_xcache_get_special_value[] = { 1, BYREF_NONE };
     352#endif
     353
    359354PHP_FUNCTION(xcache_get_special_value)
    360355{
     
    392387/* {{{ proto int xcache_get_type(zval value)
    393388   XCache internal use only for disassembler to get variable type in engine level */
     389#ifdef ZEND_BEGIN_ARG_INFO_EX
     390ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_type, 0, 0, 1)
     391    ZEND_ARG_INFO(0, value)
     392ZEND_END_ARG_INFO()
     393#else
     394static unsigned char arginfo_xcache_get_type[] = { 1, BYREF_NONE };
     395#endif
     396
    394397PHP_FUNCTION(xcache_get_type)
    395398{
     
    403406}
    404407/* }}} */
    405 /* {{{ proto string xcache_coredump(int op_type) */
     408/* {{{ proto string xcache_coredump() */
     409#ifdef ZEND_BEGIN_ARG_INFO_EX
     410ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_coredump, 0, 0, 0)
     411ZEND_END_ARG_INFO()
     412#else
     413static unsigned char arginfo_xcache_coredump[] = { 1, BYREF_NONE };
     414#endif
     415
    406416PHP_FUNCTION(xcache_coredump)
    407417{
     
    417427/* }}} */
    418428/* {{{ proto string xcache_is_autoglobal(string name) */
     429#ifdef ZEND_BEGIN_ARG_INFO_EX
     430ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_is_autoglobal, 0, 0, 1)
     431    ZEND_ARG_INFO(0, name)
     432ZEND_END_ARG_INFO()
     433#else
     434static unsigned char arginfo_xcache_is_autoglobal[] = { 1, BYREF_NONE };
     435#endif
     436
    419437PHP_FUNCTION(xcache_is_autoglobal)
    420438{
     
    434452}
    435453/* }}} */
     454/* {{{ proto int xcache_get_refcount(mixed &variable)
     455   XCache internal uses only: Get reference count of referenced variable */
     456#ifdef ZEND_BEGIN_ARG_INFO_EX
     457ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_refcount, 0, 0, 1)
     458    ZEND_ARG_INFO(1, variable)
     459ZEND_END_ARG_INFO()
     460#else
     461static unsigned char arginfo_xcache_get_refcount[] = { 1, BYREF_FORCE };
     462#endif
     463
     464PHP_FUNCTION(xcache_get_refcount)
     465{
     466    zval *variable;
     467    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
     468        RETURN_NULL();
     469    }
     470
     471    RETURN_LONG(Z_REFCOUNT(*variable) - 1);
     472}
     473/* }}} */
     474/* {{{ proto int xcache_get_cowcount(mixed value)
     475   XCache internal uses only: Get reference count of copy-on-write variable or data */
     476#ifdef ZEND_BEGIN_ARG_INFO_EX
     477ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_cowcount, 0, 0, 1)
     478    ZEND_ARG_INFO(0, variable)
     479ZEND_END_ARG_INFO()
     480#else
     481static unsigned char arginfo_xcache_get_cowcount[] = { 1, BYREF_NONE };
     482#endif
     483
     484PHP_FUNCTION(xcache_get_cowcount)
     485{
     486    zval *variable;
     487    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
     488        RETURN_NULL();
     489    }
     490
     491    RETURN_LONG(Z_REFCOUNT(*variable) - 1);
     492}
     493/* }}} */
     494/* {{{ proto bool xcache_get_isref(mixed variable)
     495   XCache internal uses only: Check if variable data is marked referenced */
     496#ifdef ZEND_BEGIN_ARG_INFO_EX
     497ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_isref, 0, 0, 1)
     498    ZEND_ARG_INFO(1, variable)
     499ZEND_END_ARG_INFO()
     500#else
     501static unsigned char arginfo_xcache_get_isref[] = { 1, BYREF_FORCE };
     502#endif
     503
     504PHP_FUNCTION(xcache_get_isref)
     505{
     506    zval *variable;
     507    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
     508        RETURN_NULL();
     509    }
     510
     511    RETURN_BOOL(Z_ISREF(*variable) && Z_REFCOUNT(*variable) >= 3);
     512}
     513/* }}} */
    436514static zend_function_entry xcache_functions[] = /* {{{ */
    437515{
    438     PHP_FE(xcache_coredump,          NULL)
     516#ifdef HAVE_XCACHE_DPRINT
     517    PHP_FE(xcache_dprint,            arginfo_xcache_dprint)
     518#endif
    439519#ifdef HAVE_XCACHE_ASSEMBLER
    440520    PHP_FE(xcache_asm,               NULL)
     
    447527    PHP_FE(xcache_decode_string,     NULL)
    448528#endif
    449     PHP_FE(xcache_get_special_value, NULL)
    450     PHP_FE(xcache_get_type,          NULL)
    451     PHP_FE(xcache_get_op_type,       NULL)
    452     PHP_FE(xcache_get_data_type,     NULL)
    453     PHP_FE(xcache_get_opcode,        NULL)
    454     PHP_FE(xcache_get_opcode_spec,   NULL)
    455     PHP_FE(xcache_is_autoglobal,     NULL)
     529    PHP_FE(xcache_get_special_value, arginfo_xcache_get_special_value)
     530    PHP_FE(xcache_get_type,          arginfo_xcache_get_type)
     531    PHP_FE(xcache_get_op_type,       arginfo_xcache_get_op_type)
     532    PHP_FE(xcache_get_data_type,     arginfo_xcache_get_data_type)
     533    PHP_FE(xcache_get_opcode,        arginfo_xcache_get_opcode)
     534    PHP_FE(xcache_get_opcode_spec,   arginfo_xcache_get_opcode_spec)
     535    PHP_FE(xcache_coredump,          arginfo_xcache_coredump)
     536    PHP_FE(xcache_is_autoglobal,     arginfo_xcache_is_autoglobal)
    456537    PHP_FE(xcache_get_refcount,      arginfo_xcache_get_refcount)
    457538    PHP_FE(xcache_get_cowcount,      arginfo_xcache_get_cowcount)
    458539    PHP_FE(xcache_get_isref,         arginfo_xcache_get_isref)
    459 #ifdef HAVE_XCACHE_DPRINT
    460     PHP_FE(xcache_dprint,            NULL)
    461 #endif
    462540    PHP_FE_END
    463541};
Note: See TracChangeset for help on using the changeset viewer.