source: trunk/opcode_spec.c @ 1

Last change on this file since 1 was 1, checked in by moo, 8 years ago

initial import to online

File size: 963 bytes
RevLine 
[1]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.