pcb 4.1.1
An interactive printed circuit board layout editor.
|
#include "global.h"
#include <memory.h>
#include <limits.h>
#include "data.h"
#include "create.h"
#include "remove.h"
#include "move.h"
#include "draw.h"
#include "undo.h"
#include "strflags.h"
#include "find.h"
#include "pcb-printf.h"
Go to the source code of this file.
Data Structures | |
struct | corner_s |
struct | line_s |
struct | rect_s |
Defines | |
#define | rint(x) (ceil((x) - 0.5)) |
#define | dprintf if(0)pcb_printf |
#define | selected(x) TEST_FLAG (SELECTEDFLAG, (x)) |
#define | autorouted(x) TEST_FLAG (AUTOFLAG, (x)) |
#define | SB (PCB->Bloat+1) |
#define | INC 7 |
#define | O_HORIZ 0x10 |
#define | O_VERT 0x20 |
#define | LEFT 0x11 |
#define | RIGHT 0x12 |
#define | UP 0x24 |
#define | DOWN 0x28 |
#define | DIAGONAL 0xf0 |
#define | ORIENT(x) ((x) & 0xf0) |
#define | DIRECT(x) ((x) & 0x0f) |
#define | LONGEST_FRECKLE 2 |
#define | DELETE(q) (q)->layer = 0xdeadbeef |
#define | DELETED(q) ((q)->layer == 0xdeadbeef) |
#define | LT_TOP 1 |
#define | LT_BOTTOM 2 |
#define | check(c, l) |
#define | SWAP(a, b) { a^=b; b^=a; a^=b; } |
#define | ECHK(X, Y, LT) |
Typedefs | |
typedef struct corner_s | corner_s |
typedef struct line_s | line_s |
typedef struct rect_s | rect_s |
Functions | |
int | djopt_set_auto_only (int argc, char **argv, Coord x, Coord y) |
static int | djopt_get_auto_only (void *data) |
static char * | element_name_for (corner_s *c) |
static char * | corner_name (corner_s *c) |
static void | dj_abort (char *msg,...) |
static int | gridsnap (Coord n) |
static int | djabs (int x) |
static int | djmax (int x, int y) |
static int | djmin (int x, int y) |
static int | dist (int x1, int y1, int x2, int y2) |
Find distance between 2 points. | |
static int | line_length (line_s *l) |
static int | dist_ltp2 (int dx, int y, int y1, int y2) |
static int | intersecting_layers (int l1, int l2) |
static int | dist_line_to_point (line_s *l, corner_s *c) |
static int | line_orient (line_s *l, corner_s *c) |
static corner_s * | other_corner (line_s *l, corner_s *c) |
static corner_s * | find_corner_if (int x, int y, int l) |
static corner_s * | find_corner (int x, int y, int l) |
static void | add_line_to_corner (line_s *l, corner_s *c) |
static LineType * | create_pcb_line (int layer, int x1, int y1, int x2, int y2, int thick, int clear, FlagType flags) |
static void | new_line (corner_s *s, corner_s *e, int layer, LineType *example) |
static line_s * | other_line (corner_s *c, line_s *l) |
static void | empty_rect (rect_s *rect) |
static void | add_point_to_rect (rect_s *rect, int x, int y, int w) |
static void | add_line_to_rect (rect_s *rect, line_s *l) |
static int | pin_in_rect (rect_s *r, int x, int y, int w) |
static int | line_in_rect (rect_s *r, line_s *l) |
static int | corner_radius (corner_s *c) |
static void | add_corner_to_rect_if (rect_s *rect, corner_s *c, rect_s *e) |
static void | remove_line (line_s *l) |
static void | move_line_to_layer (line_s *l, int layer) |
static void | remove_via_at (corner_s *c) |
static void | remove_corner (corner_s *c2) |
static void | merge_corners (corner_s *c1, corner_s *c2) |
static void | move_corner (corner_s *c, int x, int y) |
static int | any_line_selected () |
static int | trim_step (int s, int l1, int l2) |
static int | canonicalize_line (line_s *l) |
static int | split_line (line_s *l, corner_s *c) |
static int | canonicalize_lines () |
Make sure all vias are at line end points. | |
static int | simple_optimize_corner (corner_s *c) |
static int | simple_optimizations () |
static int | is_hole (corner_s *c) |
static int | orthopull_1 (corner_s *c, int fdir, int rdir, int any_sel) |
static int | orthopull () |
Look for straight runs which could be moved to reduce total trace length. | |
static int | debumpify () |
Look for "U" shaped traces we can shorten (or eliminate). | |
static int | simple_corner (corner_s *c) |
static int | unjaggy_once () |
Look for sequences of simple corners we can reduce. | |
static int | unjaggy () |
static int | vianudge () |
Look for vias with all lines leaving the same way, try to nudge via to eliminate one or more of them. | |
static int | viatrim () |
Look for traces that can be moved to the other side of the board, to reduce the number of vias needed. | |
static int | automagic () |
static int | miter () |
static void | classify_corner (corner_s *c, int this_net) |
static void | classify_nets () |
static line_s * | choose_example_line (corner_s *c1, corner_s *c2) |
static int | connect_corners (corner_s *c1, corner_s *c2) |
static void | pinsnap () |
Look for pins that have no connections. | |
static int | pad_orient (PadType *p) |
static void | padcleaner () |
static void | grok_layer_groups () |
static int | ActionDJopt (int argc, char **argv, Coord x, Coord y) |
Variables | |
static corner_s * | corners |
static corner_s * | next_corner = 0 |
static line_s * | lines |
static int | layer_groupings [MAX_LAYER] |
static char | layer_type [MAX_LAYER] |
static int | autorouted_only = 1 |
static const char | djopt_sao_syntax [] = "OptAutoOnly()" |
static const char | djopt_sao_help [] = "Toggles the optimize-only-autorouted flag." |
HID_Flag | djopt_flag_list [] |
static int | solder_layer |
static int | component_layer |
static const char | djopt_syntax [] = "djopt(miter)" |
static const char | djopt_help [] = "Perform various optimizations on the current board." |
HID_Action | djopt_action_list [] |
PCB, interactive printed circuit board design
Copyright (C) 2003 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
Contact addresses for paper mail and Email: DJ Delorie, 334 North Road, Deerfield NH 03037-1110, USA dj@delorie.com
Definition in file djopt.c.
Definition at line 64 of file djopt.c.
Referenced by ActionDJopt(), debumpify(), miter(), orthopull_1(), unjaggy_once(), and viatrim().
#define check | ( | c, | |
l | |||
) |
Definition at line 237 of file djopt.c.
Referenced by ActionDJopt(), count_contours_i_am_inside(), debumpify(), find_inside(), find_inside_m_pa(), gts_predicates_init(), gts_vertices_merge(), move_corner(), new_line(), padcleaner(), remove_line(), simple_optimize_corner(), split_line(), unjaggy_once(), and vianudge().
#define DELETE | ( | q | ) | (q)->layer = 0xdeadbeef |
Definition at line 114 of file djopt.c.
Referenced by remove_corner(), and remove_line().
#define DELETED | ( | q | ) | ((q)->layer == 0xdeadbeef) |
Definition at line 115 of file djopt.c.
Referenced by any_line_selected(), canonicalize_line(), canonicalize_lines(), classify_nets(), create_pcb_line(), debumpify(), find_corner(), find_corner_if(), miter(), orthopull(), orthopull_1(), padcleaner(), pinsnap(), remove_corner(), simple_optimizations(), unjaggy_once(), vianudge(), and viatrim().
#define DIAGONAL 0xf0 |
Definition at line 77 of file djopt.c.
Referenced by debumpify(), line_orient(), miter(), orthopull_1(), pad_orient(), simple_corner(), and simple_optimize_corner().
#define DOWN 0x28 |
Definition at line 76 of file djopt.c.
Referenced by debumpify(), line_orient(), miter(), orthopull(), orthopull_1(), pinsnap(), and vianudge().
#define dprintf if(0)pcb_printf |
Definition at line 61 of file djopt.c.
Referenced by add_line_to_corner(), choose_example_line(), connect_corners(), debumpify(), line_in_rect(), merge_corners(), move_corner(), new_line(), orthopull_1(), padcleaner(), pinsnap(), remove_corner(), simple_optimize_corner(), split_line(), trim_step(), unjaggy_once(), vianudge(), and viatrim().
for (i=0; i<cn; i++) \ { \ if (!intersecting_layers(cs[i]->layer, cb->layer)) \ continue; \ r2 = corner_radius(cs[i]); \ if (cb->X + r1 <= cs[i]->X - r2 - SB - 1) \ continue; \ if (cb->X - r1 >= cs[i]->X + r2 + SB + 1) \ continue; \ if (cb->Y LT cs[i]->Y) \ continue; \ sep = djabs(cb->Y - cs[i]->Y) - r1 - r2 - SB - 1; \ if (max > sep) \ { max = sep; snap = 1; }\ } \ for (i=0; i<ln; i++) \ { \ if (!intersecting_layers(ls[i]->layer, cb->layer)) \ continue; \ if (cb->X <= cs[i]->X || cb->X >= cs[i+1]->X) \ continue; \ sep = (djabs(cb->Y - cs[i]->Y) - ls[i]->line->Thickness/2 \ - r1 - SB - 1); \ if (max > sep) \ { max = sep; snap = 1; }\ }
Referenced by orthopull_1().
#define INC 7 |
Definition at line 69 of file djopt.c.
Referenced by add_line_to_corner(), and find_corner().
#define LEFT 0x11 |
Definition at line 73 of file djopt.c.
Referenced by debumpify(), line_orient(), miter(), orthopull(), orthopull_1(), pinsnap(), and vianudge().
#define LONGEST_FRECKLE 2 |
Manhattan length of the longest "freckle"
Definition at line 81 of file djopt.c.
Referenced by simple_optimize_corner().
#define LT_BOTTOM 2 |
Definition at line 123 of file djopt.c.
Referenced by grok_layer_groups(), and padcleaner().
#define LT_TOP 1 |
Definition at line 122 of file djopt.c.
Referenced by grok_layer_groups(), and padcleaner().
#define O_HORIZ 0x10 |
Definition at line 71 of file djopt.c.
Referenced by pad_orient().
#define O_VERT 0x20 |
Definition at line 72 of file djopt.c.
Referenced by pad_orient().
Definition at line 78 of file djopt.c.
Referenced by debumpify(), miter(), padcleaner(), and simple_corner().
#define RIGHT 0x12 |
Definition at line 74 of file djopt.c.
Referenced by debumpify(), line_orient(), miter(), orthopull(), orthopull_1(), pinsnap(), and vianudge().
Definition at line 66 of file djopt.c.
Referenced by debumpify(), miter(), orthopull_1(), padcleaner(), unjaggy_once(), and vianudge().
Definition at line 63 of file djopt.c.
Referenced by any_line_selected(), debumpify(), gts_vertices_merge(), miter(), nbcb_std_callback(), orthopull_1(), simple_optimize_corner(), unjaggy_once(), and viatrim().
#define SWAP | ( | a, | |
b | |||
) | { a^=b; b^=a; a^=b; } |
Definition at line 300 of file djopt.c.
Referenced by dist_ltp2().
#define UP 0x24 |
Definition at line 75 of file djopt.c.
Referenced by debumpify(), line_orient(), miter(), orthopull(), orthopull_1(), pinsnap(), and vianudge().
Definition at line 2998 of file djopt.c.
References add_line_to_corner(), automagic(), autorouted, autorouted_only, c, canonicalize_lines(), check, classify_nets(), component_layer, PCBType::Data, debumpify(), line_s::e, ELEMENT_LOOP, END_LOOP, find_corner(), grok_layer_groups(), hid_action(), IncrementUndoSerialNumber(), line_s::is_pad, layer, line_s::layer, LAYER_PTR, line, line_s::line, LINE_LOOP, lines, LT_COPPER, malloc(), max_copper_layer, miter(), line_s::next, NSTRCMP, orthopull(), corner_s::pad, PAD_LOOP, padcleaner(), PCB, corner_s::pin, pin, PIN_LOOP, pinsnap(), RemoveLine(), line_s::s, simple_optimizations(), solder_layer, TEST_FLAG, LayerType::Type, unjaggy(), corner_s::via, VIA_LOOP, vianudge(), viatrim(), pin_st::X, and pin_st::Y.
Definition at line 737 of file djopt.c.
References add_point_to_rect(), corner_radius(), dist(), pin_in_rect(), corner_s::x, rect_s::x1, rect_s::x2, corner_s::y, rect_s::y1, and rect_s::y2.
Referenced by debumpify(), and unjaggy_once().
Definition at line 515 of file djopt.c.
References dprintf, INC, corner_s::lines, n, corner_s::n_lines, realloc(), corner_s::x, and corner_s::y.
Referenced by ActionDJopt(), merge_corners(), new_line(), and split_line().
Definition at line 664 of file djopt.c.
References add_point_to_rect(), line_s::e, line_s::s, corner_s::x, and corner_s::y.
Referenced by debumpify(), and unjaggy_once().
static void add_point_to_rect | ( | rect_s * | rect, |
int | x, | ||
int | y, | ||
int | w | ||
) | [static] |
Definition at line 651 of file djopt.c.
References rect_s::x1, rect_s::x2, rect_s::y1, and rect_s::y2.
Referenced by add_corner_to_rect_if(), add_line_to_rect(), line_in_rect(), orthopull_1(), padcleaner(), and viatrim().
static int any_line_selected | ( | ) | [static] |
Definition at line 915 of file djopt.c.
References DELETED, line_s::line, line_s::next, and selected.
Referenced by debumpify(), miter(), orthopull(), unjaggy_once(), and viatrim().
static int automagic | ( | ) | [static] |
Definition at line 2183 of file djopt.c.
References debumpify(), orthopull(), unjaggy(), vianudge(), and viatrim().
Referenced by ActionDJopt().
static int canonicalize_line | ( | line_s * | l | ) | [static] |
Definition at line 997 of file djopt.c.
References c, DELETED, dist(), line_s::e, intersecting_layers(), corner_s::layer, line_s::layer, line_s::line, move_corner(), corner_s::next, corner_s::pad, corner_s::pin, PinLineIntersect(), line_s::s, split_line(), pin_st::Thickness, corner_s::via, x, corner_s::x, y, and corner_s::y.
Referenced by canonicalize_lines().
static int canonicalize_lines | ( | ) | [static] |
Make sure all vias are at line end points.
Definition at line 1114 of file djopt.c.
References canonicalize_line(), DELETED, and line_s::next.
Referenced by ActionDJopt().
Definition at line 2477 of file djopt.c.
References dprintf, line_s::e, flags_to_string(), intersecting_layers(), layer, line, line_s::line, corner_s::lines, corner_s::n_lines, line_s::s, s, corner_s::x, and corner_s::y.
Referenced by connect_corners().
static void classify_corner | ( | corner_s * | c, |
int | this_net | ||
) | [static] |
Definition at line 2402 of file djopt.c.
References corner_s::lines, corner_s::n_lines, corner_s::net, and other_corner().
Referenced by classify_nets().
static void classify_nets | ( | ) | [static] |
Definition at line 2413 of file djopt.c.
References c, classify_corner(), DELETED, corner_s::net, and corner_s::next.
Referenced by ActionDJopt().
Definition at line 2514 of file djopt.c.
References choose_example_line(), dprintf, line_s::e, ex, find_corner(), line_s::layer, layer, line_s::line, corner_s::lines, move_corner(), corner_s::n_lines, new_line(), corner_s::pad, corner_s::pin, line_s::s, corner_s::via, corner_s::x, and corner_s::y.
Referenced by pinsnap().
static char* corner_name | ( | corner_s * | c | ) | [static] |
Definition at line 186 of file djopt.c.
References element_name_for(), corner_s::net, corner_s::pad, pcb_snprintf(), corner_s::pin, and corner_s::via.
Referenced by merge_corners(), pinsnap(), and remove_corner().
static int corner_radius | ( | corner_s * | c | ) | [static] |
Definition at line 708 of file djopt.c.
References djmax(), line_s::line, corner_s::lines, corner_s::n_lines, corner_s::pin, pin_st::Thickness, and corner_s::via.
Referenced by add_corner_to_rect_if(), miter(), orthopull_1(), pinsnap(), and vianudge().
static LineType* create_pcb_line | ( | int | layer, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | thick, | ||
int | clear, | ||
FlagType | flags | ||
) | [static] |
Definition at line 526 of file djopt.c.
References AddObjectToCreateUndoList(), CreateNewLineOnLayer(), PCBType::Data, DELETED, DataType::Layer, LAYER_PTR, line_s::line, LayerType::Line, LayerType::LineN, line_s::next, and PCB.
Referenced by new_line(), and split_line().
static int debumpify | ( | ) | [static] |
Look for "U" shaped traces we can shorten (or eliminate).
Definition at line 1681 of file djopt.c.
References add_corner_to_rect_if(), add_line_to_rect(), any_line_selected(), autorouted, autorouted_only, c, check, DELETED, DIAGONAL, DOWN, dprintf, line_s::e, empty_rect(), gridsnap(), intersecting_layers(), corner_s::layer, LEFT, line_s::line, line_orient(), move_corner(), corner_s::net, corner_s::next, line_s::next, ORIENT, other_corner(), other_line(), corner_s::pad, pcb_printf(), corner_s::pin, RIGHT, line_s::s, SB, selected, simple_optimizations(), trim_step(), UP, corner_s::x, rect_s::x1, rect_s::x2, corner_s::y, rect_s::y1, and rect_s::y2.
Referenced by ActionDJopt(), and automagic().
static int dist | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) | [static] |
Find distance between 2 points.
We use floating point math here because we can fairly easily overflow a 32 bit integer here. In fact it only takes 0.46" to do so.
Definition at line 338 of file djopt.c.
References rint.
Referenced by add_corner_to_rect_if(), canonicalize_line(), check_snap_offgrid_line(), dist_line_to_point(), dist_ltp2(), line_length(), mark_delta_to_widget(), miter(), pinsnap(), poly_ComputeInteriorPoint(), and vianudge().
Definition at line 383 of file djopt.c.
References dist(), dist_ltp2(), line_s::e, len, line_s::s, corner_s::x, and corner_s::y.
Referenced by vianudge().
static int dist_ltp2 | ( | int | dx, |
int | y, | ||
int | y1, | ||
int | y2 | ||
) | [static] |
static void dj_abort | ( | char * | msg, |
... | |||
) | [static] |
Definition at line 226 of file djopt.c.
Referenced by move_corner(), new_line(), orthopull_1(), and other_corner().
static int djabs | ( | int | x | ) | [static] |
static int djmax | ( | int | x, |
int | y | ||
) | [static] |
static int djmin | ( | int | x, |
int | y | ||
) | [static] |
static int djopt_get_auto_only | ( | void * | data | ) | [static] |
Definition at line 152 of file djopt.c.
References autorouted_only.
Definition at line 145 of file djopt.c.
References autorouted_only.
static char* element_name_for | ( | corner_s * | c | ) | [static] |
Definition at line 164 of file djopt.c.
References PCBType::Data, ELEMENT_LOOP, END_LOOP, PAD_LOOP, PCB, pin, and PIN_LOOP.
Referenced by corner_name().
static void empty_rect | ( | rect_s * | rect | ) | [static] |
Definition at line 644 of file djopt.c.
References rect_s::x1, rect_s::x2, rect_s::y1, and rect_s::y2.
Referenced by debumpify(), line_in_rect(), orthopull_1(), padcleaner(), unjaggy_once(), and viatrim().
static corner_s* find_corner | ( | int | x, |
int | y, | ||
int | l | ||
) | [static] |
Definition at line 486 of file djopt.c.
References c, corners, DELETED, INC, intersecting_layers(), corner_s::layer, corner_s::lines, malloc(), corner_s::n_lines, corner_s::net, corner_s::next, corner_s::pad, corner_s::pin, corner_s::via, x, corner_s::x, y, and corner_s::y.
Referenced by ActionDJopt(), connect_corners(), and miter().
static corner_s* find_corner_if | ( | int | x, |
int | y, | ||
int | l | ||
) | [static] |
Definition at line 469 of file djopt.c.
References c, DELETED, intersecting_layers(), corner_s::layer, corner_s::next, corner_s::x, and corner_s::y.
Referenced by move_corner().
static int gridsnap | ( | Coord | n | ) | [static] |
Definition at line 303 of file djopt.c.
References SettingType::Grid, and Settings.
Referenced by debumpify(), orthopull_1(), and trim_step().
static void grok_layer_groups | ( | ) | [static] |
Definition at line 2837 of file djopt.c.
References bottom_silk_layer, component_layer, LayerGroupType::Entries, f, layer_groupings, layer_type, PCBType::LayerGroups, LT_BOTTOM, LT_TOP, max_copper_layer, max_group, LayerGroupType::Number, PCB, solder_layer, and top_silk_layer.
Referenced by ActionDJopt().
static int intersecting_layers | ( | int | l1, |
int | l2 | ||
) | [static] |
Definition at line 371 of file djopt.c.
References layer_groupings.
Referenced by canonicalize_line(), choose_example_line(), debumpify(), find_corner(), find_corner_if(), miter(), orthopull_1(), pinsnap(), split_line(), and unjaggy_once().
static int is_hole | ( | corner_s * | c | ) | [static] |
Definition at line 1241 of file djopt.c.
References corner_s::pad, corner_s::pin, and corner_s::via.
Referenced by orthopull_1().
Definition at line 685 of file djopt.c.
References add_point_to_rect(), dprintf, line_s::e, empty_rect(), line_s::line, line_s::s, corner_s::x, rect_s::x1, rect_s::x2, corner_s::y, rect_s::y1, and rect_s::y2.
Referenced by viatrim().
static int line_length | ( | line_s * | l | ) | [static] |
Definition at line 349 of file djopt.c.
References dist(), djabs(), line_s::e, line_s::s, corner_s::x, and corner_s::y.
Referenced by miter(), orthopull_1(), and vianudge().
Definition at line 411 of file djopt.c.
References DIAGONAL, DOWN, line_s::e, LEFT, RIGHT, line_s::s, UP, corner_s::x, and corner_s::y.
Referenced by debumpify(), miter(), orthopull_1(), padcleaner(), pinsnap(), simple_corner(), simple_optimize_corner(), unjaggy_once(), and vianudge().
Definition at line 821 of file djopt.c.
References add_line_to_corner(), corner_name(), dprintf, line_s::e, corner_s::layer, corner_s::lines, corner_s::n_lines, corner_s::pad, corner_s::pin, remove_corner(), remove_via_at(), line_s::s, and corner_s::via.
Referenced by move_corner().
static int miter | ( | ) | [static] |
Definition at line 2200 of file djopt.c.
References any_line_selected(), autorouted, autorouted_only, bloat, c, corner_radius(), DELETED, DIAGONAL, dist(), DOWN, find_corner(), SettingType::Grid, intersecting_layers(), corner_s::layer, LEFT, len, line_s::line, line_length(), line_orient(), corner_s::lines, max, corner_s::miter, move_corner(), corner_s::n_lines, corner_s::net, corner_s::next, ORIENT, other_corner(), corner_s::pad, corner_s::pin, RIGHT, SB, selected, Settings, split_line(), UP, corner_s::via, corner_s::x, x, corner_s::y, and y.
Referenced by ActionDJopt().
static void move_corner | ( | corner_s * | c, |
int | x, | ||
int | y | ||
) | [static] |
Definition at line 850 of file djopt.c.
References check, dj_abort(), dprintf, find_corner_if(), gui, LAYER_PTR, merge_corners(), MoveObject(), other_corner(), corner_s::pad, corner_s::pin, hid_st::progress, remove_line(), pin_st::X, x, corner_s::x, corner_s::y, pin_st::Y, and y.
Referenced by canonicalize_line(), connect_corners(), debumpify(), miter(), orthopull_1(), pinsnap(), simple_optimize_corner(), unjaggy_once(), and vianudge().
static void move_line_to_layer | ( | line_s * | l, |
int | layer | ||
) | [static] |
Definition at line 781 of file djopt.c.
References layer, line_s::layer, LAYER_PTR, line_s::line, and MoveObjectToLayer().
Referenced by viatrim().
Definition at line 555 of file djopt.c.
References add_line_to_corner(), check, create_pcb_line(), dj_abort(), dprintf, line_s::e, flags_to_string(), line_s::is_pad, layer, line_s::layer, line_s::line, lines, malloc(), max_copper_layer, line_s::next, s, line_s::s, corner_s::x, and corner_s::y.
Referenced by connect_corners(), and maybe_pull_1().
static int orthopull | ( | ) | [static] |
Look for straight runs which could be moved to reduce total trace length.
Definition at line 1642 of file djopt.c.
References any_line_selected(), c, DELETED, DOWN, LEFT, corner_s::next, next_corner, orthopull_1(), corner_s::pad, pcb_printf(), corner_s::pin, RIGHT, and UP.
Referenced by ActionDJopt(), and automagic().
static int orthopull_1 | ( | corner_s * | c, |
int | fdir, | ||
int | rdir, | ||
int | any_sel | ||
) | [static] |
Definition at line 1247 of file djopt.c.
References add_point_to_rect(), autorouted, autorouted_only, c, corner_radius(), DELETED, DIAGONAL, dj_abort(), DOWN, dprintf, line_s::e, ECHK, empty_rect(), SettingType::Grid, gridsnap(), intersecting_layers(), is_hole(), line_s::layer, layer, LEFT, len, line_s::line, line_length(), line_orient(), corner_s::lines, malloc(), max, move_corner(), corner_s::n_lines, corner_s::net, line_s::next, corner_s::next, other_corner(), corner_s::pad, corner_s::pin, pin_in_rect(), realloc(), RIGHT, line_s::s, SB, selected, Settings, UP, corner_s::via, x, corner_s::x, rect_s::x1, rect_s::x2, y, corner_s::y, rect_s::y1, and rect_s::y2.
Referenced by orthopull().
Definition at line 458 of file djopt.c.
References dj_abort(), line_s::e, and line_s::s.
Referenced by classify_corner(), debumpify(), miter(), move_corner(), orthopull_1(), simple_optimize_corner(), unjaggy_once(), and vianudge().
Definition at line 626 of file djopt.c.
References corner_s::lines, corner_s::n_lines, corner_s::pad, corner_s::pin, and corner_s::via.
Referenced by debumpify().
static int pad_orient | ( | PadType * | p | ) | [static] |
static void padcleaner | ( | ) | [static] |
Definition at line 2783 of file djopt.c.
References add_point_to_rect(), ALLPAD_LOOP, check, PCBType::Data, DELETED, dprintf, empty_rect(), ENDALL_LOOP, line_s::is_pad, layer_type, line_orient(), LT_BOTTOM, LT_TOP, line_s::next, ORIENT, pad_orient(), PCB, pin_in_rect(), remove_line(), SB, and TEST_FLAG.
Referenced by ActionDJopt().
static int pin_in_rect | ( | rect_s * | r, |
int | x, | ||
int | y, | ||
int | w | ||
) | [static] |
Definition at line 671 of file djopt.c.
References rect_s::x2, and rect_s::y2.
Referenced by add_corner_to_rect_if(), orthopull_1(), and padcleaner().
static void pinsnap | ( | ) | [static] |
Look for pins that have no connections.
See if there's a corner close by that should be connected to it. This usually happens when the MUCS router needs to route to an off-grid pin.
Definition at line 2565 of file djopt.c.
References c, connect_corners(), corner_name(), corner_radius(), DELETED, dist(), djmax(), djmin(), DOWN, dprintf, line_s::e, intersecting_layers(), line_s::layer, corner_s::layer, LEFT, line_s::line, line_orient(), corner_s::lines, max_copper_layer, move_corner(), corner_s::n_lines, line_s::next, corner_s::next, corner_s::pad, corner_s::pin, pin, RIGHT, line_s::s, pin_st::Thickness, UP, corner_s::via, corner_s::x, and corner_s::y.
Referenced by ActionDJopt().
static void remove_corner | ( | corner_s * | c2 | ) | [static] |
Definition at line 800 of file djopt.c.
References c, corner_name(), DELETE, DELETED, dprintf, corner_s::lines, and corner_s::next.
Referenced by merge_corners().
static void remove_line | ( | line_s * | l | ) | [static] |
Definition at line 756 of file djopt.c.
References check, PCBType::Data, DELETE, line_s::e, line_s::layer, DataType::Layer, layer, line_s::line, corner_s::lines, corner_s::n_lines, PCB, RemoveLine(), and line_s::s.
Referenced by move_corner(), and padcleaner().
static void remove_via_at | ( | corner_s * | c | ) | [static] |
Definition at line 793 of file djopt.c.
References RemoveObject(), and corner_s::via.
Referenced by merge_corners(), and simple_optimize_corner().
static int simple_corner | ( | corner_s * | c | ) | [static] |
Definition at line 1822 of file djopt.c.
References DIAGONAL, line_orient(), corner_s::lines, corner_s::n_lines, ORIENT, corner_s::pad, corner_s::pin, and corner_s::via.
Referenced by unjaggy_once().
static int simple_optimizations | ( | ) | [static] |
Definition at line 1223 of file djopt.c.
References c, DELETED, corner_s::next, corner_s::pad, corner_s::pin, and simple_optimize_corner().
Referenced by ActionDJopt(), debumpify(), unjaggy_once(), and viatrim().
static int simple_optimize_corner | ( | corner_s * | c | ) | [static] |
Definition at line 1136 of file djopt.c.
References abs, check, DIAGONAL, dprintf, line_s::e, line_s::layer, line_s::line, line_orient(), corner_s::lines, LONGEST_FRECKLE, pin_st::Mask, move_corner(), corner_s::n_lines, other_corner(), remove_via_at(), line_s::s, selected, SET_FLAG, TEST_ANY_THERMS, corner_s::via, corner_s::x, and corner_s::y.
Referenced by simple_optimizations().
Definition at line 944 of file djopt.c.
References add_line_to_corner(), c, check, create_pcb_line(), dprintf, line_s::e, intersecting_layers(), line_s::is_pad, corner_s::layer, line_s::layer, LAYER_PTR, line_s::line, corner_s::lines, lines, malloc(), MoveObject(), corner_s::n_lines, line_s::next, corner_s::pad, line_s::s, corner_s::x, and corner_s::y.
Referenced by canonicalize_line(), and miter().
static int trim_step | ( | int | s, |
int | l1, | ||
int | l2 | ||
) | [static] |
Definition at line 929 of file djopt.c.
References dprintf, gridsnap(), and s.
Referenced by debumpify().
static int unjaggy | ( | ) | [static] |
Definition at line 1938 of file djopt.c.
References unjaggy_once().
Referenced by ActionDJopt(), and automagic().
static int unjaggy_once | ( | ) | [static] |
Look for sequences of simple corners we can reduce.
Definition at line 1842 of file djopt.c.
References add_corner_to_rect_if(), add_line_to_rect(), any_line_selected(), autorouted, autorouted_only, c, check, DELETED, dprintf, empty_rect(), intersecting_layers(), corner_s::layer, line_s::layer, line_s::line, line_orient(), corner_s::lines, move_corner(), corner_s::n_lines, corner_s::net, corner_s::next, other_corner(), SB, selected, simple_corner(), simple_optimizations(), corner_s::x, rect_s::x1, rect_s::x2, corner_s::y, rect_s::y1, and rect_s::y2.
Referenced by unjaggy().
static int vianudge | ( | ) | [static] |
Look for vias with all lines leaving the same way, try to nudge via to eliminate one or more of them.
Definition at line 1958 of file djopt.c.
References c, check, corner_radius(), DELETED, dist(), dist_line_to_point(), DOWN, dprintf, line_s::layer, LEFT, len, line, line_length(), line_orient(), corner_s::lines, max_copper_layer, move_corner(), corner_s::n_lines, corner_s::net, line_s::next, corner_s::next, other_corner(), corner_s::pad, pcb_printf(), corner_s::pin, RIGHT, line_s::s, SB, pin_st::Thickness, UP, corner_s::via, corner_s::x, and corner_s::y.
Referenced by ActionDJopt(), and automagic().
static int viatrim | ( | ) | [static] |
Look for traces that can be moved to the other side of the board, to reduce the number of vias needed.
For now, we look for simple lines, not multi-segmented lines.
Definition at line 2081 of file djopt.c.
References add_point_to_rect(), any_line_selected(), autorouted, autorouted_only, DELETED, dprintf, line_s::e, empty_rect(), line_s::layer, line_s::line, line_in_rect(), move_line_to_layer(), corner_s::net, line_s::next, line_s::s, selected, simple_optimizations(), corner_s::via, corner_s::x, and corner_s::y.
Referenced by ActionDJopt(), and automagic().
int autorouted_only = 1 [static] |
Definition at line 125 of file djopt.c.
Referenced by ActionDJopt(), debumpify(), djopt_get_auto_only(), djopt_set_auto_only(), miter(), orthopull_1(), unjaggy_once(), and viatrim().
int component_layer |
Definition at line 223 of file djopt.c.
Referenced by ActionDJopt(), and grok_layer_groups().
Definition at line 117 of file djopt.c.
Referenced by adjust_vertices(), and find_corner().
{ {"djopt", 0, ActionDJopt, djopt_help, djopt_syntax} , {"OptAutoOnly", 0, djopt_set_auto_only, djopt_sao_help, djopt_sao_syntax} }
{ {"optautoonly", djopt_get_auto_only, NULL} }
const char djopt_help[] = "Perform various optimizations on the current board." [static] |
const char djopt_sao_help[] = "Toggles the optimize-only-autorouted flag." [static] |
const char djopt_sao_syntax[] = "OptAutoOnly()" [static] |
const char djopt_syntax[] = "djopt(miter)" [static] |
int layer_groupings[MAX_LAYER] [static] |
Definition at line 120 of file djopt.c.
Referenced by grok_layer_groups(), and intersecting_layers().
char layer_type[MAX_LAYER] [static] |
Definition at line 121 of file djopt.c.
Referenced by grok_layer_groups(), and padcleaner().
Definition at line 118 of file djopt.c.
Referenced by ActionDJopt(), new_line(), ReadNetlist(), and split_line().
corner_s * next_corner = 0 |
Definition at line 117 of file djopt.c.
Referenced by orthopull().
int solder_layer [static] |
Definition at line 223 of file djopt.c.
Referenced by ActionDJopt(), and grok_layer_groups().