--- parser3/src/classes/hash.C 2016/07/20 13:57:04 1.130 +++ parser3/src/classes/hash.C 2016/10/26 15:44:49 1.136 @@ -17,7 +17,7 @@ #include "pa_vbool.h" #include "pa_vmethod_frame.h" -volatile const char * IDENT_HASH_C="$Id: hash.C,v 1.130 2016/07/20 13:57:04 moko Exp $"; +volatile const char * IDENT_HASH_C="$Id: hash.C,v 1.136 2016/10/26 15:44:49 moko Exp $"; // class @@ -309,19 +309,19 @@ static void _sql(Request& r, MethodParam } if(Value* vlimit=options->get(sql_limit_name)) { valid_options++; - limit=(ulong)r.process_to_value(*vlimit).as_double(); + limit=(ulong)r.process(*vlimit).as_double(); } if(Value* voffset=options->get(sql_offset_name)) { valid_options++; - offset=(ulong)r.process_to_value(*voffset).as_double(); + offset=(ulong)r.process(*voffset).as_double(); } if(Value* vdistinct=options->get(sql_distinct_name)) { valid_options++; - distinct=r.process_to_value(*vdistinct).as_bool(); + distinct=r.process(*vdistinct).as_bool(); } if(Value* vvalue_type=options->get(sql_value_type_name)) { valid_options++; - value_type=get_value_type(r.process_to_value(*vvalue_type)); + value_type=get_value_type(r.process(*vvalue_type)); } if(valid_options!=options->count()) throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); @@ -332,9 +332,8 @@ static void _sql(Request& r, MethodParam if(bind) placeholders_count=marshal_binds(*bind, placeholders); - Temp_lang temp_lang(r, String::L_SQL); const String& statement_string=r.process_to_string(statement); - const char* statement_cstr=statement_string.untaint_cstr(r.flang, r.connection()); + const char* statement_cstr=statement_string.untaint_cstr(String::L_SQL, r.connection()); HashStringValue& hash=GET_SELF(r, VHashBase).hash(); hash.clear(); @@ -400,7 +399,7 @@ static void _foreach(Request& r, MethodP const String* key_var_name=¶ms.as_string(0, "key-var name must be string"); const String* value_var_name=¶ms.as_string(1, "value-var name must be string"); Value* body_code=¶ms.as_junction(2, "body must be code"); - Value* delim_maybe_code=params.count()>3?params.get(3):0; + Value* delim_maybe_code=params.count()>3?¶ms[3]:0; Value& caller=*r.get_method_frame()->caller(); if(key_var_name->is_empty()) key_var_name=0; @@ -419,7 +418,7 @@ static void _foreach(Request& r, MethodP if(value_var_name) r.put_element(caller, *value_var_name, i.value()); - StringOrValue sv_processed=r.process(*body_code); + Value& sv_processed=r.process(*body_code); Request::Skip lskip=r.get_skip(); r.set_skip(Request::SKIP_NOTHING); const String* s_processed=sv_processed.get_string(); @@ -517,7 +516,7 @@ static void _sort(Request& r, MethodPara if(value_var) r.put_element(*context, *value_var, i.value()); - Value& value=r.process_to_value(key_maker); + Value& value=r.process(key_maker); if(pos==0) // determining key values type by first one key_values_are_strings=value.is_string(); @@ -532,7 +531,7 @@ static void _sort(Request& r, MethodPara if(r.charsets.source().NAME()=="KOI8-R" && key_values_are_strings) for(pos=0; pos 1) { const String& stype=params.as_string(1, "type must be string"); @@ -570,7 +569,7 @@ static void _at(Request& r, MethodParams throw Exception(PARSER_RUNTIME, &stype, "type must be 'key', 'value' or 'hash'"); } - Value& vwhence=*params.get(0); + Value& vwhence=params[0]; if(vwhence.is_string()) { const String& swhence=*vwhence.get_string(); if(swhence == "last") @@ -580,7 +579,7 @@ static void _at(Request& r, MethodParams &swhence, "whence must be 'first', 'last' or expression"); } else { - pos=r.process_to_value(vwhence).as_int(); + pos=r.process(vwhence).as_int(); if(pos < 0) pos+=count; } @@ -591,15 +590,15 @@ static void _at(Request& r, MethodParams { #ifdef HASH_ORDER if(pos == 0) { - r.write_assign_lang(*new VString(*new String(hash.first_key(), String::L_TAINTED))); + r.write_pass_lang(*new VString(*new String(hash.first_key(), String::L_TAINTED))); } else if((size_t)pos == count-1) { - r.write_assign_lang(*new VString(*new String(hash.last_key(), String::L_TAINTED))); + r.write_pass_lang(*new VString(*new String(hash.last_key(), String::L_TAINTED))); } else #endif { for(HashStringValue::Iterator i(hash); i; i.next(), pos-- ) if(!pos){ - r.write_assign_lang(*new VString(*new String(i.key(), String::L_TAINTED))); + r.write_pass_lang(*new VString(*new String(i.key(), String::L_TAINTED))); break; } } @@ -609,15 +608,15 @@ static void _at(Request& r, MethodParams { #ifdef HASH_ORDER if(pos == 0) { - r.write_assign_lang(*hash.first_value()); + r.write_pass_lang(*hash.first_value()); } else if((size_t)pos == count-1) { - r.write_assign_lang(*hash.last_value()); + r.write_pass_lang(*hash.last_value()); } else #endif { for(HashStringValue::Iterator i(hash); i; i.next(), pos-- ) if(!pos){ - r.write_assign_lang(*i.value()); + r.write_pass_lang(*i.value()); break; } }