Commit 654045f2 authored by charras's avatar charras

code cleaning

parent 1b1be195
...@@ -963,7 +963,6 @@ void Build_PlacedPads_List( BOARD* aPcb ) ...@@ -963,7 +963,6 @@ void Build_PlacedPads_List( BOARD* aPcb )
aPcb->m_Status_Pcb |= LISTE_PAD_OK; aPcb->m_Status_Pcb |= LISTE_PAD_OK;
aPcb->m_Status_Pcb &= ~(LISTE_CHEVELU_OK | CHEVELU_LOCAL_OK); aPcb->m_Status_Pcb &= ~(LISTE_CHEVELU_OK | CHEVELU_LOCAL_OK);
adr_lowmem = buf_work;
} }
...@@ -1124,7 +1123,6 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC ) ...@@ -1124,7 +1123,6 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
if( !( (*pt_Dmod)->m_ModuleStatus & MODULE_to_PLACE ) ) if( !( (*pt_Dmod)->m_ModuleStatus & MODULE_to_PLACE ) )
continue; continue;
pcbframe->GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; pcbframe->GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK;
adr_lowmem = buf_work;
(*pt_Dmod)->DisplayInfo( pcbframe ); (*pt_Dmod)->DisplayInfo( pcbframe );
pcbframe->build_ratsnest_module( DC, *pt_Dmod ); pcbframe->build_ratsnest_module( DC, *pt_Dmod );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "id.h" #include "id.h"
bool CreateHeaderInfoData( FILE* file, WinEDA_PcbFrame* frame ); bool CreateHeaderInfoData( FILE* file, WinEDA_PcbFrame* frame );
static int* CreateTracksInfoData( FILE* file, BOARD* pcb ); static void CreateTracksInfoData( FILE* file, BOARD* pcb );
static void CreateBoardSection( FILE* file, BOARD* pcb ); static void CreateBoardSection( FILE* file, BOARD* pcb );
static void CreateComponentsSection( FILE* file, BOARD* pcb ); static void CreateComponentsSection( FILE* file, BOARD* pcb );
static void CreateDevicesSection( FILE* file, BOARD* pcb ); static void CreateDevicesSection( FILE* file, BOARD* pcb );
...@@ -71,7 +71,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) ...@@ -71,7 +71,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
wildcard = _( "GenCAD board files (.gcd)|*.gcd" ); wildcard = _( "GenCAD board files (.gcd)|*.gcd" );
fn.SetExt( ext ); fn.SetExt( ext );
wxFileDialog dlg( this, _( "Save GenCAD Board File" ), wxEmptyString, wxFileDialog dlg( this, _( "Save GenCAD Board File" ), wxGetCwd(),
fn.GetFullName(), wildcard, fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
...@@ -691,7 +691,7 @@ void CreateBoardSection( FILE* file, BOARD* pcb ) ...@@ -691,7 +691,7 @@ void CreateBoardSection( FILE* file, BOARD* pcb )
/****************************************************/ /****************************************************/
int* CreateTracksInfoData( FILE* file, BOARD* pcb ) void CreateTracksInfoData( FILE* file, BOARD* pcb )
/****************************************************/ /****************************************************/
/* Creation de la section "$TRACKS" /* Creation de la section "$TRACKS"
...@@ -701,72 +701,60 @@ int* CreateTracksInfoData( FILE* file, BOARD* pcb ) ...@@ -701,72 +701,60 @@ int* CreateTracksInfoData( FILE* file, BOARD* pcb )
* TRACK <name> <width> * TRACK <name> <width>
* $ENDTRACK * $ENDTRACK
* *
* on attribut ici comme nom l'epaisseur des traits precede de "TRACK": ex * on attribue ici comme nom l'epaisseur des traits precede de "TRACK": ex
* pour une largeur de 120 : nom = "TRACK120". * pour une largeur de 120 : nom = "TRACK120".
*/ */
{ {
TRACK* track; TRACK* track;
int* trackinfo, * ptinfo; int last_width = -1;
/* recherche des epaisseurs utilisees pour les traces: */ /* recherche des epaisseurs utilisees pour les traces: */
trackinfo = (int*) adr_lowmem; std::vector <int> trackinfo;
*trackinfo = -1;
unsigned ii;
for( track = pcb->m_Track; track != NULL; track = track->Next() ) for( track = pcb->m_Track; track != NULL; track = track->Next() )
{ {
if( *trackinfo != track->m_Width ) // recherche d'une epaisseur deja utilisee if( last_width != track->m_Width ) // recherche d'une epaisseur deja utilisee
{ {
ptinfo = (int*) adr_lowmem; for ( ii = 0; ii < trackinfo.size(); ii++ )
while( *ptinfo >= 0 )
{ {
if( *ptinfo != track->m_Width ) if( trackinfo[ii] == track->m_Width )
ptinfo++;
else
break; break;
} }
trackinfo = ptinfo; if ( ii == trackinfo.size() ) // not found
if( *ptinfo < 0 ) trackinfo.push_back(track->m_Width);
{
*ptinfo = track->m_Width; last_width = track->m_Width;
ptinfo++; *ptinfo = -1;
}
} }
} }
for( track = pcb->m_Zone; track != NULL; track = track->Next() ) for( track = pcb->m_Zone; track != NULL; track = track->Next() )
{ {
if( *trackinfo != track->m_Width ) // recherche d'une epaisseur deja utilisee if( last_width != track->m_Width ) // recherche d'une epaisseur deja utilisee
{ {
ptinfo = (int*) adr_lowmem; for ( ii = 0; ii < trackinfo.size(); ii++ )
while( *ptinfo >= 0 )
{ {
if( *ptinfo != track->m_Width ) if( trackinfo[ii] == track->m_Width )
ptinfo++;
else
break; break;
} }
trackinfo = ptinfo; if ( ii == trackinfo.size() ) // not found
if( *ptinfo < 0 ) trackinfo.push_back(track->m_Width);
{
*ptinfo = track->m_Width; last_width = track->m_Width;
ptinfo++; *ptinfo = -1;
}
} }
} }
// Write data // Write data
fputs( "$TRACKS\n", file ); fputs( "$TRACKS\n", file );
for( trackinfo = (int*) adr_lowmem; *trackinfo >= 0; trackinfo++ ) for( ii = 0; ii < trackinfo.size(); ii++ )
{ {
fprintf( file, "TRACK TRACK%d %d\n", *trackinfo, *trackinfo ); fprintf( file, "TRACK TRACK%d %d\n", trackinfo[ii], trackinfo[ii] );
} }
fputs( "$ENDTRACKS\n\n", file ); fputs( "$ENDTRACKS\n\n", file );
return (int*) adr_lowmem;
} }
......
...@@ -149,9 +149,6 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query ) ...@@ -149,9 +149,6 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
/* init pointeurs et variables */ /* init pointeurs et variables */
GetScreen()->m_FileName.Empty(); GetScreen()->m_FileName.Empty();
memset( buf_work, 0, BUFMEMSIZE );
adr_lowmem = adr_max = buf_work;
SetCurItem( NULL ); SetCurItem( NULL );
/* Init parametres de gestion */ /* Init parametres de gestion */
......
...@@ -42,7 +42,6 @@ extern PARAM_CFG_BASE* ParamCfgList[]; ...@@ -42,7 +42,6 @@ extern PARAM_CFG_BASE* ParamCfgList[];
char* buf_work = NULL; /* pointeur sur le buffer de travail */ char* buf_work = NULL; /* pointeur sur le buffer de travail */
char* adr_lowmem = NULL; /* adresse de base memoire de calcul disponible*/ char* adr_lowmem = NULL; /* adresse de base memoire de calcul disponible*/
char* adr_himem = NULL; /* adresse haute limite de la memoire disponible*/
char* adr_max = NULL; /* adresse haute maxi utilisee pour la memoire */ char* adr_max = NULL; /* adresse haute maxi utilisee pour la memoire */
int Angle_Rot_Module; int Angle_Rot_Module;
...@@ -143,7 +142,6 @@ Changing extension to .brd." ), ...@@ -143,7 +142,6 @@ Changing extension to .brd." ),
/* allocation de la memoire pour le fichier et autres buffers: */ /* allocation de la memoire pour le fichier et autres buffers: */
/* On reserve BUFMEMSIZE octets de ram pour calcul */ /* On reserve BUFMEMSIZE octets de ram pour calcul */
buf_work = adr_lowmem = (char*) MyZMalloc( BUFMEMSIZE ); /* adresse de la zone de calcul */ buf_work = adr_lowmem = (char*) MyZMalloc( BUFMEMSIZE ); /* adresse de la zone de calcul */
adr_himem = adr_lowmem + BUFMEMSIZE; /* adr limite haute */
adr_max = adr_lowmem; adr_max = adr_lowmem;
if( adr_lowmem == NULL ) if( adr_lowmem == NULL )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment