source: trunk/xcache/xc_opcode_spec.c @ 1281

Last change on this file since 1281 was 1281, checked in by moo, 17 months ago

remove php 4 support completely

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1#include "xcache.h"
2#include "xc_opcode_spec.h"
3#include "xc_const_string.h"
4
5/* {{{ opcode_spec */
6#define OPSPEC(ext, op1, op2, res) { OPSPEC_##ext, OPSPEC_##op1, OPSPEC_##op2, OPSPEC_##res },
7#define OPSPEC_VAR_2 OPSPEC_STD
8#include "xc_opcode_spec_def.h"
9
10zend_uchar xc_get_opcode_spec_count()
11{
12    return sizeof(xc_opcode_spec) / sizeof(xc_opcode_spec[0]);
13}
14
15const xc_opcode_spec_t *xc_get_opcode_spec(zend_uchar opcode)
16{
17#ifndef NDEBUG
18    if (xc_get_opcode_count() != xc_get_opcode_spec_count()) {
19        fprintf(stderr, "count mismatch: xc_get_opcode_count=%d, xc_get_opcode_spec_count=%d\n", xc_get_opcode_count(), xc_get_opcode_spec_count());
20    }
21#endif
22    assert(xc_get_opcode_count() == xc_get_opcode_spec_count());
23    assert(opcode < xc_get_opcode_spec_count());
24    return &xc_opcode_spec[opcode];
25}
26/* }}} */
27/* {{{ op_spec */
28
29#define OPSPECS_DEF_NAME(name) #name,
30static const char *xc_op_spec[] = { OPSPECS(OPSPECS_DEF_NAME) };
31
32zend_uchar xc_get_op_spec_count()
33{
34    return sizeof(xc_op_spec) / sizeof(xc_op_spec[0]);
35}
36
37const char *xc_get_op_spec(zend_uchar spec)
38{
39    assert(spec < xc_get_op_spec_count());
40    return xc_op_spec[spec];
41}
42/* }}} */
Note: See TracBrowser for help on using the repository browser.