Beispiel #1
0
void DRC::ListUnconnectedPads()
{
    testUnconnected();

    // update the m_ui listboxes
    updatePointers();
}
int DRC::Drc( ZONE_CONTAINER* aArea, int aCornerIndex )
{
    updatePointers();

    if( !doEdgeZoneDrc( aArea, aCornerIndex ) )
    {
        wxASSERT( m_currentMarker );
        m_pcbEditorFrame->SetMsgPanel( m_currentMarker );
        return BAD_DRC;
    }

    return OK_DRC;
}
//				正在处理的子序列位置,序列总长度,要更新的指针索引
void updatePointers(int pointers[], int length, int curPos) 
{	
    if (pointers[curPos] + 1 <= length - 1) 
	{
        pointers[curPos]++;
    } 
	else 
	{
        updatePointers(pointers, length - 1, curPos - 1);
        pointers[curPos] = pointers[curPos - 1] + 1;
    }
    return;
}
Beispiel #4
0
void DRC::ShowDialog()
{
    if( !m_ui )
    {
        m_ui = new DIALOG_DRC_CONTROL( this, m_mainWindow );
        updatePointers();

        // copy data retained in this DRC object into the m_ui DrcPanel:

        PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl,
                              m_pcb->GetDesignSettings().m_TrackMinWidth );
        PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl,
                              m_pcb->GetDesignSettings().m_ViasMinSize );
        PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl,
                              m_pcb->GetDesignSettings().m_MicroViasMinSize );

        m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile );
        m_ui->m_RptFilenameCtrl->SetValue( m_rptFilename );
    }
    else
        updatePointers();

    m_ui->Show( true );
}
int DRC::Drc( TRACK* aRefSegm, TRACK* aList )
{
    updatePointers();

    if( !doTrackDrc( aRefSegm, aList, true ) )
    {
        wxASSERT( m_currentMarker );

        m_pcbEditorFrame->SetMsgPanel( m_currentMarker );
        return BAD_DRC;
    }

    if( !doTrackKeepoutDrc( aRefSegm ) )
    {
        wxASSERT( m_currentMarker );

        m_pcbEditorFrame->SetMsgPanel( m_currentMarker );
        return BAD_DRC;
    }

    return OK_DRC;
}
void DRC::RunTests( wxTextCtrl* aMessages )
{
    // be sure m_pcb is the current board, not a old one
    // ( the board can be reloaded )
    m_pcb = m_pcbEditorFrame->GetBoard();

    // Ensure ratsnest is up to date:
    if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
    {
        if( aMessages )
        {
            aMessages->AppendText( _( "Compile ratsnest...\n" ) );
            wxSafeYield();
        }

        m_pcbEditorFrame->Compile_Ratsnest( NULL, true );
        m_pcb->GetRatsnest()->ProcessBoard();
    }

    // someone should have cleared the two lists before calling this.

    if( !testNetClasses() )
    {
        // testing the netclasses is a special case because if the netclasses
        // do not pass the BOARD_DESIGN_SETTINGS checks, then every member of a net
        // class (a NET) will cause its items such as tracks, vias, and pads
        // to also fail.  So quit after *all* netclass errors have been reported.
        if( aMessages )
            aMessages->AppendText( _( "Aborting\n" ) );

        // update the m_drcDialog listboxes
        updatePointers();

        return;
    }

    // test pad to pad clearances, nothing to do with tracks, vias or zones.
    if( m_doPad2PadTest )
    {
        if( aMessages )
        {
            aMessages->AppendText( _( "Pad clearances...\n" ) );
            wxSafeYield();
        }

        testPad2Pad();
    }

    // test track and via clearances to other tracks, pads, and vias
    if( aMessages )
    {
        aMessages->AppendText( _( "Track clearances...\n" ) );
        wxSafeYield();
    }

    testTracks( aMessages ? aMessages->GetParent() : m_pcbEditorFrame, true );

    // Before testing segments and unconnected, refill all zones:
    // this is a good caution, because filled areas can be outdated.
    if( aMessages )
    {
        aMessages->AppendText( _( "Fill zones...\n" ) );
        wxSafeYield();
    }

    m_pcbEditorFrame->Fill_All_Zones( aMessages ? aMessages->GetParent() : m_pcbEditorFrame,
                                  false );

    // test zone clearances to other zones
    if( aMessages )
    {
        aMessages->AppendText( _( "Test zones...\n" ) );
        wxSafeYield();
    }

    testZones();

    // find and gather unconnected pads.
    if( m_doUnconnectedTest )
    {
        if( aMessages )
        {
            aMessages->AppendText( _( "Unconnected pads...\n" ) );
            aMessages->Refresh();
        }

        testUnconnected();
    }

    // find and gather vias, tracks, pads inside keepout areas.
    if( m_doKeepoutTest )
    {
        if( aMessages )
        {
            aMessages->AppendText( _( "Keepout areas ...\n" ) );
            aMessages->Refresh();
        }

        testKeepoutAreas();
    }

    // find and gather vias, tracks, pads inside text boxes.
    if( aMessages )
    {
        aMessages->AppendText( _( "Test texts...\n" ) );
        wxSafeYield();
    }

    testTexts();

    // update the m_drcDialog listboxes
    updatePointers();

    if( aMessages )
    {
        // no newline on this one because it is last, don't want the window
        // to unnecessarily scroll.
        aMessages->AppendText( _( "Finished" ) );
    }
}
void main()
{
	int i;
	int j;
	int k;
	int m;

#if 0
	while(1)
	{
		scanf("%s", Seqs);
		if(is_hui_wen(Seqs, strlen(Seqs)) == TRUE)
		{
			printf("yes\n");
		}
		else
		{
			printf("no\n");
		}
	}
#endif

	int seq_len = 0;
	int hui_wen_subseq_count = 0;

	scanf("%s", Seqs);					//读取待处理字符串
	seq_len = strlen(Seqs);				//待处理字符串长度

	j = 0;
	for(k = 1; k <= seq_len; k++)			//要处理的子序列长度
	{
		for(m = 0; m < k; m++)
		{
			Pointers[m] = m;				//初始化待处理子序列位置
		}	

		while (1) 
		{
			for(i = 0; i < k; i++)			//打印待处理子序列
			{
				sub_seq[i] = Seqs[Pointers[i]];
			}
			sub_seq[i] = 0;

			printf("Case %d:\n", j+1);
			j++;
			printf("%s\n", sub_seq);

			if(is_hui_wen(sub_seq, strlen(sub_seq)) == TRUE)
			{
				hui_wen_subseq_count++;
				printf("yes\n");
			}
			else
			{
				printf("no\n");
			}
			printf("\n");
			
			if (!isExhausted(Pointers, k, seq_len))
			{						//正在处理的子序列位置,序列总长度	
				updatePointers(Pointers, seq_len, k - 1);	//更新正在处理的子序列指针
			} 
			else 
			{
				break;
			}
		} 
	}

	printf("hui_wen_subseq_count = %d\n", hui_wen_subseq_count);

}