/** * \brief Callback function invoked when the RIP exits. * * This function is registered with the RIP via SwLeSetRipExitFunction * and is intended to perform tidy up operations when the RIP exits. * The remainder of any active job is discarded by flushing the input. * * Note that this function is called whenever the RIP exits, so will also * be called as a result of calling \c SwLeStop(). * \param[in] errorCode Error code passed from the RIP to this function; used to create an exit message. * \param[in] pszText Exit message passed from the RIP to this function; used to create an exit message. */ static void OIL_RipExitCallback(int32 errorCode, uint8 * pszText) { GG_SHOW(GG_SHOW_OIL, "OIL_RipExitCallback: RIP exited (%d)\n", errorCode); if( pszText != NULL ) { /* Force output of pszText message */ unsigned int showflags = g_ConfigurableFeatures.g_uGGShow; g_ConfigurableFeatures.g_uGGShow |= GG_SHOW_OIL; GG_SHOW(GG_SHOW_OIL, " %s\n", pszText); g_ConfigurableFeatures.g_uGGShow = showflags; } if( g_SystemState.eCurrentState == OIL_Sys_JobActive ) { /* RIP exited in the middle of a job (so not as a result of calling SwLeStop() */ g_SystemState.eCurrentState = OIL_Sys_Inactive; #ifdef PMS_OIL_MERGE_DISABLE Call_gps_InterpNotifyState(g_SystemState.eCurrentState); #endif /* Read and discard any remaining input */ GG_SHOW(GG_SHOW_OIL, "OIL_RipExitCallback: Flushing input\n"); flushInput(); } }
/** * \brief OIL job initialisation function. * * This function is called to prepare the RIP for an incoming job. It requires that the * OIL be in the \c OIL_Sys_Active state when the function is entered. * \param[in] eNextState The system state that is required by the end of the call; * expected to be \c OIL_Sys_JobActive. * \return Returns TRUE if the job initialization is successfully performed and * the system is placed in the requested state, FALSE otherwise. */ int JobInit(OIL_eTySystemState eNextState) { uint8 * pConfigPS; HQASSERT(OIL_Sys_Active == g_SystemState.eCurrentState, "job_init entered in invalid state"); GG_SHOW(GG_SHOW_OIL, "JobInit:\n"); /* log the job start time */ GGglobal_timing(SW_TRACE_OIL_JOBSTART, 0); /* Tell RIP we are starting a job */ pConfigPS = GetConfigPS( g_pstCurrentJob->ePDLType ); /* ready to start the page */ GGglobal_timing(SW_TRACE_OIL_PAGESTART, 0); /* Set state now as a PS job completes during execution of SwLeJobStart */ g_SystemState.eCurrentState = eNextState; if ( ! SwLeJobStart ( (uint32)strlen((char*)pConfigPS), pConfigPS, NULL) ) { /* SwLeJobStart can return false in case of bad input, but nevertheless job is now active */ GG_SHOW(GG_SHOW_OIL, "job_init: Failed to start job \n"); } /* return TRUE if now in requested state */ return (g_SystemState.eCurrentState == eNextState); }
/** * \brief Callback function invoked when the RIP reboots * * This function is registered with the RIP via SwLeSetRipRebootFunction * and is intended to perform tidy up operations when the RIP reboots during. * a job. The remainder of the job is discarded by flushing the input. */ static void OIL_RipRebootCallback(void) { GG_SHOW(GG_SHOW_OIL, "OIL_RipRebootCallback: RIP rebooted\n"); /* Read and discard any remaining input */ GG_SHOW(GG_SHOW_OIL, "OIL_RipRebootCallback: Flushing input\n"); flushInput(); }
/** * \brief Submit a band to PMS * * This routine passes the completed band to PMS. \n * It is called only in push band delivery model. \n */ int SubmitBandToPMS(PMS_TyBandPacket *ptBandpacket) { static unsigned int uPageChecksum = 0; static unsigned int uBandSizeChecksum = 0; if(g_bPageChecksum) { /* If band packet is null, then it indicates end of page. */ if(ptBandpacket==NULL) { /* Output to console (if enabled - why wouldn't the messages be enabled if checksums have been turn on?) */ GG_SHOW(GG_SHOW_CHECKSUM, "Raster checksum: %d, 0x%08X\n", g_pstCurrentJob->uPagesToPrint, uPageChecksum); GG_SHOW(GG_SHOW_CHECKSUM, "Band size checksum: %d, 0x%08X\n", g_pstCurrentJob->uPagesToPrint, uBandSizeChecksum); /* Record checksum value */ OIL_ProbeLog(SW_TRACE_OIL_PAGECHECKSUM, SW_TRACETYPE_MARK, (intptr_t)uPageChecksum); /* Clear for next page */ uPageChecksum = 0; uBandSizeChecksum = 0; } else { unsigned char *p; unsigned int i; /* Record start of checksum calculation */ OIL_ProbeLog(SW_TRACE_OIL_PAGECHECKSUM, SW_TRACETYPE_ENTER, (intptr_t)uPageChecksum); for(i=0; i < PMS_MAX_PLANES_COUNT; i++) { #ifdef PMS_OIL_MERGE_DISABLE if(ptBandpacket->atColoredBand[i].ePlaneColorant != PMS_INVALID_COLOURANT) #else if(ptBandpacket->atColoredBand[i].ePlaneColorant != OIL_InvalidColor) #endif { if ( ptBandpacket->atColoredBand[i].pBandRaster) { for(p = ptBandpacket->atColoredBand[i].pBandRaster; p < ((ptBandpacket->atColoredBand[i].pBandRaster + ptBandpacket->atColoredBand[i].cbBandSize)); p++) { uPageChecksum += *p; } /* for each unsigned int */ uBandSizeChecksum += ptBandpacket->atColoredBand[i].cbBandSize; } /* if raster data pointer valid (why wouldn't it be?) */ } /* if plane contains valid data */ } /* for each plane */ /* Record end of checksum calculation */ OIL_ProbeLog(SW_TRACE_OIL_PAGECHECKSUM, SW_TRACETYPE_EXIT, (intptr_t)uPageChecksum); } /* not end of job condition */ } /* do checksums */ /* checkin the band packet */ return (PMS_CheckinBand(ptBandpacket)); }
/** * \brief Stop the RIP. * * \param[in] bForcedShutdown If TRUE, stop RIP regardless of the shutdown mode. * Otherwise, shutdown the RIP if shutdown mode is * total shutdown. */ void OIL_StopRIP(int bForcedShutdown) { /* check if system needs shutting down */ if(g_SystemState.eCurrentState != OIL_Sys_Inactive) { if(bForcedShutdown || (g_NextJobConfiguration.g_eShutdownMode == OIL_RIPShutdownTotal)) { g_SystemState.eCurrentState = OIL_Sys_Active; #ifndef PMS_OIL_MERGE_DISABLE_JS Call_gps_InterpNotifyState(g_SystemState.eCurrentState); #endif } else { GG_SHOW(GG_SHOW_OIL, "**RIP suspended\n"); g_SystemState.eCurrentState = OIL_Sys_Suspended; #ifndef PMS_OIL_MERGE_DISABLE_JS Call_gps_InterpNotifyState(g_SystemState.eCurrentState); #endif } } /* This call doesn't do much if in partial shutdown mode */ SysExit(OIL_Sys_Inactive); }
/** * \brief Retrieve screen table data from the PMS. * * This routine receives an integer specifying a particular screen and retrieves * a pointer to the corresponding array of PMS_TyScreenInfo structures to the PMS. * \param[in] nScreen An integer specifying which screen's information is required. * \param[out] ppPMSScreenInfo A pointer to a pointer of PMS screen information structures. * This will be updated to point to the required screen information. * \return Returns TRUE if the screen information is successfully retrieved, FALSE otherwise. */ int GetScreenInfoFromPMS(int nScreen, PMS_TyScreenInfo **ppPMSScreenInfo) { OIL_ProbeLog(SW_TRACE_OIL_GETSCREENINFOFROMPMS, SW_TRACETYPE_ENTER, (intptr_t)0); if(!PMS_GetScreenInfo(nScreen, ppPMSScreenInfo)) { GG_SHOW(GG_SHOW_OIL, "GetScreenTableFromPMS: Failed to get screen info, %d.\n", nScreen); return FALSE; } OIL_ProbeLog(SW_TRACE_OIL_GETSCREENINFOFROMPMS, SW_TRACETYPE_EXIT, (intptr_t)0); return TRUE; }
void OIL_PageDone(OIL_TyPage *ptPMSPage) #endif { OIL_ProbeLog(SW_TRACE_OIL_PAGEDONE, SW_TRACETYPE_ENTER, (intptr_t)0); #ifdef PMS_OIL_MERGE_DISABLE GG_SHOW(GG_SHOW_OIL, "Received PAGEDONE: JobID: %d, PageID: %d \n ", ptPMSPage->JobId, ptPMSPage->PageId); GGglobal_timing(SW_TRACE_OIL_PAGEDONE, ptPMSPage->PageId); /* free the OIL memory associated with the page */ ProcessPageDone(ptPMSPage->JobId, ptPMSPage->PageId); /* free the PMS memory associated with the page */ DeletePMSPage(ptPMSPage); #else GG_SHOW(GG_SHOW_OIL, "Received PAGEDONE: JobID: %d, PageID: %d \n ", ptPMSPage->pstJob->uJobId, ptPMSPage->uPageNo); GGglobal_timing(SW_TRACE_OIL_PAGEDONE, ptPMSPage->uPageNo); /* free the OIL memory associated with the page */ ProcessPageDone(ptPMSPage->pstJob->uJobId, ptPMSPage->uPageNo); #endif OIL_ProbeLog(SW_TRACE_OIL_PAGEDONE, SW_TRACETYPE_EXIT, (intptr_t)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(); }
/** * \brief OIL system exit function. * * This function is called to exit the OIL and shut down the RIP, freeing * all resources claimed by the RIP. The function first checks to ensure * that the OIL is not in the \c OIL_Sys_JobActive or \c OIL_Sys_Uninitialised * If the current system state is \c OIL_Sys_Active and the requested state is * \c OIL_Sys_Inactive, this function: * \arg unregisters streams; * \arg attempts to stop the RIP, and reports an error message if it is unsuccessful, and * \arg sets places the system into the \c OIL_Sys_Inactive state. * \param[in] eNextState The system state that is required by the end of the call; expected * to be \c OIL_Sys_Inactive. * \return Returns TRUE if the OIL is successfully exited and placed in the * requested state, FALSE otherwise. */ int SysExit(OIL_eTySystemState eNextState) { HQASSERT(OIL_Sys_JobActive != g_SystemState.eCurrentState, "sys_exit entered in state: OIL_Sys_JobActive"); HQASSERT(OIL_Sys_Uninitialised != g_SystemState.eCurrentState, "sys_exit entered in state: OIL_Sys_Uninitialised"); GG_SHOW(GG_SHOW_OIL, "SysExit:\n"); if ((g_SystemState.eCurrentState == OIL_Sys_Active) && (eNextState == OIL_Sys_Inactive)) { int val; libjpegturbo_deregister(); libjpeg_deregister(); Stream_Unregister(); val=SwLeStop(); HQASSERT(val==0, "sys_exit : RIP is not shutting down successfully"); oil_progress_finish(); oil_events_finish(); SwLeSDKEnd(val); /* shutdown the RIP, free systems resources */ SwLeShutdown(); /* does nothing in ebd, but called for consistency with start up*/ #ifdef PMS_OIL_MERGE_DISABLE_MEM OIL_free(OILMemoryPoolSys, g_SystemState.pRIPMemory); #else mfree(g_SystemState.pRIPMemory); #endif g_SystemState.eCurrentState = eNextState; } /* return TRUE if now in requested state */ return (g_SystemState.eCurrentState == eNextState); }
/** * \brief OIL system initialization function. * * Calling this function initializes the OIL and starts the RIP. The function * first checks to ensure that the OIL is not in the \c OIL_Sys_JobActive or * \c OIL_Sys_Uninitialised states. This function: * \arg sets up the callback functions used by the Skin to allocate and free memory. * \n In addition, if the system is currently in the \c OIL_Sys_Inactive state and the next state * requested is the \c OIL_Sys_Active state, this function: * \arg allocates and initializes RIP memory; * \arg provides a list of embedded devices to the RIP; * \arg provides exit and reboot callback functions to the RIP; * \arg starts the RIP; * \arg registers resources, RIP modules and streams as required, and * \arg places the system into the \c OIL_Sys_Active state. * \n If the system is currently in the \c OIL_Sys_Suspended state, and the next state * requested is the \c OIL_Sys_Active state, this function: * \arg places the system into the \c OIL_Sys_Active state. * * During this call the RIP is started and claims * \c g_SystemState.cbRIPMemory bytes of memory. * * \param[in] eNextState The system state that is required by the end of the call; * expected to be \c OIL_Sys_Active. * \return Returns TRUE if the system is successfully initialized (as necessary) * and placed in the requested state, FALSE otherwise. */ int SysInit(OIL_eTySystemState eNextState) { struct SysMemFns tSkinMemoryFns; HQASSERT((OIL_Sys_JobActive != g_SystemState.eCurrentState), ("sys_init entered in state: OIL_Sys_JobActive")); HQASSERT((OIL_Sys_Uninitialised != g_SystemState.eCurrentState), ("sys_init entered in state: OIL_Sys_Uninitialised")); /* Initialise the memory helper functions */ /* - these are the memory allocation functions to be used by skin */ tSkinMemoryFns.pAllocFn = SysAllocFnCallback; tSkinMemoryFns.pFreeFn = SysFreeFnCallback; GG_SHOW(GG_SHOW_OIL, "SysInit:\n"); if ( g_profile_scope != NULL && !SwLeProfileOption(NULL, g_profile_scope) ) { oil_printf("sys_init: Invalid profile scope %s\n", g_profile_scope); return 0; } /* log the job start time */ GGglobal_timing(SW_TRACE_OIL_SYSSTART, 0); if ((g_SystemState.eCurrentState == OIL_Sys_Inactive) && (eNextState == OIL_Sys_Active)) { uint8 *reasonText ; /* allocate memory for the RIP, all systems ready for a job */ g_SystemState.pRIPMemory = NULL; #ifdef PMS_OIL_MERGE_DISABLE_MEM g_SystemState.pRIPMemory = OIL_malloc(OILMemoryPoolSys, OIL_MemBlock, g_SystemState.cbRIPMemory); #else g_SystemState.pRIPMemory = mmalloc(g_SystemState.cbRIPMemory); #endif if(g_SystemState.pRIPMemory == NULL) /*Bad Pointer*/ { oil_printf("sys_init: Failed to allocate RIP Memory\n"); return 0; } (void)SwLeInitRuntime(NULL) ; MemLogInit(g_mps_log, g_mps_telemetry) ; /* It is assumed that pthreads has been initialised. This is done earlier in the OIL boot process. */ /* initialize the SDK support libraries */ g_SystemState.cbmaxAddressSpace = g_SystemState.cbRIPMemory; if ( !SwLeSDKStart(&g_SystemState.cbmaxAddressSpace, &g_SystemState.cbRIPMemory, g_SystemState.pRIPMemory, &tSkinMemoryFns, &reasonText) ) { GG_SHOW(GG_SHOW_OIL, "sys_init: %s.\n", (char *)reasonText) ; return FALSE ; } /* Set number of RIP renderer threads */ SwLeSetRipRendererThreads( g_ConfigurableFeatures.nRendererThreads ); SwLeMemInit(g_SystemState.cbmaxAddressSpace, g_SystemState.cbRIPMemory, 0, g_SystemState.pRIPMemory); /* set MultipleCopies pgbdev param to true so that we get just 1 copy in rastercallback */ SwLePgbSetMultipleCopies(TRUE); SwLeSetRasterCallbacks(OIL_RasterStride, OIL_RasterRequirements, OIL_RasterDestination, OIL_RasterCallback); /* Add embedded devices to list passed to RIP */ SwLeAddCustomDevices( sizeof(ppEmbeddedDevices) / sizeof(ppEmbeddedDevices[0]), ppEmbeddedDevices ); /* set RIP exit callback */ SwLeSetRipExitFunction( OIL_RipExitCallback ); /* set RIP reboot callback */ SwLeSetRipRebootFunction( OIL_RipRebootCallback ); if (!oil_progress_init()) { GG_SHOW(GG_SHOW_OIL, "sys_init: Failed to start progress timeline \n"); return FALSE; } /* Start RIP */ if ( SwLeStart( g_SystemState.cbmaxAddressSpace, g_SystemState.cbRIPMemory, 0, g_SystemState.pRIPMemory, (SwLeMONITORCALLBACK *)OIL_MonitorCallback ) ) { g_SystemState.eCurrentState = eNextState; } else { GG_SHOW(GG_SHOW_OIL, "sys_init: Failed to start RIP \n"); return FALSE; } /* Report job processing times */ progevts_enable_times(); oil_events_initialise(); if(!RegisterResources()) { GG_SHOW(GG_SHOW_OIL, "sys_init: Failed to register resources\n"); return FALSE; } if(!RegisterRIPModules()) { GG_SHOW(GG_SHOW_OIL, "sys_init: Failed to register RIP modules\n"); return FALSE; } if(!Stream_Register()) { GG_SHOW(GG_SHOW_OIL, "sys_init: Failed to register Stream\n"); return FALSE; } } if ( !libjpeg_register() || !libjpegturbo_register() ) { GG_SHOW(GG_SHOW_OIL, "sys_init: Failed to register libjpeg\n"); return FALSE; } if ((g_SystemState.eCurrentState == OIL_Sys_Suspended) && (eNextState == OIL_Sys_Active)) { GG_SHOW(GG_SHOW_OIL, "**RIP awakes\n"); g_SystemState.eCurrentState = eNextState; return TRUE; } /* Reset the job error status */ g_JobErrorData.Code = 0; g_JobErrorData.bErrorPageComplete = FALSE; /* return TRUE if now in requested state */ return (g_SystemState.eCurrentState == eNextState); }
/** * \brief Retrieve the input tray information from the PMS. * * The PMS is queried for information about the number of input trays available in the system. * The information also includes the attributes of the paper present in each tray. A snippet of * PostScript language code describing the input trays is built up in the character buffer passed * in to the function. This code snippet could be passed to the RIP to configure it with the * tray information, if required. * \param[in,out] pBuf Pointer to a character buffer used to build the PostScript language configuration string. */ void GetTrayInformation(char *pBuf) { #ifdef PMS_OIL_MERGE_DISABLE int nAvailableTraysCount, i; #else int i; #endif int bNeedAttrib0, bNeedAttrib1; char szLine[OIL_TMPSTR_SIZE]; #ifdef PMS_OIL_MERGE_DISABLE PMS_TyTrayInfo *pstPMSTrays = NULL; #endif PMS_TyPaperInfo *pstPMSPaper = NULL; PMS_TyMediaSource *ThisMediaSource; int InputTrayPriority[NUMFIXEDMEDIASOURCES]; static char pszInputAttributesStartPS[] = "<< /InputAttributes \n" " << \n"; /* In order to change the Tray Priority, change the following Priority sequence (from highest to lowest) */ static char pszInputAttributesEndPS[] = " >> \n" " /Policies <</PageSize 5 >> \n" ">> setpagedevice \n"; #ifdef PMS_OIL_MERGE_DISABLE nAvailableTraysCount = PMS_GetTrayInfo(&pstPMSTrays); #endif InputTrayPriority[0] = 0; bNeedAttrib0 = TRUE; bNeedAttrib1 = TRUE; strcat(pBuf, pszInputAttributesStartPS); #ifdef PMS_OIL_MERGE_DISABLE for (i=0; i < nAvailableTraysCount; i++) #else for (i=0; i < g_nInputTrays; i++) #endif { /* Get the media source definition so we can use the pds defined values for trays */ #ifdef PMS_OIL_MERGE_DISABLE PMS_GetMediaSource(pstPMSTrays[i].eMediaSource, &ThisMediaSource); #else PMS_GetMediaSource(g_pstTrayInfo[i].eMediaSource, &ThisMediaSource); #endif /* remember if InputAttributes 0 and 1 get initialised */ if (ThisMediaSource->ePSMediaSource == 0) { bNeedAttrib0 = FALSE; } if (ThisMediaSource->ePSMediaSource == 1) { bNeedAttrib1 = FALSE; } #ifdef PMS_OIL_MERGE_DISABLE if((pstPMSTrays[i].nPriority > 0) && (pstPMSTrays[i].nPriority <= nAvailableTraysCount)) InputTrayPriority[pstPMSTrays[i].nPriority - 1] = ThisMediaSource->ePSMediaSource; #else if((g_pstTrayInfo[i].nPriority > 0) && (g_pstTrayInfo[i].nPriority <= g_nInputTrays)) InputTrayPriority[g_pstTrayInfo[i].nPriority - 1] = ThisMediaSource->ePSMediaSource; #endif /* use the postscript defined values required for media sources so in rip tray selection works automatically */ /* pcl values will be converted to ps values in the pcl sensepagedevice routine */ sprintf(szLine, " %d << \n", ThisMediaSource->ePSMediaSource); strcat(pBuf, szLine); #ifdef PMS_OIL_MERGE_DISABLE if(pstPMSTrays[i].ePaperSize != PMS_SIZE_DONT_KNOW) { PMS_GetPaperInfo( pstPMSTrays[i].ePaperSize, &pstPMSPaper ); #else if(g_pstTrayInfo[i].ePaperSize != PMS_SIZE_DONT_KNOW) { PMS_GetPaperInfo( g_pstTrayInfo[i].ePaperSize, &pstPMSPaper ); #endif sprintf(szLine, " /PageSize [%4.3f %4.3f] \n", pstPMSPaper->dWidth , pstPMSPaper->dHeight); strcat(pBuf, szLine); if(g_ConfigurableFeatures.ePrintableMode == OIL_RIPRemovesUnprintableArea) { double ClipLeft, ClipWidth, ClipTop, ClipHeight; ClipLeft = pstPMSPaper->nLeftUnprintable * 0.000072; ClipTop = pstPMSPaper->nTopUnprintable * 0.000072; ClipWidth = pstPMSPaper->dWidth - ClipLeft - (pstPMSPaper->nRightUnprintable * 0.000072); ClipHeight = pstPMSPaper->dHeight - ClipTop - (pstPMSPaper->nBottomUnprintable * 0.000072); sprintf(szLine, " /RasterBBox [%4.3f %4.3f %4.3f %4.3f] \n", ClipLeft, ClipTop, ClipLeft + PADDED_ALIGNEMENT(ClipWidth, g_pstCurrentJob->uRIPDepth, g_pstCurrentJob->uXResolution), ClipTop + ClipHeight); } else { sprintf(szLine, " /RasterBBox [%4.3f %4.3f %4.3f %4.3f] \n", 0.0, 0.0, PADDED_ALIGNEMENT(pstPMSPaper->dWidth, g_pstCurrentJob->uRIPDepth, g_pstCurrentJob->uXResolution), pstPMSPaper->dHeight); } strcat(pBuf, szLine); } #ifdef PMS_OIL_MERGE_DISABLE if(pstPMSTrays[i].ePaperSize != PMS_SIZE_DONT_KNOW) { sprintf(szLine, " /LeadingEdge %d \n", GetMediaLeadingEdge(pstPMSTrays[i].ePaperSize)); strcat(pBuf, szLine); } if(pstPMSTrays[i].eMediaType != PMS_TYPE_DONT_KNOW) { sprintf(szLine, " /MediaType (%s) \n", GetMediaTypeString(pstPMSTrays[i].eMediaType)); strcat(pBuf, szLine); } if(pstPMSTrays[i].eMediaColor != PMS_COLOR_DONT_KNOW) { sprintf(szLine, " /MediaColor (%s) \n", GetMediaColorString(pstPMSTrays[i].eMediaColor)); strcat(pBuf, szLine); } if(pstPMSTrays[i].uMediaWeight > 0) { sprintf(szLine, " /MediaWeight %d \n", pstPMSTrays[i].uMediaWeight); strcat(pBuf, szLine); } #else if(g_pstTrayInfo[i].ePaperSize != PMS_SIZE_DONT_KNOW) { sprintf(szLine, " /LeadingEdge %d \n", GetMediaLeadingEdge(g_pstTrayInfo[i].ePaperSize)); strcat(pBuf, szLine); } if(g_pstTrayInfo[i].eMediaType != PMS_TYPE_DONT_KNOW) { sprintf(szLine, " /MediaType (%s) \n", GetMediaTypeString(g_pstTrayInfo[i].eMediaType)); strcat(pBuf, szLine); } if(g_pstTrayInfo[i].eMediaColor != PMS_COLOR_DONT_KNOW) { sprintf(szLine, " /MediaColor (%s) \n", GetMediaColorString(g_pstTrayInfo[i].eMediaColor)); strcat(pBuf, szLine); } if(g_pstTrayInfo[i].uMediaWeight > 0) { sprintf(szLine, " /MediaWeight %d \n", g_pstTrayInfo[i].uMediaWeight); strcat(pBuf, szLine); } #endif strcat(pBuf, " >> \n"); } /* check to verify InputAttribute 0 and 1 have been included, if not set to null to overwrite RIP defaults */ if (bNeedAttrib0) { strcat(pBuf, " 0 null\n"); } if (bNeedAttrib1) { strcat(pBuf, " 1 null\n"); } /* add the priority if required */ if(InputTrayPriority[0] != 0) { char *pszLine = &szLine[0]; strcat(pBuf," /Priority [ "); #ifdef PMS_OIL_MERGE_DISABLE for (i=0; i < nAvailableTraysCount; i++) #else for (i=0; i < g_nInputTrays; i++) #endif { sprintf(pszLine,"%d ",InputTrayPriority[i]); pszLine += 2; } sprintf(pszLine, "] \n"); strcat(pBuf, szLine); } strcat(pBuf, pszInputAttributesEndPS); HQASSERT ((strlen(szLine) < OIL_TMPSTR_SIZE), ("oil_media.c: szLine overflow - string larger than OIL_TMPSTR_SIZE")); HQASSERT ((strlen(pBuf) < OIL_TMPSTR_SIZE), ("SendTrayInformation: pBuf overflow - string larger than OIL_TMPSTR_SIZE")); GG_SHOW(GG_SHOW_MEDIA, "Tray Configuration PS:\n%s\n\n", pBuf); } /** * \brief Retrieve the input tray information from the PMS. * * The PMS is queried for information about the number of input trays available in the system. * The information also includes the attributes of the paper present in each tray. A snippet of * PostScript language code describing the input trays is built up in the character buffer passed * in to the function. This code snippet could be passed to the RIP to configure it with the * tray information, if required. * \param[in,out] pBuf Pointer to a character buffer used to build the PostScript language configuration string. */ void GetOutputInformation(char *pBuf) { #ifdef PMS_OIL_MERGE_DISABLE int nAvailableOutputsCount, i; #else int i; #endif int bNeedAttrib0 = TRUE; char szLine[OIL_TMPSTR_SIZE]; PMS_TyOutputInfo *pstPMSOutputs = NULL; PMS_TyMediaDest *ThisMediaDest; int OutputTrayPriority[NUMFIXEDMEDIADESTS]; static char pszOutputAttributesStartPS[] = "<< /OutputAttributes \n" " << \n"; /* In order to change the Tray Priority, change the following Priority sequence (from highest to lowest) */ static char pszOutputAttributesEndPS[] = " >> \n" ">> setpagedevice \n"; #ifdef PMS_OIL_MERGE_DISABLE nAvailableOutputsCount = PMS_GetOutputInfo(&pstPMSOutputs); OutputTrayPriority[0] = 0; strcat(pBuf, pszOutputAttributesStartPS); for (i=0; i < nAvailableOutputsCount; i++) #else pstPMSOutputs = g_pstOutputInfo; OutputTrayPriority[0] = 0; strcat(pBuf, pszOutputAttributesStartPS); for (i=0; i < g_nOutputTrays; i++) #endif { /* Get the media source definition so we can use the pds defined values for trays */ PMS_GetMediaDest(pstPMSOutputs[i].eOutputTray, &ThisMediaDest); /* remember if InputAttributes 0 and 1 get initialised */ if (ThisMediaDest->eMediaDest == 0) { bNeedAttrib0 = FALSE; } #ifdef PMS_OIL_MERGE_DISABLE if((pstPMSOutputs[i].nPriority > 0) && (pstPMSOutputs[i].nPriority <= nAvailableOutputsCount)) #else if((pstPMSOutputs[i].nPriority > 0) && (pstPMSOutputs[i].nPriority <= g_nOutputTrays)) #endif OutputTrayPriority[pstPMSOutputs[i].nPriority - 1] = ThisMediaDest->eMediaDest; /* use the postscript defined values required for media sources so in rip tray selection works automatically */ /* pcl values will be converted to ps values in the pcl sensepagedevice routine */ sprintf(szLine, " %d << \n", ThisMediaDest->eMediaDest); strcat(pBuf, szLine); sprintf(szLine, " /OutputType (%s) \n", GetMediaDestString(pstPMSOutputs[i].eOutputTray)); strcat(pBuf, szLine); strcat(pBuf, " >> \n"); } /* check to verify OutputAttribute 0 has been included, if not set to null to overwrite RIP default */ if (bNeedAttrib0) { strcat(pBuf, " 0 null\n"); } /* add the priority if required */ if(OutputTrayPriority[0] != 0) { char *pszLine = &szLine[0]; strcat(pBuf," /Priority [ "); #ifdef PMS_OIL_MERGE_DISABLE for (i=0; i < nAvailableOutputsCount; i++) #else for (i=0; i < g_nOutputTrays; i++) #endif { sprintf(pszLine,"%d ",OutputTrayPriority[i]); pszLine += 2; } sprintf(pszLine, "] \n"); strcat(pBuf, szLine); } strcat(pBuf, pszOutputAttributesEndPS); }
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; }
static int32 OIL_DeterminePDL( OIL_TyJob *pms_ptJob, int * pPDL ) #endif { int32 fGotPDL = FALSE; unsigned char buffer[ OIL_READBUFFER_LEN ]; size_t cbBytesInBuffer = 0; int eOIL_PDL = OIL_PDL_Unknown; #ifdef USE_PJL size_t cbConsumed = 0; int ePJL_PDL = eUnknown; /* Parse any PJL */ cbBytesInBuffer = PMS_PeekDataStream( buffer, sizeof(buffer) ); do { ePJL_PDL = OIL_PjlParseData( buffer, cbBytesInBuffer, &cbConsumed ); if( cbConsumed > 0 ) { /* Tell PMS we've consumed some data */ PMS_ConsumeDataStream( cbConsumed ); } if( ePJL_PDL != eNeedMoreData && ePJL_PDL != ePJL ) { /* Found a PDL */ break; } cbBytesInBuffer = PMS_PeekDataStream( buffer, sizeof(buffer) ); } while( cbBytesInBuffer > 0 ); if( ePJL_PDL != ePJL ) { eOIL_PDL = OIL_PjlMapPdlValue( ePJL_PDL ); if(eOIL_PDL == OIL_IMG) { pms_ptJob->bInputIsImage = TRUE; /* image jobs are handled by postscript interpreter */ eOIL_PDL = OIL_PDL_PS; } else if( eOIL_PDL == OIL_PDL_Unknown ) { #endif cbBytesInBuffer = PMS_PeekDataStream( buffer, MAX_SIGNATURE_BYTES ); if ((cbBytesInBuffer < MAX_SIGNATURE_BYTES) && pms_ptJob->eTestPage) { eOIL_PDL = OIL_PDL_PCL5c; /* todo - can not determine PDL with less than 4 bytes, read more data */ GG_SHOW(GG_SHOW_PSCONFIG, "OIL_DeterminePDL: too few characters read in first read to reliably determine PDL\n"); } else if ( memcmp( buffer, zip_header, 4 ) == 0 ) { eOIL_PDL = OIL_PDL_XPS; } else if ( memcmp( buffer, pdf_header, 4 ) == 0 ) { eOIL_PDL = OIL_PDL_PDF; } else if ( memcmp( buffer, ps_header, 2 ) == 0 ) { eOIL_PDL = OIL_PDL_PS; } else { /* assume the job is PCL5 */ eOIL_PDL = OIL_PDL_PCL5c; } #ifdef USE_PJL } } #endif fGotPDL = (eOIL_PDL != OIL_PDL_Unknown) ? TRUE : FALSE; *pPDL = eOIL_PDL; return fGotPDL; }
/** * \brief Submit a fully rendered page to the PMS. * * This function is called once the OIL page is completely rendered. Before submitting * the page to the PMS, various conditions are checked. The page will not be submitted * if it is outside the range of pages to be printed for the job, or if it a blank page * and blank page suppression has been activated. A page which is does not pass these * tests is deleted. * * If fewer planes have been created for the page than expected for the colorant family, blank * planes will be generated as required, or the job forced to monochrome in the case of a * CMYK job with blank color planes, if this functionality has been activated. * * Finally, if the page is to be submitted to the PMS, the completed OIL page structure * is used to create a PMS page, which is passed to PMS_CheckinPage(). If the page is * not to be submitted to the PMS, then the page is deleted immediately as the PMS * will not call the OIL function to indicate that the page has been output. */ void SubmitPageToPMS(void) { OIL_TyPage **ptLastPage; #ifdef PMS_OIL_MERGE_DISABLE PMS_TyPage *ptPMSPage; #endif int bSubmitPage = TRUE; #ifndef PMS_OIL_MERGE_DISABLE_JS gps_pageinfo_t pageinfo; int GPSFramePrintretval; int FP_force=GPS_PRINT_NORMAL; int FP_frameid=1; #endif #ifdef DIRECTPRINTPCLOUT PMS_TySystem ptPMSSysInfo; #endif g_pstCurrentJob->uPagesParsed++; #ifdef DIRECTPRINTPCLOUT PMS_GetSystemInfo(&ptPMSSysInfo , PMS_CurrentSettings); if((ptPMSSysInfo.eOutputType == PMS_DIRECT_PRINT) || (ptPMSSysInfo.eOutputType == PMS_DIRECT_PRINTXL)) { GGglobal_timing(SW_TRACE_OIL_CHECKIN, 0); GGglobal_timing(SW_TRACE_OIL_PAGEDONE, 0); return; } #endif OIL_ProbeLog(SW_TRACE_OIL_SUBMITPAGETOPMS, SW_TRACETYPE_ENTER, (intptr_t)g_pstCurrentJob->uPagesParsed); #ifdef USE_PJL bSubmitPage = OIL_PjlShouldOutputPage(g_pstCurrentJob->uPagesParsed, g_pstCurrentJob); #endif #ifndef PMS_OIL_MERGE_DISABLE_JS // memset(&pageinfo, 0, sizeof(pageinfo)); #endif if (bSubmitPage) { if ((!g_pstCurrentPage) || (g_pstCurrentPage->nBlankPage == TRUE)) { if (g_pstCurrentJob->bSuppressBlank == TRUE) { /* if blank pages are to be suppressed, then do not create the blank page. */ bSubmitPage = FALSE; } else { /* we have no CurrentPage - because this is a blank page */ GG_SHOW(GG_SHOW_OIL, "Blank page detected: create a blank page. \n "); g_pstCurrentPage = CreateOILBlankPage(g_pstCurrentPage, NULL); if(!g_pstCurrentPage) { /* There was some problem creating the blank page. Already would have been asserted */ return; } } } } if (bSubmitPage) { g_pstCurrentPage->pstJob = g_pstCurrentJob; /* attach the page at the tail of the page list of current job */ ptLastPage = &g_pstCurrentJob->pPage; while(*ptLastPage != NULL) { ptLastPage = (OIL_TyPage **)&(*ptLastPage)->pNext; } *ptLastPage = g_pstCurrentPage; g_pstCurrentJob->uPagesToPrint++; g_pstCurrentJob->uPagesInOIL++; #ifdef PMS_OIL_MERGE_DISABLE /* create PMS page from the oil page */ ptPMSPage = CreatePMSPage(g_pstCurrentPage); g_pstCurrentPage->ptPMSpage = ptPMSPage ; #endif GGglobal_timing(SW_TRACE_OIL_CHECKIN, g_pstCurrentJob->uPagesToPrint); /* There is no data attached to the page structure when using the push band delivery methods. Instead the checksum is computed in the SubmitBandToPMS function above. */ if(g_bPageChecksum && (g_ConfigurableFeatures.eBandDeliveryType != OIL_PUSH_BAND) && (g_ConfigurableFeatures.eBandDeliveryType != OIL_PUSH_BAND_DIRECT_SINGLE) && (g_ConfigurableFeatures.eBandDeliveryType != OIL_PUSH_BAND_DIRECT_FRAME) ) { uint8 *px; uint32 uBand; uint32 uColorant; uint32 uPageChecksum = 0; uint32 uBandSizeChecksum = 0; /* Record start of checksum calculation */ OIL_ProbeLog(SW_TRACE_OIL_PAGECHECKSUM, SW_TRACETYPE_ENTER, (intptr_t)uPageChecksum); for(uColorant = 0; uColorant < OIL_MAX_PLANES_COUNT; uColorant++) { #ifdef PMS_OIL_MERGE_DISABLE if(ptPMSPage->atPlane[uColorant].ePlaneColorant != PMS_INVALID_COLOURANT) { for(uBand = 0; uBand < ptPMSPage->atPlane[uColorant].uBandTotal; uBand++) { for(px = (uint8 *)ptPMSPage->atPlane[uColorant].atBand[uBand].pBandRaster; px < (uint8 *)(ptPMSPage->atPlane[uColorant].atBand[uBand].pBandRaster + ptPMSPage->atPlane[uColorant].atBand[uBand].cbBandSize); px++) { uPageChecksum+=*px; } uBandSizeChecksum+=ptPMSPage->atPlane[uColorant].atBand[uBand].cbBandSize; } } #else if(g_pstCurrentPage->atPlane[uColorant].ePlaneColorant != OIL_InvalidColor) { for(uBand = 0; uBand < g_pstCurrentPage->atPlane[uColorant].uBandTotal; uBand++) { for(px = (uint8 *)g_pstCurrentPage->atPlane[uColorant].atBand[uBand].pBandRaster; px < (uint8 *)(g_pstCurrentPage->atPlane[uColorant].atBand[uBand].pBandRaster + g_pstCurrentPage->atPlane[uColorant].atBand[uBand].cbBandSize); px++) { uPageChecksum+=*px; } uBandSizeChecksum+=g_pstCurrentPage->atPlane[uColorant].atBand[uBand].cbBandSize; } } #endif } GG_SHOW(GG_SHOW_CHECKSUM, "Raster checksum: %d, 0x%08X\n", g_pstCurrentJob->uPagesToPrint, uPageChecksum); GG_SHOW(GG_SHOW_CHECKSUM, "Band size checksum: %d, 0x%08X\n", g_pstCurrentJob->uPagesToPrint, uBandSizeChecksum); /* Record end of checksum calculation */ OIL_ProbeLog(SW_TRACE_OIL_PAGECHECKSUM, SW_TRACETYPE_EXIT, (intptr_t)uPageChecksum); /* Record checksum value */ OIL_ProbeLog(SW_TRACE_OIL_PAGECHECKSUM, SW_TRACETYPE_MARK, (intptr_t)uPageChecksum); } /* checkin the page */ #ifdef PMS_OIL_MERGE_DISABLE PMS_CheckinPage(ptPMSPage); #else #ifdef PMS_OIL_MERGE_DISABLE_JS PMS_CheckinPage(g_pstCurrentPage); #else /*PMS_CheckinPage(ptPMSPage);*/ /***************************Call to gpsFramePrint***********************************/ GPSFramePrintretval = GPS_FramePrint(gps_client, FP_frameid, &pageinfo, FP_force); if(!GPSFramePrintretval) { printf("GPS_FramePrint : Success\n"); } else { printf("GPS_FramePrint : Failed\n"); } #endif #endif /* ready to start the page */ GGglobal_timing(SW_TRACE_OIL_PAGESTART, 0); } else if (g_pstCurrentPage) { DeleteOILPage(g_pstCurrentPage); g_pstCurrentPage = NULL; } OIL_ProbeLog(SW_TRACE_OIL_SUBMITPAGETOPMS, SW_TRACETYPE_EXIT, (intptr_t)g_pstCurrentJob->uPagesParsed); }
/** * \brief Display the RIP configuration * * This function displays the active features, according * to the RIP features structure, as a string. */ static void ShowRIPFeatures() { GG_SHOW(GG_SHOW_OILVER, "("); if (stRIPFeatures.bPS) GG_SHOW(GG_SHOW_OILVER, " PS"); if (stRIPFeatures.bXPS) GG_SHOW(GG_SHOW_OILVER, " XPS"); if (stRIPFeatures.bPDF) GG_SHOW(GG_SHOW_OILVER, " PDF"); if (stRIPFeatures.bPCL5) GG_SHOW(GG_SHOW_OILVER, stRIPFeatures.bPCL ? " PCL" : " PCL5"); if (stRIPFeatures.bTrapping) GG_SHOW(GG_SHOW_OILVER, " Trapping"); if (stRIPFeatures.bCoreTrace) GG_SHOW(GG_SHOW_OILVER, " CoreTrace"); if (stRIPFeatures.bFontEmul) GG_SHOW(GG_SHOW_OILVER, " FontEmul"); if (stRIPFeatures.bMultiThreadedCore) GG_SHOW(GG_SHOW_OILVER, " MT"); if(stRIPFeatures.bUFST5) GG_SHOW(GG_SHOW_OILVER," UFST5 "); if(stRIPFeatures.bUFST7) GG_SHOW(GG_SHOW_OILVER," UFST7 "); if(stRIPFeatures.bFF) GG_SHOW(GG_SHOW_OILVER," FF "); GG_SHOW(GG_SHOW_OILVER, " )\r\n"); }
/** * \brief OIL job exit function. * * This function is called to notify the RIP that a job has completed and * that the resources claimed by the job can now be freed. It requires that * the system be in one of \c OIL_Sys_JobCancel, \c OIL_Sys_JobActive or * \c OIL_Sys_Inactive states when the function is entered.\n * This function: * \arg requests that the RIP end the current job; * \arg discards remaining pages in the job; * \arg cleans up any partial pages; * \arg deletes the job; * \arg configures the RIP according to the settings in the next job, if any, and * \arg places the system into the next requested state, if it is not already inactive. * * This function does not cause the RIP to exit. * * \param[in] eNextState The system state that is required by the end of the call. * \return Returns TRUE if the post-job cleanup is successful and the OIL is * placed in the requested state, FALSE otherwise. */ int JobExit(OIL_eTySystemState eNextState) { char szJobName[OIL_MAX_JOBNAME_LENGTH]; int GPSPlotCloseretval; int GPSSinCloseretval ; int GPSSoutCloseretval; int GPSSoutFlushretval; int GPSSoutWriteretval; long len,i; int fin = GPS_INTERP_FIN_NORMAL, uel_found=1; HQASSERT(OIL_Sys_JobCancel == g_SystemState.eCurrentState || OIL_Sys_JobActive == g_SystemState.eCurrentState || OIL_Sys_Inactive == g_SystemState.eCurrentState, "job_exit entered in invalid state"); GG_SHOW(GG_SHOW_OIL, "JobExit:\n"); /* release resources */ while (g_ulGGtiming_pagecount != 0) { /* wait - until all the pages have been output */ OIL_RelinquishTimeSlice(); } /* free(g_pstCurrentJob); */ { if (!SwLeJobEnd()) { /* Report this error */ GG_SHOW(GG_SHOW_OIL, "job_exit: Failed to finish job \n"); } } if(OIL_Sys_Inactive != g_SystemState.eCurrentState) { g_SystemState.eCurrentState = eNextState; } /* At this point RIPping must have completed and oil should have received data for all pages from the RIP*/ g_pstCurrentJob->eJobStatus = OIL_Job_RipDone; /* keep the jobname safe for use in timing log before deleting job */ strcpy(szJobName, g_pstCurrentJob->szJobName); /* Wait for all pages to be removed */ while(g_pstCurrentJob->pPage!=NULL) { OIL_RelinquishTimeSlice(); } /* check for incomplete pages which can be a result of job cancel */ if (g_pstCurrentPage) { DeleteOILPage(g_pstCurrentPage); g_pstCurrentPage = 0; } if(event_Cancel_flag == TRUE) { gpsInterpNotifyState(&gps_client, GPS_INTERP_STATE_FLUSHING); gpsFrameCancel(&gps_client,gps_frameid); gpsPlotCancel(&gps_client, PlotSet_plotid); fin = GPS_INTERP_FIN_CANCEL; } #ifndef PMS_OIL_MERGE_DISABLE_JS /***********Call to gpsflush and gpswrite for buffer1***************************/ if(*buffer1!=NULL) { if(host_outBuff) { GPSSoutFlushretval=GPS_SoutFlush(host_outBuff); if(GPSSoutFlushretval==0) { printf("GPS_SoutFlush : Success\n"); } else { printf("GPS_SoutFlush : Failed\n"); } } len=0; for(i=0;buffer1[i]!='\0';i++) len++; printf(" 1 size of hostbuff = %d\n",sizeof(host_outBuff)); GPSSoutWriteretval=GPS_SoutWrite(host_outBuff,buffer1,len,GPS_HOST_NONBLOCK); if(GPSSoutWriteretval >= 0) { printf("GPS_SoutWrite : Success\n"); } else { printf("GPS_SoutWrite : Failed\n"); } } /***********Call to gpsflush and gpswrite for buff2***************************/ if(*buffer2!=NULL) { if(host_outBuff) { GPSSoutFlushretval=GPS_SoutFlush(host_outBuff); if(GPSSoutFlushretval==0) { printf("GPS_SoutFlush : Success\n"); } else { printf("GPS_SoutFlush : Failed\n"); } } printf(" 2 size of hostbuff = %d\n",sizeof(host_outBuff)); len=0; for(i=0;buffer2[i]!='\0';i++) len++; GPSSoutWriteretval=GPS_SoutWrite(host_outBuff,buffer2,len,GPS_HOST_NONBLOCK); if(GPSSoutWriteretval >= 0) { printf("GPS_SoutWrite : Success\n"); } else { printf("GPS_SoutWrite : Failed\n"); } } /***********Call to gpsflush and gpswrite for buff3***************************/ if(*buffer3!=NULL) { if(host_outBuff) { GPSSoutFlushretval=GPS_SoutFlush(host_outBuff); if(GPSSoutFlushretval==0) { printf("GPS_SoutFlush : Success\n"); } else { printf("GPS_SoutFlush : Failed\n"); } } printf(" 3 size of hostbuff = %d\n",sizeof(host_outBuff)); len=0; for(i=0;buffer3[i]!='\0';i++) len++; GPSSoutWriteretval=GPS_SoutWrite(host_outBuff,buffer3,len,GPS_HOST_NONBLOCK); if(GPSSoutWriteretval >= 0) { printf("GPS_SoutWrite : Success\n"); } else { printf("GPS_SoutWrite : Failed\n"); } } /***********Call to gpsflush and gpswrite for buff4***************************/ if(*buffer4!=NULL) { if(host_outBuff) { GPSSoutFlushretval=GPS_SoutFlush(host_outBuff); if(GPSSoutFlushretval==0) { printf("GPS_SoutFlush : Success\n"); } else { printf("GPS_SoutFlush : Failed\n"); } } printf(" 4 size of hostbuff = %d\n",sizeof(host_outBuff)); len=0; for(i=0;buffer4[i]!='\0';i++) len++; GPSSoutWriteretval=GPS_SoutWrite(host_outBuff,buffer4,len,GPS_HOST_NONBLOCK); if(GPSSoutWriteretval >= 0) { printf("GPS_SoutWrite : Success\n"); } else { printf("GPS_SoutWrite : Failed\n"); } } /***********Call to gpsflush and gpswrite for buff5***************************/ if(*buffer5!=NULL) { if(host_outBuff) { GPSSoutFlushretval=GPS_SoutFlush(host_outBuff); if(GPSSoutFlushretval==0) { printf("GPS_SoutFlush : Success\n"); } else { printf("GPS_SoutFlush : Failed\n"); } } printf(" 5 size of hostbuff = %d\n",sizeof(host_outBuff)); len=0; for(i=0;buffer5[i]!='\0';i++) len++; GPSSoutWriteretval=GPS_SoutWrite(host_outBuff,buffer5,len,GPS_HOST_NONBLOCK); if(GPSSoutWriteretval >= 0) { printf("GPS_SoutWrite : Success\n"); } else { printf("GPS_SoutWrite : Failed\n"); } } /***********Call to GpsPlotclose***************************/ /* AppendJob = True. Don't close the Output channel, next job uses same. AppendJob = False. Close the Output channel, job ends here. */ if(AppendJob == 0) { GPSPlotCloseretval = GPS_PlotClose(gps_client, PlotSet_plotid); if(GPSPlotCloseretval>=0) { printf("GPS_PlotClose : Success\n"); } else { printf("GPS_PlotClose : Failed\n"); } PlotSet_plotid = -1; /***********Call to GpsSinclose***************************/ if (host_inBuff || host_outBuff) { GPSSinCloseretval=GPS_SinClose(host_inBuff); if(GPSSinCloseretval==0) { printf("GPS_SinClose : Success\n"); host_inBuff = NULL; } else { printf("GPS_SinClose : Failed\n"); } /***********Call to GpsSoutclose***************************/ GPSSoutCloseretval=GPS_SoutClose(host_outBuff); if(GPSSoutCloseretval==0) { printf("GPS_SoutClose : Success\n"); host_outBuff = NULL; } else { printf("GPS_SoutClose : Failed\n"); } /***********Call to GpsInterpfinishProcdata***************************/ GPS_InterpFinishProcData(gps_client, 1, fin, uel_found); } else { gpsInterpFinishTestprint(gps_client, jobid); } /*************Call to gpsInterpNotifyState()*************************************/ GPS_InterpNotifyState(gps_client, GPS_INTERP_STATE_FLUSHING); // Review - it should be GPS_INTERP_STATE_IDLE ? } #endif /* Delete the job */ DeleteOILJob(g_pstCurrentJob->uJobId); g_pstCurrentJob = NULL; /* Reconfigure the features */ g_ConfigurableFeatures.g_ePaperSelectMode = g_NextJobConfiguration.g_ePaperSelectMode; g_ConfigurableFeatures.g_uGGShow = g_NextJobConfiguration.g_uGGShow; /* print out the timing data */ if(g_bLogTiming) { GGglobal_timing_dumplog((unsigned char*)szJobName); } /* reset data for next job */ GGglobal_timing(SW_TRACE_OIL_RESET, 0); current_pdlid=0; g_tJob.eTestPage = OIL_TESTPAGE_NONE; /* return TRUE if now in requested state */ return (g_SystemState.eCurrentState == eNextState); }
int OIL_Init(void (**apfn_funcs[])()) { char *pSrc, *pDst; char szProbeOptions[MAX_PROBE_ARG_LEN + 1]; /* hook up the HQNc-standard assertion handlers */ HqAssertHandlers_t assert_handlers = { HqCustomAssert, HqCustomTrace } ; SetHqAssertHandlers(&assert_handlers) ; /*Start pthreads if not part of the OS. */ if (! OIL_Init_platform()) return 0; /* Initialise bare essential structures, this memory will never be released */ g_pstCurrentJob = NULL; g_SystemState.eCurrentState = OIL_Sys_Uninitialised; #ifndef PMS_OIL_MERGE_DISABLE_JS Call_gps_InterpNotifyState(g_SystemState.eCurrentState); #endif g_SystemState.pUserData = NULL; g_SystemState.bJobCancelReq = FALSE; g_ConfigurableFeatures.bGenoaCompliance = TRUE; g_ConfigurableFeatures.bScalableConsumption = FALSE; g_ConfigurableFeatures.bImageDecimation = FALSE; g_ConfigurableFeatures.bPixelInterleaving = FALSE; g_bLogTiming = FALSE; g_bPageChecksum = FALSE; /* Initialise g_nTimeInit = 0 to be used inside OIL_TimeInMilliSecs */ g_nTimeInit = 0; g_nTimeInit = OIL_TimeInMilliSecs(); /* all parameters initialized here must also be set in JobExit() */ g_ConfigurableFeatures.g_eShutdownMode = g_NextJobConfiguration.g_eShutdownMode = OIL_RIPShutdownPartial; /* initialise GG_SHOW control param to output only oil version messages - for all msgs set to 0xffff */ g_ConfigurableFeatures.g_uGGShow = GG_SHOW_OILVER; if((g_tSystemInfo.nOILconfig & 0x40) != 0) g_ConfigurableFeatures.g_uGGShow |= GG_SHOW_JOBCFG; g_NextJobConfiguration.g_uGGShow = g_ConfigurableFeatures.g_uGGShow; g_ConfigurableFeatures.fEbdTrapping = 0.0f; g_ConfigurableFeatures.uColorManagement = 0; /* Color management disabled */ g_ConfigurableFeatures.bRetainedRaster = FALSE; /* Set to TRUE to enable */ g_ConfigurableFeatures.bRasterByteSWap = FALSE; /* Set to TRUE to enable */ #if USE_RAM_SW_FOLDER g_ConfigurableFeatures.bSWinRAM = 1; #else g_ConfigurableFeatures.bSWinRAM = 0; #endif #if defined(USE_UFST5) g_ConfigurableFeatures.bUseUFST5 = 1; #else g_ConfigurableFeatures.bUseUFST5 = 0; #endif #if defined(USE_UFST7) g_ConfigurableFeatures.bUseUFST7 = 1; #else g_ConfigurableFeatures.bUseUFST7 = 0; #endif #ifdef USE_FF g_ConfigurableFeatures.bUseFF = 1; #else g_ConfigurableFeatures.bUseFF = 0; #endif /* initialize the PMS callback pointers */ *g_apfn_pms_calls = (void *)apfn_funcs; g_SystemState.eCurrentState = OIL_Sys_Inactive; #ifndef PMS_OIL_MERGE_DISABLE_JS Call_gps_InterpNotifyState(g_SystemState.eCurrentState); #endif GGglobal_timing(SW_TRACE_OIL_RESET, 0); /* Configure some configurable features from PMS */ GetPMSSystemInfo(); GetRIPFeatures(&stRIPFeatures); g_NextJobConfiguration.g_ePaperSelectMode = g_ConfigurableFeatures.g_ePaperSelectMode; /* Enable Scalable Consumption rip configuration */ if(g_SystemState.nOILconfig & 0x01) { g_ConfigurableFeatures.bScalableConsumption = TRUE; } /* if OIL timing enabled, set flag */ if(g_SystemState.nOILconfig & 0x02) { g_bLogTiming = TRUE; g_ConfigurableFeatures.g_uGGShow = g_NextJobConfiguration.g_uGGShow |= GG_SHOW_TIMING; } /* if page checksum enable, set flag */ if(g_SystemState.nOILconfig & 0x04) { g_bPageChecksum = TRUE; g_ConfigurableFeatures.g_uGGShow = g_NextJobConfiguration.g_uGGShow |= GG_SHOW_CHECKSUM; } /* if Genoa compliance bit set, disable genoa settings */ if(g_SystemState.nOILconfig & 0x08) { g_ConfigurableFeatures.bGenoaCompliance = FALSE; } /* if Image Decimation bit set, disable Image Decimation * Image Decimation command line control is disabled until further notice. if(g_SystemState.nOILconfig & 0x10) { g_ConfigurableFeatures.bImageDecimation = FALSE; } */ /* if retained raster bit is set, enable retained raster settings */ if((g_SystemState.nOILconfig & 0x20) && (stRIPFeatures.bPDF == TRUE)) { g_ConfigurableFeatures.bRetainedRaster = TRUE; } /* if raster byte swap bit is set, enable raster byte swap setting */ if(g_SystemState.nOILconfig & 0x80) { g_ConfigurableFeatures.bRasterByteSWap = TRUE; } if((g_ConfigurableFeatures.szProbeTrace[0] != '\0') || g_bLogTiming) { /* initialise probe handler function pointers */ OIL_ProbeLogInit("-b", "ebdprobe.log") ; } if(g_ConfigurableFeatures.szProbeTrace[0] != '\0') { pSrc = &g_ConfigurableFeatures.szProbeTrace[0]; pDst = &szProbeOptions[0]; for(; *pSrc; pSrc++) { if(*pSrc=='\"') continue; else if(*pSrc==' ') { *pDst++ = '\0'; while(*pSrc && *pSrc==' ') pSrc++; if(!*pSrc) break; pSrc--; } else *pDst++=*pSrc; } *pDst++='\0'; *pDst='\0'; for(pSrc = &szProbeOptions[0]; *pSrc; pSrc++) { /* Probe logging feature using default handler in skinkit */ if ( !OIL_ProbeOption(NULL, pSrc) ) { OIL_ProbeOptionUsage() ; OIL_ProbeLogFinish() ; break; } pSrc+=strlen(pSrc); } } GG_SHOW(GG_SHOW_OILVER, "OIL Version: %s - ", OILVersion); ShowRIPFeatures(); GG_SHOW(GG_SHOW_OILVER, "\r\n"); #ifdef USE_PJL OIL_PjlInit(); #endif return 1; }