Пример #1
0
 ~impl() noexcept { cancel_render(); }
Пример #2
0
void WinRenderFrontend::OpenStreams (bool append)
{
  int         i ;
  char        *stype ;
  OTextStream *os ;
  msgtype     mtype ;

  for (i = 0 ; i < MAX_STREAMS ; i++)
  {
    os = NULL ;
    switch (i)
    {
      case BANNER_STREAM :
           mtype = mBanner ;
           stype = "banner" ;
           break ;

      case STATUS_STREAM :
           mtype = mStatus ;
           stype = "status" ;
           break ;

      case DEBUG_STREAM :
           mtype = mDebug ;
           stype = "debug" ;
           break ;

      case FATAL_STREAM :
           mtype = mFatal ;
           stype = "fatal" ;
           break ;

      case RENDER_STREAM :
           mtype = mRender ;
           stype = "render" ;
           break ;

      case STATISTIC_STREAM :
           mtype = mStatistics ;
           stype = "statistics" ;
           break ;

      case WARNING_STREAM :
           mtype = mWarning ;
           stype = "warning" ;
           break ;

      case ALL_STREAM :
           mtype = mAll ;
           stype = "'all'" ;
           break ;

      default :
           mtype = mUnknown ;
           stype = "'unknown'" ;
           break ;
    }

    if (streams [i] != NULL)
    {
      delete streams [i] ;
      streams [i] = NULL ;
    }

    // have to test this this since a previous iteration could have cancelled the render
    // and we don't want to bug the user with extra file permission requests if they've
    // already said no.
    if (!stop_rendering)
    {
      if (streamnames [i] != NULL)
      {
        if (WIN_Allow_File_Write (streamnames [i], POV_File_Text_Stream))
        {
          os = new OTextStream (streamnames [i], POV_File_Text_Stream, append) ;
          if (os == NULL)
            message_printf ("Could not %s %s stream to file %s\n", append ? "append" : "write", stype, streamnames [i]) ;
        }
        else
          cancel_render () ;
      }
    }
    streams [i] = new WinStreamBuffer (os, mtype, (i == ALL_STREAM), ((i == ALL_STREAM) || !consoleoutput [i]) && (i != STATUS_STREAM)) ;
  }
}