Exemplo n.º 1
0
/**
 * \brief Exit routine for OIL.
 *
 * This is called to shut down the OIL and free all resources.
 * If the RIP is still active, it is shut down fairly cleanly.
 */
void OIL_Exit(void)
{
#ifdef USE_PJL
  OIL_PjlExit();
#endif

  /* Quit the RIP fairly cleanly, so that SwExit is called and the
     multi-process semaphores are cleaned up properly.
     At this point, the rip may fail to quit cleanly depending upon
     the reason we're quiting therfore we ignore the return value. */

  /* if for whatever reason the RIP is not shutdown e.g offending command,
  or RIP is suspended, force to shutdown the RIP */
  if(g_SystemState.eCurrentState != OIL_Sys_Inactive)
  {
    if(g_NextJobConfiguration.g_eShutdownMode == OIL_RIPShutdownPartial)
    {
      GG_SHOW(GG_SHOW_OIL, "OIL_Exit: Performing deferred RIP shutdown for partial shutdown mode\n");
    }
    else
    {
      GG_SHOW(GG_SHOW_OIL, "OIL_Exit: Shutting down RIP, but expect SysExit to have done this by now\n");
    }
    /* Force shutdown of rip (ignore shutdown mode). */
    OIL_StopRIP(TRUE);
  }

  /* inform PMS that ripping is complete */
  if(g_bLogTiming)
  {
    GGglobal_timing_PPMlog();
  }

  PMS_RippingComplete();

  OIL_ProbeLogFinish() ;

  OIL_VirtFileCleanup();
}
Exemplo n.º 2
0
int OIL_MultiThreadedStart(OIL_TyJob *pms_ptJob, int ePDL)
#endif
{
  int fSuccess = TRUE;
  PDFSPOOL * pdfspool = NULL;

  /* Start the RIP. This function won't do a lot if the
     RIP has already been started (from an earlier call it, or
     if using partial shutdown mode).
     */
  if(!OIL_StartRIP()) {
    oil_printf("OIL_StartRIP failed.\n");
    return FALSE;
  }

  /* create (and initialize) the OIL job structure */
  g_pstCurrentJob = CreateOILJob(pms_ptJob, ePDL);

  ebddev_InitDevParams();
  {
    /* tell RIP we are starting a job */
    if(!JobInit(OIL_Sys_JobActive))
    {
      /* cleanup will be done below in JobExit() */
      fSuccess = FALSE;
    }

    /* get job data from PMS and pass it on to RIP */
    if( fSuccess )
    {
      if( ePDL == OIL_PDL_PDF )
      {
        if(!g_pstCurrentJob->bFileInput)
        {
          pdfspool = OIL_PdfSpool_Create();
          if( pdfspool == NULL || ! OIL_PdfSpool_StoreData(pdfspool) )
          {
            /* Failed to spool PDF */
            fSuccess = FALSE;
          }
        }
      }

      /* Configure RIP for PDL */
      if ( fSuccess && ePDL != OIL_PDL_PS && !SetupPDLType( TRUE, NULL, 0 ) )
      {
        GG_SHOW(GG_SHOW_OIL, "OIL_MultiThreadedStart: failed to initialise PDL\n");
        fSuccess = FALSE;
      }

      g_pstCurrentJob->eJobStatus = OIL_Job_StreamDone;
    }
  } 
#ifdef PMS_OIL_MERGE_DISABLE_JS 
  if(( ePDL == OIL_PDL_PDF ) && ( g_pstCurrentJob->bFileInput ))
      fSuccess = FALSE;
#endif
  /* End of job */
  if(!JobExit(OIL_Sys_Active))
  {
    fSuccess = FALSE;
  }

  if( pdfspool != NULL )
  {
    OIL_PdfSpool_Free(pdfspool);
  }

  /* Shutdown the rip (if shutdown mode allows it). */
  OIL_StopRIP(FALSE);

  return fSuccess;
}