gerber viewer cleanups
This commit is contained in:
parent
e6e50f3c0d
commit
a2a024966e
|
@ -92,7 +92,10 @@ enum Gerb_Analyse_Cmd {
|
||||||
|
|
||||||
class D_CODE;
|
class D_CODE;
|
||||||
|
|
||||||
/* Structure de Description d'option d'une layer GERBER : */
|
/**
|
||||||
|
* Class GERBER_Descr
|
||||||
|
* holds the data for one gerber file or layer
|
||||||
|
*/
|
||||||
class GERBER_Descr
|
class GERBER_Descr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -152,14 +155,32 @@ public:
|
||||||
bool Execute_G_Command( char*& text, int G_commande );
|
bool Execute_G_Command( char*& text, int G_commande );
|
||||||
bool Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
bool Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
||||||
char*& text, int D_commande );
|
char*& text, int D_commande );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* size of single line of a text line from a gerber file.
|
||||||
|
* warning: some files can have very long lines, so the buffer must be large
|
||||||
|
*/
|
||||||
|
#define GERBER_BUFZ 4000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReadRS274XCommand
|
||||||
|
* reads a single RS274X command terminated with a %
|
||||||
|
*/
|
||||||
bool ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC,
|
bool ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC,
|
||||||
char* buff, char*& text );
|
char aBuff[GERBER_BUFZ], char*& text );
|
||||||
bool ExecuteRS274XCommand( int command, char* buff, char*& text );
|
|
||||||
|
/**
|
||||||
|
* Function ExecuteRS274XCommand
|
||||||
|
* executes 1 commande
|
||||||
|
*/
|
||||||
|
bool ExecuteRS274XCommand( int command, char aBuff[GERBER_BUFZ], char*& text );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Structure de Description d'un D_CODE GERBER : */
|
/**
|
||||||
|
* Class D_CODE
|
||||||
|
* holds a gerber DCODE definition.
|
||||||
|
*/
|
||||||
class D_CODE
|
class D_CODE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -178,10 +199,23 @@ public:
|
||||||
void Clear_D_CODE_Data();
|
void Clear_D_CODE_Data();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**************/
|
||||||
|
/* rs274x.cpp */
|
||||||
|
/**************/
|
||||||
|
bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
|
||||||
|
|
||||||
|
/*************/
|
||||||
|
/* dcode.cpp */
|
||||||
|
/*************/
|
||||||
|
D_CODE * ReturnToolDescr( int layer, int Dcode, int * index = NULL );
|
||||||
|
|
||||||
|
|
||||||
eda_global const wxChar* g_GERBER_Tool_Type[6]
|
eda_global const wxChar* g_GERBER_Tool_Type[6]
|
||||||
#ifdef MAIN
|
#ifdef MAIN
|
||||||
= {
|
= {
|
||||||
wxT( "????" ), wxT( "Rond" ), wxT( "Rect" ), wxT( "Line" ), wxT( "Oval" ), wxT( "Macro" )
|
wxT( "????" ), wxT( "Round" ), wxT( "Rect" ), wxT( "Line" ), wxT( "Oval" ), wxT( "Macro" )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -124,16 +124,3 @@ void Trace_1_texte_pcb(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||||
void Affiche_DCodes_Pistes(WinEDA_DrawPanel * panel, wxDC * DC,
|
void Affiche_DCodes_Pistes(WinEDA_DrawPanel * panel, wxDC * DC,
|
||||||
BOARD * Pcb, int drawmode);
|
BOARD * Pcb, int drawmode);
|
||||||
|
|
||||||
/*************/
|
|
||||||
/* dcode.cpp */
|
|
||||||
/*************/
|
|
||||||
class D_CODE;
|
|
||||||
|
|
||||||
D_CODE * ReturnToolDescr(int layer, int Dcode, int * index = NULL);
|
|
||||||
|
|
||||||
/**************/
|
|
||||||
/* rs274x.cpp */
|
|
||||||
/**************/
|
|
||||||
bool GetEndOfBlock( char * buff, char * &text, FILE *gerber_file);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -116,9 +116,9 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
|
||||||
{
|
{
|
||||||
int G_commande = 0,
|
int G_commande = 0,
|
||||||
D_commande = 0; /* command number for G et D commands (like G04 or D02) */
|
D_commande = 0; /* command number for G et D commands (like G04 or D02) */
|
||||||
char Line[4000]; /* Buffer to read 1 line of the gerber file
|
|
||||||
* warning: some files can have very long lines, so the buffer must be large
|
char Line[GERBER_BUFZ];
|
||||||
*/
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
char* text;
|
char* text;
|
||||||
int layer; /* current layer used in gerbview */
|
int layer; /* current layer used in gerbview */
|
||||||
|
@ -158,7 +158,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
|
||||||
|
|
||||||
while( TRUE )
|
while( TRUE )
|
||||||
{
|
{
|
||||||
if( fgets( Line, sizeof(Line) - 1, gerber_layer->m_Current_File ) == NULL ) // E.O.F
|
if( fgets( Line, sizeof(Line), gerber_layer->m_Current_File ) == NULL ) // E.O.F
|
||||||
{
|
{
|
||||||
if( gerber_layer->m_FilesPtr == 0 )
|
if( gerber_layer->m_FilesPtr == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -10,13 +10,10 @@
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \
|
#define CODE( x, y ) ( ((x) << 8) + (y) )
|
||||||
|| ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) || ( (x) == ',' ) )
|
|
||||||
|
|
||||||
#define CODE( x, y ) ( (x << 8) + (y) )
|
|
||||||
|
|
||||||
enum rs274x_parameters {
|
enum rs274x_parameters {
|
||||||
FORMAT_STATEMENT_COMMAND = CODE( 'F', 'S' ),
|
FORMAT_STATEMENT = CODE( 'F', 'S' ),
|
||||||
AXIS_SELECT = CODE( 'A', 'S' ),
|
AXIS_SELECT = CODE( 'A', 'S' ),
|
||||||
MIRROR_IMAGE = CODE( 'M', 'I' ),
|
MIRROR_IMAGE = CODE( 'M', 'I' ),
|
||||||
MODE_OF_UNITS = CODE( 'M', 'O' ),
|
MODE_OF_UNITS = CODE( 'M', 'O' ),
|
||||||
|
@ -42,98 +39,67 @@ enum rs274x_parameters {
|
||||||
ROTATE = CODE( 'R', 'O' )
|
ROTATE = CODE( 'R', 'O' )
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Variables locales : */
|
|
||||||
|
|
||||||
/* Routines Locales */
|
/* Local Functions */
|
||||||
static bool ReadApertureMacro( char* buff, char*& text, FILE* gerber_file );
|
static bool ReadApertureMacro( char aBuff[GERBER_BUFZ], char*& text, FILE* gerber_file );
|
||||||
|
|
||||||
/* Lit 2 codes ascii du texte pointé par text
|
|
||||||
* retourne le code correspondant ou -1 si erreur
|
/**
|
||||||
|
* Function ReadXCommand
|
||||||
|
* reads int two bytes of data and assembles them into an int with the first
|
||||||
|
* byte in the sequence put into the most significant part of a 16 bit value
|
||||||
|
* and the second byte put into the least significant part of the 16 bit value.
|
||||||
|
* @param text A reference to a pointer to read bytes from and to advance as they are read.
|
||||||
|
* @return int - with 16 bits of data in the ls bits, upper bits zeroed.
|
||||||
*/
|
*/
|
||||||
static int ReadXCommand( char*& text )
|
static int ReadXCommand( char*& text )
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if( text && *text )
|
if( text && *text )
|
||||||
{
|
result = *text++ << 8;
|
||||||
result = (*text) << 8; text++;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( text && *text )
|
if( text && *text )
|
||||||
{
|
result += *text++;
|
||||||
result += (*text) & 255; text++;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
/**
|
||||||
|
* Function ReadInt
|
||||||
|
* reads an int from an ASCII character buffer.
|
||||||
|
* @param text A reference to a character pointer from which bytes are read
|
||||||
|
* and the pointer is advanced for each byte read.
|
||||||
|
* @param int - The int read in.
|
||||||
|
*/
|
||||||
static int ReadInt( char*& text )
|
static int ReadInt( char*& text )
|
||||||
/********************************/
|
|
||||||
{
|
{
|
||||||
int nb = 0;
|
return (int) strtol( text, &text, 10 );
|
||||||
|
|
||||||
while( text && *text == ' ' )
|
|
||||||
text++;
|
|
||||||
|
|
||||||
// Skip blanks before number
|
|
||||||
|
|
||||||
while( text && *text )
|
|
||||||
{
|
|
||||||
if( (*text >= '0') && (*text <='9') )
|
|
||||||
{
|
|
||||||
nb *= 10; nb += *text & 0x0F;
|
|
||||||
text++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/**
|
||||||
|
* Function ReadDouble
|
||||||
|
* reads a double in from a character buffer.
|
||||||
|
* @param text A reference to a character pointer from which the ASCII double
|
||||||
|
* is read from and the pointer advanced for each character read.
|
||||||
|
* @return double
|
||||||
|
*/
|
||||||
static double ReadDouble( char*& text )
|
static double ReadDouble( char*& text )
|
||||||
/************************************/
|
|
||||||
{
|
{
|
||||||
double nb = 0.0;
|
return strtod( text, &text );
|
||||||
char buf[256], * ptchar;
|
|
||||||
|
|
||||||
ptchar = buf;
|
|
||||||
while( text && *text == ' ' )
|
|
||||||
text++;
|
|
||||||
|
|
||||||
// Skip blanks before number
|
|
||||||
while( text && *text )
|
|
||||||
{
|
|
||||||
if( IsNumber( *text ) )
|
|
||||||
{
|
|
||||||
*ptchar = *text;
|
|
||||||
text++; ptchar++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ptchar = 0;
|
|
||||||
|
|
||||||
nb = atof( buf );
|
|
||||||
return nb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
bool GERBER_Descr::ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC,
|
bool GERBER_Descr::ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC,
|
||||||
char* buff, char*& text )
|
char buff[GERBER_BUFZ], char*& text )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Lit toutes les commandes RS274X jusqu'a trouver de code de fin %
|
|
||||||
* appelle ExecuteRS274XCommand() pour chaque commande trouvée
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
int code_command;
|
int code_command;
|
||||||
|
@ -171,7 +137,7 @@ bool GERBER_Descr::ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of current line
|
// End of current line
|
||||||
if( fgets( buff, 255, m_Current_File ) == NULL )
|
if( fgets( buff, GERBER_BUFZ, m_Current_File ) == NULL )
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
break;
|
break;
|
||||||
|
@ -186,26 +152,22 @@ exit:
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
bool GERBER_Descr::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& text )
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
/* Execute 1 commande RS274X
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int code;
|
int code;
|
||||||
int xy_seq_len, xy_seq_char;
|
int xy_seq_len, xy_seq_char;
|
||||||
char ctmp;
|
char ctmp;
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
D_CODE* dcode;
|
D_CODE* dcode;
|
||||||
char Line[1024];
|
char line[GERBER_BUFZ];
|
||||||
wxString msg;
|
wxString msg;
|
||||||
double fcoord;
|
double fcoord;
|
||||||
double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT;
|
double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT;
|
||||||
|
|
||||||
|
|
||||||
switch( command )
|
switch( command )
|
||||||
{
|
{
|
||||||
case FORMAT_STATEMENT_COMMAND:
|
case FORMAT_STATEMENT:
|
||||||
xy_seq_len = 2;
|
xy_seq_len = 2;
|
||||||
|
|
||||||
while( *text != '*' )
|
while( *text != '*' )
|
||||||
|
@ -227,23 +189,26 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A': // Absolute coord
|
case 'A': // Absolute coord
|
||||||
m_Relative = FALSE; text++;
|
m_Relative = FALSE;
|
||||||
|
text++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I': // Absolute coord
|
case 'I': // Absolute coord
|
||||||
m_Relative = TRUE; text++;
|
m_Relative = TRUE;
|
||||||
|
text++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N': // Sequence code (followed by the number of digits for the X,Y command
|
case 'N': // Sequence code (followed by the number of digits for the X,Y command
|
||||||
text++;
|
text++;
|
||||||
xy_seq_char = *text; text++;
|
xy_seq_char = *text++;
|
||||||
if( (xy_seq_char >= '0') && (xy_seq_char <= '9') )
|
if( (xy_seq_char >= '0') && (xy_seq_char <= '9') )
|
||||||
xy_seq_len = -'0';
|
xy_seq_len = -'0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
case 'Y': // Valeurs transmises :2 (really xy_seq_len : FIX ME) digits
|
case 'Y': // Valeurs transmises :2 (really xy_seq_len : FIX ME) digits
|
||||||
code = *(text++); ctmp = *(text++) - '0';
|
code = *(text++);
|
||||||
|
ctmp = *(text++) - '0';
|
||||||
if( code == 'X' )
|
if( code == 'X' )
|
||||||
{
|
{
|
||||||
m_FmtScale.x = *text - '0'; // = nb chiffres apres la virgule
|
m_FmtScale.x = *text - '0'; // = nb chiffres apres la virgule
|
||||||
|
@ -266,7 +231,6 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AXIS_SELECT:
|
case AXIS_SELECT:
|
||||||
|
@ -324,7 +288,7 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
m_Name.Empty();
|
m_Name.Empty();
|
||||||
while( *text != '*' )
|
while( *text != '*' )
|
||||||
{
|
{
|
||||||
m_Name.Append( *text ); text++;
|
m_Name.Append( *text++ );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -354,14 +318,15 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
DisplayError( NULL, _( "Too many include files!!" ) );
|
DisplayError( NULL, _( "Too many include files!!" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strcpy( Line, text );
|
strcpy( line, text );
|
||||||
strtok( Line, "*%%\n\r" );
|
strtok( line, "*%%\n\r" );
|
||||||
m_FilesList[m_FilesPtr] = m_Current_File;
|
m_FilesList[m_FilesPtr] = m_Current_File;
|
||||||
m_Current_File = fopen( Line, "rt" );
|
|
||||||
|
m_Current_File = fopen( line, "rt" );
|
||||||
if( m_Current_File == 0 )
|
if( m_Current_File == 0 )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "fichier <%s> non trouve" ), Line );
|
msg.Printf( wxT( "fichier <%s> non trouve" ), line );
|
||||||
DisplayError( NULL, msg, 10 );
|
DisplayError( NULL, msg, 10 );
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
m_Current_File = m_FilesList[m_FilesPtr];
|
m_Current_File = m_FilesList[m_FilesPtr];
|
||||||
|
@ -373,15 +338,19 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
case APERTURE_DESCR:
|
case APERTURE_DESCR:
|
||||||
if( *text != 'D' )
|
if( *text != 'D' )
|
||||||
{
|
{
|
||||||
ok = FALSE; break;
|
ok = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
m_As_DCode = TRUE;
|
m_As_DCode = TRUE;
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
code = ReadInt( text );
|
code = ReadInt( text );
|
||||||
ctmp = *text;
|
ctmp = *text;
|
||||||
|
|
||||||
dcode = ReturnToolDescr( m_Layer, code );
|
dcode = ReturnToolDescr( m_Layer, code );
|
||||||
if( dcode == NULL )
|
if( dcode == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( text[1] == ',' ) // Tool usuel (C,R,O,P)
|
if( text[1] == ',' ) // Tool usuel (C,R,O,P)
|
||||||
{
|
{
|
||||||
text += 2; // text pointe size ( 1er modifier)
|
text += 2; // text pointe size ( 1er modifier)
|
||||||
|
@ -402,6 +371,7 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
(int) round( ReadDouble( text ) * conv_scale );
|
(int) round( ReadDouble( text ) * conv_scale );
|
||||||
dcode->m_DrillShape = 1;
|
dcode->m_DrillShape = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( *text == ' ' )
|
while( *text == ' ' )
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
|
@ -410,6 +380,7 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
text++;
|
text++;
|
||||||
dcode->m_Drill.y =
|
dcode->m_Drill.y =
|
||||||
(int) round( ReadDouble( text ) * conv_scale );
|
(int) round( ReadDouble( text ) * conv_scale );
|
||||||
|
|
||||||
dcode->m_DrillShape = 2;
|
dcode->m_DrillShape = 2;
|
||||||
}
|
}
|
||||||
dcode->m_Defined = TRUE;
|
dcode->m_Defined = TRUE;
|
||||||
|
@ -418,6 +389,7 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
case 'O': // ovale
|
case 'O': // ovale
|
||||||
case 'R': // rect
|
case 'R': // rect
|
||||||
dcode->m_Shape = (ctmp == 'O') ? GERB_OVALE : GERB_RECT;
|
dcode->m_Shape = (ctmp == 'O') ? GERB_OVALE : GERB_RECT;
|
||||||
|
|
||||||
while( *text == ' ' )
|
while( *text == ' ' )
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
|
@ -427,6 +399,7 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
dcode->m_Size.y =
|
dcode->m_Size.y =
|
||||||
(int) round( ReadDouble( text ) * conv_scale );
|
(int) round( ReadDouble( text ) * conv_scale );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( *text == ' ' )
|
while( *text == ' ' )
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
|
@ -437,6 +410,7 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
(int) round( ReadDouble( text ) * conv_scale );
|
(int) round( ReadDouble( text ) * conv_scale );
|
||||||
dcode->m_DrillShape = 1;
|
dcode->m_DrillShape = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( *text == ' ' )
|
while( *text == ' ' )
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
|
@ -471,21 +445,23 @@ bool GERBER_Descr::ExecuteRS274XCommand( int command, char* buff, char*& text )
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
bool GetEndOfBlock( char* buff, char*& text, FILE* gerber_file )
|
bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file )
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
while( (text < buff + 255) && *text )
|
while( (text < buff + GERBER_BUFZ) && *text )
|
||||||
{
|
{
|
||||||
if( *text == '*' )
|
if( *text == '*' )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if( *text == '%' )
|
if( *text == '%' )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
text++;
|
text++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fgets( buff, 255, gerber_file ) == NULL )
|
if( fgets( buff, GERBER_BUFZ, gerber_file ) == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
text = buff;
|
text = buff;
|
||||||
|
@ -496,35 +472,39 @@ bool GetEndOfBlock( char* buff, char*& text, FILE* gerber_file )
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
bool ReadApertureMacro( char* buff, char*& text, FILE* gerber_file )
|
bool ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file )
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
{
|
{
|
||||||
wxString macro_name;
|
wxString macro_name;
|
||||||
int macro_type = 0;
|
int macro_type = 0;
|
||||||
|
|
||||||
// Read macro name
|
// Read macro name
|
||||||
while( (text < buff + 255) && *text )
|
while( (text < buff + GERBER_BUFZ) && *text )
|
||||||
{
|
{
|
||||||
if( *text == '*' )
|
if( *text == '*' )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
macro_name.Append( *text );
|
macro_name.Append( *text );
|
||||||
text++;
|
text++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_DebugLevel > 0 )
|
if( g_DebugLevel > 0 )
|
||||||
wxMessageBox( macro_name, wxT( "macro name" ) );
|
wxMessageBox( macro_name, wxT( "macro name" ) );
|
||||||
|
|
||||||
text = buff;
|
text = buff;
|
||||||
fgets( buff, 255, gerber_file );
|
fgets( buff, GERBER_BUFZ, gerber_file );
|
||||||
|
|
||||||
// Read parameters
|
// Read parameters
|
||||||
macro_type = ReadInt( text );
|
macro_type = ReadInt( text );
|
||||||
|
|
||||||
while( (text < buff + 255) && *text )
|
while( (text < buff + GERBER_BUFZ) && *text )
|
||||||
{
|
{
|
||||||
if( *text == '*' )
|
if( *text == '*' )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
text++;
|
text++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue