Changeset 843
- Timestamp:
- 03/25/2012 09:01:16 AM (14 months ago)
- Location:
- trunk/processor
- Files:
-
- 6 modified
- 1 moved
-
hashtable.m4 (modified) (2 diffs)
-
head.m4 (modified) (3 diffs)
-
main.m4 (modified) (6 diffs)
-
process.m4 (moved) (moved from trunk/processor/dispatch.m4) (1 diff)
-
processor.m4 (modified) (50 diffs)
-
string.m4 (modified) (2 diffs)
-
struct.m4 (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/processor/hashtable.m4
r824 r843 78 78 IFRESTORE(`dst->canary = zend_hash_canary; DONE(canary)', ` 79 79 dnl else 80 DISPATCH(unsigned int, canary)80 PROCESS(unsigned int, canary) 81 81 ') 82 82 ') 83 83 #endif 84 DISPATCH(uint, nTableSize)85 DISPATCH(uint, nTableMask)86 DISPATCH(uint, nNumOfElements)87 DISPATCH(ulong, nNextFreeElement)84 PROCESS(uint, nTableSize) 85 PROCESS(uint, nTableMask) 86 PROCESS(uint, nNumOfElements) 87 PROCESS(ulong, nNextFreeElement) 88 88 IFCOPY(`dst->pInternalPointer = NULL; /* Used for element traversal */') DONE(pInternalPointer) 89 89 IFCOPY(`dst->pListHead = NULL;') DONE(pListHead) … … 165 165 IFCOPY(`dst->pListTail = pnew;') DONE(pListTail) 166 166 IFCOPY(`dst->pDestructor = src->pDestructor;') DONE(pDestructor) 167 DISPATCH(zend_bool, persistent)167 PROCESS(zend_bool, persistent) 168 168 #ifdef IS_UNICODE 169 DISPATCH(zend_bool, unicode)169 PROCESS(zend_bool, unicode) 170 170 #endif 171 DISPATCH(unsigned char, nApplyCount)172 DISPATCH(zend_bool, bApplyProtection)171 PROCESS(unsigned char, nApplyCount) 172 PROCESS(zend_bool, bApplyProtection) 173 173 #if ZEND_DEBUG 174 DISPATCH(int, inconsistent)174 PROCESS(int, inconsistent) 175 175 #endif 176 176 ')dnl IFDASM -
trunk/processor/head.m4
r838 r843 37 37 define(`SIZEOF_xc_entry_name_t', `sizeof(xc_entry_name_t)') 38 38 define(`COUNTOF_xc_entry_name_t', `1') 39 define(`SIZEOF_xc_ztstring', `sizeof(xc_ztstring)') 40 define(`COUNTOF_xc_ztstring', `1') 39 41 40 42 ifdef(`XCACHE_ENABLE_TEST', ` … … 56 58 typedef zval *zval_ptr; 57 59 typedef zval *zval_ptr_nullable; 60 typedef char *xc_ztstring; 58 61 #ifdef ZEND_ENGINE_2_4 59 62 typedef zend_trait_alias *zend_trait_alias_ptr; … … 61 64 #endif 62 65 63 typedef zend_uchar zval_data_type; 66 typedef zend_uchar xc_zval_data_type; 67 typedef int xc_op_type; 68 typedef zend_uchar xc_opcode; 64 69 #ifdef IS_UNICODE 65 70 typedef UChar zstr_uchar; -
trunk/processor/main.m4
r837 r843 20 20 define(`ZEND_STRS', `($1), (sizeof($1))') 21 21 define(`ZEND_STRL', `($1), (sizeof($1) - 1)') 22 define(`DST', `dst->$1') 23 define(`SRC', `src->$1') 22 24 dnl ============ 23 25 define(`INDENT', `xc_dprint_indent(indent);') … … 81 83 popdef(`SIZE') 82 84 ') 83 dnl CALLOC(1:dst, 2:type [, 3:count=1 ]) 84 define(`CALLOC', `ALLOC(`$1', `$2', `$3', `1')') 85 dnl }}} 86 dnl {{{ PROC_INT(1:elm, 2:format=%d, 3:type=, 4:spec=) 87 define(`PROC_INT', ` 88 IFNOTMEMCPY(`IFCOPY(`dst->$1 = src->$1;')') 89 IFDPRINT(` 90 INDENT() 91 ifelse( 92 `$3 $1', `zval_data_type type', `fprintf(stderr, "$3:$1:\t%d %s\n", src->$1, xc_get_data_type(src->$1));' 93 , `$3 $1', `int op_type', `fprintf(stderr, "$3:$1:\t%d %s\n", src->$1, xc_get_op_type(src->$1));' 94 , `$3 $1', `zend_uchar opcode', `fprintf(stderr, "$3:$1:\t%d %s\n", src->$1, xc_get_opcode(src->$1));' 95 , `', `', `fprintf(stderr, "$3:$1:\t%ifelse(`$2',`',`d',`$2')\n", src->$1);') 96 ') 97 IFDASM(` 98 ifelse( 99 `$3', `zend_bool', `add_assoc_bool_ex(dst, ZEND_STRS("$1"), src->$1 ? 1 : 0);' 100 , `', `', `add_assoc_long_ex(dst, ZEND_STRS("$1"), src->$1);' 101 ) 102 ') 103 DONE(`$1') 104 ') 85 dnl CALLOC(1:dst, 2:type [, 3:count=1, 4:forcetype=$2 ]) 86 define(`CALLOC', `ALLOC(`$1', `$2', `$3', `1', `$4')') 105 87 dnl }}} 106 88 dnl {{{ PROC_CLASS_ENTRY_P(1:elm) 107 define(`PROC_CLASS_ENTRY_P', `PROC_CLASS_ENTRY_P_EX(`dst->$1', ` src->$1', `$1')`'DONE(`$1')')89 define(`PROC_CLASS_ENTRY_P', `PROC_CLASS_ENTRY_P_EX(`dst->$1', `SRC(`$1')', `$1')`'DONE(`$1')') 108 90 dnl PROC_CLASS_ENTRY_P_EX(1:dst, 2:src, 3:elm-name) 109 91 define(`PROC_CLASS_ENTRY_P_EX', ` … … 151 133 dnl }}} 152 134 dnl {{{ COPY 153 define(`COPY', `IFNOTMEMCPY(`IFCOPY(`dst->$1 = src->$1;')')DONE(`$1')')135 define(`COPY', `IFNOTMEMCPY(`IFCOPY(`dst->$1 = SRC(`$1');')')DONE(`$1')') 154 136 dnl }}} 155 137 dnl {{{ COPY_N_EX 156 138 define(`COPY_N_EX', ` 157 ALLOC(`dst->$3', `$2', ` src->$1')139 ALLOC(`dst->$3', `$2', `SRC(`$1')') 158 140 IFCOPY(` 159 memcpy(dst->$3, src->$3, sizeof(dst->$3[0]) * src->$1);141 memcpy(dst->$3, SRC(`$3'), sizeof(dst->$3[0]) * SRC(`$1')); 160 142 ') 161 143 ') … … 168 150 dnl }}} 169 151 dnl {{{ COPYARRAY_EX 170 define(`COPYARRAY_EX', `IFNOTMEMCPY(`IFCOPY(`memcpy(dst->$1, src->$1, sizeof(dst->$1));')')')152 define(`COPYARRAY_EX', `IFNOTMEMCPY(`IFCOPY(`memcpy(dst->$1, SRC(`$1'), sizeof(dst->$1));')')') 171 153 dnl }}} 172 154 dnl {{{ COPYARRAY … … 226 208 } 227 209 ') 228 DONE_SIZE(`sizeof( src->$1)')210 DONE_SIZE(`sizeof(SRC(`$1'))') 229 211 ') 230 212 define(`DISABLECHECK', ` … … 261 243 include(srcdir`/processor/string.m4') 262 244 include(srcdir`/processor/struct.m4') 263 include(srcdir`/processor/ dispatch.m4')245 include(srcdir`/processor/process.m4') 264 246 include(srcdir`/processor/head.m4') 265 247 -
trunk/processor/process.m4
r840 r843 1 dnl DISPATCH(1:type, 2:elm) 2 define(`DISPATCH', ` 1 define(`PROCESS_SCALAR', `dnl {{{ (1:elm, 2:format=%d, 3:type=) 2 IFNOTMEMCPY(`IFCOPY(`DST(`$1') = SRC(`$1');')') 3 IFDPRINT(` 4 INDENT() 5 fprintf(stderr, "$3:$1:\t%ifelse(`$2',`',`d',`$2')\n", SRC(`$1')); 6 ') 7 IFDASM(` 8 ifelse( 9 `$3', `zend_bool', `add_assoc_bool_ex(dst, ZEND_STRS("$1"), SRC(`$1') ? 1 : 0);' 10 , `', `', `add_assoc_long_ex(dst, ZEND_STRS("$1"), SRC(`$1'));' 11 ) 12 ') 13 DONE(`$1') 14 ') 15 dnl }}} 16 define(`PROCESS_xc_ztstring', `dnl {{{ (1:elm) 17 PROC_STRING(`$1') 18 ') 19 dnl }}} 20 define(`PROCESS_zval_data_type', `dnl {{{ (1:elm) 21 IFDPRINT(` 22 INDENT() 23 fprintf(stderr, ":$1:\t%d %s\n", SRC(`$1'), xc_get_data_type(SRC(`$1'))); 24 DONE(`$1') 25 ', `PROCESS_SCALAR(`$1')') 26 ') 27 dnl }}} 28 define(`PROCESS_op_type', `dnl {{{ (1:elm) 29 IFDPRINT(` 30 INDENT() 31 fprintf(stderr, ":$1:\t%d %s\n", SRC(`$1'), xc_get_op_type(SRC(`$1'))); 32 DONE(`$1') 33 ', `PROCESS_SCALAR(`$1')') 34 ') 35 dnl }}} 36 define(`PROCESS_opcode', `dnl {{{ (1:elm) 37 IFDPRINT(` 38 INDENT() 39 fprintf(stderr, ":$1:\t%u %s\n", SRC(`$1'), xc_get_opcode(SRC(`$1'))); 40 DONE(`$1') 41 ', `PROCESS_SCALAR(`$1')') 42 ') 43 dnl }}} 44 define(`PROCESS', `dnl PROCESS(1:type, 2:elm) 3 45 DBG(`$0($*)') 4 assert(sizeof($1) == sizeof( src->$2));46 assert(sizeof($1) == sizeof(SRC(`$2'))); 5 47 ifelse( 6 `$1', `zend_bool', `PROC_INT(`$2', `u', `$1')' 7 , `$1', `zend_uchar', `PROC_INT(`$2', `u', `$1')' 8 , `$1', `char', `PROC_INT(`$2', `d', `$1')' 9 , `$1', `int32_t', `PROC_INT(`$2', `d', `$1')' 10 , `$1', `unsigned char', `PROC_INT(`$2', `u', `$1')' 11 , `$1', `zend_uint', `PROC_INT(`$2', `u', `$1')' 12 , `$1', `uint', `PROC_INT(`$2', `u', `$1')' 13 , `$1', `unsigned int', `PROC_INT(`$2', `u', `$1')' 14 , `$1', `zend_ulong', `PROC_INT(`$2', `lu', `$1')' 15 , `$1', `ulong', `PROC_INT(`$2', `lu', `$1')' 16 , `$1', `size_t', `PROC_INT(`$2', `u', `$1')' 17 , `$1', `long', `PROC_INT(`$2', `ld', `$1')' 18 , `$1', `time_t', `PROC_INT(`$2', `ld', `$1')' 19 , `$1', `zend_ushort', `PROC_INT(`$2', `hu', `$1')' 20 , `$1', `int', `PROC_INT(`$2', `d', `$1')' 21 , `$1', `double', `PROC_INT(`$2', `f', `$1')' 22 , `$1', `opcode_handler_t', `/* is copying enough? */COPY(`$2')' 23 , `$1', `zval_data_type', `PROC_INT(`$2', `u', `$1')' 24 , `$1', `xc_entry_type_t', `PROC_INT(`$2', `d', `$1')' 25 , `$1', `xc_hash_value_t', `PROC_INT(`$2', `lu', `$1')' 26 , `$1', `xc_md5sum_t', `COPY(`$2')' 27 , `', `', `m4_errprint(`Unknown type "$1"')' 48 `$1', `zend_bool', `PROCESS_SCALAR(`$2', `u', `$1')' 49 , `$1', `zend_uchar', `PROCESS_SCALAR(`$2', `u', `$1')' 50 , `$1', `char', `PROCESS_SCALAR(`$2', `d', `$1')' 51 , `$1', `int32_t', `PROCESS_SCALAR(`$2', `d', `$1')' 52 , `$1', `unsigned char', `PROCESS_SCALAR(`$2', `u', `$1')' 53 , `$1', `zend_uint', `PROCESS_SCALAR(`$2', `u', `$1')' 54 , `$1', `uint', `PROCESS_SCALAR(`$2', `u', `$1')' 55 , `$1', `unsigned int', `PROCESS_SCALAR(`$2', `u', `$1')' 56 , `$1', `zend_ulong', `PROCESS_SCALAR(`$2', `lu', `$1')' 57 , `$1', `ulong', `PROCESS_SCALAR(`$2', `lu', `$1')' 58 , `$1', `size_t', `PROCESS_SCALAR(`$2', `u', `$1')' 59 , `$1', `long', `PROCESS_SCALAR(`$2', `ld', `$1')' 60 , `$1', `time_t', `PROCESS_SCALAR(`$2', `ld', `$1')' 61 , `$1', `zend_ushort', `PROCESS_SCALAR(`$2', `hu', `$1')' 62 , `$1', `int', `PROCESS_SCALAR(`$2', `d', `$1')' 63 , `$1', `double', `PROCESS_SCALAR(`$2', `f', `$1')' 64 , `$1', `xc_entry_type_t', `PROCESS_SCALAR(`$2', `d', `$1')' 65 , `$1', `xc_hash_value_t', `PROCESS_SCALAR(`$2', `lu', `$1')' 66 67 , `$1', `xc_ztstring', `PROCESS_xc_ztstring(`$2')' 68 , `$1', `xc_zval_data_type', `PROCESS_zval_data_type(`$2')' 69 , `$1', `xc_op_type', `PROCESS_op_type(`$2')' 70 , `$1', `xc_opcode', `PROCESS_opcode(`$2')' 71 , `$1', `opcode_handler_t', `/* is copying enough? */COPY(`$2')' 72 , `$1', `xc_md5sum_t', `COPY(`$2')' 73 , `', `', `m4_errprint(`AUTOCHECK ERROR: Unknown type "$1"')define(`EXIT_PENDING', 1)' 28 74 ) 29 75 ') 30 dnl {{{ DISPATCH_ARRAY(1:count, 2:type, 3:elm) 31 define(`DISPATCH_ARRAY', ` 76 define(`PROCESS_ARRAY', `dnl {{{ (1:count, 2:type, 3:elm, [4:force_type]) 32 77 if (src->$3) { 33 int i;78 int LOOPCOUNTER; 34 79 IFDASM(` 35 80 zval *arr; 36 81 ALLOC_INIT_ZVAL(arr); 37 82 array_init(arr); 38 for (i = 0; i < src->$1; i ++) { 39 ifelse( 40 `$2', `zend_bool', `add_assoc_bool_ex(arr, ZEND_STRS("$3"), src->$3[i] ? 1 : 0);' 41 , `', `', `add_next_index_long(arr, src->$3[i]);') 83 84 for (LOOPCOUNTER = 0; 85 ifelse(`$1', `', `src->$3[LOOPCOUNTER]', 86 `', `', `LOOPCOUNTER < SRC(`$1')'); 87 ++LOOPCOUNTER) { 88 pushdef(`dst', `arr') 89 pushdef(`SRC', defn(`SRC') `[LOOPCOUNTER]') 90 popdef(`add_assoc_bool_ex', `add_next_index_bool($1, $3)') 91 popdef(`add_assoc_string_ex', `add_next_index_string($1, $3)') 92 popdef(`add_assoc_long_ex', `add_next_index_long($1, $3)') 93 popdef(`add_assoc_zval_ex', `add_next_index_zval($1, $3)') 94 DISABLECHECK(` 95 PROCESS(`$2', `$3') 96 ') 97 popdef(`add_assoc_zval_ex') 98 popdef(`add_assoc_long_ex') 99 popdef(`add_assoc_string_ex') 100 popdef(`add_assoc_bool_ex') 101 popdef(`SRC') 102 popdef(`dst') 103 104 ++LOOPCOUNTER; 42 105 } 43 106 add_assoc_zval_ex(dst, ZEND_STRS("$3"), arr); 44 107 ', ` 45 COPY_N_EX($@) 46 for (i = 0; i < src->$1; i ++) { 108 dnl find count with NULL 109 ifelse(`$1', `', ` 110 size_t count = 0; 111 while (SRC(`$3[count]')) { 112 ++count; 113 } 114 ++count; 115 pushdef(`STRUCT_COUNT', `count') 116 ', 117 `', `', `pushdef(`STRUCT_COUNT', `SRC(`$1')')') 118 ALLOC(`dst->$3', `$2', `STRUCT_COUNT', , `$4') 119 popdef(`STRUCT_COUNT') 120 121 for (LOOPCOUNTER = 0; 122 ifelse(`$1', `', `src->$3[LOOPCOUNTER]', 123 `', `', `LOOPCOUNTER < SRC(`$1')'); 124 ++LOOPCOUNTER) { 47 125 DISABLECHECK(` 48 DISPATCH(`$2', `$3[i]', `$4') 126 pushdef(`DST', defn(`DST') `[LOOPCOUNTER]') 127 pushdef(`SRC', ((const char **) defn(`SRC'))`[LOOPCOUNTER]') 128 PROCESS(`$2', `$3') 129 popdef(`SRC') 130 popdef(`DST') 49 131 ') 50 132 } 133 dnl the end marker 134 ifelse(`$1', `', `IFCOPY(`DST(`$3[LOOPCOUNTER]') = NULL;')') 51 135 ')dnl IFDASM 52 136 DONE(`$3') -
trunk/processor/processor.m4
r841 r843 18 18 #ifdef IS_CV 19 19 DEF_STRUCT_P_FUNC(`zend_compiled_variable', , `dnl {{{ 20 DISPATCH(int, name_len)20 PROCESS(int, name_len) 21 21 PROC_ZSTRING_L(, name, name_len) 22 DISPATCH(ulong, hash_value)22 PROCESS(ulong, hash_value) 23 23 ') 24 24 dnl }}} … … 46 46 #ifdef ZEND_ENGINE_2 47 47 DEF_STRUCT_P_FUNC(`zend_try_catch_element', , `dnl {{{ 48 DISPATCH(zend_uint, try_op)49 DISPATCH(zend_uint, catch_op)48 PROCESS(zend_uint, try_op) 49 PROCESS(zend_uint, catch_op) 50 50 ') 51 51 dnl }}} … … 53 53 DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `dnl {{{ 54 54 #ifdef ZEND_ENGINE_2_2 55 DISPATCH(int, start)56 #endif 57 DISPATCH(int, cont)58 DISPATCH(int, brk)59 DISPATCH(int, parent)55 PROCESS(int, start) 56 #endif 57 PROCESS(int, cont) 58 PROCESS(int, brk) 59 PROCESS(int, parent) 60 60 ') 61 61 dnl }}} … … 91 91 case IS_RESOURCE: 92 92 case IS_BOOL: 93 DISPATCH(long, value.lval)93 PROCESS(long, value.lval) 94 94 break; 95 95 case IS_DOUBLE: 96 DISPATCH(double, value.dval)96 PROCESS(double, value.dval) 97 97 break; 98 98 case IS_NULL: … … 110 110 case FLAG_IS_BC: 111 111 #endif 112 DISPATCH(int, value.str.len)112 PROCESS(int, value.str.len) 113 113 PROC_STRING_L(value.str.val, value.str.len) 114 114 break; … … 116 116 case IS_UNICODE: 117 117 proc_unicode: 118 DISPATCH(int32_t, value.uni.len)118 PROCESS(int32_t, value.uni.len) 119 119 PROC_ZSTRING_L(1, value.uni.val, value.uni.len) 120 120 break; … … 141 141 dnl }}} 142 142 DONE(value) 143 DISPATCH(zval_data_type, type)143 PROCESS(xc_zval_data_type, type) 144 144 #ifdef ZEND_ENGINE_2_3 145 DISPATCH(zend_uchar, is_ref__gc)146 #else 147 DISPATCH(zend_uchar, is_ref)145 PROCESS(zend_uchar, is_ref__gc) 146 #else 147 PROCESS(zend_uchar, is_ref) 148 148 #endif 149 149 150 150 #ifdef ZEND_ENGINE_2_3 151 DISPATCH(zend_uint, refcount__gc)151 PROCESS(zend_uint, refcount__gc) 152 152 #elif defined(ZEND_ENGINE_2) 153 DISPATCH(zend_uint, refcount)154 #else 155 DISPATCH(zend_ushort, refcount)153 PROCESS(zend_uint, refcount) 154 #else 155 PROCESS(zend_ushort, refcount) 156 156 #endif 157 157 ')dnl IFDASM … … 224 224 #ifdef ZEND_ENGINE_2 225 225 DEF_STRUCT_P_FUNC(`zend_arg_info', , `dnl {{{ 226 DISPATCH(zend_uint, name_len)226 PROCESS(zend_uint, name_len) 227 227 PROC_ZSTRING_L(, name, name_len) 228 DISPATCH(zend_uint, class_name_len)228 PROCESS(zend_uint, class_name_len) 229 229 PROC_ZSTRING_L(, class_name, class_name_len) 230 230 #ifdef ZEND_ENGINE_2_4 231 DISPATCH(zend_uchar, type_hint)232 #else 233 DISPATCH(zend_bool, array_type_hint)234 #endif 235 DISPATCH(zend_bool, allow_null)236 DISPATCH(zend_bool, pass_by_reference)231 PROCESS(zend_uchar, type_hint) 232 #else 233 PROCESS(zend_bool, array_type_hint) 234 #endif 235 PROCESS(zend_bool, allow_null) 236 PROCESS(zend_bool, pass_by_reference) 237 237 #ifndef ZEND_ENGINE_2_4 238 DISPATCH(zend_bool, return_reference)239 DISPATCH(int, required_num_args)238 PROCESS(zend_bool, return_reference) 239 PROCESS(int, required_num_args) 240 240 #endif 241 241 ') … … 245 245 DEF_STRUCT_P_FUNC(`zend_constant', , `dnl {{{ 246 246 STRUCT(zval, value) 247 DISPATCH(int, flags)248 DISPATCH(uint, name_len)247 PROCESS(int, flags) 248 PROCESS(uint, name_len) 249 249 pushdef(`estrndup', `zend_strndup') 250 250 PROC_ZSTRING_N(, name, name_len) 251 251 popdef(`estrndup') 252 DISPATCH(int, module_number)252 PROCESS(int, module_number) 253 253 ') 254 254 dnl }}} … … 277 277 #ifdef ZEND_ENGINE_2 278 278 DEF_STRUCT_P_FUNC(`zend_property_info', , `dnl {{{ 279 DISPATCH(zend_uint, flags)280 DISPATCH(int, name_length)279 PROCESS(zend_uint, flags) 280 PROCESS(int, name_length) 281 281 PROC_ZSTRING_L(, name, name_length) 282 DISPATCH(ulong, h)283 #ifdef ZEND_ENGINE_2_4 284 DISPATCH(int, offset)282 PROCESS(ulong, h) 283 #ifdef ZEND_ENGINE_2_4 284 PROCESS(int, offset) 285 285 #endif 286 286 #ifdef ZEND_ENGINE_2_1 287 DISPATCH(int, doc_comment_len)287 PROCESS(int, doc_comment_len) 288 288 PROC_ZSTRING_L(, doc_comment, doc_comment_len) 289 289 #endif … … 297 297 #ifdef ZEND_ENGINE_2_4 298 298 DEF_STRUCT_P_FUNC(`zend_trait_method_reference', , `dnl {{{ 299 DISPATCH(unsigned int, mname_len)299 PROCESS(unsigned int, mname_len) 300 300 PROC_STRING_L(method_name, mname_len) 301 301 COPYNULL(ce) 302 DISPATCH(unsigned int, cname_len)302 PROCESS(unsigned int, cname_len) 303 303 PROC_STRING_L(class_name, cname_len) 304 304 ') … … 306 306 DEF_STRUCT_P_FUNC(`zend_trait_alias', , `dnl {{{ 307 307 STRUCT_P(zend_trait_method_reference, trait_method) 308 DISPATCH(unsigned int, alias_len)308 PROCESS(unsigned int, alias_len) 309 309 PROC_STRING_L(alias, alias_len) 310 DISPATCH(zend_uint, modifiers)310 PROCESS(zend_uint, modifiers) 311 311 COPYNULL(function) 312 312 ') … … 314 314 DEF_STRUCT_P_FUNC(`zend_trait_precedence', , `dnl {{{ 315 315 STRUCT_P(zend_trait_method_reference, trait_method) 316 dnl TODO 317 STRUCT_ARRAY(, xc_class_name_t, exclude_from_classes) 316 PROCESS_ARRAY(, xc_ztstring, exclude_from_classes, zend_class_entry*) 318 317 COPYNULL(function) 319 318 ') … … 351 350 IFCOPY(`processor->active_class_entry_dst = dst;') 352 351 ') 353 DISPATCH(char, type)354 DISPATCH(zend_uint, name_length)352 PROCESS(char, type) 353 PROCESS(zend_uint, name_length) 355 354 PROC_ZSTRING_L(, name, name_length) 356 355 IFRESTORE(` … … 365 364 ') 366 365 #ifdef ZEND_ENGINE_2 367 DISPATCH(int, refcount)366 PROCESS(int, refcount) 368 367 #else 369 368 STRUCT_P(int, refcount) 370 369 #endif 371 370 #ifndef ZEND_ENGINE_2_4 372 DISPATCH(zend_bool, constants_updated)373 #endif 374 #ifdef ZEND_ENGINE_2 375 DISPATCH(zend_uint, ce_flags)371 PROCESS(zend_bool, constants_updated) 372 #endif 373 #ifdef ZEND_ENGINE_2 374 PROCESS(zend_uint, ce_flags) 376 375 #endif 377 376 … … 382 381 #ifdef ZEND_ENGINE_2_4 383 382 STRUCT_ARRAY(default_properties_count, zval_ptr_nullable, default_properties_table) 384 DISPATCH(int, default_properties_count)383 PROCESS(int, default_properties_count) 385 384 STRUCT_ARRAY(default_static_members_count, zval_ptr_nullable, default_static_members_table) 386 DISPATCH(int, default_static_members_count)385 PROCESS(int, default_static_members_count) 387 386 IFCOPY(`dst->static_members_table = dst->default_static_members_table;') 388 387 DONE(static_members_table) … … 425 424 DONE(`interfaces') 426 425 ') 427 DISPATCH(zend_uint, num_interfaces)426 PROCESS(zend_uint, num_interfaces) 428 427 #endif 429 428 STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases) … … 433 432 DISABLECHECK(` 434 433 IFRESTORE(`dst->info.user.filename = processor->entry_src->filepath;', `PROC_STRING(info.user.filename)') 435 DISPATCH(zend_uint, info.user.line_start)436 DISPATCH(zend_uint, info.user.line_end)437 DISPATCH(zend_uint, info.user.doc_comment_len)434 PROCESS(zend_uint, info.user.line_start) 435 PROCESS(zend_uint, info.user.line_end) 436 PROCESS(zend_uint, info.user.doc_comment_len) 438 437 PROC_ZSTRING_L(, info.user.doc_comment, info.user.doc_comment_len) 439 438 ') … … 441 440 # else 442 441 IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)') 443 DISPATCH(zend_uint, line_start)444 DISPATCH(zend_uint, line_end)442 PROCESS(zend_uint, line_start) 443 PROCESS(zend_uint, line_end) 445 444 # ifdef ZEND_ENGINE_2_1 446 DISPATCH(zend_uint, doc_comment_len)445 PROCESS(zend_uint, doc_comment_len) 447 446 PROC_ZSTRING_L(, doc_comment, doc_comment_len) 448 447 # endif … … 519 518 case IS_CONST: 520 519 ifelse($1, `result', ` 521 DISPATCH(zend_uint, $1.constant)520 PROCESS(zend_uint, $1.constant) 522 521 ', ` 523 522 IFDASM(`{ … … 532 531 dst->$1 = src->$1; 533 532 ', ` 534 DISPATCH(zend_uint, $1.constant)533 PROCESS(zend_uint, $1.constant) 535 534 ') 536 535 ') … … 546 545 case IS_TMP_VAR: 547 546 case IS_CV: 548 DISPATCH(zend_uint, $1.var)547 PROCESS(zend_uint, $1.var) 549 548 break; 550 549 case IS_UNUSED: 551 IFDASM(` DISPATCH(zend_uint, $1.var)')552 DISPATCH(zend_uint, $1.opline_num)550 IFDASM(`PROCESS(zend_uint, $1.var)') 551 PROCESS(zend_uint, $1.opline_num) 553 552 break; 554 553 ') … … 560 559 #else 561 560 DEF_STRUCT_P_FUNC(`znode', , `dnl {{{ 562 DISPATCH(int, op_type)561 PROCESS(xc_op_type, op_type) 563 562 564 563 #ifdef IS_CV … … 588 587 case IS_TMP_VAR: 589 588 case XCACHE_IS_CV: 590 DISPATCH(zend_uint, u.var)591 DISPATCH(zend_uint, u.EA.type)589 PROCESS(zend_uint, u.var) 590 PROCESS(zend_uint, u.EA.type) 592 591 break; 593 592 case IS_UNUSED: 594 IFDASM(` DISPATCH(zend_uint, u.var)')595 DISPATCH(zend_uint, u.opline_num)593 IFDASM(`PROCESS(zend_uint, u.var)') 594 PROCESS(zend_uint, u.opline_num) 596 595 #ifndef ZEND_ENGINE_2 597 DISPATCH(zend_uint, u.fetch_type)598 #endif 599 DISPATCH(zend_uint, u.EA.type)596 PROCESS(zend_uint, u.fetch_type) 597 #endif 598 PROCESS(zend_uint, u.EA.type) 600 599 break; 601 600 ') … … 611 610 #endif 612 611 DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{ 613 DISPATCH(zend_uchar, opcode)612 PROCESS(xc_opcode, opcode) 614 613 #ifdef ZEND_ENGINE_2_4 615 614 IFRESTORE(`', ` … … 628 627 STRUCT(znode, op2) 629 628 #endif 630 DISPATCH(ulong, extended_value)631 DISPATCH(uint, lineno)629 PROCESS(ulong, extended_value) 630 PROCESS(uint, lineno) 632 631 #ifdef ZEND_ENGINE_2_1 633 632 #ifdef ZEND_ENGINE_2_4 634 DISPATCH(zend_uchar, op1_type)635 DISPATCH(zend_uchar, op2_type)636 DISPATCH(zend_uchar, result_type)633 PROCESS(zend_uchar, op1_type) 634 PROCESS(zend_uchar, op2_type) 635 PROCESS(zend_uchar, result_type) 637 636 #endif 638 637 IFCOPY(` … … 674 673 } 675 674 ') 676 DISPATCH(opcode_handler_t, handler)675 PROCESS(opcode_handler_t, handler) 677 676 #endif 678 677 ') … … 681 680 DEF_STRUCT_P_FUNC(`zend_literal', , `dnl {{{ 682 681 STRUCT(zval, constant) 683 DISPATCH(zend_ulong, hash_value)684 DISPATCH(zend_uint, cache_slot)682 PROCESS(zend_ulong, hash_value) 683 PROCESS(zend_uint, cache_slot) 685 684 ') 686 685 dnl }}} … … 777 776 778 777 /* Common elements */ 779 DISPATCH(zend_uchar, type)778 PROCESS(zend_uchar, type) 780 779 PROC_ZSTRING(, function_name) 781 780 #ifdef ZEND_ENGINE_2 782 DISPATCH(zend_uint, fn_flags)781 PROCESS(zend_uint, fn_flags) 783 782 STRUCT_ARRAY(num_args, zend_arg_info, arg_info) 784 DISPATCH(zend_uint, num_args)785 DISPATCH(zend_uint, required_num_args)783 PROCESS(zend_uint, num_args) 784 PROCESS(zend_uint, required_num_args) 786 785 # ifndef ZEND_ENGINE_2_4 787 DISPATCH(zend_bool, pass_rest_by_reference)786 PROCESS(zend_bool, pass_rest_by_reference) 788 787 # endif 789 788 #else … … 808 807 #endif 809 808 #ifndef ZEND_ENGINE_2_4 810 DISPATCH(unsigned char, return_reference)809 PROCESS(unsigned char, return_reference) 811 810 #endif 812 811 /* END of common elements */ … … 822 821 dnl before copying opcodes 823 822 STRUCT_ARRAY(last_literal, zend_literal, literals) 824 DISPATCH(int, last_literal)823 PROCESS(int, last_literal) 825 824 #endif 826 825 … … 835 834 STRUCT_ARRAY(last, zend_op, opcodes) 836 835 popdef(`AFTER_ALLOC') 837 DISPATCH(zend_uint, last)836 PROCESS(zend_uint, last) 838 837 #ifndef ZEND_ENGINE_2_4 839 IFCOPY(`dst->size = src->last;DONE(size)', ` DISPATCH(zend_uint, size)')838 IFCOPY(`dst->size = src->last;DONE(size)', `PROCESS(zend_uint, size)') 840 839 #endif 841 840 842 841 #ifdef IS_CV 843 842 STRUCT_ARRAY(last_var, zend_compiled_variable, vars) 844 DISPATCH(int, last_var)843 PROCESS(int, last_var) 845 844 # ifndef ZEND_ENGINE_2_4 846 IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', ` DISPATCH(zend_uint, size_var)')845 IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `PROCESS(zend_uint, size_var)') 847 846 # endif 848 847 #else … … 853 852 #endif 854 853 855 DISPATCH(zend_uint, T)854 PROCESS(zend_uint, T) 856 855 857 856 STRUCT_ARRAY(last_brk_cont, zend_brk_cont_element, brk_cont_array) 858 DISPATCH(zend_uint, last_brk_cont)857 PROCESS(zend_uint, last_brk_cont) 859 858 #ifndef ZEND_ENGINE_2_4 860 DISPATCH(zend_uint, current_brk_cont)859 PROCESS(zend_uint, current_brk_cont) 861 860 #endif 862 861 #ifndef ZEND_ENGINE_2 863 DISPATCH(zend_bool, uses_globals)862 PROCESS(zend_bool, uses_globals) 864 863 #endif 865 864 866 865 #ifdef ZEND_ENGINE_2 867 866 STRUCT_ARRAY(last_try_catch, zend_try_catch_element, try_catch_array) 868 DISPATCH(int, last_try_catch)867 PROCESS(int, last_try_catch) 869 868 #endif 870 869 … … 873 872 #ifndef ZEND_ENGINE_2_4 874 873 COPY(start_op) 875 DISPATCH(int, backpatch_count)874 PROCESS(int, backpatch_count) 876 875 #endif 877 876 #ifdef ZEND_ENGINE_2_3 878 DISPATCH(zend_uint, this_var)877 PROCESS(zend_uint, this_var) 879 878 #endif 880 879 881 880 #ifndef ZEND_ENGINE_2_4 882 DISPATCH(zend_bool, done_pass_two)881 PROCESS(zend_bool, done_pass_two) 883 882 #endif 884 883 /* 5.0 <= ver < 5.3 */ 885 884 #if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_3) 886 DISPATCH(zend_bool, uses_this)885 PROCESS(zend_bool, uses_this) 887 886 #endif 888 887 … … 896 895 #endif 897 896 #ifdef ZEND_ENGINE_2 898 DISPATCH(zend_uint, line_start)899 DISPATCH(zend_uint, line_end)900 DISPATCH(int, doc_comment_len)897 PROCESS(zend_uint, line_start) 898 PROCESS(zend_uint, line_end) 899 PROCESS(int, doc_comment_len) 901 900 PROC_ZSTRING_L(, doc_comment, doc_comment_len) 902 901 #endif 903 902 #ifdef ZEND_COMPILE_DELAYED_BINDING 904 DISPATCH(zend_uint, early_binding);903 PROCESS(zend_uint, early_binding); 905 904 #endif 906 905 … … 908 907 DONE(reserved) 909 908 #if defined(HARDENING_PATCH) && HARDENING_PATCH 910 DISPATCH(zend_bool, created_by_eval)909 PROCESS(zend_bool, created_by_eval) 911 910 #endif 912 911 #ifdef ZEND_ENGINE_2_4 913 912 SETNULL(run_time_cache) 914 DISPATCH(int, last_cache_slot)913 PROCESS(int, last_cache_slot) 915 914 #endif 916 915 } while (0); … … 967 966 #ifdef HAVE_XCACHE_CONSTANT 968 967 DEF_STRUCT_P_FUNC(`xc_constinfo_t', , `dnl {{{ 969 DISPATCH(zend_uint, key_size)968 PROCESS(zend_uint, key_size) 970 969 #ifdef IS_UNICODE 971 DISPATCH(zend_uchar, type)970 PROCESS(zend_uchar, type) 972 971 #endif 973 972 IFRESTORE(`COPY(key)', ` 974 973 PROC_ZSTRING_N(type, key, key_size) 975 974 ') 976 DISPATCH(ulong, h)975 PROCESS(ulong, h) 977 976 STRUCT(zend_constant, constant) 978 977 ') … … 980 979 #endif 981 980 DEF_STRUCT_P_FUNC(`xc_op_array_info_detail_t', , `dnl {{{ 982 DISPATCH(zend_uint, index)983 DISPATCH(zend_uint, info)981 PROCESS(zend_uint, index) 982 PROCESS(zend_uint, info) 984 983 ') 985 984 dnl }}} 986 985 DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{ 987 986 #ifdef ZEND_ENGINE_2_4 988 DISPATCH(zend_uint, literalinfo_cnt)987 PROCESS(zend_uint, literalinfo_cnt) 989 988 STRUCT_ARRAY(literalinfo_cnt, xc_op_array_info_detail_t, literalinfos) 990 989 #else 991 DISPATCH(zend_uint, oplineinfo_cnt)990 PROCESS(zend_uint, oplineinfo_cnt) 992 991 STRUCT_ARRAY(oplineinfo_cnt, xc_op_array_info_detail_t, oplineinfos) 993 992 #endif … … 995 994 dnl }}} 996 995 DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{ 997 DISPATCH(zend_uint, key_size)996 PROCESS(zend_uint, key_size) 998 997 #ifdef IS_UNICODE 999 DISPATCH(zend_uchar, type)998 PROCESS(zend_uchar, type) 1000 999 #endif 1001 1000 IFRESTORE(`COPY(key)', ` 1002 1001 PROC_ZSTRING_N(type, key, key_size) 1003 1002 ') 1004 DISPATCH(ulong, h)1003 PROCESS(ulong, h) 1005 1004 IFRESTORE(`COPY(op_array_info)', ` 1006 1005 STRUCT(xc_op_array_info_t, op_array_info) … … 1014 1013 dnl }}} 1015 1014 DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{ 1016 DISPATCH(zend_uint, key_size)1015 PROCESS(zend_uint, key_size) 1017 1016 #ifdef IS_UNICODE 1018 DISPATCH(zend_uchar, type)1017 PROCESS(zend_uchar, type) 1019 1018 #endif 1020 1019 IFRESTORE(`COPY(key)', ` 1021 1020 PROC_ZSTRING_N(type, key, key_size) 1022 1021 ') 1023 DISPATCH(ulong, h)1024 DISPATCH(zend_uint, methodinfo_cnt)1022 PROCESS(ulong, h) 1023 PROCESS(zend_uint, methodinfo_cnt) 1025 1024 IFRESTORE(`COPY(methodinfos)', ` 1026 1025 STRUCT_ARRAY(methodinfo_cnt, xc_op_array_info_t, methodinfos) … … 1036 1035 #endif 1037 1036 #ifndef ZEND_COMPILE_DELAYED_BINDING 1038 DISPATCH(int, oplineno)1037 PROCESS(int, oplineno) 1039 1038 #endif 1040 1039 ') … … 1042 1041 #ifdef ZEND_ENGINE_2_1 1043 1042 DEF_STRUCT_P_FUNC(`xc_autoglobal_t', , `dnl {{{ 1044 DISPATCH(zend_uint, key_len)1043 PROCESS(zend_uint, key_len) 1045 1044 #ifdef IS_UNICODE 1046 DISPATCH(zend_uchar, type)1045 PROCESS(zend_uchar, type) 1047 1046 #endif 1048 1047 IFRESTORE(`COPY(key)', ` 1049 1048 PROC_ZSTRING_L(type, key, key_len) 1050 1049 ') 1051 DISPATCH(ulong, h)1050 PROCESS(ulong, h) 1052 1051 ') 1053 1052 dnl }}} … … 1055 1054 #ifdef E_STRICT 1056 1055 DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{ 1057 DISPATCH(int, type)1058 DISPATCH(uint, lineno)1059 DISPATCH(int, error_len)1056 PROCESS(int, type) 1057 PROCESS(uint, lineno) 1058 PROCESS(int, error_len) 1060 1059 PROC_STRING_L(error, error_len) 1061 1060 ') … … 1068 1067 ') 1069 1068 1070 DISPATCH(xc_hash_value_t, hvalue)1069 PROCESS(xc_hash_value_t, hvalue) 1071 1070 /* skip */ 1072 1071 DONE(next) 1073 1072 COPY(cache) 1074 DISPATCH(xc_md5sum_t, md5)1075 DISPATCH(zend_ulong, refcount)1076 1077 DISPATCH(size_t, sourcesize)1078 DISPATCH(zend_ulong, hits)1079 DISPATCH(size_t, size)1073 PROCESS(xc_md5sum_t, md5) 1074 PROCESS(zend_ulong, refcount) 1075 1076 PROCESS(size_t, sourcesize) 1077 PROCESS(zend_ulong, hits) 1078 PROCESS(size_t, size) 1080 1079 1081 1080 IFRESTORE(`COPY(op_array_info)', ` … … 1089 1088 1090 1089 #ifdef HAVE_XCACHE_CONSTANT 1091 DISPATCH(zend_uint, constinfo_cnt)1090 PROCESS(zend_uint, constinfo_cnt) 1092 1091 STRUCT_ARRAY(constinfo_cnt, xc_constinfo_t, constinfos) 1093 1092 #endif 1094 1093 1095 DISPATCH(zend_uint, funcinfo_cnt)1094 PROCESS(zend_uint, funcinfo_cnt) 1096 1095 STRUCT_ARRAY(funcinfo_cnt, xc_funcinfo_t, funcinfos) 1097 1096 1098 DISPATCH(zend_uint, classinfo_cnt)1097 PROCESS(zend_uint, classinfo_cnt) 1099 1098 STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos, , IFRESTORE(`processor->active_class_index')) 1100 1099 #ifdef ZEND_ENGINE_2_1 1101 DISPATCH(zend_uint, autoglobal_cnt)1100 PROCESS(zend_uint, autoglobal_cnt) 1102 1101 IFRESTORE(` 1103 1102 COPY(autoglobals) … … 1107 1106 #endif 1108 1107 #ifdef E_STRICT 1109 DISPATCH(zend_uint, compilererror_cnt)1108 PROCESS(zend_uint, compilererror_cnt) 1110 1109 IFRESTORE(` 1111 1110 COPY(compilererrors) … … 1115 1114 #endif 1116 1115 #ifndef ZEND_COMPILE_DELAYED_BINDING 1117 DISPATCH(zend_bool, have_early_binding)1118 #endif 1119 DISPATCH(zend_bool, have_references)1116 PROCESS(zend_bool, have_early_binding) 1117 #endif 1118 PROCESS(zend_bool, have_references) 1120 1119 ') 1121 1120 dnl }}} … … 1123 1122 IFDPRINT(`INDENT()`'fprintf(stderr, "zval:value");') 1124 1123 STRUCT_P_EX(zval_ptr, dst->value, src->value, `value', `', `&') 1125 DISPATCH(zend_bool, have_references)1124 PROCESS(zend_bool, have_references) 1126 1125 DONE(value) 1127 1126 ') 1128 1127 dnl }}} 1129 1128 DEF_STRUCT_P_FUNC(`xc_entry_t', , `dnl {{{ 1130 DISPATCH(xc_entry_type_t, type)1131 DISPATCH(size_t, size)1132 1133 DISPATCH(xc_hash_value_t, hvalue)1129 PROCESS(xc_entry_type_t, type) 1130 PROCESS(size_t, size) 1131 1132 PROCESS(xc_hash_value_t, hvalue) 1134 1133 COPY(cache) 1135 1134 /* skip */ 1136 1135 DONE(next) 1137 1136 1138 IFSTORE(`dst->refcount = 0; DONE(refcount)', ` DISPATCH(long, refcount)')1139 1140 DISPATCH(time_t, ctime)1141 DISPATCH(time_t, atime)1142 DISPATCH(time_t, dtime)1143 DISPATCH(long, ttl)1144 DISPATCH(zend_ulong, hits)1137 IFSTORE(`dst->refcount = 0; DONE(refcount)', `PROCESS(long, refcount)') 1138 1139 PROCESS(time_t, ctime) 1140 PROCESS(time_t, atime) 1141 PROCESS(time_t, dtime) 1142 PROCESS(long, ttl) 1143 PROCESS(zend_ulong, hits) 1145 1144 #ifdef IS_UNICODE 1146 DISPATCH(zend_uchar, name_type)1145 PROCESS(zend_uchar, name_type) 1147 1146 #endif 1148 1147 dnl {{{ name … … 1150 1149 #ifdef IS_UNICODE 1151 1150 if (src->name_type == IS_UNICODE) { 1152 DISPATCH(int32_t, name.ustr.len)1151 PROCESS(int32_t, name.ustr.len) 1153 1152 } 1154 1153 else { 1155 DISPATCH(int, name.str.len)1154 PROCESS(int, name.str.len) 1156 1155 } 1157 1156 #else 1158 DISPATCH(int, name.str.len)1157 PROCESS(int, name.str.len) 1159 1158 #endif 1160 1159 IFRESTORE(`COPY(name.str.val)', ` … … 1186 1185 DONE(data) 1187 1186 dnl }}} 1188 DISPATCH(time_t, mtime)1187 PROCESS(time_t, mtime) 1189 1188 #ifdef HAVE_INODE 1190 DISPATCH(int, device)1191 DISPATCH(int, inode)1189 PROCESS(int, device) 1190 PROCESS(int, inode) 1192 1191 #endif 1193 1192 1194 1193 if (src->type == XC_TYPE_PHP) { 1195 DISPATCH(int, filepath_len)1194 PROCESS(int, filepath_len) 1196 1195 IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)') 1197 DISPATCH(int, dirpath_len)1196 PROCESS(int, dirpath_len) 1198 1197 IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)') 1199 1198 #ifdef IS_UNICODE 1200 DISPATCH(int, ufilepath_len)1199 PROCESS(int, ufilepath_len) 1201 1200 IFRESTORE(`COPY(ufilepath)', `PROC_USTRING_L(ufilepath, ufilepath_len)') 1202 DISPATCH(int, udirpath_len)1201 PROCESS(int, udirpath_len) 1203 1202 IFRESTORE(`COPY(udirpath)', `PROC_USTRING_L(udirpath, udirpath_len)') 1204 1203 #endif -
trunk/processor/string.m4
r828 r843 87 87 dnl }}} 88 88 dnl PROC_STRING_N(1:name, 2:size, 3:type) 89 define(`PROC_STRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(` dst->$1', `src->$1', `src->$2', `$1', `char')')90 define(`PROC_USTRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(` dst->$1', `src->$1', `src->$2', `$1', `UChar')')89 define(`PROC_STRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `SRC(`$2')', `$1', `char')') 90 define(`PROC_USTRING_N', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `SRC(`$2')', `$1', `UChar')') 91 91 92 92 define(`PROC_STRING_L', `DBG(`$0($*)') PROC_STRING_N(`$1', `$2 + 1')') 93 93 define(`PROC_USTRING_L', `DBG(`$0($*)') PROC_USTRING_N(`$1', `$2 + 1')') 94 define(`PROC_STRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(` dst->$1', `src->$1', `strlen(src->$1) + 1', `$1', `char')')95 define(`PROC_USTRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(` dst->$1', `src->$1', `strlen(src->$1) + 1', `$1', `UChar')')94 define(`PROC_STRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `strlen(SRC(`$1')) + 1', `$1', `char')') 95 define(`PROC_USTRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`DST(`$1')', `SRC(`$1')', `strlen(SRC(`$1')) + 1', `$1', `UChar')') 96 96 97 97 dnl {{{ PROC_ZSTRING_N(1:type, 2:name, 3:size, 4:size_type) … … 100 100 #ifdef IS_UNICODE 101 101 pushdef(`NSIZE', ifelse( 102 `$4', `strlen', `UNI_STRLEN ( src->$2) + 1',103 `$4', `len', ` src->$3+ 1',104 `', `', ` src->$3',102 `$4', `strlen', `UNI_STRLEN (SRC(`$2')) + 1', 103 `$4', `len', `SRC(`$3') + 1', 104 `', `', `SRC(`$3')', 105 105 )) 106 106 DONE(`$2') 107 ifelse(`$1', `1', `PROC_STRING_N_EX(` dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_uchar')107 ifelse(`$1', `1', `PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', defn(`NSIZE'), `$2', `zstr_uchar') 108 108 ', ` 109 if (ifelse(`$1', `', `UG(unicode)', ` src->$1== IS_UNICODE')) {110 PROC_STRING_N_EX(` dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_uchar')109 if (ifelse(`$1', `', `UG(unicode)', `SRC(`$1') == IS_UNICODE')) { 110 PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', defn(`NSIZE'), `$2', `zstr_uchar') 111 111 } 112 112 else { 113 PROC_STRING_N_EX(` dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_char')113 PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', defn(`NSIZE'), `$2', `zstr_char') 114 114 } 115 115 ') 116 116 #else 117 117 DONE(`$2') 118 PROC_STRING_N_EX(` dst->$2', `src->$2', NSIZE, `$2', `zstr_char')118 PROC_STRING_N_EX(`DST(`$2')', `SRC(`$2')', NSIZE, `$2', `zstr_char') 119 119 #endif 120 120 popdef(`NSIZE') -
trunk/processor/struct.m4
r835 r843 128 128 DBG(`$0($*)') 129 129 pushdefFUNC_NAME(`$1', `$5') 130 ifdef(`DEFINED_'ifelse(`$5', `', `$1', `$5'), `', `m4_errprint(` Unknown struct "'ifelse(`$5', `', `$1', `$5')`"')')130 ifdef(`DEFINED_'ifelse(`$5', `', `$1', `$5'), `', `m4_errprint(`AUTOCHECK ERROR: Unknown struct "'ifelse(`$5', `', `$1', `$5')`"')define(`EXIT_PENDING', 1)') 131 131 assert(sizeof($1) == sizeof(($6 $3)[0])); 132 132 ifelse(`$6', `', `ALLOC(`$2', `$1')') … … 156 156 define(`STRUCT_P', ` 157 157 DBG(`$0($*)') 158 if ( src->$2) {158 if (SRC(`$2')) { 159 159 IFDPRINT(`INDENT()`'fprintf(stderr, "$1:$2 ");') 160 STRUCT_P_EX(`$1', `dst->$2', ` src->$2', `$2', `$3')160 STRUCT_P_EX(`$1', `dst->$2', `SRC(`$2')', `$2', `$3') 161 161 } 162 162 else { … … 170 170 define(`STRUCT', ` 171 171 DBG(`$0($*)') 172 assert(sizeof($1) == sizeof( src->$2));172 assert(sizeof($1) == sizeof(SRC(`$2'))); 173 173 IFDPRINT(`INDENT()`'fprintf(stderr, "$1:$2 ");') 174 STRUCT_P_EX(`$1', `dst->$2', ` src->$2', `$2', `$3', `&')174 STRUCT_P_EX(`$1', `dst->$2', `SRC(`$2')', `$2', `$3', `&') 175 175 DONE(`$2') 176 176 ') … … 178 178 dnl {{{ STRUCT_ARRAY(1:count, 2:type, 3:elm, 4:name=type, 5:loopcounter) 179 179 define(`STRUCT_ARRAY', ` 180 if ( src->$3) {180 if (SRC(`$3')) { 181 181 ifelse( 182 182 `$5', `', `int i; pushdef(`LOOPCOUNTER', `i')', … … 188 188 array_init(arr); 189 189 190 LOOPCOUNTER = 0; 191 while ( 192 ifelse(`$1', `', `src->$3[LOOPCOUNTER]', 193 `', `', `LOOPCOUNTER < src->$1') 194 ) { 190 for (LOOPCOUNTER = 0; 191 ifelse(`$1', `', `SRC(`$3[LOOPCOUNTER]')', 192 `', `', `LOOPCOUNTER < SRC(`$1')'); 193 ++LOOPCOUNTER) { 195 194 zval *zv; 196 195 197 196 ALLOC_INIT_ZVAL(zv); 198 197 array_init(zv); 199 FUNC_NAME (zv, &( src->$3[LOOPCOUNTER]) TSRMLS_CC);198 FUNC_NAME (zv, &(SRC(`$3[LOOPCOUNTER]')) TSRMLS_CC); 200 199 add_next_index_zval(arr, zv); 201 202 ++LOOPCOUNTER;203 200 } 204 201 add_assoc_zval_ex(dst, ZEND_STRS("$3"), arr); … … 206 203 dnl find count with NULL 207 204 ifelse(`$1', `', ` 208 int count;209 for (count = 0; src->$3[count]; ++count) {210 /* just count */205 size_t count = 0; 206 while (SRC(`$3[count]')) { 207 ++count; 211 208 } 212 209 ++count; 213 pushdef(` STRUCT_COUNT', `count')210 pushdef(`ARRAY_ELEMENT_COUNT', `count') 214 211 ', 215 `', `', `pushdef(`STRUCT_COUNT', `src->$1')') 216 ALLOC(`dst->$3', `$2', `STRUCT_COUNT') 212 `', `', `pushdef(`ARRAY_ELEMENT_COUNT', `SRC(`$1')')') 213 ALLOC(`dst->$3', `$2', `ARRAY_ELEMENT_COUNT') 214 popdef(`ARRAY_ELEMENT_COUNT') 215 217 216 ifdef(`AFTER_ALLOC', AFTER_ALLOC) 218 217 219 LOOPCOUNTER = 0; 220 while ( 221 ifelse(`$1', `', `src->$3[LOOPCOUNTER]', 222 `', `', `LOOPCOUNTER < src->$1') 223 ) { 218 for (LOOPCOUNTER = 0; 219 ifelse(`$1', `', `SRC(`$3[LOOPCOUNTER]')', 220 `', `', `LOOPCOUNTER < SRC(`$1')'); 221 ++LOOPCOUNTER) { 224 222 DISABLECHECK(` 225 223 STRUCT(`$2', `$3[LOOPCOUNTER]', `$4') 226 224 ') 227 228 ++LOOPCOUNTER;229 225 } 230 dnl tailing NULL 231 ifelse(`$1', `', `IFCOPY(`dst->$3[LOOPCOUNTER] = NULL;')') 232 popdef(`STRUCT_COUNT') 226 dnl the end marker 227 ifelse(`$1', `', `IFCOPY(`DST(`$3[LOOPCOUNTER]') = NULL;')') 233 228 ')dnl IFDASM 234 229 DONE(`$3')

