logical cMainFunctionEdit :: Link ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NBuffer             comp_out;
  int32               curidx          = UNDEF;
  int32               rc              = ERIC;
  logical             reserve_project = YES;
  logical             term            = NO;
BEGINSEQ
//  if ( (curidx = StartClassAction(YES,reserve_project)) == ERIC) 
//                                                     ERROR
  SetupOutput("",YES);
  if ( Compile() )                                   ERROR
  SetupOutput("...Link executable ...\n",NO);
  
  if ( prophdl->ExecuteInstanceAction("GetLinkCommand",NULL) )
    SetupOutput("Error: providing link command\n",NO);
  else
  {
    rc = ExecuteCommand(prophdl->GetActionResult(),comp_out,YES,NO);
    SetupOutput(comp_out,NO);
  }


RECOVER
  term = YES;
ENDSEQ
//  StopClassAction(reserve_project,curidx);
  return(term);
}
logical cMainFunctionEdit :: ErrorLookup ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NString             command;
  NBuffer             buffer;
  logical             term            = NO;
BEGINSEQ
  if ( !prophdl->GetInstanceContext() )             ERROR
  if ( prophdl->ExecuteInstanceAction("GetProjectPath","ERC_Batch") )
    SetupOutput("Error providing command path\n",NO);
  else
  {
    command = prophdl->GetActionResult();
    command += "ShowErrors.bat";
    command += ' ';
    command += prophdl->GetString("sys_ident");
    ExecuteCommand(command,buffer,YES,NO);
    SetupOutput(buffer,YES);
  }


RECOVER
  term = YES;
ENDSEQ
  return(term);
}
logical cMainFunctionEdit :: Compile ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NBuffer             comp_out;
  int32               curidx          = UNDEF;
  int32               rc              = ERIC;
  logical             reserve_project = YES;
  logical             term            = NO;
BEGINSEQ
//  if ( (curidx = StartClassAction(YES,reserve_project)) == ERIC) 
//                                                     ERROR
  SetupOutput("...Creating source code file ...",NO);
  if ( prophdl->ExecuteExpression(GetRESDB(),"SourceCode()").IsValid() )
    SetupOutput("...  done.\n",NO);
  else
  {
    SetupOutput("...  terminated with errors, compile not started\n",NO);
    ERROR
  }
  
  if ( prophdl->ExecuteInstanceAction("GetCompileCommand",NULL) )
    SetupOutput("Error: providing compile command\n",NO);
  else
  {
    rc = ExecuteCommand(prophdl->GetActionResult(),comp_out,YES,NO);
    SetupOutput(comp_out,NO);
    if ( !rc && strstr(comp_out,"ERROR") )
      rc = ERIC;
      
    if ( rc )
    {
      *prophdl->GPH("req_compile") = (char*)(rc ? "CPS_failed" : "CPS_ready");
      term = YES;
    }
    prophdl->ExecuteInstanceAction("SetupModLevel",NULL);
  }


RECOVER
  term = YES;
ENDSEQ
//  StopClassAction(reserve_project,curidx);
  return(term);
}