|
|
| version 1.329, 2016/09/21 00:44:50 | version 1.334, 2016/09/29 18:49:43 |
|---|---|
| Line 160 public: | Line 160 public: |
| String *extract(char *pos){ | String *extract(char *pos){ |
| String *result=new String; | String *result=new String; |
| // first: their langs | if(size_t len=strlen(pos)){ |
| result->langs.append(result->body, langs, pos-base, strlen(pos)); | // first: their langs |
| // next: letters themselves | result->langs.append(result->body, langs, pos-base, len); |
| result->body=Body(pos); | // next: letters themselves |
| result->body=Body(pos); | |
| } | |
| return result; | return result; |
| } | } |
| }; | }; |
| Line 201 static lsplit_sresult lsplit(char** stri | Line 203 static lsplit_sresult lsplit(char** stri |
| *(pos++)=0; | *(pos++)=0; |
| result.append(helper.extract(*string_ref)); | result.append(helper.extract(*string_ref)); |
| if(*pos==encloser && helper.check_lang(pos)){ // double-encloser stands for encloser | if(*pos==encloser && helper.check_lang(pos)){ // double-encloser stands for encloser |
| *string_ref=++pos; | *string_ref=pos; |
| } else { | } else { |
| *string_ref=pos; | *string_ref=pos; |
| break; | break; |
| } | } |
| } | } |
| pos++; | |
| } else { | } else { |
| result.append(helper.extract(*string_ref)); | result.append(helper.extract(*string_ref)); |
| *string_ref=0; | *string_ref=0; |
| Line 778 static void _menu(Request& r, MethodPara | Line 781 static void _menu(Request& r, MethodPara |
| for(size_t row=0; row<table.count(); row++) { | for(size_t row=0; row<table.count(); row++) { |
| table.set_current(row); | table.set_current(row); |
| 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); | Request::Skip lskip=r.get_skip(); r.set_skip(Request::SKIP_NOTHING); |
| const String* s_processed=sv_processed.get_string(); | const String* s_processed=sv_processed.get_string(); |
| Line 826 static void table_row_to_hash(Table::ele | Line 829 static void table_row_to_hash(Table::ele |
| const String* key; | const String* key; |
| if(info->key_code) { | if(info->key_code) { |
| info->table->set_current(info->row++); // change context row | info->table->set_current(info->row++); // change context row |
| StringOrValue sv_processed=info->r->process(*info->key_code); | Value& sv_processed=info->r->process(*info->key_code); |
| key=&sv_processed.as_string(); | key=&sv_processed.as_string(); |
| } else { | } else { |
| key=info->key_field<row->count()?row->get(info->key_field):0; | key=info->key_field<row->count()?row->get(info->key_field):0; |
| Line 881 static void table_row_to_hash(Table::ele | Line 884 static void table_row_to_hash(Table::ele |
| case C_CODE: { | case C_CODE: { |
| if(!info->key_code) | if(!info->key_code) |
| info->table->set_current(info->row++); // change context row | info->table->set_current(info->row++); // change context row |
| exist=info->hash->put_dont_replace(*key, &info->r->process(*info->value_code).as_value()); | exist=info->hash->put_dont_replace(*key, &info->r->process(*info->value_code)); |
| break; | break; |
| } | } |
| } | } |
| Line 1073 static void _sort(Request& r, MethodPara | Line 1076 static void _sort(Request& r, MethodPara |
| if(r.charsets.source().NAME()=="KOI8-R" && key_values_are_strings) { | if(r.charsets.source().NAME()=="KOI8-R" && key_values_are_strings) { |
| for(i=0; i<old_count; i++) | for(i=0; i<old_count; i++) |
| if(*seq[i].value.c_str) | if(*seq[i].value.c_str) |
| seq[i].value.c_str=Charset::transcode(seq[i].value.c_str, r.charsets.source(), UTF8_charset).cstr(); | seq[i].value.c_str=Charset::transcode(seq[i].value.c_str, r.charsets.source(), pa_UTF8_charset).cstr(); |
| } | } |
| // sort keys | // sort keys |
| Line 1146 static void _flip(Request& r, MethodPara | Line 1149 static void _flip(Request& r, MethodPara |
| static void _foreach(Request& r, MethodParams& params) { | static void _foreach(Request& r, MethodParams& params) { |
| InCycle temp(r); | InCycle temp(r); |
| const String& rownum_name=params.as_string(0, "rownum-var name must be string"); | const String* rownum_var_name=¶ms.as_string(0, "rownum-var name must be string"); |
| const String& value_name=params.as_string(1, "value-var name must be string"); | const String* value_var_name=¶ms.as_string(1, "value-var name must be string"); |
| Value& body_code=params.as_junction(2, "body must be code"); | Value& body_code=params.as_junction(2, "body must be code"); |
| Line 1156 static void _foreach(Request& r, MethodP | Line 1159 static void _foreach(Request& r, MethodP |
| Table& table=GET_SELF(r, VTable).table(); | Table& table=GET_SELF(r, VTable).table(); |
| size_t saved_current=table.current(); | size_t saved_current=table.current(); |
| const String* rownum_var_name=rownum_name.is_empty()? 0 : &rownum_name; | rownum_var_name=rownum_var_name->is_empty()? 0 : rownum_var_name; |
| const String* value_var_name=value_name.is_empty()? 0 : &value_name; | value_var_name=value_var_name->is_empty()? 0 : value_var_name; |
| Value* var_context=r.get_method_frame()->caller(); | Value* var_context=r.get_method_frame()->caller(); |
| Line 1171 static void _foreach(Request& r, MethodP | Line 1174 static void _foreach(Request& r, MethodP |
| if(value_var_name) | if(value_var_name) |
| r.put_element(*var_context, *value_var_name, new VTable(&table)); | r.put_element(*var_context, *value_var_name, new VTable(&table)); |
| 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); | Request::Skip lskip=r.get_skip(); r.set_skip(Request::SKIP_NOTHING); |
| const String* s_processed=sv_processed.get_string(); | const String* s_processed=sv_processed.get_string(); |