pcb 4.1.1
An interactive printed circuit board layout editor.

vendor.c File Reference

More...

#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include "change.h"
#include "data.h"
#include "draw.h"
#include "error.h"
#include "global.h"
#include "resource.h"
#include "set.h"
#include "undo.h"
#include "vendor.h"
Include dependency graph for vendor.c:

Go to the source code of this file.

Defines

#define CLOSEST   1
#define ROUND_UP   0
#define FREE(x)   if((x) != NULL) { free (x) ; (x) = NULL; }

Functions

static void add_to_drills (char *sval)
 Add a drill size to the vendor drill list.
static void apply_vendor_map (void)
static void process_skips (Resource *res)
 Deal with the "skip" subresource.
static bool rematch (const char *, const char *)
int ActionApplyVendor (int argc, char **argv, Coord x, Coord y)
int ActionToggleVendor (int argc, char **argv, Coord x, Coord y)
int ActionEnableVendor (int argc, char **argv, Coord x, Coord y)
int ActionDisableVendor (int argc, char **argv, Coord x, Coord y)
int ActionUnloadVendor (int argc, char **argv, Coord x, Coord y)
int ActionLoadVendorFrom (int argc, char **argv, Coord x, Coord y)
int vendorDrillMap (int in)
 For a given drill size, find the closest vendor drill size.
bool vendorIsElementMappable (ElementType *element)
static int vendor_get_enabled (void *data)

Variables

static int * vendor_drills = NULL
static int n_vendor_drills = 0
static int cached_drill = -1
static int cached_map = -1
static char ** ignore_refdes = NULL
static int n_refdes = 0
static char ** ignore_value = NULL
static int n_value = 0
static char ** ignore_descr = NULL
static int n_descr = 0
static char * vendor_name = NULL
 Vendor name.
static double sf
 Resource file to PCB units scale factor.
static bool vendorMapEnable = false
 Enable/disable mapping.
static int rounding_method = ROUND_UP
static const char apply_vendor_syntax [] = N_("ApplyVendor()")
static const char apply_vendor_help []
static const char toggle_vendor_syntax [] = N_("ToggleVendor()")
static const char toggle_vendor_help []
static const char enable_vendor_syntax [] = N_("EnableVendor()")
static const char enable_vendor_help []
static const char disable_vendor_syntax [] = N_("DisableVendor()")
static const char disable_vendor_help []
static const char unload_vendor_syntax [] = N_("UnloadVendor()")
static const char unload_vendor_help []
static const char load_vendor_syntax [] = N_("LoadVendorFrom(filename)")
static const char load_vendor_help []
HID_Action vendor_action_list []
HID_Flag vendor_flag_list []

Detailed Description


Copyright.


PCB, interactive printed circuit board design

Copyright (C) 2004, 2007 Dan McMahill

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 Street, Fifth Floor, Boston, MA 02110-1301 USA.

Definition in file vendor.c.


Define Documentation

#define CLOSEST   1

Definition at line 108 of file vendor.c.

Referenced by ActionLoadVendorFrom(), and vendorDrillMap().

#define FREE (   x)    if((x) != NULL) { free (x) ; (x) = NULL; }

Definition at line 112 of file vendor.c.

Referenced by ActionLoadVendorFrom(), and ActionUnloadVendor().

#define ROUND_UP   0

Definition at line 109 of file vendor.c.

Referenced by ActionLoadVendorFrom().


Function Documentation

int ActionApplyVendor ( int  argc,
char **  argv,
Coord  x,
Coord  y 
)

Definition at line 131 of file vendor.c.

References apply_vendor_map(), and hid_action().

Here is the call graph for this function:

int ActionDisableVendor ( int  argc,
char **  argv,
Coord  x,
Coord  y 
)

Definition at line 217 of file vendor.c.

References vendorMapEnable.

int ActionEnableVendor ( int  argc,
char **  argv,
Coord  x,
Coord  y 
)

Definition at line 191 of file vendor.c.

References vendorMapEnable.

int ActionToggleVendor ( int  argc,
char **  argv,
Coord  x,
Coord  y 
)

Definition at line 160 of file vendor.c.

References vendorMapEnable.

int ActionUnloadVendor ( int  argc,
char **  argv,
Coord  x,
Coord  y 
)
static void add_to_drills ( char *  sval) [static]

Add a drill size to the vendor drill list.

Definition at line 703 of file vendor.c.

References _, n_vendor_drills, realloc(), sf, and vendor_drills.

Referenced by ActionLoadVendorFrom().

Here is the call graph for this function:

static void process_skips ( Resource res) [static]

Deal with the "skip" subresource.

