--- parser3/src/classes/table.C 2008/04/07 15:14:32 1.240 +++ parser3/src/classes/table.C 2008/05/14 10:19:04 1.242 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_TABLE_C="$Date: 2008/04/07 15:14:32 $"; +static const char * const IDENT_TABLE_C="$Date: 2008/05/14 10:19:04 $"; #ifndef NO_STRINGSTREAM #include @@ -389,6 +389,8 @@ static void _load(Request& r, MethodPara GET_SELF(r, VTable).set_table(table); } +#ifdef NO_STRINGSTREAM + void maybe_enclose( String& to, const String& from, char encloser, const String* sencloser ) { if(encloser) { to<<*sencloser; @@ -409,6 +411,8 @@ void maybe_enclose( String& to, const St to<count()) - throw Exception(PARSER_RUNTIME, - 0, - "invalid option passed"); - } else { - throw Exception(PARSER_RUNTIME, - 0, - "additional params must be hash (did you spell mode parameter correctly?)"); - } - } - } - if(param_index i(*table.columns()); i.has_next(); ) { - maybe_enclose( sdata, *i.next(), separators.encloser, separators.sencloser ); - if(i.has_next()) - sdata<<*separators.scolumn; - } - } else { // nameless table [we were asked to output column names] - if(int lsize=table.count()?table[0]->count():0) - for(int column=0; column i(table); - while(i.has_next()) { - for(Array_iterator c(*i.next()); c.has_next(); ) { - maybe_enclose( sdata, *c.next(), separators.encloser, separators.sencloser ); - if(c.has_next()) - sdata<<*separators.scolumn; - } - sdata.append_know_length("\n", 1, String::L_CLEAN); - } - - // write - { - const char* data_cstr=sdata.cstr(); - file_write(r.absolute(file_name), - data_cstr, sdata.length(), true, do_append); - if(*data_cstr) // not empty (when empty it's not heap memory) - pa_free((void*)data_cstr); // not needed anymore - } #endif } @@ -703,12 +623,15 @@ static void _menu(Request& r, MethodPara StringOrValue 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(); if(delim_maybe_code && s_processed && s_processed->length()) { // delimiter set and we have body if(need_delim) // need delim & iteration produced string? r.write_pass_lang(r.process(*delim_maybe_code)); - need_delim=true; + else + need_delim=true; } + r.write_pass_lang(sv_processed); if(lskip==Request::SKIP_BREAK)