/*203:*/
//#line 687 "/usr/local/yacco2/library/thread.w"

/*565:*/
//#line 24 "/usr/local/yacco2/library/macros.w"



/*:565*/
//#line 688 "/usr/local/yacco2/library/thread.w"

/*23:*/
//#line 392 "/usr/local/yacco2/library/intro.w"

using namespace yacco2;

/*:23*/
//#line 689 "/usr/local/yacco2/library/thread.w"

/*209:*/
//#line 768 "/usr/local/yacco2/library/thread.w"

char ma[SMALL_BUFFER_4K];
const char*pp_start= "YACCO2_MSG__::PROC::%i::%s start parsing\n";
const char*pp_stop= "YACCO2_MSG__::PROC::%i::%s stop parsing\n";
/*23:*/
//#line 392 "/usr/local/yacco2/library/intro.w"

using namespace yacco2;

/*:23*/
//#line 772 "/usr/local/yacco2/library/thread.w"


/*:209*/
//#line 690 "/usr/local/yacco2/library/thread.w"

/*210:*/
//#line 775 "/usr/local/yacco2/library/thread.w"

proc_parser->pp_requesting_parallelism__= Caller_pp;
proc_parser->launched_as_procedure__= true;
proc_parser->from_thread__= Caller_pp;
proc_parser->no_competing_pp_ths__= Caller_pp->no_requested_ths_to_run__;


/*:210*/
//#line 691 "/usr/local/yacco2/library/thread.w"


/*208:*/
//#line 747 "/usr/local/yacco2/library/thread.w"

if(Caller_pp->top_stack_record()->state__->proc_call_addr__==0){
proc_parser->override_current_token(*Caller_pp->current_token()
,Caller_pp->current_token_pos__);
proc_parser->set_start_token(*Caller_pp->current_token());
proc_parser->set_start_token_pos(Caller_pp->current_token_pos__);
proc_parser->top_stack_record()->set_symbol(proc_parser->current_token());
}else{
Cparse_record*pr= 
Caller_pp->get_stack_record(Caller_pp->current_stack_pos()-2);
int new_pos= Caller_pp->current_token_pos__-1;
proc_parser->override_current_token(*pr->symbol__,new_pos);
proc_parser->set_start_token(*pr->symbol__);
proc_parser->set_start_token_pos(new_pos);
}
proc_parser->token_supplier__= Caller_pp->token_supplier__;
proc_parser->token_producer__= Caller_pp->token_producer__;
proc_parser->error_queue__= Caller_pp->error_queue__;
proc_parser->recycle_bin__= Caller_pp->recycle_bin__;
proc_parser->sym_lookup_functor__= Caller_pp->sym_lookup_functor__;
/*:208*/
//#line 693 "/usr/local/yacco2/library/thread.w"

/*638:*/
//#line 1401 "/usr/local/yacco2/library/macros.w"

if(yacco2::YACCO2_MSG__){
/*389:*/
//#line 3053 "/usr/local/yacco2/library/parser.w"

LOCK_MUTEX(yacco2::TRACE_MU);
if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Acquired trace mu"<<FILE_LINE<<std::endl;
}

/*:389*/
//#line 1403 "/usr/local/yacco2/library/macros.w"

sprintf(ma,pp_start,proc_parser->thread_no__,called_proc_name);
yacco2::lrclog<<ma;
Parser*pp_= proc_parser->pp_requesting_parallelism__;
yacco2::lrclog<<"YACCO2_MSG__::"
<<proc_parser->thread_no__
<<"::"
<<proc_parser->thread_name()
<<" requesting parser*: "<<pp_
<<FILE_LINE<<std::endl;
yacco2::lrclog<<"\tYACCO2_MSG__::PROC::"<<proc_parser->thread_no__<<"::"
<<proc_parser->thread_name()
<<" Caller's # threads to run:: "<<pp_->no_requested_ths_to_run__
<<" Caller's # active threads: "<<pp_->th_active_cnt__
<<" Self # competing threads: "<<proc_parser->no_competing_pp_ths__
<<FILE_LINE<<std::endl;
yacco2::lrclog<<"\tYACCO2_MSG__::PROC::"
<<proc_parser->thread_no__<<"::"
<<proc_parser->thread_name()
<<" passed token*: "<<pp_->current_token()
<<'"'<<proc_parser->current_token()->id__<<'"'
<<" pos: "<<proc_parser->current_token_pos__
<<FILE_LINE<<std::endl;
yacco2::lrclog
<<"\t\t::GPS FILE: ";
EXTERNAL_GPSing(proc_parser->current_token__)
yacco2::lrclog
<<" GPS LINE: "
<<proc_parser->current_token__->tok_co_ords__.line_no__
<<" GPS CHR POS: "
<<proc_parser->current_token__->tok_co_ords__.pos_in_line__
<<FILE_LINE<<std::endl;
/*390:*/
//#line 3060 "/usr/local/yacco2/library/parser.w"

if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Releasing trace mu"<<FILE_LINE<<std::endl;
}
UNLOCK_MUTEX(yacco2::TRACE_MU);

