source: trunk/xcache/xc_const_string.c

Last change on this file was 1326, checked in by moo, 9 months ago

fix type string for PHP5.1-

  • Property svn:eol-style set to native
File size: 2.1 KB
RevLine 
[1]1#include "xcache.h"
[982]2#include "xc_const_string.h"
[1]3
4/* {{{ xc_get_op_type */
5static const char *const op_type_names[] = {
6    /* 0 */ "NULL?",
7    /* 1 */ "IS_CONST",
8    /* 2 */ "IS_TMP_VAR",
9    /* 3 */ NULL,
10    /* 4 */ "IS_VAR",
11    /* 5 */ NULL,
12    /* 6 */ NULL,
13    /* 7 */ NULL,
14    /* 8 */ "IS_UNUSED",
15#ifdef IS_CV
16    /* 9  */ NULL,
17    /* 10 */ NULL,
18    /* 11 */ NULL,
19    /* 12 */ NULL,
20    /* 13 */ NULL,
21    /* 14 */ NULL,
22    /* 15 */ NULL,
23    /* 16 */ "IS_CV"
24#endif
25};
26
[20]27zend_uchar xc_get_op_type_count()
[1]28{
29    return sizeof(op_type_names) / sizeof(op_type_names[0]);
30}
31
32const char *xc_get_op_type(zend_uchar op_type)
33{
34    assert(op_type < xc_get_op_type_count());
35    return op_type_names[op_type];
36}
37/* }}} */
38/* {{{ xc_get_data_type */
39static const char *const data_type_names[] = {
40    /* 0 */ "IS_NULL",
41    /* 1 */ "IS_LONG",
42    /* 2 */ "IS_DOUBLE",
[1326]43#ifdef ZEND_ENGINE_2_1
[1]44    /* 3 */ "IS_BOOL",
[1326]45#else
46    /* 6 */ "IS_STRING",
47#endif
[1]48    /* 4 */ "IS_ARRAY",
49    /* 5 */ "IS_OBJECT",
[1326]50#ifdef ZEND_ENGINE_2_1
[1]51    /* 6 */ "IS_STRING",
[1326]52#else
53    /* 3 */ "IS_BOOL",
54#endif
[1]55    /* 7 */ "IS_RESOURCE",
56    /* 8 */ "IS_CONSTANT",
57    /* 9 */ "IS_CONSTANT_ARRAY",
[491]58    /* 10 */ "IS_UNICODE"
[1]59};
60
[20]61zend_uchar xc_get_data_type_count()
[1]62{
63    return sizeof(data_type_names) / sizeof(data_type_names[0]);
64}
65
66const char *xc_get_data_type(zend_uchar data_type)
67{
[491]68    return data_type_names[(data_type & IS_CONSTANT_TYPE_MASK)];
[1]69}
70/* }}} */
71/* {{{ xc_get_opcode */
[51]72#if PHP_MAJOR_VERSION >= 6
[982]73#   include "xc_const_string_opcodes_php6.x.h"
[1213]74#elif defined(ZEND_ENGINE_2_5)
75#   include "xc_const_string_opcodes_php5.5.h"
[821]76#elif defined(ZEND_ENGINE_2_4)
[982]77#   include "xc_const_string_opcodes_php5.4.h"
[1325]78#elif defined(ZEND_ENGINE_2_3)
79#   include "xc_const_string_opcodes_php5.3.h"
[1254]80#elif defined(ZEND_ENGINE_2_2)
[1325]81#   include "xc_const_string_opcodes_php5.2.h"
[485]82#elif defined(ZEND_ENGINE_2_1)
[982]83#   include "xc_const_string_opcodes_php5.1.h"
[1321]84#elif defined(ZEND_ENGINE_2)
85#   include "xc_const_string_opcodes_php5.0.h"
[508]86#else
[1321]87#   include "xc_const_string_opcodes_php4.x.h"
[1]88#endif
89
[20]90zend_uchar xc_get_opcode_count()
[1]91{
92    return sizeof(xc_opcode_names) / sizeof(xc_opcode_names[0]);
93}
94
95const char *xc_get_opcode(zend_uchar opcode)
96{
97    assert(opcode < xc_get_opcode_count());
98    return xc_opcode_names[opcode];
99}
100/* }}} */
Note: See TracBrowser for help on using the repository browser.