gerbv  2.6A
gerber.c File Reference

Go to the source code of this file.

Functions

static void parse_G_code (gerb_file_t *fd, gerb_state_t *state, gerbv_image_t *image)
static void parse_D_code (gerb_file_t *fd, gerb_state_t *state, gerbv_image_t *image)
gboolean gerber_parse_file_segment (gint levelOfRecursion, gerbv_image_t *image, gerb_state_t *state, gerbv_net_t *curr_net, gerbv_stats_t *stats, gerb_file_t *fd, gchar *directoryPath)
gerbv_image_tparse_gerb (gerb_file_t *fd, gchar *directoryPath)
gboolean gerber_is_rs274x_p (gerb_file_t *fd, gboolean *returnFoundBinary)
gboolean gerber_is_rs274d_p (gerb_file_t *fd)

Detailed Description

RS274X parsing functions.

Definition in file gerber.c.

Function Documentation

gboolean gerber_is_rs274d_p ( gerb_file_t *  fd)

Checks for signs that this is a RS-274D file Returns TRUE if it is, FALSE if not.

Definition at line 902 of file gerber.c.

gboolean gerber_is_rs274x_p ( gerb_file_t *  fd,
gboolean *  returnFoundBinary 
)

Checks for signs that this is a RS-274X file Returns TRUE if it is, FALSE if not.

Definition at line 807 of file gerber.c.

gboolean gerber_parse_file_segment ( gint  levelOfRecursion,
gerbv_image_t image,
gerb_state_t *  state,
gerbv_net_t curr_net,
gerbv_stats_t stats,
gerb_file_t *  fd,
gchar *  directoryPath 
)

This function reads the Gerber file char by char, looking for various Gerber codes (e.g. G, D, etc). Once it reads a code, it then dispatches control to one or another bits of code which parse the individual code. It also updates the state struct, which holds info about the current state of the hypothetical photoplotter (i.e. updates whether the aperture is on or off, updates any other parameters, like units, offsets, apertures, etc.)

Definition at line 132 of file gerber.c.

References gerbv_net::aperture, gerbv_image_t::aperture, gerbv_net::aperture_state, gerbv_render_size_t::bottom, gerbv_net::boundingBox, gerbv_net::cirseg, gerbv_image_t::format, GERBV_APERTURE_STATE_FLASH, GERBV_APERTURE_STATE_OFF, GERBV_APTYPE_MACRO, GERBV_APTYPE_MACRO_CIRCLE, GERBV_APTYPE_MACRO_LINE20, GERBV_APTYPE_MACRO_LINE21, GERBV_APTYPE_MACRO_LINE22, GERBV_APTYPE_MACRO_MOIRE, GERBV_APTYPE_MACRO_OUTLINE, GERBV_APTYPE_MACRO_POLYGON, GERBV_APTYPE_MACRO_THERMAL, GERBV_APTYPE_OVAL, GERBV_APTYPE_RECTANGLE, GERBV_COORDINATE_INCREMENTAL, GERBV_INTERPOLATION_CCW_CIRCULAR, GERBV_INTERPOLATION_CW_CIRCULAR, GERBV_INTERPOLATION_LINEARx1, GERBV_INTERPOLATION_PAREA_END, GERBV_INTERPOLATION_PAREA_START, GERBV_MESSAGE_ERROR, GERBV_OMIT_ZEROS_TRAILING, GERBV_POLARITY_CLEAR, GERBV_UNIT_MM, gerbv_image_t::info, gerbv_net::interpolation, gerbv_net::layer, gerbv_render_size_t::left, parse_D_code(), parse_G_code(), gerbv_render_size_t::right, gerbv_net::start_x, gerbv_net::start_y, gerbv_net::stop_x, gerbv_net::stop_y, and gerbv_render_size_t::top.

Referenced by parse_gerb().

static void parse_D_code ( gerb_file_t *  fd,
gerb_state_t *  state,
gerbv_image_t image 
)
static

This function reads the numeric value of a D code and updates the state. It also updates the D stats counters

Definition at line 1128 of file gerber.c.

References GERBV_APERTURE_STATE_FLASH, GERBV_APERTURE_STATE_OFF, GERBV_APERTURE_STATE_ON, GERBV_MESSAGE_ERROR, and gerbv_image_t::gerbv_stats.

Referenced by gerber_parse_file_segment().

gerbv_image_t* parse_gerb ( gerb_file_t *  fd,
gchar *  directoryPath 
)

This is a wrapper which gets called from top level. It does some initialization and pre-processing, and then calls gerber_parse_file_segment which processes the actual file. Then it does final modifications to the image created.

Definition at line 737 of file gerber.c.

References gerber_parse_file_segment(), gerbv_create_image(), GERBV_LAYERTYPE_RS274X, GERBV_MESSAGE_ERROR, gerbv_image_t::gerbv_stats, gerbv_stats_new(), gerbv_net::layer, gerbv_image_t::layers, gerbv_image_t::layertype, gerbv_image_t::netlist, gerbv_net::state, and gerbv_image_t::states.

Referenced by gerbv_create_rs274x_image_from_filename().