Changeset 993


Ignore:
Timestamp:
2012-07-18T10:27:29+02:00 (3 years ago)
Author:
moo
Message:

refactor: move functions to module

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/submodules/xc_coverager.h

    r992 r993  
    1111PHP_FUNCTION(xcache_coverager_stop);
    1212PHP_FUNCTION(xcache_coverager_get);
     13#define XCACHE_COVERAGER_FUNCTIONS() \
     14    PHP_FE(xcache_coverager_decode,  NULL) \
     15    PHP_FE(xcache_coverager_start,   NULL) \
     16    PHP_FE(xcache_coverager_stop,    NULL) \
     17    PHP_FE(xcache_coverager_get,     NULL)
  • trunk/submodules/xc_disassembler.c

    r987 r993  
    119119
    120120    zval *output;
    121 } xc_dasm_sandboxed_t; /* {{{ */
    122 
    123 zend_op_array *xc_dasm_sandboxed(void *data TSRMLS_DC)
     121} xc_dasm_sandboxed_t; /* }}} */
     122zend_op_array *xc_dasm_sandboxed(void *data TSRMLS_DC) /* {{{ */
    124123{
    125124    zend_bool catched = 0;
     
    189188}
    190189/* }}} */
     190
     191/* {{{ proto array xcache_dasm_file(string filename)
     192   Disassemble file into opcode array by filename */
     193PHP_FUNCTION(xcache_dasm_file)
     194{
     195    char *filename;
     196    int filename_len;
     197
     198    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
     199        return;
     200    }
     201    if (!filename_len) RETURN_FALSE;
     202
     203    xc_dasm_file(return_value, filename TSRMLS_CC);
     204}
     205/* }}} */
     206/* {{{ proto array xcache_dasm_string(string code)
     207   Disassemble php code into opcode array */
     208PHP_FUNCTION(xcache_dasm_string)
     209{
     210    zval *code;
     211
     212    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &code) == FAILURE) {
     213        return;
     214    }
     215    xc_dasm_string(return_value, code TSRMLS_CC);
     216}
     217/* }}} */
  • trunk/submodules/xc_disassembler.h

    r982 r993  
    11#include "php.h"
    22
    3 void xc_dasm_string(zval *return_value, zval *code TSRMLS_DC);
    4 void xc_dasm_file(zval *return_value, const char *filename TSRMLS_DC);
     3PHP_FUNCTION(xcache_dasm_file);
     4PHP_FUNCTION(xcache_dasm_string);
     5#define XCACHE_DISASSEMBLER_FUNCTIONS() \
     6    PHP_FE(xcache_dasm_file,         NULL) \
     7    PHP_FE(xcache_dasm_string,       NULL)
  • trunk/submodules/xc_optimizer.h

    r982 r993  
    33
    44void xc_optimizer_op_array_handler(zend_op_array *op_array);
     5#define XCACHE_OPTIMIZER_FUNCTIONS()
  • trunk/xcache.c

    r992 r993  
    2727#include "ext/date/php_date.h"
    2828#endif
    29 #include "submodules/xc_optimizer.h"
    30 #include "submodules/xc_coverager.h"
    31 #include "submodules/xc_disassembler.h"
     29
     30#ifdef HAVE_XCACHE_OPTIMIZER
     31#   include "submodules/xc_optimizer.h"
     32#else
     33#   define XCACHE_OPTIMIZER_FUNCTIONS()
     34#endif
     35#ifdef HAVE_XCACHE_COVERAGER
     36#   include "submodules/xc_coverager.h"
     37#else
     38#   define XCACHE_COVERAGER_FUNCTIONS()
     39#endif
     40#ifdef HAVE_XCACHE_DISASSEMBLER
     41#   include "submodules/xc_disassembler.h"
     42#else
     43#   define XCACHE_DISASSEMBLER_FUNCTIONS()
     44#endif
     45
    3246#include "xcache_globals.h"
    3347#include "xc_processor.h"
     
    31733187#endif
    31743188/* }}} */
    3175 #ifdef HAVE_XCACHE_DISASSEMBLER
    3176 /* {{{ proto array  xcache_dasm_file(string filename)
    3177    Disassemble file into opcode array by filename */
    3178 PHP_FUNCTION(xcache_dasm_file)
    3179 {
    3180     char *filename;
    3181     int filename_len;
    3182 
    3183     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
    3184         return;
    3185     }
    3186     if (!filename_len) RETURN_FALSE;
    3187 
    3188     xc_dasm_file(return_value, filename TSRMLS_CC);
    3189 }
    3190 /* }}} */
    3191 /* {{{ proto array  xcache_dasm_string(string code)
    3192    Disassemble php code into opcode array */
    3193 PHP_FUNCTION(xcache_dasm_string)
    3194 {
    3195     zval *code;
    3196 
    3197     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &code) == FAILURE) {
    3198         return;
    3199     }
    3200     xc_dasm_string(return_value, code TSRMLS_CC);
    3201 }
    3202 /* }}} */
    3203 #endif
    32043189/* {{{ proto string xcache_encode(string filename)
    32053190   Encode php file into XCache opcode encoded format */
     
    33743359    PHP_FE(xcache_clear_cache,       NULL)
    33753360    PHP_FE(xcache_coredump,          NULL)
     3361    XCACHE_OPTIMIZER_FUNCTIONS()
    33763362#ifdef HAVE_XCACHE_ASSEMBLER
    33773363    PHP_FE(xcache_asm,               NULL)
    33783364#endif
    3379 #ifdef HAVE_XCACHE_DISASSEMBLER
    3380     PHP_FE(xcache_dasm_file,         NULL)
    3381     PHP_FE(xcache_dasm_string,       NULL)
    3382 #endif
     3365    XCACHE_DISASSEMBLER_FUNCTIONS()
    33833366#ifdef HAVE_XCACHE_ENCODER
    33843367    PHP_FE(xcache_encode,            NULL)
     
    33883371    PHP_FE(xcache_decode_string,     NULL)
    33893372#endif
    3390 #ifdef HAVE_XCACHE_COVERAGER
    3391     PHP_FE(xcache_coverager_decode,  NULL)
    3392     PHP_FE(xcache_coverager_start,   NULL)
    3393     PHP_FE(xcache_coverager_stop,    NULL)
    3394     PHP_FE(xcache_coverager_get,     NULL)
    3395 #endif
     3373    XCACHE_COVERAGER_FUNCTIONS()
    33963374    PHP_FE(xcache_get_special_value, NULL)
    33973375    PHP_FE(xcache_get_type,          NULL)
Note: See TracChangeset for help on using the changeset viewer.