source: git/opcode_spec.c @ 4389208

1.01.11.21.33.03.13.2trunk
Last change on this file since 4389208 was 4389208, checked in by Xuefer <xuefer@…>, 14 years ago

initial import to online

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1 c26eb9a1-5813-0410-bd6c-c2e55f420ca7

  • Property mode set to 100644
File size: 963 bytes
Line 
1#include "xcache.h"
2#include "opcode_spec.h"
3#include "const_string.h"
4
5/* {{{ opcode_spec */
6#define OPSPEC(ext, op1, op2, res) { OPSPEC_##ext, OPSPEC_##op1, OPSPEC_##op2, OPSPEC_##res },
7#ifdef ZEND_ENGINE_2
8#   define OPSPEC_VAR_2 OPSPEC_STD
9#else
10#   define OPSPEC_VAR_2 OPSPEC_VAR
11#endif
12#include "opcode_spec_def.h"
13
14int xc_get_opcode_spec_count()
15{
16    return sizeof(xc_opcode_spec) / sizeof(xc_opcode_spec[0]);
17}
18
19const xc_opcode_spec_t *xc_get_opcode_spec(zend_uchar opcode)
20{
21    assert(xc_get_opcode_count() == xc_get_opcode_spec_count());
22    assert(opcode < xc_get_opcode_spec_count());
23    return &xc_opcode_spec[opcode];
24}
25/* }}} */
26/* {{{ op_spec */
27
28#define OPSPECS_DEF_NAME(name) #name,
29static const char *xc_op_spec[] = { OPSPECS(OPSPECS_DEF_NAME) };
30
31int xc_get_op_spec_count()
32{
33    return sizeof(xc_op_spec) / sizeof(xc_op_spec[0]);
34}
35
36const char *xc_get_op_spec(zend_uchar spec)
37{
38    assert(spec < xc_get_op_spec_count());
39    return xc_op_spec[spec];
40}
41/* }}} */
Note: See TracBrowser for help on using the repository browser.