--- parser3/src/classes/file.C 2002/04/15 11:34:24 1.76 +++ parser3/src/classes/file.C 2002/04/19 11:18:04 1.81 @@ -4,7 +4,7 @@ Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) - $Id: file.C,v 1.76 2002/04/15 11:34:24 paf Exp $ + $Id: file.C,v 1.81 2002/04/19 11:18:04 paf Exp $ */ #include "pa_config_includes.h" @@ -26,8 +26,6 @@ // defines -#define FILE_CLASS_NAME "file" - #define TEXT_MODE_NAME "text" // class @@ -104,7 +102,7 @@ static void _find(Request& r, const Stri // not found if(params->size()==2) { 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)); } } @@ -254,7 +252,7 @@ static void _exec_cgi(Request& r, const delim_size=0; // calm down, compiler throw Exception(0, &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, (uint)out.size(), out.cstr(), (uint)err.size(), err.cstr()); @@ -301,8 +299,8 @@ static void _list(Request& r, const Stri const String *regexp; pcre *regexp_code; - int ovecsize; - int *ovector; + const int ovecsize=(1/*match*/)*3; + int ovector[ovecsize]; if(params->size()>1) { regexp=¶ms->as_no_junction(1, "regexp must not be code").as_string(); @@ -317,8 +315,6 @@ static void _list(Request& r, const Stri throw Exception(0, ®exp->mid(erroffset, regexp->size()), "regular expression syntax error - %s", errptr); - - ovector=(int *)pool.malloc(sizeof(int)*(ovecsize=(1/*match*/)*3)); } else regexp_code=0; @@ -367,7 +363,6 @@ static void _list(Request& r, const Stri // write out result VTable& result=*new(pool) VTable(pool, &table); - result.set_name(method_name); r.write_no_lang(result); } @@ -381,7 +376,7 @@ static void lock_execute_body(int , void Lock_execute_body_info& info=*static_cast(context); // 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) { const String& file_spec=r.absolute(params->as_string(0, "file name must be string")); @@ -393,10 +388,7 @@ static void _lock(Request& r, const Stri // constructor -MFile::MFile(Pool& apool) : Methoded(apool) { - set_name(*NEW String(pool(), FILE_CLASS_NAME)); - - +MFile::MFile(Pool& apool) : Methoded(apool, "file") { // ^save[mode;file-name] add_native_method("save", Method::CT_DYNAMIC, _save, 2, 2);