--- parser3/src/classes/hash.C 2007/09/17 15:14:31 1.81 +++ parser3/src/classes/hash.C 2008/05/14 10:19:04 1.83 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_HASH_C="$Date: 2007/09/17 15:14:31 $"; +static const char * const IDENT_HASH_C="$Date: 2008/05/14 10:19:04 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -328,9 +328,9 @@ static void _delete(Request& r, MethodPa GET_SELF(r, VHash).hash().remove(params.as_string(0, "key must be string")); } -static void _contain(Request& r, MethodParams& params) { +static void _contains(Request& r, MethodParams& params) { - bool result = GET_SELF(r, VHash).hash().contain(params.as_string(0, "key must be string")); + bool result = GET_SELF(r, VHash).hash().contains(params.as_string(0, "key must be string")); r.write_no_lang(*new VBool(result)); } @@ -357,12 +357,15 @@ static bool one_foreach_cycle( 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(); if(info->delim_maybe_code && s_processed && s_processed->length()) { // delimiter set and we have body if(info->need_delim) // need delim & iteration produced string? info->r->write_pass_lang(info->r->process(*info->delim_maybe_code)); - info->need_delim=true; + else + info->need_delim=true; } + info->r->write_pass_lang(sv_processed); return lskip==Request::SKIP_BREAK; @@ -407,8 +410,10 @@ MHash::MHash(): Methoded("hash") // ^a.delete[key] add_native_method("delete", Method::CT_DYNAMIC, _delete, 1, 1); - // ^a.contain[key] - add_native_method("contain", Method::CT_DYNAMIC, _contain, 1, 1); + // ^a.contains[key] + add_native_method("contains", Method::CT_DYNAMIC, _contains, 1, 1); + // backward + add_native_method("contain", Method::CT_DYNAMIC, _contains, 1, 1); // ^hash::sql[query][options hash] add_native_method("sql", Method::CT_DYNAMIC, _sql, 1, 2);