--- parser3/src/main/pa_request.C 2001/03/15 09:37:56 1.37 +++ parser3/src/main/pa_request.C 2001/03/16 12:30:24 1.40 @@ -3,7 +3,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_request.C,v 1.37 2001/03/15 09:37:56 paf Exp $ + $Id: pa_request.C,v 1.40 2001/03/16 12:30:24 paf Exp $ */ #include @@ -30,6 +30,7 @@ Request::Request(Pool& apool, root_class(apool), env_class(apool), form_class(apool), + request_class(apool, *this), fclasses(apool), flang(alang), info(ainfo) @@ -47,6 +48,8 @@ Request::Request(Pool& apool, classes().put(*env_class_name, &env_class); // form class classes().put(*form_class_name, &form_class); + // request class + classes().put(*request_class_name, &request_class); } char *Request::core(const char *sys_auto_path1, @@ -93,10 +96,10 @@ char *Request::core(const char *sys_auto form_class.fill_fields(*this, post_max_size); // TODO: load site auto.p files, all assigned bases from upper dir - char *site_auto_file="Y:\\parser3\\src\\auto.p"; + /*char *site_auto_file="Y:\\parser3\\src\\auto.p"; main_class=use_file( - site_auto_file, false/*ignore possible read problem*/, - main_class_name, main_class); + site_auto_file, false/*ignore possible read problem* /, + main_class_name, main_class);*/ // there must be some auto.p if(!main_class) @@ -128,33 +131,40 @@ char *Request::core(const char *sys_auto if(const Method *method=junction->method) { // preparing to pass parameters to // @exception[origin;source;comment;type;code] - VMethodFrame *frame=NEW VMethodFrame(pool(), *junction); + VMethodFrame frame(pool(), *junction); + frame.set_self(*main_class); const String *problem_source=e.problem_source(); // origin LOCAL_STRING(origin_name, "origin"); - VString *origin_value=0; + Value *origin_value=0; #ifndef NO_STRING_ORIGIN - const Origin& origin=problem_source->origin(); - if(origin.file) { - char *buf=(char *)malloc(MAX_STRING); - snprintf(buf, MAX_STRING, "%s(%d): ", - origin.file, 1+origin.line); - String *NEW_STRING(origin_file_line, buf); - origin_value=NEW VString(*origin_file_line); + if(problem_source) { + const Origin& origin=problem_source->origin(); + if(origin.file) { + char *buf=(char *)malloc(MAX_STRING); + snprintf(buf, MAX_STRING, "%s(%d): ", + origin.file, 1+origin.line); + String *NEW_STRING(origin_file_line, buf); + origin_value=NEW VString(*origin_file_line); + } } #endif - frame->store_param(origin_name, origin_value); + frame.store_param(origin_name, + origin_value?origin_value:NEW VUnknown(pool())); // source LOCAL_STRING(source_name, "source"); - frame->store_param(source_name, - NEW VString(*problem_source)); + Value *source_value=0; + if(problem_source) + source_value=NEW VString(*problem_source); + frame.store_param(source_name, + source_value?source_value:NEW VUnknown(pool())); // comment LOCAL_STRING(comment_name, "comment"); String *NEW_STRING(comment_value, e.comment()); - frame->store_param(comment_name, + frame.store_param(comment_name, NEW VString(*comment_value)); // type @@ -164,7 +174,7 @@ char *Request::core(const char *sys_auto type_value=NEW VString(*e.type()); else type_value=NEW VUnknown(pool()); - frame->store_param(type_name, type_value); + frame.store_param(type_name, type_value); // code LOCAL_STRING(code_name, "code"); @@ -173,9 +183,9 @@ char *Request::core(const char *sys_auto code_value=NEW VString(*e.code()); else code_value=NEW VUnknown(pool()); - frame->store_param(code_name, code_value); + frame.store_param(code_name, code_value); - result=execute_method(*frame, *method); + result=execute_method(frame, *method); } } @@ -273,5 +283,5 @@ char *Request::absolute(const char *name strcat(result, name); return result; } else - return relative(info.request_uri, name); + return relative(info.uri, name); }