|
|
| version 1.76, 2002/04/15 11:34:24 | version 1.81, 2002/04/19 11:18:04 |
|---|---|
| Line 26 | Line 26 |
| // defines | // defines |
| #define FILE_CLASS_NAME "file" | |
| #define TEXT_MODE_NAME "text" | #define TEXT_MODE_NAME "text" |
| // class | // class |
| Line 104 static void _find(Request& r, const Stri | Line 102 static void _find(Request& r, const Stri |
| // not found | // not found |
| if(params->size()==2) { | if(params->size()==2) { |
| Value& not_found_code=params->as_junction(1, "not-found param must be code"); | Value& not_found_code=params->as_junction(1, "not-found param must be code"); |
| r.write_pass_lang(r.process_to_value(not_found_code)); | r.write_pass_lang(r.process(not_found_code)); |
| } | } |
| } | } |
| Line 254 static void _exec_cgi(Request& r, const | Line 252 static void _exec_cgi(Request& r, const |
| delim_size=0; // calm down, compiler | delim_size=0; // calm down, compiler |
| throw Exception(0, | throw Exception(0, |
| &method_name, | &method_name, |
| "output does not contain CGI header; exit code=%d; outsize=%u; out: \"%s\"; errsize=%u; err: \"%s\"", | "output does not contain CGI header; exit status=%d; stdoutsize=%u; stdout: \"%s\"; stderrsize=%u; stderr: \"%s\"", |
| status, | status, |
| (uint)out.size(), out.cstr(), | (uint)out.size(), out.cstr(), |
| (uint)err.size(), err.cstr()); | (uint)err.size(), err.cstr()); |
| Line 301 static void _list(Request& r, const Stri | Line 299 static void _list(Request& r, const Stri |
| const String *regexp; | const String *regexp; |
| pcre *regexp_code; | pcre *regexp_code; |
| int ovecsize; | const int ovecsize=(1/*match*/)*3; |
| int *ovector; | int ovector[ovecsize]; |
| if(params->size()>1) { | if(params->size()>1) { |
| regexp=¶ms->as_no_junction(1, "regexp must not be code").as_string(); | regexp=¶ms->as_no_junction(1, "regexp must not be code").as_string(); |
| Line 317 static void _list(Request& r, const Stri | Line 315 static void _list(Request& r, const Stri |
| throw Exception(0, | throw Exception(0, |
| ®exp->mid(erroffset, regexp->size()), | ®exp->mid(erroffset, regexp->size()), |
| "regular expression syntax error - %s", errptr); | "regular expression syntax error - %s", errptr); |
| ovector=(int *)pool.malloc(sizeof(int)*(ovecsize=(1/*match*/)*3)); | |
| } else | } else |
| regexp_code=0; | regexp_code=0; |
| Line 367 static void _list(Request& r, const Stri | Line 363 static void _list(Request& r, const Stri |
| // write out result | // write out result |
| VTable& result=*new(pool) VTable(pool, &table); | VTable& result=*new(pool) VTable(pool, &table); |
| result.set_name(method_name); | |
| r.write_no_lang(result); | r.write_no_lang(result); |
| } | } |
| Line 381 static void lock_execute_body(int , void | Line 376 static void lock_execute_body(int , void |
| Lock_execute_body_info& info=*static_cast<Lock_execute_body_info *>(context); | Lock_execute_body_info& info=*static_cast<Lock_execute_body_info *>(context); |
| // execute body | // execute body |
| info.r->write_assign_lang(info.r->process_to_string(*info.body_code)); | info.r->write_assign_lang(info.r->process(*info.body_code)); |
| }; | }; |
| static void _lock(Request& r, const String& method_name, MethodParams *params) { | static void _lock(Request& r, const String& method_name, MethodParams *params) { |
| const String& file_spec=r.absolute(params->as_string(0, "file name must be string")); | const String& file_spec=r.absolute(params->as_string(0, "file name must be string")); |
| Line 393 static void _lock(Request& r, const Stri | Line 388 static void _lock(Request& r, const Stri |
| // constructor | // constructor |
| MFile::MFile(Pool& apool) : Methoded(apool) { | MFile::MFile(Pool& apool) : Methoded(apool, "file") { |
| set_name(*NEW String(pool(), FILE_CLASS_NAME)); | |
| // ^save[mode;file-name] | // ^save[mode;file-name] |
| add_native_method("save", Method::CT_DYNAMIC, _save, 2, 2); | add_native_method("save", Method::CT_DYNAMIC, _save, 2, 2); |