--- parser3/src/main/Attic/core.C 2001/02/24 15:26:03 1.35 +++ parser3/src/main/Attic/core.C 2001/02/25 08:50:13 1.37 @@ -1,5 +1,5 @@ /* -$Id: core.C,v 1.35 2001/02/24 15:26:03 paf Exp $ +$Id: core.C,v 1.37 2001/02/25 08:50:13 paf Exp $ */ #include "pa_request.h" @@ -50,6 +50,11 @@ void Request::core() { void Request::use(char *file, String *name) { char *source=file_read(pool(), file); + if(!source) + THROW(0,0, + 0, + "use: can not read '%s' file", file); + VClass& vclass=COMPILE(source, file); if(name) // they forced some name? vclass.set_name(*name); @@ -71,17 +76,19 @@ char *Request::execute_MAIN() { Value *main=vclass->get_element(name_main); if(main) { // found some 'main' element Junction *junction=main->get_junction(); - const Method *method=junction->method; - if(method) { // that element is a method, call it - // initialize contexts - self=root=rcontext=vclass; - wcontext=NEW WWrapper(pool(), vclass); - - // execute! - execute(method->code); - - // return chars - return wcontext->get_string()->cstr(); + if(junction) {// it even has junction! + const Method *method=junction->method; + if(method) { // and junction is method-junction! call it + // initialize contexts + self=root=rcontext=vclass; + wcontext=NEW WWrapper(pool(), vclass); + + // execute! + execute(method->code); + + // return chars + return wcontext->get_string()->cstr(); + } } } }