pcb 4.1.1
An interactive printed circuit board layout editor.

bom.c File Reference

Prints a centroid file in a format which includes data needed by a pick and place machine. More...

#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "global.h"
#include "data.h"
#include "error.h"
#include "misc.h"
#include "pcb-printf.h"
#include "hid.h"
#include "hid/common/hidnogui.h"
#include "../hidint.h"
Include dependency graph for bom.c:

Go to the source code of this file.

Data Structures

struct  _StringList
struct  _BomList

Typedefs

typedef struct _StringList StringList
typedef struct _BomList BomList

Functions

static HID_Attributebom_get_export_options (int *n)
static char * CleanBOMString (char *in)
static double xyToAngle (double x, double y, bool morethan2pins)
static StringListstring_insert (char *str, StringList *list)
static BomListbom_insert (char *refdes, char *descr, char *value, BomList *bom)
static void print_and_free (FILE *fp, BomList *bom)
 If fp is not NULL then print out the bill of materials contained in bom. Either way, free all memory which has been allocated for bom.
static int PrintBOM (void)
static void bom_do_export (HID_Attr_Val *options)
static void bom_parse_arguments (int *argc, char ***argv)
void hid_bom_init ()

Variables

static HID_Attribute bom_options []
static HID_Attr_Val bom_values [NUM_OPTIONS]
static const char * bom_filename
static const char * xy_filename
static const Unitxy_unit
static char * reference_pin_names [] = {"1", "2", "A1", "A2", "B1", "B2", 0}
 Includes numbered and BGA pins.
HID bom_hid

Detailed Description

Prints a centroid file in a format which includes data needed by a pick and place machine.

Further formatting for a particular factory setup can easily be generated with awk or perl. In addition, a bill of materials file is generated which can be used for checking stock and purchasing needed materials. returns != zero on error.


Copyright.


PCB, interactive printed circuit board design

Copyright (C) 2006 DJ Delorie

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Contact addresses for paper mail and Email: Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany Thomas.Nau@rz.uni-ulm.de


Definition in file bom.c.


Typedef Documentation

typedef struct _BomList BomList
typedef struct _StringList StringList

Function Documentation

static void bom_do_export ( HID_Attr_Val options) [static]

Definition at line 617 of file bom.c.

References bom_filename, bom_get_export_options(), bom_values, get_unit_list(), get_unit_struct(), HID_Attr_Val::int_value, PrintBOM(), HID_Attr_Val::str_value, and xy_filename.

Referenced by hid_bom_init().

Here is the call graph for this function:

static HID_Attribute* bom_get_export_options ( int *  n) [static]
static BomList* bom_insert ( char *  refdes,
char *  descr,
char *  value,
BomList bom 
) [static]

Definition at line 259 of file bom.c.

References _BomList::descr, malloc(), _BomList::next, NSTRCMP, _BomList::num, _BomList::refdes, string_insert(), and _BomList::value.

Referenced by PrintBOM().

Here is the call graph for this function:

static void bom_parse_arguments ( int *  argc,
char ***  argv 
) [static]

Definition at line 645 of file bom.c.

References hid_parse_command_line(), and hid_register_attributes().

Referenced by hid_bom_init().

Here is the call graph for this function:

static char* CleanBOMString ( char *  in) [static]

Definition at line 157 of file bom.c.

References malloc().

Referenced by print_and_free(), and PrintBOM().

Here is the call graph for this function:

static void print_and_free ( FILE *  fp,
BomList bom 
) [static]

If fp is not NULL then print out the bill of materials contained in bom. Either way, free all memory which has been allocated for bom.

Definition at line 323 of file bom.c.

References CleanBOMString(), _BomList::descr, _BomList::next, _StringList::next, _BomList::num, _BomList::refdes, _StringList::str, and _BomList::value.

Referenced by PrintBOM().

Here is the call graph for this function:

static StringList* string_insert ( char *  str,
StringList list 
) [static]

Definition at line 233 of file bom.c.

References malloc(), _StringList::next, and _StringList::str.

Referenced by bom_insert().

Here is the call graph for this function:

static double xyToAngle ( double  x,
double  y,
bool  morethan2pins 
) [static]

Definition at line 189 of file bom.c.

References M_PI.

Referenced by PrintBOM().


Variable Documentation

const char* bom_filename [static]

Definition at line 112 of file bom.c.

Referenced by bom_do_export(), and PrintBOM().

Definition at line 652 of file bom.c.

Initial value:
 {

  {"bomfile", "Name of the BOM output file",
   HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_bomfile 0

  {"xyfile", "Name of the XY output file",
   HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_xyfile 1


  {"xy-unit", "XY units",
   HID_Unit, 0, 0, {-1, 0, 0}, NULL, 0},
#define HA_unit 2
  {"xy-in-mm", ATTR_UNDOCUMENTED,
   HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_xymm 3
}

Definition at line 66 of file bom.c.

Referenced by bom_get_export_options().

HID_Attr_Val bom_values[NUM_OPTIONS] [static]

Definition at line 110 of file bom.c.

Referenced by bom_do_export().

char* reference_pin_names[] = {"1", "2", "A1", "A2", "B1", "B2", 0} [static]

Includes numbered and BGA pins.

In order of preference. Possibly BGA pins can be missing, so we add a few to try.

Definition at line 372 of file bom.c.

Referenced by PrintBOM().

const char* xy_filename [static]

Definition at line 113 of file bom.c.

Referenced by bom_do_export(), and PrintBOM().

const Unit* xy_unit [static]

Definition at line 114 of file bom.c.