示例#1
0
static void OpenPlace(HANDLE hDlg,BoardParams *DlgParams,int row,int col,CHECK_OPEN_PLACE check)
{
  FarDialogItem DialogItem; int color;
  if(row<0) return;
  if(col<0) return;
  if(row>=DlgParams->width) return;
  if(col>=DlgParams->height) return;
  Info.SendDlgMessage(hDlg,DM_GETDLGITEMSHORT,DlgParams->width*col+row,&DialogItem);
  if(GET_DATA_1(DialogItem)==STATE_CLOSE)
  {
    SET_DATA_1(DialogItem,STATE_OPEN);
    DialogItem.VBuf[1].Char=GetChar(GET_DATA_0(DialogItem),GET_DATA_1(DialogItem),&color);
    int bgcolor=GetBG(row,col,GET_DATA_1(DialogItem));
    DialogItem.VBuf[0].Attributes.ForegroundColor=DialogItem.VBuf[1].Attributes.ForegroundColor=DialogItem.VBuf[2].Attributes.ForegroundColor=color;
    DialogItem.VBuf[0].Attributes.BackgroundColor=DialogItem.VBuf[1].Attributes.BackgroundColor=DialogItem.VBuf[2].Attributes.BackgroundColor=bgcolor;
    Info.SendDlgMessage(hDlg,DM_SETDLGITEMSHORT,DlgParams->width*col+row,&DialogItem);
    if(!GET_DATA_0(DialogItem))
    {
      OpenPlace(hDlg,DlgParams,row-1,col-1,COP_NONE);
      OpenPlace(hDlg,DlgParams,row-1,col,COP_NONE);
      OpenPlace(hDlg,DlgParams,row-1,col+1,COP_NONE);
      OpenPlace(hDlg,DlgParams,row,col-1,COP_NONE);
      OpenPlace(hDlg,DlgParams,row,col+1,COP_NONE);
      OpenPlace(hDlg,DlgParams,row+1,col-1,COP_NONE);
      OpenPlace(hDlg,DlgParams,row+1,col,COP_NONE);
      OpenPlace(hDlg,DlgParams,row+1,col+1,COP_NONE);
    }
    if(check!=COP_NONE) CheckStop(hDlg,DlgParams,row,col);
  }
  else if(check==COP_CHECK_ALL&&GET_DATA_1(DialogItem)==STATE_OPEN&&GET_DATA_0(DialogItem)>0&&GET_DATA_0(DialogItem)<9)
  {
    int mines=0;
    mines+=GetMine(row-1,col-1,hDlg,DlgParams,true);
    mines+=GetMine(row-1,col,hDlg,DlgParams,true);
    mines+=GetMine(row-1,col+1,hDlg,DlgParams,true);
    mines+=GetMine(row,col-1,hDlg,DlgParams,true);
    mines+=GetMine(row,col+1,hDlg,DlgParams,true);
    mines+=GetMine(row+1,col-1,hDlg,DlgParams,true);
    mines+=GetMine(row+1,col,hDlg,DlgParams,true);
    mines+=GetMine(row+1,col+1,hDlg,DlgParams,true);
    if(mines==GET_DATA_0(DialogItem)) //FIXME
    {
      OpenPlace(hDlg,DlgParams,row-1,col-1,COP_CHECK_STOP);
      OpenPlace(hDlg,DlgParams,row-1,col,COP_CHECK_STOP);
      OpenPlace(hDlg,DlgParams,row-1,col+1,COP_CHECK_STOP);
      OpenPlace(hDlg,DlgParams,row,col-1,COP_CHECK_STOP);
      OpenPlace(hDlg,DlgParams,row,col+1,COP_CHECK_STOP);
      OpenPlace(hDlg,DlgParams,row+1,col-1,COP_CHECK_STOP);
      OpenPlace(hDlg,DlgParams,row+1,col,COP_CHECK_STOP);
      OpenPlace(hDlg,DlgParams,row+1,col+1,COP_CHECK_STOP);

      CheckStop(hDlg,DlgParams,row,col);
    }
  }
}
示例#2
0
void first(){
    switch(condition) {
        case 0:
		lineTracking();
        switch(sensor.middle_sensor) {
            case 0b00001111:
            case 0b00011111:
            case 0b00111111:
            case 0b01111111:
            case 0b00011110:
            case 0b00111110:
            condition = 1;
            break;
        }
        break;

        case 1:
		wheels.stop();
		RightTurn();
        break;

        case 2: CheckStop(); break;
        case 3: Forward(); break;
        case 4: BackToLine(); break;
        case 5: LeftTurn(); break;
        case 6:
		lineTracking();
		if(sensor.front_sensor == 0b00111100 || sensor.front_sensor == 0b00011100 || sensor.front_sensor == 0b00111000)
		{
			wheels.forward(0,0);
			condition = 6;
		}
        break;
    }
}
示例#3
0
void PModule( mod_entry *obj )
/***********************************/
{
    if( (obj->modinfo & MOD_NEED_PASS_2) == 0 )
        return;
    DEBUG(( DBG_BASE, "2 : processing module %s", obj->name ));
    CurrMod = obj;
    IterateModRelocs( CurrMod->relocs, CurrMod->sizerelocs, IncExecRelocs );
    DoBakPats();
    DBIGenModule();
    CheckStop();
}
示例#4
0
int CIpcMessage::ReceiveAndInform(Ipc_msg_qid Queue)
{
	int ret;

	if ((ret = Receive(Queue)) == ABP_SUCCESS)
	{
		m_Stop = CheckStop();

		if (CheckInform())
		{
			Inform();
		}
	}

	return ret;
}
示例#5
0
static void DoShutdown( HWND hWnd, int reason )
{
	CheckStop( hWnd );
	INT_PTR nRet = notifydlg_popup( GetModuleHandle( NULL ) );
	if( nRet == IDCANCEL )
	{
		void OnStop( HWND hDlg );
		// i know it's ugly here.:(
		OnStop( hWnd );
		return;
	}
#ifdef COMPILE_DIST
	Win32::ShutdownSystem( checkConfig.safeShutdown );
#else
	if( reason == 1 )
	{
		MessageBox( hWnd, "Process does not exist", "INFO", MB_OK );
	}
	else if( reason == 2 )
	{
		MessageBox( hWnd, "Process has not tcp conn.", "INFO", MB_OK );
	}
#endif
}
示例#6
0
static void DoPass1( mod_entry *next, file_list *list )
/*****************************************************/
/* do pass 1 on the object file */
{
    member_list         *member;
    char                *membname;
    unsigned long       loc;
    unsigned long       size;
    unsigned            reclength;
    bool                lastmod;
    bool                ignoreobj;

    loc = 0;
    lastmod = FALSE;
    if( CacheOpen( list ) ) {
        reclength = CheckLibraryType( list, &loc, FALSE );
        for( ;; ) { /*  there may be more than 1 object module in a file */
            member = NULL;
            ignoreobj = FALSE;
            if( EndOfLib( list, loc ) )
                break;
            membname = IdentifyObject( list, &loc, &size );
            if( list->status & STAT_IS_LIB ) {
                if( (list->status & STAT_HAS_MEMBER) && list->u.member != NULL ) {
                    member = FindMember( list, membname );
                    if( member == NULL ) {
                        ignoreobj = TRUE;
                    } else if( list->u.member == NULL ) {
                        lastmod = TRUE;
                    }
                }
            }
            if( ignoreobj ) {
                _LnkFree( membname );
                if( size != 0 ) {
                    loc += size;
                } else {
                    SkipFile( list, &loc );
                }
            } else {
                if( next == NULL ) {
                    next = NewModEntry();
                }
                next->n.next_mod = NULL;
                next->f.source = list;
                next->modtime = next->f.source->file->modtime;
                next->modinfo |= ObjFormat & FMT_OBJ_FMT_MASK;
                if( member != NULL ) {
                    next->modinfo |= member->flags;
                    _LnkFree( member );
                }
                if( !(list->status & STAT_HAS_MEMBER) ) {
                    next->modinfo |= list->status & DBI_MASK;
                    if( list->status & STAT_LAST_SEG ) {
                        next->modinfo |= MOD_LAST_SEG;
                    }
                }
                AddToModList( next );
                next->location = loc;
                if( membname == NULL ) {
                    membname = ChkStrDup( list->file->name );
                }
                next->name = membname;
                loc = ObjPass1();
                if( list->status & STAT_TRACE_SYMS ) {
                    TraceSymList( CurrMod->publist );
                }
                next = NULL;
            }
            ObjFormat = 0;
            if( list->status & STAT_IS_LIB ) {             // skip padding.
                loc += CalcAlign( loc, reclength );
            } else if( !IS_FMT_OMF( CurrMod->modinfo ) ) {
                break;          // can only concat omf.
            }
            if( lastmod || CacheEnd( list, loc ) ) {
                break;
            }
        }
        if( list->u.member != NULL ) {
            LnkMsg( ERR+MSG_CANT_FIND_MEMBER, "12", list->file->name,
                                                    list->u.member->name );
        }
        CacheClose( list, 1 );
    }
    CheckStop();
}