|
|
| version 1.103, 2002/04/18 10:51:00 | version 1.104, 2002/04/19 08:28:35 |
|---|---|
| Line 172 static void _rsplit(Request& r, const St | Line 172 static void _rsplit(Request& r, const St |
| r.write_no_lang(*new(pool) VTable(pool, &table)); | r.write_no_lang(*new(pool) VTable(pool, &table)); |
| } | } |
| static void search_action(Table& table, Array *row, int, int, void *) { | static void search_action(Table& table, Array *row, int, int, int, int, void *) { |
| if(row) | if(row) |
| table+=row; | table+=row; |
| } | } |
| Line 182 struct Replace_action_info { | Line 182 struct Replace_action_info { |
| Request *request; const String *origin; | Request *request; const String *origin; |
| const String *src; String *dest; | const String *src; String *dest; |
| Value *replacement_code; | Value *replacement_code; |
| const String *post_match; | |
| }; | }; |
| #endif | #endif |
| static void replace_action(Table& table, Array *row, int start, int finish, | static void replace_action(Table& table, Array *row, |
| void *info) { | int prestart, int prefinish, |
| int poststart, int postfinish, | |
| void *info) { | |
| Replace_action_info& ai=*static_cast<Replace_action_info *>(info); | Replace_action_info& ai=*static_cast<Replace_action_info *>(info); |
| if(row) { // begin&middle | if(row) { // begin&middle |
| // piece from last match['start'] to beginning of this match['finish'] | // piece from last match['prestart'] to beginning of this match['prefinish'] |
| if(start!=finish) | if(prestart!=prefinish) |
| *ai.dest << ai.src->mid(start, finish);//ai.dest->APPEND_CONST("-"); | *ai.dest << ai.src->mid(prestart, prefinish);//ai.dest->APPEND_CONST("-"); |
| // store found parts in one-record VTable | // store found parts in one-record VTable |
| if(table.size()) // middle | if(table.size()) // middle |
| table.put(0, row); | table.put(0, row); |
| Line 213 static void replace_action(Table& table, | Line 214 static void replace_action(Table& table, |
| */ | */ |
| *ai.dest << replaced; | *ai.dest << replaced; |
| } | } |
| ai.post_match=(String *)row->get(2/*post_match*/); | |
| } else // end | } else // end |
| *ai.dest << *ai.post_match; | *ai.dest << ai.src->mid(poststart, postfinish); |
| } | } |
| /// @todo use pcre:study somehow | /// @todo use pcre:study somehow |
| Line 254 static void _match(Request& r, const Str | Line 254 static void _match(Request& r, const Str |
| Replace_action_info replace_action_info={ | Replace_action_info replace_action_info={ |
| &r, &method_name, | &r, &method_name, |
| &src, &result, | &src, &result, |
| &replacement_code, | &replacement_code |
| &src | |
| }; | }; |
| src.match( | src.match( |
| &method_name, | &method_name, |