beautification
This commit is contained in:
parent
40efaf419f
commit
3312da3152
|
@ -35,9 +35,10 @@ void SetDir( int, int, int, int );
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
bool ComputeMatriceSize( WinEDA_BasePcbFrame* frame, int g_GridRoutingSize )
|
bool ComputeMatriceSize( WinEDA_BasePcbFrame* frame, int g_GridRoutingSize )
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calcule Nrows et Ncols, dimensions de la matrice de representation du BOARD
|
* Calcule Nrows et Ncols, dimensions de la matrice de representation du BOARD
|
||||||
pour les routages automatiques et calculs de zone
|
* pour les routages automatiques et calculs de zone
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
BOARD* pcb = frame->m_Pcb;
|
BOARD* pcb = frame->m_Pcb;
|
||||||
|
@ -61,6 +62,7 @@ BOARD * pcb = frame->m_Pcb;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************/
|
/*******************/
|
||||||
/* class BOARDHEAD */
|
/* class BOARDHEAD */
|
||||||
/*******************/
|
/*******************/
|
||||||
|
@ -76,20 +78,24 @@ BOARDHEAD::BOARDHEAD(void)
|
||||||
m_MemSize = 0;
|
m_MemSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOARDHEAD::~BOARDHEAD( void )
|
BOARDHEAD::~BOARDHEAD( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
int BOARDHEAD::InitBoard( void )
|
int BOARDHEAD::InitBoard( void )
|
||||||
/*****************************/
|
/*****************************/
|
||||||
|
|
||||||
/* initialize the data structures
|
/* initialize the data structures
|
||||||
retourne la taille RAM utilisee, ou -1 si defaut
|
* retourne la taille RAM utilisee, ou -1 si defaut
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii, kk;
|
int ii, kk;
|
||||||
|
|
||||||
if (Nrows <= 0 || Ncols <= 0) return(0);
|
if( Nrows <= 0 || Ncols <= 0 )
|
||||||
|
return 0;
|
||||||
m_Nrows = Nrows;
|
m_Nrows = Nrows;
|
||||||
m_Ncols = Ncols;
|
m_Ncols = Ncols;
|
||||||
|
|
||||||
|
@ -105,22 +111,26 @@ int ii, kk;
|
||||||
|
|
||||||
/* allocate Board & initialize everything to empty */
|
/* allocate Board & initialize everything to empty */
|
||||||
m_BoardSide[kk] = (BoardCell*) MyZMalloc( ii * sizeof(BoardCell) );
|
m_BoardSide[kk] = (BoardCell*) MyZMalloc( ii * sizeof(BoardCell) );
|
||||||
if( m_BoardSide[kk] == NULL) return(-1);
|
if( m_BoardSide[kk] == NULL )
|
||||||
|
return -1;
|
||||||
|
|
||||||
/***** allocate Distances *****/
|
/***** allocate Distances *****/
|
||||||
m_DistSide[kk] = (DistCell*) MyZMalloc( ii * sizeof(DistCell) );
|
m_DistSide[kk] = (DistCell*) MyZMalloc( ii * sizeof(DistCell) );
|
||||||
if (m_DistSide[kk] == NULL) return(-1);
|
if( m_DistSide[kk] == NULL )
|
||||||
|
return -1;
|
||||||
|
|
||||||
/***** allocate Dir (chars) *****/
|
/***** allocate Dir (chars) *****/
|
||||||
m_DirSide[kk] = (char*) MyZMalloc( ii );
|
m_DirSide[kk] = (char*) MyZMalloc( ii );
|
||||||
if (m_DirSide[kk] == NULL) return( -1 );
|
if( m_DirSide[kk] == NULL )
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MemSize = m_Layers * ii * ( sizeof(BoardCell) + sizeof(DistCell) + sizeof(char) );
|
m_MemSize = m_Layers * ii * ( sizeof(BoardCell) + sizeof(DistCell) + sizeof(char) );
|
||||||
|
|
||||||
return(m_MemSize);
|
return m_MemSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************/
|
/*********************************/
|
||||||
void BOARDHEAD::UnInitBoard( void )
|
void BOARDHEAD::UnInitBoard( void )
|
||||||
/*********************************/
|
/*********************************/
|
||||||
|
@ -155,20 +165,20 @@ int ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
void PlaceCells( BOARD* Pcb, int net_code, int flag )
|
void PlaceCells( BOARD* Pcb, int net_code, int flag )
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
/* Initialise les cellules du board a la valeur HOLE et VIA_IMPOSSIBLE
|
|
||||||
selon les marges d'isolement
|
|
||||||
les elements de net_code = net_code ne seront pas places comme occupe
|
|
||||||
mais en VIA_IMPOSSIBLE uniquement
|
|
||||||
Pour Routage 1 seule face:
|
|
||||||
le plan BOTTOM est utilise
|
|
||||||
et Route_Layer_BOTTOM = Route_Layer_TOP
|
|
||||||
|
|
||||||
Selon les bits = 1 du parametre flag:
|
/* Initialise les cellules du board a la valeur HOLE et VIA_IMPOSSIBLE
|
||||||
si FORCE_PADS : tous les pads seront places meme ceux de meme net_code
|
* selon les marges d'isolement
|
||||||
|
* les elements de net_code = net_code ne seront pas places comme occupe
|
||||||
|
* mais en VIA_IMPOSSIBLE uniquement
|
||||||
|
* Pour Routage 1 seule face:
|
||||||
|
* le plan BOTTOM est utilise
|
||||||
|
* et Route_Layer_BOTTOM = Route_Layer_TOP
|
||||||
|
*
|
||||||
|
* Selon les bits = 1 du parametre flag:
|
||||||
|
* si FORCE_PADS : tous les pads seront places meme ceux de meme net_code
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -212,7 +222,8 @@ int masque_layer;
|
||||||
{
|
{
|
||||||
TRACK* TmpSegm = new TRACK( NULL );
|
TRACK* TmpSegm = new TRACK( NULL );
|
||||||
TmpSegm->m_Layer = ( (EDGE_MODULE*) PtModStruct )->m_Layer;
|
TmpSegm->m_Layer = ( (EDGE_MODULE*) PtModStruct )->m_Layer;
|
||||||
if(TmpSegm->m_Layer == EDGE_N) TmpSegm->m_Layer = -1;
|
if( TmpSegm->m_Layer == EDGE_N )
|
||||||
|
TmpSegm->m_Layer = -1;
|
||||||
|
|
||||||
TmpSegm->m_Start = ( (EDGE_MODULE*) PtModStruct )->m_Start;
|
TmpSegm->m_Start = ( (EDGE_MODULE*) PtModStruct )->m_Start;
|
||||||
TmpSegm->m_End = ( (EDGE_MODULE*) PtModStruct )->m_End;
|
TmpSegm->m_End = ( (EDGE_MODULE*) PtModStruct )->m_End;
|
||||||
|
@ -228,7 +239,8 @@ int masque_layer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,6 +273,7 @@ int masque_layer;
|
||||||
TmpSegm->m_NetCode = -1;
|
TmpSegm->m_NetCode = -1;
|
||||||
|
|
||||||
TraceSegmentPcb( Pcb, TmpSegm, type_cell, marge, WRITE_CELL );
|
TraceSegmentPcb( Pcb, TmpSegm, type_cell, marge, WRITE_CELL );
|
||||||
|
|
||||||
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
|
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
|
||||||
delete TmpSegm;
|
delete TmpSegm;
|
||||||
break;
|
break;
|
||||||
|
@ -268,7 +281,8 @@ int masque_layer;
|
||||||
|
|
||||||
case TYPETEXTE:
|
case TYPETEXTE:
|
||||||
PtText = (TEXTE_PCB*) PtStruct;
|
PtText = (TEXTE_PCB*) PtStruct;
|
||||||
if(PtText->GetLength() == 0 ) break;
|
if( PtText->GetLength() == 0 )
|
||||||
|
break;
|
||||||
ux0 = PtText->m_Pos.x; uy0 = PtText->m_Pos.y;
|
ux0 = PtText->m_Pos.x; uy0 = PtText->m_Pos.y;
|
||||||
|
|
||||||
dx = PtText->Pitch() * PtText->GetLength();
|
dx = PtText->Pitch() * PtText->GetLength();
|
||||||
|
@ -290,7 +304,8 @@ int masque_layer;
|
||||||
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +313,8 @@ int masque_layer;
|
||||||
pt_segm = Pcb->m_Track;
|
pt_segm = Pcb->m_Track;
|
||||||
for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
|
for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
|
||||||
{
|
{
|
||||||
if(net_code == pt_segm->m_NetCode) continue;
|
if( net_code == pt_segm->m_NetCode )
|
||||||
|
continue;
|
||||||
TraceSegmentPcb( Pcb, pt_segm, HOLE, marge, WRITE_CELL );
|
TraceSegmentPcb( Pcb, pt_segm, HOLE, marge, WRITE_CELL );
|
||||||
TraceSegmentPcb( Pcb, pt_segm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
TraceSegmentPcb( Pcb, pt_segm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||||
}
|
}
|
||||||
|
@ -307,12 +323,14 @@ int masque_layer;
|
||||||
pt_segm = (TRACK*) Pcb->m_Zone;
|
pt_segm = (TRACK*) Pcb->m_Zone;
|
||||||
for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
|
for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
|
||||||
{
|
{
|
||||||
if(net_code == pt_segm->m_NetCode) continue;
|
if( net_code == pt_segm->m_NetCode )
|
||||||
|
continue;
|
||||||
TraceSegmentPcb( Pcb, pt_segm, HOLE, marge, WRITE_CELL );
|
TraceSegmentPcb( Pcb, pt_segm, HOLE, marge, WRITE_CELL );
|
||||||
TraceSegmentPcb( Pcb, pt_segm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
TraceSegmentPcb( Pcb, pt_segm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu )
|
int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu )
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
|
@ -331,9 +349,12 @@ wxString msg;
|
||||||
for( ii = Pcb->GetNumRatsnests(); ii > 0; ii--, pt_rats++ )
|
for( ii = Pcb->GetNumRatsnests(); ii > 0; ii--, pt_rats++ )
|
||||||
{
|
{
|
||||||
/* On ne route que les chevelus actifs et routables */
|
/* On ne route que les chevelus actifs et routables */
|
||||||
if( (pt_rats->status & CH_ACTIF) == 0) continue;
|
if( (pt_rats->status & CH_ACTIF) == 0 )
|
||||||
if( pt_rats->status & CH_UNROUTABLE) continue;
|
continue;
|
||||||
if( (pt_rats->status & CH_ROUTE_REQ) == 0 ) continue;
|
if( pt_rats->status & CH_UNROUTABLE )
|
||||||
|
continue;
|
||||||
|
if( (pt_rats->status & CH_ROUTE_REQ) == 0 )
|
||||||
|
continue;
|
||||||
pt_pad = pt_rats->pad_start;
|
pt_pad = pt_rats->pad_start;
|
||||||
|
|
||||||
current_net_code = pt_pad->m_NetCode;
|
current_net_code = pt_pad->m_NetCode;
|
||||||
|
@ -345,7 +366,7 @@ wxString msg;
|
||||||
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r1,
|
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r1,
|
||||||
pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y );
|
pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y );
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
c1 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
|
c1 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
|
||||||
if( c1 < 0 || c1 >= Ncols )
|
if( c1 < 0 || c1 >= Ncols )
|
||||||
|
@ -353,7 +374,7 @@ wxString msg;
|
||||||
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c1,
|
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c1,
|
||||||
pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x );
|
pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x );
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pt_pad = pt_rats->pad_end;
|
pt_pad = pt_rats->pad_end;
|
||||||
|
@ -364,7 +385,7 @@ wxString msg;
|
||||||
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r2,
|
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r2,
|
||||||
pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y );
|
pt_pad->m_Pos.y, Pcb->m_BoundaryBox.m_Pos.y );
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
c2 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
|
c2 = (pt_pad->m_Pos.x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
|
||||||
if( c2 < 0 || c2 >= Ncols )
|
if( c2 < 0 || c2 >= Ncols )
|
||||||
|
@ -372,28 +393,28 @@ wxString msg;
|
||||||
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c2,
|
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c2,
|
||||||
pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x );
|
pt_pad->m_Pos.x, Pcb->m_BoundaryBox.m_Pos.x );
|
||||||
DisplayError( NULL, msg );
|
DisplayError( NULL, msg );
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWork( r1, c1, current_net_code, r2, c2, pt_ch, 0 ); Ntotal++;
|
SetWork( r1, c1, current_net_code, r2, c2, pt_ch, 0 ); Ntotal++;
|
||||||
}
|
}
|
||||||
|
|
||||||
SortWork();
|
SortWork();
|
||||||
return(Ntotal);
|
return Ntotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
BoardCell GetCell( int row, int col, int side )
|
BoardCell GetCell( int row, int col, int side )
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
/* fetch board cell :
|
/* fetch board cell :
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
BoardCell* p;
|
BoardCell* p;
|
||||||
|
|
||||||
p = Board.m_BoardSide[side];
|
p = Board.m_BoardSide[side];
|
||||||
return( p[row*Ncols +col] );
|
return p[row * Ncols + col];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,6 +444,7 @@ BoardCell *p;
|
||||||
p[r * Ncols + c] |= x;
|
p[r * Ncols + c] |= x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
/* void XorCell(int r,int c,int s,BoardCell x ) */
|
/* void XorCell(int r,int c,int s,BoardCell x ) */
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
@ -448,6 +470,7 @@ BoardCell *p;
|
||||||
p[r * Ncols + c] &= x;
|
p[r * Ncols + c] &= x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* void AddCell(int r,int c,int s,BoardCell x ) */
|
/* void AddCell(int r,int c,int s,BoardCell x ) */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
@ -461,7 +484,6 @@ BoardCell *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* DistCell GetDist(int r,int c,int s ) */
|
/* DistCell GetDist(int r,int c,int s ) */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -472,7 +494,7 @@ DistCell GetDist(int r,int c,int s ) /* fetch distance cell */
|
||||||
DistCell* p;
|
DistCell* p;
|
||||||
|
|
||||||
p = Board.m_DistSide[s];
|
p = Board.m_DistSide[s];
|
||||||
return( p[r*Ncols+c] );
|
return p[r * Ncols + c];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -500,7 +522,7 @@ int GetDir(int r,int c,int s )
|
||||||
char* p;
|
char* p;
|
||||||
|
|
||||||
p = Board.m_DirSide[s];
|
p = Board.m_DirSide[s];
|
||||||
return( (int)(p[r*Ncols+c]) );
|
return (int) (p[r * Ncols + c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -509,7 +531,6 @@ char *p;
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
|
|
||||||
/* store direction cell */
|
/* store direction cell */
|
||||||
|
|
||||||
void SetDir( int r, int c, int s, int x )
|
void SetDir( int r, int c, int s, int x )
|
||||||
{
|
{
|
||||||
char* p;
|
char* p;
|
||||||
|
@ -517,4 +538,3 @@ char *p;
|
||||||
p = Board.m_DirSide[s];
|
p = Board.m_DirSide[s];
|
||||||
p[r * Ncols + c] = (char) x;
|
p[r * Ncols + c] = (char) x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue