示例#1
0
/* Does not return - goes to scheduler */
void
GCFromMutator(Thread_t* curThread)
{
	Proc_t *proc = (Proc_t *) curThread->proc;
	mem_t alloc = (mem_t) curThread->saveregs[ALLOCPTR];
	mem_t limit = (mem_t) curThread->saveregs[ALLOCLIMIT];
	mem_t sysAllocLimit = proc->allocLimit;

	/* Put registers in stacklet */
	int i;
	Stacklet_t *stacklet = CurrentStacklet(curThread->stack);
	volatile reg_t* primaryRegs =
		&stacklet->bottomBaseRegs[primaryStackletOffset == 0 ? 0 : 32];
	for (i=0; i<32; i++)
		primaryRegs[i] = curThread->saveregs[i];

	/*
		Check that we are running on own stack and allocation pointers
		consistent
	*/
	if (paranoid)
		assert(proc == (getProc())); /* getProc is slow */
	assert(proc->userThread == curThread);
	assert((proc->stack - (int) (&proc)) < 1024) ;
	assert((limit == sysAllocLimit) || (limit == StopHeapLimit));
	assert(alloc <= sysAllocLimit);

	/* ReleaseJob(proc) */
	/* Update processor's info, GCRelease thread, but don't unmap */
	UpdateJob(proc);
	procChangeState(proc, Scheduler, 1003);
	scheduler(proc);
	DIE("scheduler returned");
}
void ShowTonerReplacementDlg(UIStatusWnd *wnd)
{
	pthread_t thread;

	if(wnd != NULL){
		SigDisable();
		InitTonerReplacementDlgWidgets(wnd);
		SigEnable();

		if(GetPossibleChangeValueAtAlertCode(wnd->pAlertCode) == TRUE){
			UpdateJob(REQ_UPDATE_CONSUMABLESINFO_OF_TONERREPLACEMENT);
			ChangeToTonerReplaceMode(wnd, &thread);

			g_timer_tag = gtk_timeout_add(TIMER_INTERVAL, (GtkFunction)UpdateTimerFunc, wnd);
			pthread_join(thread, NULL);
			if(wnd->toner_replacement_dlg->modeChangeRetCode == RET_NORMAL){
				ShowDialog((UIDialog *)wnd->toner_replacement_dlg, NULL);
			}
		}else{
			ShowMsgDlg(wnd, MSG_TYPE_COMMUNICATION_ERR_GET);
		}
	}
}
示例#3
0
void MsgDlgOK(UIStatusWnd *wnd)
{
	int ret = 0;

	switch(wnd->msg_dlg->type){
	case MSG_TYPE_CLEANING1:
		UpdateJob(CCPD_REQ_CLEANING2);
		break;
	case MSG_TYPE_CLEANING2:
		UpdateJob(CCPD_REQ_CLEANING);
		break;
	case MSG_TYPE_HIDE_MONITOR:
		HideMonitor(wnd);
		break;
	case MSG_TYPE_CLEANING:
		if( wnd->nModel == MODEL_LBP3250 ||
		    wnd->nModel == MODEL_LBP3100 ||
		    wnd->nModel == MODEL_LBP3050 ||
		    wnd->nModel == MODEL_LBP6200 ||
		    wnd->nModel == MODEL_LBP6000 ||
		    wnd->nModel == MODEL_LBP6020 ){
			ret = ExecuteCleaning( wnd );
		} else {
			UpdateJob(CCPD_REQ_CLEANING3);
		}
		break;
	case MSG_TYPE_CLEANING2_CMD:
		if( wnd->nModel == MODEL_LBP5050 ||
		    wnd->nModel == MODEL_LBP7210 ||
		    wnd->nModel == MODEL_LBP7200 ){
			ret = ExecuteCleaning( wnd );
		} else {
			UpdateJob(CCPD_REQ_CLEANING3);
		}
		break;
	case MSG_TYPE_CALIBRATION:
		ret = UpdateJob(CCPD_REQ_CALIBRATION);
		if ( ret == 2 ){
		        HideMsgDlg(wnd);
			ShowMsgDlg(wnd, MSG_TYPE_PERFORM_CALIB_ERR);
		}else{
		        ret = 0;
		}
		break;
	case MSG_TYPE_CLEANING_3300:
		UpdateJob(CCPD_REQ_CLEANING);
		break;
	case MSG_TYPE_CLEANING_DATA:
		ret = PerformCleaning(wnd);
		break;
	case MSG_TYPE_CLEANING1_DATA:
		ret = PerformCleaning(wnd);
		break;
	case MSG_TYPE_DEVREQ_REGICLR:
	case MSG_TYPE_DEVREQ_CLRMIS:
		ret = SendRegiClrRequest(wnd);
		break;
	case MSG_TYPE_DEVREQ_CALIB:
		ret = SendCalibRequest(wnd);
		break;
	case MSG_TYPE_RESET_UNIT:
		wnd->resetunit_dlg->setdata = TRUE;
		break;
	}
	if( ret == 0 )
	{
		HideMsgDlg(wnd);
	}
}
static int UpdateTimerFunc(UIStatusWnd *wnd)
{
	int ret = TRUE;
	int needQuit = TRUE;
	int doing = FALSE;
	int warningEnd = FALSE;
	int statusPossibleChange = ALERTSTAT_ERROR;
	int isReplaceMode = FALSE;
	int buttonEnable = FALSE;
	char *mainStatusString = NULL;
	char *subStatusString = NULL;

	if(wnd != NULL){
		GtkWidget *window = UI_DIALOG(wnd->toner_replacement_dlg)->window;

		if(wnd->toner_replacement_dlg->modeChangeRetCode != RET_NORMAL){
			warningEnd = TRUE;
		}else if((wnd->toner_replacement_dlg->isModeChangeThreadActive == FALSE) &&
					(wnd->toner_replacement_dlg->modeChangeRetCode == RET_NORMAL)){
			doing = TRUE;
		}

		if(doing == TRUE){
			statusPossibleChange = GetPossibleChangeValueAtAlertCode(wnd->pAlertCode);
			isReplaceMode = GetIsReplaceModeValueAtAlertCode(wnd->pAlertCode);
			if(statusPossibleChange != ALERTSTAT_ERROR){
				needQuit = FALSE;

				if(wnd->toner_replacement_dlg->isModeChanged == FALSE){
					if((statusPossibleChange == TRUE) && (isReplaceMode == TRUE)){
						wnd->toner_replacement_dlg->isModeChanged = TRUE;
						UpdateButtonEnable(wnd, TRUE);
					}
				}else{
					if(isReplaceMode != TRUE){
						needQuit = TRUE;
					}
				}
			}else{
				needQuit = TRUE;
			}

			if(needQuit == TRUE){
				HideTonerReplacementDlg(wnd);
				ret = FALSE;
			}else{
				mainStatusString = MessageStr[MAIN_MES_WAIT_MOMENT];

				if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenC")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseC")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerC"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_C];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenM")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseM")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerM"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_M];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenY")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseY")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerY"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_Y];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenK")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseK")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerK"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_K];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNRotateTonerOpen")) ||
					!(strcmp(wnd->pAlertCode, "CNRotateTonerClose"))){
					mainStatusString = MessageStr[MAIN_MES_ROTATING];
					subStatusString = MessageStr[SUB_MES_ROTATING];
					buttonEnable = FALSE;
				}

				SetTextToTextView(window, "TonerReplacementDlg_text", _(mainStatusString));
				SetTextToLabel(window, "TonerReplacementDlg_Replaceable_TonerColor_label", _(subStatusString));


				if(GetIsCoverOpenValueAtAlertCode(wnd->pAlertCode) == FALSE){
					UpdateButtonEnable(wnd, buttonEnable);
					if(wnd->toner_replacement_dlg->isCoverOpend == TRUE){
						UpdateJob(REQ_UPDATE_CONSUMABLESINFO_OF_TONERREPLACEMENT);
						wnd->toner_replacement_dlg->isCoverOpend = FALSE;
					}
				}else{
					wnd->toner_replacement_dlg->isCoverOpend = TRUE;
					if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenC")) ||
						!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenM")) ||
						!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenY")) ||
						!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenK")) ||
						!(strcmp(wnd->pAlertCode, "CNRotateTonerOpen"))){
						SetWidgetSensitive(window, "TonerReplacementDlg_Cyan_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Magenta_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Yellow_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Black_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Finish_button", TRUE);
						if(wnd->toner_replacement_dlg->buttonEnableOld == TRUE){
							SetFocus(window, "TonerReplacementDlg_text");
						}
						wnd->toner_replacement_dlg->buttonEnableOld = FALSE;
					}
				}
			}
		}else{
			if(warningEnd == TRUE){
				ShowMsgDlg(wnd, MSG_TYPE_COMMUNICATION_ERR_GET);
				ret = FALSE;
			}
		}
	}else{
		HideTonerReplacementDlg(wnd);
		ret = FALSE;
	}
	return ret;
}