--- parser3/src/classes/Attic/root.C 2001/03/12 09:08:46 1.18 +++ parser3/src/classes/Attic/root.C 2001/03/12 09:35:01 1.20 @@ -3,7 +3,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: root.C,v 1.18 2001/03/12 09:08:46 paf Exp $ + $Id: root.C,v 1.20 2001/03/12 09:35:01 paf Exp $ */ #include @@ -49,11 +49,11 @@ static void _untaint(Request& r, const S static void _process(Request& r, const String& name, Array *params) { - Value *vsource=static_cast(params->get(0)); // evaluate source to process - const String& source=r.process(*vsource).as_string(); + const String& source=r.process(*static_cast(params->get(0))).as_string(); - // process source code, append processed methods to 'self' class + // calculate pseudo file name of processed chars + // would be something like "/some/file(4) process" char place[MAX_STRING]; #ifndef NO_STRING_ORIGIN const Origin& origin=source.origin(); @@ -63,21 +63,23 @@ static void _process(Request& r, const S #else strncpy(place, MAX_STRING, name.cstr()); #endif - r.use_buf(source.cstr(), place, r.self->get_class()); - // execute @main[] + VClass& self_class=*r.self->get_class(); + // temporarily zero @main so to maybe-replace it in processed code + Temp_method temp_method(self_class, *main_method_name, 0); + + // process source code, append processed methods to 'self' class + // maybe-define new @main + r.use_buf(source.cstr(), place, &self_class); + + // maybe-execute @main[] if(Value *value=r.self->get_element(*main_method_name)) { // found some 'main' element if(Junction *junction=value->get_junction()) // it even has junction! if(const Method *method=junction->method) { // and junction is method-junction! call it // execute! r.execute(*method->parser_code); - return; } } - - R_THROW(0, 0, - &name, - "'"MAIN_METHOD_NAME"' method not found"); }