/*:390*/
//#line 1435 "/usr/local/yacco2/library/macros.w"

}
if(yacco2::YACCO2_T__){
/*389:*/
//#line 3053 "/usr/local/yacco2/library/parser.w"

LOCK_MUTEX(yacco2::TRACE_MU);
if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Acquired trace mu"<<FILE_LINE<<std::endl;
}

/*:389*/
//#line 1438 "/usr/local/yacco2/library/macros.w"

yacco2::lrclog<<"YACCO2_T__::"
<<proc_parser->thread_no__
<<"::"
<<proc_parser->thread_name()
<<" token*: "<<proc_parser->current_token__
<<" enum: "<<proc_parser->current_token__->enumerated_id__
<<" pos: "<<proc_parser->current_token_pos__
<<' '<<'"'<<proc_parser->current_token__->id__<<'"'
<<FILE_LINE<<std::endl;
yacco2::lrclog
<<"\t\t::GPS FILE: ";
EXTERNAL_GPSing(proc_parser->current_token__)
yacco2::lrclog
<<" GPS LINE: "
<<proc_parser->current_token__->tok_co_ords__.line_no__
<<" GPS CHR POS: "
<<proc_parser->current_token__->tok_co_ords__.pos_in_line__
<<FILE_LINE<<std::endl;
/*390:*/
//#line 3060 "/usr/local/yacco2/library/parser.w"

if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Releasing trace mu"<<FILE_LINE<<std::endl;
}
UNLOCK_MUTEX(yacco2::TRACE_MU);

/*:390*/
//#line 1457 "/usr/local/yacco2/library/macros.w"

}

/*:638*/
//#line 694 "/usr/local/yacco2/library/thread.w"

/*207:*/
//#line 732 "/usr/local/yacco2/library/thread.w"

THR_result rslt= proc_parser->parallel_parse();

/*:207*/
//#line 695 "/usr/local/yacco2/library/thread.w"

/*206:*/
//#line 720 "/usr/local/yacco2/library/thread.w"

proc_parser->remove_from_stack(proc_parser->parse_stack__.top_sub__-1);
CAbs_lr1_sym*sym= proc_parser->top_stack_record()->symbol__;
if(sym!=0){
if(sym->auto_delete__==ON){
/*641:*/
//#line 1482 "/usr/local/yacco2/library/macros.w"

if(yacco2::YACCO2_TH__){
THREAD_NO tid= proc_parser->thread_no__;
/*389:*/
//#line 3053 "/usr/local/yacco2/library/parser.w"

LOCK_MUTEX(yacco2::TRACE_MU);
if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Acquired trace mu"<<FILE_LINE<<std::endl;
}

/*:389*/
//#line 1485 "/usr/local/yacco2/library/macros.w"

yacco2::lrclog<<"YACCO2_TH__:: "<<"sym to be deleted: "
<<tid<<"::"
<<proc_parser->fsm_tbl__->id__<<"::"
<<sym->id__
<<FILE_LINE<<std::endl;
/*390:*/
//#line 3060 "/usr/local/yacco2/library/parser.w"

if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Releasing trace mu"<<FILE_LINE<<std::endl;
}
UNLOCK_MUTEX(yacco2::TRACE_MU);

/*:390*/
//#line 1491 "/usr/local/yacco2/library/macros.w"

}

/*:641*/
//#line 725 "/usr/local/yacco2/library/thread.w"

delete sym;
}
proc_parser->top_stack_record()->set_symbol(0);
}
proc_parser->parse_stack__.lr_stk_init(*proc_parser->fsm_tbl__->start_state__);
/*:206*/
//#line 696 "/usr/local/yacco2/library/thread.w"

/*205:*/
//#line 709 "/usr/local/yacco2/library/thread.w"

proc_parser->set_use_all_shift_on();
proc_parser->set_abort_parse(OFF);
proc_parser->set_stop_parse(OFF);
proc_parser->has_questionable_shift_occured__= OFF;

/*:205*/
//#line 697 "/usr/local/yacco2/library/thread.w"


finished_working:
/*204:*/
//#line 705 "/usr/local/yacco2/library/thread.w"

proc_parser->clear_parse_stack();

/*:204*/
//#line 700 "/usr/local/yacco2/library/thread.w"

/*645:*/
//#line 1527 "/usr/local/yacco2/library/macros.w"

if(yacco2::YACCO2_MSG__){
/*389:*/
//#line 3053 "/usr/local/yacco2/library/parser.w"

LOCK_MUTEX(yacco2::TRACE_MU);
if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Acquired trace mu"<<FILE_LINE<<std::endl;
}

/*:389*/
//#line 1529 "/usr/local/yacco2/library/macros.w"

yacco2::lrclog<<"YACCO2_MSG__::PROC::"<<proc_parser->thread_no__
<<"::"<<called_proc_name
<<" ==>procedure finished working"
<<FILE_LINE<<std::endl;
/*390:*/
//#line 3060 "/usr/local/yacco2/library/parser.w"

if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Releasing trace mu"<<FILE_LINE<<std::endl;
}
UNLOCK_MUTEX(yacco2::TRACE_MU);

/*:390*/
//#line 1534 "/usr/local/yacco2/library/macros.w"

}

/*:645*/
//#line 701 "/usr/local/yacco2/library/thread.w"

return rslt;

/*:203*/
