|
|
| version 1.89, 2009/04/16 01:10:21 | version 1.90, 2009/05/04 09:26:19 |
|---|---|
| Line 428 struct Foreach_info { | Line 428 struct Foreach_info { |
| bool need_delim; | bool need_delim; |
| }; | }; |
| #endif | #endif |
| static bool one_foreach_cycle( | static bool one_foreach_cycle( |
| HashStringValue::key_type akey, | HashStringValue::key_type akey, |
| HashStringValue::value_type avalue, | HashStringValue::value_type avalue, |
| Foreach_info *info) { | Foreach_info *info) { |
| Value& var_context=*info->var_context; | Value& var_context=*info->var_context; |
| if(info->key_var_name){ | if(info->key_var_name){ |
| info->vkey->set_string(*new String(akey, String::L_TAINTED)); | info->vkey->set_string(*new String(akey, String::L_TAINTED)); |
| Line 440 static bool one_foreach_cycle( | Line 440 static bool one_foreach_cycle( |
| if(info->value_var_name) | if(info->value_var_name) |
| var_context.put_element(var_context, *info->value_var_name, avalue, false); | var_context.put_element(var_context, *info->value_var_name, avalue, false); |
| StringOrValue sv_processed=info->r->process(*info->body_code); | if(info->delim_maybe_code){ |
| Request::Skip lskip=info->r->get_skip(); info->r->set_skip(Request::SKIP_NOTHING); | StringOrValue sv_processed=info->r->process(*info->body_code); |
| Request::Skip lskip=info->r->get_skip(); info->r->set_skip(Request::SKIP_NOTHING); | |
| const String* s_processed=sv_processed.get_string(); | const String* s_processed=sv_processed.get_string(); |
| if(info->delim_maybe_code && s_processed && s_processed->length()) { // delimiter set and we have body | if(s_processed && s_processed->length()) { // delimiter set and we have body |
| if(info->need_delim) // need delim & iteration produced string? | if(info->need_delim) // need delim & iteration produced string? |
| info->r->write_pass_lang(info->r->process(*info->delim_maybe_code)); | info->r->write_pass_lang(info->r->process(*info->delim_maybe_code)); |
| else | else |
| info->need_delim=true; | info->need_delim=true; |
| } | |
| info->r->write_pass_lang(sv_processed); | |
| return lskip==Request::SKIP_BREAK; | |
| } else { | |
| info->r->process_write(*info->body_code); | |
| Request::Skip lskip=info->r->get_skip(); info->r->set_skip(Request::SKIP_NOTHING); | |
| return lskip==Request::SKIP_BREAK; | |
| } | } |
| info->r->write_pass_lang(sv_processed); | |
| return lskip==Request::SKIP_BREAK; | |
| } | } |
| static void _foreach(Request& r, MethodParams& params) { | static void _foreach(Request& r, MethodParams& params) { |
| Temp_hash_value<const String::Body, void*> | Temp_hash_value<const String::Body, void*> |