Commit 6791556e authored by charras's avatar charras

Pcbnew: fixed a recent bug that could be creates errors in rats nest...

Pcbnew: fixed a recent bug that could be creates errors in rats nest calculations (forgotten rats nets)
parent 7fc9e5f1
......@@ -8,7 +8,11 @@
#include "appl_wxstruct.h"
#define BUILD_VERSION wxT("(20090602-unstable)")
#define BUILD_VERSION "(20090621-unstable)"
#ifndef KICAD_ABOUT_VERSION
#define KICAD_ABOUT_VERSION BUILD_VERSION
#endif
wxString g_BuildVersion
......@@ -16,7 +20,7 @@ wxString g_BuildVersion
#include "version.h"
( wxT( KICAD_SVN_VERSION ) )
#else
( BUILD_VERSION )
( wxT( BUILD_VERSION ) )
#endif
;
......@@ -25,7 +29,7 @@ wxString g_BuildAboutVersion
# include "version.h"
( wxT( KICAD_ABOUT_VERSION ) )
#else
( BUILD_VERSION )
( wxT( BUILD_VERSION ) )
#endif
;
......
......@@ -4,16 +4,11 @@
/* read the generic netlist created by eeschema and convert it to a pads-pcb form
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined( HAVE_STRINGS_H )
#include <strings.h>
#endif
#include <ctype.h>
/* Pads-pcb sample:
......@@ -109,6 +104,7 @@
char* GetLine( FILE* File, char* Line, int* LineNum, int SizeLine );
int ReadAndWriteComponentDataSection( FILE* InFile, FILE* OutFile, int* LineNumber );
int ReadAndWriteNetsDataSection( FILE* InFile, FILE* OutFile, int* LineNumber );
int AreStringsEqual( const char * src, const char * ref );
class ComponentDataClass
......@@ -174,12 +170,12 @@ int main( int argc, char** argv )
/* Read and write data lines */
while( GetLine( InFile, Line, &LineNumber, sizeof(Line) ) )
{
if( stricmp( Line, "$BeginComponent" ) == 0 )
if( AreStringsEqual( Line, "$BeginComponent" ) )
{
ReadAndWriteComponentDataSection( InFile, OutFile, &LineNumber );
continue;
}
if( stricmp( Line, "$BeginNets" ) == 0 )
if( AreStringsEqual( Line, "$BeginNets" ) )
{
fprintf( OutFile, "\n*NET*\n" );
ReadAndWriteNetsDataSection( InFile, OutFile, &LineNumber );
......@@ -215,16 +211,16 @@ int ReadAndWriteComponentDataSection( FILE* InFile, FILE* OutFile, int* LineNumb
while( GetLine( InFile, Line, LineNumber, sizeof(Line) ) )
{
if( stricmp( Line, "$BeginPinList" ) == 0 )
if( AreStringsEqual( Line, "$BeginPinList" ) )
{
while( GetLine( InFile, Line, LineNumber, sizeof(Line) ) )
if( stricmp( Line, "$EndPinList" ) == 0 )
if( AreStringsEqual( Line, "$EndPinList" ) )
break;
continue;
}
if( stricmp( Line, "$EndComponent" ) == 0 ) // Create the output for the component:
if( AreStringsEqual( Line, "$EndComponent" ) ) // Create the output for the component:
{
/* Create the line like: C2 unknown */
......@@ -237,27 +233,27 @@ int ReadAndWriteComponentDataSection( FILE* InFile, FILE* OutFile, int* LineNumb
data = strtok( NULL, "=\n\r" );
if( data == NULL )
continue;
if( stricmp( Line, "TimeStamp" ) == 0 )
if( AreStringsEqual( Line, "TimeStamp" ) )
{
ComponentData.m_TimeStamp = atol( data );
continue;
}
if( stricmp( Line, "Footprint" ) == 0 )
if( AreStringsEqual( Line, "Footprint" ) )
{
strncpy( ComponentData.m_Footprint, data, 255 );
continue;
}
if( stricmp( Line, "Reference" ) == 0 )
if( AreStringsEqual( Line, "Reference" ) )
{
strncpy( ComponentData.m_Reference, data, 255 );
continue;
}
if( stricmp( Line, "Value" ) == 0 )
if( AreStringsEqual( Line, "Value" ) )
{
strncpy( ComponentData.m_Value, data, 255 );
continue;
}
if( stricmp( Line, "Libref" ) == 0 )
if( AreStringsEqual( Line, "Libref" ) )
{
strncpy( ComponentData.m_LibRef, data, 255 );
continue;
......@@ -283,10 +279,10 @@ int ReadAndWriteNetsDataSection( FILE* InFile, FILE* OutFile, int* LineNumber )
while( GetLine( InFile, Line, LineNumber, sizeof(Line) ) )
{
if( stricmp( Line, "$EndNets" ) == 0 )
if( AreStringsEqual( Line, "$EndNets" ) )
return 0;
ident = strtok( Line, " \n\r" );
if( stricmp( ident, "Net" ) == 0 )
if( AreStringsEqual( ident, "Net" ) )
{
netnum = strtok( NULL, " \n\r" );
netname = strtok( NULL, " \"\n\r" );
......@@ -330,3 +326,32 @@ char* GetLine( FILE* File, char* Line, int* LineNum, int SizeLine )
strtok( Line, "\n\r" );
return Line;
}
/***************************************************/
int AreStringsEqual( const char * src, const char * ref )
/***************************************************/
/* Compare 2 chains, and return 0 if equal or 1 if different
* stricmp does the same job, but does not exist under all systems
*/
{
int match = 1;
while (src && ref )
{
unsigned char c1 = *src;
unsigned char c2 = *ref;
if ( c1 >= 'a' && c1 <= 'z' )
c1 += 'A' - 'a';
if ( c2 >= 'a' && c2 <= 'z' )
c2 += 'A' - 'a';
if ( c1 != c2 )
{
match = 0;
break;
}
if ( c1 == 0 || c2 == 0 )
break;
src++; ref++;
}
return match;
}
......@@ -121,7 +121,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
bool first = true;
for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
{
if( first )
if( ! first )
Name += wxT( "," );
Name += Lib->m_Name;
first = false;
......
......@@ -50,7 +50,7 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi
wxString m_SelectionChoices[] = { _("Change module"), _("Change same modules"), _("Ch. same module+value"), _("Change all") };
int m_SelectionNChoices = sizeof( m_SelectionChoices ) / sizeof( wxString );
m_Selection = new wxRadioBox( this, ID_SELECTION_CLICKED, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_SelectionNChoices, m_SelectionChoices, 1, wxRA_SPECIFY_COLS );
m_Selection = new wxRadioBox( this, ID_SELECTION_CLICKED, _("Browse Libs modules"), wxDefaultPosition, wxDefaultSize, m_SelectionNChoices, m_SelectionChoices, 1, wxRA_SPECIFY_COLS );
m_Selection->SetSelection( 0 );
bMiddleSizer->Add( m_Selection, 0, wxALL, 5 );
......
......@@ -435,7 +435,7 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_SELECTION_CLICKED</property>
<property name="label">wxRadioBox</property>
<property name="label">Browse Libs modules</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
......
This diff is collapsed.
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