Definition at line 754 of file vendor.c.

References _, Resource::c, cnt, ignore_descr, ignore_refdes, ignore_value, Message(), n_descr, n_refdes, n_value, NSTRCMP, realloc(), resource_type, ResourceVal::subres, Resource::v, and ResourceVal::value.

Referenced by ActionLoadVendorFrom().

Here is the call graph for this function:

static bool rematch ( const char *  re,
const char *  s 
) [static]

Definition at line 894 of file vendor.c.

References _, m, and Message().

Referenced by vendorIsElementMappable().

Here is the call graph for this function:

static int vendor_get_enabled ( void *  data) [static]

Definition at line 983 of file vendor.c.

References vendorMapEnable.

int vendorDrillMap ( int  in)

For a given drill size, find the closest vendor drill size.

Definition at line 629 of file vendor.c.

References _, cached_drill, cached_map, CLOSEST, max, Message(), min, n_vendor_drills, rounding_method, vendor_drills, and vendorMapEnable.

Referenced by apply_vendor_map(), CreateNewPin(), and CreateNewVia().

Here is the call graph for this function:

bool vendorIsElementMappable ( ElementType element)

Definition at line 831 of file vendor.c.

References _, DESCRIPTION_NAME, ignore_descr, ignore_refdes, ignore_value, Message(), n_descr, n_refdes, n_value, NAMEONPCB_NAME, NSTRCMP, rematch(), TEST_FLAG, UNKNOWN, VALUE_NAME, and vendorMapEnable.

Referenced by apply_vendor_map(), and CreateNewPin().

Here is the call graph for this function:


Variable Documentation

const char apply_vendor_help[] [static]
Initial value:
  N_("Applies the currently loaded vendor drill table to the current design.")

Definition at line 118 of file vendor.c.

const char apply_vendor_syntax[] = N_("ApplyVendor()") [static]

Definition at line 116 of file vendor.c.

int cached_drill = -1 [static]

Definition at line 80 of file vendor.c.

Referenced by ActionLoadVendorFrom(), ActionUnloadVendor(), and vendorDrillMap().

int cached_map = -1 [static]

Definition at line 81 of file vendor.c.

Referenced by vendorDrillMap().

const char disable_vendor_help[] [static]
Initial value:
  N_("Disables automatic drill size mapping.")

Definition at line 201 of file vendor.c.

const char disable_vendor_syntax[] = N_("DisableVendor()") [static]

Definition at line 199 of file vendor.c.

const char enable_vendor_help[] [static]
Initial value:
  N_("Enables automatic drill size mapping.")

Definition at line 173 of file vendor.c.

const char enable_vendor_syntax[] = N_("EnableVendor()") [static]

Definition at line 171 of file vendor.c.

char** ignore_descr = NULL [static]
char** ignore_refdes = NULL [static]
char** ignore_value = NULL [static]
const char load_vendor_help[] [static]
Initial value:
  N_("Loads the specified vendor resource file.")

Definition at line 259 of file vendor.c.

const char load_vendor_syntax[] = N_("LoadVendorFrom(filename)") [static]

Definition at line 257 of file vendor.c.

int n_descr = 0 [static]
int n_refdes = 0 [static]
int n_value = 0 [static]
int rounding_method = ROUND_UP [static]

Definition at line 110 of file vendor.c.

Referenced by ActionLoadVendorFrom(), and vendorDrillMap().

double sf [static]

Resource file to PCB units scale factor.

Definition at line 99 of file vendor.c.

Referenced by ActionLoadVendorFrom(), and add_to_drills().

const char toggle_vendor_help[] [static]
Initial value:
  N_("Toggles the state of automatic drill size mapping.")

Definition at line 142 of file vendor.c.

const char toggle_vendor_syntax[] = N_("ToggleVendor()") [static]

Definition at line 140 of file vendor.c.

const char unload_vendor_help[] [static]
Initial value:
  N_("Unloads the current vendor drill mapping table.")

Definition at line 227 of file vendor.c.

const char unload_vendor_syntax[] = N_("UnloadVendor()") [static]

Definition at line 225 of file vendor.c.

int* vendor_drills = NULL [static]

Definition at line 77 of file vendor.c.

Referenced by ActionLoadVendorFrom(), ActionUnloadVendor(), add_to_drills(), and vendorDrillMap().

Initial value:
 {
  {"VendorMapOn", vendor_get_enabled, NULL}
}

Definition at line 988 of file vendor.c.

char* vendor_name = NULL [static]

Vendor name.

Definition at line 94 of file vendor.c.

Referenced by ActionLoadVendorFrom().