Loading change_log.txt +15 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,21 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Sep-25 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ + pcbnew * got rid of reference to global display options DisplayOpt.DisplayZones from collectors.cpp so collectors.cpp can continue to be used in multiple future (non-display related) general contexts. * Moved TYPEZONE to end of AllBoardItems, added GENERAL_COLLECTOR::AllButZones to provide support of DisplayOpt.DisplayZones. * Added aHotKeyCode to PcbGeneralLocateAndDisplay() + gerbview * viewer was getting stuck in a loop when loading a bad gerber file. Fixed the bug, but line 223 through 225 of readgerb.cpp need review. * beautified a few files with uncrustify, (any I had to look at). 2007-sept-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ + pcbnew: Loading gerbview/files.cpp +191 −183 Original line number Diff line number Diff line Loading @@ -18,10 +18,12 @@ static void LoadDCodeFile(WinEDA_GerberFrame * frame, const wxString & FullFileN /********************************************************/ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) /********************************************************/ /* Gestion generale des commandes de lecture de fichiers */ { int id = event.GetId(); wxClientDC dc( DrawPanel ); DrawPanel->CursorOff( &dc ); Loading Loading @@ -104,17 +106,16 @@ wxClientDC dc(DrawPanel); } /*******************************************************************************************/ int WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName, wxDC* DC, int mode ) /*******************************************************************************************/ /* Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s retourne: 0 si fichier non lu ( annulation de commande ... ) 1 si OK * Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s * retourne: * 0 si fichier non lu ( annulation de commande ... ) * 1 si OK */ { wxString filename = FullFileName; Loading @@ -124,7 +125,9 @@ wxString path = wxPathOnly(FullFileName); if( filename == wxEmptyString ) { wxString mask = wxT( "*" ) + g_PhotoFilenameExt; mask += wxT( ";*.gbr;*.gbx;*.lgr;*.ger" ); filename = EDA_FileSelector( _( "Gerber files:" ), path, /* Chemin par defaut */ wxEmptyString, /* nom fichier par defaut */ Loading @@ -134,11 +137,14 @@ wxString path = wxPathOnly(FullFileName); 0, FALSE ); if ( filename == wxEmptyString ) return FALSE; if( filename == wxEmptyString ) return FALSE; } GetScreen()->m_FileName = filename; wxSetWorkingDirectory( path ); ChangeFileNameExt( filename, g_PenFilenameExt ); if( Read_GERBER_File( DC, GetScreen()->m_FileName, filename ) ) Loading @@ -148,18 +154,19 @@ wxString path = wxPathOnly(FullFileName); GetScreen()->SetRefreshReq(); g_SaveTime = time( NULL ); return(1); return 1; } /**********************************************************************************************/ static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName, wxDC* DC ) /**********************************************************************************************/ /* Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s retourne: 0 si fichier non lu ( annulation de commande ... ) 1 si OK * Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s * retourne: * 0 si fichier non lu ( annulation de commande ... ) * 1 si OK */ { wxString filename = FullFileName; Loading @@ -169,6 +176,7 @@ wxString filename = FullFileName; if( filename == wxEmptyString ) { wxString penfilesmask( wxT( "*" ) ); penfilesmask += g_PenFilenameExt; filename = frame->GetScreen()->m_FileName; ChangeFileNameExt( filename, g_PenFilenameExt ); Loading @@ -181,7 +189,8 @@ wxString filename = FullFileName; 0, TRUE ); if ( filename == wxEmptyString ) return; if( filename == wxEmptyString ) return; } frame->Read_D_Code_File( filename ); Loading @@ -190,10 +199,10 @@ wxString filename = FullFileName; } /*******************************************************************************/ bool WinEDA_GerberFrame::SaveGerberFile( const wxString& FullFileName, wxDC* DC ) /*******************************************************************************/ /* Sauvegarde du fichier PCB en format ASCII */ { Loading @@ -202,6 +211,7 @@ wxString filename = FullFileName; if( filename == wxEmptyString ) { wxString mask( wxT( "*" ) ); mask += g_PhotoFilenameExt; filename = EDA_FileSelector( _( "Gerber files:" ), wxEmptyString, /* Chemin par defaut */ Loading @@ -212,7 +222,8 @@ wxString filename = FullFileName; wxFD_SAVE, FALSE ); if ( filename.IsEmpty() ) return FALSE; if( filename.IsEmpty() ) return FALSE; } GetScreen()->m_FileName = filename; Loading @@ -221,6 +232,3 @@ wxString filename = FullFileName; return TRUE; } gerbview/readgerb.cpp +259 −249 Original line number Diff line number Diff line Loading @@ -11,56 +11,56 @@ #include "protos.h" /* Format Gerber : NOTES : Fonctions preparatoires: Gn = G01 interpolation lineaire ( trace de droites ) G02,G20,G21 Interpolation circulaire , sens trigo < 0 G03,G30,G31 Interpolation circulaire , sens trigo > 0 G04 commentaire G06 Interpolation parabolique G07 Interpolation cubique G10 interpolation lineaire ( echelle 10x ) G11 interpolation lineaire ( echelle 0.1x ) G12 interpolation lineaire ( echelle 0.01x ) G52 plot symbole reference par Dnn code G53 plot symbole reference par Dnn ; symbole tourne de -90 degres G54 Selection d'outil G55 Mode exposition photo G56 plot symbole reference par Dnn A code G57 affiche le symbole reference sur la console G58 plot et affiche le symbole reference sur la console G60 interpolation lineaire ( echelle 100x ) G70 Unites = Inches G71 Unites = Millimetres G74 supprime interpolation circulaire sur 360 degre, revient a G01 G75 Active interpolation circulaire sur 360 degre G90 Mode Coordonnees absolues G91 Mode Coordonnees Relatives Coordonnees X,Y X,Y sont suivies de + ou - et de m+n chiffres (non separes) m = partie entiere n = partie apres la virgule formats classiques : m = 2, n = 3 (format 2.3) m = 3, n = 4 (format 3.4) ex: G__ X00345Y-06123 D__* Outils et D_CODES numero d'outil ( identification des formes ) 1 a 99 (classique) 1 a 999 D_CODES: D01 ... D9 = codes d'action: D01 = activation de lumiere (baisser de plume) lors du déplacement D02 = extinction de lumiere (lever de plume) lors du déplacement D03 = Flash D09 = VAPE Flash D51 = precede par G54 -> Select VAPE D10 ... D255 = Indentification d'outils ( d'ouvertures ) Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H) * Fonctions preparatoires: * Gn = * G01 interpolation lineaire ( trace de droites ) * G02,G20,G21 Interpolation circulaire , sens trigo < 0 * G03,G30,G31 Interpolation circulaire , sens trigo > 0 * G04 commentaire * G06 Interpolation parabolique * G07 Interpolation cubique * G10 interpolation lineaire ( echelle 10x ) * G11 interpolation lineaire ( echelle 0.1x ) * G12 interpolation lineaire ( echelle 0.01x ) * G52 plot symbole reference par Dnn code * G53 plot symbole reference par Dnn ; symbole tourne de -90 degres * G54 Selection d'outil * G55 Mode exposition photo * G56 plot symbole reference par Dnn A code * G57 affiche le symbole reference sur la console * G58 plot et affiche le symbole reference sur la console * G60 interpolation lineaire ( echelle 100x ) * G70 Unites = Inches * G71 Unites = Millimetres * G74 supprime interpolation circulaire sur 360 degre, revient a G01 * G75 Active interpolation circulaire sur 360 degre * G90 Mode Coordonnees absolues * G91 Mode Coordonnees Relatives * * Coordonnees X,Y * X,Y sont suivies de + ou - et de m+n chiffres (non separes) * m = partie entiere * n = partie apres la virgule * formats classiques : m = 2, n = 3 (format 2.3) * m = 3, n = 4 (format 3.4) * ex: * G__ X00345Y-06123 D__* * * Outils et D_CODES * numero d'outil ( identification des formes ) * 1 a 99 (classique) * 1 a 999 * D_CODES: * * D01 ... D9 = codes d'action: * D01 = activation de lumiere (baisser de plume) lors du déplacement * D02 = extinction de lumiere (lever de plume) lors du déplacement * D03 = Flash * D09 = VAPE Flash * D51 = precede par G54 -> Select VAPE * * D10 ... D255 = Indentification d'outils ( d'ouvertures ) * Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H) */ Loading @@ -69,34 +69,33 @@ Outils et D_CODES /* Routines Locales */ /* Routine de Lecture d'un fichier de D Codes. Accepte format standard ou ALSPCB un ';' demarre un commentaire. Format Standard: tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] ex: 1, 12, 12, 0, 0, 0, 3 ; D10 Format ALSPCB: Ver , Hor , Type , Tool [,Drill] ex: 0.012, 0.012, L , D10 Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. Retourne: < 0 si erreur: -1 = Fichier non trouve -2 = Erreur lecture fichier Rang de D_code maxi lu ( nbr de dcodes ) Representation interne: Les lignes sont représentées par des TRACKS standards Les Flash sont représentées par des DRAWSEGMENTS - ronds ou ovales: DRAWSEGMENTS - rectangles: DRAWSEGMENTS la reference aux D-CODES est placée dans le membre m_NetCode * Accepte format standard ou ALSPCB * un ';' demarre un commentaire. * * Format Standard: * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] * ex: 1, 12, 12, 0, 0, 0, 3 ; D10 * * Format ALSPCB: * Ver , Hor , Type , Tool [,Drill] * ex: 0.012, 0.012, L , D10 * * Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. * Retourne: * < 0 si erreur: * -1 = Fichier non trouve * -2 = Erreur lecture fichier * Rang de D_code maxi lu ( nbr de dcodes ) * * * Representation interne: * * Les lignes sont représentées par des TRACKS standards * Les Flash sont représentées par des DRAWSEGMENTS * - ronds ou ovales: DRAWSEGMENTS * - rectangles: DRAWSEGMENTS * la reference aux D-CODES est placée dans le membre m_NetCode */ Loading @@ -107,12 +106,12 @@ bool WinEDA_GerberFrame::Read_GERBER_File(wxDC * DC, /********************************************************/ /* Lecture de 1 fichier gerber. Format Imperial Absolu fin de bloc = * CrLf apres chaque commande G codes repetes * Format * Imperial * Absolu * fin de bloc = * * CrLf apres chaque commande * G codes repetes */ { int G_commande = 0, D_commande = 0; /* Numero de commande G et D codes */ Loading @@ -131,6 +130,7 @@ int error = 0; } gerber_layer = g_GERBER_Descr_List[layer]; /* Mise a jour de l'echelle gerber : */ gerber_layer->ResetDefaultValues(); Loading @@ -139,7 +139,8 @@ int error = 0; if( gerber_layer->m_Current_File == 0 ) { msg = _( "File " ) + GERBER_FullFileName + _( " not found" ); DisplayError(this, msg, 10); return FALSE; DisplayError( this, msg, 10 ); return FALSE; } gerber_layer->m_FileName = GERBER_FullFileName; Loading @@ -153,13 +154,18 @@ wxBusyCursor show_wait; { if( fgets( Line, 255, gerber_layer->m_Current_File ) == NULL ) // E.O.F { if ( gerber_layer->m_FilesPtr == 0 ) break; if( gerber_layer->m_FilesPtr == 0 ) break; fclose( gerber_layer->m_Current_File ); gerber_layer->m_FilesPtr--; gerber_layer->m_Current_File = gerber_layer->m_FilesList[gerber_layer->m_FilesPtr]; continue; } text = StrPurge( Line ); while( text && *text ) Loading @@ -179,7 +185,8 @@ wxBusyCursor show_wait; case 'M': // End file gerber_layer->m_CommandState = CMD_IDLE; while ( *text ) text ++; while( *text ) text++; break; case 'G': /* Ligne type Gxx : commande */ Loading Loading @@ -212,22 +219,28 @@ wxBusyCursor show_wait; if( gerber_layer->m_CommandState != ENTER_RS274X_CMD ) { gerber_layer->m_CommandState = ENTER_RS274X_CMD; gerber_layer->ReadRS274XCommand(this, DC, Line, text); if( !gerber_layer->ReadRS274XCommand( this, DC, Line, text ) ) { error++; } } else //Error { wxBell(); error++; wxBell(); error++; gerber_layer->m_CommandState = CMD_IDLE; text++; } break; default: text ++; error++; text++; error++; break; } // end switch (*text) } // end while (text } // end while (TRUE) } } } if( error ) { Loading Loading @@ -259,7 +272,8 @@ wxBusyCursor show_wait; TRUE ); } else DCodeFileName = D_Code_FullFileName; else DCodeFileName = D_Code_FullFileName; if( !DCodeFileName.IsEmpty() ) { Loading @@ -270,7 +284,3 @@ wxBusyCursor show_wait; return TRUE; } gerbview/rs274x.cpp +475 −416 Original line number Diff line number Diff line Loading @@ -10,13 +10,12 @@ #include "protos.h" #define IsNumber(x) ( ( ((x) >= '0') && ((x) <='9') ) ||\ ((x) == '-') || ((x) == '+') || ((x) == '.') || ((x) == ',')) #define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \ || ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) || ( (x) == ',' ) ) #define CODE( x, y ) ( (x << 8) + (y) ) enum rs274x_parameters { enum rs274x_parameters { FORMAT_STATEMENT_COMMAND = CODE( 'F', 'S' ), AXIS_SELECT = CODE( 'A', 'S' ), MIRROR_IMAGE = CODE( 'M', 'I' ), Loading @@ -41,7 +40,6 @@ enum rs274x_parameters KNOCKOUT = CODE( 'K', 'O' ), STEP_AND_REPEAT = CODE( 'S', 'P' ), ROTATE = CODE( 'R', 'O' ) }; /* Variables locales : */ Loading @@ -50,7 +48,7 @@ enum rs274x_parameters static bool ReadApertureMacro( char* buff, char*& text, FILE* gerber_file ); /* Lit 2 codes ascii du texte point par text retourne le code correspondant ou -1 si erreur * retourne le code correspondant ou -1 si erreur */ static int ReadXCommand( char*& text ) { Loading @@ -60,12 +58,14 @@ int result; { result = (*text) << 8; text++; } else return -1; else return -1; if( text && *text ) { result += (*text) & 255; text++; } else return -1; else return -1; return result; } Loading @@ -76,7 +76,10 @@ static int ReadInt(char * &text) { int nb = 0; while ( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text ) { Loading @@ -85,8 +88,10 @@ int nb = 0; nb *= 10; nb += *text & 0x0F; text++; } else break; else break; } return nb; } Loading @@ -99,7 +104,10 @@ double nb = 0.0; char buf[256], * ptchar; ptchar = buf; while ( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text ) { if( IsNumber( *text ) ) Loading @@ -107,28 +115,32 @@ char buf[256], * ptchar; *ptchar = *text; text++; ptchar++; } else break; else break; } *ptchar = 0; nb = atof( buf ); return nb; } /****************************************************************************/ bool GERBER_Descr::ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC, char* buff, char*& text ) /****************************************************************************/ /* Lit toutes les commandes RS274X jusqu'a trouver de code de fin % appelle ExecuteRS274XCommand() pour chaque commande trouve * appelle ExecuteRS274XCommand() pour chaque commande trouve */ { bool ok = true; int code_command; bool eof = FALSE; text++; do for(;;) { while( *text ) { Loading @@ -137,7 +149,7 @@ bool eof = FALSE; case '%': // End commande text++; m_CommandState = CMD_IDLE; return TRUE; goto exit; // success completion case ' ': case '\r': Loading @@ -151,23 +163,32 @@ bool eof = FALSE; default: code_command = ReadXCommand( text ); ExecuteRS274XCommand(code_command, buff, text); ok = ExecuteRS274XCommand( code_command, buff, text ); if( !ok ) goto exit; break; } } // End of current line if ( fgets(buff,255,m_Current_File) == NULL ) eof = TRUE; if( fgets( buff, 255, m_Current_File ) == NULL ) { ok = false; break; } text = buff; } while( !eof ); } return FALSE; exit: return ok; } /*******************************************************************************/ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text ) /*******************************************************************************/ /* Execute 1 commande RS274X */ { Loading @@ -186,6 +207,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; { case FORMAT_STATEMENT_COMMAND: xy_seq_len = 2; while( *text != '*' ) { switch( *text ) Loading @@ -193,20 +215,25 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case ' ': text++; break; case 'L': // No Leading 0 m_NoTrailingZeros = FALSE; text++; break; case 'T': // No trailing 0 m_NoTrailingZeros = TRUE; text++; break; case 'A': // Absolute coord m_Relative = FALSE; text++; break; case 'I': // Absolute coord m_Relative = TRUE; text++; break; case 'N': // Sequence code (followed by the number of digits for the X,Y command text++; xy_seq_char = *text; text++; Loading @@ -222,7 +249,8 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; m_FmtScale.x = *text - '0'; // = nb chiffres apres la virgule m_FmtLen.x = ctmp + m_FmtScale.x; // = nb total de chiffres } else { else { m_FmtScale.y = *text - '0'; m_FmtLen.y = ctmp + m_FmtScale.y; } Loading @@ -238,6 +266,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; break; } } break; case AXIS_SELECT: Loading @@ -247,8 +276,10 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case MODE_OF_UNITS: code = ReadXCommand( text ); if ( code == INCH ) m_GerbMetric = FALSE; else if ( code == MILLIMETER ) m_GerbMetric = TRUE; if( code == INCH ) m_GerbMetric = FALSE; else if( code == MILLIMETER ) m_GerbMetric = TRUE; conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT; break; Loading @@ -271,6 +302,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; break; } } break; case SCALE_FACTOR: Loading @@ -284,7 +316,8 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case ROTATE: msg.Printf( _( "Command <%c%c> ignored by Gerbview" ), (command >> 8) & 0xFF, command & 0xFF ); if ( g_DebugLevel > 0 )wxMessageBox(msg); if( g_DebugLevel > 0 ) wxMessageBox( msg ); break; case IMAGE_NAME: Loading @@ -293,16 +326,21 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; { m_Name.Append( *text ); text++; } break; case IMAGE_POLARITY: if ( strnicmp(text, "NEG", 3 ) == 0 ) m_ImageNegative = TRUE; else m_ImageNegative = FALSE; if( strnicmp( text, "NEG", 3 ) == 0 ) m_ImageNegative = TRUE; else m_ImageNegative = FALSE; break; case LAYER_POLARITY: if ( * text == 'C' ) m_LayerNegative = TRUE; else m_LayerNegative = FALSE; if( *text == 'C' ) m_LayerNegative = TRUE; else m_LayerNegative = FALSE; break; case APERTURE_MACRO: Loading Loading @@ -342,17 +380,21 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; code = ReadInt( text ); ctmp = *text; dcode = ReturnToolDescr( m_Layer, code ); if ( dcode == NULL ) break; if( dcode == NULL ) break; if( text[1] == ',' ) // Tool usuel (C,R,O,P) { text += 2; // text pointe size ( 1er modifier) dcode->m_Size.x = dcode->m_Size.y = (int) round( ReadDouble( text ) * conv_scale ); switch( ctmp ) { case 'C': // Circle dcode->m_Shape = GERB_CIRCLE; while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; Loading @@ -360,7 +402,9 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; (int) round( ReadDouble( text ) * conv_scale ); dcode->m_DrillShape = 1; } while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; Loading @@ -374,14 +418,18 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case 'O': // ovale case 'R': // rect dcode->m_Shape = (ctmp == 'O') ? GERB_OVALE : GERB_RECT; while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; dcode->m_Size.y = (int) round( ReadDouble( text ) * conv_scale ); } while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; Loading @@ -389,7 +437,9 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; (int) round( ReadDouble( text ) * conv_scale ); dcode->m_DrillShape = 1; } while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'Y' ) { text++; Loading @@ -414,26 +464,32 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; break; } GetEndOfBlock( buff, text, m_Current_File ); ok = GetEndOfBlock( buff, text, m_Current_File ); return ok; } /*****************************************************************/ bool GetEndOfBlock( char* buff, char*& text, FILE* gerber_file ) /*****************************************************************/ { bool eof = FALSE; do { for(;;) { while( (text < buff + 255) && *text ) { if ( *text == '*' ) return TRUE; if ( *text == '%' ) return TRUE; if( *text == '*' ) return TRUE; if( *text == '%' ) return TRUE; text++; } if ( fgets(buff,255,gerber_file) == NULL ) eof = TRUE; if( fgets( buff, 255, gerber_file ) == NULL ) break; text = buff; } while( ! eof); } return FALSE; } Loading @@ -449,12 +505,14 @@ int macro_type = 0; // Read macro name while( (text < buff + 255) && *text ) { if ( *text == '*' ) break; if( *text == '*' ) break; macro_name.Append( *text ); text++; } if ( g_DebugLevel > 0 ) wxMessageBox(macro_name, wxT("macro name")); if( g_DebugLevel > 0 ) wxMessageBox( macro_name, wxT( "macro name" ) ); text = buff; fgets( buff, 255, gerber_file ); Loading @@ -463,9 +521,10 @@ int macro_type = 0; while( (text < buff + 255) && *text ) { if ( *text == '*' ) return TRUE; if( *text == '*' ) return TRUE; text++; } return FALSE; } include/class_collector.h +3 −3 Original line number Diff line number Diff line Loading @@ -112,11 +112,11 @@ public: /** * Function Remove * removes the item at item_position (first position is 0); * @param item_position index. * @param ndx The index into the list. */ void Remove( unsigned int item_position ) void Remove( int ndx ) { m_List.erase( m_List.begin() + item_position ); m_List.erase( m_List.begin() + (unsigned) ndx ); } /** Loading Loading
change_log.txt +15 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,21 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Sep-25 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ + pcbnew * got rid of reference to global display options DisplayOpt.DisplayZones from collectors.cpp so collectors.cpp can continue to be used in multiple future (non-display related) general contexts. * Moved TYPEZONE to end of AllBoardItems, added GENERAL_COLLECTOR::AllButZones to provide support of DisplayOpt.DisplayZones. * Added aHotKeyCode to PcbGeneralLocateAndDisplay() + gerbview * viewer was getting stuck in a loop when loading a bad gerber file. Fixed the bug, but line 223 through 225 of readgerb.cpp need review. * beautified a few files with uncrustify, (any I had to look at). 2007-sept-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ + pcbnew: Loading
gerbview/files.cpp +191 −183 Original line number Diff line number Diff line Loading @@ -18,10 +18,12 @@ static void LoadDCodeFile(WinEDA_GerberFrame * frame, const wxString & FullFileN /********************************************************/ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) /********************************************************/ /* Gestion generale des commandes de lecture de fichiers */ { int id = event.GetId(); wxClientDC dc( DrawPanel ); DrawPanel->CursorOff( &dc ); Loading Loading @@ -104,17 +106,16 @@ wxClientDC dc(DrawPanel); } /*******************************************************************************************/ int WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName, wxDC* DC, int mode ) /*******************************************************************************************/ /* Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s retourne: 0 si fichier non lu ( annulation de commande ... ) 1 si OK * Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s * retourne: * 0 si fichier non lu ( annulation de commande ... ) * 1 si OK */ { wxString filename = FullFileName; Loading @@ -124,7 +125,9 @@ wxString path = wxPathOnly(FullFileName); if( filename == wxEmptyString ) { wxString mask = wxT( "*" ) + g_PhotoFilenameExt; mask += wxT( ";*.gbr;*.gbx;*.lgr;*.ger" ); filename = EDA_FileSelector( _( "Gerber files:" ), path, /* Chemin par defaut */ wxEmptyString, /* nom fichier par defaut */ Loading @@ -134,11 +137,14 @@ wxString path = wxPathOnly(FullFileName); 0, FALSE ); if ( filename == wxEmptyString ) return FALSE; if( filename == wxEmptyString ) return FALSE; } GetScreen()->m_FileName = filename; wxSetWorkingDirectory( path ); ChangeFileNameExt( filename, g_PenFilenameExt ); if( Read_GERBER_File( DC, GetScreen()->m_FileName, filename ) ) Loading @@ -148,18 +154,19 @@ wxString path = wxPathOnly(FullFileName); GetScreen()->SetRefreshReq(); g_SaveTime = time( NULL ); return(1); return 1; } /**********************************************************************************************/ static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName, wxDC* DC ) /**********************************************************************************************/ /* Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s retourne: 0 si fichier non lu ( annulation de commande ... ) 1 si OK * Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s * retourne: * 0 si fichier non lu ( annulation de commande ... ) * 1 si OK */ { wxString filename = FullFileName; Loading @@ -169,6 +176,7 @@ wxString filename = FullFileName; if( filename == wxEmptyString ) { wxString penfilesmask( wxT( "*" ) ); penfilesmask += g_PenFilenameExt; filename = frame->GetScreen()->m_FileName; ChangeFileNameExt( filename, g_PenFilenameExt ); Loading @@ -181,7 +189,8 @@ wxString filename = FullFileName; 0, TRUE ); if ( filename == wxEmptyString ) return; if( filename == wxEmptyString ) return; } frame->Read_D_Code_File( filename ); Loading @@ -190,10 +199,10 @@ wxString filename = FullFileName; } /*******************************************************************************/ bool WinEDA_GerberFrame::SaveGerberFile( const wxString& FullFileName, wxDC* DC ) /*******************************************************************************/ /* Sauvegarde du fichier PCB en format ASCII */ { Loading @@ -202,6 +211,7 @@ wxString filename = FullFileName; if( filename == wxEmptyString ) { wxString mask( wxT( "*" ) ); mask += g_PhotoFilenameExt; filename = EDA_FileSelector( _( "Gerber files:" ), wxEmptyString, /* Chemin par defaut */ Loading @@ -212,7 +222,8 @@ wxString filename = FullFileName; wxFD_SAVE, FALSE ); if ( filename.IsEmpty() ) return FALSE; if( filename.IsEmpty() ) return FALSE; } GetScreen()->m_FileName = filename; Loading @@ -221,6 +232,3 @@ wxString filename = FullFileName; return TRUE; }
gerbview/readgerb.cpp +259 −249 Original line number Diff line number Diff line Loading @@ -11,56 +11,56 @@ #include "protos.h" /* Format Gerber : NOTES : Fonctions preparatoires: Gn = G01 interpolation lineaire ( trace de droites ) G02,G20,G21 Interpolation circulaire , sens trigo < 0 G03,G30,G31 Interpolation circulaire , sens trigo > 0 G04 commentaire G06 Interpolation parabolique G07 Interpolation cubique G10 interpolation lineaire ( echelle 10x ) G11 interpolation lineaire ( echelle 0.1x ) G12 interpolation lineaire ( echelle 0.01x ) G52 plot symbole reference par Dnn code G53 plot symbole reference par Dnn ; symbole tourne de -90 degres G54 Selection d'outil G55 Mode exposition photo G56 plot symbole reference par Dnn A code G57 affiche le symbole reference sur la console G58 plot et affiche le symbole reference sur la console G60 interpolation lineaire ( echelle 100x ) G70 Unites = Inches G71 Unites = Millimetres G74 supprime interpolation circulaire sur 360 degre, revient a G01 G75 Active interpolation circulaire sur 360 degre G90 Mode Coordonnees absolues G91 Mode Coordonnees Relatives Coordonnees X,Y X,Y sont suivies de + ou - et de m+n chiffres (non separes) m = partie entiere n = partie apres la virgule formats classiques : m = 2, n = 3 (format 2.3) m = 3, n = 4 (format 3.4) ex: G__ X00345Y-06123 D__* Outils et D_CODES numero d'outil ( identification des formes ) 1 a 99 (classique) 1 a 999 D_CODES: D01 ... D9 = codes d'action: D01 = activation de lumiere (baisser de plume) lors du déplacement D02 = extinction de lumiere (lever de plume) lors du déplacement D03 = Flash D09 = VAPE Flash D51 = precede par G54 -> Select VAPE D10 ... D255 = Indentification d'outils ( d'ouvertures ) Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H) * Fonctions preparatoires: * Gn = * G01 interpolation lineaire ( trace de droites ) * G02,G20,G21 Interpolation circulaire , sens trigo < 0 * G03,G30,G31 Interpolation circulaire , sens trigo > 0 * G04 commentaire * G06 Interpolation parabolique * G07 Interpolation cubique * G10 interpolation lineaire ( echelle 10x ) * G11 interpolation lineaire ( echelle 0.1x ) * G12 interpolation lineaire ( echelle 0.01x ) * G52 plot symbole reference par Dnn code * G53 plot symbole reference par Dnn ; symbole tourne de -90 degres * G54 Selection d'outil * G55 Mode exposition photo * G56 plot symbole reference par Dnn A code * G57 affiche le symbole reference sur la console * G58 plot et affiche le symbole reference sur la console * G60 interpolation lineaire ( echelle 100x ) * G70 Unites = Inches * G71 Unites = Millimetres * G74 supprime interpolation circulaire sur 360 degre, revient a G01 * G75 Active interpolation circulaire sur 360 degre * G90 Mode Coordonnees absolues * G91 Mode Coordonnees Relatives * * Coordonnees X,Y * X,Y sont suivies de + ou - et de m+n chiffres (non separes) * m = partie entiere * n = partie apres la virgule * formats classiques : m = 2, n = 3 (format 2.3) * m = 3, n = 4 (format 3.4) * ex: * G__ X00345Y-06123 D__* * * Outils et D_CODES * numero d'outil ( identification des formes ) * 1 a 99 (classique) * 1 a 999 * D_CODES: * * D01 ... D9 = codes d'action: * D01 = activation de lumiere (baisser de plume) lors du déplacement * D02 = extinction de lumiere (lever de plume) lors du déplacement * D03 = Flash * D09 = VAPE Flash * D51 = precede par G54 -> Select VAPE * * D10 ... D255 = Indentification d'outils ( d'ouvertures ) * Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H) */ Loading @@ -69,34 +69,33 @@ Outils et D_CODES /* Routines Locales */ /* Routine de Lecture d'un fichier de D Codes. Accepte format standard ou ALSPCB un ';' demarre un commentaire. Format Standard: tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] ex: 1, 12, 12, 0, 0, 0, 3 ; D10 Format ALSPCB: Ver , Hor , Type , Tool [,Drill] ex: 0.012, 0.012, L , D10 Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. Retourne: < 0 si erreur: -1 = Fichier non trouve -2 = Erreur lecture fichier Rang de D_code maxi lu ( nbr de dcodes ) Representation interne: Les lignes sont représentées par des TRACKS standards Les Flash sont représentées par des DRAWSEGMENTS - ronds ou ovales: DRAWSEGMENTS - rectangles: DRAWSEGMENTS la reference aux D-CODES est placée dans le membre m_NetCode * Accepte format standard ou ALSPCB * un ';' demarre un commentaire. * * Format Standard: * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] * ex: 1, 12, 12, 0, 0, 0, 3 ; D10 * * Format ALSPCB: * Ver , Hor , Type , Tool [,Drill] * ex: 0.012, 0.012, L , D10 * * Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. * Retourne: * < 0 si erreur: * -1 = Fichier non trouve * -2 = Erreur lecture fichier * Rang de D_code maxi lu ( nbr de dcodes ) * * * Representation interne: * * Les lignes sont représentées par des TRACKS standards * Les Flash sont représentées par des DRAWSEGMENTS * - ronds ou ovales: DRAWSEGMENTS * - rectangles: DRAWSEGMENTS * la reference aux D-CODES est placée dans le membre m_NetCode */ Loading @@ -107,12 +106,12 @@ bool WinEDA_GerberFrame::Read_GERBER_File(wxDC * DC, /********************************************************/ /* Lecture de 1 fichier gerber. Format Imperial Absolu fin de bloc = * CrLf apres chaque commande G codes repetes * Format * Imperial * Absolu * fin de bloc = * * CrLf apres chaque commande * G codes repetes */ { int G_commande = 0, D_commande = 0; /* Numero de commande G et D codes */ Loading @@ -131,6 +130,7 @@ int error = 0; } gerber_layer = g_GERBER_Descr_List[layer]; /* Mise a jour de l'echelle gerber : */ gerber_layer->ResetDefaultValues(); Loading @@ -139,7 +139,8 @@ int error = 0; if( gerber_layer->m_Current_File == 0 ) { msg = _( "File " ) + GERBER_FullFileName + _( " not found" ); DisplayError(this, msg, 10); return FALSE; DisplayError( this, msg, 10 ); return FALSE; } gerber_layer->m_FileName = GERBER_FullFileName; Loading @@ -153,13 +154,18 @@ wxBusyCursor show_wait; { if( fgets( Line, 255, gerber_layer->m_Current_File ) == NULL ) // E.O.F { if ( gerber_layer->m_FilesPtr == 0 ) break; if( gerber_layer->m_FilesPtr == 0 ) break; fclose( gerber_layer->m_Current_File ); gerber_layer->m_FilesPtr--; gerber_layer->m_Current_File = gerber_layer->m_FilesList[gerber_layer->m_FilesPtr]; continue; } text = StrPurge( Line ); while( text && *text ) Loading @@ -179,7 +185,8 @@ wxBusyCursor show_wait; case 'M': // End file gerber_layer->m_CommandState = CMD_IDLE; while ( *text ) text ++; while( *text ) text++; break; case 'G': /* Ligne type Gxx : commande */ Loading Loading @@ -212,22 +219,28 @@ wxBusyCursor show_wait; if( gerber_layer->m_CommandState != ENTER_RS274X_CMD ) { gerber_layer->m_CommandState = ENTER_RS274X_CMD; gerber_layer->ReadRS274XCommand(this, DC, Line, text); if( !gerber_layer->ReadRS274XCommand( this, DC, Line, text ) ) { error++; } } else //Error { wxBell(); error++; wxBell(); error++; gerber_layer->m_CommandState = CMD_IDLE; text++; } break; default: text ++; error++; text++; error++; break; } // end switch (*text) } // end while (text } // end while (TRUE) } } } if( error ) { Loading Loading @@ -259,7 +272,8 @@ wxBusyCursor show_wait; TRUE ); } else DCodeFileName = D_Code_FullFileName; else DCodeFileName = D_Code_FullFileName; if( !DCodeFileName.IsEmpty() ) { Loading @@ -270,7 +284,3 @@ wxBusyCursor show_wait; return TRUE; }
gerbview/rs274x.cpp +475 −416 Original line number Diff line number Diff line Loading @@ -10,13 +10,12 @@ #include "protos.h" #define IsNumber(x) ( ( ((x) >= '0') && ((x) <='9') ) ||\ ((x) == '-') || ((x) == '+') || ((x) == '.') || ((x) == ',')) #define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \ || ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) || ( (x) == ',' ) ) #define CODE( x, y ) ( (x << 8) + (y) ) enum rs274x_parameters { enum rs274x_parameters { FORMAT_STATEMENT_COMMAND = CODE( 'F', 'S' ), AXIS_SELECT = CODE( 'A', 'S' ), MIRROR_IMAGE = CODE( 'M', 'I' ), Loading @@ -41,7 +40,6 @@ enum rs274x_parameters KNOCKOUT = CODE( 'K', 'O' ), STEP_AND_REPEAT = CODE( 'S', 'P' ), ROTATE = CODE( 'R', 'O' ) }; /* Variables locales : */ Loading @@ -50,7 +48,7 @@ enum rs274x_parameters static bool ReadApertureMacro( char* buff, char*& text, FILE* gerber_file ); /* Lit 2 codes ascii du texte point par text retourne le code correspondant ou -1 si erreur * retourne le code correspondant ou -1 si erreur */ static int ReadXCommand( char*& text ) { Loading @@ -60,12 +58,14 @@ int result; { result = (*text) << 8; text++; } else return -1; else return -1; if( text && *text ) { result += (*text) & 255; text++; } else return -1; else return -1; return result; } Loading @@ -76,7 +76,10 @@ static int ReadInt(char * &text) { int nb = 0; while ( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text ) { Loading @@ -85,8 +88,10 @@ int nb = 0; nb *= 10; nb += *text & 0x0F; text++; } else break; else break; } return nb; } Loading @@ -99,7 +104,10 @@ double nb = 0.0; char buf[256], * ptchar; ptchar = buf; while ( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text == ' ' ) text++; // Skip blanks before number while( text && *text ) { if( IsNumber( *text ) ) Loading @@ -107,28 +115,32 @@ char buf[256], * ptchar; *ptchar = *text; text++; ptchar++; } else break; else break; } *ptchar = 0; nb = atof( buf ); return nb; } /****************************************************************************/ bool GERBER_Descr::ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC, char* buff, char*& text ) /****************************************************************************/ /* Lit toutes les commandes RS274X jusqu'a trouver de code de fin % appelle ExecuteRS274XCommand() pour chaque commande trouve * appelle ExecuteRS274XCommand() pour chaque commande trouve */ { bool ok = true; int code_command; bool eof = FALSE; text++; do for(;;) { while( *text ) { Loading @@ -137,7 +149,7 @@ bool eof = FALSE; case '%': // End commande text++; m_CommandState = CMD_IDLE; return TRUE; goto exit; // success completion case ' ': case '\r': Loading @@ -151,23 +163,32 @@ bool eof = FALSE; default: code_command = ReadXCommand( text ); ExecuteRS274XCommand(code_command, buff, text); ok = ExecuteRS274XCommand( code_command, buff, text ); if( !ok ) goto exit; break; } } // End of current line if ( fgets(buff,255,m_Current_File) == NULL ) eof = TRUE; if( fgets( buff, 255, m_Current_File ) == NULL ) { ok = false; break; } text = buff; } while( !eof ); } return FALSE; exit: return ok; } /*******************************************************************************/ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text ) /*******************************************************************************/ /* Execute 1 commande RS274X */ { Loading @@ -186,6 +207,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; { case FORMAT_STATEMENT_COMMAND: xy_seq_len = 2; while( *text != '*' ) { switch( *text ) Loading @@ -193,20 +215,25 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case ' ': text++; break; case 'L': // No Leading 0 m_NoTrailingZeros = FALSE; text++; break; case 'T': // No trailing 0 m_NoTrailingZeros = TRUE; text++; break; case 'A': // Absolute coord m_Relative = FALSE; text++; break; case 'I': // Absolute coord m_Relative = TRUE; text++; break; case 'N': // Sequence code (followed by the number of digits for the X,Y command text++; xy_seq_char = *text; text++; Loading @@ -222,7 +249,8 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; m_FmtScale.x = *text - '0'; // = nb chiffres apres la virgule m_FmtLen.x = ctmp + m_FmtScale.x; // = nb total de chiffres } else { else { m_FmtScale.y = *text - '0'; m_FmtLen.y = ctmp + m_FmtScale.y; } Loading @@ -238,6 +266,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; break; } } break; case AXIS_SELECT: Loading @@ -247,8 +276,10 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case MODE_OF_UNITS: code = ReadXCommand( text ); if ( code == INCH ) m_GerbMetric = FALSE; else if ( code == MILLIMETER ) m_GerbMetric = TRUE; if( code == INCH ) m_GerbMetric = FALSE; else if( code == MILLIMETER ) m_GerbMetric = TRUE; conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT; break; Loading @@ -271,6 +302,7 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; break; } } break; case SCALE_FACTOR: Loading @@ -284,7 +316,8 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case ROTATE: msg.Printf( _( "Command <%c%c> ignored by Gerbview" ), (command >> 8) & 0xFF, command & 0xFF ); if ( g_DebugLevel > 0 )wxMessageBox(msg); if( g_DebugLevel > 0 ) wxMessageBox( msg ); break; case IMAGE_NAME: Loading @@ -293,16 +326,21 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; { m_Name.Append( *text ); text++; } break; case IMAGE_POLARITY: if ( strnicmp(text, "NEG", 3 ) == 0 ) m_ImageNegative = TRUE; else m_ImageNegative = FALSE; if( strnicmp( text, "NEG", 3 ) == 0 ) m_ImageNegative = TRUE; else m_ImageNegative = FALSE; break; case LAYER_POLARITY: if ( * text == 'C' ) m_LayerNegative = TRUE; else m_LayerNegative = FALSE; if( *text == 'C' ) m_LayerNegative = TRUE; else m_LayerNegative = FALSE; break; case APERTURE_MACRO: Loading Loading @@ -342,17 +380,21 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; code = ReadInt( text ); ctmp = *text; dcode = ReturnToolDescr( m_Layer, code ); if ( dcode == NULL ) break; if( dcode == NULL ) break; if( text[1] == ',' ) // Tool usuel (C,R,O,P) { text += 2; // text pointe size ( 1er modifier) dcode->m_Size.x = dcode->m_Size.y = (int) round( ReadDouble( text ) * conv_scale ); switch( ctmp ) { case 'C': // Circle dcode->m_Shape = GERB_CIRCLE; while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; Loading @@ -360,7 +402,9 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; (int) round( ReadDouble( text ) * conv_scale ); dcode->m_DrillShape = 1; } while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; Loading @@ -374,14 +418,18 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; case 'O': // ovale case 'R': // rect dcode->m_Shape = (ctmp == 'O') ? GERB_OVALE : GERB_RECT; while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; dcode->m_Size.y = (int) round( ReadDouble( text ) * conv_scale ); } while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'X' ) { text++; Loading @@ -389,7 +437,9 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; (int) round( ReadDouble( text ) * conv_scale ); dcode->m_DrillShape = 1; } while ( * text == ' ' ) text++; while( *text == ' ' ) text++; if( *text == 'Y' ) { text++; Loading @@ -414,26 +464,32 @@ double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT/25.4 : PCB_INTERNAL_UNIT; break; } GetEndOfBlock( buff, text, m_Current_File ); ok = GetEndOfBlock( buff, text, m_Current_File ); return ok; } /*****************************************************************/ bool GetEndOfBlock( char* buff, char*& text, FILE* gerber_file ) /*****************************************************************/ { bool eof = FALSE; do { for(;;) { while( (text < buff + 255) && *text ) { if ( *text == '*' ) return TRUE; if ( *text == '%' ) return TRUE; if( *text == '*' ) return TRUE; if( *text == '%' ) return TRUE; text++; } if ( fgets(buff,255,gerber_file) == NULL ) eof = TRUE; if( fgets( buff, 255, gerber_file ) == NULL ) break; text = buff; } while( ! eof); } return FALSE; } Loading @@ -449,12 +505,14 @@ int macro_type = 0; // Read macro name while( (text < buff + 255) && *text ) { if ( *text == '*' ) break; if( *text == '*' ) break; macro_name.Append( *text ); text++; } if ( g_DebugLevel > 0 ) wxMessageBox(macro_name, wxT("macro name")); if( g_DebugLevel > 0 ) wxMessageBox( macro_name, wxT( "macro name" ) ); text = buff; fgets( buff, 255, gerber_file ); Loading @@ -463,9 +521,10 @@ int macro_type = 0; while( (text < buff + 255) && *text ) { if ( *text == '*' ) return TRUE; if( *text == '*' ) return TRUE; text++; } return FALSE; }
include/class_collector.h +3 −3 Original line number Diff line number Diff line Loading @@ -112,11 +112,11 @@ public: /** * Function Remove * removes the item at item_position (first position is 0); * @param item_position index. * @param ndx The index into the list. */ void Remove( unsigned int item_position ) void Remove( int ndx ) { m_List.erase( m_List.begin() + item_position ); m_List.erase( m_List.begin() + (unsigned) ndx ); } /** Loading