|
|
| version 1.60, 2001/07/09 16:13:17 | version 1.61, 2001/07/11 16:32:13 |
|---|---|
| Line 112 static void _lsplit(Request& r, const St | Line 112 static void _lsplit(Request& r, const St |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| const String& string=*static_cast<VString *>(r.self)->get_string(); | const String& string=*static_cast<VString *>(r.self)->get_string(); |
| Array& row=*new(pool) Array(pool); | Array pieces(pool); |
| split_list(r, method_name, params, string, row); | split_list(r, method_name, params, string, pieces); |
| Table& table=*new(pool) Table(pool, &string, | Array& columns=*new(pool) Array(pool); |
| 0/*nameless*/, 1/*row preallocate(and only)*/); | columns+=new(pool) String(pool, "piece"); |
| table+=&row; | |
| Table& table=*new(pool) Table(pool, &string, | |
| &columns, pieces.size()); | |
| int size=pieces.quick_size(); | |
| for(int i=0; i<size; i++) { | |
| Array& row=*new(pool) Array(pool); | |
| row+=pieces.quick_get(i); | |
| table+=&row; | |
| } | |
| r.write_no_lang(*new(pool) VTable(pool, &table)); | r.write_no_lang(*new(pool) VTable(pool, &table)); |
| } | } |
| Line 126 static void _rsplit(Request& r, const St | Line 133 static void _rsplit(Request& r, const St |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| const String& string=*static_cast<VString *>(r.self)->get_string(); | const String& string=*static_cast<VString *>(r.self)->get_string(); |
| Array list(pool); | Array pieces(pool); |
| split_list(r, method_name, params, string, list); | split_list(r, method_name, params, string, pieces); |
| Array& row=*new(pool) Array(pool); | Array& columns=*new(pool) Array(pool); |
| for(int i=list.size(); --i>=0; ) | columns+=new(pool) String(pool, "piece"); |
| row+=list.get(i); | |
| Table& table=*new(pool) Table(pool, &string, | Table& table=*new(pool) Table(pool, &string, |
| 0/*nameless*/, 1/*row preallocate(and only)*/); | &columns, pieces.size()); |
| table+=&row; | for(int i=pieces.size(); --i>=0; ) { |
| Array& row=*new(pool) Array(pool); | |
| row+=pieces.get(i); | |
| table+=&row; | |
| } | |
| r.write_no_lang(*new(pool) VTable(pool, &table)); | r.write_no_lang(*new(pool) VTable(pool, &table)); |
| } | } |