Browse Source

PHP_5_4: handle exclude_from_classes

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@843 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 9 years ago
parent
commit
49275ed9ca
  1. 58
      processor/dispatch.m4
  2. 20
      processor/hashtable.m4
  3. 7
      processor/head.m4
  4. 40
      processor/main.m4
  5. 142
      processor/process.m4
  6. 311
      processor/processor.m4
  7. 24
      processor/string.m4
  8. 55
      processor/struct.m4

58
processor/dispatch.m4

@ -1,58 +0,0 @@
dnl DISPATCH(1:type, 2:elm)
define(`DISPATCH', `
DBG(`$0($*)')
assert(sizeof($1) == sizeof(src->$2));
ifelse(
`$1', `zend_bool', `PROC_INT(`$2', `u', `$1')'
, `$1', `zend_uchar', `PROC_INT(`$2', `u', `$1')'
, `$1', `char', `PROC_INT(`$2', `d', `$1')'
, `$1', `int32_t', `PROC_INT(`$2', `d', `$1')'
, `$1', `unsigned char', `PROC_INT(`$2', `u', `$1')'
, `$1', `zend_uint', `PROC_INT(`$2', `u', `$1')'
, `$1', `uint', `PROC_INT(`$2', `u', `$1')'
, `$1', `unsigned int', `PROC_INT(`$2', `u', `$1')'
, `$1', `zend_ulong', `PROC_INT(`$2', `lu', `$1')'
, `$1', `ulong', `PROC_INT(`$2', `lu', `$1')'
, `$1', `size_t', `PROC_INT(`$2', `u', `$1')'
, `$1', `long', `PROC_INT(`$2', `ld', `$1')'
, `$1', `time_t', `PROC_INT(`$2', `ld', `$1')'
, `$1', `zend_ushort', `PROC_INT(`$2', `hu', `$1')'
, `$1', `int', `PROC_INT(`$2', `d', `$1')'
, `$1', `double', `PROC_INT(`$2', `f', `$1')'
, `$1', `opcode_handler_t', `/* is copying enough? */COPY(`$2')'
, `$1', `zval_data_type', `PROC_INT(`$2', `u', `$1')'
, `$1', `xc_entry_type_t', `PROC_INT(`$2', `d', `$1')'
, `$1', `xc_hash_value_t', `PROC_INT(`$2', `lu', `$1')'
, `$1', `xc_md5sum_t', `COPY(`$2')'
, `', `', `m4_errprint(`Unknown type "$1"')'
)
')
dnl {{{ DISPATCH_ARRAY(1:count, 2:type, 3:elm)
define(`DISPATCH_ARRAY', `
if (src->$3) {
int i;
IFDASM(`
zval *arr;
ALLOC_INIT_ZVAL(arr);
array_init(arr);
for (i = 0; i < src->$1; i ++) {
ifelse(
`$2', `zend_bool', `add_assoc_bool_ex(arr, ZEND_STRS("$3"), src->$3[i] ? 1 : 0);'
, `', `', `add_next_index_long(arr, src->$3[i]);')
}
add_assoc_zval_ex(dst, ZEND_STRS("$3"), arr);
', `
COPY_N_EX($@)
for (i = 0; i < src->$1; i ++) {
DISABLECHECK(`
DISPATCH(`$2', `$3[i]', `$4')
')
}
')dnl IFDASM
DONE(`$3')
}
else {
COPYNULL(`$3')
}
')
dnl }}}

20
processor/hashtable.m4

@ -77,14 +77,14 @@ define(`DEF_HASH_TABLE_FUNC', `
dnl elseif
IFRESTORE(`dst->canary = zend_hash_canary; DONE(canary)', `
dnl else
DISPATCH(unsigned int, canary)
PROCESS(unsigned int, canary)
')
')
#endif
DISPATCH(uint, nTableSize)
DISPATCH(uint, nTableMask)
DISPATCH(uint, nNumOfElements)
DISPATCH(ulong, nNextFreeElement)
PROCESS(uint, nTableSize)
PROCESS(uint, nTableMask)
PROCESS(uint, nNumOfElements)
PROCESS(ulong, nNextFreeElement)
IFCOPY(`dst->pInternalPointer = NULL; /* Used for element traversal */') DONE(pInternalPointer)
IFCOPY(`dst->pListHead = NULL;') DONE(pListHead)
#ifdef ZEND_ENGINE_2_4
@ -164,14 +164,14 @@ define(`DEF_HASH_TABLE_FUNC', `
#endif
IFCOPY(`dst->pListTail = pnew;') DONE(pListTail)
IFCOPY(`dst->pDestructor = src->pDestructor;') DONE(pDestructor)
DISPATCH(zend_bool, persistent)
PROCESS(zend_bool, persistent)
#ifdef IS_UNICODE
DISPATCH(zend_bool, unicode)
PROCESS(zend_bool, unicode)
#endif
DISPATCH(unsigned char, nApplyCount)
DISPATCH(zend_bool, bApplyProtection)
PROCESS(unsigned char, nApplyCount)
PROCESS(zend_bool, bApplyProtection)
#if ZEND_DEBUG
DISPATCH(int, inconsistent)
PROCESS(int, inconsistent)
#endif
')dnl IFDASM
popdef(`FUNC_NAME')

7
processor/head.m4

@ -36,6 +36,8 @@ define(`SIZEOF_zend_trait_precedence_ptr', `sizeof(zend_trait_precedence)')
define(`COUNTOF_zend_trait_precedence_ptr', `1')
define(`SIZEOF_xc_entry_name_t', `sizeof(xc_entry_name_t)')
define(`COUNTOF_xc_entry_name_t', `1')
define(`SIZEOF_xc_ztstring', `sizeof(xc_ztstring)')
define(`COUNTOF_xc_ztstring', `1')
ifdef(`XCACHE_ENABLE_TEST', `
#undef NDEBUG
@ -55,12 +57,15 @@ sinclude(builddir`/structinfo.m4')
typedef zval *zval_ptr;
typedef zval *zval_ptr_nullable;
typedef char *xc_ztstring;
#ifdef ZEND_ENGINE_2_4
typedef zend_trait_alias *zend_trait_alias_ptr;
typedef zend_trait_precedence *zend_trait_precedence_ptr;
#endif
typedef zend_uchar zval_data_type;
typedef zend_uchar xc_zval_data_type;
typedef int xc_op_type;
typedef zend_uchar xc_opcode;
#ifdef IS_UNICODE
typedef UChar zstr_uchar;
#endif

40
processor/main.m4

@ -19,6 +19,8 @@ undefine(`len')
')
define(`ZEND_STRS', `($1), (sizeof($1))')
define(`ZEND_STRL', `($1), (sizeof($1) - 1)')
define(`DST', `dst->$1')
define(`SRC', `src->$1')
dnl ============
define(`INDENT', `xc_dprint_indent(indent);')
dnl }}}
@ -80,31 +82,11 @@ define(`ALLOC', `
popdef(`COUNT')
popdef(`SIZE')
')
dnl CALLOC(1:dst, 2:type [, 3:count=1 ])
define(`CALLOC', `ALLOC(`$1', `$2', `$3', `1')')
dnl }}}
dnl {{{ PROC_INT(1:elm, 2:format=%d, 3:type=, 4:spec=)
define(`PROC_INT', `
IFNOTMEMCPY(`IFCOPY(`dst->$1 = src->$1;')')
IFDPRINT(`
INDENT()
ifelse(
`$3 $1', `zval_data_type type', `fprintf(stderr, "$3:$1:\t%d %s\n", src->$1, xc_get_data_type(src->$1));'
, `$3 $1', `int op_type', `fprintf(stderr, "$3:$1:\t%d %s\n", src->$1, xc_get_op_type(src->$1));'
, `$3 $1', `zend_uchar opcode', `fprintf(stderr, "$3:$1:\t%d %s\n", src->$1, xc_get_opcode(src->$1));'
, `', `', `fprintf(stderr, "$3:$1:\t%ifelse(`$2',`',`d',`$2')\n", src->$1);')
')
IFDASM(`
ifelse(
`$3', `zend_bool', `add_assoc_bool_ex(dst, ZEND_STRS("$1"), src->$1 ? 1 : 0);'
, `', `', `add_assoc_long_ex(dst, ZEND_STRS("$1"), src->$1);'
)
')
DONE(`$1')
')
dnl CALLOC(1:dst, 2:type [, 3:count=1, 4:forcetype=$2 ])
define(`CALLOC', `ALLOC(`$1', `$2', `$3', `1', `$4')')
dnl }}}
dnl {{{ PROC_CLASS_ENTRY_P(1:elm)
define(`PROC_CLASS_ENTRY_P', `PROC_CLASS_ENTRY_P_EX(`dst->$1', `src->$1', `$1')`'DONE(`$1')')
define(`PROC_CLASS_ENTRY_P', `PROC_CLASS_ENTRY_P_EX(`dst->$1', `SRC(`$1')', `$1')`'DONE(`$1')')
dnl PROC_CLASS_ENTRY_P_EX(1:dst, 2:src, 3:elm-name)
define(`PROC_CLASS_ENTRY_P_EX', `
if ($2) {
@ -150,13 +132,13 @@ define(`UNFIXPOINTER_EX', `IFSTORE(`
')')
dnl }}}
dnl {{{ COPY
define(`COPY', `IFNOTMEMCPY(`IFCOPY(`dst->$1 = src->$1;')')DONE(`$1')')
define(`COPY', `IFNOTMEMCPY(`IFCOPY(`dst->$1 = SRC(`$1');')')DONE(`$1')')
dnl }}}
dnl {{{ COPY_N_EX
define(`COPY_N_EX', `
ALLOC(`dst->$3', `$2', `src->$1')
ALLOC(`dst->$3', `$2', `SRC(`$1')')
IFCOPY(`
memcpy(dst->$3, src->$3, sizeof(dst->$3[0]) * src->$1);
memcpy(dst->$3, SRC(`$3'), sizeof(dst->$3[0]) * SRC(`$1'));
')
')
dnl }}}
@ -167,7 +149,7 @@ dnl {{{ COPYPOINTER
define(`COPYPOINTER', `COPY(`$1')')
dnl }}}
dnl {{{ COPYARRAY_EX
define(`COPYARRAY_EX', `IFNOTMEMCPY(`IFCOPY(`memcpy(dst->$1, src->$1, sizeof(dst->$1));')')')
define(`COPYARRAY_EX', `IFNOTMEMCPY(`IFCOPY(`memcpy(dst->$1, SRC(`$1'), sizeof(dst->$1));')')')
dnl }}}
dnl {{{ COPYARRAY
define(`COPYARRAY', `COPYARRAY_EX(`$1',`$2')DONE(`$1')')
@ -225,7 +207,7 @@ define(`DONE', `
zend_hash_add(&done_names, "$1", sizeof("$1"), (void*)&b, sizeof(b), NULL);
}
')
DONE_SIZE(`sizeof(src->$1)')
DONE_SIZE(`sizeof(SRC(`$1'))')
')
define(`DISABLECHECK', `
pushdef(`DONE_SIZE')
@ -260,7 +242,7 @@ EXPORT(`zval')
include(srcdir`/processor/hashtable.m4')
include(srcdir`/processor/string.m4')
include(srcdir`/processor/struct.m4')
include(srcdir`/processor/dispatch.m4')
include(srcdir`/processor/process.m4')
include(srcdir`/processor/head.m4')
define(`IFNOTMEMCPY', `ifdef(`USEMEMCPY', `', `$1')')

142
processor/process.m4

@ -0,0 +1,142 @@
define(`PROCESS_SCALAR', `dnl {{{ (1:elm, 2:format=%d, 3:type=)
IFNOTMEMCPY(`IFCOPY(`DST(`$1') = SRC(`$1');')')
IFDPRINT(`
INDENT()
fprintf(stderr, "$3:$1:\t%ifelse(`$2',`',`d',`$2')\n", SRC(`$1'));
')
IFDASM(`
ifelse(
`$3', `zend_bool', `add_assoc_bool_ex(dst, ZEND_STRS("$1"), SRC(`$1') ? 1 : 0);'
, `', `', `add_assoc_long_ex(dst, ZEND_STRS("$1"), SRC(`$1'));'
)
')
DONE(`$1')
')
dnl }}}
define(`PROCESS_xc_ztstring', `dnl {{{ (1:elm)
PROC_STRING(`$1')
')
dnl }}}
define(`PROCESS_zval_data_type', `dnl {{{ (1:elm)
IFDPRINT(`
INDENT()
fprintf(stderr, ":$1:\t%d %s\n", SRC(`$1'), xc_get_data_type(SRC(`$1')));
DONE(`$1')
', `PROCESS_SCALAR(`$1')')
')
dnl }}}
define(`PROCESS_op_type', `dnl {{{ (1:elm)
IFDPRINT(`
INDENT()
fprintf(stderr, ":$1:\t%d %s\n", SRC(`$1'), xc_get_op_type(SRC(`$1')));
DONE(`$1')
', `PROCESS_SCALAR(`$1')')
')
dnl }}}
define(`PROCESS_opcode', `dnl {{{ (1:elm)
IFDPRINT(`
INDENT()
fprintf(stderr, ":$1:\t%u %s\n", SRC(`$1'), xc_get_opcode(SRC(`$1')));
DONE(`$1')
', `PROCESS_SCALAR(`$1')')
')
dnl }}}
define(`PROCESS', `dnl PROCESS(1:type, 2:elm)
DBG(`$0($*)')
assert(sizeof($1) == sizeof(SRC(`$2')));
ifelse(
`$1', `zend_bool', `PROCESS_SCALAR(`$2', `u', `$1')'
, `$1', `zend_uchar', `PROCESS_SCALAR(`$2', `u', `$1')'
, `$1', `char', `PROCESS_SCALAR(`$2', `d', `$1')'
, `$1', `int32_t', `PROCESS_SCALAR(`$2', `d', `$1')'
, `$1', `unsigned char', `PROCESS_SCALAR(`$2', `u', `$1')'
, `$1', `zend_uint', `PROCESS_SCALAR(`$2', `u', `$1')'
, `$1', `uint', `PROCESS_SCALAR(`$2', `u', `$1')'
, `$1', `unsigned int', `PROCESS_SCALAR(`$2', `u', `$1')'
, `$1', `zend_ulong', `PROCESS_SCALAR(`$2', `lu', `$1')'
, `$1', `ulong', `PROCESS_SCALAR(`$2', `lu', `$1')'
, `$1', `size_t', `PROCESS_SCALAR(`$2', `u', `$1')'
, `$1', `long', `PROCESS_SCALAR(`$2', `ld', `$1')'
, `$1', `time_t', `PROCESS_SCALAR(`$2', `ld', `$1')'
, `$1', `zend_ushort', `PROCESS_SCALAR(`$2', `hu', `$1')'
, `$1', `int', `PROCESS_SCALAR(`$2', `d', `$1')'
, `$1', `double', `PROCESS_SCALAR(`$2', `f', `$1')'
, `$1', `xc_entry_type_t', `PROCESS_SCALAR(`$2', `d', `$1')'
, `$1', `xc_hash_value_t', `PROCESS_SCALAR(`$2', `lu', `$1')'
, `$1', `xc_ztstring', `PROCESS_xc_ztstring(`$2')'
, `$1', `xc_zval_data_type', `PROCESS_zval_data_type(`$2')'
, `$1', `xc_op_type', `PROCESS_op_type(`$2')'
, `$1', `xc_opcode', `PROCESS_opcode(`$2')'
, `$1', `opcode_handler_t', `/* is copying enough? */COPY(`$2')'
, `$1', `xc_md5sum_t', `COPY(`$2')'
, `', `', `m4_errprint(`AUTOCHECK ERROR: Unknown type "$1"')define(`EXIT_PENDING', 1)'
)
')
define(`PROCESS_ARRAY', `dnl {{{ (1:count, 2:type, 3:elm, [4:force_type])
if (src->$3) {
int LOOPCOUNTER;
IFDASM(`
zval *arr;
ALLOC_INIT_ZVAL(arr);
array_init(arr);
for (LOOPCOUNTER = 0;
ifelse(`$1', `', `src->$3[LOOPCOUNTER]',
`', `', `LOOPCOUNTER < SRC(`$1')');
++LOOPCOUNTER) {
pushdef(`dst', `arr')
pushdef(`SRC', defn(`SRC') `[LOOPCOUNTER]')
popdef(`add_assoc_bool_ex', `add_next_index_bool($1, $3)')
popdef(`add_assoc_string_ex', `add_next_index_string($1, $3)')
popdef(`add_assoc_long_ex', `add_next_index_long($1, $3)')
popdef(`add_assoc_zval_ex', `add_next_index_zval($1, $3)')
DISABLECHECK(`
PROCESS(`$2', `$3')
')
popdef(`add_assoc_zval_ex')
popdef(`add_assoc_long_ex')
popdef(`add_assoc_string_ex')
popdef(`add_assoc_bool_ex')
popdef(`SRC')
popdef(`dst')
++LOOPCOUNTER;
}
add_assoc_zval_ex(dst, ZEND_STRS("$3"), arr);
', `
dnl find count with NULL
ifelse(`$1', `', `
size_t count = 0;
while (SRC(`$3[count]')) {
++count;
}
++count;
pushdef(`STRUCT_COUNT', `count')
',
`', `', `pushdef(`STRUCT_COUNT', `SRC(`$1')')')
ALLOC(`dst->$3', `$2', `STRUCT_COUNT', , `$4')
popdef(`STRUCT_COUNT')
for (LOOPCOUNTER = 0;
ifelse(`$1', `', `src->$3[LOOPCOUNTER]',
`', `', `LOOPCOUNTER < SRC(`$1')');
++LOOPCOUNTER) {
DISABLECHECK(`
pushdef(`DST', defn(`DST') `[LOOPCOUNTER]')
pushdef(`SRC', ((const char **) defn(`SRC'))`[LOOPCOUNTER]')
PROCESS(`$2', `$3')
popdef(`SRC')
popdef(`DST')
')
}
dnl the end marker
ifelse(`$1', `', `IFCOPY(`DST(`$3[LOOPCOUNTER]') = NULL;')')
')dnl IFDASM
DONE(`$3')
}
else {
COPYNULL(`$3')
}
')
dnl }}}

311
processor/processor.m4

@ -17,9 +17,9 @@ DECL_STRUCT_P_FUNC(`zend_property_info')
dnl ====================================================
#ifdef IS_CV
DEF_STRUCT_P_FUNC(`zend_compiled_variable', , `dnl {{{
DISPATCH(int, name_len)
PROCESS(int, name_len)
PROC_ZSTRING_L(, name, name_len)
DISPATCH(ulong, hash_value)
PROCESS(ulong, hash_value)
')
dnl }}}
#endif
@ -45,18 +45,18 @@ dnl }}}
#endif
#ifdef ZEND_ENGINE_2
DEF_STRUCT_P_FUNC(`zend_try_catch_element', , `dnl {{{
DISPATCH(zend_uint, try_op)
DISPATCH(zend_uint, catch_op)
PROCESS(zend_uint, try_op)
PROCESS(zend_uint, catch_op)
')
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `dnl {{{
#ifdef ZEND_ENGINE_2_2
DISPATCH(int, start)
PROCESS(int, start)
#endif
DISPATCH(int, cont)
DISPATCH(int, brk)
DISPATCH(int, parent)
PROCESS(int, cont)
PROCESS(int, brk)
PROCESS(int, parent)
')
dnl }}}
DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr', `zval_ptr')
@ -90,10 +90,10 @@ dnl {{{ zvalue_value
case IS_LONG:
case IS_RESOURCE:
case IS_BOOL:
DISPATCH(long, value.lval)
PROCESS(long, value.lval)
break;
case IS_DOUBLE:
DISPATCH(double, value.dval)
PROCESS(double, value.dval)
break;
case IS_NULL:
IFDPRINT(`INDENT()`'fprintf(stderr, "\tNULL\n");')
@ -109,13 +109,13 @@ dnl {{{ zvalue_value
#ifdef FLAG_IS_BC
case FLAG_IS_BC:
#endif
DISPATCH(int, value.str.len)
PROCESS(int, value.str.len)
PROC_STRING_L(value.str.val, value.str.len)
break;
#ifdef IS_UNICODE
case IS_UNICODE:
proc_unicode:
DISPATCH(int32_t, value.uni.len)
PROCESS(int32_t, value.uni.len)
PROC_ZSTRING_L(1, value.uni.val, value.uni.len)
break;
#endif
@ -140,19 +140,19 @@ proc_unicode:
')
dnl }}}
DONE(value)
DISPATCH(zval_data_type, type)
PROCESS(xc_zval_data_type, type)
#ifdef ZEND_ENGINE_2_3
DISPATCH(zend_uchar, is_ref__gc)
PROCESS(zend_uchar, is_ref__gc)
#else
DISPATCH(zend_uchar, is_ref)
PROCESS(zend_uchar, is_ref)
#endif
#ifdef ZEND_ENGINE_2_3
DISPATCH(zend_uint, refcount__gc)
PROCESS(zend_uint, refcount__gc)
#elif defined(ZEND_ENGINE_2)
DISPATCH(zend_uint, refcount)
PROCESS(zend_uint, refcount)
#else
DISPATCH(zend_ushort, refcount)
PROCESS(zend_ushort, refcount)
#endif
')dnl IFDASM
')
@ -223,20 +223,20 @@ DEF_STRUCT_P_FUNC(`zval_ptr_nullable', , `dnl {{{
dnl }}}
#ifdef ZEND_ENGINE_2
DEF_STRUCT_P_FUNC(`zend_arg_info', , `dnl {{{
DISPATCH(zend_uint, name_len)
PROCESS(zend_uint, name_len)
PROC_ZSTRING_L(, name, name_len)
DISPATCH(zend_uint, class_name_len)
PROCESS(zend_uint, class_name_len)
PROC_ZSTRING_L(, class_name, class_name_len)
#ifdef ZEND_ENGINE_2_4
DISPATCH(zend_uchar, type_hint)
PROCESS(zend_uchar, type_hint)
#else
DISPATCH(zend_bool, array_type_hint)
PROCESS(zend_bool, array_type_hint)
#endif
DISPATCH(zend_bool, allow_null)
DISPATCH(zend_bool, pass_by_reference)
PROCESS(zend_bool, allow_null)
PROCESS(zend_bool, pass_by_reference)
#ifndef ZEND_ENGINE_2_4
DISPATCH(zend_bool, return_reference)
DISPATCH(int, required_num_args)
PROCESS(zend_bool, return_reference)
PROCESS(int, required_num_args)
#endif
')
dnl }}}
@ -244,12 +244,12 @@ dnl }}}
#ifdef HAVE_XCACHE_CONSTANT
DEF_STRUCT_P_FUNC(`zend_constant', , `dnl {{{
STRUCT(zval, value)
DISPATCH(int, flags)
DISPATCH(uint, name_len)
PROCESS(int, flags)
PROCESS(uint, name_len)
pushdef(`estrndup', `zend_strndup')
PROC_ZSTRING_N(, name, name_len)
popdef(`estrndup')
DISPATCH(int, module_number)
PROCESS(int, module_number)
')
dnl }}}
#endif
@ -276,15 +276,15 @@ DEF_STRUCT_P_FUNC(`zend_function', , `dnl {{{
dnl }}}
#ifdef ZEND_ENGINE_2
DEF_STRUCT_P_FUNC(`zend_property_info', , `dnl {{{
DISPATCH(zend_uint, flags)
DISPATCH(int, name_length)
PROCESS(zend_uint, flags)
PROCESS(int, name_length)
PROC_ZSTRING_L(, name, name_length)
DISPATCH(ulong, h)
PROCESS(ulong, h)
#ifdef ZEND_ENGINE_2_4
DISPATCH(int, offset)
PROCESS(int, offset)
#endif
#ifdef ZEND_ENGINE_2_1
DISPATCH(int, doc_comment_len)
PROCESS(int, doc_comment_len)
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
#endif
dnl isnt in php6 yet
@ -296,25 +296,24 @@ dnl }}}
#endif
#ifdef ZEND_ENGINE_2_4
DEF_STRUCT_P_FUNC(`zend_trait_method_reference', , `dnl {{{
DISPATCH(unsigned int, mname_len)
PROCESS(unsigned int, mname_len)
PROC_STRING_L(method_name, mname_len)
COPYNULL(ce)
DISPATCH(unsigned int, cname_len)
PROCESS(unsigned int, cname_len)
PROC_STRING_L(class_name, cname_len)
')
dnl }}}
DEF_STRUCT_P_FUNC(`zend_trait_alias', , `dnl {{{
STRUCT_P(zend_trait_method_reference, trait_method)
DISPATCH(unsigned int, alias_len)
PROCESS(unsigned int, alias_len)
PROC_STRING_L(alias, alias_len)
DISPATCH(zend_uint, modifiers)
PROCESS(zend_uint, modifiers)
COPYNULL(function)
')
dnl }}}
DEF_STRUCT_P_FUNC(`zend_trait_precedence', , `dnl {{{
STRUCT_P(zend_trait_method_reference, trait_method)
dnl TODO
STRUCT_ARRAY(, xc_class_name_t, exclude_from_classes)
PROCESS_ARRAY(, xc_ztstring, exclude_from_classes, zend_class_entry*)
COPYNULL(function)
')
dnl }}}
@ -350,8 +349,8 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
processor->active_class_entry_src = src;
IFCOPY(`processor->active_class_entry_dst = dst;')
')
DISPATCH(char, type)
DISPATCH(zend_uint, name_length)
PROCESS(char, type)
PROCESS(zend_uint, name_length)
PROC_ZSTRING_L(, name, name_length)
IFRESTORE(`
#ifndef ZEND_ENGINE_2
@ -364,15 +363,15 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
PROC_CLASS_ENTRY_P(parent)
')
#ifdef ZEND_ENGINE_2
DISPATCH(int, refcount)
PROCESS(int, refcount)
#else
STRUCT_P(int, refcount)
#endif
#ifndef ZEND_ENGINE_2_4
DISPATCH(zend_bool, constants_updated)
PROCESS(zend_bool, constants_updated)
#endif
#ifdef ZEND_ENGINE_2
DISPATCH(zend_uint, ce_flags)
PROCESS(zend_uint, ce_flags)
#endif
#ifdef ZEND_ENGINE_2
@ -381,9 +380,9 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
#ifdef ZEND_ENGINE_2_4
STRUCT_ARRAY(default_properties_count, zval_ptr_nullable, default_properties_table)
DISPATCH(int, default_properties_count)
PROCESS(int, default_properties_count)
STRUCT_ARRAY(default_static_members_count, zval_ptr_nullable, default_static_members_table)
DISPATCH(int, default_static_members_count)
PROCESS(int, default_static_members_count)
IFCOPY(`dst->static_members_table = dst->default_static_members_table;')
DONE(static_members_table)
#else
@ -424,7 +423,7 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
', `
DONE(`interfaces')
')
DISPATCH(zend_uint, num_interfaces)
PROCESS(zend_uint, num_interfaces)
#endif
STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases)
STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences)
@ -432,18 +431,18 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
# ifdef ZEND_ENGINE_2_4
DISABLECHECK(`
IFRESTORE(`dst->info.user.filename = processor->entry_src->filepath;', `PROC_STRING(info.user.filename)')
DISPATCH(zend_uint, info.user.line_start)
DISPATCH(zend_uint, info.user.line_end)
DISPATCH(zend_uint, info.user.doc_comment_len)
PROCESS(zend_uint, info.user.line_start)
PROCESS(zend_uint, info.user.line_end)
PROCESS(zend_uint, info.user.doc_comment_len)
PROC_ZSTRING_L(, info.user.doc_comment, info.user.doc_comment_len)
')
DONE(info)
# else
IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)')
DISPATCH(zend_uint, line_start)
DISPATCH(zend_uint, line_end)
PROCESS(zend_uint, line_start)
PROCESS(zend_uint, line_end)
# ifdef ZEND_ENGINE_2_1
DISPATCH(zend_uint, doc_comment_len)
PROCESS(zend_uint, doc_comment_len)
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
# endif
# endif
@ -518,7 +517,7 @@ define(`UNION_znode_op', `dnl {{{
switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) {
case IS_CONST:
ifelse($1, `result', `
DISPATCH(zend_uint, $1.constant)
PROCESS(zend_uint, $1.constant)
', `
IFDASM(`{
zval *zv;
@ -531,7 +530,7 @@ define(`UNION_znode_op', `dnl {{{
IFCOPY(`
dst->$1 = src->$1;
', `
DISPATCH(zend_uint, $1.constant)
PROCESS(zend_uint, $1.constant)
')
')
')
@ -545,11 +544,11 @@ define(`UNION_znode_op', `dnl {{{
case IS_VAR:
case IS_TMP_VAR:
case IS_CV:
DISPATCH(zend_uint, $1.var)
PROCESS(zend_uint, $1.var)
break;
case IS_UNUSED:
IFDASM(`DISPATCH(zend_uint, $1.var)')
DISPATCH(zend_uint, $1.opline_num)
IFDASM(`PROCESS(zend_uint, $1.var)')
PROCESS(zend_uint, $1.opline_num)
break;
')
}
@ -559,7 +558,7 @@ define(`UNION_znode_op', `dnl {{{
dnl }}}
#else
DEF_STRUCT_P_FUNC(`znode', , `dnl {{{
DISPATCH(int, op_type)
PROCESS(xc_op_type, op_type)
#ifdef IS_CV
# define XCACHE_IS_CV IS_CV
@ -587,16 +586,16 @@ DEF_STRUCT_P_FUNC(`znode', , `dnl {{{
case IS_VAR:
case IS_TMP_VAR:
case XCACHE_IS_CV:
DISPATCH(zend_uint, u.var)
DISPATCH(zend_uint, u.EA.type)
PROCESS(zend_uint, u.var)
PROCESS(zend_uint, u.EA.type)
break;
case IS_UNUSED:
IFDASM(`DISPATCH(zend_uint, u.var)')
DISPATCH(zend_uint, u.opline_num)
IFDASM(`PROCESS(zend_uint, u.var)')
PROCESS(zend_uint, u.opline_num)
#ifndef ZEND_ENGINE_2
DISPATCH(zend_uint, u.fetch_type)
PROCESS(zend_uint, u.fetch_type)
#endif
DISPATCH(zend_uint, u.EA.type)
PROCESS(zend_uint, u.EA.type)
break;
')
}
@ -610,7 +609,7 @@ DEF_STRUCT_P_FUNC(`znode', , `dnl {{{
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{
DISPATCH(zend_uchar, opcode)
PROCESS(xc_opcode, opcode)
#ifdef ZEND_ENGINE_2_4
IFRESTORE(`', `
switch (src->opcode) {
@ -627,13 +626,13 @@ DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{
STRUCT(znode, op1)
STRUCT(znode, op2)
#endif
DISPATCH(ulong, extended_value)
DISPATCH(uint, lineno)
PROCESS(ulong, extended_value)
PROCESS(uint, lineno)
#ifdef ZEND_ENGINE_2_1
#ifdef ZEND_ENGINE_2_4
DISPATCH(zend_uchar, op1_type)
DISPATCH(zend_uchar, op2_type)
DISPATCH(zend_uchar, result_type)
PROCESS(zend_uchar, op1_type)
PROCESS(zend_uchar, op2_type)
PROCESS(zend_uchar, result_type)
#endif
IFCOPY(`
#ifdef ZEND_ENGINE_2_4
@ -673,15 +672,15 @@ DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{
break;
}
')
DISPATCH(opcode_handler_t, handler)
PROCESS(opcode_handler_t, handler)
#endif
')
dnl }}}
#ifdef ZEND_ENGINE_2_4
DEF_STRUCT_P_FUNC(`zend_literal', , `dnl {{{
STRUCT(zval, constant)
DISPATCH(zend_ulong, hash_value)
DISPATCH(zend_uint, cache_slot)
PROCESS(zend_ulong, hash_value)
PROCESS(zend_uint, cache_slot)
')
dnl }}}
#endif
@ -776,15 +775,15 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
dnl RESTORE is done above!
/* Common elements */
DISPATCH(zend_uchar, type)
PROCESS(zend_uchar, type)
PROC_ZSTRING(, function_name)
#ifdef ZEND_ENGINE_2
DISPATCH(zend_uint, fn_flags)
PROCESS(zend_uint, fn_flags)
STRUCT_ARRAY(num_args, zend_arg_info, arg_info)
DISPATCH(zend_uint, num_args)
DISPATCH(zend_uint, required_num_args)
PROCESS(zend_uint, num_args)
PROCESS(zend_uint, required_num_args)
# ifndef ZEND_ENGINE_2_4
DISPATCH(zend_bool, pass_rest_by_reference)
PROCESS(zend_bool, pass_rest_by_reference)
# endif
#else
if (src->arg_types) {
@ -807,7 +806,7 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
}
#endif
#ifndef ZEND_ENGINE_2_4
DISPATCH(unsigned char, return_reference)
PROCESS(unsigned char, return_reference)
#endif
/* END of common elements */
#ifdef IS_UNICODE
@ -821,7 +820,7 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
#ifdef ZEND_ENGINE_2_4
dnl before copying opcodes
STRUCT_ARRAY(last_literal, zend_literal, literals)
DISPATCH(int, last_literal)
PROCESS(int, last_literal)
#endif
pushdef(`AFTER_ALLOC', `IFCOPY(`
@ -834,16 +833,16 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
')')
STRUCT_ARRAY(last, zend_op, opcodes)
popdef(`AFTER_ALLOC')
DISPATCH(zend_uint, last)
PROCESS(zend_uint, last)
#ifndef ZEND_ENGINE_2_4
IFCOPY(`dst->size = src->last;DONE(size)', `DISPATCH(zend_uint, size)')
IFCOPY(`dst->size = src->last;DONE(size)', `PROCESS(zend_uint, size)')
#endif
#ifdef IS_CV
STRUCT_ARRAY(last_var, zend_compiled_variable, vars)
DISPATCH(int, last_var)
PROCESS(int, last_var)
# ifndef ZEND_ENGINE_2_4
IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `DISPATCH(zend_uint, size_var)')
IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `PROCESS(zend_uint, size_var)')
# endif
#else
dnl zend_cv.m4 is illegal to be made public, don not ask me for it
@ -852,38 +851,38 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
')
#endif
DISPATCH(zend_uint, T)
PROCESS(zend_uint, T)
STRUCT_ARRAY(last_brk_cont, zend_brk_cont_element, brk_cont_array)
DISPATCH(zend_uint, last_brk_cont)
PROCESS(zend_uint, last_brk_cont)
#ifndef ZEND_ENGINE_2_4
DISPATCH(zend_uint, current_brk_cont)
PROCESS(zend_uint, current_brk_cont)
#endif
#ifndef ZEND_ENGINE_2
DISPATCH(zend_bool, uses_globals)
PROCESS(zend_bool, uses_globals)
#endif
#ifdef ZEND_ENGINE_2
STRUCT_ARRAY(last_try_catch, zend_try_catch_element, try_catch_array)
DISPATCH(int, last_try_catch)
PROCESS(int, last_try_catch)
#endif
STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
#ifndef ZEND_ENGINE_2_4
COPY(start_op)
DISPATCH(int, backpatch_count)
PROCESS(int, backpatch_count)
#endif
#ifdef ZEND_ENGINE_2_3
DISPATCH(zend_uint, this_var)
PROCESS(zend_uint, this_var)
#endif
#ifndef ZEND_ENGINE_2_4
DISPATCH(zend_bool, done_pass_two)
PROCESS(zend_bool, done_pass_two)
#endif
/* 5.0 <= ver < 5.3 */
#if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_3)
DISPATCH(zend_bool, uses_this)
PROCESS(zend_bool, uses_this)
#endif
IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)')
@ -895,23 +894,23 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
')
#endif
#ifdef ZEND_ENGINE_2
DISPATCH(zend_uint, line_start)
DISPATCH(zend_uint, line_end)
DISPATCH(int, doc_comment_len)
PROCESS(zend_uint, line_start)
PROCESS(zend_uint, line_end)
PROCESS(int, doc_comment_len)
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
#endif
#ifdef ZEND_COMPILE_DELAYED_BINDING
DISPATCH(zend_uint, early_binding);
PROCESS(zend_uint, early_binding);
#endif
/* reserved */
DONE(reserved)
#if defined(HARDENING_PATCH) && HARDENING_PATCH
DISPATCH(zend_bool, created_by_eval)
PROCESS(zend_bool, created_by_eval)
#endif
#ifdef ZEND_ENGINE_2_4
SETNULL(run_time_cache)
DISPATCH(int, last_cache_slot)
PROCESS(int, last_cache_slot)
#endif
} while (0);
IFRESTORE(`xc_fix_op_array_info(processor->entry_src, processor->php_src, dst, shallow_copy, op_array_info TSRMLS_CC);')
@ -966,42 +965,42 @@ dnl }}}
#ifdef HAVE_XCACHE_CONSTANT
DEF_STRUCT_P_FUNC(`xc_constinfo_t', , `dnl {{{
DISPATCH(zend_uint, key_size)
PROCESS(zend_uint, key_size)
#ifdef IS_UNICODE
DISPATCH(zend_uchar, type)
PROCESS(zend_uchar, type)
#endif
IFRESTORE(`COPY(key)', `
PROC_ZSTRING_N(type, key, key_size)
')
DISPATCH(ulong, h)
PROCESS(ulong, h)
STRUCT(zend_constant, constant)
')
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`xc_op_array_info_detail_t', , `dnl {{{
DISPATCH(zend_uint, index)
DISPATCH(zend_uint, info)
PROCESS(zend_uint, index)
PROCESS(zend_uint, info)
')
dnl }}}
DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{
#ifdef ZEND_ENGINE_2_4
DISPATCH(zend_uint, literalinfo_cnt)
PROCESS(zend_uint, literalinfo_cnt)
STRUCT_ARRAY(literalinfo_cnt, xc_op_array_info_detail_t, literalinfos)
#else
DISPATCH(zend_uint, oplineinfo_cnt)
PROCESS(zend_uint, oplineinfo_cnt)
STRUCT_ARRAY(oplineinfo_cnt, xc_op_array_info_detail_t, oplineinfos)
#endif
')
dnl }}}
DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{
DISPATCH(zend_uint, key_size)
PROCESS(zend_uint, key_size)
#ifdef IS_UNICODE
DISPATCH(zend_uchar, type)
PROCESS(zend_uchar, type)
#endif
IFRESTORE(`COPY(key)', `
PROC_ZSTRING_N(type, key, key_size)
')
DISPATCH(ulong, h)
PROCESS(ulong, h)
IFRESTORE(`COPY(op_array_info)', `
STRUCT(xc_op_array_info_t, op_array_info)
')
@ -1013,15 +1012,15 @@ DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{
')
dnl }}}
DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{
DISPATCH(zend_uint, key_size)
PROCESS(zend_uint, key_size)
#ifdef IS_UNICODE
DISPATCH(zend_uchar, type)
PROCESS(zend_uchar, type)
#endif
IFRESTORE(`COPY(key)', `
PROC_ZSTRING_N(type, key, key_size)
')
DISPATCH(ulong, h)
DISPATCH(zend_uint, methodinfo_cnt)
PROCESS(ulong, h)
PROCESS(zend_uint, methodinfo_cnt)
IFRESTORE(`COPY(methodinfos)', `
STRUCT_ARRAY(methodinfo_cnt, xc_op_array_info_t, methodinfos)
')
@ -1035,28 +1034,28 @@ DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{
STRUCT(zend_class_entry, cest)
#endif
#ifndef ZEND_COMPILE_DELAYED_BINDING
DISPATCH(int, oplineno)
PROCESS(int, oplineno)
#endif
')
dnl }}}
#ifdef ZEND_ENGINE_2_1
DEF_STRUCT_P_FUNC(`xc_autoglobal_t', , `dnl {{{
DISPATCH(zend_uint, key_len)
PROCESS(zend_uint, key_len)
#ifdef IS_UNICODE
DISPATCH(zend_uchar, type)
PROCESS(zend_uchar, type)
#endif
IFRESTORE(`COPY(key)', `
PROC_ZSTRING_L(type, key, key_len)
')
DISPATCH(ulong, h)
PROCESS(ulong, h)
')
dnl }}}
#endif
#ifdef E_STRICT
DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{
DISPATCH(int, type)
DISPATCH(uint, lineno)
DISPATCH(int, error_len)
PROCESS(int, type)
PROCESS(uint, lineno)
PROCESS(int, error_len)
PROC_STRING_L(error, error_len)
')
dnl }}}
@ -1067,16 +1066,16 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
processor->php_src = src;
')
DISPATCH(xc_hash_value_t, hvalue)
PROCESS(xc_hash_value_t, hvalue)
/* skip */
DONE(next)
COPY(cache)
DISPATCH(xc_md5sum_t, md5)
DISPATCH(zend_ulong, refcount)
PROCESS(xc_md5sum_t, md5)
PROCESS(zend_ulong, refcount)
DISPATCH(size_t, sourcesize)
DISPATCH(zend_ulong, hits)
DISPATCH(size_t, size)
PROCESS(size_t, sourcesize)
PROCESS(zend_ulong, hits)
PROCESS(size_t, size)
IFRESTORE(`COPY(op_array_info)', `
STRUCT(xc_op_array_info_t, op_array_info)
@ -1088,17 +1087,17 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
STRUCT_P(zend_op_array, op_array)
#ifdef HAVE_XCACHE_CONSTANT
DISPATCH(zend_uint, constinfo_cnt)
PROCESS(zend_uint, constinfo_cnt)
STRUCT_ARRAY(constinfo_cnt, xc_constinfo_t, constinfos)
#endif
DISPATCH(zend_uint, funcinfo_cnt)
PROCESS(zend_uint, funcinfo_cnt)
STRUCT_ARRAY(funcinfo_cnt, xc_funcinfo_t, funcinfos)
DISPATCH(zend_uint, classinfo_cnt)
PROCESS(zend_uint, classinfo_cnt)
STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos, , IFRESTORE(`processor->active_class_index'))
#ifdef ZEND_ENGINE_2_1
DISPATCH(zend_uint, autoglobal_cnt)
PROCESS(zend_uint, autoglobal_cnt)
IFRESTORE(`
COPY(autoglobals)
', `
@ -1106,7 +1105,7 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
')
#endif
#ifdef E_STRICT
DISPATCH(zend_uint, compilererror_cnt)
PROCESS(zend_uint, compilererror_cnt)
IFRESTORE(`
COPY(compilererrors)
', `
@ -1114,48 +1113,48 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
')
#endif
#ifndef ZEND_COMPILE_DELAYED_BINDING
DISPATCH(zend_bool, have_early_binding)
PROCESS(zend_bool, have_early_binding)
#endif
DISPATCH(zend_bool, have_references)
PROCESS(zend_bool, have_references)
')
dnl }}}
DEF_STRUCT_P_FUNC(`xc_entry_data_var_t', , `dnl {{{
IFDPRINT(`INDENT()`'fprintf(stderr, "zval:value");')
STRUCT_P_EX(zval_ptr, dst->value, src->value, `value', `', `&')
DISPATCH(zend_bool, have_references)
PROCESS(zend_bool, have_references)
DONE(value)
')
dnl }}}
DEF_STRUCT_P_FUNC(`xc_entry_t', , `dnl {{{
DISPATCH(xc_entry_type_t, type)
DISPATCH(size_t, size)
PROCESS(xc_entry_type_t, type)
PROCESS(size_t, size)
DISPATCH(xc_hash_value_t, hvalue)
PROCESS(xc_hash_value_t, hvalue)
COPY(cache)
/* skip */
DONE(next)
IFSTORE(`dst->refcount = 0; DONE(refcount)', `DISPATCH(long, refcount)')
IFSTORE(`dst->refcount = 0; DONE(refcount)', `PROCESS(long, refcount)')
DISPATCH(time_t, ctime)
DISPATCH(time_t, atime)
DISPATCH(time_t, dtime)
DISPATCH(long, ttl)
DISPATCH(zend_ulong, hits)
PROCESS(time_t, ctime)
PROCESS(time_t, atime)
PROCESS(time_t, dtime)
PROCESS(long, ttl)
PROCESS(zend_ulong, hits)
#ifdef IS_UNICODE
DISPATCH(zend_uchar, name_type)
PROCESS(zend_uchar, name_type)
#endif
dnl {{{ name
DISABLECHECK(`
#ifdef IS_UNICODE
if (src->name_type == IS_UNICODE) {
DISPATCH(int32_t, name.ustr.len)
PROCESS(int32_t, name.ustr.len)
}
else {
DISPATCH(int, name.str.len)
PROCESS(int, name.str.len)
}
#else
DISPATCH(int, name.str.len)
PROCESS(int, name.str.len)
#endif
IFRESTORE(`COPY(name.str.val)', `
#ifdef IS_UNICODE
@ -1185,21 +1184,21 @@ DEF_STRUCT_P_FUNC(`xc_entry_t', , `dnl {{{
')
DONE(data)
dnl }}}
DISPATCH(time_t, mtime)
PROCESS(time_t, mtime)
#ifdef HAVE_INODE
DISPATCH(int, device)
DISPATCH(int, inode)
PROCESS(int, device)
PROCESS(int, inode)
#endif
if (src->type == XC_TYPE_PHP) {
DISPATCH(int, filepath_len)
PROCESS(int, filepath_len)
IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)')
DISPATCH(int, dirpath_len)
PROCESS(int, dirpath_len)
IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)')
#ifdef IS_UNICODE
DISPATCH(int, ufilepath_len)
PROCESS(int, ufilepath_len)
IFRESTORE(`COPY(ufilepath)', `PROC_USTRING_L(ufilepath, ufilepath_len)')
DISPATCH(int, udirpath_len)
PROCESS(int, udirpath_len)
IFRESTORE(`COPY(udirpath)', `PROC_USTRING_L(udirpath, udirpath_len)')
#endif
}

24
processor/string.m4

@ -86,36 +86,36 @@ define(`PROC_STRING_N_EX', `
')
dnl }}}
dnl PROC_STRING_N(1:name, 2:size, 3:type)
define(`PROC_STRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`dst->$1', `src->$1', `src->$2', `$1', `char')')
define(`PROC_USTRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`dst->$1', `src->$1', `src->$2', `$1', `UChar')')
define(`PROC_STRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `SRC(`$2')', `$1', `char')')
define(`PROC_USTRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `SRC(`$2')', `$1', `UChar')')
define(`PROC_STRING_L', `DBG(`$0($*)') PROC_STRING_N(`$1', `$2 + 1')')
define(`PROC_USTRING_L', `DBG(`$0($*)') PROC_USTRING_N(`$1', `$2 + 1')')
define(`PROC_STRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`dst->$1', `src->$1', `strlen(src->$1) + 1', `$1', `char')')
define(`PROC_USTRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`dst->$1', `src->$1', `strlen(src->$1) + 1', `$1', `UChar')')
define(`PROC_STRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `strlen(SRC(`$1')) + 1', `$1', `char')')
define(`PROC_USTRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `strlen(SRC(`$1')) + 1', `$1', `UChar')')
dnl {{{ PROC_ZSTRING_N(1:type, 2:name, 3:size, 4:size_type)
define(`PROC_ZSTRING_N', `
DBG(`$0($*)')
#ifdef IS_UNICODE
pushdef(`NSIZE', ifelse(
`$4', `strlen', `UNI_STRLEN (src->$2) + 1',
`$4', `len', `src->$3 + 1',
`', `', `src->$3',
`$4', `strlen', `UNI_STRLEN (SRC(`$2')) + 1',
`$4', `len', `SRC(`$3') + 1',
`', `', `SRC(`$3')',
))
DONE(`$2')
ifelse(`$1', `1', `PROC_STRING_N_EX(`dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_uchar')
ifelse(`$1', `1', `PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', defn(`NSIZE'), `$2', `zstr_uchar')
', `
if (ifelse(`$1', `', `UG(unicode)', `src->$1 == IS_UNICODE')) {
PROC_STRING_N_EX(`dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_uchar')
if (ifelse(`$1', `', `UG(unicode)', `SRC(`$1') == IS_UNICODE')) {
PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', defn(`NSIZE'), `$2', `zstr_uchar')
}
else {
PROC_STRING_N_EX(`dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_char')
PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', defn(`NSIZE'), `$2', `zstr_char')
}
')
#else
DONE(`$2')
PROC_STRING_N_EX(`dst->$2', `src->$2', NSIZE, `$2', `zstr_char')
PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', NSIZE, `$2', `zstr_char')
#endif
popdef(`NSIZE')
')

55
processor/struct.m4

@ -127,7 +127,7 @@ dnl {{{ STRUCT_P_EX(1:type, 2:dst, 3:src, 4:elm-name, 5:name=type, 6:&)
define(`STRUCT_P_EX', `
DBG(`$0($*)')
pushdefFUNC_NAME(`$1', `$5')
ifdef(`DEFINED_'ifelse(`$5', `', `$1', `$5'), `', `m4_errprint(`Unknown struct "'ifelse(`$5', `', `$1', `$5')`"')')
ifdef(`DEFINED_'ifelse(`$5', `', `$1', `$5'), `', `m4_errprint(`AUTOCHECK ERROR: Unknown struct "'ifelse(`$5', `', `$1', `$5')`"')define(`EXIT_PENDING', 1)')
assert(sizeof($1) == sizeof(($6 $3)[0]));
ifelse(`$6', `', `ALLOC(`$2', `$1')')
IFDASM(`do {
@ -155,9 +155,9 @@ dnl }}}
dnl {{{ STRUCT_P(1:type, 2:elm, 3:name=type)
define(`STRUCT_P', `
DBG(`$0($*)')
if (src->$2) {
if (SRC(`$2')) {
IFDPRINT(`INDENT()`'fprintf(stderr, "$1:$2 ");')
STRUCT_P_EX(`$1', `dst->$2', `src->$2', `$2', `$3')
STRUCT_P_EX(`$1', `dst->$2', `SRC(`$2')', `$2', `$3')
}
else {
IFDPRINT(`INDENT()`'fprintf(stderr, "$1:$2:\tNULL\n");')
@ -169,15 +169,15 @@ dnl }}}
dnl {{{ STRUCT(1:type, 2:elm, 3:name=type)
define(`STRUCT', `
DBG(`$0($*)')
assert(sizeof($1) == sizeof(src->$2));
assert(sizeof($1) == sizeof(SRC(`$2')));
IFDPRINT(`INDENT()`'fprintf(stderr, "$1:$2 ");')
STRUCT_P_EX(`$1', `dst->$2', `src->$2', `$2', `$3', `&')
STRUCT_P_EX(`$1', `dst->$2', `SRC(`$2')', `$2', `$3', `&')
DONE(`$2')
')
dnl }}}
dnl {{{ STRUCT_ARRAY(1:count, 2:type, 3:elm, 4:name=type, 5:loopcounter)
define(`STRUCT_ARRAY', `
if (src->$3) {
if (SRC(`$3')) {
ifelse(
`$5', `', `int i; pushdef(`LOOPCOUNTER', `i')',
`', `', `pushdef(`LOOPCOUNTER', `$5')')
@ -187,49 +187,44 @@ define(`STRUCT_ARRAY', `
ALLOC_INIT_ZVAL(arr);
array_init(arr);
LOOPCOUNTER = 0;
while (
ifelse(`$1', `', `src->$3[LOOPCOUNTER]',
`', `', `LOOPCOUNTER < src->$1')
) {
for (LOOPCOUNTER = 0;
ifelse(`$1', `', `SRC(`$3[LOOPCOUNTER]')',
`', `', `LOOPCOUNTER < SRC(`$1')');
++LOOPCOUNTER) {
zval *zv;
ALLOC_INIT_ZVAL(zv);
array_init(zv);
FUNC_NAME (zv, &(src->$3[LOOPCOUNTER]) TSRMLS_CC);
FUNC_NAME (zv, &(SRC(`$3[LOOPCOUNTER]')) TSRMLS_CC);
add_next_index_zval(arr, zv);
++LOOPCOUNTER;
}
add_assoc_zval_ex(dst, ZEND_STRS("$3"), arr);
', `
dnl find count with NULL
ifelse(`$1', `', `
int count;
for (count = 0; src->$3[count]; ++count) {
/* just count */
size_t count = 0;
while (SRC(`$3[count]')) {
++count;
}
++count;
pushdef(`STRUCT_COUNT', `count')
pushdef(`ARRAY_ELEMENT_COUNT', `count')
',
`', `', `pushdef(`STRUCT_COUNT', `src->$1')')
ALLOC(`dst->$3', `$2', `STRUCT_COUNT')
`', `', `pushdef(`ARRAY_ELEMENT_COUNT', `SRC(`$1')')')
ALLOC(`dst->$3', `$2', `ARRAY_ELEMENT_COUNT')
popdef(`ARRAY_ELEMENT_COUNT')
ifdef(`AFTER_ALLOC', AFTER_ALLOC)
LOOPCOUNTER = 0;
while (
ifelse(`$1', `', `src->$3[LOOPCOUNTER]',
`', `', `LOOPCOUNTER < src->$1')
) {
for (LOOPCOUNTER = 0;
ifelse(`$1', `', `SRC(`$3[LOOPCOUNTER]')',
`', `', `LOOPCOUNTER < SRC(`$1')');
++LOOPCOUNTER) {
DISABLECHECK(`
STRUCT(`$2', `$3[LOOPCOUNTER]', `$4')
')
++LOOPCOUNTER;
}
dnl tailing NULL
ifelse(`$1', `', `IFCOPY(`dst->$3[LOOPCOUNTER] = NULL;')')
popdef(`STRUCT_COUNT')
dnl the end marker
ifelse(`$1', `', `IFCOPY(`DST(`$3[LOOPCOUNTER]') = NULL;')')
')dnl IFDASM
DONE(`$3')
popdef(`FUNC_NAME')

Loading…
Cancel
Save