Index: 1.1.4/configure =================================================================== --- 1.1.4/configure (revision 10776) +++ 1.1.4/configure (nonexistent) @@ -1,4 +0,0 @@ -#!/bin/sh -cd scconfig -make -./configure "$@" Property changes on: 1.1.4/configure ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: 1.1.4/AUTHORS =================================================================== --- 1.1.4/AUTHORS (revision 10776) +++ 1.1.4/AUTHORS (nonexistent) @@ -1,13 +0,0 @@ -pcb-rnd maintainer: Tibor 'Igor2' Palinkas -email: pcb-rnd (at) igor2.repo.hu -Chat, IRC: http://repo.hu/projects/pcb-rnd/irc.html - -An always up-to-date list of developers and contributors can be found at -http://repo.hu/cgi-bin/pcb-rnd-people.cgi - -PCB was originally written by Thomas Nau -Development was later taken over by harry eaton -The port to GTK was done by Bill Wilson -Dan McMahill converted the build system from imake to autoconf/automake. -DJ Delorie wrote the trace optimizer, added symbolic flag support and -many other improvements. Index: 1.1.4/doc-rnd/news.html =================================================================== --- 1.1.4/doc-rnd/news.html (revision 10776) +++ 1.1.4/doc-rnd/news.html (nonexistent) @@ -1,53 +0,0 @@ - - - pcb-rnd - news - - - - - - - - - -
Main - News - People - Events & timeline - pcb-rnd -
- - -
- -

News

- -
- - - -
- 2016-09-04 -
- Rebranding -
- We have a new main page reflecting the transition how we regard pcb-rnd: - it is not much of just a fork of geda/pcb by now, but a separate PCB - editor with its own team and own course. File save/load compatibility is - maintained. - -
- 2016-08-24 -
- Release 1.1.1 -
- Available at the download page . -
- The next development cycle will focus on editable/searchable attributes - and a new native file format. - -
-
- - - Index: 1.1.4/doc-rnd/irc.html =================================================================== --- 1.1.4/doc-rnd/irc.html (revision 10776) +++ 1.1.4/doc-rnd/irc.html (nonexistent) @@ -1,43 +0,0 @@ - - - pcb-rnd - IRC - - - - - - - - - -
Main - News - People - Events & timeline - pcb-rnd -
- - -

Live support via IRC (chat)

-
Irc server: repo.hu       Port: 6667       Channel: #pcb-rnd -
  -

I'm normally online as Igor2 between 5:00 CET and 19:00 CET; on Sunday there's an AFK-window between 11:00 CET and 16:00 CET. If I don't answer in a few minutes I'm probably away doing something, please be patient; say hi before you type your long question so you see if I'm available. -


-

-Below is an iframe of -kiwiirc irc client configured with the above settings. If it doesn't -work, please visit their page and -try to manually configure it, it's just 4 fields. -

-Using the web client: you may change your nickname; there's no password -or registration or channel key or ssl of any form. Your real IP won't be -shown on the IRC network (check kiwiirc's page about thier privacy -policy). -

-Connecting with the web client may take some time, give it a minute. -


- - - - - Index: 1.1.4/doc-rnd/conf/tree/rc_path.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/rc_path.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/rc_path.html (nonexistent) @@ -1,12 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: rc/path

- -
node name type flags description -
prefix string 0 e.g. /usr/local -
lib string 0 e.g. /usr/lib/pcb-rnd -
bin string 0 e.g. /usr/bin -
share string 0 e.g. /usr/share/pcb-rnd -
home string 0 user's home dir, determined run-time -
exec_prefix string 0 exec prefix path (extracted from argv[0]) -
Index: 1.1.4/doc-rnd/conf/tree/editor_view.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/editor_view.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/editor_view.html (nonexistent) @@ -1,8 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: editor/view

- -
node name type flags description -
flip_x boolean 0 view: flip the board along the X (horizontal) axis -
flip_y boolean 0 view: flip the board along the Y (vertical) axis -
Index: 1.1.4/doc-rnd/conf/tree/CFN_INTEGER.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_INTEGER.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_INTEGER.html (nonexistent) @@ -1,10 +0,0 @@ - - -

pcb-rnd conf tree

-

type: integer

-A decimal integer value without unit. The value might be stored in a -32 bit integer; safe range is approximately -2^31 .. 2^31. -

-Example values: 4, 1500, 2545343, -6 - - Index: 1.1.4/doc-rnd/conf/tree/appearance_messages.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/appearance_messages.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/appearance_messages.html (nonexistent) @@ -1,7 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: appearance/messages

- -
node name type flags description -
char_per_line integer 0 width of an output line in characters (used by separator drawing in find.c) -
Index: 1.1.4/doc-rnd/conf/tree/editor.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/editor.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/editor.html (nonexistent) @@ -1,49 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: editor

- -
node name type flags description -
grid_unit unit 0 select whether you draw in mm or mil -
grid coord 0 grid in pcb-units -
increments_mm increments 0 increments (size deltas) when drawing in mil -
increments_mil increments 0 increments (size deltas) when drawing in mil -
zoom real 0 default zoom -
mode integer 0 currently active mode -
buffer_number integer 0 number of the current buffer -
clear_line boolean 0 new lines/arc clear polygons. -
full_poly boolean 0 new polygons are full polygons. -
unique_names boolean 0 force unique names -
snap_pin boolean 0 snap to pins and pads -
snap_offgrid_line boolean 0 Snap to certain off-grid points along a line. -
highlight_on_point boolean 0 Highlight if crosshair is on endpoints. -
show_solder_side boolean 0 mirror output -
save_last_command boolean 0 the command entry editline always starts with the last command entered by user in the current session -
line_refraction integer 0 value for line lookahead setting -
save_in_tmp boolean 0 emergency save unsaved PCB data (despite the user clicks don't save) when: user starts a new PCB; user quits pcb-rnd. Does not affect the on-crash emergency save. -
draw_grid boolean 0 draw grid points -
all_direction_lines boolean 0 enable lines to all directions -
rubber_band_mode boolean 0 move, rotate use rubberband connections -
swap_start_direction boolean 0 change starting direction after each click -
show_drc boolean 0 show drc region on crosshair -
auto_drc boolean 0 when set, PCB doesn't let you place copper that violates DRC. -
show_number boolean 0 pinout shows number -
orthogonal_moves boolean 0 move items orthogonally. -
reset_after_element boolean 0 reset connections after each element while saving all connections -
auto_place boolean 0 flag which says we should force placement of the windows on startup -
lock_names boolean 0 lock down text so they can not be moved or selected -
only_names boolean 0 lock down everything else but text so only text objects can be moved or selected -
thin_draw boolean 0 if set, objects on the screen are drawn as outlines (lines are drawn as center-lines). This lets you see line endpoints hidden under pins, for example. -
thin_draw_poly boolean 0 if set, polygons on the screen are drawn as outlines. -
local_ref boolean 0 use local reference for moves, by setting the mark at the beginning of each move. -
check_planes boolean 0 when set, only polygons and their clearances are drawn, to see if polygons have isolated regions. -
show_mask boolean 0 show the solder mask layer -
hide_names boolean 0 when set, element names are not drawn. -
description boolean 0 display element description as element name, instead of value -
name_on_pcb boolean 0 display Reference Designator as element name, instead of value -
fullscreen boolean 0 hide widgets to make more room for the drawing -
click_time integer 0 default time for click expiration, in ms -
enable_stroke boolean 0 Enable libstroke gestures on middle mouse button when non-zero -
live_routing boolean 0 autorouter shows tracks in progress -
beep_when_finished boolean 0 flag if a signal should be produced when searching of connections is done -
undo_warning_size integer 0 warn the user when undo list exceeds this amount of kilobytes in memory -
Index: 1.1.4/doc-rnd/conf/tree/CFN_STRING.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_STRING.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_STRING.html (nonexistent) @@ -1,13 +0,0 @@ - - -

pcb-rnd conf tree

-

type: string

-Text value. -

-Example values: -

-foo
-bar
-{long text with / punctuation?}
-
- Index: 1.1.4/doc-rnd/conf/tree/CFN_COORD.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_COORD.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_COORD.html (nonexistent) @@ -1,10 +0,0 @@ - - -

pcb-rnd conf tree

-

type: coord

-A coordinate: size, distance, spacing. A decimal number with an unit. Unit -can be metric (e.g. mm, cm, m) or imperial (e.g. mil). -

-Example values: 1.5mm, 15 mil - - Index: 1.1.4/doc-rnd/conf/tree/appearance_color.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/appearance_color.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/appearance_color.html (nonexistent) @@ -1,30 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: appearance/color

- -
node name type flags description -
black color 0 -
white color 0 -
background color 0 background and cursor color ... -
crosshair color 0 different object colors -
cross color 0 -
via color 0 -
via_selected color 0 -
pin color 0 -
pin_selected color 0 -
pin_name color 0 -
element color 0 -
element_nonetlist color 0 -
rat color 0 -
invisible_objects color 0 -
invisible_mark color 0 -
element_selected color 0 -
rat_selected color 0 -
connected color 0 -
off_limit color 0 -
grid color 0 -
layer color 0 -
layer_selected color 0 -
warn color 0 -
mask color 0 -
Index: 1.1.4/doc-rnd/conf/tree/CFN_INCREMENTS.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_INCREMENTS.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_INCREMENTS.html (nonexistent) @@ -1,8 +0,0 @@ - - -

pcb-rnd conf tree

-

type: increments

-A collection of coordinates representing an increment configuration. -

-TODO - Index: 1.1.4/doc-rnd/conf/tree/appearance_pinout.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/appearance_pinout.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/appearance_pinout.html (nonexistent) @@ -1,12 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: appearance/pinout

- -
node name type flags description -
name_length integer 0 -
zoom real 0 -
offset_x coord 0 X offset of origin -
offset_y coord 0 Y offset of origin -
text_offset_x coord 0 X offset of text from pin center -
text_offset_y coord 0 Y offset of text from pin center -
Index: 1.1.4/doc-rnd/conf/tree/appearance.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/appearance.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/appearance.html (nonexistent) @@ -1,8 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: appearance

- -
node name type flags description -
rat_thickness coord 0 -
mark_size coord 0 relative marker size -
Index: 1.1.4/doc-rnd/conf/tree/CFN_LIST.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_LIST.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_LIST.html (nonexistent) @@ -1,10 +0,0 @@ - - -

pcb-rnd conf tree

-

type: list

-An ordered list of strings. -

-Example values: -

-li:{ foo; bar; {foo/bar/with-punctuation}; 123}
-
Index: 1.1.4/doc-rnd/conf/tree/rc.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/rc.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/rc.html (nonexistent) @@ -1,25 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: rc

- -
node name type flags description -
verbose integer 0 -
backup_interval integer 0 time between two backups in seconds -
font_command string 0 commands for file loading... -
file_command string 0 -
file_path string 0 -
library_shell string 0 -
library_search_paths list 0 -
emergency_name string 0 file name template for emergency save anonymous .pcb files (when pcb-rnd crashes); optional field: %ld --> pid; must be shorter than 240 characters. Don't do emergency save if this item is empty. -
backup_name string 0 file name template for periodic backup anonymous .pcb files; optional fields: %P --> pid -
save_command string 0 command to pipe the pcb, footprint or buffer file into, when saving (makes lihata persist impossible) -
keep_save_backups boolean 0 a copy is made before a save operation overwrites an existing file; if this setting is true, keep the copy even after a successful save -
default_font_file list 0 name of default font file (list of names to search) -
default_pcb_file list 0 -
script_filename string 0 PCB Actions script to execute on startup -
action_string string 0 PCB Actions string to execute on startup -
rat_path string 0 -
rat_command string 0 -
preferred_gui list 0 if set, try GUI HIDs in this order when no GUI is explicitly selected -
have_regex boolean 0 whether we have regex compiled in -
Index: 1.1.4/doc-rnd/conf/tree/CFN_COLOR.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_COLOR.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_COLOR.html (nonexistent) @@ -1,9 +0,0 @@ - - -

pcb-rnd conf tree

-

type: color

-A color description. Use the "webcolor" format: #rrggbb, where -rr, gg and bb are 2 digit hexadecimal values for red, green and blue -components. -

-Example values: #ff0000 for red, #555555 for grey. Index: 1.1.4/doc-rnd/conf/tree/CFN_UNIT.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_UNIT.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_UNIT.html (nonexistent) @@ -1,9 +0,0 @@ - - -

pcb-rnd conf tree

-

type: unit

-Name of a unit. -

-Example values: mm, cm, m, mil - - Index: 1.1.4/doc-rnd/conf/tree/CFN_BOOLEAN.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_BOOLEAN.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_BOOLEAN.html (nonexistent) @@ -1,8 +0,0 @@ - - -

pcb-rnd conf tree

-

type: boolean

-Boolean value: true or false. Most often used for determining whether a -feature or a (display mode) is enabled. -

-Example values: true, false, on, off, yes, no, 1, 0. Index: 1.1.4/doc-rnd/conf/tree/temp.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/temp.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/temp.html (nonexistent) @@ -1,7 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: temp

- -
node name type flags description -
rat_warn boolean 0 rats nest has set warnings -
Index: 1.1.4/doc-rnd/conf/tree/CFN_REAL.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/CFN_REAL.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/CFN_REAL.html (nonexistent) @@ -1,9 +0,0 @@ - - -

pcb-rnd conf tree

-

type: real

-A decimal numeric value without unit. -

-Example values: 3.141592654, 5, -12, 0 - - Index: 1.1.4/doc-rnd/conf/tree/design.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/design.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/design.html (nonexistent) @@ -1,26 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: design

- -
node name type flags description -
via_thickness coord 0 -
via_drilling_hole coord 0 -
line_thickness coord 0 -
clearance coord 0 -
max_width coord 0 -
max_height coord 0 -
alignment_distance coord 0 default drc size -
bloat coord 0 default drc size -
shrink coord 0 -
min_wid coord 0 -
min_slk coord 0 -
min_drill coord 0 -
min_ring coord 0 -
text_scale integer 0 text scaling in % -
poly_isle_area real 0 polygon min area -
default_layer_name string 0 -
fab_author string 0 Full name of author for FAB drawings -
initial_layer_stack string 0 If set, the initial layer stack is set to this -
groups string 0 string with layergroups -
routes string 0 string with route styles -
Index: 1.1.4/doc-rnd/conf/tree/appearance_misc.html =================================================================== --- 1.1.4/doc-rnd/conf/tree/appearance_misc.html (revision 10776) +++ 1.1.4/doc-rnd/conf/tree/appearance_misc.html (nonexistent) @@ -1,7 +0,0 @@ - -

pcb-rnd conf tree

-

subtree: appearance/misc

- -
node name type flags description -
volume integer 0 the speakers volume -100..100 -
Index: 1.1.4/doc-rnd/conf/lists.html =================================================================== --- 1.1.4/doc-rnd/conf/lists.html (revision 10776) +++ 1.1.4/doc-rnd/conf/lists.html (nonexistent) @@ -1,125 +0,0 @@ - - -

The new config system in pcb-rnd

-

Lists and arrays

- -Non-scalar settings are arrays or lists. Arrays can be explicitly indexed - -The default policy is always overwrite. -

-There are three active policies: overwrite, prepend and append. -When dealing with lists: -

-Step 3 is straight-forward: if policy is overwrite, reset the output -list and copy the source's list into the output list. If policy is -prepend (or append), keep the current output list and prepend -(or append) the list provided by the source. -

-In practice this means the user can replace, prepend or append ordered lists -from various sources. A common example is setting the library search paths. - -

examples

- -

simple overwrite

-Config sources (ordered by priority): - -
role priority policy content -
system 200 overwrite A,B,C -
user 400 overwrite (not defined) -
project 600 overwrite D,E -
-

Merge iterations: - -
step description output list after executing this step remarks -
0. reset the output (empty)   -
1. apply system A,B,C   -
2. apply user A,B,C "not defined" doesn't mean "empty", so the list is not deleted - no change -
3. apply project D,E replace the original output because of the overwrite policy -
-

Example scenario: the project is restricted to local footprint libs; this setup -makes sure no system or user configuration injects external footprint paths. - -

empty overwrite

-Config sources (ordered by priority): - -
role priority policy content -
system 200 overwrite A,B,C -
user 400 overwrite (not defined) -
project 600 overwrite defined to be an empty list -
-

Merge iterations: - -
step description output list after executing this step remarks -
0. reset the output (empty)   -
1. apply system A,B,C   -
2. apply user A,B,C "not defined" doesn't mean "empty", so the list is not deleted - no change -
3. apply project (empty) replace the original output because of the overwrite policy -
- -

prepend

-Config sources (ordered by priority): - -
role priority policy content -
system 200 overwrite A,B,C -
user 400 prepend (not defined) -
project 600 prepend D,E -
-

Merge iterations: - -
step description output list after executing this step remarks -
0. reset the output (empty)   -
1. apply system A,B,C   -
2. apply user A,B,C "not defined" doesn't mean "empty", so the list is not deleted - no change -
3. apply project D,E,A,B,C   -
-

Example scenario: the project has its own footprint libs with two paths; these -should be searched before system and user paths, still, system path is also -kept so stock footprints can be found. -

-This is better than hardwiring A,B,C in the project's list: A, B and C may -depend on the installation on a given system. A project file has no idea -about how the system is installed but it is assumed system installation -and the system configuration file are consistent. - -

append

-Config sources (ordered by priority): - -
role priority policy content -
system 200 overwrite A,B,C -
user 400 append (not defined) -
project 600 append D,E -
-

Merge iterations: - -
step description output list after executing this step remarks -
0. reset the output (empty)   -
1. apply system A,B,C   -
2. apply user A,B,C "not defined" doesn't mean "empty", so the list is not deleted - no change -
3. apply project A,B,C,D,E   -
-

Example scenario: the project has its own footprint libs with two paths; these -should be searched after system and user paths. This means the local footprint -lib has lower priority than the stock footprints. See system-dependent -installation remarks in the previous point. - - -

prepend+append

-Config sources (ordered by priority): - -
role priority policy content -
system 200 overwrite A,B,C -
user 400 prepend X,Y,Z -
project 600 append D,E -
-

Merge iterations: - -
step description output list after executing this step remarks -
0. reset the output (empty)   -
1. apply system A,B,C   -
2. apply user X,Y,Z,A,B,C   -
3. apply project X,Y,Z,A,B,C,D,E   -
Index: 1.1.4/doc-rnd/conf/index_prog.html =================================================================== --- 1.1.4/doc-rnd/conf/index_prog.html (revision 10776) +++ 1.1.4/doc-rnd/conf/index_prog.html (nonexistent) @@ -1,8 +0,0 @@ - - -

The new config system in pcb-rnd

-

Programmer's documentation

- -TODO - - Index: 1.1.4/doc-rnd/conf/groups.html =================================================================== --- 1.1.4/doc-rnd/conf/groups.html (revision 10776) +++ 1.1.4/doc-rnd/conf/groups.html (nonexistent) @@ -1,116 +0,0 @@ - - -

The new config system in pcb-rnd

-

grouping - flat vs. tree

-The original settings and HID attribute system in pcb were both flat: -basically a list of type:key=val triplets. All settings in a few big bags; -which bag sometimes doesn't depend on some logical categorizing, but -historical reasons (e.g. which part of the code needs the given setting). -

-This works well for a small amount of settings but lack of categories or -hierarchy (or sets or groups) makes it harder to understand what setting does -what and orients users to just accept defaults. After a while it also -makes programmers think twice before adding a new setting, increasing the -crowd in a bag. This in turn results in a less configurable -system. -

-Introducing a hierarchy of settings can solve these problems by grouping -and categorizing settings. If the user is interested in how footprints are -searched, they can ignore the settings the editor/ subtree has. It is also -easier to save and reload selectively: when the hierarchy is done right, -closely related settings end up in the same category (thus the same subtree). -Thus saving or loading a subtree can fully save or restore a property of the -program, even if that property is affected by multiple settings. - -

pcb-rnd config tree

-The config tree, the full tree is, something that exists in memory. Actual -config files often contain only a subset of the tree. Multiple config files -(e.g. system level, user level, settings from the .pcb file) are loaded and -merged to form the final config tree. The hierarchy of the tree is represented -by setting groups, which are like directories on a file system. Actual settings -are always leaves of the tree, placed in a specific group at any level (just -like in file systems). A full path to a setting is written like a -path on a file system: group1/group2/item, where group1 and group2 are -names of setting groups and item is the name of the setting. Note: unlike -with real file systems, the leading slash (representing the root) is omitted. -

-Details/constraints: -A valid path unambiguously identifies a setting (or a setting group). Settings -and groups always have exactly one parent (except for the root group that -has no parent). There is only one root of the config tree. -

-The main groups in the logical tree are: - -

- -
(root)   (config root) -
|       -
+- rc run control (program startup) -
|       -
|   |   -
|   +- path paths automatically set up by the program at startup - do not specify these -
|       -
+- design some default settings of a new design; minimum/maximum value of some design settings -
|       -
+- editor how the pcb editor behaves - independent of HIDs or the GUI -
|   |   -
|   +- increments_mm interactive increment/decrement steps when active unit is mm -
|   |   -
|   +- increments_mil interactive increment/decrement steps when active unit is mil -
|   |   -
|   +- view default view parameters -
|       -
+- appearance how the GUI looks like - common to all GUI HIDs -
|   |   -
|   +- color layer colors, GUI colors, misc design colors -
|   |   -
|   +- pinout pin label properties -
|   |   -
|   +- messages message window properties -
|   |   -
|   +- misc non-GUI settings handled by the GUI HIDs -
|       -
+- plugins dynamic subtree for various plugin settings -
|   |   -
|   +- foo all settings of the imaginary foo plugin are registered in this group -
|       -
+- utils dynamic subtree for various plugin settings -
  |   -
  +- bar all settings of the imaginary bar utility are registered in this group -
-
- -

dynamic subtrees

- -The plugins/ and utils/ subtree are dynamic, which means their contents -are not defined by core pcb. -

-In plugins/ each plugin should create a group for its own settings. What -this subtree should contain depends on what plugins are actually loaded. -The benefit of this approach is that plugins can use the central config -infrastructure instead of inventing their own config files. This makes -user's life easier on many levels: single config syntax to learn; uniform -GUI (gtk HID's preferences window) to change all settings; uniform way to -save/restore parts of the settings. -

-The utils/ subtree is very similar in all aspects except that it is for -external utility programs. Utils that are closely related to pcb-rnd, such -as gsch2pcb-rnd, should work from the same configuration (e.g. to -make sure the same footprint paths are searched). If they already load the -pcb-rnd config files it's easier to keep their settings in the same tree, -in the same format. -

-Pcb-rnd doesn't generate warning for unrecognized settings in dynamic subtrees. -This lets the user configure plugins that are not always loaded and let util -settings sit in their subtree. - -

what happens to all these settings

- -After loading all config files they are merged: if the same setting is -described in multiple files, the higher priority wins or if the setting is -a list (e.g. library search paths) the items are merged in a final list. -At this point the full logical config tree is built. Next the textual values -from the logical tree are converted into binary (native C values like -"long int" or "double") and are saved in C variables for the code to -access them directly. - Index: 1.1.4/doc-rnd/conf/sources.html =================================================================== --- 1.1.4/doc-rnd/conf/sources.html (revision 10776) +++ 1.1.4/doc-rnd/conf/sources.html (nonexistent) @@ -1,72 +0,0 @@ - - -

The new config system in pcb-rnd

-

Sources

-There are different sources of configuration settings. These are -different configuration files, sometimes located on the file system. -The full list of config sources is: - - -
role default
setting
prio
location presence remarks -
internal - 100 - (compiled into the executable) - always - the ultimate fallback; allows pcb-rnd even if no other configuration file is found - - -
system - 200 - /usr/share/pcb-rnd/pcb-conf.lht - recommended - should hold system and installation specific settigns, e.g. path to the system-wise installed footprint library - -
default.pcb - 300 - /usr/share/pcb-rnd/default.pcb - deprecated - pcb editable defaults - -
user - 400 - ~/.pcb-rnd/pcb-conf.lht - recommended - store user preferences, user's common footprint lib path, etc; this is the first file the user can modify (even from the GUI) - -
environment - 500 - environment variables (TODO) - occassional - inject the same (temporary) settings in multiple pcb-rnd sessions without having to change config files - -
project - 600 - projdect.lht in the project directory - optional - local project settings - useful for large projects with multiple design (.pcb) files - -
design - 700 - saved in the design (.pcb) file - optional, common - per design deviation from the user+system config - -
cli - 800 - command line argument - occassional - inject/change a setting for a single session; useful in batch/automated processing -
- -

-Pcb-rnd reads them all, then merges all settings into a master binary -representation. If a setting is specified in multiple sources, the one -with the higher priority wins, except for lists where it is also possible -to prepend/append items. Default priorities are designed to result -precedence in an intuitive way (e.g. design settigns overwrite user settings). -However, priority can be changed per setting, resulting -in weak settings ("use this value if it was not already set") or strong settings -("I always want to use mincut, so I enable it from my user's config with high -priority and a version controlled project setting can not turn it off") - - Index: 1.1.4/doc-rnd/conf/plugin_chk.html =================================================================== --- 1.1.4/doc-rnd/conf/plugin_chk.html (revision 10776) +++ 1.1.4/doc-rnd/conf/plugin_chk.html (nonexistent) @@ -1,7 +0,0 @@ - - -

The new config system in pcb-rnd

-

Plugin programmer's checklist

- -TODO - Index: 1.1.4/doc-rnd/conf/src/merging.dot =================================================================== --- 1.1.4/doc-rnd/conf/src/merging.dot (revision 10776) +++ 1.1.4/doc-rnd/conf/src/merging.dot (nonexistent) @@ -1,103 +0,0 @@ -digraph g { - rankdir=LR; - - subgraph cluster_memtree { - label="in-memory lihata trees" - bgcolor=grey - rank=same - CFR_INTERNAL [label="CFR_INTERNAL\nultimate fallback"] - CFR_SYSTEM [label="CFR_SYSTEM\nsystem level configuration"] - CFR_DEFAULTPCB [label="CFR_DEFAULTPCB"] - CFR_USER [label="CFR_USER\nuser level configuration"] - CFR_ENV [label="CFR_ENV"] - CFR_PROJECT [label="CFR_PROJECT\nproject level configuration"] - CFR_DESIGN [label="CFR_DESIGN"] - CFR_CLI [label="CFR_CLI"] - } - - subgraph cluster_fields { - label="string -> conf_native_t hash" - bgcolor=grey - conf_fields [label="conf_fields\ncentral hash\nof all\nknown settings"] - } - - subgraph cluster_native { - label="native C structures\nper module" - bgcolor=grey - conf_core [label="conf_core\npcb-rnd core settings"] - conf_hid_gtk [label="conf_hid_gtk\nthe hid_gtk plugin's settings"] - conf_mincut [label="conf_mincut\nthe mincut plugin's settings"] - conf_report [label="conf_report\nthe report plugin's settings"] - conf_other [label="...\nother plugin's settings"] - } - - CFR_INTERNAL -> conf_fields [color=red] - CFR_SYSTEM -> conf_fields [color=red] - CFR_DEFAULTPCB -> conf_fields [color=red] - CFR_USER -> conf_fields [color=red] - CFR_ENV -> conf_fields [color=red] - CFR_PROJECT -> conf_fields [color=red] - CFR_DESIGN -> conf_fields [color=red] - CFR_CLI -> conf_fields [color=red] - - -# CFR_INTERNAL -> CFR_SYSTEM -# CFR_SYSTEM -> CFR_DEFAULTPCB -# CFR_DEFAULTPCB -> CFR_USER -# CFR_USER -> CFR_ENV -# CFR_ENV -> CFR_PROJECT -# CFR_PROJECT -> CFR_DESIGN -# CFR_DESIGN -> CFR_CLI - - conf_fields -> conf_core [color=red] - conf_fields -> conf_hid_gtk [color=red] - conf_fields -> conf_mincut [color=red] - conf_fields -> conf_report [color=red] - conf_fields -> conf_other [color=red] - - - - subgraph cluster_files { - label="config files" - bgcolor=grey - lht_system [label="/usr/share/pcb-rnd/pcb-conf.lht" shape=hexagon] - pcb_default [label="/usr/share/pcb-rnd/default.pcb" shape=hexagon] - project [label="./project.lht" shape=hexagon] - lht_user [label="~/.pcb-rnd/pcb-conf.lht" shape=hexagon] - } - - subgraph cluster_exec_env { - label="execution environment" - bgcolor=grey - env [label="environmental variables"] - cli [label="command line arguments\ne.g. -c or\npluginspecific args"] - } - - lht_internal [label="hardwired\nin the\nexecutable"] - design [label="settings\nin the\n.pcb file" shape=hexagon] - - lht_internal -> CFR_INTERNAL [label="program startup"] - lht_system -> CFR_SYSTEM [label="loaded at startup"] - pcb_default -> CFR_DEFAULTPCB [label="loadad in CreateNewPCB()"] - lht_user -> CFR_USER [label="loaded at startup" dir=both] - env -> CFR_ENV [label="built at startup"] - project -> CFR_PROJECT [label="loaded when a\nnew .pcb or project\nis loaded" dir=both] - design -> CFR_DESIGN [label="extracted when loading a design" dir=both] - cli -> CFR_CLI [label="built during\ncommand line argument\nparsing"] - - - hid_gtk [label="the GTK HID"] - - conf_core -> hid_gtk [weight=100] - conf_hid_gtk -> hid_gtk - - hid_gtk -> CFR_DESIGN [color=blue weigth=0] - hid_gtk -> CFR_PROJECT [color=blue weigth=0 style=dashed] - hid_gtk -> CFR_USER [color=blue weigth=0 style=dashed] - - - editor [label="core:\nediting pcb"] - conf_core -> editor [weight=100] - editor -> CFR_DESIGN [color=blue weigth=0] - -} \ No newline at end of file Index: 1.1.4/doc-rnd/conf/src/Makefile =================================================================== --- 1.1.4/doc-rnd/conf/src/Makefile (revision 10776) +++ 1.1.4/doc-rnd/conf/src/Makefile (nonexistent) @@ -1,2 +0,0 @@ -../merging.png: merging.dot - dot -Tpng merging.dot > ../merging.png \ No newline at end of file Index: 1.1.4/doc-rnd/conf/noextend.html =================================================================== --- 1.1.4/doc-rnd/conf/noextend.html (revision 10776) +++ 1.1.4/doc-rnd/conf/noextend.html (nonexistent) @@ -1,59 +0,0 @@ - - -

The OLD config system in pcb-rnd

-

If the config system is too static

- -This document describes the old situation, focusing on drawbacks for -a purpose: to give a hint on why some of the design decisions are made -the way they are, in the new conf system. - -

Settings, preferences, colors, and...

-The core implemented a so called Settings. It was a flat list of items, -each bound to a C variable. There was a bunch of metadata attached to -the items: name, type, description. Generic code could query or change -the value of any setting, the C code could read and write them directly -too. The content is saved to ~/.pcb/settings. -

-On the downside, the actual items this system knew about was pretty much -static, hardwired in core. A plugin could not register its own settings. -Multiple parallel methods were present in the code to overcome this -limitation: -

- -

Meta-drawbacks

-This also introduced a more subtle drawback: the configuration was now -scattered into different files, randomly (looking from the -user's point of view). In other words, the actual structure did not reflect -some logical grouping, but mostly historical or source code organizational -reasons. -

-In turn, this also limited (again somewhat randomly) what settings can be -stored system-wise, user-wise, or on project or design level. -

-Finally, handling of file search paths was not very sophisticated. There -was the system and user configuration that reflected where the stock -library or the user's generic library were installed. And then -there was the per-project local footprint libs that had to be somehow -added too. -

-There was a hardwired way of handling the situation where multiple set -of paths were specified. In practice it was usually possible to get this -to work for the simpler cases, but it was not powerful enough to express -things like "use all system and user libraries first, then the project's local -library" vs. "the project's local library has priority over system libraries". Index: 1.1.4/doc-rnd/conf/index_user.html =================================================================== --- 1.1.4/doc-rnd/conf/index_user.html (revision 10776) +++ 1.1.4/doc-rnd/conf/index_user.html (nonexistent) @@ -1,92 +0,0 @@ - - -

The new config system in pcb-rnd

-

User documentation

-As of 1.1.0, pcb-rnd switched to a lihata based configuration system. -The purpose of this document is to describes the basic system design going into -enough details to provide the user with full control over the configuration. -The other side, how the system is implemented is described in the - programmer's manual and there is also a -checklist to assist plugin programmers. - -

Architecture: data flows, merging, dispatching

-The final configuration is a collection of values for - all known settings, arranged in a tree. The config -tree is a theoretical concept; different representations of the tree are -actually built runtime, in-memory. Pcb-rnd code, plugins and utilities -are constantly reading these in-memory representations to decide how to -carry out their tasks. -

-Config settings are imported from multiple sources: from different files, -from environment vareiables, from command line arguments, from the .pcb -files on load. Any source can define any part of the config tree. -When the configuration is processed, each source is read into a temporary -tree and then all the temporary trees are merged into the final -config tree. The following diagram demonstrates all configuration -related data flows. -

- -

-The leftmost column of nodes are the sources. (Note: paths mentioned there are -the default paths, for reference, it is possible to change them compile-time.) -Along the black arrows, from left to right, each source is imported into a -tree representing a role: the role or -purpose of the source. The next -step is following the red arrows in two steps: - -Some components may change some of the settings run-time. The trivial example -is the GUI (hid_gtk on this diagram) that provides menus and dialog boxes for -the user to change settings. Such a change is always fed back (blue arrow) -to the design role tree directly, from where the new value is again merged -and dispatched along the red arrows. Changes in the design role are saved -with the .pcb file (thus the bidirectional black arrow between the source and -the in-memory tree for the design role). Occassionally the user wants to -save parts of the setting as a project setting or -as an user setting - in this case, along the dashed blue lines, the -corresponding project or user roles are modified. This again results in updating -the hash and the binary representation; these roles also have -bidirectional black arrows and their changes are also saved in the original -source. - -

Merge details

-In the new system it is up to the user to decide what settings are -system-level and what settings are user- or project-level. This is possible -because any source can define any setting. In the merging step (red arrows -between roles and the hash) it may turn out that there are overlaps (multiple -sources defining value for the same setting) or blind spots (no source -sets a given item). - -

overlaps

-Each setting in each source has a prioirty. The -priority can be defined in the source, or if it is not defined, each source -inherits a fallback default priority. The fallback is designed to provide -the intuitive order: cli > design > project > user > system. -

-When multiple sources are describing a value for the same setting, -priority decides the final value. Most settings are scalar: -a single integer, string or a single "yes/no" or "on/off" value (e.g. -the background color or whether polygons are thin-drawn). For scalars -the rule is simple: the higher priority value wins and all lower priority -values are discarded when putting the values into the hash. More -details: how different roles and priorities -can be used with scalars. - -

-There are some settings that are represented as an array or list of -values. They are described in a lihata list item ("li:") in the config -files and are generally called lists in this document. How lists -are merged is controlled by the merging policy, which can be -in each source, just like the prioirty is set. Check out the -list merging section for more details. - -

blind spots

-At the end the code does need a value for each setting, so in the final -render (after the hash) every setting must have a value. To avoid blind spots, -values not initialized, there is a built-in configuration file, compiled into -the executable. This file is loaded into role CFR_INTERNAL, and has -the lowest priority. This configuration file contains the default value for -all settings. - Index: 1.1.4/doc-rnd/conf/syntax.html =================================================================== --- 1.1.4/doc-rnd/conf/syntax.html (revision 10776) +++ 1.1.4/doc-rnd/conf/syntax.html (nonexistent) @@ -1,45 +0,0 @@ - - -

The new config system in pcb-rnd

-

Config file syntax

- -The config file sytnax is lihata. -Most users don't need to understand most of the syntax, just follow the -patterns seen in the examples. A few thumb of rules: - - -

config root syntax

-

-A pcb-rnd config file, (or document for short) has a single root -node whose name must be li:pcb-rnd-conf-v1 - this is the signature of the -document. It is a flat list of one or more config root/ subtrees. -TODO: is this really a list or a hash? -

-Each config root is a partial description of the - config tree (which is the logical -confgiuration of all possible settings). Config roots have a policy and -a priority attached. This is done in the name -of the config root, which must be of the form of policy-priority, -e.g. "overwrite-300" or "append-125". The priority part (with the dash) -can be omitted (and then the per role default priority is used), e.g. -"overwrite" or "append" are valid config root names. -

-Under the config root, a tree of sections (hashes) and setting values -(text nodes) are built. These structures and values are in 1:1 -correspondance with the config tree. Excess -(unknown) keys are considered a warning (except in the plugin/ and -utils/ subtrees). Missing keys or missing subtrees is normal because a config -root can be partial. -

-TODO: examples - -

list syntax

-TODO: list syntax - -

in project files

-TODO Index: 1.1.4/doc-rnd/conf/index.html =================================================================== --- 1.1.4/doc-rnd/conf/index.html (revision 10776) +++ 1.1.4/doc-rnd/conf/index.html (nonexistent) @@ -1,92 +0,0 @@ - - -

The new config system in pcb-rnd

-

Why, what was wrong with the old one?

-The old config system had several limitations that would have been -hard to fix keeping the original design: - - -

What the new system offers

- - -

How to get started

- - - -

But isn't this more complicated for the user?

-Hopefully not much. There are a few extra features, like -multiple sources with levels that did not -exist in pcb and lists with prepend/append. Some of these -features present in other software so users should be comfortable with the ideas. -The learning curve is probably compensated by the more orthogonal system. -The syntax is also geared for simplicity and easy use with text editors. -Finally, the new preferences dialog in the GTK HID and config actions help -the user to explore how settings got used from all the config sources. There's -an intended layering in complexity: simple things can be done easily without -having to understand the whole system. -

-All in all, the extra features the user needs to learn is comparable with -the old customs that he/she can forget. - -

And did it make the code more complicated?

-The size of the code did not change much after the initial config rewrite. -The new system has new features, some of which brought in a few hundred lines of -code, but a similar amount of old code could be removed. What came in is -infrastructure, what had to go was a bunch of repetitive config parsing, -boolean-setting-accessor-action code. This means on the long run, the more -settings are added, the more the new system pays back. -

-Read access, which is far the most common way to use the config in the -code (e.g. if (setting == true) { }) is very similar to the old Settings -system. Write access needs to go through a function call API, but this -is usually a single call per setting (instead of directly modifying a -variable). -

-For plugin programmers, the new system makes life much easier as they can -plug their settings in. - - -

Compatibility with mainline

- -None. The new configuration system uses a new logical structure, new file -format, new locations on the file system. Most setting names are the same -or very similar to the old ones. Some settings are renamed for clarity: -clearance is always called clearance, on the UI, in the code and in -config files as well (mainline pcb sometimes call it keepaway).The new, -tree-based logics adds a twist too: full names of settings are paths. - -

- -Since configuration is stored in new files, pcb-rnd settings do not interfere -with pcb settings on any level. - - - Index: 1.1.4/doc-rnd/conf/merging.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/conf/merging.png =================================================================== --- 1.1.4/doc-rnd/conf/merging.png (revision 10776) +++ 1.1.4/doc-rnd/conf/merging.png (nonexistent) Property changes on: 1.1.4/doc-rnd/conf/merging.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/conf/scalars.html =================================================================== --- 1.1.4/doc-rnd/conf/scalars.html (revision 10776) +++ 1.1.4/doc-rnd/conf/scalars.html (nonexistent) @@ -1,56 +0,0 @@ - - -

The new config system in pcb-rnd

-

Scalars

- -Scalar settings have only one value after the merge. The only policy -available is overwrite - this policy is applied regardless of the -current policy setting. - -

examples

- -

simple overwrite

-Config sources: - -
role priority policy content -
system 200 overwrite A -
user 400 overwrite (not defined) -
project 600 overwrite Q -
-

-Merge iterations: - -
step description output list after executing this step remarks -
0. reset the output (empty)   -
1. apply system A   -
2. apply user A "not defined" doesn't mean "empty", so the list is not deleted - no change -
3. apply project Q replace the original output because of the overwrite policy -
-

Example scenario: system default overriden by a project setting. - -

user-forced value

-Config sources append: - -
role priority policy content -
system 200 overwrite A -
user 650 overwrite E -
project 600 overwrite Q -
-

-Merge iterations: - -
step description output list after executing this step remarks -
0. reset the output (empty)   -
1. apply system A   -
2. apply project Q   -
3. apply user E   -
-

Example scenario: user preference enforced: even if the project file would use -'Q' for the given setting, the user prefers 'E'. This affects runtime -(the value of the setting after the merge, in other words how pcb-rnd works), -but does nto change the project configuration. This allows the given user to -always use 'E' for the given setting while lets other users working on the -same project use the value set in the project file. - - - Index: 1.1.4/doc-rnd/conf/prio.html =================================================================== --- 1.1.4/doc-rnd/conf/prio.html (revision 10776) +++ 1.1.4/doc-rnd/conf/prio.html (nonexistent) @@ -1,22 +0,0 @@ - - -

The new config system in pcb-rnd

-

Priorities

- -Priority is an integer property of each config root. -Syntax-wise it is part of the name of the config -root. In the lihata config file it is either specified or omitted. When -omitted, a role dependent default value is -used. The default values are chosen in an intuitive way, thus most -commonly the priority value is omitted. -

-For scalar settings, the highest priority -value determines the final value of a setting after the merge. If there -is a tie, role decides: the role closer to the CLI is stronger. -

-For lists and arrays, priority determines the -order of merge, which changes the order of itmes in the final list as -config roots prepend and append items. - - - Index: 1.1.4/doc-rnd/logo32.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/logo32.png =================================================================== --- 1.1.4/doc-rnd/logo32.png (revision 10776) +++ 1.1.4/doc-rnd/logo32.png (nonexistent) Property changes on: 1.1.4/doc-rnd/logo32.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/logo16.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/logo16.png =================================================================== --- 1.1.4/doc-rnd/logo16.png (revision 10776) +++ 1.1.4/doc-rnd/logo16.png (nonexistent) Property changes on: 1.1.4/doc-rnd/logo16.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/help.html =================================================================== --- 1.1.4/doc-rnd/help.html (revision 10776) +++ 1.1.4/doc-rnd/help.html (nonexistent) @@ -1,62 +0,0 @@ - - - pcb-rnd - help wanted - - - - - - - - - -
Main - News - People - Events & timeline - pcb-rnd -
- - -

pcb-rnd - help wanted

-The project is looking for volunteers for the features listed below. If -you want to contribute, you will need to have an svn client and an email -client. Furthermore an IRC client is strongly recommended. -

-You will become part of the team and get svn commit right immediately -when you start working. -

-Don't have much free time? Don't worry: the tasks below are split up in -very small (1..2 hours) chunks. Coordination is granted, the administrative -overhead is almost zero - you can focus on the task, and finish it whenever -you have a free hour. -

-Worrying about your contribution to go in /dev/null? Don't: pcb-rnd -has very short loops; you start contributing and get immediate feedback. Your -work is part of the official thing immediately and revised and accepted (or -rarely refused) within hours or at most days. -There are no bitrotting branches. -

-You are not confident enough with your skills? pcb-rnd is an optimal -project for learning. If you start contributing, you get support. There -are small and simple entry level tasks. Most of the tasks don't require -any programming skills. -

-Sign up: mail to pcb-rnd (at) igor2.repo.hu . -If you want to work on a feature not listed below, feel free to drop me -a mail. -

- -
ID skill required description -
tutorial geda user tutorial projects -
windows geda user generic testing on windows -
mtest geda user systematic manual testing -
doc geda user, html write sections of user documentation -
logo designer the official pcb-rnd logo -
banner designer pcb-rnd banner for the homepage -
icons designer icons, other graphical elements for the GTK HID -
css designer CSS for the homepage (only design/style, no content). -
atest C/beginner program automated test cases -
- - Index: 1.1.4/doc-rnd/motivation.html =================================================================== --- 1.1.4/doc-rnd/motivation.html (revision 10776) +++ 1.1.4/doc-rnd/motivation.html (nonexistent) @@ -1,109 +0,0 @@ - - - pcb-rnd - motivation - - - - - - - - - -
Main - News - People - Events & timeline - pcb-rnd -
- - -

pcb-rnd motivation

-

Phase 1: At the beginning... (2013..2014)

-I use PCB a lot on various computers. I used to try to join the mainstream -development with small contribution (minor patches) and was active on -IRC and the mailing lists for a while. However, it didn't work out well, -and: - -I was pondering a fork for years. The trigger was that one day I've upgraded -Debian on my lab computer and the new version of PCB came with gl enabled; this -made PCB absolutely unusable (had to wait like 10 seconds for a scroll) while -all the transparent polys over traces made the whole screen a mess. I should -have recompiled everything and built a new Debian package with gl disabled or -install from source (but I have too many computers for that). My decision -was to set up my own .deb but then build it from a fork (it's not much of -an extra effort), so I can add some of the features I miss in daily use. -My plans with this fork: - -

-Footnotes: -

- -

Phase 2: major cleanups (2015..2016)

-In the first phase I was mostly implementing a set of small features and fixes. -As I got more familiar with the code base, I decided to bite the bullet and -do some refactoring: - -

-Plans for the future includes: -

- -

Phase 3: community requested features (from 2016 onward)

-Overlapping phase 2 there is an ongoing - feature poll . If there -are enough active users/testers for a feature, it gets implemented in -phase 3. -

-There is a small, active, constructive community forming around pcb-rnd. Future -directions will be mainly set by their need. - - - Index: 1.1.4/doc-rnd/Autostyle.html =================================================================== --- 1.1.4/doc-rnd/Autostyle.html (revision 10776) +++ 1.1.4/doc-rnd/Autostyle.html (nonexistent) @@ -1,14 +0,0 @@ - - - - - - - -
Main - News - People - Events & timeline - pcb-rnd -
- Index: 1.1.4/doc-rnd/UNIX.txt =================================================================== --- 1.1.4/doc-rnd/UNIX.txt (revision 10776) +++ 1.1.4/doc-rnd/UNIX.txt (nonexistent) @@ -1,31 +0,0 @@ -State on UNIX systems -~~~~~~~~~~~~~~~~~~~~~ - -Source releases starting from 1.1.2 should compile and run out-of-the-box -on old UNIX systems, such as IRIX. Does NOT require any GNU installed. - -Requirements: - - x11 and motif (for the GUI) - - an awk implementation that supports gsub(), e.g. nawk - -1. If your C compiler does not support #warning, run a script to patch - the source: - - # cwd is the root of the distribution - util/workarounds/unwarn_all.sh - - This will take a while and will modify a lot of .c files. - -2. ./configure - -3. make - -Considerations listed in ../INSTALL apply. - -The above procedure has been tested on IRIX 5.3 on IP22. - -Expected compilation times [minute:second]: - -./configure compile, -O0 compile -O3 system -------------------------------------------------------------------------------- -1:55 7:40 14:27 IRIX 5.3, IP22 @ 100 MHz Index: 1.1.4/doc-rnd/packaging.txt =================================================================== --- 1.1.4/doc-rnd/packaging.txt (revision 10776) +++ 1.1.4/doc-rnd/packaging.txt (nonexistent) @@ -1,90 +0,0 @@ -Packaging pcb-rnd for a distribution -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -1. program, libs, desktop integration - -Pcb-rnd is an interactive printed circuit board editor program. A typical -user is an electric engineer. This sort of programs are often called EDA, -Electronics Design Automation. - -Pcb-rnd has different frontends: graphical and stdio/text based batch -processing. There are different graphical frontends - pcb-rnd does not -depend on gtk or motif, the specific frontend modules may depend on them. - -Pcb-rnd is scriptable if libgpmi is available. Since libgpmi is not -a mainstream library for the scripting feature it should also be packaged. - -Pcb-rnd is intended for UNIX-fans. It is heavily keyboard-oriented and it -doesn't assume its users don't want to understand or learn how it works. -Many typical user workflows include Makefiles and it's a common thing to -start pcb-rnd from a shell. Thus desktop integration is not in focus -at the moment. If you fixed things for this while packaging, please let -us know, we may merge your patches (see below). - -2. options, plugins, dependencies - -Pcb-rnd is a modular software with a lot of options. Majority of these options -are selected by the state of a module. A module has three states: - - disable: (not compiled at all) - - buildin: enabled and static linked - - plugin: enabled and dynamic loaded (from a .so) - -The configure script takes --disable-*, --building-* and --plugin-* -arguments with * substituted with the name of the module. The configure -script also determines the dependencies according to the selection. Special -arguments --all=plugin and --all=buildin are provided in configure to select -all working modules to be plugins or buildins. - -For binary distributions it's strongly recommended to have most of the -modules compiled as plugins and have them in separate packages. This -would let the user to install a core pcb-rnd package and then the GTK -or the lesstif plugin (or both) from separate packages. This also reduces -package dependencies. - -This is less relevant for source distributions, if the user has full control -over the configuration. - -If non-critical dependencies are not met, modules are automatically disabled -by ./configure. - -3. typical ./configure options - scconfig vs. auto* - -./configurfe --prefix works as expected. DESTDIR is called install_root. - -Typical commands for configuring pcb-rnd for packaging would be: - - ./configure --all=plugin --prefix=/usr - make all - install_root=/tmp/pkg_tmp make install - -We are happy with scconfig. Please don't write about how much better -autoconf or cmake would be, we won't switch. - -4. release cycles, tarballs, svn trunk - what to package - -Development happens in svn trunk/, there are usually no branches. While -we try to keep trunk/ compilable any time, it's not guaranteed that it -would work out-of-the-box between releases. It is not recommended to -package trunk/ - please package stable releases instead. - -We follow the "release early, release often" rule. Source release tarballs -are always considered stable. Beside the project web page, releases are -also accessible as svn tags: svn://repo.hu/pcb-rnd/tags . - -Sometimes we have minor releases with 1..2 month period, sometimes a -longer period passes between releases. - -There's no automated release notification at the moment; if you want to -get notified about new releases, please contact me (email -pcb-rnd (at) igor2.repo.hu) - -5. bug reporting and fixes for packaging - -There's no special method for reporting packaging related bugs and -feature requests, please follow the normal bug report instructions or just -drop me a mail. Please mention that the issue is related to packaging, this -usually gives it a higher priority. - -We are willing to make minor changes to make packaging easier - if you bump -into something you'd need to work around while packaging, please let us know, -we may just fix it "upstream". - Index: 1.1.4/doc-rnd/mods/gen.sh =================================================================== --- 1.1.4/doc-rnd/mods/gen.sh (revision 10776) +++ 1.1.4/doc-rnd/mods/gen.sh (nonexistent) @@ -1,128 +0,0 @@ -#!/bin/sh - -path=../../src_plugins - -sloc() -{ - (cd "$1" && sloccount .) | awk '/^Total Phys/ { size=$9; sub(",", "", size); print size }' -} - -gen_pie() -{ - local bn=$1 code_size=$2 color=$3 - echo "" - echo "@slice" - echo "$code_size" - echo "@label" - echo "$bn ($code_size)" - if test ! -z "$color" - then - echo "@color" - echo "$color" - fi -} - -echo "#autogenerated by gen.sh" > mods.pie -echo "#autogenerated by gen.sh" > after.pie - -echo HIDs >&2 -code_size=`sloc ../../src/hid` -gen_pie "HIDs" $code_size "orangered" >> after.pie - -echo Core >&2 -tmp=/tmp/pcb-mods-stat -mkdir $tmp -cp -r ../../src/*.c ../../src/*.h ../../src/Makefile* $tmp -code_size=`sloc $tmp` -gen_pie "core" $code_size "#00ff88" >> after.pie - -#echo 3rd >&2 -#code_size=`sloc ../../src_3rd` -#gen_pie "3rd" $code_size >> after.pie - - -( -cat pre.html -for n in $path/* -do - if test -d "$n" - then - echo $n >&2 - bn=`basename $n` - code_size=`sloc $n` - total=$(($total + $code_size)) - gen_pie $bn $code_size >> mods.pie -# case $bn in -# gpmi) echo "@pull" >> mods.pie; echo "0.1" >> mods.pie;; -# esac - - echo "$bn$code_size" - awk ' - /^#/ { - key=$1 - sub("#", "", key) - sub("[:=]", "", key) - $1="" - DB[key]=$0 - next - } - { desc = desc " " $0 } - - function strip(s) { - sub("^[ \t]*", "", s) - sub("[ \t]*$", "", s) - return s - } - - END { - st = DB["state"] - if (st ~ "partial") - clr = "bgcolor=\"yellow\"" - else if (st ~ "works") - clr = "bgcolor=\"lightgreen\"" - else if ((st ~ "fail") || (st ~ "disable")) - clr = "bgcolor=\"red\"" - else - clr="" - - clr2 = clr - if (clr2 != "") { - sub("bgcolor=\"", "", clr2) - sub("\"", "", clr2) - print "@color" >> "mods.pie" - print clr2 >> "mods.pie" - } - - print "" st - if (DB["lstate"] != "") - print "
(" strip(DB["lstate"]) ")" - - dfl = DB["default"] - if (dfl ~ "buildin") - clr = "bgcolor=\"lightgreen\"" - else if (dfl ~ "plugin") - clr = "bgcolor=\"yellow\"" - else if ((dfl ~ "fail") || (dfl ~ "disable")) - clr = "bgcolor=\"red\"" - else - clr="" - - print "" dfl - if (DB["ldefault"] != "") - print "
(" strip(DB["ldefault"]) ")" - print "" desc - } - ' < $n/README - fi -done -cat post.html -gen_pie "plugins" "$total" "#0088ff" >> after.pie -) > index.html - -for n in mods after -do - animpie < $n.pie | animator -H -d $n - pngtopnm ${n}0000.png | pnmcrop | pnmtopng > $n.png - rm ${n}0000.png -done - Property changes on: 1.1.4/doc-rnd/mods/gen.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: 1.1.4/doc-rnd/mods/after.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods/after.png =================================================================== --- 1.1.4/doc-rnd/mods/after.png (revision 10776) +++ 1.1.4/doc-rnd/mods/after.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods/after.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods/before.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods/before.png =================================================================== --- 1.1.4/doc-rnd/mods/before.png (revision 10776) +++ 1.1.4/doc-rnd/mods/before.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods/before.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods/mods.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods/mods.png =================================================================== --- 1.1.4/doc-rnd/mods/mods.png (revision 10776) +++ 1.1.4/doc-rnd/mods/mods.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods/mods.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods/post.html =================================================================== --- 1.1.4/doc-rnd/mods/post.html (revision 10776) +++ 1.1.4/doc-rnd/mods/post.html (nonexistent) @@ -1,3 +0,0 @@ - - - Index: 1.1.4/doc-rnd/mods/pre.html =================================================================== --- 1.1.4/doc-rnd/mods/pre.html (revision 10776) +++ 1.1.4/doc-rnd/mods/pre.html (nonexistent) @@ -1,60 +0,0 @@ - - -

pcb-rnd modularization

-

Why bother...

-I believe good software should be modular. This is especially important in -the context of large software, such as CAD applications. There should be -a thin core that can model the world and provide the basic operations defined -on it but anything else should go in separate modules. -

-Fortunately PCB already had a strong infrastructure supporting this idea. -It has dynamic loadable plugins and the GUI and exporters are in separate -HID modules. While working on pcb-gpmi and later pcb-rnd, I added the -gpmi module as a separate plugin. -

-As of version 1.0.8 a cosiderable chunk of core code has been moved into -core plugins. A core plugin is just a plugin that is -maintained together with the core, in the same repository, still the code is -somewhat detached from the core. More importantly, the user can choose, for -each plugin, separately: -

-

-I believe such modularization has benefits on multiple levels: -

- -

Progress in charts

-

Before-after

-All numbers are in SLOC -and are acquired running sloccount on the given directory. While lines of -code alone is not a true measure of complexity, it's a good estimation. The -slices of pie charts are the major components of the pcb-rnd executable. -
- -
        -
Before modularization: pcb-rnd version 1.0.7 -
Note: gpmi was already a plugin -
- After modularization: pcb-rnd version 1.0.8 -
Note: gpmi is part of the "plugins" slice -
-
-

Zooming on to the plugins

-

- -

-(Red means the plugin doesn't really work). - -

Progress in numbers

-Below is a table with the summary of core plugins. - -
module size [sloc] status configure
default
description - - Index: 1.1.4/doc-rnd/mods/index.html =================================================================== --- 1.1.4/doc-rnd/mods/index.html (revision 10776) +++ 1.1.4/doc-rnd/mods/index.html (nonexistent) @@ -1,136 +0,0 @@ - - -

pcb-rnd modularization

-

Why bother...

-I believe good software should be modular. This is especially important in -the context of large software, such as CAD applications. There should be -a thin core that can model the world and provide the basic operations defined -on it but anything else should go in separate modules. -

-Fortunately PCB already had a strong infrastructure supporting this idea. -It has dynamic loadable plugins and the GUI and exporters are in separate -HID modules. While working on pcb-gpmi and later pcb-rnd, I added the -gpmi module as a separate plugin. -

-As of version 1.0.8 a cosiderable chunk of core code has been moved into -core plugins. A core plugin is just a plugin that is -maintained together with the core, in the same repository, still the code is -somewhat detached from the core. More importantly, the user can choose, for -each plugin, separately: -

    -
  • to compile it as a buildin (static-link it into the pcb executable) -
  • to compile it as a plugin (dynamic-link it runtime, if the .so is installed in the plugins/ directory) -
  • to disable the plugin, so it is not compiled at all -
-

-I believe such modularization has benefits on multiple levels: -

    -
  • it is possible to compiler smaller, potentially faster executables by omitting features the specific user would never use anyway -
  • in a distribution dynamic-link plugins can be distributed as separate packages providing the user with the option to decide what features to install -
  • such plugins have to have some sort of APIs if they want to reference eachother or if the code needs to reference them; such an API may not (and often did not) exist when the code is part of the core -
- -

Progress in charts

-

Before-after

-All numbers are in SLOC -and are acquired running sloccount on the given directory. While lines of -code alone is not a true measure of complexity, it's a good estimation. The -slices of pie charts are the major components of the pcb-rnd executable. -
- -
        -
Before modularization: pcb-rnd version 1.0.7 -
Note: gpmi was already a plugin -
- After modularization: pcb-rnd version 1.0.8 -
Note: gpmi is part of the "plugins" slice -
-
-

Zooming on to the plugins

-

- -

-(Red means the plugin doesn't really work). - -

Progress in numbers

-Below is a table with the summary of core plugins. - -
module size [sloc] status configure
default
description - - -
autoplace608 - works - buildin - Automatically place elements. -
autoroute4177 - works - buildin - Automatically route selected or all rats. This is the original autorouter. -
dbus438 - disabled -
(TODO: needs scconfig support) -
disabled - Remote control PCB using DBUS. -
djopt2315 - works - buildin - Various board optimization algorithms. -
export_gcode2450 - works - buildin - Export to gcode -
export_lpr96 - works - buildin - Export to lpr (using export_ps to generate postscript) -
export_nelma683 -
export_ps1608 - works - buildin - Export postscript or embedded postscript. -
gpmi2992 - works - buildin -
(if gpmi is installed) -
Scriptable plugin system with about 10 scripting languages supported and dynamic load/unload of scripts that can manipulate the GUI, the board, can implement exporters, etc. -
import_edif3578 - works - buildin - Import code for netlists in the EDIF format. -
import_sch255 - works - buildin - Imports element and netlist data from the schematics (or some other source). -
mincut886 - works - buildin - Use the minimal cut algorithm to indicate shorts: instead of highlighting two random pins/pads, try to highlight the least number of objects that connect the two networks. -
oldactions53 - works - disabled - Random collection of old/obsolete actions. Bell(): audible feedback; DumpLibrary(): print footprint library on stdout -
puller1878 - works - buildin - Pull traces to minimize their length. -
renumber218 - works - buildin - Renumber elements (renaming them) and generate a text file for back annotation. -
stroke124 - partially works (doesn't work with lesstif; works with the gtk hid, but there's no zoom bindings) - disabled -
(requires libstroke installed) -
Gesture recognition with libstroke. -
toporouter6161 - fails -
(infinite loop in gts) -
disabled - Automatically route selected or all rats using a topological algorithm. This is the new autorouter from 2009. -
vendordrill567 - works - buildin - Vendor drill mapping. -
- - Index: 1.1.4/doc-rnd/contrib.html =================================================================== --- 1.1.4/doc-rnd/contrib.html (revision 10776) +++ 1.1.4/doc-rnd/contrib.html (nonexistent) @@ -1,66 +0,0 @@ - - - pcb-rnd - contribution - - - - - - - - - -
Main - News - People - Events & timeline - pcb-rnd -
- - -

pcb-rnd - contribution

- -If you are interested to help out, please contact me using - the live chat (CET daytime) or mail to: -pcb-rnd (at) igor2.repo.hu. - -

Contributing as a user

-Using pcb-rnd in production and just reporting bugs is already a huge contribution. -

-More dedicated users can join in scheduled, systematic testing. Such testing -is split up into independent chunks that each can be done in an hour. -

-Even more dedicated users can join developing the documentation. -

-None of the above requires or assumes any programming skill. - -

Contributing as a developer

- -The project is lead in an autocratic way by Igor2. - -Developer freedom taken away: -
    -
  • the basic concept of pcb-rnd is set and won't change -
  • the toolchain is chosen, and won't change; the usual hot topics: svn, scconfig, C. -
  • don't add code that restricts usability for others; add code that increases usability for some; thus prefer to add code in plugins! -
-

-Developer freedom promptly granted: -

    -
  • svn commit access from day 0 -
  • work together in trunk/, not alone in a branch -
  • pcb-rnd has a strong plugin support; want to implement a strange/controversial feature? In a plugin, almost anything goes -
  • especially in plugins, work on whatever you want, even if noone else needs that feature -
-

-Coding style/indentation: there's an unified style -in core and core plugins. If you work on those parts, try to stick to it. If you -are working on a new plugin, it's still the preferred style but you can use -a different style. However, the rule is that if someone else starts hacking -that part too, he is allowed to convert the code to the unified format; but -unified format can not be converted to anything else. So it's a one way -process which long term grants unified style while not demotivates a plugin -developer by forcing a style on him in the early, "when the bulk of the code -is written" phase. - - Index: 1.1.4/doc-rnd/myfeature.html =================================================================== --- 1.1.4/doc-rnd/myfeature.html (revision 10776) +++ 1.1.4/doc-rnd/myfeature.html (nonexistent) @@ -1,69 +0,0 @@ - - - pcb-rnd - my feature - - - - - - - - - -
Main - News - People - Events & timeline - pcb-rnd -
- - -

pcb-rnd - how to get my favorite feature implemented

- -The list below is sorted: top items have higher priority, but you -are free to choose any. - -

1. If you are a programmer with free time to spend

-Read the contribution howto and join the project. -You are welcome to work only on the feature you are interested in. You get -all the support (e.g. for understending the API, to get a blank plugin -set up so you need to fill in only the feature-specific parts, etc.). Success -rate shoudl be near to 100%. - -

2. If you are not a programmer and have free time

-You can join and work on things you don't need that much, but others do. -This will build your reputation in the community which in turns encourages -others to implement your favorite feature even if they wouldn't do it for -themselves. The success rate is somewhat more random, obviously. - -

3. If you don't have free time

-Consider donation: buy someone else's time. To do so, contact me -(see the contribution howto page). Since -you don't need to cover all costs and the hourly rates are much lower -on a pet project, and your feature may be simpler than it looks, and -someone who already knows the code also saves the learning cureve, it may -all be cheaper than you think. The success rate should be close to 100%. -

-However, this is a last resort solution, the above ones are clearly preferred. - - -

4. If you don't have anything to contribute with

-[DEL:Vote for it in the -feature poll. If your feature is not there, ask on the mailing list. -Chance for success: if it's a popular demand on the feature poll, chances -are somewhat good. Else chances are very low, but not zero.:DEL] -

-Because of 100% passivity of the geda community, I decided not to spend more -time on community-related tasks. The poll is there, you can use it, -but you will have to orgnaize at least 5 active, capable users who are -commited enough to spend significant time on testing/supporting development. -I will consider implementing your feature only if you can bring and keep -those people motivated and active. - -

5. If you tried everything, even point 4. and all failed...

-Complain loudly on the mailing list, advertise your opinion, try pushing -the thing - a.k.a. go trolling. Success rate is exactly 0%, -you make a lot of good friends enemies that will make it harder -to ask or contribute later for another feature, but it may make you feel -better. </irony>. - Index: 1.1.4/doc-rnd/hacking/plugin_core_simple.html =================================================================== --- 1.1.4/doc-rnd/hacking/plugin_core_simple.html (revision 10776) +++ 1.1.4/doc-rnd/hacking/plugin_core_simple.html (nonexistent) @@ -1,59 +0,0 @@ - - -

pcb-rnd hacking - simple core plugins

- -

Introduction

- -

Setting up a new core plugin

-
    -
  • 1. make up a name for the plugin. There are a few conventions. This document will refer to the name as plg, always replace it with your chosen name. -
  • 2. cd src_plugins; svn mkdir plg -
  • 3. copy Makefile, Plug.tmpasm and README from another, small plugin, for example from the report plugin (the next points will assume you picked this plugin as the source of the copy) -
  • 4. edit Makefile: replace report to plg -
  • 5. edit README; there should be short summary about the purpose of the plugin then "#key: value" pairs for statistics: -
      -
    • #state: either works or disabled -
    • #lstate: if state is disabled, add a new line #lstate: with a few words on why the plugin is disabled -
    • #default: disabled or builtin or plugin (this field might be removed later because of redundancy) -
    • #implements: the same as the plugin name prefix (see conventions. ) or (feature) for feature plugins; it's redundant but is kept for supporting external plugins -
    -
  • 6. edit Plug.tmpasm: -
    -put /local/pcb/mod {plg}
    -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/plg/foo.o $(PLUGDIR)/plg/bar.o @]
    -put /local/pcb/mod/CONF {$(PLUGDIR)/plg/foo_conf.h}
    -put /local/pcb/mod/YACC [@ $(PLUGDIR)/plg/bary @]
    -put /local/pcb/mod/LEX  [@ $(PLUGDIR)/plg/barl @]
    -		
    - -
      -
    • /local/pcb/mod: the name of the module we are compiling -
    • /local/pcb/mod/OBJS: a space separated list of object files to compile -
    • /local/pcb/mod/CONF: optional: the name of the conf struct header - if the plugin doesn't have runtime configuration settings, remove this line -
    • /local/pcb/mod/YACC: optional: if you have files for yacc-processing, list them without the .y suffix here (space separated) -
    • /local/pcb/mod/LEX: optional: if you have files for lex-processing, list them without the .l suffix here (space separated) -
    • Leave the switch part on the bottom intact. -
    -
  • 7. create your C sources and headers in src_plugins/plg/ -
  • 8. edit scconfig/plugins.h: copy an existing line and edit it: -
    -plugin_def("plg",       "short description",       default)
    -
    - Default is one of: -
      -
    • sbuildin - unless the user requests otherwise, your plugin is linked into the executable -
    • sdisable - unless the user requests otherwise, your plugin is not compiled (recommended until the plugin gets some user testing) -
    • splugin - unless the user requests otherwise, your plugin is dynamically linked; not recommended: the policy is to let users explicitly request dynamic linking -
    - The order of entries in the file is the same as the order in the summary table - at the end of ./configure; insert your plugin in the right group! -
  • 9. add your plugin to the build list in one of the src_plugins/plugins_*.tmpasm files; choose the file that lists plugins similar to yours. -
  • 10. run ./configure --buildin-plg -
  • 11. run make to see if it compiles and test -
  • (12. while developing, you can run make from src_plugins/plg - if - your plugin is a builtin, it will recompile pcb-rnd. For some of us it's convenient - to run make in the same directory where all the source files are.) -
- - - Index: 1.1.4/doc-rnd/hacking/indent.html =================================================================== --- 1.1.4/doc-rnd/hacking/indent.html (revision 10776) +++ 1.1.4/doc-rnd/hacking/indent.html (nonexistent) @@ -1,15 +0,0 @@ - - -

pcb-rnd - indentation

- -As of r1022 all old code is converted using indent(1) with the following -command line: - -
-indent --line-length128 -brs -br -nce --tab-size2 -ut -npsl  -npcs -hnl $*
-
-

-Contributors are kindly asked to follow this style or run the above commandline -on their code before sending a patch or commiting to svn. - - Index: 1.1.4/doc-rnd/hacking/c89.html =================================================================== --- 1.1.4/doc-rnd/hacking/c89.html (revision 10776) +++ 1.1.4/doc-rnd/hacking/c89.html (nonexistent) @@ -1,14 +0,0 @@ - - -

pcb-rnd - C89

- -The code is written in C, namely C89 for most parts with a few exceptions -written in C99. It's not yet decided whether the code will be C89 or C99 -long term. If it'll be C89, the C99 parts will be rewritten. If it'll be -C99, new code can use C99 features freely. Until the decision, keep -new code C89. Especlially watch out for these: -
    -
  • commengt: always use /* */, never // -
  • don't mix variable declaration with code - open a new {} block, which will also scope your new variables, or better yet, split up the function into smaller, static functions, the compiler will inline them anyway -
  • try to avoid vararg macros, use vararg functions instead -
Index: 1.1.4/doc-rnd/hacking/releasing.txt =================================================================== --- 1.1.4/doc-rnd/hacking/releasing.txt (revision 10776) +++ 1.1.4/doc-rnd/hacking/releasing.txt (nonexistent) @@ -1,11 +0,0 @@ -release check list - -0. test compile and test run a clean checkout on a clean system - configure with --debug --all=buildin, then without -1. check next version number and previous revision in tags/ -2. update the changelog -3. rewrite the release notes -4. modify version number in scconfig -5. update changelog in debian/ -6. commit trunk -7. svn tag using URLs Index: 1.1.4/doc-rnd/hacking/src/data1.dot =================================================================== --- 1.1.4/doc-rnd/hacking/src/data1.dot (revision 10776) +++ 1.1.4/doc-rnd/hacking/src/data1.dot (nonexistent) @@ -1,47 +0,0 @@ -digraph pcb_data { - PCBType_misc [label="misc fields:\nID\nName\nFileName\ncolors\ndrc settings\ncursor coords\ngrid\nlayergroups\nroute styles\n..."] - PCBType_flags [label="flags:\nChanged\nViaOn (vias drawn?)\n..."] - PCBType -> PCBType_misc - PCBType -> PCBType_flags - PCBType -> DataType - PCBType [shape=box] - - PCB [label="extern PCBType PCB\nglobal variable\nholding the current\nboard" shape=diamond] - PCB -> PCBType - - Buffers [label="extern BufferType Buffers[]\nglobal variable holding\nall paste buffers" shape=diamond] - Buffers -> BufferType - - BufferType_misc [label="misc fields:\nbounding box\noffset"] - BufferType -> BufferType_misc - BufferType -> DataType - BufferType [shape=box] - - DataType_lists [label="layer-independent lists:\nrats\nvias\nelements"] - DataType_rtrees [label="layer-independent rtrees"] - DataType_LayerN [label="LayerN: number of\nlayers in use"] - DataType_layers [label="an array of layers"] - - DataType -> DataType_misc - DataType -> DataType_LayerN - DataType -> DataType_layers - DataType -> DataType_lists - DataType -> DataType_rtrees - DataType [shape=box] - - DataType_layers -> LayerType - - - LayerType_lines [label="list and rtree of lines"] - LayerType_arcs [label="list and rtree of arcs"] - LayerType_texts [label="list and rtree of text objects"] - LayerType_polygons [label="list and rtree of polygons"] - LayerType_misc [label="misc fields:\nflags\ncolors"] - - LayerType -> LayerType_misc - LayerType -> LayerType_lines - LayerType -> LayerType_arcs - LayerType -> LayerType_texts - LayerType -> LayerType_polygons - LayerType [shape=box] -} Index: 1.1.4/doc-rnd/hacking/src/Makefile =================================================================== --- 1.1.4/doc-rnd/hacking/src/Makefile (revision 10776) +++ 1.1.4/doc-rnd/hacking/src/Makefile (nonexistent) @@ -1,2 +0,0 @@ -../data1.png: data1.dot - dot -Tpng $^ > $@ Index: 1.1.4/doc-rnd/hacking/plugin_naming.html =================================================================== --- 1.1.4/doc-rnd/hacking/plugin_naming.html (revision 10776) +++ 1.1.4/doc-rnd/hacking/plugin_naming.html (nonexistent) @@ -1,12 +0,0 @@ - - -

pcb-rnd hacking - plugin naming conventions

-
    -
  • export plugins start with export_; these render to a non-native format that can not be then loaded -
  • native formats are prefixed with io_; even if your plugin can now only load or save, if it's possible to do a load-save-load round-trip without data loss, it's an io_ -
  • interactive, often GUI, frontends are prefixed with hid_ -
  • footprint access plugins start with fp_ -
  • anything else is considered a feature plugin and has no specific prefix. -
- - Index: 1.1.4/doc-rnd/hacking/import.html =================================================================== --- 1.1.4/doc-rnd/hacking/import.html (revision 10776) +++ 1.1.4/doc-rnd/hacking/import.html (nonexistent) @@ -1,64 +0,0 @@ - - -

pcb-rnd hacking - how importers work

- -

Introduction

-This document describes the common aspects of import code, be it an -import_ plugin or the load part of an io_plugin, importing a footprint, -loading a board or a netlist. - -

Data structures

- -The board is stored in PCBType *. Some import code, like the one -that loads a design (an io plugin's ->parse_pcb function), gets the -target in an argument. (Other, non-import code usually operate on -the global variable that represents the current board: -PCBType *PCB.). -

-In either case, PCBType's most important field is PCBDataType *data, -which holds lists and vectors to store all objects on the board. When -the target is a buffer (e.g. io plugin's ->parse_element function), it's -a DataType *buf which also have a PCBDataType *data containing -the same data a board could. -

-A PCBDataType struct in turn has three sets of important fields: -

    -
  • lists for layer-independent objects (e.g. rat lines, vias, elements) -
  • number of layers in use (LayerN) and an array of layers (see later) -
  • rtree structures - these are used for looking up objects for locations -
-Each layer is a LayerType structure. A layer has the following fields: -
    -
  • lists for lines, texts, arcs, polygons -
  • some generic layer attributes (colors, flags, key-value pairs) -
  • an rtree struct for each object type. -
-

-Any code that needs to create objects should use the functions in create.[ch]. -The functions that operate layer-independently usually get a destination as -PCBDataType, so they can operate both on boards and buffers. A typical -example is PinTypePtr CreateNewVia(DataTypePtr Data, ...) that returns -NULL or the pointer to the new via that is already added to the corresponding list -of Data and in the rtree. -

-Layer object creation is done referencing the layer as LayerType *. A -typical example is LineTypePtr CreateDrawnLineOnLayer(LayerTypePtr Layer, ...) -which returns NULL on error or a pointer to the new line object created (inserted -in the layer's line list, added to the rtree). -

-Code should avoid manipulating the lists and rtree structures directly. - -
-
-Figure 1. simplified map of object related data structures -
-diamond: variable; rectangle: struct; round: struct field -
- - -

Extra steps around creating a new board

-TODO: postproc, post*, other setup - - - - Index: 1.1.4/doc-rnd/hacking/data1.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/hacking/data1.png =================================================================== --- 1.1.4/doc-rnd/hacking/data1.png (revision 10776) +++ 1.1.4/doc-rnd/hacking/data1.png (nonexistent) Property changes on: 1.1.4/doc-rnd/hacking/data1.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/distros.txt =================================================================== --- 1.1.4/doc-rnd/distros.txt (revision 10776) +++ 1.1.4/doc-rnd/distros.txt (nonexistent) @@ -1,47 +0,0 @@ -How to request packaging (distros sorted by popularity, 2016): - -Ubuntu: - easiest is to get in Debian, Ubuntu picks up packages from sid - alternative: ubuntu-devel-discuss@lists.ubuntu.com (pending) - alternative: https://bugs.launchpad.net/ubuntu/+filebug?no-redirect&field.tag=needs-packaging - -linux mint - https://blueprints.launchpad.net/linuxmint - (same maintainer as debian?) - -slackware: - Promised (AFK, ask again in 3rd week of sept) - geda/pcb maintainer: pfeifer[dot]felix[at]googlemail[dot]com (sent mail) - https://slackbuilds.org/guidelines/ - needs an existing package - since the slackbuild needs slackware's pkgtools usually at the end of a ./configure --prefix=/usr --extrastuff..make.. make install DESTDIR=/tmp/NAMEOFPACKAGE..cd /tmp/NAMEOFPACKAGE..makepkg -l y -c n ../NAMEOFPACKAGE-123.txz - installwatch can build a package - check out #slackbuilds - -Debian: - Bdale? - (alternative: pkg-electronics-devel@lists.alioth.debian.org - pending) - (alternative: RFP through reportbug) - -fedora: - https://fedoraproject.org/wiki/Package_maintainers_wishlist?rd=PackageMaintainers/WishList - (wrote mail to cicku) - -OpenSuse: - adrian [at] suse.de (mail sent) - -Arch: - DONE! needs to be modularized - Kyle Keen (mail sent) - -Manjaro: - Same as arch - ----- -FreeBSD: - hrs [at] freebsd.org (Hiroki Sato - mail sent) - -OpenBSD: - andreas.bihlmaier [at] gmx.de -> ENOTIME, he suggests ports@openbsd.org - - Index: 1.1.4/doc-rnd/query/tutor_cli.html =================================================================== --- 1.1.4/doc-rnd/query/tutor_cli.html (revision 10776) +++ 1.1.4/doc-rnd/query/tutor_cli.html (nonexistent) @@ -1,168 +0,0 @@ - - - -

advanced searc, command line tutorial: query language

- -

scope

- -pcb-rnd from version 1.1.3 features a flexible advnced search that helps -the user selecting/unselecting objects that match a given logical expression. -The core of the feature is the pcb-rnd query language. The same language -is used in the programmable DRC (see also: -a more formal description of the language). -

-The current document is a walk through of the practical aspects of the -language. It starts with the simplest examples while working towards more -complex cases. -

-A limited version of the functionality is accessible through a GUI -wizard when using the GTK HID. A separate -tutorial is dealing with that feature. - -

Actions

-The query(act, expr) action creates the list called "@", which contains all -objects of the design. Then it iterates over this list (if needed) and -evaluates the query expression on each object. For each evaluation "act" -is performed; "act" is one of: -
    -
  • select - add the matching object to the selections if expr evaluated to true -
  • unselect - remove the matching object from the selections if expr evaluated to true -
  • eval - print the result of the expression to stdout -
  • dump - this inhibits evaluating; it compiles the expression and dumps the parse tree (useful for debugging) -
-

-The symbol @ in the query represents the iterator, or in other words, -the current object we are checking. The engine iterates over all -copper objects, silk objects, pins, holes, layers and nets. A simple query -that selects all objects looks like this: -

-query(select, '@')
-
-The actual query experssion was a single @ in this case. This made -the iteration happen, got the expression evaluated one each object. The -result of each evaluation was the given object. Since these objects -were all existing, valid objects, they were taken as logical value TRUE, -thus for each the add-to-selection was performed. -

-Note: it's usually a good idea to write the expression in single quotes, because -it may contain commas, double quotes and parenthesis that pcb-rnd's action parser may -take as action syntax. -

-The same expression can ran with eval would print the result of each -evaluation: -

-query(eval, '@')
-
-This is visible on the terminal pcb-rnd was started from - on X, it's a good -idea to start a terminal and run pcb-rnd from that instead from a menu or -icon. The rest of this tutorial will use the eval query because it's easier -to include the result of an eval than of a selection. Most examples will -specify the query expression only, without quotes - the reader should -add the query(eval, ' ') part. - -

iteration vs. evaluate once

-If an expression does not reference the @ object, no iteration is performed -and the expression is ran only once: -
-query(eval, '1')
-
-This will calculate the value of 1 and prints it to the standard output. Since -theres no iteration, this can not result in changes in selection. However, -it makes it easy to demonstrate some basic concepts of the query language. -

-Note: if @ is present multiple times in the expression, it's still only -one loop over all objects. When evaluating the expression for a given object, -all instances of @ are substituted with the same object in that iteration. - - -

grammar: arithmetics and logics

-For example the integer and floating point numbers and the usual -arithmetic and logical operators work as expected: - - -
expression result explanation -
42 42 the integer value 42 -
3.14 3.14 the floating point value 3.14 -
10 mil 254000 a number with a unit suffix is converted to pcb-rnd's internal coordinate unit (nanometers) -
1+2 3 sum of 1 and 2 -
2*4 8 multiplication -
47/4 11 integer division (because both operands were integers) -
47/4.0 11.75 floating point division (because at least one of the operands was a float) -
(1+2)*5 15 parenthesis works as usual -
1 && 0 0 logical AND - the result is 1 if both operands were TRUE, 0 else -
1 || 0 1 logical OR - the result is 1 if either operand was TRUE, 0 else -
!2 0 logical NOT - 2 is non-zero, so it is TRUE, negate this to get the result (FALSE, which is 0) -
4 > 2 1 because four is greater than two; all the usual relational operats work: == is equal, != is not-equal, <, <=, > and >=. -
- -

grammar: object properties

-Object have named properties, e.g. the thickness of a line (or arc, or -trace in general) is called ".thickness", so the thickness of -the current object is: -
-	@.thickness
-
-

-Next, we can already select all traces thicker than 10 mil: -

-	query(select, '@.thickness > 10 mil')
-
-

-Because logical expressions are available, it's easy to select all medium-thick -lines: -

-	(@.thickness >= 10 mil) && (@.thickness <= 30 mil)
-
-

-or any trace that's too thin or too thick: -

-	(@.thickness < 10 mil) || (@.thickness > 30 mil)
-
-

-or traces that don't match our preferred 8, 10 and 15 mil thicnkess values: -

-	(@.thickness != 8 mil) && (@.thickness != 10 mil) && (@.thickness != 15 mil)
-
- -

grammar: invalid value

-But how comes an expression like '@.thickness > 10 mil' works while -@ iterates over non-trace objects, like layers, nets or elements that -clearly have no thickness? -

-The answer is the invalid value, which is neither true nor false. If -a property does not exist in a given object, the result is the invalid value -or invalid for short. The invalid is treated specially: -

    -
  • in arithmetic operations it propagates: if either operand is invalid, the result is invalid, e.g. 1+invalid = invalid; this affects +, -, *, / and all the relational operators -
  • in binary logic operations (&& and ||), it is ignored: it is assumed to be true in a && and false in a || so the outcome depends on the other operand -
  • in logical NOT (!), TODO -
-When @ refers to a non-trace object, @.thickness is invalid and -'@.thickness > 10 mil' is evaluated t invalid. If the result is not TRUE, -the requested action is not performed. -

-The invalid value is generated only when the expression is valid but the -actual object doesn't have the feature needed. If the expression is wrong, -an error is generated and the expression stops evaluating immediately. - -

grammar: more properties

-Some properties are a single numeric value, like thickness, or the -.name of a layer (which is a string) but others are objects. For -example the .layer property of a line or arc refers to the layer -object the given line or arc is drawn on. These in turn can be combined, -and the "name of the layer the current object is on": -
-	@.layer.name
-
-

-Referencing non-existing properties yields an error, e.g. @.thickness.layer -is an error - in contrast with @.layer, which may evaluate to the -invalid value (e.g. for vias or nets, because they don't have layers). -The difference is that tickness can not have a layer ever (thus is an error) -while @.layer is either applicable or not, but potentially could work, this -when it doesn't, it's only an invalid value. -

-Further useful property combinatons: -TODO -

-There is a full list of all properties. Index: 1.1.4/doc-rnd/windows.txt =================================================================== --- 1.1.4/doc-rnd/windows.txt (revision 10776) +++ 1.1.4/doc-rnd/windows.txt (nonexistent) @@ -1,38 +0,0 @@ -State on windows -~~~~~~~~~~~~~~~~ - -Does not work yet. This file documents how far we got. The situation -is constantly improving. - -1. Cross compilation from Linux to win32 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -(developers may need this, if you are an user, skip to 2.) - -TODO: deps with mpk - -Use mingw and wine: - - ./configure --emu="wine cmd /c" --target=i586-mingw32msvc "$@" - -(Replace i586- with whatever toolchain prefix you have) - -2. download the binary pack -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Temporary URL: http://igor2.repo.hu/tmp/pcb-rnd-pack.zip - -Download, unpack, run setup.bat then pcb-rnd.bat - -All binaries in the pack are cross-compiled from source, using mingw and -mpk. All binaries are 32-bit. The pack is self-contained, no gtk or other -external dependencies. - -Known bugs: - - inserting elements fail (even static ones) - - no shell and awk in the pack -> parametric footprints fail - - text (including menu text) doesn't appear on XP - - no exporters that depend on libgd (png, jpeg, gif, nelma) - -Worked on systems: - - Windows 8.1 pro, Hungarian, 32 bit - - Windows 7 pro, Hungarian, 64 bit - - Windows 7 pro, English, 64 bit Index: 1.1.4/doc-rnd/man/pcb-rnd.1 =================================================================== --- 1.1.4/doc-rnd/man/pcb-rnd.1 (revision 10776) +++ 1.1.4/doc-rnd/man/pcb-rnd.1 (nonexistent) @@ -1,47 +0,0 @@ -.\" pcb-rnd - manual -.\" Copyright (C) 2016 Tibor 'Igor2' Palinkas -.\" -.\" 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: pcb-rnd[removethis]@igor2.repo.hu -.TH pcb-rnd 1 2016-10-29 "" "pcb-rnd manual" -.SH NAME -pcb-rnd - Printed Circuit Board editor -.SH SYNPOSIS -.nf -.sp -\fBpcb-rnd [\fIoptions\fB] [\fIinputfile\fB] -.fi -.SH DECSRIPTION - -.BR pcb-rnd -is a modular PCB editor. The main use is interactive editing. If no \fI-x\fR is specified on the command line, the graphical editor mode is initiated. Automated, headless processing is also possible with \fI-x\fR or \fI--gui batch\fR. -.SH OPTIONS - - -.TP - -.B -x \fIexporter\fR [\fIexportflags] \fIinputfile\fR\fR -Instead of interactive editing, export the design (loaded from \fIinputfile\fR) to a file using the specified \fIexporter\fR plugin. A list of exporter-specific parameters may follow to control the details of the process. -.TP - -.B --gui \fIhid\fR -Use the \fIhid\fR plugin for the "gui" frontend. Common choices are "gtk" or "lesstif" for graphical user intrfaces and "batch" for a headless command-line interface (or automated batch processing). -.TP - -.B -c \fIpath=val\fR -Set a config node in role CFR_CLI. The path of the node is \fIpath\fR (e.g. editor/grid) and the new value is \fIval\fR (e.g. 5mm). -.PP - Index: 1.1.4/doc-rnd/man/pcb-rnd.1.html =================================================================== --- 1.1.4/doc-rnd/man/pcb-rnd.1.html (revision 10776) +++ 1.1.4/doc-rnd/man/pcb-rnd.1.html (nonexistent) @@ -1,79 +0,0 @@ - - - - -
pcb-rnd 1 - 2016-10-29 - pcb-rnd manual -
- - - -

NAME

-
-pcb-rnd - Printed Circuit Board editor -
- -

SYNPOSIS

-
-

-pcb-rnd [options] [inputfile] - - - -

- -

DESCRIPTION

-
-pcb-rnd is a modular PCB editor. The main use is interactive editing. If no -x is specified on the command line, the graphical editor mode is initiated. Automated, headless processing is also possible with -x or --gui batch. -
- - -

OPTIONS

-
- - - - - - - - - -
-x exporter [exportflags] inputfile - Instead of interactive editing, export the design (loaded from inputfile) to a file using the specified exporter plugin. A list of exporter-specific parameters may follow to control the details of the process. -
--gui hid - Use the hid plugin for the "gui" frontend. Common choices are "gtk" or "lesstif" for graphical user intrfaces and "batch" for a headless command-line interface (or automated batch processing). -
-c path=val - Set a config node in role CFR_CLI. The path of the node is path (e.g. editor/grid) and the new value is val (e.g. 5mm). -
-
-

- - -
pcb-rnd 1 - 2016-10-29 - pcb-rnd manual -
- - - Index: 1.1.4/doc-rnd/man/pcb-rnd.1.mml =================================================================== --- 1.1.4/doc-rnd/man/pcb-rnd.1.mml (revision 10776) +++ 1.1.4/doc-rnd/man/pcb-rnd.1.mml (nonexistent) @@ -1,38 +0,0 @@ -pcb-rnd -1 -2016-10-29 - - pcb-rnd - Printed Circuit Board editor - pcb-rnd [options] [inputfile] - - -pcb-rnd is a modular PCB editor. The main use is interactive -editing. If no -x is specified on the command line, the -graphical editor mode is initiated. Automated, headless processing -is also possible with -x or --gui batch. - - - - - - -x exporter [exportflags] inputfile - Instead of interactive editing, export the design (loaded from - inputfile) to a file using the specified - exporter plugin. A list of exporter-specific parameters - may follow to control the details of the process. - - - --gui hid - Use the hid plugin for the "gui" frontend. Common - choices are "gtk" or "lesstif" for graphical user intrfaces - and "batch" for a headless command-line interface (or automated - batch processing). - - - -c path=val - Set a config node in role CFR_CLI. The path of the node is - path (e.g. editor/grid) and the new value is - val (e.g. 5mm). - - - Index: 1.1.4/doc-rnd/man/index.html =================================================================== --- 1.1.4/doc-rnd/man/index.html (revision 10776) +++ 1.1.4/doc-rnd/man/index.html (nonexistent) @@ -1,3 +0,0 @@ - -

  • pcb-rnd (1) -- pcb-rnd - Printed Circuit Board editor - Index: 1.1.4/doc-rnd/man/gsch2pcb-rnd.1 =================================================================== --- 1.1.4/doc-rnd/man/gsch2pcb-rnd.1 (revision 10776) +++ 1.1.4/doc-rnd/man/gsch2pcb-rnd.1 (nonexistent) @@ -1,134 +0,0 @@ -.TH gsch2pcb-rnd 1 "September 25th, 2013" "gEDA Project" 1.8.2.20130925 -.SH NAME -gsch2pcb-rnd - Update pcb-rnd layouts from gEDA/gaf schematics -.SH SYNOPSIS -\fBgsch2pcb-rnd\fR [\fIOPTION\fR ...] {\fIPROJECT\fR | \fIFILE\fR ...} -.SH DESCRIPTION -.PP -\fBgsch2pcb-rnd\fR is a frontend to \fBgnetlist\fR(1) which aids in -creating and updating \fBpcb-rnd\fR(1) printed circuit board layouts based -on a set of electronic schematics created with \fBgschem\fR(1). - -.PP -Instead of specifying all options and input gEDA schematic \fIFILE\fRs -on the command line, \fBgsch2pcb-rnd\fR can use a \fIPROJECT\fR file -instead. - -.PP -\fBgsch2pcb-rnd\fR first runs \fBgnetlist\fR(1) with the `PCB' backend to -create a `.net' file containing a \fBpcb-rnd\fR(1) formatted netlist for -the design. - -.PP -The second step is to run \fBgnetlist\fR(1) again with the `gsch2pcb-rnd' -backend to find any \fBM4\fR(1) elements required by the schematics. -Any missing elements are found by searching a set of file element -directories. If no `.pcb' file exists for the design yet, it is -created with the required elements; otherwise, any new elements -are output to a `.new.pcb' file. - -.PP -If a `.pcb' file exists, it is searched for elements with a -non-empty element name with no matching schematic symbol. These -elements are removed from the `.pcb' file, with a backup in a -`.pcb.bak' file. - -.PP -Finally, \fBgnetlist\fR(1) is run a third time with the `pcbpins' -backend to create a `.cmd' file. This can be loaded into -\fBpcb-rnd\fR(1) to rename all pin names in the PCB layout to match the -schematic. - -.SH OPTIONS -.TP 8 -\fB-o\fR, \fB--output-name\fR=\fIBASENAME\fR -Use output filenames `\fIBASENAME\fR.net', `\fIBASENAME\fR.pcb', and -`\fIBASENAME\fR.new.pcb'. By default, the basename of the first -schematic file in the list of input files is used. -.TP 8 -\fB-d\fR, \fB--elements-dir\fR=\fIDIRECTORY\fR -Add \fIDIRECTORY\fR to the list of directories to search for PCB file -elements. -.TP 8 -\fB-r\fR, \fB--remove-unfound\fR -Don't include references to unfound elements in the generated `.pcb' -files. Use if you want \fBpcb-rnd\fR(1) to be able to load the -(incomplete) `.pcb' file. This is enabled by default. -.TP 8 -\fB-k\fR, \fB--keep-unfound\fR -Keep include references to unfound elements in the generated `.pcb' -files. Use if you want to hand edit or otherwise preprocess the -generated `.pcb' file before running \fBpcb\fR(1). -.TP 8 -\fB-p\fR, \fB--preserve\fR -Preserve elements in PCB files which are not found in the schematics. -Since elements with an empty element name (schematic "refdes") are -never deleted, this option is rarely useful. -.TP 8 -\fB--gnetlist\fR \fIBACKEND\fR -In addition to the default backends, run \fBgnetlist\fR(1) with `\-g -\fIBACKEND\fR', with output to `.\fIBACKEND\fR'. -.TP 8 -\fB--gnetlist-arg\fR \fIARG\fR -Pass \fIARG\fR as an additional argument to \fBgnetlist\fR(1). -.TP 8 -\fB--empty-footprint\fR \fINAME\fR -If \fINAME\fR is not `none', \fBgsch2pcb-rnd\fR will not add elements for -components with that name to the PCB file. Note that if the omitted -components have net connections, they will still appear in the netlist -and \fBpcb-rnd\fR(1) will warn that they are missing. -.TP 8 -\fB--fix-elements\fR -If a schematic component's `footprint' attribute is not equal to the -`Description' of the corresponding PCB element, update the -`Description' instead of replacing the element. -.TP 8 -\fB-q\fR, \fB--quiet\fR -Don't output information on steps to take after running \fBgsch2pcb-rnd\fR. -.TP 8 -\fB-v\fR, \fB--verbose\fR -Output extra debugging information. This option can be specified -twice (`\-v \-v') to obtain additional debugging for file elements. -.TP 8 -\fB-h\fR, \fB--help\fR -Print a help message. -.TP 8 -\fB-V\fR, \fB--version\fR -Print \fBgsch2pcb-rnd\fR version information. - -.SH PROJECT FILES -.PP -A \fBgsch2pcb-rnd\fR project file is a file (not ending in `.sch') -containing a list of schematics to process and some options. Any -long-form command line option can appear in the project file with the -leading `\-\-' removed, with the exception of `\-\-gnetlist-arg', -`\-\-fix-elements', `\-\-verbose', and `\-\-version'. Schematics should be -listed on a line beginning with `schematics'. -.PP -An example project file might look like: - -.nf - schematics partA.sch partB.sch - output-name design -.ad b - -.SH ENVIRONMENT -.TP 8 -.B GNETLIST -specifies the \fBgnetlist\fR(1) program to run. The default is -`gnetlist'. - -.SH AUTHORS -See the `AUTHORS' file included with this program. - -.SH COPYRIGHT -.nf -Copyright \(co 1999-2011 gEDA Contributors. License GPLv2+: GNU GPL -version 2 or later. Please see the `COPYING' file included with this -program for full details. -.PP -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -.SH SEE ALSO -\fBgschem\fR(1), \fBgnetlist\fR(1), \fBpcb-rnd\fR(1) Index: 1.1.4/doc-rnd/man/copyright.mml =================================================================== --- 1.1.4/doc-rnd/man/copyright.mml (revision 10776) +++ 1.1.4/doc-rnd/man/copyright.mml (nonexistent) @@ -1,21 +0,0 @@ - -pcb-rnd - manual\n -Copyright (C) 2016 Tibor 'Igor2' Palinkas\n -\n -This program is free software; you can redistribute it and/or modify\n -it under the terms of the GNU General Public License as published by\n -the Free Software Foundation; either version 2 of the License, or\n -(at your option) any later version.\n -\n -This program is distributed in the hope that it will be useful,\n -but WITHOUT ANY WARRANTY; without even the implied warranty of\n -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n -GNU General Public License for more details.\n -\n -You should have received a copy of the GNU General Public License along\n -with this program; if not, write to the Free Software Foundation, Inc.,\n -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n -\n -Contact: pcb-rnd[removethis]@igor2.repo.hu - -pcb-rnd manual Index: 1.1.4/doc-rnd/man/README =================================================================== --- 1.1.4/doc-rnd/man/README (revision 10776) +++ 1.1.4/doc-rnd/man/README (nonexistent) @@ -1,10 +0,0 @@ -Manual pages are written in the manual markup format and are compiled into -manual and html using mml. Do not edit the generated manual or html pages. - -The generated files are commited in the repository so dependencies are not -required for casual users to build the project. - -The required tools and dependencies are: - svn://repo.hu/libmawk/trunk - svn://repo.hu/web3.0/trunk - svn://repo.hu/shscripts/trunk/manmarkup Index: 1.1.4/doc-rnd/man/Makefile =================================================================== --- 1.1.4/doc-rnd/man/Makefile (revision 10776) +++ 1.1.4/doc-rnd/man/Makefile (nonexistent) @@ -1,58 +0,0 @@ -# This Makefile is a plain old hand written one; all configuration settings -# are included from ../../Makefile.conf which is scconfig generated - -IN=pcb-rnd.1.mml -OUT_HTML = pcb-rnd.1.html -OUT_MAN1 = pcb-rnd.1 -OUT_LINT = pcb-rnd.1.lint - -OUTPUT = $(OUT_HTML) $(OUT_MAN1) index.html -MML = /usr/bin/mml - -all: $(OUTPUT) - -lint: pcb-rnd.1.lint - -.SUFFIXES: .html .mml .lint - -.mml.html: .mml_linkmap - $(MML) -i copyright.mml -f html $< > $@ - -.mml: - $(MML) -i copyright.mml -f man $< > $@ - -.mml_linkmap: - $(MML) -i copyright.mml -f linkmap $(IN) > $@ - -index.html: - @echo "" > $@ - $(MML) -i copyright.mml -f indexhtml $(IN) >> $@ - @echo "" >> $@ - -clean: - -distclean: - -genclean: - rm $(OUTPUT) 2>/dev/null ; true - -.mml.lint: - $(MML) -i copyright.mml -f lint $< - -install_: - $(MKDIR) "$(MAN1DIR)" - $(CPC) "`pwd`/pcb-rnd.1" "$(MAN1DIR)/pcb-rnd.1" - $(CPC) "`pwd`/gsch2pcb-rnd.1" "$(MAN1DIR)/gsch2pcb-rnd.1" - -uninstall: - $(RM) "$(MAN1DIR)/pcb-rnd.1" - $(RM) "$(MAN1DIR)/gsch2pcb-rnd.1" - -install: - make install_ CPC="$(CP)" - -linstall: - make install_ CPC="$(LN)" - -include ../../Makefile.conf - Index: 1.1.4/doc-rnd/ddrc/requirements.txt =================================================================== --- 1.1.4/doc-rnd/ddrc/requirements.txt (revision 10776) +++ 1.1.4/doc-rnd/ddrc/requirements.txt (nonexistent) @@ -1,23 +0,0 @@ -The Dynamic DRC should be able to solve at least these tasks: - - check start grounding - - require element placement on same layer - - specify element proximity to each other on same layer - - specify element proximity to the edge - - specify element proximity to network or other copper feature - on the same layer - - perform copper vs. copper checks - - minimal gap between an object or network and anything else - - minimal gap between high voltage and low voltage networks - - perform copper geometry checks - - detect minimal width (high current) - - detect poly hairpin - - number and length of stubs (hight freq) - - "via cage": a given network needs to be sorrounded by a set of gnd vias - - network related copper checks - - matched length lines (e.g. fast dram bus) - - balanced transmission line (distance between the tracks) - - match and/or limit number of vias - - limit layer usage - - require layer stackup properties, e.g. microstrip, stripline - - e.g. require ground poly on the next layer - - e.g. number of gaps in the ground poly the line jumps Index: 1.1.4/doc-rnd/ddrc/examples1.txt =================================================================== --- 1.1.4/doc-rnd/ddrc/examples1.txt (revision 10776) +++ 1.1.4/doc-rnd/ddrc/examples1.txt (nonexistent) @@ -1,54 +0,0 @@ -# Example 1: Sensitive RF elements should be close -# -# e1 is the list of elements that have the user tag RF -# e2 is a copy of e1; it's needed to get two loops (e1 vs. e2 objects form pairs) -# Assert that any two components are closer than 25 mm to each other - -rule sensitive RF elements - let e1 (type(@, element)) && (@.a.group == "RF") - let e2 e1 - assert (distance(e1, e2) < 25 mm) - -# Example 2: matched trace lengths on dram data 0 -# -# e1 is the list of dram traces -# e2 is a copy of e1 (see Example 1) -# Assert that any two net lengths are matched within 2 mm - -rule matched length dram traces - let e1 (type(@, net)) && (@.a.group == "dram_data_0") - let e2 e1 - assert abs(netlen(e1) - netlen(e2)) < 2 mm - -# Example 3: check if isolation gap is maintained between any HV and LV nets -# (Lazy: assume any copper is part of a network, compare net-to-net only) -# -# hv is the list of high voltage nets -# lv is a list of non-hv networks -# - -rule isolation gap 1 - let hv (type(@, net)) && (@.a.high_voltage) - let lv (type(@, net)) && !(@.a.high_voltage) - assert !is_closer(lv, hv, 4 mm) - -# Example 4: check if isolation gap is maintained between any HV and LV nets -# (Proper way: do not forget about copper not part of any network!) -# -# hv is the list of high voltage nets -# hvo is a list of all objects found in hv -# cp is a list of all copper object -# There are two iterators in the assert: cp (all copper objects) and hv. -# For each hv and cp pair: -# - lcomplement returns a cp object if the cp object is not in hv (i.e. -# the object is low voltage); else the return value is empty and is_closer -# returns invalid which is not a violation -# - hvo is required because cp is an object while hv is a list of nets -# (so cp is never on the hv list) -# - if there was a valid (low voltage) cp object found, - -rule isolation gap 2 - let hv (type(@, net)) && (@.a.high_voltage) - let hvo lobjs(hv) - let cp (type(@, copper)) - assert !is_closer(lcomplement(cp, hvo), hv, 4 mm) Index: 1.1.4/doc-rnd/ddrc/proposal1.txt =================================================================== --- 1.1.4/doc-rnd/ddrc/proposal1.txt (revision 10776) +++ 1.1.4/doc-rnd/ddrc/proposal1.txt (nonexistent) @@ -1,242 +0,0 @@ -Dynamic DRC proposal 1: a Declarative DRC language. - -P0 A DRC program is an unordered list of rules. Rules are evaluated and - violations reported. The advantage of a declarative language is that - intermediate results can be cached and reused. - -P1 The language is intended to be human readable and human writable, but - the main goal is to let programs and scripts (e.g. netlisters) to - generate it. - -P2 A rule consists of three parts: - - the rule keyword; syntax: rule NAME - - build variables (lists) using search statements - - state assertions about those lists. - - comments, empty lines - -P3 Variables are named by the user and are local to the rule (TODO) - -P4 Lists are ordered. - -P5 A list is consists of zero or more objects. An object is: -P6 - the board -P7 - a layer -P8 - a board drawing primitive (line, arc, polygon, via, text) -P9 - an element primitive (element line, element arc(?), pin, pad, element name) -P10 - an element as a whole -P11 - a net -P61 - a 2D coordinate with or without layer information - -P12 Objects have named properties (or fields): -P13 - core attributes: for each object type a predefined set of key=value - pairs that always exist (e.g. thickness of a line, start angle of - an arc); these field names starts with "p." -P14 - user attributes: free-form key=value pairs optionally assigned by - the user; these field names start with "a." - -P15 Note: the language is case sensitive with keywords and builtins using - lowercase only. For better readability, in syntax description in this - document uppercase words are user chosen identifiers or fields. Whitespace - character sequences are usually treated as a single whitespace. (This - does not mean identifiers have to be uppercase in a program.) - - The syntax of a search statement is: - -P16 let LISTNAME EXPR - -P17 It creates a list called LISTNAME and evaluates expression EXPR to all - available objects and adds the objects that match EXPR to the list. Each - matching object is added only once. The particular order of objects on - the list is random. Object "matches EXPR" when the EXPR evaluated on - the object yields true. - -P18 The current object used in the iteration during the search is called - @. - -P19 An expression returns a value. A value can be: -P20 - an object -P21 - a list -P22 - scalar: a number or string (might be suffixed, like "42 mm") -P23 - void (empty, also known as false) - -P23 A value is considered true if: -P24 - it is an existing object -P25 - it is a non-empty list -P26 - it is a non-zero number or non-empty string -P69 - it is a valid coordinate - - An expression is one of: - - syntax meaning - ---------------------------------------------------------------- -P27 (EXPR) change precedence -P28 EXPR || EXPR logical OR (result: number) -P29 EXPR && EXPR logical AND (result: number) -P30 EXPR + EXPR add (number only) -P31 EXPR - EXPR subtract (number only) -P32 EXPR * EXPR multiply or ... (number only) -P32 EXPR / EXPR multiply or ... (number only) -P32 EXPR == EXPR the two values are equal -P33 EXPR != EXPR the two values are not equal -P71 EXPR ~ string regex match left EXPR using pattern right string -P34 EXPR > EXPR left EXPR is greater than right EXPR (number only) -P35 EXPR >= EXPR left EXPR is greater than or equal to right EXPR (number only) -P36 EXPR < EXPR left EXPR is less than right EXPR (number only) -P37 EXPR <= EXPR left EXPR is less than or equal to right EXPR (number only) -P38 !EXPR logical NOT (result: number, 0 or 1) -P39 FUNC(EXPR, EXPR, ...) call a function with 0 or more arguments -P40 EXPR.field evaluated to the value of an object field (see P45, P46) - - The syntax of an assertion is: - -P41 assert EXPR - -P42 If the EXPR in an assert evaluates to false, a DRC violation is generated. - -P43 If an assert EXPR is a list anywhere else than in a function argument, it is - evaluated for all valid members of the list (see P45, P46). For example - if there is a variable called FOO, which is a list of objects - (built using a search statement), expression - - FOO.p.thickness - - is evaluated as many times as many objects are on the list, and the - full assert is checked each case. If there is another similar list - called BAR, an expression: - - (FOO.p.thickness < BAR.p.thickness) - - will compare each possible pair of FOO and BAR objects. That is, if - FOO has 4 objects and BAR has 15 objects, that is 4*15 = 60 comparisons. - -P44 However, each list is iterated only once, even if it is referenced multiple - times in the same expression. For example, with the above lists: - - (FOO.p.clearance > 10 mil) && (FOO.p.thickness < BAR.p.thickness) - - the potential number of iterations is still 4*15, and not 4*4*15. In - practice the engine leverages lazy evaluation so if FOO.p.clearance - is smaller than 10 mil, the right size is not evaluated. See also: P45, P46. - -P45 A field reference is valid if the field exists. For example a line object - has a thickness attribute, thus the .p.thickness is valid, but a polygon - object does not have a thickness and .p.thickness on a polygon is invalid. - An user attribute reference (e.g. field .a.baz) is valid if the attribute - key exists in the given object. - -P46 Invalid fields are skipped in iterations. Thus if variable BLOBB is a list - that consists of 3 line, 2 arc and a layer objects, the following assert - will result in 2 comparisons only: - - (BLOBB.p.width >= 10 mm) - - (because only arc objects have valid .p.width field). - -P47. An invalid field in an expression is never considered an - error. In an assert statement it causes skipping an iteration. In a - search statement it evaluates to void. - -P48. A void value is never equal to anything. A void value is not equal - even to another void value. - -P49. Comments are lines starting with # - - - BUILTIN FUNCTIONS - -P70 list(LISTNAME) - Within an expression, a reference to a list may become an iterator and - refer to a single object. In case the expression needs the listm the - list() function protects LISTNAME from becoming an iterator. For - example llen(list(@)) is the number of all objects the design consists. - -P50 llen(EXPR) - Returns to the number of items of a list (an integer number >= 0). - -P51 lvalid(EXPR, field) - Returns a list of items on the list for which field is valid. - EXPR can be a list or an object. - -P52 lunion(EXPR1, EXPR2) - A new list is created; items of EXPR1 are copied to the new list in order. - Those items from EXPR2 that are not on the list already are appended, - keeping their order. The new list is returned. - - Both EXPR1 and EXPR2 can be either a list or an object. - - Note: order of arguments does matter (affects order of objects on the - resulting list). - -P53 lintersect(EXPR1, EXPR2) - A new list is created; items that are present on both EXPR1 and EXPR2 - are copied onto the new list. The new list is returned. - - Both EXPR1 and EXPR2 can be either a list or an object. - - Note 1: this function can be used as "is this object on the list" query: - list_intersection(LIST, OBJ) will result an empty list (which means false) - if OBJ is not on the list. - - Note 2: similarly, if both argument are objects, the result is false - if the two arguments are not the same object. - -P54 lcomplement(EXPR1, EXPR2) - Creates a new list with all items that are present in EXPR1 but not in - EXPR2. The new list is returned. - - Both EXPR1 and EXPR2 can be either a list or an object. - - -P55 ldiff(EXPR1, EXPR2) - Creates a new list with all items that are present either in EXPR1 or in - EXPR2 but not in both. The new list is returned. - - -P56 distance(EXPR1, EXPR2) - Calculates the shortest distance between two objects. Returns a number. - - Note: if any expression is a layer, the stack distance is calculated - (which will be 0 for now, as pcb-rnd doesn't yet know about layer thickness). - If the expression is a net, the whole shape of the net is used - (expensive! use is_closer() instead) - If the expression is the board, the operation is invalid (see P46). - -P57 is_closer(EXPR1, EXPR2, NUMBER) - Checks if EXPR1 and EXPR2 are closer to each-other than NUMBER. It uses - the classic bloat-and-find algorithm originally used by the classic DRC, - thus it is much cheaper than distance(EXPR1, EXPR2) < NUMBER. - -P58 netlen(EXPR) - Network length of EXRP1: sum of all non-overlapping trace/arc lengths that - make up a network; polygons are approximated with their average diameter - (TODO). If EXPR is an object, its length is returned. - -P59 netobjs(EXPR) - Creates and returns a list of objects consists of a net. - -P60 type(EXPR, TYPENAME) - EXPR is an object. Returns the object if it's type matches TYPENAME, else - returns void (a.k.a. false). This call is useful to decide whether an - object is of a specific type. TYPENAME is one of: - - drawing primitive type: arc, line, polygon, text, via, element - - element primitive type: element_line, element_name, pin, pad - - misc type: layer, net - - meta-type, or a group: - - copper: primitive that results in copper (arc, line, polygon, text (on copper), via, pin, pad) - - drilled: anything that drills the board (via, pin) - -P62 gridup(EXPR, NUM1, NUM2) - If expression is an object, return a list of coordinates that are on - the object, evenly spaced: -P63 - for lines and arcs, the points are evenly spaced on the centerlane with - a gap of NUM1, starting from both endpoints, having the corner case in - the middle; if NUM2 is 0, the gap at the middle may be larger than NUM1, - else it may be smaller than NUM1. -P64 - for polygons take a grid of NUM1*NUM2 spacing (NUM1 is always axis - aligned to X, NUM2 to Y). The offset of the grid is unspecified -P65 - element and text are ignored -P66 - a pad or pin is approximated with a polygon -P67 - for networks, iterate over all objects and append unique coordinates on - the resulting list -P68 There's no guarantee on the particular order of the list. - Index: 1.1.4/doc-rnd/Makefile =================================================================== --- 1.1.4/doc-rnd/Makefile (revision 10776) +++ 1.1.4/doc-rnd/Makefile (nonexistent) @@ -1,28 +0,0 @@ -MENU_RES=../src/pcb-menu-gtk.lht ../src/pcb-menu-lesstif.lht -MENU_RES_MKEY=../src/pcb-menu-mkey.lht -KEYLIST=../util/keylist.sh -DEBLIST=../util/devhelpers/deblist.sh - -all: keys.html keys_mkey.html - ./Autostyle.sh *.html features/*.html - -keys.html: $(MENU_RES) $(KEYLIST) - $(KEYLIST) $(MENU_RES) > keys.html - -keys_mkey.html: $(MENU_RES_MKEY) $(KEYLIST) - $(KEYLIST) $(MENU_RES_MKEY) > keys_mkey.html - -install: - cd man && make install - -linstall: - cd man && make linstall - -uninstall: - cd man && make uninstall - -clean: - cd man && make clean - -distclean: - cd man && make distclean Index: 1.1.4/doc-rnd/mac.txt =================================================================== --- 1.1.4/doc-rnd/mac.txt (revision 10776) +++ 1.1.4/doc-rnd/mac.txt (nonexistent) @@ -1,22 +0,0 @@ -State on MacOSX -~~~~~~~~~~~~~~~ - -Source releases starting from 1.1.0 should compile and run out-of-the-box. - -Requirements for GUI: x11 and gtk+ - - X11 server and client libraries for OS X are available from the XQuartz - download and install - - gtk+ is available from brew - * brew install dependencies (gtk+ and libgd) with the following commands - brew install libgd - brew install gtk+ - * if you want to use gEDA with PCB-RND you may want to install it as well - via brew - brew install homebrew/science/geda-gaf - -Known issues: - - application window opens behind other windows; it seems to be a gtk bug - that can not be worked around from the application - - slow rendering and error messages about invalid numerics on the console - -Considerations listed in ../INSTALL apply. Index: 1.1.4/doc-rnd/logo256.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/logo256.png =================================================================== --- 1.1.4/doc-rnd/logo256.png (revision 10776) +++ 1.1.4/doc-rnd/logo256.png (nonexistent) Property changes on: 1.1.4/doc-rnd/logo256.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/vianudge.txt =================================================================== --- 1.1.4/doc-rnd/djopt/vianudge.txt (revision 10776) +++ 1.1.4/doc-rnd/djopt/vianudge.txt (nonexistent) @@ -1,3 +0,0 @@ -Looks for vias where all traces leave in the same direction. Tries to -move via in that direction to eliminate one of the traces (and thus a -corner). Index: 1.1.4/doc-rnd/djopt/orthopull.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/orthopull.out.png =================================================================== --- 1.1.4/doc-rnd/djopt/orthopull.out.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/orthopull.out.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/orthopull.out.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/unjaggy.txt =================================================================== --- 1.1.4/doc-rnd/djopt/unjaggy.txt (revision 10776) +++ 1.1.4/doc-rnd/djopt/unjaggy.txt (nonexistent) @@ -1,2 +0,0 @@ -Looks for corners which could be flipped to eliminate one or more -corners (i.e. jaggy lines become simpler). Index: 1.1.4/doc-rnd/djopt/debumpify.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/debumpify.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/debumpify.pcb (nonexistent) @@ -1,89 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[0 5000 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - -Attribute("PCB::grid::unit" "mm") - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[23405 32500 30000 32500 1000 4000 "clearline"] - Line[92500 32500 111595 32500 1000 4000 "clearline"] - Line[30000 32500 30000 22500 1000 4000 "clearline"] - Line[30000 22500 37500 22500 1000 4000 "clearline"] - Line[37500 22500 37500 32500 1000 4000 "clearline"] - Line[37500 32500 47500 32500 1000 4000 "clearline"] - Line[47500 32500 57500 22500 1000 4000 "clearline"] - Line[57500 22500 67500 22500 1000 4000 "clearline"] - Line[67500 22500 77500 32500 1000 4000 "clearline"] - Line[77500 32500 82500 32500 1000 4000 "clearline"] - Line[82500 32500 85000 22500 1000 4000 "clearline"] - Line[90000 22500 92500 32500 1000 4000 "clearline"] - Line[85000 22500 90000 22500 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( - Text[30000 5000 0 105 "90" "clearline"] - Text[60000 5000 0 105 "45" "clearline"] - Text[82500 5000 0 105 "rand" "clearline"] -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/Post.html =================================================================== --- 1.1.4/doc-rnd/djopt/Post.html (revision 10776) +++ 1.1.4/doc-rnd/djopt/Post.html (nonexistent) @@ -1,4 +0,0 @@ -
  • autorun all the above except miter; run them multiple times until there's no more change possible     -
    - - Index: 1.1.4/doc-rnd/djopt/viatrim.txt =================================================================== --- 1.1.4/doc-rnd/djopt/viatrim.txt (revision 10776) +++ 1.1.4/doc-rnd/djopt/viatrim.txt (nonexistent) @@ -1,2 +0,0 @@ -Looks for traces that go from via to via, where moving that trace to a -different layer eliminates one or both vias. Index: 1.1.4/doc-rnd/djopt/miter.out.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/miter.out.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/miter.out.pcb (nonexistent) @@ -1,75 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[500.0 0 0 1] -Cursor[500 0 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 45000 15000 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 80000 47500 -4350 -5650 3 100 ""] -( - Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] - ElementLine [-3740 -2362 -3740 2362 800] - ElementLine [3740 -2362 3740 2362 800] - - ) -Layer(1 "component") -( - Line[50905 15000 53405 15000 1000 4000 "clearline"] - Line[80000 41595 80000 41595 1000 4000 "clearline"] - Line[53405 15000 80000 41595 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/Pre.html =================================================================== --- 1.1.4/doc-rnd/djopt/Pre.html (revision 10776) +++ 1.1.4/doc-rnd/djopt/Pre.html (nonexistent) @@ -1,14 +0,0 @@ - - -

    Action djopt()

    - -The different types of optimizations change your board in order to -reduce the total trace length and via count. Each optimization is accessible -using an argument, e.g. djopt(miter). The basic actions have to be run multiple -times as each iteration will change the design making new changes possible for -subsequent iterations with the same or other actions. -

    -Click on the images to download the example .pcb design. - - -
    argument name description example in example out after 1st iteration Index: 1.1.4/doc-rnd/djopt/vianudge.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/vianudge.out.png =================================================================== --- 1.1.4/doc-rnd/djopt/vianudge.out.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/vianudge.out.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/vianudge.out.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/unjaggy.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/unjaggy.out.png =================================================================== --- 1.1.4/doc-rnd/djopt/unjaggy.out.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/unjaggy.out.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/unjaggy.out.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/orthopull.out.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/orthopull.out.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/orthopull.out.pcb (nonexistent) @@ -1,99 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[47500 32500 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 52500 10000 4350 5650 1 100 ""] -( - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] - ElementLine [3740 -2362 3740 2362 800] - ElementLine [-3740 -2362 -3740 2362 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R103" "1206" 72500 10000 4350 5650 1 100 ""] -( - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] - ElementLine [3740 -2362 3740 2362 800] - ElementLine [-3740 -2362 -3740 2362 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R104" "1206" 62500 52500 -4350 -5650 3 100 ""] -( - Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] - ElementLine [-3740 -2362 -3740 2362 800] - ElementLine [3740 -2362 3740 2362 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 35000 10000 -4350 -5650 3 100 ""] -( - Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] - ElementLine [-3740 -2362 -3740 2362 800] - ElementLine [3740 -2362 3740 2362 800] - - ) -Layer(1 "component") -( - Line[52500 15905 52500 22500 1000 4000 "clearline"] - Line[72500 15905 72500 22500 1000 4000 "clearline"] - Line[62500 46595 62500 22500 1000 4000 "clearline"] - Line[35000 22500 52500 22500 1000 4000 "clearline"] - Line[35000 22500 35000 15905 1000 4000 "clearline"] - Line[62500 22500 72500 22500 1000 4000 "clearline"] - Line[52500 22500 62500 22500 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - Connect("R103-2") - Connect("R104-2") - ) -) Index: 1.1.4/doc-rnd/djopt/debumpify.txt =================================================================== --- 1.1.4/doc-rnd/djopt/debumpify.txt (revision 10776) +++ 1.1.4/doc-rnd/djopt/debumpify.txt (nonexistent) @@ -1,2 +0,0 @@ -Looks for U-shaped traces (with 90 degree corners) that can be shortened -or eliminated. Index: 1.1.4/doc-rnd/djopt/miter.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/miter.png =================================================================== --- 1.1.4/doc-rnd/djopt/miter.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/miter.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/miter.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/viatrim.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/viatrim.out.png =================================================================== --- 1.1.4/doc-rnd/djopt/viatrim.out.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/viatrim.out.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/viatrim.out.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/vianudge.out.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/vianudge.out.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/vianudge.out.pcb (nonexistent) @@ -1,79 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[17500 22500 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - -Via[85000 27500 8661 4000 0 3937 "" ""] - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 57500 10000 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["onsolder" "Standard SMT resistor, capacitor etc" "R102" "1206" 10000 10000 5650 4350 2 100 "auto"] -( - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "onsolder,square"] - Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "onsolder,square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[63405 10000 85000 10000 1000 4000 "clearline"] - Line[85000 10000 85000 27500 1000 4000 "clearline"] -) -Layer(2 "solder") -( - Line[15905 10000 30000 10000 2000 4000 "clearline"] - Line[30000 10000 30000 27500 2000 4000 "clearline"] - Line[30000 27500 85000 27500 2000 4000 "clearline"] - Line[85000 27500 85000 27500 2000 4000 "clearline"] -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/orthopull.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/orthopull.png =================================================================== --- 1.1.4/doc-rnd/djopt/orthopull.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/orthopull.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/orthopull.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/debumpify.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/debumpify.out.png =================================================================== --- 1.1.4/doc-rnd/djopt/debumpify.out.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/debumpify.out.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/debumpify.out.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/unjaggy.out.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/unjaggy.out.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/unjaggy.out.pcb (nonexistent) @@ -1,79 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[12500 10000 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 65000 12500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[23405 32500 37500 32500 1000 4000 "clearline"] - Line[37500 32500 37500 15000 1000 4000 "clearline"] - Line[37500 15000 37500 15000 1000 4000 "clearline"] - Line[37500 32500 37500 32500 1000 4000 "clearline"] - Line[37500 15000 45000 15000 1000 4000 "clearline"] - Line[45000 15000 45000 10000 1000 4000 "clearline"] - Line[45000 10000 59095 10000 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/Makefile =================================================================== --- 1.1.4/doc-rnd/djopt/Makefile (revision 10776) +++ 1.1.4/doc-rnd/djopt/Makefile (nonexistent) @@ -1,50 +0,0 @@ -PCB=../../src/pcb-rnd -HTML=index.html -CASES = \ - debumpify.$(TARGET) \ - miter.$(TARGET) \ - orthopull.$(TARGET) \ - unjaggy.$(TARGET) \ - vianudge.$(TARGET) \ - viatrim.$(TARGET) - -all: - make conv TARGET=out.png - make conv TARGET=png - make index - -index: - make index.html TARGET=txt - -index.html: Pre.html Post.html $(CASES) Makefile - cat Pre.html > $(HTML) - make conv TARGET=tbl - cat Post.html >>$(HTML) - -conv: $(CASES) - -.SUFFIXES: .pcb .out.pcb .png .out.png .tbl -.PRECIOUS: %.pcb %.out.pcb %.png %.out.png - -.pcb.out.pcb: - echo "OptAutoOnly(); djopt($*); SaveTo(LayoutAs, $*.out.pcb.tmp);"| $(PCB) --gui batch $*.pcb - awk '/Symbol.. . 1800./,/^Attribute/ { next } { print $$0 }' < $*.out.pcb.tmp > $*.out.pcb - rm $*.out.pcb.tmp - -.pcb.tbl: - echo '
    $*'>>$(HTML) - cat $*.txt >>$(HTML) - echo ' '>>$(HTML) - -.pcb.png: - $(PCB) -x png --dpi 300 $*.pcb - -out.pcb.out.png: - $(PCB) -x png --dpi 300 $*.out.pcb - -clean: - rm *.out.pcb *.png index.html 2>/dev/null; true - - - - Index: 1.1.4/doc-rnd/djopt/miter.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/miter.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/miter.pcb (nonexistent) @@ -1,80 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[500.0 0 0 1] -Cursor[500 0 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Attribute("PCB::grid::unit" "mil") - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 45000 15000 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 80000 47500 -4350 -5650 3 100 ""] -( - Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] - ElementLine [-3740 -2362 -3740 2362 800] - ElementLine [3740 -2362 3740 2362 800] - - ) -Layer(1 "component") -( - Line[50905 15000 80000 15000 1000 4000 "clearline"] - Line[80000 15000 80000 41595 1000 4000 "clearline"] - Line[81181 41595 80000 41595 1000 4000 "clearline"] - Line[80000 41595 78819 41595 1000 4000 "clearline"] - Line[50905 16181 50905 15000 1000 4000 "clearline"] - Line[50905 15000 50905 13819 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/viatrim.out.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/viatrim.out.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/viatrim.out.pcb (nonexistent) @@ -1,80 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[37500 10000 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - -Via[60000 32500 7874 4000 0 3150 "" ""] -Via[92500 32500 7874 4000 0 3150 "" ""] -Via[75000 32500 7874 4000 0 3150 "" ""] - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[23405 32500 60000 32500 1000 4000 "clearline"] - Line[92500 32500 111595 32500 1000 4000 "clearline"] - Line[60000 32500 60000 32500 1000 4000 "clearline"] - Line[60000 32500 75000 32500 1000 4000 "clearline"] -) -Layer(2 "solder") -( - Line[75000 32500 92500 32500 1000 4000 "clearline"] -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/vianudge.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/vianudge.png =================================================================== --- 1.1.4/doc-rnd/djopt/vianudge.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/vianudge.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/vianudge.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/unjaggy.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/unjaggy.png =================================================================== --- 1.1.4/doc-rnd/djopt/unjaggy.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/unjaggy.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/unjaggy.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/orthopull.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/orthopull.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/orthopull.pcb (nonexistent) @@ -1,98 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[47500 32500 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - -Attribute("PCB::grid::unit" "mm") - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 52500 10000 4350 5650 1 100 ""] -( - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] - ElementLine [3740 -2362 3740 2362 800] - ElementLine [-3740 -2362 -3740 2362 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R103" "1206" 72500 10000 4350 5650 1 100 ""] -( - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 5905 1181 5905 5118 2000 5718 "2" "2" "square"] - ElementLine [3740 -2362 3740 2362 800] - ElementLine [-3740 -2362 -3740 2362 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R104" "1206" 62500 52500 -4350 -5650 3 100 ""] -( - Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] - ElementLine [-3740 -2362 -3740 2362 800] - ElementLine [3740 -2362 3740 2362 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 35000 10000 -4350 -5650 3 100 ""] -( - Pad[-1181 5905 1181 5905 5118 2000 5718 "1" "1" "square"] - Pad[-1181 -5905 1181 -5905 5118 2000 5718 "2" "2" "square"] - ElementLine [-3740 -2362 -3740 2362 800] - ElementLine [3740 -2362 3740 2362 800] - - ) -Layer(1 "component") -( - Line[52500 15905 52500 37500 1000 4000 "clearline"] - Line[72500 15905 72500 37500 1000 4000 "clearline"] - Line[62500 46595 62500 37500 1000 4000 "clearline"] - Line[35000 37500 72500 37500 1000 4000 "clearline"] - Line[35000 37500 35000 15905 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - Connect("R103-2") - Connect("R104-2") - ) -) Index: 1.1.4/doc-rnd/djopt/debumpify.out.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/debumpify.out.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/debumpify.out.pcb (nonexistent) @@ -1,88 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[0 5000 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[23405 32500 30000 32500 1000 4000 "clearline"] - Line[92500 32500 111595 32500 1000 4000 "clearline"] - Line[30000 32500 30000 32500 1000 4000 "clearline"] - Line[30000 32500 37500 32500 1000 4000 "clearline"] - Line[37500 32500 37500 32500 1000 4000 "clearline"] - Line[37500 32500 47500 32500 1000 4000 "clearline"] - Line[47500 32500 57500 22500 1000 4000 "clearline"] - Line[57500 22500 67500 22500 1000 4000 "clearline"] - Line[67500 22500 77500 32500 1000 4000 "clearline"] - Line[77500 32500 82500 32500 1000 4000 "clearline"] - Line[82500 32500 85000 22500 1000 4000 "clearline"] - Line[90000 22500 92500 32500 1000 4000 "clearline"] - Line[85000 22500 90000 22500 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( - Text[30000 5000 0 105 "90" "clearline"] - Text[60000 5000 0 105 "45" "clearline"] - Text[82500 5000 0 105 "rand" "clearline"] -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/miter.txt =================================================================== --- 1.1.4/doc-rnd/djopt/miter.txt (revision 10776) +++ 1.1.4/doc-rnd/djopt/miter.txt (nonexistent) @@ -1,2 +0,0 @@ -Replaces 90 degree corners with a pair of 45 degree corners, to reduce -RF losses and trace length. Index: 1.1.4/doc-rnd/djopt/viatrim.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/viatrim.png =================================================================== --- 1.1.4/doc-rnd/djopt/viatrim.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/viatrim.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/viatrim.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/vianudge.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/vianudge.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/vianudge.pcb (nonexistent) @@ -1,81 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[17500 22500 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Attribute("PCB::grid::unit" "mm") -Via[85000 50000 8661 4000 0 3937 "" ""] - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 57500 10000 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["onsolder" "Standard SMT resistor, capacitor etc" "R102" "1206" 10000 10000 5650 4350 2 100 "auto"] -( - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "onsolder,square"] - Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "onsolder,square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[63405 10000 85000 10000 1000 4000 "clearline"] - Line[85000 10000 85000 50000 1000 4000 "clearline"] -) -Layer(2 "solder") -( - Line[15905 10000 30000 10000 2000 4000 "clearline"] - Line[30000 10000 30000 27500 2000 4000 "clearline"] - Line[30000 27500 85000 27500 2000 4000 "clearline"] - Line[85000 50000 85000 27500 2000 4000 "clearline"] -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/orthopull.txt =================================================================== --- 1.1.4/doc-rnd/djopt/orthopull.txt (revision 10776) +++ 1.1.4/doc-rnd/djopt/orthopull.txt (nonexistent) @@ -1,4 +0,0 @@ -Looks for chains of traces all going in one direction, with more -traces orthogonal on one side than on the other. Moves the chain in -that direction, causing a net reduction in trace length, possibly -eliminating traces and/or corners. Index: 1.1.4/doc-rnd/djopt/debumpify.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/debumpify.png =================================================================== --- 1.1.4/doc-rnd/djopt/debumpify.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/debumpify.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/debumpify.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/unjaggy.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/unjaggy.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/unjaggy.pcb (nonexistent) @@ -1,81 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[12500 10000 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Attribute("PCB::grid::unit" "mm") - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 65000 12500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[23405 32500 30000 32500 1000 4000 "clearline"] - Line[30000 22500 37500 22500 1000 4000 "clearline"] - Line[37500 22500 37500 15000 1000 4000 "clearline"] - Line[30000 32500 30000 22500 1000 4000 "clearline"] - Line[37500 15000 45000 15000 1000 4000 "clearline"] - Line[45000 15000 45000 10000 1000 4000 "clearline"] - Line[45000 10000 56595 10000 1000 4000 "clearline"] -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/djopt/miter.out.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/djopt/miter.out.png =================================================================== --- 1.1.4/doc-rnd/djopt/miter.out.png (revision 10776) +++ 1.1.4/doc-rnd/djopt/miter.out.png (nonexistent) Property changes on: 1.1.4/doc-rnd/djopt/miter.out.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/djopt/index.html =================================================================== --- 1.1.4/doc-rnd/djopt/index.html (revision 10776) +++ 1.1.4/doc-rnd/djopt/index.html (nonexistent) @@ -1,45 +0,0 @@ - - -

    Action djopt()

    - -The different types of optimizations change your board in order to -reduce the total trace length and via count. Each optimization is accessible -using an argument, e.g. djopt(miter). The basic actions have to be run multiple -times as each iteration will change the design making new changes possible for -subsequent iterations with the same or other actions. -

    -Click on the images to download the example .pcb design. - - -
    argument name description example in example out after 1st iteration -
    debumpify -Looks for U-shaped traces (with 90 degree corners) that can be shortened -or eliminated. - -
    miter -Replaces 90 degree corners with a pair of 45 degree corners, to reduce -RF losses and trace length. - -
    orthopull -Looks for chains of traces all going in one direction, with more -traces orthogonal on one side than on the other. Moves the chain in -that direction, causing a net reduction in trace length, possibly -eliminating traces and/or corners. - -
    unjaggy -Looks for corners which could be flipped to eliminate one or more -corners (i.e. jaggy lines become simpler). - -
    vianudge -Looks for vias where all traces leave in the same direction. Tries to -move via in that direction to eliminate one of the traces (and thus a -corner). - -
    viatrim -Looks for traces that go from via to via, where moving that trace to a -different layer eliminates one or both vias. - -
    autorun all the above except miter; run them multiple times until there's no more change possible     -
    - - Index: 1.1.4/doc-rnd/djopt/viatrim.pcb =================================================================== --- 1.1.4/doc-rnd/djopt/viatrim.pcb (revision 10776) +++ 1.1.4/doc-rnd/djopt/viatrim.pcb (nonexistent) @@ -1,87 +0,0 @@ -# release: pcb-rnd 1.0.7 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 140000 67500] - -Grid[2500.0 0 0 1] -Cursor[37500 10000 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - - -Attribute("PCB::grid::unit" "mm") -Via[60000 32500 7874 4000 0 3150 "" ""] -Via[92500 32500 7874 4000 0 3150 "" ""] -Via[75000 32500 7874 4000 0 3150 "" ""] -Via[40000 32500 7874 4000 0 3150 "" ""] - -Element["" "Standard SMT resistor, capacitor etc" "R101" "1206" 17500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) - -Element["" "Standard SMT resistor, capacitor etc" "R102" "1206" 117500 32500 -5650 4350 0 100 ""] -( - Pad[5905 -1181 5905 1181 5118 2000 5718 "1" "1" "square"] - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "2" "2" "square"] - ElementLine [-2362 3740 2362 3740 800] - ElementLine [-2362 -3740 2362 -3740 800] - - ) -Layer(1 "component") -( - Line[23405 32500 40000 32500 1000 4000 "clearline"] - Line[92500 32500 111595 32500 1000 4000 "clearline"] - Line[111595 33681 111595 32500 1000 4000 "clearline"] - Line[111595 32500 111595 31319 1000 4000 "clearline"] - Line[23405 33681 23405 32500 1000 4000 "clearline"] - Line[23405 32500 23405 31319 1000 4000 "clearline"] - Line[40000 32500 60000 32500 1000 4000 "clearline"] -) -Layer(2 "solder") -( - Line[60000 32500 75000 32500 1000 4000 "clearline"] - Line[75000 32500 92500 32500 1000 4000 "clearline"] -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) -NetList() -( - Net("GND" "(unknown)") - ( - Connect("R101-1") - Connect("R102-2") - ) -) Index: 1.1.4/doc-rnd/devlog/20160101_cschem.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160101_cschem.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160101_cschem.html (nonexistent) @@ -1,68 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    cschem

    - -Cschem is a project I plan to start within the next few years. It's goals -and some design concepts are similar to gschem's and geda's, while it -also breaks some traditions to fix shortcomings in the design of geda. It's -named after gschem, not after geda, to emphasize that the editor needs to -be connected more to the rest of the system (see details later). -

    -Some concepts cschem will try to follow (marking with * where there's major -difference to geda): -

      -
    • 1. design -
        -
      • 1.1. modularity, aka. toolkit approach -
      • 1.2. flexibility (trough attributes) -
      • 1.3. one schematics file is one sheet -
      • 1.4. multi page projects (hierarchic, flat) -
      • 1.5. data is in structured text files (no builtin sql support in core) -
      • 1.6. * the concept of a "project"; it's optional, tools can work on a set of schematics files _or_ on a complete project -
      • 1.7. * nets and components are uniquely identifiable using the same identifiers by all projects -
      • 1.8. * no excess "smartness" in the GUI editor: no slotting, no pin numbering, no auto renumbering, etc; these all should be done in the netlist layer and results fed back to the editor -
      • 1.9. * direct, bidirectional communication between the editor (GUI) and the netlist layer without any integration of the two, through simple and clean API, keeping both parts replaceable; attributes cschem got back from the netlister are "volatile": not saved, do not override attributes provided by the user -
      • 1.10. * less format-specific tricks built into the GUI code, more generic approaches (e.g. a search is a search, not a search-for-text-attribute and results on the result lists are any object of the design) -
      • 1.11. * slotting, pin mapping, device mapping are in backends -
      • 1.12. * back annotation should not be any harder than forward annotation -
      • 1.13. * since a lot of info is invented in backends, not in the GUI (e.g. pin numbers, when slotting), the GUI needs to be able to switch between "views": what (combination of) backend(s) to get these info from; Note: this would also provide an interactive DRC on the GUI with the DRC still implemented in the netlister! -
      • 1.14. * the scriptable plugin system is based on GPMI from the start to guarantee the tool is not tied to any one specific scripting engine or scripting language -
      -
    • 2. implementation -
        -
      • 2.1. a core library that does common things like figuring what objects are connected with net lines -
      • 2.2. the simple GUI editor should provide the frame; exotic functions should come from user plugins -
      • 2.3. a simple netlister that provides only generic (* absolutely no backend specific) queries; actual backends are implemented as plugins -
      • 2.4. * the core library and the netlister and the GUI core are all implemented in plain C: -
          -
        • 2.4.1. * no dependency on any specific scripting engine or scripting language; no core functionality implemented in anything else but C -
        • 2.4.2. * no dependency on big "solves-everything" libraries (e.g. no glib or cairo dependency) -
        • 2.4.3. * the actual GUI is behind the plugin system (like PCB's HIDs) -
        • 2.4.4. * the first gui, in accordance with the no big libraries, will not be gtk or qt but sdl2 based; this would guarantee to have a front end that doesn't need to be rewritten every 5 years just for the sake of the rewrite -
        • 2.4.5. * scconfig instead of autotools: smaller, easier to maintain, works better outside of the gnu-win32 world -
        -
      -
    • 3. project management -
        -
      • 3.1. automatic tests wherever possible, as early as possible -
      • 3.2. * VCS: simple, centralized svn with straight linear developement, actively trying to avoid branching -
      • 3.3. * near-zero-administration releases with svn commits -
      • 3.4. * users should be able to submit bug reports anonymously, without having to register, without having to run javascript, java applet, flash, etc. -
      -
    - - -

    -There are a lot of open questions: -

      -
    • q1. how buses should work -
    • q2. how slotting should work (but at least we can have alternatives here) -
    • q3. how hierarchical design should work -
    • q4. * how the GUI should display large amount of attributes without making the whole page an unreadable mess -
    • q5. flat vs. non-flat netlists - if turns out it's not just an implementation detail in a netlister backend -
    • q6. * whether project file format is a custom format or just a top sch page referencing other sch pages - pcb-rnd is leading here, there is an optional project file format already defined, so this is more or less decided -
    • q7. attribute conventions -
    - Index: 1.1.4/doc-rnd/devlog/20150821a_parametric_requirements.html =================================================================== --- 1.1.4/doc-rnd/devlog/20150821a_parametric_requirements.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20150821a_parametric_requirements.html (nonexistent) @@ -1,32 +0,0 @@ - - -

    pcb-rnd devlog

    -

    requirements for parametric footprint generation

    - -It's appealing to write parametric footprint generators for new footprint -families: invest some time once, and have a tool that can spit out -dozens of footprints. However, it is not always worth having a generator -instead of static footprints. The minimal requirements for a generator are: - -
      - -
    • the footprint family is a series of footprints that can be generated -using the same code, with changing some base properties (e.g. number of -pins) - -
    • dimensions and other properties can be calculated from the base -properties with reasonable formulas and conditional code; e.g. sot* is not -a good candidate for generation, as sot23 or sot89 can not be generated -from some common anestor by varying one or two parameters, but would need -a large table that translates package name to a pattern - easier to keep -those in static footprint files - -
    • has a reasonable amount of existing variations; e.g. it is not worth -writing a generator for the dsub family because there are only a few of -them in common use (db9, db15, db25, and maybe db37). - -
    • preferably a link to a datasheet that shows at least 3 members of the -family; if that's not possible, separate datasheets describing at least 3 -members of the family. - -
    Index: 1.1.4/doc-rnd/devlog/20150901a_back_ann.html =================================================================== --- 1.1.4/doc-rnd/devlog/20150901a_back_ann.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20150901a_back_ann.html (nonexistent) @@ -1,87 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    back annotation

    - - -

    Conclusions of the first thread

    -DJ has another
    model -where back annotation is only a subset of a bigger mechanism. -

    -Many other users commented the thread, but no one else presented a -plan that formed a complete system. -

    -While there were some useful feedback about some details, no one explicitly -said he'd be contributing the gschem part (... for any of the ideas floating -around). -

    -The thread is swamped in a chaotic set of random ideas and opinions - the -same way as previous related threads usually did. - - -

    Second thread

    -In the second thread I will focus on actual contribution. For this, -I'm narrowing down what exactly needs to be contributed: - - -
      -
    • 1. minor UI changes, most probably in the C part of the gschem code. -somehow ending up in the official repo; I'd prefer to avoid maintaining a -fork of gschem (no, having the fork in git doesn't help). - -
    • 2. a scheme script that can be plugged into gschem and do real simple -things like toggling flags for point 1, counting how many flags are -toggled, warn the user about the counter is being non-zero; this script -doesn't need to get into the official repo - -
    • 3. depending on whether we (me and my actual contributor who contributes -code) go for push or pull, we need: a new action or menu or whatever that -can trigger a pull or some means that can collect a change list pushed and -then indicate that something's happened. It's not really a third piece of -code, just a third piece of concept that is spread across 1 and 2. -
    -

    -First, I seek a contributor for exactly these 3 things. Alternatively if -there's someone who is really willing to contribute actual code and spend -time on this, I'm open to change parts of my plan if he has better ideas -as long as the new approach still solves the actual problems I have. - - -

    Preparing for the third phase (3rd sep)

    -Options are being eliminated slowly. I couldn't find out who are currently the -maintainers of gschem, so I couldn't ask their opinion about my back annotation -plan directly. Last stable release is about 2 years old, last unstable is more -than a year old. -

    -The main options currently are: -

      -
    • 1. Evan offered contribution on the gschem side; Markus offered him write - access to the official git repo. We could have a branch there. We'd - aim for a merge, so minimal changes and a lot of scheme hacking (... - that still none of us want to do, afaik). - Without positive feedback from maintainers, I believe this branch - has a very low chance to get merged in mainline. If it doesn't get - merged, all the extra effort on scheme, git, and trying to - do things in the gschem-way are just energy wasted. - -
    • 2. I start an svn repo and implement the stuff the better way (no - scheme, bigger change, no worries about whether it gets merged). Keep - changes on-topic and small, so later on if someone wants to merge, - there's a chance to get it into a branch in the git repo first then - do the merge. Has even lower chance to get merged, but certainly - speeds up development and is much easier to work on, distribute and - use than a bitrotting git branch. If it doesn't get merged, - only a small amount of efforts wasted on trying to keep changes - merge-friendly. - -
    • 3. I start an svn repo and implement the stuff the best I can - without - considering any merging aspects. This is the option that'd grant - the most development speed and efficiency. It doesn't get merged, - but no energy is wasted at all and the resulting code is better. -
    -There are some other options, but those are just variants of the above three. -Currently I think option 1 is unlikely to work, for I don't touch git, -and noone wants to touch scheme. Both 2 or 3 could work, but the total lack -of gschem maintainer feedback doesn't make option 2 look too good. - Index: 1.1.4/doc-rnd/devlog/20150830b_back_ann.html =================================================================== --- 1.1.4/doc-rnd/devlog/20150830b_back_ann.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20150830b_back_ann.html (nonexistent) @@ -1,304 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    back annotation

    - -

    netlists, annotations

    - -Pcb-rnd (and mainline pcb) maintains a netlist as part of the design. Pcb -doesn't modify the netlist. The netlist is imported from an external source, -typically from gschem. This process is called forward annotation. -

    -Sometimes there are a set of connections which contain pin pairs that could -be swapped. For example the data lines of an external parallel SRAM interface -to an MCU: it doesn't matter if data bit 1 at the MCU is wired to data bit -1 or 5 of the SRAM, as there is an 1:1 mapping and no one else is using the -same bus wires. In this case connections should be swapped during pcb routing -and annotated back to gschem so that the schematics can be updated. Both -paths are illustrated below. -

    -annotation paths -

    -Forward annotation passes on complete netlists along arrows forward1 and -forward2. Back annotation would pass back netlists, changes or modification -requests on the back1, back2 path. Gnetlist takes sch files to extract -and build a netlist in whatever format the receiver needs. There should be a -glue layer, called foo on the drawing, that does the reverse: receives -whatever format the sender has and generates something that gschem will -understand. - -

    Support in pcb-rnd: core

    -Pcb-rnd gets a complete netlist. If the user could change the netlist directly, -there should be some sort of diff tool in foo that can explain the -changes to gschem, or a diff tool in gschem. What is worse, forward annotation -happens much more often than back annotation and pcb-rnd would need to be able -to merge a new netlist with local changes. The simple "gsch2pcb overwrites the -netlist in pcb from whatever gnetlist produced" approach would not work. -

    -An alternative is to keep the netlist as-is, and maintain a separate list of -changes. The form proposed hereby is a table of "operation,pinID,net" or -"operation,args...". Netlist operation is one of "del_conn", "add_conn" and "net_info". The table is called the netlist patch. -

    -For example assume two components with pins A1, A2 and B1, B2, with connections -n1=A1-B1 and n2=A2-B2. While routing the designer decides changing them to -n1=A1-B2 and n2=A2-B1 would be easier and is acceptable by the design. The -table of changes would contain this: - -
    op pinID net -
    del_conn B1 n1 -
    del_conn B2 n2 -
    add_conn B2 n1 -
    add_conn B1 n2 -
    -The first two lines would remove pins B1 and B2 from n1 and n2. The last -two would put them back, swapped. New nets could be created or unused nets -could be removed using the add_net and del_net commands that have empty pinID. -The table is ordered, rows are strictly executed from top to bottom. -

    -Pcb-rnd would store this table in memory. When some code calls the netlist -code to find out the members of a net, or which net a given pin is connected to, -after running the original netlist code, the result would be adjusted by the table. -

    -The table would be normalized after operations. For example: - -
    op pinID net -
    del_conn B1 n1 -
    add_conn B1 n2 -
    add_conn B1 n3 -
    del_conn B1 n2 -
    -would be reduced to - -
    op pinID net -
    del_conn B1 n1 -
    add_conn B1 n3 -
    -Simple linear crawls on the table seems sufficient: it is expected that -pcb designers will make netlist modifications rarely and they will back -annotate them ASAP. In extreme cases there may be 64 bit wide bus systems that -need total reordering; even a 4 such reorders will introduce about 1024 items -on the list which seems not too big for O(1) algorithms. See section TODO -for better approaches. -

    -Pcb-rnd would save the normalized table in the pcb file in a new section. -Upon a netlist change in pcb (import/load netlist or load the pcb), pcb-rnd -would check each row of the table: it is easy to decide whether that row -has been implemented in the netlist or not. Obsolete rows of the table would -be deleted. -

    -A corner case is when B1 is removed from n1 and then added to n2 by the table, -while a new forward annotation removes B1 from n1 and adds it to n3. In this -case the first row of the table is deleted, as B1 is already removed from n1, -but pcb-rnd has no chance to decide if netlist adding B1 to n3 should affect -the table adding B1 to n2, so that rule is kept. -

    -net_info is used to describe the original members of a net, in -the state they were before any change on the netlist occured. - -

    Support in pcb-rnd: GUI

    -A trivial idea is to extend the netlist window so that pins can be moved in -between nets or deleted or assigned to nets. Changes should be marked. This -is not the preferred way of editing the netlist, tho: not much more convenient -than making changes in gschem and doing forward annotation. -

    -There should be a separate dialog box or a separate region of the netlist box -showing the netlist patch with edit capabilities. -

    -Finally, the most important feature would be new actions resolving shorts. -Using the above example (n1=A1-B1 and n2=A2-B2 changed to n1=A1-B2 and n2=A2-B1), -I believe the user would: - -
    action screenshot patch list after the actions -
    • look at initial rats
    (empty) -
    • first connect A1 to B1
    (empty) - -
      -
    • then realize it's very hard to connect A2 to B2 while the previous connection is there -
    • he would then revert the first connection -
    • and connect A1 to B2 -
    • which would cause shorts -
    - (empty) - -
      -
    • then he would use the "approve netlist change" hotkey/action on the network; - this would add netlist patch commands for the A1-B2 connection, - but would also keep the A1-B1 connection, which remains a rat; because - of the new connection there'd be a rat between A1 and A2 or B1 and B2 too - (all 4 pins connected together on the patched netlist at the moment!) -
    - -
    -net_info n1 A1 B1
    -net_info n2 A2 B2
    -del_conn B1 n1
    -add_conn B1 n2
    -
    - -
      -
    • the user would then use an action (maybe the same one?) on the rat line - so that pcb-rnd would understand that rat is not needed anymore and - would add a patch to remove the A1-B1 connection -
    • the same thing would need to happen to the A2-B2 rat -
    - -
    -net_info n1 A1 B1
    -net_info n2 A2 B2
    -del_conn B1 n1
    -add_conn B1 n2
    -del_conn B2 n2
    -
    - - -
    • the user then would connect A2 to B1, which again is a short
    -
      -
    • the user would approve it as a new connection -
    • we have exactly 2 del_conn and 2 add_conn patches. -
    - -
    -net_info n1 A1 B1
    -net_info n2 A2 B2
    -del_conn B1 n1
    -add_conn B1 n2
    -del_conn B2 n2
    -add_conn B2 n1
    -
    - -
    -An experienced user may think a few steps in advance and -chose to first remove the A1-B1 and A2-B2 rats and then create the A1-B2 -and A2-B1 connections and then approve the two new connections. -

    -An alternative is drag&drop ratline endpoint onto snap points; it may -be tricky to convert that to net/pin relations if a rat line is between two -line segments, tho. -

    -These changes would live immediately, leaving the board free of shorts and -rats. There should be, however, some warning in the "congratulation" message -that tells the user a back annotation is still required. - -

    Support in gschem

    -Ideally there should be a very small change in gschem and an optional -plugin script could do the rest. The plugin script would be in contant -with foo. -

    -There are multiple ways pins can be connected to a net in gschem. It's -probably not a good idea to have too much automatism in the gschem's side, -trying to actually removing connections and adding new ones using the patch -(or whatever info foo converted the patch into). -

    -However, gschem should support four things natively: -

      -
    • it should have a concept of an unwanted pin-network connection; a connection - becomes unwanted only when the back annotation says so -
    • it should be able to mark unwanted connections on the active schematic page -
    • it should be able to tell the user if there are unwanted connections on - any of the pages open -
    • it should be able to refresh its idea of unwanted connections while - schematic pages are open -
    -

    -Displaying unwanted connections happen at: -

      -
    • a pin of a component is connected to a net using a "blue line" net: mark the pin-net connection point -
    • a pin is directly connected to another pin, no net line in between: mark the connection point -
    • a pin is connected to a net using a pin attribute: mark the pin -
    • TODO: are there more? -
    -

    -TODO: there are a lot to think over about special cases related to -multipage schematics, hierarchies, slots, split symbols. - -

    What foo does exactly

    -... is not clear yet. It depends on what sort of support gschem would provide. - -

    Amendment 1: other parameters (1st sep)

    -I originally forgot to mention my other intentions in the above document: -back annotate non-netlist properites. It probably happened because netlist -related stuff are the hardest to solve. -

    -There are other parameters that sometimes change during routing. A common case -for my 1 or 2 layer boards is when I originally intend to use 0603 parts but -during routing I figure I need to pass a trace between the pads. I need to -change the part to 0805 or 1206 (for two traces). I'd like to be able to -do this in-place in pcb with an action that replaces the footprint -but keeps the origin in place. This obviously still requires some manual -fiddling afterwards, but would remove the long, tedious chain I have now: -

      -
    • 1. remember or note down which parts to change footprints for -
    • 2. go back to gschem and change them -
    • 3. get the changes in pcb (I use gsch2pcb and Makefiles, one step; the import menu is one step too, just another one) -
    • 4. disperse the new elements -
    • 5. find where they used to be -
    • 6. and then do the fiddling to fit them in -
    -

    -The new process would be: -

      -
    • 1. get the footprint replaced, in-place; this would already approve the - change and there'd be a command for it in the patch table -
    • 2. do the fiddling to fit the new part in -
    • 3. do a back annotation -
    • (4. optionally, if we go for non-automatic change of attributes in gschem, - change them manually in gschem, cycling through the affected - items using some UI feature) -
    -

    -The same thing could work for values, which is the other attribute PCB also -sees. The same mechanism could work from other programs as well, e.g. tuning -the values of some parts in a simulator and then back annotating the changes -to the schematics. The patch table format foo handles would be in the -simplest plain text form. - - -

    Amendment 2: examples from gschem's point of view (3rd Sep)

    -

    netlist change

    -
      -
    • The user creates the schematics and imports it in pcb; the original - netlist contains a line "netname1 U1-1 CONN1-2" -
    • The user, as part of some pin swapping, decides that U1-1 should be - connected to net "netname2" instead of "netname1". Changes are - done in pcb-rnd as described above. -
    • The netlist patch generated for this single change by pcb-rnd would be: -
      -del_conn netname1 U1-1
      -add_conn netname2 U1-1
      -	
      -
    • the user may need to load the netlist patch in ghscem -
    • In gschem there would be an indication that highlights any U1-1 pin or - U1 symbol that makes a connection to netname 1, graphically or using - attributes. When asked, gschem UI would also tell the user that U1-1 is - now connected to netname1 but should be connected to netname2 instead. -
    • The user would find this indication and would resolve the situation - by whatever changes he finds appropriate -
    • gschem would rerun the patch commands and would figure that the del_conn - fails to run because U1-1 is no longer connected to netname1 and the add_conn - fails too because U1-1 is connected to netname2. This leaves U1-1 without - any known issue, so the indication on U1-1 would be gone. -
    - -

    attribute change: footprint change

    -
      -
    • The user creates the schematics and imports it in pcb; originally - U1 has an attribute footprint=DIP(8). -
    • during the layout the user figures using the footpritn SO(8) is - more appropriate. He does the change in pcb-rnd. -
    • pcb-rnd emits the following netlist patch for this: -
      -change_attrib U1 footprint=DIP(8) footprint=SO(8)
      -	
      -

      - (or it could be a del_attrib and add_attrib pair, like with connections) -

    • the user may need to load the netlist patch in ghscem -
    • In gschem there would be an indication that highlights any U1 instances - that has footprint=DIP(8) -
    • The user would find this indication and would resolve the situation - by whatever changes he finds appropriate (e.g. change the attribute) -
    • gschem would rerun the patch commands and would figure the change is - no longer requred and would remove the indication -
    - Index: 1.1.4/doc-rnd/devlog/20150801a_events.html =================================================================== --- 1.1.4/doc-rnd/devlog/20150801a_events.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20150801a_events.html (nonexistent) @@ -1,22 +0,0 @@ - - -

    pcb-rnd devlog

    -

    events

    -PCB has a nice action infrastructure: most user actions are -implemented in smallish functions taking (int argc, char *argv[]). Menu -items, hotkeys, the command line and batch processing just call these -actions. This is the user->pcb_core direction of commands. -

    -Before adding scripting to pcb-rnd, the other direction (pcb_core->user) has -to be implemented: an event infrastructure. Random parts of the core -or the HID code will yield events using a simple vararg event() function. -Other parts of PCB, especially plugins, can bind (sign up to) events with -function pointers. When an event is triggered, all functions signed up to -the event are called (in random order). -

    -Passing arguments to events is similar to the arguments of actions, except -argv[] is not a char *[], but an event_arg_t *[]. event_arg_t has an enum -field for argument type and an union for the argument value. This means the -API is binary: integers are passed as integers, not as strings. - - Index: 1.1.4/doc-rnd/devlog/20160921_gl.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160921_gl.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160921_gl.html (nonexistent) @@ -1,56 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    what's missing for: opengl

    -

    -What we don't have: -

      -
    • rendering with opengl -
    • utilizing the 2d or 3d hardware acceleration of the GPU in drawing -
    • transparent copper layers -
    • on some CPU+GPU combination the current software rendering is slower than mainline's opengl rendering -
    -

    -Why we don't have it: -

      -
    • I don't have a hardware+driver combination where opengl rendering works at acceptable speed -
    • I have no experience with opengl programming -
    • I am not much interested in changing any of the above two -
    -

    -What's needed: -

      -
    • 1. split the gtk hid into: -
        -
      • a generic gtk UI feature plugin (menu, widgets, controls, no drawing) -
      • a gtk-gdk (software render) HID plugin that depends on the gtk feature plugin -
      • an gtk-opengl HID plugin that depends on the gtk feature plugin and on the opengl utility plugin -
      -
    • 2. get scconfig to detect opengl headers/libs -
    • 3. resurrect the opengl utility plugin -
    • 4. resurrect the opengl drawing code -
    -

    -How we could have it, gtk+gl: -

      -
    • A. contribute: I can do 1. and 2. so you need to concentrate only on the opengl part (3. and 4.); -
    • B. or donation/sponsoration: -
        -
      • buy the time of a random developer for point 3. and 4.; I can still do 1. and 2. in free time, scheduled with the other pcb-rnd duties -
      • buy my time so I don't need to sit in my regular job but have a few days off to do all four points -
      -
    -

    -How we could have it, long term: -

      -
    • I plan to write an SDL2 based HID -
    • SDL2 has transparent render support for both software and accelerated drawing, the latter probably means 2d hardware acceleration which is probably as good as direct opengl drawing would be -
    -

    -What we can't do: -

      -
    • make transparent layers with the current gtk/gdk software render (too much effort) -
    • make transparent layers with lesstif (too much effort) -
    • speed up the software render -
    Index: 1.1.4/doc-rnd/devlog/res/20150830b_s6.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_s6.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_s6.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_s6.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_s6.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/res/20150830b_annot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_annot.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_annot.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_annot.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_annot.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/res/20150830b_annot.dot =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_annot.dot (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_annot.dot (nonexistent) @@ -1,19 +0,0 @@ -digraph annot { - - - gnetlist [shape=box] - - {rank=same pcb gschem spacer1} - - spacer1 [style=invisible] - - foo [shape=box] - - gschem -> gnetlist [label="forward1"] - pcb -> foo [label="back1"] - - gschem->spacer1->pcb [style=invisible arrowhead=none] - - gnetlist -> pcb [label="forward2"] - foo -> gschem [label="back2"] -} Index: 1.1.4/doc-rnd/devlog/res/20150830b_s0.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_s0.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_s0.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_s0.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_s0.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/res/20150830b_s1.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_s1.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_s1.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_s1.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_s1.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/res/20150830b_s2.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_s2.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_s2.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_s2.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_s2.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/res/20150830b_s3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_s3.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_s3.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_s3.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_s3.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/res/20150830b_s4.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_s4.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_s4.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_s4.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_s4.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/res/Makefile =================================================================== --- 1.1.4/doc-rnd/devlog/res/Makefile (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/Makefile (nonexistent) @@ -1,4 +0,0 @@ -all: 20150830b_annot.png - -%.png: %.dot - dot -Tpng < $^ > $@ Index: 1.1.4/doc-rnd/devlog/res/20150830b_s5.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/res/20150830b_s5.png =================================================================== --- 1.1.4/doc-rnd/devlog/res/20150830b_s5.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/res/20150830b_s5.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/res/20150830b_s5.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/20150731a_menu.html =================================================================== --- 1.1.4/doc-rnd/devlog/20150731a_menu.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20150731a_menu.html (nonexistent) @@ -1,59 +0,0 @@ - - -

    pcb-rnd devlog

    -

    Dynamic menus

    -

    Background

    -Before integrating gpmi scripting, pcb-rnd needs to be prepared to -interface with the scripts. The engine is pretty much ready since ages: -the action interface is ideal for scripts to register their actions or -execute existing actions. This also means the command line and batch -UI are instantly connected with scripts. -

    -The only largely visible remaining portion is the GUI. pcb-gpmi supports -building dialog boxes using the current HID (so called attribute dialogs, -originally invented for exporter settings) and calling some simpler predefined -dialogs like a progress bar or alert. -

    -What's really missing is a way to create new menus on the fly. The user -loads a script and the script makes up a menu with submenus, all bound to -the proper actions. -

    -This introduces a nice dilemma, tho: there is a real cool menu configuration -file that makes the user able to reconfigure the menu system, hot keys, tool -tips and whatnot (I wish more applications had this feature!). What if a script -comes in and trolls the whole thing creating random menus at surprising -places in the menu system? How the user can control what the script could do -with his preciously crafted menu setup tailored to his own preferences? -

    -I believe in sharp tools and careful users. I indeed plan to allow scripts to -do whatever they want with the menu system but I invent some conventions too. -As long as scripts stick to these conventions, the user retain control over -the menu layout. - -

    How it works

    - -PCB reads *menu.res and builds the gui on startup; the menu system is -static after that point. pcb-rnd does the same on startup but also -stores all menus (referenced by their paths, like "/File/Save as") in a -hash table. Later on a call to a new hid function (create_menu()) can -create new menus or submenus, extending the menu tree at any point. -

    -When a new menu "/File/foo" is created, using the hash create_menu() -finds out that /File already exists and doesn't create it but use the -existing widget from the hash. This means if the user creates menus from -the res file that are also created by the script, the res file sort of -overrides the script's later actions as all those menus will already exist -by the time the script tries to create them. -

    -And here comes the conventions part: -

      -
    • there will be a new menu, called "/Plugins" -
    • each plugin should have its own submenu there (gpmi for scripting: "/Plugins/GPMI scripting") -
    • each script is just a child of the gpmi plugin so it should have its submenus under "Plugins/GPMI scripting/scriptname" -
    - -As long as plugins and scripts stick to this convention, the user can -create all the menus for all the plugins and scripts in advance. Stock -menu res files will have the /Plugin menu at least, so its place is fixed. - - Index: 1.1.4/doc-rnd/devlog/20160808_model.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160808_model.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160808_model.html (nonexistent) @@ -1,101 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    How to represent the world in pcb-rnd

    - -

    Proper implementation

    - -<daydreaming> -

    -In a proper model there's no element/footprint. There are a few simple -primitives and there are groups, like the ones in svg: groups contain -metadata, primitives and groups. -

    -An element is just a group. The whole design may contain groups of groups -of groups. A stereo amplifier may be a group for a PSU and two instances -of a single-channel amp group that match square-unit to square-unit. -

    -What makes up an element now is a refdes, its pins/pads we can identify -(for the netlist-related things) and the feature that you can drag the -whole thing as one. A group could do all these as well: refdes is just -metadata, silk lines are just primitives, pins/pads are just small groups -of primitives and metadata. -

    -There could be "group types" and type-specific code handling them. In such -a setup you probably don't need to have a text object: just a group that -consists of mostly lines (or polygons) and some metadata (the string -version of the text); the group type would assigns the text-handling code -with to the group. So for the rest of the code, text is not a special -thing, not a bounding box, but just a set of primitives. When you edit it, -you can edit it either line-by-line or as text with the assigned code. -

    -This would allow us to have a very small amount of primitives: line, arc, -poly, hole (without a ring - a via is just a group of a few primitives). -Each primitive would have a layer-span field; this would solve the -blind/buried via question for good. (In theory line and arc could be one -thing, spline oslt, but I don't think performance penalty is worth that.) -

    -However, this means a total rewrite as almost every non-trivial piece of -the code depends on the object model, from find/search/drc to the whole -polygon code, just to name two huge ones. The file format thing is the -smallest of this all. The only major parts I think we could keep are the -GUI and the new conf system. At the current rate of development this would -take more than a year to have a mostly working version and probably yet -another year to get everything tested out and reach current level of -service again. -

    -I am not against such a rewrite, but it would really need a very strong -user/tester backing and maybe more developers than the current amount. -

    -Also, Imagine we'd have a pcb program you couldn't trust on -anything: e.g. losing your data, generating broken gerber, etc. for a very -long time... -

    -So I generally agree that we should do this, but for practical reasons I -am a bit skeptic whether this would work out in the current situation. -It'd kill any cschem plans for years, and because of the long development -cycle it would most probably kill pcb-rnd too. -

    -</daydreaming> - -

    Improper implementation

    - -However, I see an alternative that is not as good as the real thing, but -might be good enough that users don't see much difference. It's -possible to implement it step by step, without long years of "nothing -works as used to" phases. The alternative is: -

    -

      -
    • 1. Add io_lihata, first as a second native file format option, but long -term as the primary file format; it's because we can't really extend the -code without breaking compatibility with mainline on the .pcb format. In -other words, we either _pretend_ we are compatible, but using any new -feature would break compatibility (current state) or we admit that new -features are implemented only in the lihata syntax and when you save to -.pcb it's like saving png from gimp, losing some extra layer info. This -step will happen either way, for other reasons. - -
    • 2. rearrange some internals; the core is currently split per operation -(e.g. there's create.c for creating all sort of objects and remove.c -for removing them). The new setup should be per object type (e.g. arc.c -that knows how to create or remove arcs). - -
    • 3. Once lihata is in place, we can extend/rewrite some parts. An option -is to rewrite footprint support to allow them to be sort of a small pcb -design. So objects on arbitrary layers, footprint-in-footprint, etc. - -
    • 4. When 3. is done, we could extend element handling so that pcb-rnd knows -which element is there for why. So you could have some real elements, with -refdes, part of the netlist, etc, but you could also do a panelization as -a matrix of full pcb designs place like if they were elements. -
    -

    -This 3.,4. would not be the same as building up everything from generic -atoms, but would be close to it and would be much simpler to implement -(still a big one, tho). I believe in practice, for end users, it would -probably be 99% the same as the proper solution. -

    -I believe 3.,4. would be more or less the pcb-rnd equivalent of gschem's -implementation of schematics and symbols with about the same level of -generalism. Not perfect, but maybe good enough. Index: 1.1.4/doc-rnd/devlog/20150820b_qf.html =================================================================== --- 1.1.4/doc-rnd/devlog/20150820b_qf.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20150820b_qf.html (nonexistent) @@ -1,27 +0,0 @@ - - -

    pcb-rnd devlog

    -

    qf()

    -The next group of footprints I decided to generate are qfn(), tqfp(), lqfp(). -The generic set of rules for these footprints is: -
      -
    • there is a virtual rectangle that forms rows of pads -
    • pads are evenly spaced among the edges of that rectangle -
    • pin numbering is counter-clockwise -
    • the body of the part may be inside of the rectangle or may extend over the pads -
    - -

    low level flexibility vs. high level comfort

    -qf() currently has 14 arguments. It is flexible enough to generate qfn, tqfp, -lqfp, and anything similar I've seen in the package datasheet of a major -vendor. However, it is not straight forward to convert datasheet tables -into qf() parameters. -

    -On the other hand, in practice we need qfn() and tqfp(), which are special -cases of qf(). To nail the common use cases, qfn() and tqfp() narrows down -the number of parameters to 3..4. Even better, these parameters are exactly -those that are in the name of a typical QFN or TQFP footprint or in the first -few lines of the dimensions table. I call these scripts frontends to qf(). -

    -This makes the common footprints very easy to produce using frontends while -leaves a (bit more complicated) plan B, qf(), for special cases. Index: 1.1.4/doc-rnd/devlog/20150820a_dimensions.html =================================================================== --- 1.1.4/doc-rnd/devlog/20150820a_dimensions.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20150820a_dimensions.html (nonexistent) @@ -1,24 +0,0 @@ - - -

    pcb-rnd devlog

    -

    fp2anim dimensions

    -After attacking the qfn()/qfp() parametric footprint problem today, -I realized fp2anim lacked a very important feature: dimension lines. -The footprint being generated is to match the datasheet. Checking the match -requires visible dimensions. -

    -The new feature of fp2anim is to optionally display custom dimensions on -the preview. Generator scripts print #dimension comments in the footprint -file (not breaking the file format). The generator passes on a dimension -name along with the value. As a first attempt my conventions are: -

      -
    • add dimension lines for dimension type input parameters -
    • add dimension lines for calculated dimensions if they are likely to be informative and be included in the datasheet -
    - -

    fp2anim vector font

    -While working on the dimensions, I realized I had to switch to vector fonts: -the built-in pixel font of animator can not be rotated. The size of a vector -font text can be calculated, which also enables fp2anim to optionally place -semi-transparent bars behind the text to make it more visible on dark background -(like pads). Index: 1.1.4/doc-rnd/devlog/20160826_virtusers.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160826_virtusers.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160826_virtusers.html (nonexistent) @@ -1,65 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    Offer vs. pull (virtual users vs. active users)

    -Pcb-rnd has an pulled-by-users policy on deciding what features to implement. -Below I try to explain how we ended up using this policy. - -

    Past: offer, virtual users

    - -When I started pcb-rnd, although I published it, I didn't think anyone else -would use it. It was just about having mainline with different default -settings. -

    -Later on I added a few features, and pcb-rnd slowly became much more than -just different defaults. I felt other users may find the new features useful, -so I had put it on offer: advertised the repository. I thought users -would download and try the software. Judging from the feedback, they didn't. I -didn't mind, becuase I was working on features I needed, to get pcb-rnd do what -I wanted: I was my own target audience and anyone else trying pcb-rnd could -only be a side effect. Until when I ran out of features because it already -had everything I needed. -

    -The next step was to implement features for other users. Between summer -of 2015 and summer of 2016, I tried to be a bit more proactive: made -public polls to map what users needed and tried to focus implementing -those features. This did not bring too many users either. -

    -This was when I realized what was really happening: I was offering -features for virtual users, addressing my communication to the wide -auidence. Noone really felt it was for him. Even if he was complaining about -a missing feature in pcb and a few days later I announced the fix in pcb-rnd, it -was not specifically for him, but for the Greater Good. -

    -Virtual users nearly never became real users. My conclusion was that there -was no point in implementing features for virtual users as noone ever would -use those features. - -

    Present: pull, active users

    -Mid summer 2016, I switched strategy. Instead of polling the crowd, I picked -a few users with known feature requests and asked them if they were willing to -test pcb-rnd if I implemented their feature. More than half of them said yes -and many of them got hooked up. They all became productive, active members -of the pcb-rnd community. -

    -Learning from this experiece, the new strategy of pcb-rnd is as follows: -

      -
    • pull instead of offer: do not hope a new feature would attract users, - rather arrange active users who then pull the project with their - feature requests; -
    • do not invest too much time in anything that is not currently pulled - by actual, existing, active users; rather invest that time in fulfilling - the needs of already existing users -
    • reaching 100 users with an average of 0.1% activity will result in - 0 active useres whereas reaching only 10 users with 30% activity - will result in 3 active users; thus a small active communit around - pcb-rnd is more efficient than the much larger geda community; -
    • users really appreciate fast response on bugreports and feature requests. - Instead of trying to impress virtual users, rather keep already interested - users happy. -
    - - - - Index: 1.1.4/doc-rnd/devlog/20162601/poll.csv =================================================================== --- 1.1.4/doc-rnd/devlog/20162601/poll.csv (revision 10776) +++ 1.1.4/doc-rnd/devlog/20162601/poll.csv (nonexistent) @@ -1,10 +0,0 @@ -0,50,yes,yes,no,no,no,1,2,Linux -10,40,no,n/a,no,yes,n/a,20,2,Linux -0,5,n/a,no,no,no,no,20,4,Linux -5,20,no,no,no,yes,no,5,20,Linux -0,0,n/a,n/a,no,no,no,10,0,Linux -0,80,yes,yes,no,no,no,15,0,Linux -50,80,no,no,no,yes,n/a,30,100,OSX -20,75,no,no,no,yes,yes,15,3,Linux -0,8,yes,yes,yes,yes,no,2,1,Linux -0,2,yes,yes,no,no,no,8,4,Linux Index: 1.1.4/doc-rnd/devlog/20162601/poll.tsv =================================================================== --- 1.1.4/doc-rnd/devlog/20162601/poll.tsv (revision 10776) +++ 1.1.4/doc-rnd/devlog/20162601/poll.tsv (nonexistent) @@ -1,10 +0,0 @@ -0 50 yes yes no no no 1 2 Linux -10 40 no n/a no yes n/a 20 2 Linux -0 5 n/a no no no no 20 4 Linux -5 20 no no no yes no 5 20 Linux -0 0 n/a n/a no no no 10 0 Linux -0 80 yes yes no no no 15 0 Linux -50 80 no no no yes n/a 30 100 OSX -20 75 no no no yes yes 15 3 Linux -0 8 yes yes yes yes no 2 1 Linux -0 2 yes yes no no no 8 4 Linux Index: 1.1.4/doc-rnd/devlog/20162601/header.csv =================================================================== --- 1.1.4/doc-rnd/devlog/20162601/header.csv (revision 10776) +++ 1.1.4/doc-rnd/devlog/20162601/header.csv (nonexistent) @@ -1 +0,0 @@ -1. How many of your boards REQUIRE burried or blind vias? [percentage],2. How many of your boards could BENEFIT burried or blind vias? [percentage],3. When your board REQUIRED them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no],4. When your board could BENEFIT using them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no],5. Have you ever tried pcb-rnd? [yes/no],6. Would you try pcb-rnd if it offered blind/burried vias? [yes/no],7. Would you consider switching to pcb-rnd if it offered blind/burried vias? [yes/no],8. Approximately how many boards have you done so far with pcb (pcb mainline/branches/forks included, using gschem/gnetlist not required)? "1 board done" means you had one or more physical copies of the board. [rough estimation, positive integer],9. Approximately how many boards have you done with other packages? [rough estimation, positive integer],10. What OS would you prefer to do your pcb layouts on (assuming your favorite layout tool is/would be available on it)? [one of: (GNU/)Linux, *BSD, OSX, windows, other; if you like more, select the one you would spend most time on!],, \ No newline at end of file Index: 1.1.4/doc-rnd/devlog/20162601/header =================================================================== --- 1.1.4/doc-rnd/devlog/20162601/header (revision 10776) +++ 1.1.4/doc-rnd/devlog/20162601/header (nonexistent) @@ -1,11 +0,0 @@ -1. How many of your boards REQUIRE burried or blind vias? [percentage] -2. How many of your boards could BENEFIT burried or blind vias? [percentage] -3. When your board REQUIRED them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] -4. When your board could BENEFIT using them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] -5. Have you ever tried pcb-rnd? [yes/no] -6. Would you try pcb-rnd if it offered blind/burried vias? [yes/no] -7. Would you consider switching to pcb-rnd if it offered blind/burried vias? [yes/no] -8. Approximately how many boards have you done so far with pcb (pcb mainline/branches/forks included, using gschem/gnetlist not required)? "1 board done" means you had one or more physical copies of the board. [rough estimation, positive integer] -9. Approximately how many boards have you done with other packages? [rough estimation, positive integer] -10. What OS would you prefer to do your pcb layouts on (assuming your favorite layout tool is/would be available on it)? [one of: (GNU/)Linux, *BSD, OSX, windows, other; if you like more, select the one you would spend most time on!] - Index: 1.1.4/doc-rnd/devlog/20162601/poll.html =================================================================== --- 1.1.4/doc-rnd/devlog/20162601/poll.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20162601/poll.html (nonexistent) @@ -1,24 +0,0 @@ - - -
    1. How many of your boards REQUIRE burried or blind vias? [percentage] -2. How many of your boards could BENEFIT burried or blind vias? [percentage] -3. When your board REQUIRED them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] -4. When your board could BENEFIT using them, do you more often find a workaround to stick with pcb instead of switching to another design tool? [yes/no] -5. Have you ever tried pcb-rnd? [yes/no] -6. Would you try pcb-rnd if it offered blind/burried vias? [yes/no] -7. Would you consider switching to pcb-rnd if it offered blind/burried vias? [yes/no] -8. Approximately how many boards have you done so far with pcb (pcb mainline/branches/forks included, using gschem/gnetlist not required)? "1 board done" means you had one or more physical copies of the board. [rough estimation, positive integer] -9. Approximately how many boards have you done with other packages? [rough estimation, positive integer] -10. What OS would you prefer to do your pcb layouts on (assuming your favorite layout tool is/would be available on it)? [one of: (GNU/)Linux, *BSD, OSX, windows, other; if you like more, select the one you would spend most time on!] - -
    050yesyesnonono12Linux -
    1040non/anoyesn/a202Linux -
    05n/anononono204Linux -
    520nononoyesno520Linux -
    00n/an/anonono100Linux -
    080yesyesnonono150Linux -
    5080nononoyesn/a30100OSX -
    2075nononoyesyes153Linux -
    08yesyesyesyesno21Linux -
    02yesyesnonono84Linux -
    Index: 1.1.4/doc-rnd/devlog/20160313_unglib.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160313_unglib.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160313_unglib.html (nonexistent) @@ -1,49 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    unglib: glib removal

    - -

    glib problems

    - -As mentioned in a previous post, glib is -sometimes dangerous. Even if it was not, it's still huge and contradicts -the UNIX philosophy: Do One Thing and Do It Well. Glib tries to do a lot -of things. I do not doubt it is trying to do each of these things well, but as -a combination it's pretty much impossible to Keep It Simple, Stupid. -While glib is modular in design, from the viewpoint of an application it is -not modular: it's highly unlikely that the application can replace a part -of glib while keeping the rest. -

    -The source of these problems is that glib is a "megalib" that tries to solve -a host of problems as a package. - -

    The solution

    - -The solution is to replace the megalib with -a set of independent minilibs. Each minilib: -
      -
    • tries to do one thing - e.g. linked lists, without coupling it with a custom memory allocator -
    • is simple - the API is so small that it's easy to learn it in minutes -
    • is small - so that if anything breaks it's very easy to find and fix the bug (when did you last debug internals of glib?) -
    • is replaceable - since they are independent, if one doesn't work up to expectations, it's real easy to replace it without affecting any other part; e.g. replacing linked lists without replacing hash tables -
    -

    -The minilibs are imported as svn externals in trunk/src_3rd. They are small -enough so that they can be distributed together with pcb sources. - -

    Current state

    - -The "unglib" patch is mostly done. All references of glib are removed -from the core and the lesstif hid. There are a three components that -still depend on glib, but they each can be disabled: -
      -
    • the GTK HID: because gtk is already coupled with glib, it doesn't make much sense to remove glib from the gtk HID code -
    • the toporouter plugin: the code is huge and will be potentially deprecated anyway (lack of developer resources/user interest) -
    • the puller: glib should be removed from the puller long term but the code is big and there's no much user need for it in pcb-rnd -
    -

    -This means pcb-rnd can be compiled with lesstif (or a compatible motif) -on a UNIX box without depending on glib. Together with the earlier effort -that removed autotools, it means a UNIX box without any "GNU infection" -should be able to compile and run pcb-rnd. Index: 1.1.4/doc-rnd/devlog/20151028_glib.html =================================================================== --- 1.1.4/doc-rnd/devlog/20151028_glib.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20151028_glib.html (nonexistent) @@ -1,65 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    why glib is a bad idea

    - -Levente tried to compile pcb-rnd on bsd and used a different c compiler -than gcc. For this in the first step I fixed the build system so that it -doesn't have gcc --std=gnu99 but gcc --std=c99. -

    -And then everything broke. A minilib I use for hashing, -genht, failed to -link against hid/common/action.c. I first thought it was a bug in genht: -genht was compiled without --std while the rest of the code compiled with ---std=gnu99 or --std=c99. Genht heavily depends on static inline -functions for performance, maybe that's why. -

    -So I tried to reproduce the situation in a hello-world like program and -tried all combinaton of --std, -DNDEBUG, -rdynamic and all build flags -used in pcb-rnd for the genht lib and the test program, but all combination -worked. It looked like it broke only in pcb-rnd. -

    -I gave up on the minimal test case and went back to pcb-rnd. I realized if -the build is the same, the only way it may break is that some header -included before genht's headers change some global state. I started to -shuffle the #includes. Long story short, it turned out if <glib.h> is -included before genht's headers, it breaks. -

    -Some more tracing showed it was because glib over-#defines the keyword -inline in a public header that gets included from glib.h. It's all wrapped -in a complicated tree of #ifdefs, so it behaves differently depending on -the --std setting. -

    -The morale of the story is... Well, I have multiple conclusions. -

      -
    • glib is not a lib that tries to solve something, it is a prorgamming -environment that tries to supersede C. - -
    • As such, it feels free to mess with the environment, redefine C -keywords as it sees fit, because once you use glib, why would you use -anything else? And once you use glib, you are programming in glib, not in -"plain C". - -
    • Grepping through the pcb-rnd code, I see that pcb-rnd does not try to -use glib as a programming environment, but needs only 2 and a half -features: hash, list and rarely dynamic strings. Any other glib call is -just a must that had to be done that way to get hashes and lists working. - -
    • genht is 510 sloc. I have a generic list implementation (which, by the -way, is more efficient than glib's) It costs 256 sloc. So having -type-independent hashes and lists in C89 costs less than 800 lines of code -if you pick the right libs. Glib's include/ alone is over 24000 sloc! -And in return glib breaks inline... -
    - -

    -In a nuthsell this is why I don't believe in glib-like solve-all megalibs. I -don't say size alone determines this, but size is a good indication of -potential problems. -

    -If I need hash and lists and the offer is longer than 5k sloc, I know it -will bring a lot of unneeded bloat that likely to break things. - - - \ No newline at end of file Index: 1.1.4/doc-rnd/devlog/20160126.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160126.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160126.html (nonexistent) @@ -1,59 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    Burried/blind via poll

    - -

    Results

    - -I received 10 full answers to the poll - thanks everyone who -answered. This is a small sample, but this is the best I could get -(I can't reach more pcb users). -

    -Raw results are available in html, tsv and -csv format. - -

    My interpretation

    - -(User obviously means "those users who answered the poll") - -
      -
    • 1. only half of the users would consider even trying pcb-rnd for blind/burried vias -
    • 2. there was only one user who'd consider switching to pcb-rnd for blind-burried vias - this feature doesn't seem to be valuable enough to attract users (details below) -
    • 3. about half of the users need blind/burried via; when they do, they don't use pcb -
    • 4. 9 out of 10 users runs PCB on Linux -
    - -

    My conclusions

    -Because of 1. and 2., pcb-rnd doesn't seem to need blind/burried vias. The -purpose of question 7 was to find out whether users value this feature high -enough to actually consider investing time/effort in return, compared to -question 6. This pair of questions was designed to avoid noise that comes -from the fact that we, on the list tend to express our opinions in vast -crowds while only a few invest more time than talking and do actual work. -According to the result of line 7, my conclusion is that it's absolutely -not blind/burried vias that potential pcb-rnd users need. Thus -my decision is that I won't spend time on this feature in the near future. -

    -The situation for pcb might be different, tho. I worded the first 4 questions -to find out how strong the need is among the users of mainline pcb and whether -they are devoted to pcb or choose the tool according to the design requirements. -There seems to be a correlation between having to use blind/burried vias -and using other layout tools. Or in other words: those who are happy with pcb -usually don't need or want blind/burried vias anyway and those who do have -already switched to another tool. -

    -This suggests mainline pcb could benefit from burried/blind vias. However, -the demand is much lower than "every new design needs this" or "no new -user would consider pcb because of this missing feature". -

    -Linux: it seems pcb power users mostly use Linux. I am not sure if it's -because PCB works well on Linux and is a bit harder to compile on -anything else - or the other way around (Linux users are more attracted -to PCB). - - - - - - Index: 1.1.4/doc-rnd/devlog/20160802.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160802.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160802.html (nonexistent) @@ -1,25 +0,0 @@ - - -

    pcb-rnd devlog

    - -

    Languages and libs

    - -Reflecting to (but not joining) the annual geda-user language/libs debate, -the policy of pcb-rnd (and later cschem) on this: -
      -
    • the core part of the code is in C - not in C++, C#, cobol, ada, haskell, etc. -
    • external dependencies are minimized, especially core shouldn't depend on too many external libs and tools (e.g. core shouldn't depend on glib) -
    • core doesn't know anything about [turing complete] scripting languages, user scripting is provided by a plugin -
    • the scripting plugin does not attempt to restrict the user to My Favorite Language - it rather supports 10+ different languages, from ruby through awk through python to lua; it even supports an older version of guile; all languages are options. -
    -The above set of rules is crafted so that compiling core functionality is easy -and excess external libs (gtk, glib) are needed only for optional features -(such as the gtk hid in pcb-rnd). However, it's equally important not to -restrict users in optional extras that may require more dependencies. This is -solved by minimizing core and moving functionality behind APIs in a plugin -system. -

    -This policy is very unlikely to change in the future - if you believe -the core should be rewritten in your favorite language, please fork the -project or start a new one. - Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_3.png =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/pie_col_3.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/pie_col_3.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/20160409/pie_col_3.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/20160409/poll.csv =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/poll.csv (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/poll.csv (nonexistent) @@ -1,9 +0,0 @@ -a,a,a,-,-,-,c -d,a,c,f,a,-,d -b,a,b,-,c,-,c -d,c,d,a+f,c,-,e -d,b,c,a+f,b,-,b -d,a,a,a,d,-,c --,a,c,-,a,-,- -c,a,b,f,a,-,c -c,a,c,-,a,-,- Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_4.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_4.png =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/pie_col_4.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/pie_col_4.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/20160409/pie_col_4.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/20160409/poll.tsv =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/poll.tsv (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/poll.tsv (nonexistent) @@ -1,9 +0,0 @@ -a a a - - - c -d a c f a - d -b a b - c - c -d c d a+f c - e -d b c a+f b - b -d a a a d - c -- a c - a - - -c a b f a - c -c a c - a - - Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_5.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_5.png =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/pie_col_5.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/pie_col_5.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/20160409/pie_col_5.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/20160409/header.csv =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/header.csv (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/header.csv (nonexistent) @@ -1 +0,0 @@ -1. Do you use the lesstif HID?,2. If there were different menu resources files distributed with PCB, would you try them?,3. Do you customize your menu resource file?,4. If you do not costumize your menu resource file, it's because,5. Do you miss multi-key sequences from the GTK hid?,6. If the GTK hid supported multi-key sequences, would that change any of your previous answers?,7. Vendor (drill) mapping also uses a resource file., \ No newline at end of file Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_7.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/devlog/20160409/pie_col_7.png =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/pie_col_7.png (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/pie_col_7.png (nonexistent) Property changes on: 1.1.4/doc-rnd/devlog/20160409/pie_col_7.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/devlog/20160409/header =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/header (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/header (nonexistent) @@ -1,7 +0,0 @@ -1. Do you use the lesstif HID? -2. If there were different menu resources files distributed with PCB, would you try them? -3. Do you customize your menu resource file? -4. If you do not costumize your menu resource file, it's because -5. Do you miss multi-key sequences from the GTK hid? -6. If the GTK hid supported multi-key sequences, would that change any of your previous answers? -7. Vendor (drill) mapping also uses a resource file. Index: 1.1.4/doc-rnd/devlog/20160409/poll.html =================================================================== --- 1.1.4/doc-rnd/devlog/20160409/poll.html (revision 10776) +++ 1.1.4/doc-rnd/devlog/20160409/poll.html (nonexistent) @@ -1,98 +0,0 @@ - - - -
    1. Do you use the lesstif HID? -2. If there were different menu resources files distributed with PCB, would you try them? -3. Do you customize your menu resource file? -4. If you do not costumize your menu resource file, it's because -5. Do you miss multi-key sequences from the GTK hid? -6. If the GTK hid supported multi-key sequences, would that change any of your previous answers? -7. Vendor (drill) mapping also uses a resource file. -
    aaa---c -
    dacfa-d -
    bab-c-c -
    dcda+fc-e -
    dbca+fb-b -
    daaad-c -
    -ac-a-- -
    cabfa-c -
    cac-a-- -
    - - - - -  - -
    -

    -

    Legend

    -
    -1. Do you use the lesstif HID? (select one)
    -a. yes, exclusively
    -b. yes, often
    -c. sometimes, rarely
    -d. never
    -
    -
    -2. If there were different menu resources files distributed with PCB, 
    -would you try them? (select one)
    -a. yes, I'd give each variant a try before deciding which one to use
    -b. no, I'm fine with the default
    -c. I don't know what a menu resource file is
    -
    -
    -3. Do you customize your menu resource file? (select one)
    -a. yes, always (e.g. I have an own variant I use with all installation of 
    -PCB)
    -b. yes, sometimes, rarely (e.g. I once had to do something repeatedly and 
    -added a key binding for that)
    -c. never, I know where I'd perform the changes if I ever needed 
    -them but defalts are good enough for now
    -d. never, I don't know what a menu resource file is
    -
    -
    -4. If you do not costumize your menu resource file, it's because (select 
    -zero or more):
    -a. I don't need to
    -b. the file is too long
    -c. too many keys are taken, it's hard to find a free one
    -d. I don't like the format of the file
    -e. I don't like the idea of editing text config files, I want a GUI for 
    -this
    -f. I don't want to diverge from the default settings (e.g. because of 
    -potetial hassle at a later upgrade)
    -
    -
    -5. Do you miss multi-key sequences from the GTK hid? (select one)
    -a. yes, I'd prefer to use them over modifiers (ctrl, alt, shift)
    -b. yes, I'd use them together with the modifiers
    -c. maybe I'd use some
    -d. no, I prefer modifiers
    -e. I hate the idea so much that I'd even disable it compile time if that 
    -was possible
    -f. N/A, don't know
    -
    -
    -6. If the GTK hid supported multi-key sequences, would that change any of 
    -your previous answers? (fill in zero or more with a letter)
    -a. my new choice for 2. would be:
    -b. my new choice for 3. would be:
    -
    -7. slightly off-topic: vendor (drill) mapping also uses a resource file. 
    -Do you use this feature? (select one)
    -a. yes, often, many of my boards rely on vendor mapping and I maintain 
    -my own resource files per vendor
    -b. yes, sometimes, rarely (e.g. I needed it once...)
    -c. no, I know how to use it but never needed it
    -d. no, I know the feature exists and I know where to look it up but I 
    -don't really know what exactly it can do or why I should bother
    -e. no, I never heard about this feature
    -
    -

    Downloads

    -
    $bn$code_size" - awk ' - /^#/ { - key=$1 - sub("#", "", key) - sub("[:=]", "", key) - $1="" - DB[key]=$0 - next - } - { desc = desc " " $0 } - - function strip(s) { - sub("^[ \t]*", "", s) - sub("[ \t]*$", "", s) - return s - } - - END { - st = DB["state"] - if (st ~ "partial") - clr = "bgcolor=\"yellow\"" - else if (st ~ "works") - clr = "bgcolor=\"lightgreen\"" - else if ((st ~ "fail") || (st ~ "disable")) - clr = "bgcolor=\"red\"" - else - clr="" - - clr2 = clr - if (clr2 != "") { - sub("bgcolor=\"", "", clr2) - sub("\"", "", clr2) - print "@color" >> "mods.pie" - print clr2 >> "mods.pie" - } - - print "" st - if (DB["lstate"] != "") - print "
    (" strip(DB["lstate"]) ")" - - dfl = DB["default"] - if (dfl ~ "buildin") - clr = "bgcolor=\"lightgreen\"" - else if (dfl ~ "plugin") - clr = "bgcolor=\"yellow\"" - else if ((dfl ~ "fail") || (dfl ~ "disable")) - clr = "bgcolor=\"red\"" - else - clr="" - - print "
    " dfl - if (DB["ldefault"] != "") - print "
    (" strip(DB["ldefault"]) ")" - print "
    " desc - } - ' < $n/README - fi -done -cat post.html -gen_pie "plugins" "$total" "#0088ff" >> after.pie -) > index.html - -for n in mods after -do - animpie < $n.pie | animator -H -d $n - pngtopnm ${n}0000.png | pnmcrop | pnmtopng > $n.png - rm ${n}0000.png -done - Property changes on: 1.1.4/doc-rnd/mods2/gen.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: 1.1.4/doc-rnd/mods2/after.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods2/after.png =================================================================== --- 1.1.4/doc-rnd/mods2/after.png (revision 10776) +++ 1.1.4/doc-rnd/mods2/after.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods2/after.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods2/before.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods2/before.png =================================================================== --- 1.1.4/doc-rnd/mods2/before.png (revision 10776) +++ 1.1.4/doc-rnd/mods2/before.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods2/before.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods2/mods.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods2/mods.png =================================================================== --- 1.1.4/doc-rnd/mods2/mods.png (revision 10776) +++ 1.1.4/doc-rnd/mods2/mods.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods2/mods.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods2/post.html =================================================================== --- 1.1.4/doc-rnd/mods2/post.html (revision 10776) +++ 1.1.4/doc-rnd/mods2/post.html (nonexistent) @@ -1,3 +0,0 @@ -
    - - Index: 1.1.4/doc-rnd/mods2/pre.html =================================================================== --- 1.1.4/doc-rnd/mods2/pre.html (revision 10776) +++ 1.1.4/doc-rnd/mods2/pre.html (nonexistent) @@ -1,60 +0,0 @@ - - -

    pcb-rnd modularization

    -

    Why bother...

    -I believe good software should be modular. This is especially important in -the context of large software, such as CAD applications. There should be -a thin core that can model the world and provide the basic operations defined -on it but anything else should go in separate modules. -

    -Fortunately PCB already had a strong infrastructure supporting this idea. -It has dynamic loadable plugins and the GUI and exporters are in separate -HID modules. While working on pcb-gpmi and later pcb-rnd, I added the -gpmi module as a separate plugin. -

    -In version 1.0.8 and 1.0.9 a cosiderable chunk of core code has been moved into -core plugins. A core plugin is just a plugin that is -maintained together with the core, in the same repository, still the code is -somewhat detached from the core. More importantly, the user can choose, for -each plugin, separately: -

    -

    -I believe such modularization has benefits on multiple levels: -

    - -

    Progress in charts

    -

    Before-after

    -All numbers are in SLOC -and are acquired running sloccount on the given directory. While lines of -code alone is not a true measure of complexity, it's a good estimation. The -slices of pie charts are the major components of the pcb-rnd executable. -
    - -
            -
    Before modularization: pcb-rnd version 1.0.7 -
    Note: gpmi was already a plugin -
    - After modularization: pcb-rnd version 1.0.9 -
    Note: gpmi is part of the "plugins" slice -
    -
    -

    Zooming on to the plugins

    -

    - -

    -(Red means the plugin doesn't really work). - -

    Progress in numbers

    -Below is a table with the summary of core plugins. - -
    module size [sloc] status configure
    default
    description - - Index: 1.1.4/doc-rnd/mods2/index.html =================================================================== --- 1.1.4/doc-rnd/mods2/index.html (revision 10776) +++ 1.1.4/doc-rnd/mods2/index.html (nonexistent) @@ -1,159 +0,0 @@ - - -

    pcb-rnd modularization

    -

    Why bother...

    -I believe good software should be modular. This is especially important in -the context of large software, such as CAD applications. There should be -a thin core that can model the world and provide the basic operations defined -on it but anything else should go in separate modules. -

    -Fortunately PCB already had a strong infrastructure supporting this idea. -It has dynamic loadable plugins and the GUI and exporters are in separate -HID modules. While working on pcb-gpmi and later pcb-rnd, I added the -gpmi module as a separate plugin. -

    -In version 1.0.8 and 1.0.9 a cosiderable chunk of core code has been moved into -core plugins. A core plugin is just a plugin that is -maintained together with the core, in the same repository, still the code is -somewhat detached from the core. More importantly, the user can choose, for -each plugin, separately: -

      -
    • to compile it as a buildin (static-link it into the pcb executable) -
    • to compile it as a plugin (dynamic-link it runtime, if the .so is installed in the plugins/ directory) -
    • to disable the plugin, so it is not compiled at all -
    -

    -I believe such modularization has benefits on multiple levels: -

      -
    • it is possible to compiler smaller, potentially faster executables by omitting features the specific user would never use anyway -
    • in a distribution dynamic-link plugins can be distributed as separate packages providing the user with the option to decide what features to install -
    • such plugins have to have some sort of APIs if they want to reference eachother or if the code needs to reference them; such an API may not (and often did not) exist when the code is part of the core -
    - -

    Progress in charts

    -

    Before-after

    -All numbers are in SLOC -and are acquired running sloccount on the given directory. While lines of -code alone is not a true measure of complexity, it's a good estimation. The -slices of pie charts are the major components of the pcb-rnd executable. -
    - -
            -
    Before modularization: pcb-rnd version 1.0.7 -
    Note: gpmi was already a plugin -
    - After modularization: pcb-rnd version 1.0.9 -
    Note: gpmi is part of the "plugins" slice -
    -
    -

    Zooming on to the plugins

    -

    - -

    -(Red means the plugin doesn't really work). - -

    Progress in numbers

    -Below is a table with the summary of core plugins. - -
    module size [sloc] status configure
    default
    description - - -
    autoplace612 - works - buildin - Automatically place elements. -
    autoroute4337 - works - buildin - Automatically route selected or all rats. This is the original autorouter. -
    dbus438 - disabled -
    (TODO: needs scconfig support) -
    disabled - Remote control PCB using DBUS. -
    djopt2320 - works - buildin - Various board optimization algorithms. -
    export_bom374 - works - buildin - Export bom (Bill of Materials) -
    export_gcode2452 - works - buildin - Export to gcode -
    export_gerber972 - works - buildin - Export to gerber -
    export_lpr96 - works - buildin - Export to lpr (using export_ps to generate postscript) -
    export_nelma685 - works - buildin - Export to nelma (Numerical capacitance calculator) -
    export_png1107 - works - buildin - Export to png, gif and jpeg -
    export_ps1613 - works - buildin - Export postscript or embedded postscript. -
    fontmode163 - works - buildin - Font editing actions. -
    gpmi3003 - works - buildin -
    (if gpmi is installed) -
    Scriptable plugin system with about 10 scripting languages supported and dynamic load/unload of scripts that can manipulate the GUI, the board, can implement exporters, etc. -
    import_edif3578 - works - buildin - Import code for netlists in the EDIF format. -
    import_sch259 - works - buildin - Imports element and netlist data from the schematics (or some other source). -
    legacy_func72 - works - buildin - Random collection of old/obsolete (legacy) functions. 3rd party plugins may depend on them. This module implements C functions and variables and does not register actions or flags. -
    mincut886 - works - buildin - Use the minimal cut algorithm to indicate shorts: instead of highlighting two random pins/pads, try to highlight the least number of objects that connect the two networks. -
    oldactions57 - works - disabled - Random collection of old/obsolete actions. Bell(): audible feedback; DumpLibrary(): print footprint library on stdout -
    puller1884 - works - buildin - Pull traces to minimize their length. -
    renumber222 - works - buildin - Renumber elements (renaming them) and generate a text file for back annotation. -
    stroke124 - partially works (doesn't work with lesstif; works with the gtk hid, but there's no zoom bindings) - disabled -
    (requires libstroke installed) -
    Gesture recognition with libstroke. -
    toporouter6165 - fails -
    (infinite loop in gts) -
    disabled - Automatically route selected or all rats using a topological algorithm. This is the new autorouter from 2009. -
    vendordrill572 - works - buildin - Vendor drill mapping. -
    - - Index: 1.1.4/doc-rnd/wishlist.txt =================================================================== --- 1.1.4/doc-rnd/wishlist.txt (revision 10776) +++ 1.1.4/doc-rnd/wishlist.txt (nonexistent) @@ -1,32 +0,0 @@ -Active user wishes: - W1: cschem [Chris] - W2: proper primitives [Chris] - W3: more generic footprints [Chris, Evan] - W4: user doc [Miloh] - W5: 3d modeller export [Miloh, Evan] - W6: GUI access to object attributes: gtk editor, find/select by attrib [James] - W7: programmable drc (star grounding) [James] - W8: gl support [Erich, Evan] - W9: push & shove [Erich, Evan] - -Plan (parallel threads of development): - - A. file format and model - Steps: - 1. lihata persistency - 2. native lihata file format - 3. extend the file format - - everything should have an attribute hash -> W6 - - footprints should have optional attachments (e.g. 3d models) -> W5 - This helps us testing out the persistent-lihata idea that'd be - later used in chscem from the start -> W1 - This is also needed for more generic footprint implementation -> W3 - - B. visible attribute support - Steps: - 1. GTK dialog box for attribute edition - 2. search & select should work by attribute - 3. extend the routing style system to auto-add attributes - (this needs A., the new file format) - Allows the user to manage properties like "50 ohm net" in attributes, - to group objects by property, and to select them by property. -> W6 Index: 1.1.4/doc-rnd/mods3/gen.sh =================================================================== --- 1.1.4/doc-rnd/mods3/gen.sh (revision 10776) +++ 1.1.4/doc-rnd/mods3/gen.sh (nonexistent) @@ -1,125 +0,0 @@ -#!/bin/sh - -path=../../src_plugins - -sloc() -{ - (cd "$1" && sloccount .) | awk '/^Total Phys/ { size=$9; sub(",", "", size); print size }' -} - -gen_pie() -{ - local bn=$1 code_size=$2 color=$3 - echo "" - echo "@slice" - echo "$code_size" - echo "@label" - echo "$bn ($code_size)" - if test ! -z "$color" - then - echo "@color" - echo "$color" - fi -} - -echo "#autogenerated by gen.sh" > mods.pie -echo "#autogenerated by gen.sh" > after.pie - -echo Core >&2 -tmp=/tmp/pcb-mods-stat -mkdir $tmp -cp -r ../../src/*.c ../../src/*.h ../../src/Makefile* $tmp -code_size=`sloc $tmp` -gen_pie "core" $code_size "#00ff88" >> after.pie - -#echo 3rd >&2 -#code_size=`sloc ../../src_3rd` -#gen_pie "3rd" $code_size >> after.pie - - -( -cat pre.html -for n in $path/* -do - if test -d "$n" - then - echo $n >&2 - bn=`basename $n` - code_size=`sloc $n` - total=$(($total + $code_size)) - gen_pie $bn $code_size >> mods.pie -# case $bn in -# gpmi) echo "@pull" >> mods.pie; echo "0.1" >> mods.pie;; -# esac - - echo "
    $bn$code_size" - awk ' - /^#/ { - key=$1 - sub("#", "", key) - sub("[:=]", "", key) - $1="" - DB[key]=$0 - next - } - { desc = desc " " $0 } - - function strip(s) { - sub("^[ \t]*", "", s) - sub("[ \t]*$", "", s) - return s - } - - END { - st = DB["state"] - if (st ~ "partial") - clr = "bgcolor=\"yellow\"" - else if (st ~ "works") - clr = "bgcolor=\"lightgreen\"" - else if ((st ~ "fail") || (st ~ "disable")) - clr = "bgcolor=\"red\"" - else - clr="" - - clr2 = clr - if (clr2 != "") { - sub("bgcolor=\"", "", clr2) - sub("\"", "", clr2) - print "@color" >> "mods.pie" - print clr2 >> "mods.pie" - } - - print "" st - if (DB["lstate"] != "") - print "
    (" strip(DB["lstate"]) ")" - - dfl = DB["default"] - if (dfl ~ "buildin") - clr = "bgcolor=\"lightgreen\"" - else if (dfl ~ "plugin") - clr = "bgcolor=\"yellow\"" - else if ((dfl ~ "fail") || (dfl ~ "disable")) - clr = "bgcolor=\"red\"" - else - clr="" - - print "
    " dfl - if (DB["ldefault"] != "") - print "
    (" strip(DB["ldefault"]) ")" - print "
    " DB["implements"] - print "" desc - } - ' < $n/README - fi -done -cat post.html -gen_pie "plugins" "$total" "#0088ff" >> after.pie -) > index.html - -for n in mods after -do - animpie < $n.pie | animator -H -d $n - pngtopnm ${n}0000.png | pnmcrop | pnmtopng > $n.png - rm ${n}0000.png -done - Property changes on: 1.1.4/doc-rnd/mods3/gen.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: 1.1.4/doc-rnd/mods3/after.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods3/after.png =================================================================== --- 1.1.4/doc-rnd/mods3/after.png (revision 10776) +++ 1.1.4/doc-rnd/mods3/after.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods3/after.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods3/before.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods3/before.png =================================================================== --- 1.1.4/doc-rnd/mods3/before.png (revision 10776) +++ 1.1.4/doc-rnd/mods3/before.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods3/before.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods3/mods.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/mods3/mods.png =================================================================== --- 1.1.4/doc-rnd/mods3/mods.png (revision 10776) +++ 1.1.4/doc-rnd/mods3/mods.png (nonexistent) Property changes on: 1.1.4/doc-rnd/mods3/mods.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/mods3/post.html =================================================================== --- 1.1.4/doc-rnd/mods3/post.html (revision 10776) +++ 1.1.4/doc-rnd/mods3/post.html (nonexistent) @@ -1,17 +0,0 @@ -
    - -

    Classes

    -Each plugin implements a class (rarely a set of classes). Classes are: - -
    name description -
    (feature) random features directly accessible for the user, usually actions -
    (lib) support code library for other plugins (core doesn't depend on these); functionality not directly accessible for the user but other plugins may depend on it -
    hid Human Interface Device: interactive user interface, usually GUI -
    import load alien formats into the design space -
    export save (parts of) the design space in alien formats -
    fp footprint (element) library implementation -
    io native file format (save & load) implementation -
    - - - Index: 1.1.4/doc-rnd/mods3/pre.html =================================================================== --- 1.1.4/doc-rnd/mods3/pre.html (revision 10776) +++ 1.1.4/doc-rnd/mods3/pre.html (nonexistent) @@ -1,60 +0,0 @@ - - -

    pcb-rnd modularization

    -

    Why bother...

    -I believe good software should be modular. This is especially important in -the context of large software, such as CAD applications. There should be -a thin core that can model the world and provide the basic operations defined -on it but anything else should go in separate modules. -

    -Fortunately PCB already had a strong infrastructure supporting this idea. -It has dynamic loadable plugins and the GUI and exporters are in separate -HID modules. While working on pcb-gpmi and later pcb-rnd, I added the -gpmi module as a separate plugin. -

    -In version 1.0.8 to 1.1.0 a cosiderable chunk of core code has been moved into -core plugins. A core plugin is just a plugin that is -maintained together with the core, in the same repository, still the code is -somewhat detached from the core. More importantly, the user can choose, for -each plugin, separately: -

    -

    -I believe such modularization has benefits on multiple levels: -

    - -

    Progress in charts

    -

    Before-after

    -All numbers are in SLOC -and are acquired running sloccount on the given directory. While lines of -code alone is not a true measure of complexity, it's a good estimation. The -slices of pie charts are the major components of the pcb-rnd executable. -
    - -
            -
    Before modularization: pcb-rnd version 1.0.7 -
    Note: gpmi was already a plugin -
    - After modularization: pcb-rnd version 1.1.0 -
    Note: gpmi is part of the "plugins" slice -
    -
    -

    Zooming on to the plugins

    -

    - -

    -(Red means the plugin doesn't really work). - -

    Progress in numbers

    -Below is a table with the summary of core plugins. - -
    module size [sloc] status configure
    default
    class description - - Index: 1.1.4/doc-rnd/mods3/index.html =================================================================== --- 1.1.4/doc-rnd/mods3/index.html (revision 10776) +++ 1.1.4/doc-rnd/mods3/index.html (nonexistent) @@ -1,373 +0,0 @@ - - -

    pcb-rnd modularization

    -

    Why bother...

    -I believe good software should be modular. This is especially important in -the context of large software, such as CAD applications. There should be -a thin core that can model the world and provide the basic operations defined -on it but anything else should go in separate modules. -

    -Fortunately PCB already had a strong infrastructure supporting this idea. -It has dynamic loadable plugins and the GUI and exporters are in separate -HID modules. While working on pcb-gpmi and later pcb-rnd, I added the -gpmi module as a separate plugin. -

    -In version 1.0.8 to 1.1.0 a cosiderable chunk of core code has been moved into -core plugins. A core plugin is just a plugin that is -maintained together with the core, in the same repository, still the code is -somewhat detached from the core. More importantly, the user can choose, for -each plugin, separately: -

      -
    • to compile it as a buildin (static-link it into the pcb executable) -
    • to compile it as a plugin (dynamic-link it runtime, if the .so is installed in the plugins/ directory) -
    • to disable the plugin, so it is not compiled at all -
    -

    -I believe such modularization has benefits on multiple levels: -

      -
    • it is possible to compiler smaller, potentially faster executables by omitting features the specific user would never use anyway -
    • in a distribution dynamic-link plugins can be distributed as separate packages providing the user with the option to decide what features to install -
    • such plugins have to have some sort of APIs if they want to reference eachother or if the code needs to reference them; such an API may not (and often did not) exist when the code is part of the core -
    - -

    Progress in charts

    -

    Before-after

    -All numbers are in SLOC -and are acquired running sloccount on the given directory. While lines of -code alone is not a true measure of complexity, it's a good estimation. The -slices of pie charts are the major components of the pcb-rnd executable. -
    - -
            -
    Before modularization: pcb-rnd version 1.0.7 -
    Note: gpmi was already a plugin -
    - After modularization: pcb-rnd version 1.1.0 -
    Note: gpmi is part of the "plugins" slice -
    -
    -

    Zooming on to the plugins

    -

    - -

    -(Red means the plugin doesn't really work). - -

    Progress in numbers

    -Below is a table with the summary of core plugins. - -
    module size [sloc] status configure
    default
    class description - - -
    autocrop158 - works - buildin - (feature) - Reduce the board dimensions to just enclose the elements. -
    autoplace614 - works - buildin - (feature) - Automatically place elements. -
    autoroute4343 - works - buildin - (feature) - Automatically route selected or all rats. This is the original autorouter. -
    boardflip131 - WIP -
    (doesn't update rtrees) -
    disabled - (feature) - All objects on the board are up-down flipped. -
    dbus483 - WIP -
    (needs to install the xml?) -
    disabled - (feature) - Remote control PCB using DBUS. -
    diag162 - works - disabled - (feature) - Actions for pcb-rnd core diagnostics, intended for developers. These are not in core because end users normally don't need these. As a plugin, due to dynamic loading, it can be dropped on an existing pcb-rnd installation with minimal risk of scaring away a reproducible bug. -
    distalign428 - works - buildin - (feature) - Introducing Align() and Distribute(), which work much like the similarly named functions in Visio. Given that PCB does not have the concept of "first selected object" to draw on, the reference points can be selected by arguments. -
    distaligntext466 - works - buildin - (feature) - Same as distalign, operates on text objects. -
    djopt2320 - works - buildin - (feature) - Various board optimization algorithms. -
    export_bboard426 - WIP - disabled - export - Export breadboard -
    export_bom230 - works - buildin - export - Export bom (Bill of Materials) -
    export_dsn443 - Work-in-progress - disable - export - Export specctra .dsn files -
    export_dxf3992 - WIP - disabled - export - Export dxf -
    export_gcode2466 - works - buildin - export - Export to gcode -
    export_gerber971 - works - buildin - export - Export to gerber -
    export_ipcd356468 - Work-in-progress - disable - export - IPC-D-356 Netlist export. -
    export_lpr106 - works - buildin - export - Export to lpr (using export_ps to generate postscript) -
    export_nelma679 - works - buildin - export - Export to nelma (Numerical capacitance calculator) -
    export_openscad1394 - WIP - disabled - export - Export openscad -
    export_png1120 - works - buildin - export - Export to png, gif and jpeg -
    export_ps1638 - works - buildin - export - Export postscript or embedded postscript. -
    export_test257 - disabled -
    (work in progress) -
    buildin - export - A thin layer of code to dump exporter calls for testing the HID exporter API. -
    export_xy270 - works - buildin - export - Export XY centroid element data for pick & place. -
    fontmode165 - works - buildin - (feature) - Font editing actions. -
    fp_fs379 - works - buildin - fp - Footprint: file system based implementation. Used to be called Newlib: load footprints from directories. Run external processes for the parametric footprints. -
    fp_wget302 - works - buildin - fp - Footprint: get static (file) footprints from the web, e.g. from http://gedasymbols.org -
    gl590 - disabled -
    (pcb-rnd has no support for opengl.) -
    disabled - (feature) - Common gl functions for hids. -
    gpmi3046 - works - buildin -
    (if gpmi is installed) -
    (feature) - Scriptable plugin system with about 10 scripting languages supported and dynamic load/unload of scripts that can manipulate the GUI, the board, can implement exporters, etc. -
    hid_batch333 - works - buildin - hid - HID without GUI; read actions from stdin. -
    hid_gtk15972 - works - buildin - hid - GUI: the GTK HID. -
    hid_lesstif6923 - works - buildin - hid - GUI: the lesstif HID. -
    import_dsn114 - Work-in-progress - disable - import - Import specctra .dsn files -
    import_edif3621 - works - buildin - import - Import plugin for netlists in the EDIF format. -
    import_netlist131 - works - buildin - import - Import plugin for netlists in the classic pcb netlist format. -
    import_sch301 - works - buildin - import - Imports element and netlist data from the schematics (or some other source). -
    io_kicad998 - work-in-progress - disabled - io - Load and save the design and elements in Kicad's s-expression format - this is the new, currently preferred format in Kicad. -
    io_kicad_legacy941 - work-in-progress - buildin - io - Load and save the design and elements in Kicad's legacy format. -
    io_lihata1042 - WIP - disabled - io - Load and save the design and elements in the lihata board format. -
    io_pcb2174 - works - buildin - io - Load and save the design and elements in the original pcb text format. -
    jostle446 - works - buildin - (feature) - Pushes lines out of the way. -
    lib_gensexpr6 - works - disabled - (lib) - S-expression parser lib -
    lib_legacy_func74 - works - buildin - (lib) - Random collection of old/obsolete (legacy) functions. 3rd party plugins may depend on them. This module implements C functions and variables and does not register actions or flags. -
    loghid273 - WIP - disabled - (feature) - Sits between a HID (or exporter) and the core and logs all core->plugin calls made through the HID structure. -
    mincut909 - works - buildin - (feature) - Use the minimal cut algorithm to indicate shorts: instead of highlighting two random pins/pads, try to highlight the least number of objects that connect the two networks. -
    oldactions155 - works - disabled - (feature) - Random collection of old/obsolete actions. Bell(): audible feedback; DumpLibrary(): print footprint library on stdout; a set of debug actions useful for writing pcb scripts: Debug(), DebugXY(), Return(). Old plugin actions to toggle or set settings that are now accessible via the unified config system (vendordrill, djopt) -
    polycombine208 - works - buildin - (feature) - The selected polygons are combined together according to the ordering of their points. -
    polystitch185 - segfaults - disable - (feature) - The polygon under the cursor (based on closest-corner) is stitched together with the polygon surrounding it on the same layer. Use with pstoedit conversions where there's a "hole" in the shape - select the hole. -
    propedit766 - works - buildin - (feature) - List and edit properties of a group of objects. -
    puller1888 - works - buildin - (feature) - Pull traces to minimize their length. -
    query1823 - WIP - disable - (feature) - pcb-rnd query language: execute expressions on objects and rules for the programmed drc. -
    renumber310 - works - buildin - (feature) - Renumber elements (renaming them) and generate a text file for back annotation. -
    report749 - works - buildin - (feature) - Report() and ReportObject() actions - print a report about design objects. -
    shand_cmd212 - works - buildin - (feature) - vi-like command shorthands (1..3 character long commands) -
    smartdisperse173 - works - buildin - (feature) - Improve the initial dispersion of elements by choosing an order based on the netlist, rather than the arbitrary element order. This isn't the same as a global autoplace, it's more of a linear autoplace. It might make some useful local groupings. For example, you should not have to chase all over the board to find the resistor that goes with a given LED. -
    stroke135 - partially works (doesn't work with lesstif; works with the gtk hid, but there's no zoom bindings) - disabled - (feature) - Gesture recognition with libstroke. -
    teardrops226 - works - buildin - (feature) - Draw teardrops on pins. -
    toporouter6162 - fails -
    (infinite loop in gts) -
    disabled - (feature) - Automatically route selected or all rats using a topological algorithm. This is the new autorouter from 2009. -
    vendordrill513 - works - buildin - (feature) - Vendor drill mapping. -
    - -

    Classes

    -Each plugin implements a class (rarely a set of classes). Classes are: - -
    name description -
    (feature) random features directly accessible for the user, usually actions -
    (lib) support code library for other plugins (core doesn't depend on these); functionality not directly accessible for the user but other plugins may depend on it -
    hid Human Interface Device: interactive user interface, usually GUI -
    import load alien formats into the design space -
    export save (parts of) the design space in alien formats -
    fp footprint (element) library implementation -
    io native file format (save & load) implementation -
    - - - Index: 1.1.4/doc-rnd/misc/install_cgi.html =================================================================== --- 1.1.4/doc-rnd/misc/install_cgi.html (revision 10776) +++ 1.1.4/doc-rnd/misc/install_cgi.html (nonexistent) @@ -1,45 +0,0 @@ - - -

    Installation of the footprint CGIs

    -

    system requirements, 3rd party software

    - The following software needs to be installed on the system - that will host the scripts: -
      -
    • /bin/bash (did not test with POSIX shell) -
    • awk (tested with gawk, may work with other modern implementation) -
    • common binutils, e.g. ls, find -
    • animator, the svn HEAD version; NOTE: it is possible to manually compile animator into a static executable (useful on dedicated web servers) -
    • a web server that can execute plain old CGI scripts -
    • a full checkout of pcb-rnd/trunk from svn://repo.hu/pcb-rnd/trunk -
    - -

    Installation

    -Since the CGIs are just demo scripts for repo.hu and are not really installed -anywhere else normally, there is no install script but a manual installation -process. For both the parametric and the static footprint CGI: -
      -
    1. check out pcb-rnd/trunk in a directory readable (but not writable) by www-data (or whatever user the CGI will run with) -
    2. copy the config file pcblib.cgi.conf from pcb-rnd/trunk/util to /etc -
    3. edit the config file; ignore setting sdir for now -
    4. hardlink, copy, or wrap the cgi files from under pcb-rnd/trunk/util into the web server's CGI directory -
    -

    -For the static footprint CGI (set up the map cache): -

      -
    1. cd to trunk/util/pcblib-map in the checkout and run make - NOTE: some awk scripts have hardwired CGI paths yet (TODO) -
    2. copy this directory to a web-accessible directory -
    3. set sdir to the absolute path of the web-accessible copy in /etc/pcblib.cgi.conf -
    - -

    Tips and tricks

    -

    cgi wrapping

    -Making the checkout directly into the cgi-bin dir is not a good idea. Using -a hard link on each CGI between the checkout and the cgi-bin dir is better, -but an svn up will silently break the link leaving the old version live. -The most stable solution is placing a wrapper script in the cgi-bin dir: -
    -#!/bin/bash
    -. /full/path/to/the/checkout/util/pcblib-param.cgi
    -
    - - Index: 1.1.4/doc-rnd/screenshot.jpg =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/screenshot.jpg =================================================================== --- 1.1.4/doc-rnd/screenshot.jpg (revision 10776) +++ 1.1.4/doc-rnd/screenshot.jpg (nonexistent) Property changes on: 1.1.4/doc-rnd/screenshot.jpg ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi_temp_inst.txt =================================================================== --- 1.1.4/doc-rnd/gpmi_temp_inst.txt (revision 10776) +++ 1.1.4/doc-rnd/gpmi_temp_inst.txt (nonexistent) @@ -1,65 +0,0 @@ -GPMI system-wide installation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The installation process is somewhat manual at this early stage. Please -follow the steps below. - -First, you'll need libgpmi - it's a general purpose script glue interface. - -A/1. svn checkout svn://repo.hu/gpmi/trunk gpmi/trunk -A/2. look at doc/languages.txt there; if you have preferred languages, -please install the -dev packages of those. My favorite is mawk, but I -think most of the example pcb scripts would be in lua. Versions should -match; it may be that gpmi works with a newer minor version out of the -box, tho. -A/3. run ./configure -A/4. check if it found the language(s) you wanted; if not, or anything -else breaks, please send me your scconfig/config.log -A/5. make -A/6. make install (as root, but see below) - -There are options to step 6: - -- if you want to check what it'd do, you could run this: - - install_root=/tmp/foo make install - - it's like DESTDIR for autotools: it will do everything but will use - /tmp/foo instead of / so you see what it'd do without using root or - messing with /usr - -- you can use make linstall instead of make install; this creates symlinks -(pointing to the binaries in your user checkout) instead of copying the -files. If gpmi changes and you need to update and recompile, you won't -need to reinstall (until the number of files change). - -- there's a make uninstall, but it's more or less untested (failed once -and worked once for me) - -Second, you'll need pcb-rnd: - -B/1. svn checkout svn://repo.hu/pcb-rnd/trunk pcb-rnd/trunk -B/2. ./configure -B/3. check the output; if anything went wrong, please send me -scconfig/config.log -B/4. make -B/5. you don't need to install it for testing: cd src; ./pcb-rnd - - -There are options in step 2: by default, if gpmi is found, it's compiled -in "buildin" mode, which means script support is compiled into the pcb-rnd -executable. An alternative is to have it as a plugin (dynamic linkable -object). This can be done using the --plugin-gpmi argument for ./configure. - - -GPMI local installation -~~~~~~~~~~~~~~~~~~~~~~~ -GPMI can be installed without root, into a local user directory (typically -under home). To achieve this, follow the above steps with the following -modifications (assuming you want to install gpmi in ~/usr): - -A/3. ./configure --prefix=~/usr -B/2. ./configure --gpmi-prefix=~/usr - -NOTE: you don't need to use install_root; gpmi will install under ~/usr as -if it was /usr. Index: 1.1.4/doc-rnd/gpmi/scripting_intro.html =================================================================== --- 1.1.4/doc-rnd/gpmi/scripting_intro.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/scripting_intro.html (nonexistent) @@ -1,226 +0,0 @@ - - -

    Scripting intro

    -This document is an introduction to GPMI for pcb-rnd users. It focuses on -scripting pcb-rnd and doesn't discusses GPMI deeper than the minimum necessary. -GPMI is more generic than shown here. -

    -The scope of the document is to describe the relations between pcb-rnd, -hids, GPMI, glue packages and scripts. Details on how specific glue -packages access pcb-rnd internals (or how those internals work) are -described in other documents. - -

    1. pcb-rnd internals

    - -Since scripts are glued to pcb-rnd internals, scripters need to know -the basic concepts of how pcb-rnd is structured. - -

    1.1 pcb-rnd, HIDs, plugins and GPMI

    -pcb-rnd consists of: -
      -
    • a core that handles the file format, data structures, UI and exporter logics -
    • a hid system that is a layer between core and the HIDs -
    • a set of GUI HIDs which are responsible for interactive graphical display of the current design -
    • a set of exporter HIDs which are responsible for exporting offline representation of the current design -
    • a plugin system that can load HIDs from on the fly, from dynamic loadable libraries (.so or .dll) -
    • a buildin system which is the "static link" variant of the plugin system: some plugins can be selected to be statically linked into the pcb-rnd executable so they are "always loaded" -
    -

    -Note 1: at the moment GUI hids can not be plugins or buildins. -
    -Note 2: plugins/buildins are always exporter HIDs technically, but in practice -they do not have to offer exporting. This means such a HID plugin is loaded -and registered as an exporter on paper, but it doesn't really create a -new export facility, just sits there, interacting with pcb-rnd (creating -menus, actions, etc). Most script plugins do this. -

    -When pcb-rnd executable is compiled, the core, the default GUI and exporter HIDs -and buildins are compiled into the executable. Later on -

    -The GPMI hid is an optional plugin that, by compile-time choice -of the user, can be: -

      -
    • left out all-together - pcb-rnd does not have scripting -
    • compiled as a plugin - when the .so (or .dll) is put in the right directory, pcb-rnd loads it during startup and has scripting -
    • compiled as buildin - becomes part of the pcb-rnd executable so that scripting is always available -
    - -

    1.2. Actions, menus, exporters

    -The core implements actions. An action is a command with custom arguments, -e.g. Delete(Selected). These actions are the commands on the default command -line in pcb-rnd. In batch mode the command language uses these actions as well. -Remote controlling pcb-rnd using the --listen switch will read these actions -on the standard input. -

    -GUI menus are configured to execute actions too. This also means it is impossible -to realize an user-accessible functionality that can be triggered from -the GUI command line, menu or batch input without making it an action. -

    -The only exception, where new functionality is not behind a new action is -exporters. An exporter is a structured dialog box of options and a set of -callback functions implementing a drawing API. Exporting works by the following -steps: -

      -
    1. An exporter HID may register one or more exporters. -
    2. When the user tries to export the design, pcb-rnd lists all - registered exporters. -
    3. The user chooses one, and the preconfigured dialog box - with the selected exporter's options are popped up. -
    4. pcb-rnd core runs the dialog and saves the results if the user - clicked on the ok button. -
    5. pcb-rnd starts the exporting process: it calls the callbacks - to draw the design layer by layer, object by object. -
    - -

    1.3. How a script can interact with the user

    -
      -
    • The script may register actions - these actions are instantly accessible from the GUI command line, on stdin with --listen and in batch mode -
    • The script may create menus and bind them to actions - when the menu is selected, the action is executed -
    • The script may bind to events that will be generated asynchronously by pcb-rnd - when such an event is received, the script executes some code -
    • The script may register new exporter(s) - the user will be able to export the design using the script -
    • The script may run arbitrary code "on load" (when the script is loaded) - however, that time the design or even the GUI may not be loaded/initialized yet - this is useful for registering actions, bind to events or set up exporters -
    - - -

    2. GPMI intro

    - -

    2.1. GPMI's place in the pcb-rnd world

    -
    -GPMI is a plugin/buildin HID. Instead of doing actual work, it loads scripts -and provides a glue layer between pcb-rnd and the scripts. The actual work -is performed by the scripts. -The glue layer comes in two kinds: -
      -
    • gpmi module: dynamic lib written in C, knows how to load and interpret a script and how to deliver events to the script -
    • gpmi package: dynamic lib, provides C functions the script can directly call; package functions then know how to deal with PCB internals -
    -Arrows drawn with dashed line represents a slow, string based communication. -
    - -

    2.2. Module, script, script context, packages

    -
    -Each time a script needs to be loaded, first a module is loaded and the name -of the script is passed to the module. During module initialization, the module -sets up a script interpreter and script context and loads the script into the -context. -

    -If there are 3 separate lua scripts running in pcb-rnd, there are 3 separate -lua modules loaded, each dealing with one of the scripts. The process of -loading a script is illustrated by highlighting the relevant paths with red -for step 1 and green for step 2. -

    -Step 0: the GPMI HID finds a script has to be loaded. The idea comes -from the config file (pcb-rnd-gpmi.conf) or from the GUI (manage scripts) -or as a request from a script already loaded. -

    -Step 1: the GPMI HID loads the corresponding module which in turns -loads the script. The script has a "main" part that is run on load. For -most languages this is the global code sections; in some languages it is -a specific function, usually called main. A few basic glue packages -are already loaded before the script. -

    -Step 2: the script can load glue packages. This usually happens -from the on-load main part from the script. The actual mechanism is to -call PkgLoad() from a glue package that was automatically loaded in -Step 1. The green arrows represent this path: the script executes PkgLoad() -which in turns loads other package(s) into the GPMI hid. -

    -Packages are loaded only once and are globally accessible for multiple modules. -

    - -

    2.3. Binding events, registering actions, creating menus

    -
    -Binding an event in a script is done by calling the Bind() function -(this is implemented in a package automatically loaded). The first -argument is the name of the event, the second argument is the name of -the script function that should be called when the event is triggered. Both -arguments are strings. The event binding mechanism is shown in red in the -map to the right. -

    -The script can create new actions using the action_register() function -(the actions package needs to be loaded first). A script may register multiple -actions. This call is marked with green in the above map. -If any of the actions registered by the script is called, the event "ACTE_action" -is generated. This has two implications: -

      -
    • a script that registers actions needs to bind the ACTE_action event to serve the action requests -
    • if a script registers multiple actions, in the event handler it needs to check which action triggered the event (e.g. with a switch()-like construction on the event name) -
    -
    - -
    -Menus are created using the create_menu() call. Menus can be -created only when the GUI is already set up - this may happen only -after some of the scripts are already loaded. Thus scripts shall -create menus from an event handler bound to the ACTE_gui_init event. -This event is triggered right after the GUI has been set up. -On the map to the right the red arrows represent the path of ACTE_gui_init; -the green arrows represent the reaction of the script, creating the new -menu. -

    -

    - -

    2.4. Exporting

    -
    -Exporter scripts first have to set up an exporter hid. This typically -happens from their on-load main part. Related calls are in the hid -package. The following map shows this process with red arrows: -

    -When the user chooses to use the exporter, among the green arrows, -a series of events are triggered and the script can generate output -directly to a file from event handlers bound to these exporting events. -

    - -

    2.5. Making modifications on the design

    -The purpose of a script might be to manipulate the objects in the current design. -Such a script registers actions, and implements the handler of the actions -using the layout package. The layout package provides calls to query, -change and create design objects. - - -

    3. How it works in practice

    - -

    3.1. Loading the GPMI plugin

    -Check the output of ./configure, it will tell if gpmi is compiled as buildin -or plugin (or not at all). -If the gpmi plugin is compiled as a buildin, it is already loaded, no -further steps are required. -

    -If gpmi is a plugin, gpmi_plugin.so (or gpmi_plugin.dll) needs to be -copied in one of the plugin directories pcb-rnd is looking into on startup: - -
    path purpose -
    -
    $prefix/lib/pcb-rnd/plugins/$arch/ system plugins, multihost -
    $prefix/lib/pcb-rnd/plugins/ system plugins -
    ~/.pcb/plugins/$arch/ user plugins, multihost -
    ~/.pcb/plugins/ user plugins -
    ./plugins/$arch/ project plugins, multihost -
    ./plugins/ project plugins -
    -In the above table: -

      -
    • $prefix is the installation prefix (normally /usr) -
    • $arch is the host arch triplet, e.g. i386-unknown-linux; this is useful if multiple architectures share the same NFS mounted plugin dir -
    • ~ is the user home directory, if exists, e.g. /home/jdoe -
    • ./ is the current working directory pcb has been started from; may be useful for project-local scripts -
    - -

    3.2. Loading scripts

    -The gpmi plugin looks for a file called "pcb-rnd-gpmi.conf" in each of the -plugin directories. Wherever the file is found, it is loaded and parsed. -The file is plain text, each line describes a script to be loaded. Empty -lines and lines starting with # are comments and are ignored. -

    -Script load lines contain two words separated by a space: a module name -and a script name. Relative paths in the the script name are relative to -the directory the config file is found in. -

    -Example config: -

    -# load the carc script (written in lua) from next to the config file:
    -lua carc.lua
    -
    -# load foo.awk, whcih is a mawk script, from its installation path
    -mawk /usr/lib/foo/foo.awk
    -
    Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.html (nonexistent) @@ -1,25 +0,0 @@ -Load packages the script depends on: -
      -
    • actions for registering the new action; -
    • dialogs for printing in the message log. -
    -

    -Create a function ev_action that will be called when any of -the actions registered by the script is executed. The script registers -only one action, so it does not need to check which action caused -the function to be called. -

    -When the action event is called, use dialog_log to append -a log message. -

    -In the "main" section of the script, bind event ACTE_action to -our local function ev_action - this gets ev_action to -be called when any of the actions registered by this script is executed. -

    -Finally use action_register to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps) -
    Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.py =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.py (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.py (nonexistent) @@ -1,8 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -def ev_action(id, name, argc, x, y): - dialog_log("Hello world!\n"); - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.stt =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.stt (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.stt (nonexistent) @@ -1,10 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/dialogs" 0) - -(defun ev_action (id name argc x y) - (dialog_log "Hello world!\n")) - -(Bind "ACTE_action" "ev_action") -(action_register "hello" "" "log hello world" "hello()") - - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.pl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.pl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.pl (nonexistent) @@ -1,10 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -sub ev_action { - my($id, $name, $argc, $x, $y) = @_; - dialog_log("Hello world!\n"); -} - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.bash =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.bash (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.bash (nonexistent) @@ -1,18 +0,0 @@ -#!/bin/bash - -function load_packages() -{ - GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 - GPMI PkgLoad "pcb-rnd-gpmi/dialogs" 0 -} - -function ev_action() { - GPMI dialog_log "Hello world!\n" -} - -function main() -{ - load_packages - GPMI Bind "ACTE_action" "ev_action" - GPMI action_register "hello" "" "log hello world" "hello()" -} Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ID.desc =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ID.desc (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ID.desc (nonexistent) @@ -1,2 +0,0 @@ -Create a new action hello() that prints "Hello world!" in the message log. - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/index.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/index.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/index.html (nonexistent) @@ -1,55 +0,0 @@ - - -<-- back to the index of Rosetta examples -

    hello world (text, log)

    -Create a new action hello() that prints "Hello world!" in the message log. -

    Example implementations

    -awk - | -bash - | -lua - | -pl - | -py - | -rb - | -scm - | -stt - | -tcl -

    Explanation, step by step

    -Load packages the script depends on: -
      -
    • -actions - for registering the new action; -
    • -dialogs - for printing in the message log.
    - -

    Create a function -ev_action - that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. -

    When the action event is called, use -dialog_log - to append a log message. -

    In the "main" section of the script, bind event -ACTE_action - to our local function -ev_action - - this gets -ev_action - to be called when any of the actions registered by this script is executed. -

    Finally use -action_register - to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps)
    - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ID.name =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ID.name (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ID.name (nonexistent) @@ -1 +0,0 @@ -hello world (text, log) Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.lua =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.lua (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.lua (nonexistent) @@ -1,9 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -function ev_action(id, name, argc, x, y) - dialog_log("Hello world!\n"); -end - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.tcl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.tcl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.tcl (nonexistent) @@ -1,10 +0,0 @@ -PkgLoad pcb-rnd-gpmi/actions 0 -PkgLoad pcb-rnd-gpmi/dialogs 0 - -proc ev_action {id, name, argc, x, y} { - dialog_log "Hello world!\n" -} - -Bind ACTE_action ev_action -action_register "hello" "" "log hello world" "hello()" - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.scm =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.scm (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.scm (nonexistent) @@ -1,9 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/dialogs" 0) - -(define ev_action (lambda (id name argc x y) - (dialog_log "Hello world!\n"))) - -(Bind "ACTE_action" "ev_action") -(action_register "hello" "" "log hello world" "hello()") - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.awk =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.awk (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.awk (nonexistent) @@ -1,14 +0,0 @@ -BEGIN { - PkgLoad("pcb-rnd-gpmi/actions", 0); - PkgLoad("pcb-rnd-gpmi/dialogs", 0); -} - -function ev_action(id, name, argc, x, y) -{ - dialog_log("Hello world!\n"); -} - -BEGIN { - Bind("ACTE_action", "ev_action"); - action_register("hello", "", "log hello world", "hello()"); -} Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.rb =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.rb (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello/ex.rb (nonexistent) @@ -1,9 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -def ev_action(id, name, argc, x, y) - dialog_log("Hello world!\n"); -end - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.html (nonexistent) @@ -1,26 +0,0 @@ -Load packages the script depends on: -
      -
    • actions for registering the new action; -
    • dialogs for creating a dialog box. -
    -

    -Create a function ev_action that will be called when any of -the actions registered by the script is executed. The script registers -only one action, so it does not need to check which action caused -the function to be called. -

    -When the action event is called, use dialog_report to pop -up a report dialog. First argument donates the name (title) of the window, -the second is the text printed in the window. -

    -In the "main" section of the script, bind event ACTE_action to -our local function ev_action - this gets ev_action to -be called when any of the actions registered by this script is executed. -

    -Finally use action_register to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps) -
    Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.py =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.py (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.py (nonexistent) @@ -1,8 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -def ev_action(id, name, argc, x, y): - dialog_report("Greeting window", "Hello world!"); - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.stt =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.stt (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.stt (nonexistent) @@ -1,10 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/dialogs" 0) - -(defun ev_action (id name argc x y) - (dialog_report "Greeting window" "Hello world!")) - -(Bind "ACTE_action" "ev_action") -(action_register "hello" "" "log hello world" "hello()") - - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.pl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.pl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.pl (nonexistent) @@ -1,10 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -sub ev_action { - my($id, $name, $argc, $x, $y) = @_; - dialog_report("Greeting window", "Hello world!"); -} - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.bash =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.bash (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.bash (nonexistent) @@ -1,18 +0,0 @@ -#!/bin/bash - -function load_packages() -{ - GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 - GPMI PkgLoad "pcb-rnd-gpmi/dialogs" 0 -} - -function ev_action() { - GPMI dialog_report "Greeting window" "Hello world!" -} - -function main() -{ - load_packages - GPMI Bind "ACTE_action" "ev_action" - GPMI action_register "hello" "" "log hello world" "hello()" -} Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ID.desc =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ID.desc (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ID.desc (nonexistent) @@ -1,3 +0,0 @@ -Create a new action hello() that prints "Hello world!" in a popup window. - - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/index.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/index.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/index.html (nonexistent) @@ -1,55 +0,0 @@ - - -<-- back to the index of Rosetta examples -

    hello world (popup window)

    -Create a new action hello() that prints "Hello world!" in a popup window. -

    Example implementations

    -awk - | -bash - | -lua - | -pl - | -py - | -rb - | -scm - | -stt - | -tcl -

    Explanation, step by step

    -Load packages the script depends on: -
      -
    • -actions - for registering the new action; -
    • -dialogs - for creating a dialog box.
    - -

    Create a function -ev_action - that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. -

    When the action event is called, use -dialog_report - to pop up a report dialog. First argument donates the name (title) of the window, the second is the text printed in the window. -

    In the "main" section of the script, bind event -ACTE_action - to our local function -ev_action - - this gets -ev_action - to be called when any of the actions registered by this script is executed. -

    Finally use -action_register - to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps)
    - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ID.name =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ID.name (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ID.name (nonexistent) @@ -1 +0,0 @@ -hello world (popup window) Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.lua =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.lua (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.lua (nonexistent) @@ -1,9 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -function ev_action(id, name, argc, x, y) - dialog_report("Greeting window", "Hello world!"); -end - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.tcl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.tcl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.tcl (nonexistent) @@ -1,10 +0,0 @@ -PkgLoad pcb-rnd-gpmi/actions 0 -PkgLoad pcb-rnd-gpmi/dialogs 0 - -proc ev_action {id, name, argc, x, y} { - dialog_report "Greeting window" "Hello world!" -} - -Bind ACTE_action ev_action -action_register "hello" "" "log hello world" "hello()" - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.scm =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.scm (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.scm (nonexistent) @@ -1,9 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/dialogs" 0) - -(define ev_action (lambda (id name argc x y) - (dialog_report "Greeting window" "Hello world!"))) - -(Bind "ACTE_action" "ev_action") -(action_register "hello" "" "log hello world" "hello()") - Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.awk =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.awk (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.awk (nonexistent) @@ -1,14 +0,0 @@ -BEGIN { - PkgLoad("pcb-rnd-gpmi/actions", 0); - PkgLoad("pcb-rnd-gpmi/dialogs", 0); -} - -function ev_action(id, name, argc, x, y) -{ - dialog_report("Greeting window", "Hello world!"); -} - -BEGIN { - Bind("ACTE_action", "ev_action"); - action_register("hello", "", "log hello world", "hello()"); -} Index: 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.rb =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.rb (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/10_hello_gui/ex.rb (nonexistent) @@ -1,9 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -def ev_action(id, name, argc, x, y) - dialog_report("Greeting window", "Hello world!"); -end - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.html (nonexistent) @@ -1,36 +0,0 @@ -Load packages the script depends on: -
      -
    • actions for registering the new action; -
    • layout for searching selected objects and moving objects. -
    -

    -Create a function ev_action that will be called when any of -the actions registered by the script is executed. The script registers -only one action, so it does not need to check which action caused -the function to be called. -

    -When the action event is called, first set up: -

      -
    • fetch event argument 0 and 1 using action_arg; -
    • resolve the conversion rate from mm to PCB's units using mm2pcb_multiplier; -
    • perform a search for all selected object using layout_search_selected (return value is the number of objects found), name the resulting list "mv_search" -
    -A loop then iterates over the objects on the list: -
      -
    • resolve the Nth element of the list using layout_search_get, referecing the list by name ("mv_search") and specifying which element to get (the Nth); the result is an object pointer; -
    • move the object using layout_obj_move; specify the object pointer, then which part of the object should be moved ("OC_OBJ" means the whole object) and relative offsets (dx and dy calculated earlier) -
    -Finally the search list shall be destroyed to reclaim memory, using layout_search_free. -

    - -In the "main" section of the script, bind event ACTE_action to -our local function ev_action - this gets ev_action to -be called when any of the actions registered by this script is executed. -

    -Finally use action_register to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps) -
    Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.py =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.py (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.py (nonexistent) @@ -1,15 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/layout", 0); - -def ev_action(id, name, argc, x, y): - dx = int(action_arg(0)) * float(mm2pcb_multiplier()) - dy = int(action_arg(1)) * float(mm2pcb_multiplier()) - num_objs = int(layout_search_selected("mv_search", "OM_ANY")) - for n in xrange(0, num_objs): - obj_ptr = layout_search_get("mv_search", n) - layout_obj_move(obj_ptr, "OC_OBJ", dx, dy) - layout_search_free("mv_search") - -Bind("ACTE_action", "ev_action"); -action_register("hello", "", "log hello world", "hello()"); -action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.stt =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.stt (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.stt (nonexistent) @@ -1,24 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/layout" 0) - -(defun ev_action (id name argc x y) -(let - ( - (dx (* (->num (action_arg 0)) (->num (mm2pcb_multiplier)))) - (dy (* (->num (action_arg 1)) (->num (mm2pcb_multiplier)))) - (num_objs (->num (layout_search_selected "mv_search" "OM_ANY"))) - (obj_ptr 0) - ) - (do ((n 0 (1+ n))) - ((> n num_objs)) - (set! obj_ptr (layout_search_get "mv_search" n)) - (layout_obj_move obj_ptr "OC_OBJ" (->int dx) (->int dy)) - ) -) -) - -(Bind "ACTE_action" "ev_action") -(action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)") - - - Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.pl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.pl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.pl (nonexistent) @@ -1,20 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/layout", 0); - -sub ev_action { - my($id, $name, $argc, $x, $y) = @_; - - my $dx = action_arg(0) * mm2pcb_multiplier(); - my $dy = action_arg(1) * mm2pcb_multiplier(); - - my $num_objs = layout_search_selected("mv_search", "OM_ANY"); - for(my $n = 0; $n < $num_objs; $n++) { - $obj_ptr = layout_search_get("mv_search", $n); - layout_obj_move($obj_ptr, "OC_OBJ", $dx, $dy); - } - layout_search_free("mv_search"); - -} - -Bind("ACTE_action", "ev_action"); -action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.bash =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.bash (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.bash (nonexistent) @@ -1,41 +0,0 @@ -#!/bin/bash - -function load_packages() -{ - GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 - GPMI PkgLoad "pcb-rnd-gpmi/layout" 0 -} - -function ev_action() { - local dx dy n num_objs - - GPMI action_arg 0 - a0=`bash_int "$result"` - - GPMI action_arg 1 - a1=`bash_int "$result"` - - GPMI mm2pcb_multiplier - conv=`bash_int "$result"` - - dx=$(($a0 * $conv)) - dy=$(($a1 * $conv)) - - GPMI layout_search_selected "mv_search" "OM_ANY" - num_objs=`bash_int "$result"` - - for n in `seq 0 $(($num_objs-1))` - do - GPMI layout_search_get "mv_search" $n - obj_ptr="$result" - GPMI layout_obj_move $obj_ptr "OC_OBJ" $dx $dy - done - GPMI layout_search_free "mv_search" -} - -function main() -{ - load_packages - GPMI Bind "ACTE_action" "ev_action" - GPMI action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)" -} Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ID.desc =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ID.desc (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ID.desc (nonexistent) @@ -1,3 +0,0 @@ -Create a new action mv(dx,dy) that moves selected objects relative by dx and dy mm. - - Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/index.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/index.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/index.html (nonexistent) @@ -1,74 +0,0 @@ - - -<-- back to the index of Rosetta examples -

    action: move selected objects

    -Create a new action mv(dx,dy) that moves selected objects relative by dx and dy mm. -

    Example implementations

    -awk - | -bash - | -lua - | -pl - | -py - | -rb - | -scm - | -stt - | -tcl -

    Explanation, step by step

    -Load packages the script depends on: -
      -
    • -actions - for registering the new action; -
    • -layout - for searching selected objects and moving objects.
    - -

    Create a function -ev_action - that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. -

    When the action event is called, first set up: -

      -
    • fetch event argument 0 and 1 using -action_arg -; -
    • resolve the conversion rate from mm to PCB's units using -mm2pcb_multiplier -; -
    • perform a search for all selected object using -layout_search_selected - (return value is the number of objects found), name the resulting list "mv_search"
    - A loop then iterates over the objects on the list: -
      -
    • resolve the Nth element of the list using -layout_search_get -, referecing the list by name ("mv_search") and specifying which element to get (the Nth); the result is an object pointer; -
    • move the object using -layout_obj_move -; specify the object pointer, then which part of the object should be moved ("OC_OBJ" means the whole object) and relative offsets (dx and dy calculated earlier)
    - Finally the search list shall be destroyed to reclaim memory, using -layout_search_free -. -

    In the "main" section of the script, bind event -ACTE_action - to our local function -ev_action - - this gets -ev_action - to be called when any of the actions registered by this script is executed. -

    Finally use -action_register - to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps)
    - Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ID.name =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ID.name (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ID.name (nonexistent) @@ -1 +0,0 @@ -action: move selected objects Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.lua =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.lua (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.lua (nonexistent) @@ -1,18 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/layout", 0); - -function ev_action(id, name, argc, x, y) - local dx = action_arg(0) * mm2pcb_multiplier() - local dy = action_arg(1) * mm2pcb_multiplier() - - local num_objs = layout_search_selected("mv_search", "OM_ANY") - for n=0,num_objs+1 - do - obj_ptr = layout_search_get("mv_search", n) - layout_obj_move(obj_ptr, "OC_OBJ", dx, dy) - end - layout_search_free("mv_search") -end - -Bind("ACTE_action", "ev_action"); -action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); \ No newline at end of file Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.tcl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.tcl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.tcl (nonexistent) @@ -1,17 +0,0 @@ -PkgLoad pcb-rnd-gpmi/actions 0 -PkgLoad pcb-rnd-gpmi/layout 0 - -proc ev_action {id, name, argc, x, y} { - set dx [expr round([action_arg 0] * [mm2pcb_multiplier])] - set dy [expr round([action_arg 1] * [mm2pcb_multiplier])] - - set num_objs [layout_search_selected mv_search OM_ANY] - for {set n 0} {$n < $num_objs} {incr n} { - set obj_ptr [layout_search_get mv_search $n] - layout_obj_move $obj_ptr OC_OBJ $dx $dy - } - layout_search_free mv_search -} - -Bind ACTE_action ev_action -action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)" Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.scm =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.scm (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.scm (nonexistent) @@ -1,20 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/layout" 0) - -(define ev_action (lambda (id name argc x y) -(let - ( - (dx (* (string->number (action_arg 0)) (string->number (mm2pcb_multiplier)))) - (dy (* (string->number (action_arg 1)) (string->number (mm2pcb_multiplier)))) - (num_objs (string->number (layout_search_selected "mv_search" "OM_ANY"))) - (obj_ptr 0) - ) - (do ((n 0 (1+ n))) - ((> n num_objs)) - (set! obj_ptr (layout_search_get "mv_search" n)) - (layout_obj_move obj_ptr "OC_OBJ" (inexact->exact dx) (inexact->exact dy)) - ) -))) - -(Bind "ACTE_action" "ev_action") -(action_register "mv" "" "move selected objects by dx and dy mm" "mv(dx,dy)") Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.awk =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.awk (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.awk (nonexistent) @@ -1,22 +0,0 @@ -BEGIN { - PkgLoad("pcb-rnd-gpmi/actions", 0); - PkgLoad("pcb-rnd-gpmi/layout", 0); -} - -function ev_action(id, name, argc, x, y ,dx,dy,n,num_objs,obj_ptr) -{ - dx = action_arg(0) * mm2pcb_multiplier() - dy = action_arg(1) * mm2pcb_multiplier() - - num_objs = layout_search_selected("mv_search", "OM_ANY") - for(n = 0; n < num_objs; n++) { - obj_ptr = layout_search_get("mv_search", n) - layout_obj_move(obj_ptr, "OC_OBJ", dx, dy) - } - layout_search_free("mv_search") -} - -BEGIN { - Bind("ACTE_action", "ev_action"); - action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); -} Index: 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.rb =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.rb (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/30_move/ex.rb (nonexistent) @@ -1,25 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/layout", 0); - -def ev_action(id, name, argc, x, y) -# TODO: how to convert 1e+06 in ruby? -# conv = mm2pcb_multiplier().to_i - conv = 1000000 - - - dx = action_arg(0).to_i * conv.to_i; - dy = action_arg(1).to_i * conv.to_i; - - num_objs = layout_search_selected("mv_search", "OM_ANY").to_i; - - for n in 0..(num_objs-1) - obj_ptr = layout_search_get("mv_search", n); - layout_obj_move(obj_ptr, "OC_OBJ", dx, dy); - n += 1; - end - layout_search_free("mv_search"); - -end - -Bind("ACTE_action", "ev_action"); -action_register("mv", "", "move selected objects by dx and dy mm", "mv(dx,dy)"); Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.html (nonexistent) @@ -1,33 +0,0 @@ -Load packages the script depends on: -
      -
    • actions for registering the new action; -
    • dialogs for creating a dialog box. -
    -

    -Create a function ev_action that will be called when any of -the actions registered by the script is executed. The script registers -only one action, so it does not need to check which action caused -the function to be called. -

    -When the action event is called, use dialog_report to pop -up a report dialog. First argument donates the name (title) of the window, -the second is the text printed in the window. -

    -Create a function ev_gui_init that will be called when the -gui has been initialized - this is the right moment to register -new menus in the GUI. Put the new menu item in the -"Plugins/GPMI scripting/" menu by convention, and set hot key to ctrl+w. -The menu should execute action hello(). -

    -In the "main" section of the script, bind event ACTE_action to -our local function ev_action - this gets ev_action to -be called when any of the actions registered by this script is executed. -Also bind ev_gui_init so that the new menu can be safely created. -

    -Finally use action_register to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps) -
    Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.py =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.py (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.py (nonexistent) @@ -1,12 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -def ev_action(id, name, argc, x, y): - dialog_report("Greeting window", "Hello world!"); - -def ev_gui_init(id, argc, argv): - create_menu("/main_menu/Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); - -Bind("ACTE_action", "ev_action"); -Bind("ACTE_gui_init", "ev_gui_init"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.stt =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.stt (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.stt (nonexistent) @@ -1,12 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/dialogs" 0) - -(defun ev_action (id name argc x y) - (dialog_report "Greeting window" "Hello world!")) - -(defun ev_gui_init (id argc argv) - (create_menu "/main_menu/Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello")) - -(Bind "ACTE_action" "ev_action") -(Bind "ACTE_gui_init" "ev_gui_init") -(action_register "hello" "" "log hello world" "hello()") Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.pl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.pl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.pl (nonexistent) @@ -1,17 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -sub ev_action { - my($id, $name, $argc, $x, $y) = @_; - dialog_report("Greeting window", "Hello world!"); -} - -sub ev_gui_init -{ - my($id, $name, $argc, $argv) = @_; - create_menu("/main_menu/Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); -} - -Bind("ACTE_action", "ev_action"); -Bind("ACTE_gui_init", "ev_gui_init"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.bash =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.bash (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.bash (nonexistent) @@ -1,24 +0,0 @@ -#!/bin/bash - -function load_packages() -{ - GPMI PkgLoad "pcb-rnd-gpmi/actions" 0 - GPMI PkgLoad "pcb-rnd-gpmi/dialogs" 0 -} - -function ev_action() { - GPMI dialog_report "Greeting window" "Hello world!" -} - -function ev_gui_init() -{ - GPMI create_menu "/main_menu/Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello" -} - -function main() -{ - load_packages - GPMI Bind "ACTE_action" "ev_action" - GPMI Bind "ACTE_gui_init" "ev_gui_init" - GPMI action_register "hello" "" "log hello world" "hello()" -} Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ID.desc =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ID.desc (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ID.desc (nonexistent) @@ -1,3 +0,0 @@ -Create a new action hello() that prints "Hello world!" in a popup window, create a menu (under "Plugins/GPMI scripting/") that executes the action. - - Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/index.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/index.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/index.html (nonexistent) @@ -1,58 +0,0 @@ - - -<-- back to the index of Rosetta examples -

    hello world (popup window + submenu)

    -Create a new action hello() that prints "Hello world!" in a popup window, create a menu (under "Plugins/GPMI scripting/") that executes the action. -

    Example implementations

    -awk - | -bash - | -lua - | -pl - | -py - | -rb - | -scm - | -stt - | -tcl -

    Explanation, step by step

    -Load packages the script depends on: -
      -
    • -actions - for registering the new action; -
    • -dialogs - for creating a dialog box.
    - -

    Create a function -ev_action - that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called. -

    When the action event is called, use -dialog_report - to pop up a report dialog. First argument donates the name (title) of the window, the second is the text printed in the window. -

    Create a function -ev_gui_init - that will be called when the gui has been initialized - this is the right moment to register new menus in the GUI. Put the new menu item in the "Plugins/GPMI scripting/" menu by convention, and set hot key to ctrl+w. The menu should execute action hello(). -

    In the "main" section of the script, bind event -ACTE_action - to our local function -ev_action - - this gets -ev_action - to be called when any of the actions registered by this script is executed. Also bind ev_gui_init so that the new menu can be safely created. -

    Finally use -action_register - to register the action: -

      -
    • first argument is the name of the action -
    • second is the xy query string; it is empty since this action won't need coordinates to operate on -
    • third is the description that shows up in dumps and helps -
    • fourth is the syntax description (also for helps)
    - Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ID.name =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ID.name (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ID.name (nonexistent) @@ -1 +0,0 @@ -hello world (popup window + submenu) Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.lua =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.lua (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.lua (nonexistent) @@ -1,14 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -function ev_action(id, name, argc, x, y) - dialog_report("Greeting window", "Hello world!"); -end - -function ev_gui_init(id, argc, argv) - create_menu("/main_menu/Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); -end - -Bind("ACTE_action", "ev_action"); -Bind("ACTE_gui_init", "ev_gui_init"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.tcl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.tcl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.tcl (nonexistent) @@ -1,15 +0,0 @@ -PkgLoad pcb-rnd-gpmi/actions 0 -PkgLoad pcb-rnd-gpmi/dialogs 0 - -proc ev_action {id, name, argc, x, y} { - dialog_report "Greeting window" "Hello world!" -} - -proc ev_gui_init {id, argc, argv} { - create_menu "/main_menu/Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello" -} - -Bind ACTE_action ev_action -Bind ACTE_gui_init ev_gui_init -action_register "hello" "" "log hello world" "hello()" - Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.scm =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.scm (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.scm (nonexistent) @@ -1,12 +0,0 @@ -(PkgLoad "pcb-rnd-gpmi/actions" 0) -(PkgLoad "pcb-rnd-gpmi/dialogs" 0) - -(define ev_action (lambda (id name argc x y) - (dialog_report "Greeting window" "Hello world!"))) - -(define ev_gui_init (lambda (id argc argv) - (create_menu "/main_menu/Plugins/GPMI scripting/hello" "hello()" "h" "Ctrlw" "tooltip for hello"))) - -(Bind "ACTE_action" "ev_action") -(Bind "ACTE_gui_init" "ev_gui_init") -(action_register "hello" "" "log hello world" "hello()") Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.awk =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.awk (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.awk (nonexistent) @@ -1,20 +0,0 @@ -BEGIN { - PkgLoad("pcb-rnd-gpmi/actions", 0); - PkgLoad("pcb-rnd-gpmi/dialogs", 0); -} - -function ev_action(id, name, argc, x, y) -{ - dialog_report("Greeting window", "Hello world!"); -} - -function ev_gui_init(id, argc, argv) -{ - create_menu("/main_menu/Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); -} - -BEGIN { - Bind("ACTE_action", "ev_action"); - Bind("ACTE_gui_init", "ev_gui_init"); - action_register("hello", "", "log hello world", "hello()"); -} Index: 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.rb =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.rb (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/12_hello_menu/ex.rb (nonexistent) @@ -1,14 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/actions", 0); -PkgLoad("pcb-rnd-gpmi/dialogs", 0); - -def ev_action(id, name, argc, x, y) - dialog_report("Greeting window", "Hello world!"); -end - -def ev_gui_init(id, argc, argv) - create_menu("/main_menu/Plugins/GPMI scripting/hello", "hello()", "h", "Ctrlw", "tooltip for hello"); -end - -Bind("ACTE_action", "ev_action"); -Bind("ACTE_gui_init", "ev_gui_init"); -action_register("hello", "", "log hello world", "hello()"); Index: 1.1.4/doc-rnd/gpmi/rosetta/index.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/index.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/index.html (nonexistent) @@ -1,58 +0,0 @@ - - - -

    pcb-rnd scripting - Rosetta

    -The Rosetta Stone -of pcb-rnd scripting is a collection of example scripts implemented in -various scripting languages. Rosetta has multiple purposes: -
      -
    • to provide examples of using the pcb-rnd API; -
    • to not scare away newcomers by showing the first examples in an unfamiliar language; -
    • to help the user to decide which language to use for a specific task; -
    • to provide examples on how to convert idioms of pcb-rnd scripts from one language to another. -
    -

    -Each example comes with an explanation, written in plain English about what the -scripts do, step by step. Instead of trying to exploit powerful features -of the language, example implementations try to be simple. -

    -The list below is ordered from the least complex to the most complex examples. -Column lvl is the complexity score. The less the score is, the simpler -the example is. - - -

    Index of examples

    - - - - - - - - -
    lvlexample languages description -
    10 - hello world (text, log) - awk bash lua perl python ruby scheme stutter tcl - Create a new action hello() that prints "Hello world!" in the message log. -
    10 - hello world (popup window) - awk bash lua perl python ruby scheme stutter tcl - Create a new action hello() that prints "Hello world!" in a popup window. -
    12 - hello world (popup window + submenu) - awk bash lua perl python ruby scheme stutter tcl - Create a new action hello() that prints "Hello world!" in a popup window, create a menu (under "Plugins/GPMI scripting/") that executes the action. -
    30 - action: move selected objects - awk bash lua perl python ruby scheme stutter tcl - Create a new action mv(dx,dy) that moves selected objects relative by dx and dy mm. -
    35 - drill list exporter - awk lua tcl - Create a new exporter that prints a list of drills in x,y,dia table in CSV, TSV or text format -
    - - - - Index: 1.1.4/doc-rnd/gpmi/rosetta/index.templ.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/index.templ.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/index.templ.html (nonexistent) @@ -1,29 +0,0 @@ - - - -

    pcb-rnd scripting - Rosetta

    -The Rosetta Stone -of pcb-rnd scripting is a collection of example scripts implemented in -various scripting languages. Rosetta has multiple purposes: -
      -
    • to provide examples of using the pcb-rnd API; -
    • to not scare away newcomers by showing the first examples in an unfamiliar language; -
    • to help the user to decide which language to use for a specific task; -
    • to provide examples on how to convert idioms of pcb-rnd scripts from one language to another. -
    -

    -Each example comes with an explanation, written in plain English about what the -scripts do, step by step. Instead of trying to exploit powerful features -of the language, example implementations try to be simple. -

    -The list below is ordered from the least complex to the most complex examples. -Column lvl is the complexity score. The less the score is, the simpler -the example is. - - -

    Index of examples

    - - - - - Index: 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.html (nonexistent) @@ -1,60 +0,0 @@ - -An exporter is a hid registered. During the export -process, pcb-rnd calls the exporter to draw objects on layers. The GPMI -layer converts these calls to bindable events. An exporter script catches -the drawing events relevant to the output format and draws everything from -event handlers. -

    -An exporter is sort of a drawing backend: pcb-rnd sets up graphic contexts -(gc for short) and draws on them. The first gc set up should open the -output file, the last gc closed should flush/close the file. -

    -


    - -

    Theory of operation

    -Assume only filled circles on the -top assembly layer are holes. Emit a line for each of these -and ignore everything else. - -

    Implementation

    -Load packages the script depends on: -
      -
    • hid for registering the new exporter; -
    • layout for unit conversion; -
    • dialogs for error reporting. -
    -

    -Set up an exporter hid, storing the handle of each object created in -a global variable: -

      -
    • create a hid using hid_create -
    • add two attributes (fields) to the dialog using hid_add_attribute -
    • register the new hid using hid_register - this makes it an exporter -
    -

    -Set up global state variables: -

      -
    • fmt will be a cache for the format selected by the user -
    • conv is the conversion scale between mm and PCB internal coordinate unit -
    • channel specifies a file handle or indicates that the output file is open -
    • green_light indicates that the exporter is drawing the relevant layer -
    -

    -Define a make_gc callback. It is called when a new graphic -context is created (e.g. for layers). An exporter is sort of a drawing -backend: pcb-rnd sets up gc's and draws on them. The first gc set up -should open the output file, the last gc closed should flush/close the file. -Define a destroy_gc callback for the latter. GCs are -destroyed at the end of the export process. Use global variable channel -to make sure the file is open/close only once (see TODO script context). -

    -Define a set_layer callback that sets green_light to true if -layer name is "topasssembly", false otherwise. -

    -Callback fill_circle is the workhorse: check if we have the green -light to emit lines, then convert coordinates and diameter to mm and -decide what format to use for printing a line for each filled circle. -

    -Finally, bind all four callbacks to exporter events. - - Index: 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ID.desc =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ID.desc (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ID.desc (nonexistent) @@ -1 +0,0 @@ -Create a new exporter that prints a list of drills in x,y,dia table in CSV, TSV or text format Index: 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/index.html =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/index.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/index.html (nonexistent) @@ -1,71 +0,0 @@ - - -<-- back to the index of Rosetta examples -

    drill list exporter

    -Create a new exporter that prints a list of drills in x,y,dia table in CSV, TSV or text format -

    Example implementations

    -awk - | -lua - | -tcl -

    Explanation, step by step

    - - An exporter is a hid registered. During the export process, pcb-rnd calls the exporter to draw objects on layers. The GPMI layer converts these calls to bindable events. An exporter script catches the drawing events relevant to the output format and draws everything from event handlers. -

    An exporter is sort of a drawing backend: pcb-rnd sets up graphic contexts (gc for short) and draws on them. The first gc set up should open the output file, the last gc closed should flush/close the file. -

    -


    -

    Theory of operation

    - Assume only -filled circles - on the -top assembly layer - are holes. Emit a line for each of these and ignore everything else. -

    Implementation

    - Load packages the script depends on: -
      -
    • -hid - for registering the new exporter; -
    • -layout - for unit conversion; -
    • -dialogs - for error reporting.
    - -

    Set up an exporter hid, storing the handle of each object created in a global variable: -

    - -

    Set up global state variables: -

      -
    • fmt will be a cache for the format selected by the user -
    • conv is the conversion scale between mm and PCB internal coordinate unit -
    • channel specifies a file handle or indicates that the output file is open -
    • green_light indicates that the exporter is drawing the relevant layer
    - -

    Define a -make_gc - callback. It is called when a new graphic context is created (e.g. for layers). An exporter is sort of a drawing backend: pcb-rnd sets up gc's and draws on them. The first gc set up should open the output file, the last gc closed should flush/close the file. Define a -destroy_gc - callback for the latter. GCs are destroyed at the end of the export process. Use global variable -channel - to make sure the file is open/close only once (see TODO -script context -). -

    Define a -set_layer - callback that sets green_light to true if layer name is "topasssembly", false otherwise. -

    Callback -fill_circle - is the workhorse: check if we have the green light to emit lines, then convert coordinates and diameter to mm and decide what format to use for printing a line for each filled circle. -

    Finally, bind all four callbacks to exporter events. Index: 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ID.name =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ID.name (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ID.name (nonexistent) @@ -1 +0,0 @@ -drill list exporter Index: 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.lua =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.lua (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.lua (nonexistent) @@ -1,65 +0,0 @@ -PkgLoad("pcb-rnd-gpmi/hid", 0) -PkgLoad("pcb-rnd-gpmi/layout", 0) -PkgLoad("pcb-rnd-gpmi/dialogs", 0) - -hid = hid_create("drill", "drill list export") -attr_path = hid_add_attribute(hid, "filename", "name of the output file", "HIDA_Path", 0, 0, "drill.txt") -attr_format = hid_add_attribute(hid, "format", "file format", "HIDA_Enum", 0, 0, "CSV|TSV|text") -hid_register(hid) - -fmt = 0 -conv = mm2pcb_multiplier() -channel = nil -green_light = 0 - -function make_gc(event_id, hid, gc) - if channel == nil - then - channel = io.open(hid_get_attribute(hid, attr_path), "w") - if channel == nil - then - dialog_report("Error exporting drill", "Could not open file [hid_get_attribute $hid $attr_path] for\nwriting, exporting drill failed.") - return - end - fmt = hid_get_attribute(hid, attr_format) - end -end - -function destroy_gc(event_id, hid, gc) - if channel ~= nil - then - channel:close() - channel = nil - end -end - -function set_layer(event_id, hid, name, group, empty) - if name == "topassembly" - then - green_light = 1 - else - green_light = 0 - end -end - -function fill_circle(event_id, hid, gc, cx, cy, r) - if green_light - then - cx = cx / conv - cy = cy / conv - local dia = r / conv * 2 - - if fmt == "CSV" then - channel:write(cx .. "," .. cy .. "," .. dia .. "\n") - elseif (fmt == "TSV") then - channel:write(cx .. "\t" .. cy .. "\t" .. dia .. "\n") - elseif (fmt == "text") then - channel:write(cx .. " " .. cy .. " " .. dia .. "\n") - end - end -end - -Bind("HIDE_make_gc", "make_gc") -Bind("HIDE_destroy_gc", "destroy_gc") -Bind("HIDE_set_layer", "set_layer") -Bind("HIDE_fill_circle", "fill_circle") Index: 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.tcl =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.tcl (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.tcl (nonexistent) @@ -1,63 +0,0 @@ -PkgLoad pcb-rnd-gpmi/hid 0 -PkgLoad pcb-rnd-gpmi/layout 0 -PkgLoad pcb-rnd-gpmi/dialogs 0 - -set hid [hid_create "drill" "drill list export"] -set attr_path [hid_add_attribute $hid "filename" "name of the output file" "HIDA_Path" 0 0 "drill.txt"] -set attr_format [hid_add_attribute $hid "format" "file format" "HIDA_Enum" 0 0 "CSV|TSV|text"] -hid_register $hid - -set fmt 0 -set conv [mm2pcb_multiplier] -set channel -1 -set green_light 0 - -proc make_gc {event_id hid gc} { - global channel attr_path attr_format fmt - - if {$channel == -1} { - if {[catch {open [hid_get_attribute $hid $attr_path] "w"} channel]} { - dialog_report "Error exporting drill" "Could not open file [hid_get_attribute $hid $attr_path] for\nwriting, exporting drill failed." - return - } - set fmt [hid_get_attribute $hid $attr_format] - } -} - -proc destroy_gc {event_id hid gc} { - global channel - - if {$channel > -1} { - close $channel - set channel -1 - } -} - -proc set_layer {event_id hid name group empty} { - global green_light - - if { $name eq "topassembly" } { set green_light 1 } { set green_light 0 } -} - -proc fill_circle {event_id hid gc cx cy r} { - global channel conv fmt green_light - - if {$green_light} { - set cx [expr $cx / $conv] - set cy [expr $cy / $conv] - set dia [expr $r / $conv * 2] - - if {$fmt eq "CSV"} { - puts $channel "$cx,$cy,$dia" - } elseif {$fmt eq "TSV"} { - puts $channel "$cx $cy $dia" - } elseif {$fmt eq "text"} { - puts $channel "$cx $cy $dia" - } - } -} - -Bind HIDE_make_gc make_gc -Bind HIDE_destroy_gc destroy_gc -Bind HIDE_set_layer set_layer -Bind HIDE_fill_circle fill_circle Index: 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.awk =================================================================== --- 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.awk (revision 10776) +++ 1.1.4/doc-rnd/gpmi/rosetta/35_export_drill/ex.awk (nonexistent) @@ -1,60 +0,0 @@ -BEGIN { - PkgLoad("pcb-rnd-gpmi/hid", 0) - PkgLoad("pcb-rnd-gpmi/layout", 0) - PkgLoad("pcb-rnd-gpmi/dialogs", 0) - - hid = hid_create("drill", "drill list export") - attr_path = hid_add_attribute(hid, "filename", "name of the output file", "HIDA_Path", 0, 0, "drill.txt") - attr_format = hid_add_attribute(hid, "format", "file format", "HIDA_Enum", 0, 0, "CSV|TSV|text") - hid_register(hid) - - fmt = 0 - conv = mm2pcb_multiplier() - channel = "" - green_light = 0 -} - -function make_gc(event_id, hid, gc) { - if (channel == "") { - channel = hid_get_attribute(hid, attr_path) -# awk: can't check whether the file can be open here - fmt = hid_get_attribute(hid, attr_format) - } -} - -function destroy_gc(event_id, hid, gc) { - if (channel != "") { - close(channel) - channel = "" - } -} - -function set_layer(event_id, hid, name, group, empty) { - if (name == "topassembly") - green_light = 1 - else - green_light = 0 -} - -function fill_circle(event_id, hid, gc, cx, cy, r ,dia) { - if (green_light) { - cx = cx / conv - cy = cy / conv - dia = r / conv * 2 - - if (fmt == "CSV") { - print cx "," cy "," dia > channel - } else if (fmt == "TSV") { - print cx "\t" cy "\t" dia > channel - } else if (fmt == "text") { - print cx " " cy " " dia > channel - } - } -} - -BEGIN { - Bind("HIDE_make_gc", "make_gc") - Bind("HIDE_destroy_gc", "destroy_gc") - Bind("HIDE_set_layer", "set_layer") - Bind("HIDE_fill_circle", "fill_circle") -} Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.png =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.png (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.png (nonexistent) Property changes on: 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi/Porting =================================================================== --- 1.1.4/doc-rnd/gpmi/Porting (revision 10776) +++ 1.1.4/doc-rnd/gpmi/Porting (nonexistent) @@ -1,5 +0,0 @@ -Currently the project works on Linux only. GPMI is portable, so we need -only Makefile tweakings on pcb-gpmi to be able to compile it anywhere -where GPMI compiles. However, first I want to see some test results -from Linux users. - Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.dot =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.dot (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_exp.dot (nonexistent) @@ -1,65 +0,0 @@ -digraph g { - rankdir=LR - splines="polyline" -# nodesep=1 -# ranksep=1.5 - - subgraph cluster_0 { - label="pcb-rnd" -# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] - core [label="core" shape=box] - hids [label="HID system" shape=box height=2] - plugins [label="plugin system" shape=box height=2] - } - - subgraph cluster_1 { - label="GPMI" - gpmi_hid [label="gpmi HID"] - gpmi_pkg [label="gpmi package\n(host glue layer)"] - gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] - gpmi_scr1 [label="lua script"] - gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] - gpmi_scr2 [label="awk script"] - outfile [label="export\noutput file" color=green] - } - - - - gui [label="the active\nGUI HID\n(e.g. gtk)"] - exp1 [label="PS exporer"] - exp2 [label="PNG exporer"] - - - exp1 -> hids [label="register"] - exp2 -> hids [label="register"] - - hids -> exp1 [label="drawing"] - hids -> exp2 [label="drawing"] - hids -> gui [label="drawing"] - - plugins -> gpmi_hid [label="load plugin"] - gpmi_hid -> hids [label="register"] - hids -> gpmi_hid [label="drawing" color=green] - core -> gpmi_hid [label="event"] - - gpmi_pkg -> core [label="calls & variables"] - gpmi_pkg -> hids [label="calls & variables" color=red] - gpmi_pkg -> gpmi_hid [label="calls & variables"] - gpmi_pkg -> plugins [label="calls & variables"] - - - gpmi_hid -> gpmi_mod1 [label="load script"] - gpmi_hid -> gpmi_mod1 [label="event" color=green] - gpmi_hid -> gpmi_mod2 [label="load script"] - gpmi_hid -> gpmi_mod2 [label="event"] - - gpmi_mod1 -> gpmi_scr1 [label="load and exec"] - gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed color=green] - gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=red] - gpmi_scr1 -> outfile [label="write" color=green] - - gpmi_mod2 -> gpmi_scr2 [label="load and exec"] - gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] - gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] - -} \ No newline at end of file Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.png =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.png (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.png (nonexistent) Property changes on: 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.dot =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.dot (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_menu.dot (nonexistent) @@ -1,63 +0,0 @@ -digraph g { - rankdir=LR - splines="polyline" -# nodesep=1 -# ranksep=1.5 - - subgraph cluster_0 { - label="pcb-rnd" -# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] - core [label="core" shape=box] - hids [label="HID system" shape=box height=2] - plugins [label="plugin system" shape=box height=2] - } - - subgraph cluster_1 { - label="GPMI" - gpmi_hid [label="gpmi HID"] - gpmi_pkg [label="gpmi package\n(host glue layer)"] - gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] - gpmi_scr1 [label="lua script"] - gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] - gpmi_scr2 [label="awk script"] - } - - - - gui [label="the active\nGUI HID\n(e.g. gtk)"] - exp1 [label="PS exporer"] - exp2 [label="PNG exporer"] - - - exp1 -> hids [label="register"] - exp2 -> hids [label="register"] - - hids -> exp1 [label="drawing"] - hids -> exp2 [label="drawing"] - hids -> gui [label="drawing" color=green] - - plugins -> gpmi_hid [label="load plugin"] - gpmi_hid -> hids [label="register"] - hids -> gpmi_hid [label="drawing"] - core -> gpmi_hid [label="event" color=red] - - gpmi_pkg -> core [label="calls & variables"] - gpmi_pkg -> hids [label="calls & variables" color=green] - gpmi_pkg -> gpmi_hid [label="calls & variables"] - gpmi_pkg -> plugins [label="calls & variables"] - - - gpmi_hid -> gpmi_mod1 [label="load script"] - gpmi_hid -> gpmi_mod1 [label="event" color=red] - gpmi_hid -> gpmi_mod2 [label="load script"] - gpmi_hid -> gpmi_mod2 [label="event"] - - gpmi_mod1 -> gpmi_scr1 [label="load and exec"] - gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed color=red] - gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=green] - - gpmi_mod2 -> gpmi_scr2 [label="load and exec"] - gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] - gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] - -} \ No newline at end of file Index: 1.1.4/doc-rnd/gpmi/Credits =================================================================== --- 1.1.4/doc-rnd/gpmi/Credits (revision 10776) +++ 1.1.4/doc-rnd/gpmi/Credits (nonexistent) @@ -1,11 +0,0 @@ -2006...2009 -~~~~~~~~~~~ -Big thanks to DJ Delorie who added external HID support in PCB and commited -many small patches needed to get this project working in the period -when the whole project was a plugin to vanilla pcb. - -The following people helped the project with their valuable feedbacks -in the early stage: - John Griessen - Carlos Nieves Onega - Index: 1.1.4/doc-rnd/gpmi/History =================================================================== --- 1.1.4/doc-rnd/gpmi/History (revision 10776) +++ 1.1.4/doc-rnd/gpmi/History (nonexistent) @@ -1,32 +0,0 @@ -History -~~~~~~~ -As of October 2006, PCB has native support for external (or dynamic -loadable) HIDs. This project is plugin that provides scripting features. - -For a long time I believe that good applications should be scriptable, -and real good ones should not restrict scripting to one or two languages. -For this reason I have been working on GPMI with various other developers -for years. GPMI provides a general way to split up big applications in -smaller, usually dynamic loadable parts, and encourages that some of these -parts should be written in a script language. For me, the ideal model -of an application is a small core that knows how to manipulate the -internal representation of the task and a lot of dynamic functionality -plugins and support plugins that do all the high-level job for the user. - -PCB is an old and big software, with a stable user base. Restructuring the -whole source to "GPMIize" it is no option. Instead, a nice compromise is -implementing this functionality in a plugin that pcb can load for the users -who are interested in such extras. - -From 2006 to 2009 spring the project was on hold, because I was nagging -PCB developers to add support for customizable dialog boxes. In late March -2009, PCB developers pointed out that the interface I was waiting for had been -there for who-knows-how-long. With the help of DJ Delorie I extended the -action handling of PCB to remember action contexts, which was another showstopper. -After all obstacles removed, I allocated a 24 hour coding session where I -finished the exporter functionality, added action binding, dialog box handling -and layout manipulation functions. - -During the summer of 2015 I merged pcb-gpmi into pcb-rnd and made it -the default scirpting engine for pcb-rnd. - Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.png =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.png (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.png (nonexistent) Property changes on: 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.dot =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.dot (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_reg.dot (nonexistent) @@ -1,64 +0,0 @@ -digraph g { - rankdir=LR - splines="polyline" -# nodesep=1 -# ranksep=1.5 - - subgraph cluster_0 { - label="pcb-rnd" -# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] - core [label="core" shape=box] - hids [label="HID system" shape=box height=2] - plugins [label="plugin system" shape=box height=2] - } - - subgraph cluster_1 { - label="GPMI" - gpmi_hid [label="gpmi HID"] - gpmi_pkg [label="gpmi package\n(host glue layer)"] - gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] - gpmi_scr1 [label="lua script"] - gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] - gpmi_scr2 [label="awk script"] - } - - - - gui [label="the active\nGUI HID\n(e.g. gtk)"] - exp1 [label="PS exporer"] - exp2 [label="PNG exporer"] - - - exp1 -> hids [label="register"] - exp2 -> hids [label="register"] - - hids -> exp1 [label="drawing"] - hids -> exp2 [label="drawing"] - hids -> gui [label="drawing"] - - plugins -> gpmi_hid [label="load plugin"] - gpmi_hid -> hids [label="register"] - hids -> gpmi_hid [label="drawing"] - core -> gpmi_hid [label="event"] - - gpmi_pkg -> core [label="calls & variables" color=green] - gpmi_pkg -> hids [label="calls & variables"] - gpmi_pkg -> gpmi_hid [label="calls & variables" color=red] - gpmi_pkg -> plugins [label="calls & variables"] - - - gpmi_hid -> gpmi_mod1 [label="load script"] - gpmi_hid -> gpmi_mod1 [label="event"] - gpmi_hid -> gpmi_mod2 [label="load script"] - gpmi_hid -> gpmi_mod2 [label="event"] - - gpmi_mod1 -> gpmi_scr1 [label="load and exec"] - gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed] - gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=red] - gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=green] - - gpmi_mod2 -> gpmi_scr2 [label="load and exec"] - gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] - gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] - -} \ No newline at end of file Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_load.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_load.png =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_load.png (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_load.png (nonexistent) Property changes on: 1.1.4/doc-rnd/gpmi/gpmi_flow_load.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi/gpmi_flow.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/gpmi/gpmi_flow.png =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow.png (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow.png (nonexistent) Property changes on: 1.1.4/doc-rnd/gpmi/gpmi_flow.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi/gpmi_flow_load.dot =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow_load.dot (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow_load.dot (nonexistent) @@ -1,63 +0,0 @@ -digraph g { - rankdir=LR - splines="polyline" -# nodesep=1 -# ranksep=1.5 - - subgraph cluster_0 { - label="pcb-rnd" -# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] - core [label="core" shape=box] - hids [label="HID system" shape=box height=2] - plugins [label="plugin system" shape=box height=2] - } - - subgraph cluster_1 { - label="GPMI" - gpmi_hid [label="gpmi HID"] - gpmi_pkg [label="gpmi package\n(host glue layer)"] - gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] - gpmi_scr1 [label="lua script"] - gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] - gpmi_scr2 [label="awk script"] - } - - - - gui [label="the active\nGUI HID\n(e.g. gtk)"] - exp1 [label="PS exporer"] - exp2 [label="PNG exporer"] - - - exp1 -> hids [label="register"] - exp2 -> hids [label="register"] - - hids -> exp1 [label="drawing"] - hids -> exp2 [label="drawing"] - hids -> gui [label="drawing"] - - plugins -> gpmi_hid [label="load plugin" color=red] - gpmi_hid -> hids [label="register"] - hids -> gpmi_hid [label="drawing"] - core -> gpmi_hid [label="event"] - - gpmi_pkg -> core [label="calls & variables"] - gpmi_pkg -> hids [label="calls & variables"] - gpmi_pkg -> gpmi_hid [label="calls & variables" color=green] - gpmi_pkg -> plugins [label="calls & variables"] - - - gpmi_hid -> gpmi_mod1 [label="load script" color=red] - gpmi_hid -> gpmi_mod1 [label="event"] - gpmi_hid -> gpmi_mod2 [label="load script"] - gpmi_hid -> gpmi_mod2 [label="event"] - - gpmi_mod1 -> gpmi_scr1 [label="load and exec" color=red] - gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed] - gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed color=green] - - gpmi_mod2 -> gpmi_scr2 [label="load and exec"] - gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] - gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] - -} \ No newline at end of file Index: 1.1.4/doc-rnd/gpmi/gpmi_flow.dot =================================================================== --- 1.1.4/doc-rnd/gpmi/gpmi_flow.dot (revision 10776) +++ 1.1.4/doc-rnd/gpmi/gpmi_flow.dot (nonexistent) @@ -1,63 +0,0 @@ -digraph g { - rankdir=LR - splines="polyline" -# nodesep=1 -# ranksep=1.5 - - subgraph cluster_0 { - label="pcb-rnd" -# core [label="pcb-rnd core|{{HID system|plugin system}}" shape=record] - core [label="core" shape=box] - hids [label="HID system" shape=box height=2] - plugins [label="plugin system" shape=box height=2] - } - - subgraph cluster_1 { - label="GPMI" - gpmi_hid [label="gpmi HID"] - gpmi_pkg [label="gpmi package\n(host glue layer)"] - gpmi_mod1 [label="gpmi lua module\n(script glue layer)"] - gpmi_scr1 [label="lua script"] - gpmi_mod2 [label="gpmi mawk module\n(script glue layer)"] - gpmi_scr2 [label="awk script"] - } - - - - gui [label="the active\nGUI HID\n(e.g. gtk)"] - exp1 [label="PS exporer"] - exp2 [label="PNG exporer"] - - - exp1 -> hids [label="register"] - exp2 -> hids [label="register"] - - hids -> exp1 [label="drawing"] - hids -> exp2 [label="drawing"] - hids -> gui [label="drawing"] - - plugins -> gpmi_hid [label="load plugin"] - gpmi_hid -> hids [label="register"] - hids -> gpmi_hid [label="drawing"] - core -> gpmi_hid [label="event"] - - gpmi_pkg -> core [label="calls & variables"] - gpmi_pkg -> hids [label="calls & variables"] - gpmi_pkg -> gpmi_hid [label="calls & variables"] - gpmi_pkg -> plugins [label="calls & variables"] - - - gpmi_hid -> gpmi_mod1 [label="load script"] - gpmi_hid -> gpmi_mod1 [label="event"] - gpmi_hid -> gpmi_mod2 [label="load script"] - gpmi_hid -> gpmi_mod2 [label="event"] - - gpmi_mod1 -> gpmi_scr1 [label="load and exec"] - gpmi_mod1 -> gpmi_scr1 [label="event" style=dashed] - gpmi_scr1 -> gpmi_pkg [label="function calls" style=dashed] - - gpmi_mod2 -> gpmi_scr2 [label="load and exec"] - gpmi_mod2 -> gpmi_scr2 [label="event" style=dashed] - gpmi_scr2 -> gpmi_pkg [label="function calls" style=dashed] - -} \ No newline at end of file Index: 1.1.4/doc-rnd/gpmi/index.html =================================================================== --- 1.1.4/doc-rnd/gpmi/index.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/index.html (nonexistent) @@ -1,32 +0,0 @@ - - -

    pcb-rnd GPMI scripting - TOC

    - -

    Installation, configuration

    - - - -

    High level docs

    - - -

    Glue layer documentation

    - - -

    Authors, credits, misc

    - - - - Index: 1.1.4/doc-rnd/gpmi/util/rosetta_genpages.sh =================================================================== --- 1.1.4/doc-rnd/gpmi/util/rosetta_genpages.sh (revision 10776) +++ 1.1.4/doc-rnd/gpmi/util/rosetta_genpages.sh (nonexistent) @@ -1,171 +0,0 @@ -#!/bin/sh - -clean_id() -{ - tr "\r\n" "~" | sed ' -s/~*$//; -s/|/\&pipe;/g; -s/&/\&/g; -s//\>/g; -s/"/\"/g; -s/'\''/\'/g; -s/~\+/
    /g; -' - echo "" -} - -genpage() -{ - local dir scripts name desc - - dir="$1" - scripts="$2" - - name=`cat $dir/ID.name` - desc=`cat $dir/ID.desc` - ./tags < "$dir/ex.html" | awk -v "fn_ref=../packages/XREF" -v "scripts=$scripts" -v "name=$name" -v "desc=$desc" ' - BEGIN { - while((getline < fn_ref) > 0) { - REF[$2] = $3 - } - print "" - print "" - print "<-- back to the index of Rosetta examples" - print "

    " name "

    " - print desc - - print "

    Example implementations

    " - v = split(scripts, S, "[\r\n]+") - for(n = 1; n <= v; n++) { - lang=S[n] - sub("^ex[.]", "", lang) - if (n != 1) - print " | " - print "" lang "" - } - - print "

    Explanation, step by step

    " - } - /^/ { - gsub("", "", $0) - name=$0 - gsub("[ \t]*", "", name) - if (name in REF) { - link_begin="" - link_end = "" - } - else { - link_begin="" - link_end="" - } - print "" link_begin $0 link_end "" - next - } - - { print $0 } - - ' > "$dir/index.html" -} - -gen_index() -{ - - awk -v "template=$1" ' - BEGIN { - FS="[|]" - q = "\"" - LANGS["rb"] = "ruby" - LANGS["pl"] = "perl" - LANGS["py"] = "python" - LANGS["stt"] = "stutter" - LANGS["scm"] = "scheme" - } - - ($1 == "scripts") { - s = $3 - gsub("ex[.]", "", s) - v = split(s, S, " ") - s = "" - for(n = 1; n <= v; n++) { - if (S[n] in LANGS) - s = s " " LANGS[S[n]] - else - s = s " " S[n] - } - DATA[$2, $1] = s - next - } - - ($1 == "name") { - if (names == "") - names = $2 - else - names = names "|" $2 - } - - - { - # DATA[script, name] = "hello world" - DATA[$2, $1] = $3 - } - - function generate(cmd ,N,n,v,name,level) { - if (cmd == "index") { - print "" - print "" - print "
    lvlexample languages description" - v = split(names, N, "[|]") - for(n = 1; n <= v; n++) { - name = N[n] - level = name - sub("_.*", "", level) - if (level ~ "[^0-9]") - level = "n/a" - print "
    " level - print " " DATA[name, "name"] "" - print " " DATA[name, "scripts"] - print " " DATA[name, "desc"] - } - print "
    " - } - else - print "Do not know how to generate " cmd > "/dev/stderr" - } - - END { - FS="" - while((getline < template) > 0) { - if (match($0, "]*>")) { - print substr($0, 1, RSTART-1) - cmd=substr($0, RSTART+8, RLENGTH-9) - sub("^[ \t]*", "", cmd) - generate(cmd) - print substr($0, RSTART+RLENGTH) - } - else - print $0 - } - } - ' - -} - - -for n in ../rosetta/* -do - if test -d "$n" - then - bn=`basename $n` - scripts=`cd $n && ls ex.* | grep -v ".pyc$\|.html$" ` - genpage "$n" "$scripts" - echo -n "desc|$bn|" - clean_id < $n/ID.desc - echo -n "name|$bn|" - clean_id < $n/ID.name - echo -n "scripts|$bn|" - echo $scripts - fi -done | gen_index ../rosetta/index.templ.html > ../rosetta/index.html - - Property changes on: 1.1.4/doc-rnd/gpmi/util/rosetta_genpages.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi/util/Makefile =================================================================== --- 1.1.4/doc-rnd/gpmi/util/Makefile (revision 10776) +++ 1.1.4/doc-rnd/gpmi/util/Makefile (nonexistent) @@ -1 +0,0 @@ -all: Index: 1.1.4/doc-rnd/gpmi/util/tags =================================================================== --- 1.1.4/doc-rnd/gpmi/util/tags (revision 10776) +++ 1.1.4/doc-rnd/gpmi/util/tags (nonexistent) @@ -1,4 +0,0 @@ -#!/bin/sh - -tr "\n" " " | sed "s@\(<[^/]\)@\n\1@g;s@\(]*>\)@\1\n@g" - Property changes on: 1.1.4/doc-rnd/gpmi/util/tags ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: 1.1.4/doc-rnd/gpmi/Makefile =================================================================== --- 1.1.4/doc-rnd/gpmi/Makefile (revision 10776) +++ 1.1.4/doc-rnd/gpmi/Makefile (nonexistent) @@ -1,20 +0,0 @@ -DPI_BIG=-Gsize=8,8 -Gdpi=166 -DPI=-Gsize=8,8 -Gdpi=100 - -all: gpmi_flow.png gpmi_flow_load.png gpmi_flow_reg.png gpmi_flow_menu.png gpmi_flow_exp.png - cd rosetta && make - -gpmi_flow.png: gpmi_flow.dot Makefile - dot $(DPI_BIG) -Tpng gpmi_flow.dot >$@ - -gpmi_flow_load.png: gpmi_flow_load.dot Makefile - dot $(DPI) -Tpng gpmi_flow_load.dot >$@ - -gpmi_flow_reg.png: gpmi_flow_reg.dot Makefile - dot $(DPI) -Tpng gpmi_flow_reg.dot >$@ - -gpmi_flow_menu.png: gpmi_flow_menu.dot Makefile - dot $(DPI) -Tpng gpmi_flow_menu.dot >$@ - -gpmi_flow_exp.png: gpmi_flow_exp.dot Makefile - dot $(DPI) -Tpng gpmi_flow_exp.dot >$@ Index: 1.1.4/doc-rnd/gpmi/packages/actions_ref.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/actions_ref.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/actions_ref.html (nonexistent) @@ -1,82 +0,0 @@ - - -

    PCB GPMI

    -

    Reference manual for package actions

    -Automatically generated from actions.h - -

    Events

    -
    -

    Events do not have return value. The first argument is always the even id. Event handlers defined in scripts get all event arguments converted to string (types below are informational). - -

    ACTE_action(int event_id, const char* name, int argc, int x, int y)

    -
    - Generated when an action registered by the script is executed.
    -   Arguments:
    -    name: name of the action (as registed using function action_register())
    -    argc: number of arguments. Arguments can be accessed using function action_arg
    -    x, y: optional coords, if need_xy was not empty at action_register 
    -
    -
    -

    ACTE_gui_init(int event_id, int argc, char** argv)

    -
    - Generated right after gui initialization, before the gui main loop.
    -   Arguments:
    -    argc: number of arguments the gui was initialized with.
    -    argv[]: arguments the gui was initialized with - unaccessible for the scripts. 
    -
    -
    -

    ACTE_unload(int event_id, const char* conffile)

    -
    - Generated right before unloading a script to give the script a chance
    -   to clean up.
    -   Arguments:
    -    conffile: the name of the config file that originally triggered laoding the script, or empty if the script was loaded from the gui. 
    -
    -
    -

    Functions

    -
    -

    The following functions are registered in script context. - -

    int action_register(const char* name, const char* need_xy, const char* description, const char* syntax)

    -
    - Register an action in PCB - when the action is executed, event
    -   ACTE_action is generated with the action name.
    -   Multiple actions can be registered. Any action registered by the script
    -   will trigger an ACTE_event sent to the script.
    -   Arguments:
    -    name: name of the action
    -    need_xy: the question the user is asked when he needs to choose a coordinate; if empty, no coordinate is asked
    -    description: description of the action (for the help)
    -    syntax: syntax of the action (for the help)
    -   Returns 0 on success.
    - 
    -
    -
    -

    const char* action_arg(int argn)

    -
    - extract the (argn)th event argument for the current action (makes sense only in an ACTE_action event handler 
    -
    -
    -

    int action(const char* cmdline)

    -
    - call an existing action using PCB syntax (e.g. foo(1, 2, 3))
    -   Returns non-zero on error; generally returns value of the action
    -   (which is also non-zero on error). 
    -
    -
    -

    void create_menu(const char* path, const char* action, const char* mnemonic, const char* hotkey, const char* tooltip)

    -
    - Create a new menu or submenu at path. Missing parents are created
    -   automatically with empty action, mnemonic, hotkey and tooltip.
    -   Arguments:
    -    path: the full path of the new menu
    -    action: this action is executed when the user clicks on the menu
    -    mnemonic: which letter to underline in the menu text (will be the fast-jump-there key once the menu is open)
    -    hotkey: when this key is pressed in the main gui, the action is also triggered; the format is modifiers<Key>letter, where modifiers is Alt, Shift or Ctrl. This is the same syntax that is used in the .res files.
    -    tooltip: short help text 
    -
    -
    - - - - Index: 1.1.4/doc-rnd/gpmi/packages/layout.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/layout.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/layout.html (nonexistent) @@ -1,58 +0,0 @@ - - -

    layout package

    - -Layout package searches and manipulates the current layout. Dimension units -are in nanometer unless otherwise mentioned. - -

    Page: board dimensions

    - Functions used to query or set width and height of the drawing: -
      -
    • int layout_get_page_width(); -
    • int layout_get_page_height(); -
    • void layout_set_page_size(int width, int height); -
    - -

    Layer manipulation

    -Most functions perform operations similar to user commands affecting -the current layer. -The following few calls can change the current layer. Warning: this is the -same current layer as the user's; the script most probably wants to save -the current layer before changing it and then restore it after the operation. -
      -
    • int layout_resolve_layer(const char *name): resolve layer number by name (case sensitive); returns negative number if not found -
    • int layout_get_current_layer(): returns the number of the current layer -
    • void layout_switch_to_layer(int layer): switch to layer (further actions will take place there) -
    -

    - -

    Object searches

    - Search results are collected on lists identified by their name (search_ID). - If a new search is done with the same name, old search results for that - name are discarded. - Search functions return the number of objects found (size of the list) that can - be then used while querying the results using layout_search_get(). - Results should be freed using layout_search_free() when they are no - longer needed. -

    - TODO: validity of a list in time -

    -Once the search list is ready, the script can iterate over it and resolve -the object handle of each object found, using layout_search_get(). Having -an object handle, The layout_obj_*() functions may be used by the script -to access fields of an object structure. - -

    Create new objects

    - The layour_create_*() calls are used to create new objects on the current - layer (set by layout_switch_to_layer()). - - -

    API reference - page, untis and coordinates

    -(angles are in radian) -TODO - -

    API reference - debug draw

    -TODO - - - Index: 1.1.4/doc-rnd/gpmi/packages/event_id.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/event_id.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/event_id.html (nonexistent) @@ -1,20 +0,0 @@ - - -

    event_id

    - -The first argument passed to an event handler is always the event ID. -It is useful if there are several GPMI events with the same arguments and -the script wants to bind them all to the same event handler. In that case -using event_id the event handler can determine which event triggered the -call. This design is similar to the signal handler documented in -signal(2). - -

    - -The case described above (dispatcher in the event handler) is rare. -Most users will bind one event to one function and can safely ignore this -argument. Nevertheless it must present as the first argument -on the event handler's argument list. - - - Index: 1.1.4/doc-rnd/gpmi/packages/dialogs_ref.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/dialogs_ref.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/dialogs_ref.html (nonexistent) @@ -1,105 +0,0 @@ - - -

    PCB GPMI

    -

    Reference manual for package dialogs

    -Automatically generated from dialogs.h - -

    Enums

    -
    -

    Enum values should be passed on as strings. - -

    dialog_fileselect_e

    -
    - Filter on what files a file select dialog should list 
    -
    - -
    value meaning -
    FS_NONE none of the below -
    FS_READ when the selected file will be read, not written (HID_FILESELECT_READ) -
    FS_NOT_EXIST the function calling hid->fileselect will deal with the case when the selected file already exists. If not given, then the gui will prompt with an "overwrite?" prompt. Only used when writing. (HID_FILESELECT_MAY_NOT_EXIST) -
    FS_TEMPLATE the call is supposed to return a file template (for gerber output for example) instead of an actual file. Only used when writing. (HID_FILESELECT_IS_TEMPLATE) -
    -
    -

    Functions

    -
    -

    The following functions are registered in script context. - -

    void dialog_log(const char* msg)

    -
    - Append a msg to the log (log window and/or stderr). 
    -
    -
    -

    int dialog_confirm(const char* msg, const char* ok, const char* cancel)

    -
    - Ask the user for confirmation (usually using a popup). Returns 0 for
    -   cancel and 1 for ok.
    -   Arguments:
    -     msg: message to the user
    -     ok: label of the OK button
    -     cancel: label of the cancel button
    -  Arguments "ok" and "cancel" may be empty (or NULL) in which
    -  case the GUI will use the default (perhaps localized) labels for
    -  those buttons. 
    -
    -
    -

    void dialog_report(const char* title, const char* msg)

    -
    - Pop up a report dialog.
    -   Arguments:
    -     title: title of the window
    -     msg: message 
    -
    -
    -

    char* dialog_prompt(const char* msg, const char* default_)

    -
    - Ask the user to input a string (usually in a popup).
    -   Arguments:
    -     msg: message or question text
    -     default_: default answer (this may be filled in on start)
    -   Returns the answer. 
    -
    -
    -

    char* dialog_fileselect(const char* title, const char* descr, char* default_file_, char* default_ext, const char* history_tag, dialog_fileselect_t flags)

    -
    - Pops up a file selection dialog.
    -   Arguments:
    -     title: window title
    -     descr: description
    -     default_file_
    -     default_ext: default file name extension
    -     history_tag
    -     flags: one or more flags (see below)
    -   Returns the selected file or NULL (empty). 
    -
    -
    -

    void dialog_beep(void)

    -
    - Audible beep 
    -
    -
    -

    int dialog_progress(int so_far, int total, const char* message)

    -
    - Request the GUI hid to draw a progress bar.
    -   Arguments:
    -     int so_far: achieved state
    -     int total: maximum state
    -     const char *message: informs the users what they are waiting for
    -   If so_far is bigger than total, the progress bar is closed.
    -   Returns nonzero if the user wishes to cancel the operation.
    -
    -
    -
    -

    int dialog_attribute(hid_t* hid, const char* title, const char* descr)

    -
    - Pop up an attribute dialog; content (widgets) of the dialog box are coming
    -   from hid (see the hid package).
    -   Arguments:
    -     hid: widgets
    -     title: title of the window
    -     descr: descripting printed in the dialog 
    -
    -
    - - - - Index: 1.1.4/doc-rnd/gpmi/packages/actions.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/actions.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/actions.html (nonexistent) @@ -1,123 +0,0 @@ - - -

    The actions package

    - -The action package is used to register actions and menus in PCB and -to execute existing actions. In PCB actions -are generated when the user selects a menu, presses a key or issues a -command on the PCB command line. - -

    Registration of new actions

    -The script may register new actions -using arbitrary action names. If any of the registered actions is -detected, an ACTE_action event is sent to the script. If multiple -actions are used in a script, argument name of the event handler -can be used to identify the triggering action. (This may be time consuming -in scripting languages (a series of string comparison) - those scripts -binding to frequent actions should not bind to too many different actions.) -pcb-gpmi guarantees that the event handler of a script is triggered only -when an action is caught that previously was registered by the same script. -

    -The process of binding an action: -

      -
    1. create an event handler for event ACTE_action -
    2. register one or more actions using function action_register -
    3. optional: when the event handler is triggered, check argument name (for scripts with multiple actions registered) -
    4. optional: use argument argc and function action_arg to fetch action arguments -
    5. optional: use arguments x, y to learn the cursor position on the layout. -
    - -Example (written in lua): -
    --- load the package
    -PkgLoad("pcb-gpmi/actions", 0);
    -
    --- action callback
    -function ev_action(id, name, argc, x, y)
    -	if name == "cake" then
    -		size = action_arg(1);
    -		-- put cake drawing code here
    -	else
    -		-- must be candy
    -		amount = action_arg(1);
    -		-- put candy drawing code here
    -	end
    -end
    -
    --- register and bind action
    -action_register("cake",  "cake center xy?", "cake service", "cake(size)", "");
    -action_register("candy", "candy cloud center xy?", "cake service", "candy(amount)", "");
    -Bind("ACTE_action", "ev_action");
    -
    -

    -When the script is unloaded all actions the script registered -are removed from pcb-rnd automatically. - -

    Executing actions

    -An existing action can be executed using the action() call. The only one -argument is a command line string. The syntyax is the same as in pcb -command line. - -Example (written in lua): -
    -PkgLoad("pcb-rnd-gpmi/actions", 0);
    -
    -function ev_action1(id, name, argc, x, y)
    -	action("undo()")
    -	action("undo()")
    -end
    -
    --- register and bind action
    -action_register("untwo", "", "undo twice", "untwo()", "CONTEXT!");
    -
    -

    -The above script registers a new action called untwo(). When untwo() is executed, -it exectues action undo() twice. - - -

    Creating menus

    -It is possible to insert menus and submenus runtime, using the call -create_menu(). The script should do this only after the gui has been initialized. -The most common way is to create all menus from the ACTE_gui_init event, -which is called after the gui finished setting up. -

    -The first argument of create_menu() is the menu path. The path is a list -of visible menu names separated by slashes (e.g. "/main_menu/File/Save as..." means -"File" menu, "Save as..." submenu). -

    -Paths are interpreted as menu paths, which are a slightly simplified version -of lihata paths found in menu.lht. Basically there's a main directory directly -under root that determines the type of the menu: -

    -

      -
    • /main_menu/ is the menubar -
    • /popups/something/ is a popup menu called something; the lesstif HID does - not support popups; popups are popped up by actions. -
    -

    -The simplification compared to lihata paths is that only menu and submenu -names are on the path, so lihata nodes like "li:submenu" should be ignored. -In other words, the path represents how the menus can be reached from the user -interface, plus a "main menu type prefix" as discussed above. -

    -By convention, scripts should -create new menu items under the "/main_menu/Plugins/" menu. -

    -The following example lua script registers a new menu item -

    -PkgLoad("pcb-rnd-gpmi/actions", 0);
    -
    -function ev_gui_init(argc, argv)
    -	create_menu("/main_menu/Plugins/foo", "undo()", "o", "Ctrl<Key>o", "tooltip for foo");
    -end
    -
    --- register and bind action
    -Bind("ACTE_gui_init", "ev_gui_init");
    -
    -

    -When the user clicks on the menu, the action script specified in the second argument -of create_menu() is executed. Thus the script usually registers a new action -first then registers one or more menu items executing those actions. - - - Index: 1.1.4/doc-rnd/gpmi/packages/hid_ref.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/hid_ref.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/hid_ref.html (nonexistent) @@ -1,205 +0,0 @@ - - -

    PCB GPMI

    -

    Reference manual for package hid

    -Automatically generated from hid.h - -

    Enums

    -
    -

    Enum values should be passed on as strings. - -

    hid_attr_type_e

    -
    - Type of an HID attribute (usually a widget on an attribute dialog box) 
    -
    - -
    value meaning -
    HIDA_Label non-editable label displayed on the GUI -
    HIDA_Integer a sugned integer value -
    HIDA_Real a floating point value -
    HIDA_String one line textual input -
    HIDA_Boolean true/false boolean value -
    HIDA_Enum select an item of a predefined list -
    HIDA_Mixed TODO -
    HIDA_Path path to a file or directory -
    HIDA_Unit select a dimension unit -
    HIDA_Coord enter a coordinate -
    -
    -

    EndCapStyle_e

    -
    - Line or arc ending style 
    -
    - -
    value meaning -
    Trace_Cap filled circle (trace drawing) -
    Square_Cap rectangular lines (square pad) -
    Round_Cap round pins or round-ended pads, thermals -
    Beveled_Cap octagon pins or bevel-cornered pads -
    -
    -

    Events

    -
    -

    Events do not have return value. The first argument is always the even id. Event handlers defined in scripts get all event arguments converted to string (types below are informational). - -

    HIDE_get_export_options(int event_id, void* hid)

    -
    - Called before get_exporter_options returns the option list to the GUI hid 
    -
    -
    -

    HIDE_do_export_start(int event_id, void* hid)

    -
    - Called before export redraw starts 
    -
    -
    -

    HIDE_do_export_finish(int event_id, void* hid)

    -
    - Called after export redraw finihsed 
    -
    -
    -

    HIDE_set_layer(int event_id, void* hid, const char* name, int group, int empty)

    -
    - PCB callback events for drawing: change layer 
    -
    -
    -

    HIDE_set_color(int event_id, void* hid, void* gc, const char* name)

    -
    - PCB callback events for drawing: change drawing color 
    -
    -
    -

    HIDE_set_line_cap(int event_id, void* hid, void* gc, EndCapStyle style)

    -
    - PCB callback events for drawing: change drawing line cap style
    -
    -
    -

    HIDE_set_line_width(int event_id, void* hid, void* gc, int width)

    -
    - PCB callback events for drawing: change drawing line width 
    -
    -
    -

    HIDE_set_draw_xor(int event_id, void* hid, void* gc, int xor)

    -
    - PCB callback events for drawing: toggle xor drawing method 
    -
    -
    -

    HIDE_set_draw_faded(int event_id, void* hid, void* gc, int faded)

    -
    - PCB callback events for drawing: toggle faded drawing method 
    -
    -
    -

    HIDE_draw_line(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

    -
    - PCB callback events for drawing: draw a line 
    -
    -
    -

    HIDE_draw_arc(int event_id, void* hid, void* gc, int cx, int cy, int xradius, int yradius, double start_angle, double delta_angle)

    -
    - PCB callback events for drawing: draw an arc from center cx;cy 
    -
    -
    -

    HIDE_draw_rect(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

    -
    - PCB callback events for drawing: draw a rectangle 
    -
    -
    -

    HIDE_fill_circle(int event_id, void* hid, void* gc, int cx, int cy, int radius)

    -
    - PCB callback events for drawing: draw a filled circle 
    -
    -
    -

    HIDE_fill_polygon(int event_id, void* hid, void* gc, int n_coords, int* x, int* y)

    -
    - PCB callback events for drawing: draw a filled ploygon 
    -
    -
    -

    HIDE_fill_rect(int event_id, void* hid, void* gc, int x1, int y1, int x2, int y2)

    -
    - PCB callback events for drawing: draw a filled rectangle 
    -
    -
    -

    HIDE_use_mask(int event_id, void* hid, int use_it)

    -
    - PCB callback events for drawing: TODO 
    -
    -
    -

    HIDE_make_gc(int event_id, void* hid, void* gc)

    -
    - PCB callback events for drawing: create a new graphical context 
    -
    -
    -

    HIDE_destroy_gc(int event_id, void* hid, void* gc)

    -
    - PCB callback events for drawing: destroy a graphical context 
    -
    -
    -

    HIDE_fill_pcb_pv(int event_id, void* hid, void* fg_gc, void* bg_gc, void* pad, int drawHole, int mask)

    -
    - PCB callback events for drawing: TODO 
    -
    -
    -

    HIDE_fill_pcb_pad(int event_id, void* hid, void* pad, int clear, int mask)

    -
    - PCB callback events for drawing: TODO 
    -
    -
    -

    Functions

    -
    -

    The following functions are registered in script context. - -

    hid_t* hid_create(char* hid_name, char* description)

    -
    - Creates a new hid context. Name and description matters only if the hid is
    -registered as an exporter later. 
    -
    -
    -

    int hid_add_attribute(hid_t* hid, char* attr_name, char* help, hid_attr_type_t type, int min, int max, char* default_val)

    -
    - Append an attribute in a hid previously created using hid_create().
    -   Arguments:
    -     hid: hid_t previously created using hid_create()
    -     attr_name: name of the attribute
    -     help: help text for the attribute
    -     type: type of the attribute (input widget type)
    -     min: minimum value of the attribute, if type is integer or real)
    -     max: maximum value of the attribute, if type is integer or real)
    -     default_val: default value of the attribute
    -  Returns an unique ID of the attribute the caller should store for
    -  later reference. For example this ID is used when retrieving the
    -  value of the attribute after the user finished entering data in
    -  the dialog. 
    -
    -
    -

    char* hid_get_attribute(hid_t* hid, int attr_id)

    -
    - Query an attribute from the hid after dialog_attributes() returned.
    -   Arguments:
    -     hid: hid_t previously created using hid_create()
    -     attr_id: the unique ID of the attribute (returned by hid_add_attribute())
    -   Returns the value (converted to string) set by the user. 
    -
    -
    -

    int hid_register(hid_t* hid)

    -
    - Register the hid; call it after a hid is created and its attributes
    -   are all set up 
    -
    -
    -

    void hid_gpmi_data_set(hid_t* h, void* data)

    -
    - For internal use 
    -
    -
    -

    hid_t* hid_gpmi_data_get(HID* h)

    -
    - For internal use 
    -
    -
    -

    HID_Attr_Val hid_string2val(const hid_attr_type_t type, const char* str)

    -
    - For internal use 
    -
    -
    - - - - Index: 1.1.4/doc-rnd/gpmi/packages/XREF =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/XREF (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/XREF (nonexistent) @@ -1,85 +0,0 @@ -event ACTE_action ../packages/actions_ref.html#ACTE_action -event ACTE_gui_init ../packages/actions_ref.html#ACTE_gui_init -event ACTE_unload ../packages/actions_ref.html#ACTE_unload -function action_register ../packages/actions_ref.html#action_register -function action_arg ../packages/actions_ref.html#action_arg -function action ../packages/actions_ref.html#action -function create_menu ../packages/actions_ref.html#create_menu -enum dialog_fileselect_e ../packages/dialogs_ref.html#dialog_fileselect_e -function dialog_log ../packages/dialogs_ref.html#dialog_log -function dialog_confirm ../packages/dialogs_ref.html#dialog_confirm -function dialog_report ../packages/dialogs_ref.html#dialog_report -function dialog_prompt ../packages/dialogs_ref.html#dialog_prompt -function dialog_fileselect ../packages/dialogs_ref.html#dialog_fileselect -function dialog_beep ../packages/dialogs_ref.html#dialog_beep -function dialog_progress ../packages/dialogs_ref.html#dialog_progress -function dialog_attribute ../packages/dialogs_ref.html#dialog_attribute -enum hid_attr_type_e ../packages/hid_ref.html#hid_attr_type_e -enum EndCapStyle_e ../packages/hid_ref.html#EndCapStyle_e -event HIDE_get_export_options ../packages/hid_ref.html#HIDE_get_export_options -event HIDE_do_export_start ../packages/hid_ref.html#HIDE_do_export_start -event HIDE_do_export_finish ../packages/hid_ref.html#HIDE_do_export_finish -event HIDE_set_layer ../packages/hid_ref.html#HIDE_set_layer -event HIDE_set_color ../packages/hid_ref.html#HIDE_set_color -event HIDE_set_line_cap ../packages/hid_ref.html#HIDE_set_line_cap -event HIDE_set_line_width ../packages/hid_ref.html#HIDE_set_line_width -event HIDE_set_draw_xor ../packages/hid_ref.html#HIDE_set_draw_xor -event HIDE_set_draw_faded ../packages/hid_ref.html#HIDE_set_draw_faded -event HIDE_draw_line ../packages/hid_ref.html#HIDE_draw_line -event HIDE_draw_arc ../packages/hid_ref.html#HIDE_draw_arc -event HIDE_draw_rect ../packages/hid_ref.html#HIDE_draw_rect -event HIDE_fill_circle ../packages/hid_ref.html#HIDE_fill_circle -event HIDE_fill_polygon ../packages/hid_ref.html#HIDE_fill_polygon -event HIDE_fill_rect ../packages/hid_ref.html#HIDE_fill_rect -event HIDE_use_mask ../packages/hid_ref.html#HIDE_use_mask -event HIDE_make_gc ../packages/hid_ref.html#HIDE_make_gc -event HIDE_destroy_gc ../packages/hid_ref.html#HIDE_destroy_gc -event HIDE_fill_pcb_pv ../packages/hid_ref.html#HIDE_fill_pcb_pv -event HIDE_fill_pcb_pad ../packages/hid_ref.html#HIDE_fill_pcb_pad -function hid_create ../packages/hid_ref.html#hid_create -function hid_add_attribute ../packages/hid_ref.html#hid_add_attribute -function hid_get_attribute ../packages/hid_ref.html#hid_get_attribute -function hid_register ../packages/hid_ref.html#hid_register -function hid_gpmi_data_set ../packages/hid_ref.html#hid_gpmi_data_set -function hid_gpmi_data_get ../packages/hid_ref.html#hid_gpmi_data_get -function hid_string2val ../packages/hid_ref.html#hid_string2val -enum layout_object_mask_e ../packages/layout_ref.html#layout_object_mask_e -enum layout_object_coord_e ../packages/layout_ref.html#layout_object_coord_e -enum layout_flag_e ../packages/layout_ref.html#layout_flag_e -enum layer_field_e ../packages/layout_ref.html#layer_field_e -function layout_search_box ../packages/layout_ref.html#layout_search_box -function layout_search_selected ../packages/layout_ref.html#layout_search_selected -function layout_search_found ../packages/layout_ref.html#layout_search_found -function layout_search_get ../packages/layout_ref.html#layout_search_get -function layout_search_free ../packages/layout_ref.html#layout_search_free -function layout_obj_coord ../packages/layout_ref.html#layout_obj_coord -function layout_obj_type ../packages/layout_ref.html#layout_obj_type -function layout_obj_move ../packages/layout_ref.html#layout_obj_move -function layout_arc_angles ../packages/layout_ref.html#layout_arc_angles -function layout_create_line ../packages/layout_ref.html#layout_create_line -function layout_create_via ../packages/layout_ref.html#layout_create_via -function layout_create_arc ../packages/layout_ref.html#layout_create_arc -function layout_switch_to_layer ../packages/layout_ref.html#layout_switch_to_layer -function layout_get_current_layer ../packages/layout_ref.html#layout_get_current_layer -function layout_resolve_layer ../packages/layout_ref.html#layout_resolve_layer -function layout_get_max_possible_layer ../packages/layout_ref.html#layout_get_max_possible_layer -function layout_get_max_copper_layer ../packages/layout_ref.html#layout_get_max_copper_layer -function layout_get_max_layer ../packages/layout_ref.html#layout_get_max_layer -function layout_layer_name ../packages/layout_ref.html#layout_layer_name -function layout_layer_color ../packages/layout_ref.html#layout_layer_color -function layout_layer_field ../packages/layout_ref.html#layout_layer_field -function layout_get_page_width ../packages/layout_ref.html#layout_get_page_width -function layout_get_page_height ../packages/layout_ref.html#layout_get_page_height -function layout_set_page_size ../packages/layout_ref.html#layout_set_page_size -function mil2pcb_multiplier ../packages/layout_ref.html#mil2pcb_multiplier -function mm2pcb_multiplier ../packages/layout_ref.html#mm2pcb_multiplier -function current_grid_unit ../packages/layout_ref.html#current_grid_unit -function debug_draw_request ../packages/layout_ref.html#debug_draw_request -function debug_draw_flush ../packages/layout_ref.html#debug_draw_flush -function debug_draw_finish ../packages/layout_ref.html#debug_draw_finish -function debug_draw_dctx ../packages/layout_ref.html#debug_draw_dctx -function draw_set_color ../packages/layout_ref.html#draw_set_color -function draw_set_line_width ../packages/layout_ref.html#draw_set_line_width -function draw_set_draw_xor ../packages/layout_ref.html#draw_set_draw_xor -function draw_set_draw_faded ../packages/layout_ref.html#draw_set_draw_faded -function draw_line ../packages/layout_ref.html#draw_line Index: 1.1.4/doc-rnd/gpmi/packages/dialogs.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/dialogs.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/dialogs.html (nonexistent) @@ -1,47 +0,0 @@ - - -

    dialogs package

    - The purpose of this package is to expose the dialog box handling interface - of the active GUI hid. Using this package scripts can pop up dialog boxes - to inform or ask the user. If there is no active GUI, call logs are dumped - on stderr. Note: message arguments usually may contain newline (\n) characters - to split the message. - -

    Common conventions

    - Dialog boxes are blocking calls to the GUI HID: when the script - calls a dialog box, the script is suspended until the dialog box - is closed by the user. In other words, dialog boxes behave - as regular function calls from the scripts: when they return, - the dialog is over and the result is known. -

    - The only exception is dialog_progress(), which opens or - updates or closes the already open progress dialog box, and - returns immediately (even when the box is left open). - -

    Simple dialogs vs. custom dialogs

    - Most of the calls will pop up a static dialog box. Static means - that widgets are predefined by the GUI HID. The script - is free to fill in data, but can not change the basic structure of - the dialog box. For example dialog_confirm(), dialog_prompt(), - dialog_fileselect() are static. -

    - When the script needs a custom, dynamic dialog box, it needs to - create an attribute dialog. The script sets up a HID - structure using the hid package, builds up all the input fields - then calls dialog_attribute() with the hid. - -

    Progress dialogs

    - - The script should call dialog_progress() periodicly from a process that - runs time consuming calculations and check the return value and break - the loop on cancel. The process should have an idea of how long it - will take. This is passed on in argument total. As long as - argument so_far is less than total, the dialog is - open. -

    - After the process has finished, a call with so_far=total+1 should be - made to make sure the window is closed. If the call returns non-zero, - the process should be cancelled. - - - Index: 1.1.4/doc-rnd/gpmi/packages/hid.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/hid.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/hid.html (nonexistent) @@ -1,76 +0,0 @@ - - -

    hid package

    - -The hid package has two purposes: -
      -
    • it is glue layer for exporter dialog boxes and attribute dialog boxes; -
    • it can register exporter HIDs in PCB -
    - -

    Building a custom dialog box

    -First hid_create() needs to be called. It returns a new hid_t, which is -an opaq structure for the package that is used to describe attributes of -an attribute dialog or an exporter hid. Attributes are added using -hid_add_attribute(), which returns an unique ID of the attribute. The -attribute ID can be used later for querying attribute value set by the -user using hid_get_attribute(). -

    -The process of building a dialog box is closed by a call to -

      -
    • hid_register(), which registers a new exporter hid using the - attributes of the dialog box; or -
    • dialog_attribute() (of the dialog package) which pops up a custom - dialog box immediately. -
    - -

    Registering an exporter

    - Function hid_register() registers the hid as an exporter. Should be - called after all attributes have been added using hid_add_atrtibute(). - The export is coordinated by pcb core; when the user request an export - using the exporter, a series of events are delivered to the script: -
      -
    1. envelope events to set up exporting -
    2. many draw events to actually export the objects -
    3. an envelope event to finish exporting -
    - -

    Envelope: events generated before or after exporting

    -
      -
    • HIDE_get_export_options(void *hid): Generated before get_exporter_options returns the option list to the GUI hid -
    • HIDE_do_export_start(void *hid): Generated before export redraw starts -
    • HIDE_do_export_finish(void *hid): Generated after export redraw finihsed -
    - -

    Drawing: events generated during exporting

    - Note: there may be multiple gcs (graphic contexts), each having its own color, line - properties, xor drawing and faded state. Graphic contexts are created - and destroyed by the following events: -
      -
    • HIDE_make_gc(void *hid, void *gc); -
    • HIDE_destroy_gc(void *hid, void *gc); -
    - - Gc properties are changed by the following events: -
      -
    • HIDE_set_layer(void *hid, const char *name, int group); -
    • HIDE_set_color(void *hid, void *gc, const char *name); -
    • HIDE_set_line_cap(void *hid, void *gc, EndCapStyle style); -
    • HIDE_set_line_width(void *hid, void *gc, int width); -
    • HIDE_set_draw_xor(void *hid, void *gc, int xor); -
    • HIDE_set_draw_faded(void *hid, void *gc, int faded); -
    - - Finally, the actual drawing operations: -
      -
    • HIDE_draw_line(void *hid, void *gc, int x1, int y1, int x2, int y2); -
    • HIDE_draw_arc(void *hid, void *gc, int cx, int cy, int xradius, int yradius, int start_angle, int delta_angle); -
    • HIDE_draw_rect(void *hid, void *gc, int x1, int y1, int x2, int y2); -
    • HIDE_fill_circle(void *hid, void *gc, int cx, int cy, int radius); -
    • HIDE_fill_polygon(void *hid, void *gc, int n_coords, int *x, int *y); -
    • HIDE_fill_rect(void *hid, void *gc, int x1, int y1, int x2, int y2); -
    • HIDE_use_mask(void *hid, int use_it); [TODO] -
    - - - Index: 1.1.4/doc-rnd/gpmi/packages/layout_ref.html =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/layout_ref.html (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/layout_ref.html (nonexistent) @@ -1,305 +0,0 @@ - - -

    PCB GPMI

    -

    Reference manual for package layout

    -Automatically generated from layout.h - -

    Enums

    -
    -

    Enum values should be passed on as strings. - -

    layout_object_mask_e

    -
    - Object type search mask bits 
    -
    - -
    value meaning -
    OM_LINE lines (traces, silk lines, not font) -
    OM_TEXT text written using the font -
    OM_POLYGON polygons, including rectangles -
    OM_ARC arcs, circles -
    OM_VIA vias and holes which are not part of a footprint -
    OM_PIN pins/pads of a footprint -
    OM_ANY shorthand for "find anything" -
    -
    -

    layout_object_coord_e

    -
    - Which coordinate of the object is referenced 
    -
    - -
    value meaning -
    OC_BX1 bounding box X1 -
    OC_BX2 bounding box X2 -
    OC_BY1 bounding box Y1 -
    OC_BY2 bounding box Y2 -
    OC_P1X point 1 X -
    OC_P2X point 2 X -
    OC_P1Y point 1 Y -
    OC_P2Y point 2 Y -
    OC_OBJ the whole object -
    OC_P1 point 1 is P1X -
    OC_P2 point 2 is P2X -
    -
    -

    layout_flag_e

    -
    - of layout_object_coord_t 
    -
    - -
    value meaning -
    FL_NONE <comment missing in the header> -
    FL_SHOWNUMBER <comment missing in the header> -
    FL_LOCALREF <comment missing in the header> -
    FL_CHECKPLANS <comment missing in the header> -
    FL_SHOWDRC <comment missing in the header> -
    FL_RUBBERBAND <comment missing in the header> -
    FL_DESCRIPTION <comment missing in the header> -
    FL_NAMEONPCB <comment missing in the header> -
    FL_AUTODRC <comment missing in the header> -
    FL_ALLDIRECTION <comment missing in the header> -
    FL_SWAPSTARTDIR <comment missing in the header> -
    FL_UNIQUENAME <comment missing in the header> -
    FL_CLEARNEW <comment missing in the header> -
    FL_SNAPPIN <comment missing in the header> -
    FL_SHOWMASK <comment missing in the header> -
    FL_THINDRAW <comment missing in the header> -
    FL_ORTHOMOVE <comment missing in the header> -
    FL_LIVEROUTE <comment missing in the header> -
    FL_THINDRAWPOLY <comment missing in the header> -
    FL_LOCKNAMES <comment missing in the header> -
    FL_ONLYNAMES <comment missing in the header> -
    FL_NEWFULLPOLY <comment missing in the header> -
    FL_HIDENAMES <comment missing in the header> -
    FL_THERMALSTYLE1 <comment missing in the header> -
    FL_THERMALSTYLE2 <comment missing in the header> -
    FL_THERMALSTYLE3 <comment missing in the header> -
    FL_THERMALSTYLE4 <comment missing in the header> -
    FL_THERMALSTYLE5 <comment missing in the header> -
    -
    -

    layer_field_e

    -
    - Field name of the layer structure 
    -
    - -
    value meaning -
    LFLD_NUM_LINES number of lines on the layer -
    LFLD_NUM_TEXTS number of texts on the layer -
    LFLD_NUM_POLYS number of polygons on the layer -
    LFLD_NUM_ARCS number of arcs on the layer -
    LFLD_VISIBLE non-zero if the layer is visible -
    LFLD_NODRC non-zero if the layer doesn't use DRC -
    -
    -

    Functions

    -
    -

    The following functions are registered in script context. - -

    int layout_search_box(const char* search_ID, layout_object_mask_t obj_types, int x1, int y1, int x2, int y2)

    -
    - creates a new search and adds all objects that matches obj_types mask within the given rectangle on the current layer
    -   Arguments:
    -     search_ID: unique name of the search (overwrites existing search on the same name)
    -     obj_types: on or more object types
    -     x1, y1, x2, y2: box the search is done within (PCB coords)
    -   Returns the number of object on the search list. 
    -
    -
    -

    int layout_search_selected(const char* search_ID, layout_object_mask_t obj_types)

    -
    - creates a new search and adds all selected objects
    -   Arguments:
    -     search_ID: unique name of the search (overwrites existing search on the same name)
    -     obj_types: on or more object types
    -   Returns the number of object on the search list. 
    -
    -
    -

    int layout_search_found(const char* search_ID, layout_object_mask_t obj_types)

    -
    - creates a new search and adds all found objects (the green highlight)
    -   Arguments:
    -     search_ID: unique name of the search (overwrites existing search on the same name)
    -     obj_types: on or more object types
    -   Returns the number of object on the search list. 
    -
    -
    -

    layout_object_t* layout_search_get(const char* search_ID, int n)

    -
    - Returns the nth object from a search list (or NULL pointer if n is beyond the list) 
    -
    -
    -

    int layout_search_free(const char* search_ID)

    -
    - Frees all memory related to a search. Returns 0 on success.
    -   Argument:
    -     search_ID: unique name of the search (requires an existing search) 
    -
    -
    -

    int layout_obj_coord(layout_object_t* obj, layout_object_coord_t coord)

    -
    - Return the requested coord of an object; except for the bounding box
    -    coordinates, the meaning of coordinates are object-specific.
    -    Point 1 and point 2 are usually endpoints of the object (line, arc),
    -    "the whole object" coordinate is a central point. 
    -
    -
    -

    layout_object_mask_t layout_obj_type(layout_object_t* obj)

    -
    - Return the type of an object (always a single bit) 
    -
    -
    -

    int layout_obj_move(layout_object_t* obj, layout_object_coord_t coord, int dx, int dy)

    -
    - Change location of an object or parts of the object (like move endpoint of a line);
    -   Arguments:
    -     obj: the object
    -     coord: which coordinate to drag (e.g. move only the endpoint)
    -     dx, dy: relative x and y coordinates the selected coordinate is displaced by
    -   Returns 0 on success 
    -
    -
    -

    int layout_arc_angles(layout_object_t* obj, int relative, int start, int delta)

    -
    - change angles of an arc; start and delate are relative if relative is non-zero; returns 0 on success 
    -
    -
    -

    int layout_create_line(int x1, int y1, int x2, int y2, int thickness, int clearance, layout_flag_t flags)

    -
    - create a line 
    -
    -
    -

    int layout_create_via(int x, int y, int thickness, int clearance, int mask, int hole, const char* name, layout_flag_t flags)

    -
    - create a named via 
    -
    -
    -

    int layout_create_arc(int x, int y, int width, int height, int sa, int dir, int thickness, int clearance, layout_flag_t flags)

    -
    - create a new arc; sa is start angle, dir is delta angle 
    -
    -
    -

    void layout_switch_to_layer(int layer)

    -
    - switch to layer (further layer-specific actions will take place there) 
    -
    -
    -

    int layout_get_current_layer()

    -
    - returns the number of the current layer 
    -
    -
    -

    int layout_resolve_layer(const char* name)

    -
    - resolve layer number by name (case sensitive); returns negative number if not found 
    -
    -
    -

    int layout_get_max_possible_layer()

    -
    - return the theoretical number of layers supported by PCB 
    -
    -
    -

    int layout_get_max_copper_layer()

    -
    - return the actual number of copper layers on the current design 
    -
    -
    -

    int layout_get_max_layer()

    -
    - return the actual number of layers on the current design 
    -
    -
    -

    const char* layout_layer_name(int layer)

    -
    - return the name of a layer 
    -
    -
    -

    const char* layout_layer_color(int layer)

    -
    - return the color of a layer 
    -
    -
    -

    int layout_layer_field(int layer, layer_field_t fld)

    -
    - return an integer field of a layer 
    -
    -
    -

    int layout_get_page_width()

    -
    - query or set width and height of the drawing 
    -
    -
    -

    int layout_get_page_height()

    -
    -<comment missing in the header>
    -
    -
    -

    void layout_set_page_size(int width, int height)

    -
    -<comment missing in the header>
    -
    -
    -

    double mil2pcb_multiplier()

    -
    - -- coordinate system -- (coord.c) 
    -
    -
    -

    double mm2pcb_multiplier()

    -
    -<comment missing in the header>
    -
    -
    -

    const char* current_grid_unit()

    -
    -<comment missing in the header>
    -
    -
    -

    int debug_draw_request(void)

    -
    - Initialize debug drawing; returns 1 if worked, 0 if denied 
    -
    -
    -

    void debug_draw_flush(void)

    -
    - Flush the drawing 
    -
    -
    -

    void debug_draw_finish(dctx_t* ctx)

    -
    - Finish (close) drawing 
    -
    -
    -

    dctx_t* debug_draw_dctx(void)

    -
    - Get the draw context of debug draw 
    -
    -
    -

    void draw_set_color(dctx_t* ctx, const char* name)

    -
    - Debug draw style: set drawing color 
    -
    -
    -

    void draw_set_line_width(dctx_t* ctx, int width)

    -
    - Debug draw style: set line width 
    -
    -
    -

    void draw_set_draw_xor(dctx_t* ctx, int xor)

    -
    - Debug draw style: set whether drawing should happen in xor 
    -
    -
    -

    void draw_set_draw_faded(dctx_t* ctx, int faded)

    -
    - Debug draw style: set whether drawing should happen in faded mode  
    -
    -
    -

    void draw_line(dctx_t* ctx, int x1_, int y1_, int x2_, int y2_)

    -
    - Debug draw: draw a line using the current style settings 
    -
    -
    - - - - Index: 1.1.4/doc-rnd/gpmi/packages/Makefile =================================================================== --- 1.1.4/doc-rnd/gpmi/packages/Makefile (revision 10776) +++ 1.1.4/doc-rnd/gpmi/packages/Makefile (nonexistent) @@ -1,15 +0,0 @@ -ROOT=../../.. -GPMIDIR=$(ROOT)/src_plugins/gpmi/pcb-gpmi -ALL= actions dialogs hid layout - -all: XREF $(ALL:%=%_ref.html) - -include $(GPMIDIR)/Makefile.config - -%_ref.html REF.% : $(GPMIDIR)/gpmi_plugin/gpmi_pkg/%.h - $(ROOT)/util/genref.sh "$^" "$(ROOT)" "../packages/$*_ref.html" $(PCB_CFLAGS) >$*_ref.html - -XREF: $(ALL:%=REF.%) - cat $^ > $@ - - Index: 1.1.4/doc-rnd/README =================================================================== --- 1.1.4/doc-rnd/README (revision 10776) +++ 1.1.4/doc-rnd/README (nonexistent) @@ -1,10 +0,0 @@ -pcb-rnd "diff" documentation: this directory contains documentation -on the features that differ from the original pcb version it was forked from. - -Most notable subdirectories: - features/ details of pcb-rnd features - conf/ documentation of the configuration system - hacking/ documentation for developers - devlog/ random thoughts and articles - -Documentation of the original version can be found in ../doc-orig Index: 1.1.4/doc-rnd/logo64.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/logo64.png =================================================================== --- 1.1.4/doc-rnd/logo64.png (revision 10776) +++ 1.1.4/doc-rnd/logo64.png (nonexistent) Property changes on: 1.1.4/doc-rnd/logo64.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/Autostyle.sh =================================================================== --- 1.1.4/doc-rnd/Autostyle.sh (revision 10776) +++ 1.1.4/doc-rnd/Autostyle.sh (nonexistent) @@ -1,71 +0,0 @@ -#!/bin/sh - -autostyle() -{ - awk -v "template=$1" ' - BEGIN { - while((getline < template) > 0) { - if (parse_auto(RES, $0)) { - if (RES["action"] == "begin") - curr = RES["ID"] - else - reset_curr = 1 - } - if (curr != "") - AUTO[curr] = AUTO[curr] $0 "\n" - if (reset_curr) { - curr = "" - reset_curr = 0 - } - } - } - - function parse_auto(RES, line ,tmp) - { - if (!(line ~ ".*", "", line) - line = tolower(line) - tmp = line - sub("[ \t].*$", "", tmp) - RES["ID"] = tmp - tmp = line - sub("^[^ \t]*[ \t]*", "", tmp) - RES["action"] = tmp - return 1 - } - - { - if (parse_auto(RES, $0)) { - if (RES["action"] == "begin") - skip = 1 - else if (RES["action"] == "end") { - printf("%s", AUTO[RES["ID"]]) - skip = 0 - } - next - } - } - - (!skip) { print $0 } - - ' -} - -for html in $* -do - case $html in - Autostyle.html) ;; - *) - mv $html $html.tmp - autostyle "Autostyle.html" < $html.tmp > $html - if test $? = 0 - then - rm $html.tmp - else - echo "Failed on $html, keeping the original version." - mv $html.tmp $html - fi - esac -done Property changes on: 1.1.4/doc-rnd/Autostyle.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: 1.1.4/doc-rnd/keys_mkey.html =================================================================== --- 1.1.4/doc-rnd/keys_mkey.html (revision 10776) +++ 1.1.4/doc-rnd/keys_mkey.html (nonexistent) @@ -1,508 +0,0 @@ - -

    Key to action bindings

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    key pcb-menu-mkey.lht -
    . - 'All-direction' lines
    conf(toggle, editor/all_direction_lines, design) -
    / - Cycle Clip
    Display(CycleClip) -
    0 - Select Layer 10
    SelectLayer(10) -
    0-alt - Select Layer 20
    SelectLayer(20) -
    0-alt-ctrl - Toggle Layer 20
    ToggleView(20) -
    0-ctrl - Toggle Layer 10
    ToggleView(10) -
    1 - Select Layer 1
    SelectLayer(1) -
    1-alt - Select Layer 11
    SelectLayer(11) -
    1-alt-ctrl - Toggle Layer 11
    ToggleView(11) -
    1-ctrl - Toggle Layer 1
    ToggleView(1) -
    1-shift - Buffer/Select Buffer #1
    PasteBuffer(1) -
    2 - Select Layer 2
    SelectLayer(2) -
    2-alt - Select Layer 12
    SelectLayer(12) -
    2-alt-ctrl - Toggle Layer 12
    ToggleView(12) -
    2-ctrl - Toggle Layer 2
    ToggleView(2) -
    2-shift - Buffer/Select Buffer #2
    PasteBuffer(2) -
    3 - Select Layer 3
    SelectLayer(3) -
    3-alt - Select Layer 13
    SelectLayer(13) -
    3-alt-ctrl - Toggle Layer 13
    ToggleView(13) -
    3-ctrl - Toggle Layer 3
    ToggleView(3) -
    3-shift - Buffer/Select Buffer #3
    PasteBuffer(3) -
    4 - Select Layer 4
    SelectLayer(4) -
    4-alt - Select Layer 14
    SelectLayer(14) -
    4-alt-ctrl - Toggle Layer 14
    ToggleView(14) -
    4-ctrl - Toggle Layer 4
    ToggleView(4) -
    4-shift - Buffer/Select Buffer #4
    PasteBuffer(4) -
    5 - Select Layer 5
    SelectLayer(5) -
    5-alt - Select Layer 15
    SelectLayer(15) -
    5-alt-ctrl - Toggle Layer 15
    ToggleView(15) -
    5-ctrl - Toggle Layer 5
    ToggleView(5) -
    5-shift - Buffer/Select Buffer #5
    PasteBuffer(5) -
    6 - Select Layer 6
    SelectLayer(6) -
    6-alt - Select Layer 16
    SelectLayer(16) -
    6-alt-ctrl - Toggle Layer 16
    ToggleView(16) -
    6-ctrl - Toggle Layer 6
    ToggleView(6) -
    7 - Select Layer 7
    SelectLayer(7) -
    7-alt - Select Layer 17
    SelectLayer(17) -
    7-alt-ctrl - Toggle Layer 17
    ToggleView(17) -
    7-ctrl - Toggle Layer 7
    ToggleView(7) -
    8 - Select Layer 8
    SelectLayer(8) -
    8-alt - Select Layer 18
    SelectLayer(18) -
    8-alt-ctrl - Toggle Layer 18
    ToggleView(18) -
    8-ctrl - Toggle Layer 8
    ToggleView(8) -
    9 - Select Layer 9
    SelectLayer(9) -
    9-alt - Select Layer 19
    SelectLayer(19) -
    9-alt-ctrl - Toggle Layer 19
    ToggleView(19) -
    9-ctrl - Toggle Layer 9
    ToggleView(9) -
    : - Command Entry
    Command() -
    = - Simple optimization
    djopt(simple) -
    =-shift - Auto-Optimize
    djopt(auto) -
    [ - Grid -5mil
    SetValue(Grid,-5,mil) -
    \ - Full screen
    fullscreen(toggle) -
    ] - Grid +5mil
    SetValue(Grid,+5,mil) -
    a-alt - Select all visible
    Select(All) -
    a-alt-shift - Unselect all
    Unselect(All) -
    a
     c -
    Library
    DoWindows(Library) -
    b - Flip Object
    Flip(Object) -
    b-alt-ctrl - netlist patch for back annotation
    SavePatch() -
    b-shift - Move selected elements to other side
    Flip(SelectedElements) -
    backspace - Remove Selected
    RemoveSelected() -
    backspace-shift - Remove Connected
    Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block) -
    c - Center cursor
    Center() -
    c-ctrl
      -
    Copy selection to buffer
    GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Unselect(All); Mode(PasteBuffer) -
    d - Pins/Via show Name/Number
    Display(PinOrPadName) -
    d-shift - Pinout
    Display(Pinout) -
    delete - Remove
    Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore) -
    delete-shift - Remove selected objects
    RemoveSelected() -
    down - Step Down
    Cursor(Warp,0,-1,grid) -
    down-shift - Step +Down
    Cursor(Pan,0,-50,view) -
    e-shift - Erase selected rats
    DeleteRats(SelectedRats) -
    e
     c -
    Copy selection to buffer
    GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Unselect(All); Mode(PasteBuffer) -
    e
     d -
    Remove
    Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore) -
    e
     i -
    Buffer/Mirror buffer (up/down)
    Mode(PasteBuffer); PasteBuffer(Mirror) -
    e
     r -
    Rotate buffer 90 deg CCW
    -
    e
     r-shift -
    Redo last undone operation
    Redo() -
    e
     u-shift -
    Undo last operation
    Undo() -
    e
     x -
    text on layout
    ChangeName(Object) -
    enter - Click
    Mode(Notify); Mode(Release) -
    f-alt-shift - Replace footprint
    ReplaceFootprint() -
    f-ctrl - Lookup connection to object
    GetXY(Click on the object); Connection(Find) -
    f-shift - Reset all connections
    Connection(Reset); Display(Redraw) -
    f
     a -
    Save Layout As...
    Save(LayoutAs) -
    f
     c -
    Quit Program
    Quit() -
    f
     i -
    Export layout...
    Export() -
    f
     n -
    Start New Layout
    New() -
    f
     o -
    Load layout
    Load(Layout) -
    f
     p -
    Print layout...
    Print() -
    f
     r -
    Revert
    Load(Revert,none) -
    f
     s -
    Save Layout
    Save(Layout) -
    g - Grid +5mil
    SetValue(Grid,+5,mil) -
    g-ctrl - Grid +0.05mm
    SetValue(Grid,+0.05,mm) -
    g-ctrl-shift - Grid -0.05mm
    SetValue(Grid,-0.05,mm) -
    g-shift - Grid -5mil
    SetValue(Grid,-5,mil) -
    h-ctrl - ChangeHole Object
    ChangeHole(Object) -
    h-shift - ToggleHideName SelectedElement
    ToggleHideName(SelectedElements) -
    h
     a -
    About...
    About() -
    j - ChangeJoin Object
    ChangeJoin(Object) -
    j-shift - ChangeJoin SelectedObject
    ChangeJoin(SelectedObjects) -
    k - Clear Object +2 mil
    ChangeClearSize(Object,+2,mil) -
    k-ctrl - Clear Selected +2 mil
    ChangeClearSize(SelectedObjects,+2,mil) -
    k-ctrl-shift - Clear Selected -2 mil
    ChangeClearSize(SelectedObjects,-2,mil) -
    k-shift - Clear Object -2 mil
    ChangeClearSize(Object,-2,mil) -
    l - Line Tool size +5 mil
    SetValue(LineSize,+5,mil) -
    l-shift - Line Tool size -5 mil
    SetValue(LineSize,-5,mil) -
    left - Step Left
    Cursor(Warp,-1,0,grid) -
    left-shift - Step +Left
    Cursor(Pan,-50,0,view) -
    m - Move Object to current layer
    MoveToCurrentLayer(Object) -
    m-ctrl - MarkCrosshair
    MarkCrosshair() -
    m-shift - Move selected to current layer
    MoveToCurrentLayer(Selected) -
    n - text on layout
    ChangeName(Object) -
    n-alt - Nonetlist
    ChangeNonetlist(Element) -
    n-ctrl - Start New Layout
    New() -
    n-ctrl-shift - pin on layout
    ChangeName(Object, Number) -
    n-shift - Select shortest rat
    AddRats(Close) -
    o - Optimize rats nest
    Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block) -
    o-ctrl - ChangeOctagon Object
    ChangeOctagon(Object) -
    o-shift - AddRats to selected pins
    Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(SelectedRats); Atomic(Block) -
    p - Polygon PreviousPoint
    Polygon(PreviousPoint) -
    p-alt - Manage plugins...
    ManagePlugins() -
    p-ctrl - Auto-place selected elements
    AutoPlaceSelected() -
    p-ctrl-shift - Thin draw poly
    conf(toggle, editor/thin_draw_poly, design) -
    p-shift - Polygon Close
    Polygon(Close) -
    q - ChangeSquare Object
    ChangeSquare(ToggleObject) -
    q-ctrl - Quit Program
    Quit() -
    r-alt - Auto-route selected rats
    AutoRoute(SelectedRats) -
    r-ctrl - Generate object report
    ReportObject() -
    r-shift - Redo last undone operation
    Redo() -
    right - Step Right
    Cursor(Warp,1,0,grid) -
    right-shift - Step +Right
    Cursor(Pan,50,0,view) -
    s - ChangeSize +5 mil
    ChangeSize(Object,+5,mil) -
    s-alt - ChangeDrill +5 mil
    ChangeDrillSize(Object,+5,mil) -
    s-alt-shift - ChangeDrill -5 mil
    ChangeDrillSize(Object,-5,mil) -
    s-ctrl - Save Layout
    Save(Layout) -
    s-ctrl-shift - Save Layout As...
    Save(LayoutAs) -
    s-shift - ChangeSize -5 mil
    ChangeSize(Object,-5,mil) -
    space - Arrow Mode
    Mode(Arrow) -
    t - Text Tool scale +10 mil
    SetValue(TextScale,+10,mil) -
    t-shift - Text Tool scale -10 mil
    SetValue(TextScale,-10,mil) -
    tab - Flip up/down
    SwapSides(V) -
    tab-ctrl - Spin 180 degrees
    SwapSides(R) -
    tab-ctrl-shift - Swap Sides
    SwapSides() -
    tab-shift - Flip left/right
    SwapSides(H) -
    u - Undo last operation
    Undo() -
    u-ctrl-shift - Clear undo-buffer
    Undo(ClearList) -
    up - Step Up
    Cursor(Warp,0,1,grid) -
    up-shift - Step +Up
    Cursor(Pan,0,50,view) -
    v-alt - Via Tool drill +5 mil
    SetValue(ViaDrillingHole,+5,mil) -
    v-alt-shift - Via Tool drill -5 mil
    SetValue(ViaDrillingHole,-5,mil) -
    v-ctrl - Paste buffer to layout
    Mode(PasteBuffer) -
    v-ctrl-shift - Via Tool size -5 mil
    SetValue(ViaSize,-5,mil) -
    v-shift - Via Tool size +5 mil
    SetValue(ViaSize,+5,mil) -
    v
     e -
    Zoom Max
    Zoom() -
    v
     f -
    Zoom Max
    Zoom() -
    v
     i -
    Zoom In 2X
    Zoom(-2) -
    v
     o -
    Zoom Out 2X
    Zoom(+2) -
    w - Add All Rats
    AddRats(AllRats) -
    w-shift - AddRats Selected
    AddRats(SelectedRats) -
    x - Cycle object being dragged
    CycleDrag() -
    x-ctrl - Cut selection to buffer
    GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer) -
    x-shift - Swap nets on two selected pins
    net(swap) -
    y - Puller
    Puller() -
    y-ctrl - Redo last undone operation
    Redo() -
    y-shift - ChangeSizes to Route style
    ChangeSizes(Object,style,mil) -
    z - Zoom In 20%
    Zoom(-1.2) -
    z-ctrl - Undo last operation
    Undo() -
    z-shift - Zoom Out 20%
    Zoom(+1.2) -
    | - Thin draw
    conf(toggle, editor/thin_draw, design) -
    - - Index: 1.1.4/doc-rnd/gsch2pcb-rnd.htm =================================================================== --- 1.1.4/doc-rnd/gsch2pcb-rnd.htm (revision 10776) +++ 1.1.4/doc-rnd/gsch2pcb-rnd.htm (nonexistent) @@ -1,49 +0,0 @@ - - - pcb-rnd user manual - - -

    pcb-rnd - user manual

    - -

    2. Utilities

    -

    -

    2.1. gsch2pcb-rnd

    -

    -Gsch2pcb-rnd is a standalone utility that can extract netlists and -element data from a schematics produced by gschem. Thus it is a glue -between gschem and pcb-rnd, doing forward annotation. It is ideal -for automating the design process as it can be easily called from -Makefiles, shell scripts or other programs/scripts, whereas the -"import schematics" feautre (import_sch plugin) is more geared for the -GUI user. -

    -Multiple methods of operation are offered - the user can select -one of these by name, using the -m command line argument (e.g. -gsch2pcb-rnd -m importsep foo.sch): - - - - - -
    method name - description -
    pcb - The classic approach: load the existing extract elements from - the .sch file, load the .pcb file, compare element lists, load - footprint libraries and create .new.pcb and .net and .cmd and let - the user handle the rest. Does not work with anything else - than the .pcb format. This method is deprecated and is - provided only for compatibility with some old workflows. -
    import - Runs the same gnetlist backend as the import_sch plugin. A single - action command file generated with .cmd suffix. When executed - (using action ExcuteFile(foo.cmd)), it syncs (replaces/creates) - every element and sets up all nets. Pro: single-command import. - Con: can't load netlist only or elements only. -
    importsep - Similar to import, but produces two files: a .cmd file with element - updates only (can be appled the same way as import's) and a - separate .net netlist file that can be imported the same way as the - .net of the pcb method. Pro: the user can update elements-only or - nets-only. Con: requires two user actions to get a full impoty. -
    Index: 1.1.4/doc-rnd/TODO =================================================================== --- 1.1.4/doc-rnd/TODO (revision 10776) +++ 1.1.4/doc-rnd/TODO (nonexistent) @@ -1,154 +0,0 @@ -- BUGS - ? all route styles deleted when using 'File>load layout data to paste buffer' - + in the 45-deg line mode, while DRC enforce settings toggled 'on' can cause isolated trace crossing, violating DRC - - save as: change format, save as again: it sets back the format to default but the file name is wrong [report:Erich] - -- Lihata persistent save: - - flag compatibility: save unknown, string-flags as loaded by io_pcb - - ind: space in ha:layer name - - ind: symbol height is not in-line on the output - - ind: indentation bug in via and netlists - - ind: indentation bug in inline struct therm: closing } is preceded by indentation whitespace for some reason - - keep numeric format: test all - - keep unknown subtrees - -- replace settings with lihata (conf_*) - - TEST: - - vendor drill mapping (all functionality, including regex based refdes ignore) - - route style in gtk and lesstif, save, load, 0, 1 or a lot of styles - - route style vs. autorouter - -- query & advanced search - - search expr wizard should pick up the expression from the button when clicked - - field accessors: - - pad area - - pin area - - line (and pad) length and length^2 - - make a run on alarge board, speed test, with -O0 and -O3: - - iteration speed (a simple @) - - eval speed (a simple @ with a lot of constants in an expr) - - geo speed - - regex and string cmp match speed vs. select by name - -CLEANUP #5 -- save/load bugs: - - gtk load dialog extension filter should reflect known formats - - when changing format in the save dialog, the file extension is not modified - - there should be an "auto" or "guess by extension" option in the save dialog format -- convert PCBChanged into an event (and provide a core action for compatibility) -- rework the gpmi plugin to make it more standard in regard of the build system and to remove a few directories -- dir rename trunk/pcblib/tru-hole should handle make correctly and not walk on existing web services or user installs -- grid status line label doesn't update when using setvalue(grid,delta) add another hook to update this value [miloh] -- Erich's select undo bug: place an element, select, save & load, unselect, undo 2 times: bad serial -- Erich's gtk lag report: press 's' a lot then move the mouse - 's' ends up in the new loc! -- conf: throw an error if user config can not be written -- the TAB bug: (over ssh -X) press tab for a good 15 seconds; release; it won't work again for a fraction of a second -- mark bug - ortho shouldn't use it, it should use last point (crosshair.X2); make sure nothing else abuses it [James] -- conf: - - remove CFN_INCREMENTS, test if saving increments from preferences works - - config pov: change prio - - gtk preferences: check what takes 131 megs of VIRT ram (on top); destroy the dialog structures when closed - - gtk preferences: poly isle area widget missing from the sizes tab - - debug why default layer names from the user config are ignored - - fp_fs_search: kill anything that gets ':' separated string as path list, get a config list instead - - switch the lesstif HID over from attribs to conf - - remove redundancy: don't store values in the PCB struct that are in the design conf - - increments are not really implemented - - if font file is not found: - - embedded version? - - warn when try to write text on pcb? -- action bug: gui_act.c shouldn't reference Crosshair.X directly; check d-fix.patch about how to fix it -- next_gui: keep them open, hide -- look for #warnings -- fix librarychanged: disable update of gedasymbols on-start, make it an explicit refresh button -- libstroke: zoom -- cleanup/rewrite resources: - - load/swap menus (TODO#1) - - gpmi: - - hid: hid_destroy (pair of hid_create) - - cleanup on unload: remove menus -- check whether local copy of gts is needed, bisect when toporouter broke -- check gpmi when pcb-rnd is fully linstalled - broken symlinks? -- multi-key: display state on the gui -- implement loglevels and log style tags in the lesstif HID -- TODO#3: works only on US keyboard -- gsch2pcb: generalize plugin/buildin loading for external tools, check if gsch2pcb can work from plugins - -CLEANUP #6: -- lihata board format: - - pads should be polygons (0 long line can't be rotated!) -- layer groups from config (e.g. CLI) is ignored -- res: - - search for vendor in the hid plugins, there should be no trace of it (vendor should register its in submenus with anchors) - - re-add dynamic menus after a gui change: - - either remember dynamic menus in a separate list so they can be rebuilt - - or provide hooks and let plugins deal with it - - gpmi: auto-remove menus by cookie (TODO#2) - - load new res on the fly (replace the menu system): - - low level reload code (re-add the dynamic menus too!) - - action to reload if file name is known - - gui load dialog with tags listed -- decide about exporter policy: - - png exports selection (even in not-as-shown), others don't - - extend png hid attribs with a flag for this, maybe do the same for others - - document the decision in "hacking" -- reduce - - export_bom: rewrite the string list code using htsp and/or lists - - hash in hid_attrib.c? - - nelma and gcode both invent .png name locally - - get rid of gcode/lists.h, and vector.[ch] (autorouter) - - vendordrill - - search for /units, replace it with pcb-printf something - - add round down - - replace ignore_refdes, ignore_value and ignore_descr with genvector - - mods: - - gpmi (and other buildins/plugins) not showing up in the about box -- self contained - - files - - default font - - action (--show-paths!) and dialog box to print where the actual files are coming from - - project specific menus from extra lihata files - maybe from project.lht -- main.c: - - SIGPIPE - detect it (needed for popen) - -CLEANUP #7: the big object split -- remove pcb_obj_type_t from const.h - use obj_any.h instead - - - - -FEATURES -- BUILD: menuconfig and a config file for scconfig - -Low prio: -- scconfig: check if it picks up settings from env vars (for a gentoo build) -- replace mkdtemp() with something safer -- display net names on pins, vias (and maybe tracks?) when zoomed in enough -- DRC should warn for thin poly hair -- rotate shaped vias don't rotate the shape (is via rotated at all?) -- new examples - - blinking led with parametric footprints - - example of nonetlist: 1206 jumpers and logos -- decide what to do with old doc - texi doesn't seem to work at all -- rethink/rewrite the action/change infrastructure - too many void *ptr1 - pointers, too many code duplication -- double sided board, poly on both layers; grab existing lines on one layer and - move then around. If all layers are visible, redraw of the far side layer - is slow and causes flickering elements from that layer until the front is - redrawn. Maybe we should have less flushes? -- gpmi: - - dialog: attribute dialog: mini parser from text - - fix debug draw in the gtk hid - - ACTE_action(): coords should not be int but Coord - - get timers to work -- dmalloc: #include from the bottom from each file. Is this a good idea?! -- win32 port {large} - - clean up central Makefile.in rules: - - remove cat, sed, grep where possible, use scconfig instead -- arc bug: draw an arc with one end out of the drawing area; it will be jumpy and can not be placed properly - -> AttachForCopy() calls SetCrosshairRange() that then sets corsshair max* which - limits the arc to move freely. Problem: this is not arc-specific, this happens with any buffer copy! going for no-design-limit is probably better -- while drawing a line, the temporary outline should reflect the layer color -- push&shove - - keep 45-deg knee when grabbing a point for drag&drop in non-all-dir -- examine current handling of long options [miloh] Index: 1.1.4/doc-rnd/index.html =================================================================== --- 1.1.4/doc-rnd/index.html (revision 10776) +++ 1.1.4/doc-rnd/index.html (nonexistent) @@ -1,123 +0,0 @@ - - - pcb-rnd - main - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -
    - - -
    -

    Summary

    - -
    -
    pcb-rnd
    -
    - is a flexible, modular Printed Circuit Board editor -

    historically is a fork of PCB -

    is an informal part of the geda project -

    features a lot of small and large improvements and bugfixes - - -

    Version Control svn://repo.hu/pcb-rnd/trunk -
    Download source releases -
    Comments, feedback, patches live chat with the developer
    or mail to: pcb-rnd (at) igor2.repo.hu
    Mailing list: pcb-rnd (at) list.repo.hu (send a mail with subject: subscribe) -
    Contribution and support - How to join or contribute -
    We are looking for help. -
    Do you have a feature request? - -
    Key features - editor for multilayer Printed Circuit Boards -
    scriptable in 10+ different scripting languages -
    parametric footprint generation, web footprints -
    modular code with a flexible plugin system -
    fits well in a UNIXy workflow -
    supports CLI and server applications -
    active development, frequent releases -
    friendly and efficient developer and user community -
    predictable development cycles - -
    Suported platforms - Linux desktop (various distributions, from source) -
    Mac OS X -
    Arch Linux (user package) - -
    IRIX 5.3 -
    (Likely: any 90's UNIX system with motif) -
    Screen resolution as small as 800x600 -
    GUI options: motif/lesstif, gtk -
    -
    - - -
    - - - -

    What is -rnd?

    -
    - -
    RaNDom - When it started, it used to be a random collection of small fixes and improvements. We got much further than that by now. -
    - -

    - - - -
    RespoNsive Developers - Developers try to respond on user needs, adding features that are actually needed by current users. -
    - -

    - - -
    - Response Not Delayed - Bugrepots, user requests and patches submitted are answered ASAP. There are no patches bitrotting for months. There are no forgotten bugreports. -
    - -

    - - - -
    Research
    &
    Development
    -
    -
    - Rázós,
    Nehéz
    Döntések
    (Brave, hard decisions) -
    There is a constant experimentation with new features and directions. We are willing to try strange/unusual ideas without risking the stability of the daily workflow. -
    - -

    - - - -
    Rants
    Now
    Dissipating
    -
    Instead of talking and ranting a lot about what could work better, we just sit down and make it work better. -
    - -

    - - - -
    Rather
    Nicely
    Decentralized
    -
    Slim, generic core; most of the code organized in replacable plugins. Most plugins depend only on the core. -
    - - - Index: 1.1.4/doc-rnd/logo128.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/logo128.png =================================================================== --- 1.1.4/doc-rnd/logo128.png (revision 10776) +++ 1.1.4/doc-rnd/logo128.png (nonexistent) Property changes on: 1.1.4/doc-rnd/logo128.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/keys.html =================================================================== --- 1.1.4/doc-rnd/keys.html (revision 10776) +++ 1.1.4/doc-rnd/keys.html (nonexistent) @@ -1,684 +0,0 @@ - -

    Key to action bindings

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    key pcb-menu-lesstif.lht pcb-menu-gtk.lht -
    . - 'All-direction' lines
    conf(toggle, editor/all_direction_lines, design) -
    'All-direction' lines
    conf(toggle, editor/all_direction_lines, design) -
    / - Cycle Clip
    Display(CycleClip) -
    Cycle Clip
    Display(CycleClip) -
    0 - Select Layer 10
    SelectLayer(10) -
    Select Layer 10
    SelectLayer(10) -
    0-alt - Select Layer 20
    SelectLayer(20) -
    Select Layer 20
    SelectLayer(20) -
    0-alt-ctrl - Toggle Layer 20
    ToggleView(20) -
    Toggle Layer 20
    ToggleView(20) -
    0-ctrl - Toggle Layer 10
    ToggleView(10) -
    Toggle Layer 10
    ToggleView(10) -
    1 - Select Layer 1
    SelectLayer(1) -
    Select Layer 1
    SelectLayer(1) -
    1-alt - Select Layer 11
    SelectLayer(11) -
    Select Layer 11
    SelectLayer(11) -
    1-alt-ctrl - Toggle Layer 11
    ToggleView(11) -
    Toggle Layer 11
    ToggleView(11) -
    1-ctrl - Toggle Layer 1
    ToggleView(1) -
    Toggle Layer 1
    ToggleView(1) -
    1-shift - #1
    PasteBuffer(1) -
    Select Buffer #1
    PasteBuffer(1) -
    2 - Select Layer 2
    SelectLayer(2) -
    Select Layer 2
    SelectLayer(2) -
    2-alt - Select Layer 12
    SelectLayer(12) -
    Select Layer 12
    SelectLayer(12) -
    2-alt-ctrl - Toggle Layer 12
    ToggleView(12) -
    Toggle Layer 12
    ToggleView(12) -
    2-ctrl - Toggle Layer 2
    ToggleView(2) -
    Toggle Layer 2
    ToggleView(2) -
    2-shift - #2
    PasteBuffer(2) -
    Select Buffer #2
    PasteBuffer(2) -
    3 - Select Layer 3
    SelectLayer(3) -
    Select Layer 3
    SelectLayer(3) -
    3-alt - Select Layer 13
    SelectLayer(13) -
    Select Layer 13
    SelectLayer(13) -
    3-alt-ctrl - Toggle Layer 13
    ToggleView(13) -
    Toggle Layer 13
    ToggleView(13) -
    3-ctrl - Toggle Layer 3
    ToggleView(3) -
    Toggle Layer 3
    ToggleView(3) -
    3-shift - #3
    PasteBuffer(3) -
    Select Buffer #3
    PasteBuffer(3) -
    4 - Select Layer 4
    SelectLayer(4) -
    Select Layer 4
    SelectLayer(4) -
    4-alt - Select Layer 14
    SelectLayer(14) -
    Select Layer 14
    SelectLayer(14) -
    4-alt-ctrl - Toggle Layer 14
    ToggleView(14) -
    Toggle Layer 14
    ToggleView(14) -
    4-ctrl - Toggle Layer 4
    ToggleView(4) -
    Toggle Layer 4
    ToggleView(4) -
    4-shift - #4
    PasteBuffer(4) -
    Select Buffer #4
    PasteBuffer(4) -
    5 - Select Layer 5
    SelectLayer(5) -
    Select Layer 5
    SelectLayer(5) -
    5-alt - Select Layer 15
    SelectLayer(15) -
    Select Layer 15
    SelectLayer(15) -
    5-alt-ctrl - Toggle Layer 15
    ToggleView(15) -
    Toggle Layer 15
    ToggleView(15) -
    5-ctrl - Toggle Layer 5
    ToggleView(5) -
    Toggle Layer 5
    ToggleView(5) -
    5-shift - #5
    PasteBuffer(5) -
    Select Buffer #5
    PasteBuffer(5) -
    6 - Select Layer 6
    SelectLayer(6) -
    Select Layer 6
    SelectLayer(6) -
    6-alt - Select Layer 16
    SelectLayer(16) -
    Select Layer 16
    SelectLayer(16) -
    6-alt-ctrl - Toggle Layer 16
    ToggleView(16) -
    Toggle Layer 16
    ToggleView(16) -
    6-ctrl - Toggle Layer 6
    ToggleView(6) -
    Toggle Layer 6
    ToggleView(6) -
    7 - Select Layer 7
    SelectLayer(7) -
    Select Layer 7
    SelectLayer(7) -
    7-alt - Select Layer 17
    SelectLayer(17) -
    Select Layer 17
    SelectLayer(17) -
    7-alt-ctrl - Toggle Layer 17
    ToggleView(17) -
    Toggle Layer 17
    ToggleView(17) -
    7-ctrl - Toggle Layer 7
    ToggleView(7) -
    Toggle Layer 7
    ToggleView(7) -
    8 - Select Layer 8
    SelectLayer(8) -
    Select Layer 8
    SelectLayer(8) -
    8-alt - Select Layer 18
    SelectLayer(18) -
    Select Layer 18
    SelectLayer(18) -
    8-alt-ctrl - Toggle Layer 18
    ToggleView(18) -
    Toggle Layer 18
    ToggleView(18) -
    8-ctrl - Toggle Layer 8
    ToggleView(8) -
    Toggle Layer 8
    ToggleView(8) -
    9 - Select Layer 9
    SelectLayer(9) -
    Select Layer 9
    SelectLayer(9) -
    9-alt - Select Layer 19
    SelectLayer(19) -
    Select Layer 19
    SelectLayer(19) -
    9-alt-ctrl - Toggle Layer 19
    ToggleView(19) -
    Toggle Layer 19
    ToggleView(19) -
    9-ctrl - Toggle Layer 9
    ToggleView(9) -
    Toggle Layer 9
    ToggleView(9) -
    : - Command
    Command() -
    Command Entry
    Command() -
    = - SimpleOpts
    djopt(simple) -
    Simple optimization
    djopt(simple) -
    =-shift - Auto-Optimize
    djopt(auto) -
    Auto-Optimize
    djopt(auto) -
    [ - Temp Arrow ON
    Mode(Save); Mode(Arrow); Mode(Notify) -
    Temp Arrow ON
    Mode(Save); Mode(Arrow); Mode(Notify) -
    \ -   - Full screen
    fullscreen(toggle) -
    ] - Temp Arrow OFF
    Mode(Release); Mode(Restore) -
    Temp Arrow OFF
    Mode(Release); Mode(Restore) -
    ` - Zoom Toggle
    Zoom(Toggle) -
      -
    a - Set Same
    SetSame() -
    Set Same
    SetSame() -
    a-alt - Select all visible
    Select(All) -
    Select all visible
    Select(All) -
    a-alt-shift - Unselect all
    Unselect(All) -
    Unselect all
    Unselect(All) -
    b - Flip Object
    Flip(Object) -
    Flip Object
    Flip(Object) -
    b-alt-ctrl -   - netlist patch for back annotation
    SavePatch() -
    b-shift - Move selected elements to other side
    Flip(SelectedElements) -
    Move selected elements to other side
    Flip(SelectedElements) -
    backspace - Remove
    Delete(Selected) -
    Remove Selected
    RemoveSelected() -
    backspace-shift - Remove Connected
    Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block) -
    Remove Connected
    Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block) -
    c - Center cursor
    Center() -
    Center cursor
    Center() -
    c-ctrl - Copy selection to buffer
    GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Mode(PasteBuffer) -
    Copy selection to buffer
    GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Unselect(All); Mode(PasteBuffer) -
    d - Pins/Via show Name/Number
    Display(PinOrPadName) -
    Pins/Via show Name/Number
    Display(PinOrPadName) -
    d-shift - Pinout
    Display(Pinout) -
    Error: key prefix collision -
    Pinout
    Display(Pinout) -
    delete - Delete selected objects
    Delete(Selected) -
    Remove
    Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore) -
    delete-shift - Remove Connected
    Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block) -
    Remove selected objects
    RemoveSelected() -
    down - Step Down
    Cursor(Warp,0,-1,grid) -
    Step Down
    Cursor(Warp,0,-1,grid) -
    down-shift - Step +Down
    Cursor(Pan,0,-50,view) -
    Step +Down
    Cursor(Pan,0,-50,view) -
    e - Erase rats-nest
    DeleteRats(AllRats) -
    Erase rats nest
    DeleteRats(AllRats) -
    e-ctrl -   - Edit properties of selected...
    PropEdit(Selected) -
    e-shift - Erase selected rats
    DeleteRats(SelectedRats) -
    Erase selected rats
    DeleteRats(SelectedRats) -
    enter - "Click"
    Mode(Notify); Mode(Release) -
    Click
    Mode(Notify); Mode(Release) -
    escape - Cancel
    Mode(Cancel) -
    Cancel
    Mode(Escape) -
    f - Find Connections
    Connection(Reset); Connection(Find) -
    Find Connections
    Connection(Reset); Connection(Find) -
    f-alt-shift -   - Replace footprint
    ReplaceFootprint() -
    f-ctrl - Lookup connection to object
    GetXY(Click on the object); Connection(Find) -
    Lookup connection to object
    GetXY(Click on the object); Connection(Find) -
    f-shift - Reset all connections
    Connection(Reset); Display(Redraw) -
    Reset all connections
    Connection(Reset); Display(Redraw) -
    f1 - Via
    Mode(Via) -
    Via
    Mode(Via) -
    f10 - Thermal
    Mode(Thermal) -
    Thermal
    Mode(Thermal) -
    f11 - Arrow
    Mode(Arrow) -
    Arrow
    Mode(Arrow) -
    f12 - Lock
    Mode(Lock) -
    Lock
    Mode(Lock) -
    f2 - Line
    Mode(Line) -
    Line
    Mode(Line) -
    f3 - Arc
    Mode(Arc) -
    Arc
    Mode(Arc) -
    f4 - Text
    Mode(Text) -
    Text
    Mode(Text) -
    f5 - Rectangle
    Mode(Rectangle) -
    Rectangle
    Mode(Rectangle) -
    f6 - Polygon
    Mode(Polygon) -
    Polygon
    Mode(Polygon) -
    f7 - Buffer
    Mode(PasteBuffer) -
    Buffer
    Mode(PasteBuffer) -
    f7-shift - Rotate buffer 90 deg CCW
    Mode(PasteBuffer); PasteBuffer(Rotate,1) -
    Rotate buffer 90 deg CCW
    Mode(PasteBuffer); PasteBuffer(Rotate,1) -
    f8 - Remove
    Mode(Remove) -
    Remove
    Mode(Remove) -
    f9 - Rotate
    Mode(Rotate) -
    Rotate
    Mode(Rotate) -
    g - Grid +5mil
    SetValue(Grid,+5,mil) -
    Grid +5mil
    SetValue(Grid,+5,mil) -
    g-ctrl - Grid +0.05mm
    SetValue(Grid,+0.05,mm) -
    Grid +0.05mm
    SetValue(Grid,+0.05,mm) -
    g-ctrl-shift - Grid -0.05mm
    SetValue(Grid,-0.05,mm) -
    Grid -0.05mm
    SetValue(Grid,-0.05,mm) -
    g-shift - Grid -5mil
    SetValue(Grid,-5,mil) -
    Grid -5mil
    SetValue(Grid,-5,mil) -
    h - ToggleHideName Object
    ToggleHideName(Object) -
    ToggleHideName Object
    ToggleHideName(Object) -
    h-ctrl - ChangeHole Object
    ChangeHole(Object) -
    ChangeHole Object
    ChangeHole(Object) -
    h-shift - ToggleHideName SelectedElement
    ToggleHideName(SelectedElements) -
    ToggleHideName SelectedElement
    ToggleHideName(SelectedElements) -
    i -   - Library
    DoWindows(Library) -
    insert - Insert Point
    Mode(InsertPoint) -
    Insert Point
    Mode(InsertPoint) -
    j - ChangeJoin Object
    ChangeJoin(Object) -
    ChangeJoin Object
    ChangeJoin(Object) -
    j-shift - ChangeJoin SelectedObject
    ChangeJoin(SelectedObjects) -
    ChangeJoin SelectedObject
    ChangeJoin(SelectedObjects) -
    k - Clear Object +2 mil
    ChangeClearSize(Object,+2,mil) -
    Clear Object +2 mil
    ChangeClearSize(Object,+2,mil) -
    k-ctrl - Clear Selected +2 mil
    ChangeClearSize(SelectedObjects,+2,mil) -
    Clear Selected +2 mil
    ChangeClearSize(SelectedObjects,+2,mil) -
    k-ctrl-shift - Clear Selected -2 mil
    ChangeClearSize(SelectedObjects,-2,mil) -
    Clear Selected -2 mil
    ChangeClearSize(SelectedObjects,-2,mil) -
    k-shift - Clear Object -2 mil
    ChangeClearSize(Object,-2,mil) -
    Clear Object -2 mil
    ChangeClearSize(Object,-2,mil) -
    l - Line Tool size +5 mil
    SetValue(LineSize,+5,mil) -
    Line Tool size +5 mil
    SetValue(LineSize,+5,mil) -
    l-shift - Line Tool size -5 mil
    SetValue(LineSize,-5,mil) -
    Line Tool size -5 mil
    SetValue(LineSize,-5,mil) -
    left - Step Left
    Cursor(Warp,-1,0,grid) -
    Step Left
    Cursor(Warp,-1,0,grid) -
    left-shift - Step +Left
    Cursor(Pan,-50,0,view) -
    Step +Left
    Cursor(Pan,-50,0,view) -
    m - Move Object to current layer
    MoveToCurrentLayer(Object) -
    Move Object to current layer
    MoveToCurrentLayer(Object) -
    m-ctrl - MarkCrosshair
    MarkCrosshair() -
    MarkCrosshair
    MarkCrosshair() -
    m-shift - Move selected to current layer
    MoveToCurrentLayer(Selected) -
    Move selected to current layer
    MoveToCurrentLayer(Selected) -
    n - Change text on layout
    ChangeName(Object) -
    text on layout
    ChangeName(Object) -
    n-alt -   - Nonetlist
    ChangeNonetlist(Element) -
    n-ctrl - Start new layout
    New() -
    Start New Layout
    New() -
    n-ctrl-shift - Change text on layout
    ChangeName(Object, Number) -
    pin on layout
    ChangeName(Object, Number) -
    n-shift - Select shortest rat
    AddRats(Close) -
    Select shortest rat
    AddRats(Close) -
    o - Optimize rats-nest
    Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block) -
    Optimize rats nest
    Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block) -
    o-ctrl - ChangeOctagon Object
    ChangeOctagon(Object) -
    ChangeOctagon Object
    ChangeOctagon(Object) -
    o-shift - AddRats to selected pins
    Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(SelectedRats); Atomic(Block) -
    AddRats to selected pins
    Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(SelectedRats); Atomic(Block) -
    p - Polygon PreviousPoint
    Polygon(PreviousPoint) -
    Polygon PreviousPoint
    Polygon(PreviousPoint) -
    p-alt - Manage plugins...
    ManagePlugins() -
    Manage plugins...
    ManagePlugins() -
    p-ctrl - Auto-place selected elements
    AutoPlaceSelected() -
    Auto-place selected elements
    AutoPlaceSelected() -
    p-ctrl-shift - Thin draw poly
    conf(toggle, editor/thin_draw_poly, design) -
    Thin draw poly
    conf(toggle, editor/thin_draw_poly, design) -
    p-shift - Polygon Close
    Polygon(Close) -
    Polygon Close
    Polygon(Close) -
    q - ChangeSquare Object
    ChangeSquare(Object) -
    ChangeSquare Object
    ChangeSquare(ToggleObject) -
    q-ctrl - Quit Program
    Quit() -
    Quit Program
    Quit() -
    r - Report net length
    Report(NetLength) -
      -
    r-alt - Auto-route selected rats
    AutoRoute(SelectedRats) -
    Auto-route selected rats
    AutoRoute(SelectedRats) -
    r-ctrl - Generate object report
    ReportObject() -
    Generate object report
    ReportObject() -
    r-shift - Redo last undone operation
    Redo() -
    Redo last undone operation
    Redo() -
    right - Step Right
    Cursor(Warp,1,0,grid) -
    Step Right
    Cursor(Warp,1,0,grid) -
    right-shift - Step +Right
    Cursor(Pan,50,0,view) -
    Step +Right
    Cursor(Pan,50,0,view) -
    s - ChangeSize +5 mil
    ChangeSize(Object,+5,mil) -
    ChangeSize +5 mil
    ChangeSize(Object,+5,mil) -
    s-alt - ChangeDrill +5 mil
    ChangeDrillSize(Object,+5,mil) -
    ChangeDrill +5 mil
    ChangeDrillSize(Object,+5,mil) -
    s-alt-shift - ChangeDrill -5 mil
    ChangeDrillSize(Object,-5,mil) -
    ChangeDrill -5 mil
    ChangeDrillSize(Object,-5,mil) -
    s-ctrl - Save layout
    Save(Layout) -
    Save Layout
    Save(Layout) -
    s-ctrl-shift - Save layout as...
    Save(LayoutAs) -
    Save Layout As...
    Save(LayoutAs) -
    s-shift - ChangeSize -5 mil
    ChangeSize(Object,-5,mil) -
    ChangeSize -5 mil
    ChangeSize(Object,-5,mil) -
    space - Arrow
    Mode(Arrow) -
    Arrow Mode
    Mode(Arrow) -
    t - Text Tool scale +10 mil
    SetValue(TextScale,+10,mil) -
    Text Tool scale +10 mil
    SetValue(TextScale,+10,mil) -
    t-shift - Text Tool scale -10 mil
    SetValue(TextScale,-10,mil) -
    Text Tool scale -10 mil
    SetValue(TextScale,-10,mil) -
    tab - Flip up/down
    SwapSides(V) -
    Flip up/down
    SwapSides(V) -
    tab-ctrl - Spin 180°
    SwapSides(R) -
    Spin 180 degrees
    SwapSides(R) -
    tab-ctrl-shift - Swap Sides
    SwapSides() -
    Swap Sides
    SwapSides() -
    tab-shift - Flip left/right
    SwapSides(H) -
    Flip left/right
    SwapSides(H) -
    u - Undo last operation
    Undo() -
    Undo last operation
    Undo() -
    u-ctrl-shift - Clear undo-buffer
    Undo(ClearList) -
    Clear undo-buffer
    Undo(ClearList) -
    up - Step Up
    Cursor(Warp,0,1,grid) -
    Step Up
    Cursor(Warp,0,1,grid) -
    up-shift - Step +Up
    Cursor(Pan,0,50,view) -
    Step +Up
    Cursor(Pan,0,50,view) -
    v - Zoom Max
    Zoom() -
    Zoom Max
    Zoom() -
    v-alt - Via Tool drill +5 mil
    SetValue(ViaDrillingHole,+5,mil) -
    Via Tool drill +5 mil
    SetValue(ViaDrillingHole,+5,mil) -
    v-alt-shift - Via Tool drill -5 mil
    SetValue(ViaDrillingHole,-5,mil) -
    Via Tool drill -5 mil
    SetValue(ViaDrillingHole,-5,mil) -
    v-ctrl - Paste buffer to layout
    Mode(PasteBuffer) -
    Paste buffer to layout
    Mode(PasteBuffer) -
    v-ctrl-shift - Via Tool size -5 mil
    SetValue(ViaSize,-5,mil) -
    Via Tool size -5 mil
    SetValue(ViaSize,-5,mil) -
    v-shift - Via Tool size +5 mil
    SetValue(ViaSize,+5,mil) -
    Via Tool size +5 mil
    SetValue(ViaSize,+5,mil) -
    w - Add All Rats
    AddRats(AllRats) -
    Add All Rats
    AddRats(AllRats) -
    w-shift - AddRats Selected
    AddRats(SelectedRats) -
    AddRats Selected
    AddRats(SelectedRats) -
    x -   - Cycle object being dragged
    CycleDrag() -
    x-ctrl - Cut selection to buffer
    GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer) -
    Cut selection to buffer
    GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer) -
    x-shift -   - Swap nets on two selected pins
    net(swap) -
    y - Puller
    Puller() -
    Puller
    Puller() -
    y-shift - ChangeSizes to Route style
    ChangeSizes(Object,style,mil) -
    ChangeSizes to Route style
    ChangeSizes(Object,style,mil) -
    z - Zoom In 20%
    Zoom(-1.2) -
    Zoom In 20%
    Zoom(-1.2) -
    z-alt - Undo
    Undo() -
      -
    z-shift - Zoom Out 20%
    Zoom(+1.2) -
    Zoom Out 20%
    Zoom(+1.2) -
    | - Thin draw
    conf(toggle, editor/thin_draw, design) -
    Thin draw
    conf(toggle, editor/thin_draw, design) -
    -
    pcb-menu-lesstif.lht: d-shift vs. d-shift; - Index: 1.1.4/doc-rnd/features/cycdrag.html =================================================================== --- 1.1.4/doc-rnd/features/cycdrag.html (revision 10776) +++ 1.1.4/doc-rnd/features/cycdrag.html (nonexistent) @@ -1,46 +0,0 @@ - - - pcb-rnd - [cycdrag] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [cycdrag] patches

    - -A long standing misfeature of pcb (and pcb-rnd) has been that when dragging the -end of connected traces, pcb chosen one of the traces "randomly". It often -didn't pick the one the user wanted to move. The workaround was to move the -one that pcb picked and then return and move the target trace then -move the other trace back. This gets even more annoying if there are more than -two objects connected in the given point: 3 traces and a via for example. -

    -The cycdrag patch addresses this issue by defining an action that can cycle -through objects that could be dragged in the given point while the left mouse -button is pressed. This lets the user explicitly select the one object to -work on. -

    -This demo video -demonstrates how it works with three lines and a via. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -It does not work with the lesstif HID. It does not work with the rubber band -mode. - - - Index: 1.1.4/doc-rnd/features/mincut.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/mincut.png =================================================================== --- 1.1.4/doc-rnd/features/mincut.png (revision 10776) +++ 1.1.4/doc-rnd/features/mincut.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/mincut.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/nonetlist.html =================================================================== --- 1.1.4/doc-rnd/features/nonetlist.html (revision 10776) +++ 1.1.4/doc-rnd/features/nonetlist.html (nonexistent) @@ -1,71 +0,0 @@ - - - pcb-rnd - [nonetlist] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [nonetlist] patch

    - -The [nonetlist] patch adds an element flag that makes PCB ignore the marked -element when dealing with netlists. This means connecting a net to a pin of -a nonetlist element will not cause a short. The refdes of a nonetlist -part is drawn with color element-color-nonetlist (ElementColor_nonetlist -in the source; default value #777777, grey). -

    -Uses of the nonetlist feature: -

      -
    • smd jumper: Combined with the [intconn] patch, this - solves the "0-ohm 1206 jumper" problem: the element should be marked - as nonetlist, with both pins set intconn(1) - this will result in a 2 - pad element, pads internally connected, that can be part of any one network - without causing short and passing the DRC. -
    • mechanical parts that should not show up on the schematics: -
        -
      • mounting hole elements: single pin holes with silk marking the head of the screw -
      • chassis (often with mounting holes or keep-out areas) -
      • logos in footprints (no poly support in footprint - yet?) -
      • mechanical parts which do not have solderable pins (plastic spacers, extra connector shields) -
      • "spare connectors", e.g. unused/disconnected DIP sockets, pin grids, or connectors in the corner of the PCB for prototyping (dev-board style) -
      -
    -

    -Preservation: gsch2pcb-rnd leaves nonetlist elements in the PCB. -

    save/load and compatibility

    -This patch introduces a new element flag. The following example demonstrates -a 1206 jumper footprint: -
    -Element["nonetlist" "1206 jumper, 0 ohm" "" "1206" 0 0 -3150 -3150 0 100 ""]
    -(
    -	Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "square,intconn(1)"]
    -	Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "square,intconn(1)"]
    -	ElementLine[-2362 -3740 2362 -3740 800]
    -	ElementLine[-2362 3740 2362 3740 800]
    -)
    -
    -Mainline PCB will load the design ignoring internal connections and nonetlist -flag - this will cause shorts on all connected pins/pads and will break -the connection. -

    -Mainline PCB doesn't save nonetlist and elements are embedded in the file - -once the design is loaded and saved with mainline PCB, the flag is lost. -After reloading the file in pcb-rnd, the element causes the same shorts -as in mainline PCB. - -

    plans

    -No plans, the feature is complete. - - Index: 1.1.4/doc-rnd/features/square.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/square.png =================================================================== --- 1.1.4/doc-rnd/features/square.png (revision 10776) +++ 1.1.4/doc-rnd/features/square.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/square.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/unglib.html =================================================================== --- 1.1.4/doc-rnd/features/unglib.html (revision 10776) +++ 1.1.4/doc-rnd/features/unglib.html (nonexistent) @@ -1,35 +0,0 @@ - - - pcb-rnd - [unglib] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [unglib] patch

    - -Removes glib dependency from core, in favor of -minilibs to help -keeping the code small, modular -and easier to fix. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Remove glib dependency from the puller plugin. - - - Index: 1.1.4/doc-rnd/features/grid_local_16.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/grid_local_16.png =================================================================== --- 1.1.4/doc-rnd/features/grid_local_16.png (revision 10776) +++ 1.1.4/doc-rnd/features/grid_local_16.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/grid_local_16.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/onpoint.html =================================================================== --- 1.1.4/doc-rnd/features/onpoint.html (revision 10776) +++ 1.1.4/doc-rnd/features/onpoint.html (nonexistent) @@ -1,68 +0,0 @@ - - - pcb-rnd - [onpoint] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [onpoint] patches

    - -Robert Drehmel writes: -
    -When (e.g.) routing 5mm power traces on a small grid, it's not always easy to hit the
    -point where the trace ended (which is the center of the semicircle at the end of the
    -line) to start the next line.  If you have selected the line tool, finding the end of
    -the line can become guesswork as the cursor doesn't change shape like it does with the
    -select tool.
    -I want my traces to consist of lines and arcs that are perfectly connected and I want
    -to work as fast as possible.
    -
    -Attached is a small patch that
    -
    -  - makes it possible to deactivate snapping to "some sensible point along a line".
    -    (that's what a comment in the code says). This snapping algorithm gets in the way
    -    sometimes so you have to slowly go over a line to find out where it really ends,
    -    bouncing back and forth between the points of the small grid, the end of the line
    -    and these "sensible points", which is wasting time. The command is
    -    "Display(ToggleSnapOffGridLine)". It is still activated by default to avoid
    -    violating POLA.
    -
    -  - more importantly, introduces a new command called "Display(ToggleHighlightOnPoint)"
    -    that highlights all lines and arcs which have (end)points exactly on the position
    -    where the cross hair is currently snapped to. It therefore helps finding the end
    -    points of lines and arcs, but sometimes also shows redundant traces, traces that
    -    aren't perfectly connected to each other, traces that don't end directly on the
    -    center of a via but should, etc. It works with thin draw too and I tested it with
    -    gtk and lesstif.
    -
    -I use the second option mostly in conjunction with deactivating the first. Both commands
    -have been added to the menu by means of (g)pcb-menu.res.in and are available as command
    -line options as well.
    -Caveats:
    -  - The HID API expects all HIDs to make a copy of the color string when setting a color.
    -  - The function that lightens up a color could be improved.
    -  - I used it for a while, but after porting it from my local fork, it probably needs
    -    more testing.
    -
    - -

    save/load and compatibility

    -Not affected. - -

    plans

    -The feature is complete. - - - Index: 1.1.4/doc-rnd/features/library_t.html =================================================================== --- 1.1.4/doc-rnd/features/library_t.html (revision 10776) +++ 1.1.4/doc-rnd/features/library_t.html (nonexistent) @@ -1,46 +0,0 @@ - - - pcb-rnd - [library_t] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [library_t] patch

    - -The original code has a special setup for representing trees, C structures -called LibraryMenu and LibraryEntry. This system can represent only a subset -of trees: there is a root, a level consist of directories only and a next level, -each directory consist of data nodes only. This has been enough for newlib, -which strictly follows this model in the file system hierarchy. The lesstif -HID also hardwired this model in the GUI. -

    -In pcb-rnd this has been replaced with a new struct type called library_t -that can represent an arbitrary tree: directories and files within directories -down to many levels. -

    -Both the gtk and the lesstif had has been modified accordingly and can -properly display the tree. This in turn enables alternative footprint backend -implementations such as fp_wget to import -more complex libraries, e.g. the one on gedasymbols.org. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Finished, no plans. - - - Index: 1.1.4/doc-rnd/features/flagcomp.html =================================================================== --- 1.1.4/doc-rnd/features/flagcomp.html (revision 10776) +++ 1.1.4/doc-rnd/features/flagcomp.html (nonexistent) @@ -1,41 +0,0 @@ - - - pcb-rnd - [flagcomp] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [flagcomp] patch

    - -Many of the patches in this fork, and in possible future branches/forks -may introduce new pin, pad or element flags. PCB loads and saves flags -by converting the text representation to an in-memory binary format. Any -flag not understood is lost. -

    -This patch adds a linked list of string flags, filled in with the unknown -flags while loading a PCB. On save, these flags are appended to the normal -flag list. This preserves all unknown flags (but not order of flags) in -a load/save cycle. - -

    save/load and compatibility

    -This patch ensures compatibility in save/load cycles with flags introduced -by later versions of mainline PCB or different branches/forks of PCB by -not removing flags they introduced. - -

    plans

    -No plans - this feature is fully implemented. - - Index: 1.1.4/doc-rnd/features/grid_edge.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/grid_edge.png =================================================================== --- 1.1.4/doc-rnd/features/grid_edge.png (revision 10776) +++ 1.1.4/doc-rnd/features/grid_edge.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/grid_edge.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/pcblib.html =================================================================== --- 1.1.4/doc-rnd/features/pcblib.html (revision 10776) +++ 1.1.4/doc-rnd/features/pcblib.html (nonexistent) @@ -1,74 +0,0 @@ - - - pcb-rnd - [pcblib] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [pcblib] and [pcblib-param] and [fp_fs] patches

    - -
    -The footprint library shipped with mainline pcb is cluttered with -special puprose parts. I believe PCB encourages the user from -an early stage to build his own library. Thus the purpose of -the library shipped with PCB should be -to provide a minimal collection of real essential footprints ... -
      -
    • ... for the very beginning of the learning curve; -
    • ... and to be the core of the user's own library later. -
    -

    -[pcblib] is a replacement of newlib/ and lib/ and the m4 macros with -such an essential core library of static footprints ("file elements") -and easier-to-use parametric footprints. -

    -There is an online map of -the library and -an online interface to the parametric footprint generators. - -

    Design decisions

    -Parts are sorted only in a few directories: smd, tru-hole, connector and -parametric. I believe there are so many orthogonal properties of footpritns -that there's no obvious hierarchy. Also, pcblib contains much fewer footpritns -than newlib so it should be still easy to navigate. -

    -Parametric footprints are in a separate directory for now, even tho they -would fit under smd, tru-hole or connector. The reason is purely historical -and the layout may change in the future. - -

    Example

    -To the right: Footprint selection dialog on pcblib, with the smd directory -open. Note how few smd parts are there. Still, smd/ is the most crowded -subdirectory! - -

    [fp_fs]

    -As of vesion 1.0.10, the footprint list/search/load of footprints is a plugin. -The original code that handles local file system footprint libraries (e.g. -pcblib or newlib) is now a plugin. Altnerative plugins can be provided that work -from databases or from the web. In extreme -situations the file system based footprint plugin can even be disabled. - -

    save/load and compatibility

    -Not affected: elements are embedded in the PCB. - -

    plans

    -None, the feature is complete. -
                - - -
    - - Index: 1.1.4/doc-rnd/features/gpmi.html =================================================================== --- 1.1.4/doc-rnd/features/gpmi.html (revision 10776) +++ 1.1.4/doc-rnd/features/gpmi.html (nonexistent) @@ -1,59 +0,0 @@ - - - pcb-rnd - [gpmi] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [gpmi] patch

    - -Thanks to gpmi, pcb-rnd is scriptable in about 10 scripting languages (e.g. -lua, awk, ruby, python, scheme, tcl). Scripts are integrated in pcb-rnd and -have access to most of the internals. Scripts -are able to: -
    - -

    -This feature has three options: -

      -
    • disabled: not compiled at all - when gpmi is not installed (no gpmi scripting in PCB) -
    • buildin: compiled and linked in the executable - pcb-rnd always can load and run scripts -
    • plugin: compiled as a loadable plugin - pcb-rnd can load and run scripts if the plugin is installed -
    - -

    Example

    -Check out the Rosetta stone of -pcb-rnd. - -

    save/load and compatibility

    -Save/load files are not affected. - -

    plans

    -Expose more internals, write more example scripts and documentation. - - - Index: 1.1.4/doc-rnd/features/mincut.html =================================================================== --- 1.1.4/doc-rnd/features/mincut.html (revision 10776) +++ 1.1.4/doc-rnd/features/mincut.html (nonexistent) @@ -1,65 +0,0 @@ - - - pcb-rnd - [mincut] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [mincut] patch

    - -The original code was highlighting pins/pads only when a short came around -after rats nest optimization. This was not very helpful on a complex board. -There had been a long discussion on the mailing list about the best solutions. -There were a few very good ideas, including: -
      -
    • manual tagging of objects (lines, polys, arcs, vias) with net and warn - where two differently tagged net connects -
    • automatic tagging based on "where it was connected first", then the same - warning mechanism as above -
    • trace history (using the undo buffer?) and go back until when it was - not broken, check what exactly broke it -
    • history combined with tagging -
    • calculate minimal cut -
    -

    -I choose minimal cut for my patch because it doesn't require tracing the -full history or any manual administration of nets vs. objects (which I -would find inevitable even with manual tagging - directly or indirectly -the user needs to be able to change net tags). -

    -The minimal cut is the least amount of object whose removal would resolve -the short. It is best demonstrated on an example: -

    - -

    -Removing all the marked lines/polys/vias would surely resolve the short -(sometimes leaving rat lines behind). Minimal cut is better than randomly -removing objects, tho: it guarantees that the minimal amount of objects -are to be removed. On a complex board, this place is likely to be close -to the place where the problem really is - much closer than the pins/pads. -

    -Since mincut can be expensive on large boards, the feature can be enabled -per board (a new PCB flag) and can be disbaled globally (--enable-mincut 0 -when starting PCB). - -

    save/load and compatibility

    -New PCB flag enablemincut. Mainline pcb ignores this flag but does not -preserve it. - -

    plans

    -Finished, no plans. - - Index: 1.1.4/doc-rnd/features/square.pcb =================================================================== --- 1.1.4/doc-rnd/features/square.pcb (revision 10776) +++ 1.1.4/doc-rnd/features/square.pcb (nonexistent) @@ -1,893 +0,0 @@ -# release: pcb 20110918 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 130000 105000] - -Grid[2500.0 0 0 1] -Cursor[0 0 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1000 1000 1000 1000 1500 1000] -Flags("nameonpcb,uniquename,clearnew") -Groups("1,c:2,s:3:4:5:6:7:8") -Styles["Signal,1500,6000,3150,2500:Power,3000,6000,3937,2500:Fat,8000,6000,3500,2500:Skinny,1200,2402,1181,2500"] - -Symbol[' ' 1800] -( -) -Symbol['!' 1200] -( - SymbolLine[0 4500 0 5000 800] - SymbolLine[0 1000 0 3500 800] -) -Symbol['"' 1200] -( - SymbolLine[0 1000 0 2000 800] - SymbolLine[1000 1000 1000 2000 800] -) -Symbol['#' 1200] -( - SymbolLine[0 3500 2000 3500 800] - SymbolLine[0 2500 2000 2500 800] - SymbolLine[1500 2000 1500 4000 800] - SymbolLine[500 2000 500 4000 800] -) -Symbol['$' 1200] -( - SymbolLine[1500 1500 2000 2000 800] - SymbolLine[500 1500 1500 1500 800] - SymbolLine[0 2000 500 1500 800] - SymbolLine[0 2000 0 2500 800] - SymbolLine[0 2500 500 3000 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[2000 3500 2000 4000 800] - SymbolLine[1500 4500 2000 4000 800] - SymbolLine[500 4500 1500 4500 800] - SymbolLine[0 4000 500 4500 800] - SymbolLine[1000 1000 1000 5000 800] -) -Symbol['%' 1200] -( - SymbolLine[0 1500 0 2000 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1000 1000 800] - SymbolLine[1000 1000 1500 1500 800] - SymbolLine[1500 1500 1500 2000 800] - SymbolLine[1000 2500 1500 2000 800] - SymbolLine[500 2500 1000 2500 800] - SymbolLine[0 2000 500 2500 800] - SymbolLine[0 5000 4000 1000 800] - SymbolLine[3500 5000 4000 4500 800] - SymbolLine[4000 4000 4000 4500 800] - SymbolLine[3500 3500 4000 4000 800] - SymbolLine[3000 3500 3500 3500 800] - SymbolLine[2500 4000 3000 3500 800] - SymbolLine[2500 4000 2500 4500 800] - SymbolLine[2500 4500 3000 5000 800] - SymbolLine[3000 5000 3500 5000 800] -) -Symbol['&' 1200] -( - SymbolLine[0 4500 500 5000 800] - SymbolLine[0 1500 0 2500 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[0 3500 1500 2000 800] - SymbolLine[500 5000 1000 5000 800] - SymbolLine[1000 5000 2000 4000 800] - SymbolLine[0 2500 2500 5000 800] - SymbolLine[500 1000 1000 1000 800] - SymbolLine[1000 1000 1500 1500 800] - SymbolLine[1500 1500 1500 2000 800] - SymbolLine[0 3500 0 4500 800] -) -Symbol[''' 1200] -( - SymbolLine[0 2000 1000 1000 800] -) -Symbol['(' 1200] -( - SymbolLine[0 4500 500 5000 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[0 1500 0 4500 800] -) -Symbol[')' 1200] -( - SymbolLine[0 1000 500 1500 800] - SymbolLine[500 1500 500 4500 800] - SymbolLine[0 5000 500 4500 800] -) -Symbol['*' 1200] -( - SymbolLine[0 2000 2000 4000 800] - SymbolLine[0 4000 2000 2000 800] - SymbolLine[0 3000 2000 3000 800] - SymbolLine[1000 2000 1000 4000 800] -) -Symbol['+' 1200] -( - SymbolLine[0 3000 2000 3000 800] - SymbolLine[1000 2000 1000 4000 800] -) -Symbol[',' 1200] -( - SymbolLine[0 6000 1000 5000 800] -) -Symbol['-' 1200] -( - SymbolLine[0 3000 2000 3000 800] -) -Symbol['.' 1200] -( - SymbolLine[0 5000 500 5000 800] -) -Symbol['/' 1200] -( - SymbolLine[0 4500 3000 1500 800] -) -Symbol['0' 1200] -( - SymbolLine[0 4500 500 5000 800] - SymbolLine[0 1500 0 4500 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[2000 1500 2000 4500 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[0 4000 2000 2000 800] -) -Symbol['1' 1200] -( - SymbolLine[0 1800 800 1000 800] - SymbolLine[800 1000 800 5000 800] - SymbolLine[0 5000 1500 5000 800] -) -Symbol['2' 1200] -( - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 2000 1000 800] - SymbolLine[2000 1000 2500 1500 800] - SymbolLine[2500 1500 2500 2500 800] - SymbolLine[0 5000 2500 2500 800] - SymbolLine[0 5000 2500 5000 800] -) -Symbol['3' 1200] -( - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 2800 1500 2800 800] - SymbolLine[2000 1500 2000 2300 800] - SymbolLine[2000 3300 2000 4500 800] - SymbolLine[2000 3300 1500 2800 800] - SymbolLine[2000 2300 1500 2800 800] -) -Symbol['4' 1200] -( - SymbolLine[0 3500 2000 1000 800] - SymbolLine[0 3500 2500 3500 800] - SymbolLine[2000 1000 2000 5000 800] -) -Symbol['5' 1200] -( - SymbolLine[0 1000 2000 1000 800] - SymbolLine[0 1000 0 3000 800] - SymbolLine[0 3000 500 2500 800] - SymbolLine[500 2500 1500 2500 800] - SymbolLine[1500 2500 2000 3000 800] - SymbolLine[2000 3000 2000 4500 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[0 4500 500 5000 800] -) -Symbol['6' 1200] -( - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[0 1500 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[1500 2800 2000 3300 800] - SymbolLine[0 2800 1500 2800 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[2000 3300 2000 4500 800] -) -Symbol['7' 1200] -( - SymbolLine[500 5000 2500 1000 800] - SymbolLine[0 1000 2500 1000 800] -) -Symbol['8' 1200] -( - SymbolLine[0 4500 500 5000 800] - SymbolLine[0 3700 0 4500 800] - SymbolLine[0 3700 700 3000 800] - SymbolLine[700 3000 1300 3000 800] - SymbolLine[1300 3000 2000 3700 800] - SymbolLine[2000 3700 2000 4500 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[0 2300 700 3000 800] - SymbolLine[0 1500 0 2300 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[2000 1500 2000 2300 800] - SymbolLine[1300 3000 2000 2300 800] -) -Symbol['9' 1200] -( - SymbolLine[500 5000 2000 3000 800] - SymbolLine[2000 1500 2000 3000 800] - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[0 1500 0 2500 800] - SymbolLine[0 2500 500 3000 800] - SymbolLine[500 3000 2000 3000 800] -) -Symbol[':' 1200] -( - SymbolLine[0 2500 500 2500 800] - SymbolLine[0 3500 500 3500 800] -) -Symbol[';' 1200] -( - SymbolLine[0 5000 1000 4000 800] - SymbolLine[1000 2500 1000 3000 800] -) -Symbol['<' 1200] -( - SymbolLine[0 3000 1000 2000 800] - SymbolLine[0 3000 1000 4000 800] -) -Symbol['=' 1200] -( - SymbolLine[0 2500 2000 2500 800] - SymbolLine[0 3500 2000 3500 800] -) -Symbol['>' 1200] -( - SymbolLine[0 2000 1000 3000 800] - SymbolLine[0 4000 1000 3000 800] -) -Symbol['?' 1200] -( - SymbolLine[1000 3000 1000 3500 800] - SymbolLine[1000 4500 1000 5000 800] - SymbolLine[0 1500 0 2000 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[2000 1500 2000 2000 800] - SymbolLine[1000 3000 2000 2000 800] -) -Symbol['@' 1200] -( - SymbolLine[0 1000 0 4000 800] - SymbolLine[0 4000 1000 5000 800] - SymbolLine[1000 5000 4000 5000 800] - SymbolLine[5000 3500 5000 1000 800] - SymbolLine[5000 1000 4000 0 800] - SymbolLine[4000 0 1000 0 800] - SymbolLine[1000 0 0 1000 800] - SymbolLine[1500 2000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[2000 3500 3000 3500 800] - SymbolLine[3000 3500 3500 3000 800] - SymbolLine[3500 3000 4000 3500 800] - SymbolLine[3500 3000 3500 1500 800] - SymbolLine[3500 2000 3000 1500 800] - SymbolLine[2000 1500 3000 1500 800] - SymbolLine[2000 1500 1500 2000 800] - SymbolLine[4000 3500 5000 3500 800] -) -Symbol['A' 1200] -( - SymbolLine[0 2000 0 5000 800] - SymbolLine[0 2000 700 1000 800] - SymbolLine[700 1000 1800 1000 800] - SymbolLine[1800 1000 2500 2000 800] - SymbolLine[2500 2000 2500 5000 800] - SymbolLine[0 3000 2500 3000 800] -) -Symbol['B' 1200] -( - SymbolLine[0 5000 2000 5000 800] - SymbolLine[2000 5000 2500 4500 800] - SymbolLine[2500 3300 2500 4500 800] - SymbolLine[2000 2800 2500 3300 800] - SymbolLine[500 2800 2000 2800 800] - SymbolLine[500 1000 500 5000 800] - SymbolLine[0 1000 2000 1000 800] - SymbolLine[2000 1000 2500 1500 800] - SymbolLine[2500 1500 2500 2300 800] - SymbolLine[2000 2800 2500 2300 800] -) -Symbol['C' 1200] -( - SymbolLine[700 5000 2000 5000 800] - SymbolLine[0 4300 700 5000 800] - SymbolLine[0 1700 0 4300 800] - SymbolLine[0 1700 700 1000 800] - SymbolLine[700 1000 2000 1000 800] -) -Symbol['D' 1200] -( - SymbolLine[500 1000 500 5000 800] - SymbolLine[1800 1000 2500 1700 800] - SymbolLine[2500 1700 2500 4300 800] - SymbolLine[1800 5000 2500 4300 800] - SymbolLine[0 5000 1800 5000 800] - SymbolLine[0 1000 1800 1000 800] -) -Symbol['E' 1200] -( - SymbolLine[0 2800 1500 2800 800] - SymbolLine[0 5000 2000 5000 800] - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 1000 2000 1000 800] -) -Symbol['F' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 1000 2000 1000 800] - SymbolLine[0 2800 1500 2800 800] -) -Symbol['G' 1200] -( - SymbolLine[2000 1000 2500 1500 800] - SymbolLine[500 1000 2000 1000 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[0 1500 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 2000 5000 800] - SymbolLine[2000 5000 2500 4500 800] - SymbolLine[2500 3500 2500 4500 800] - SymbolLine[2000 3000 2500 3500 800] - SymbolLine[1000 3000 2000 3000 800] -) -Symbol['H' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[2500 1000 2500 5000 800] - SymbolLine[0 3000 2500 3000 800] -) -Symbol['I' 1200] -( - SymbolLine[0 1000 1000 1000 800] - SymbolLine[500 1000 500 5000 800] - SymbolLine[0 5000 1000 5000 800] -) -Symbol['J' 1200] -( - SymbolLine[700 1000 1500 1000 800] - SymbolLine[1500 1000 1500 4500 800] - SymbolLine[1000 5000 1500 4500 800] - SymbolLine[500 5000 1000 5000 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[0 4500 0 4000 800] -) -Symbol['K' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 3000 2000 1000 800] - SymbolLine[0 3000 2000 5000 800] -) -Symbol['L' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 5000 2000 5000 800] -) -Symbol['M' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 1000 1500 3000 800] - SymbolLine[1500 3000 3000 1000 800] - SymbolLine[3000 1000 3000 5000 800] -) -Symbol['N' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 1000 2500 5000 800] - SymbolLine[2500 1000 2500 5000 800] -) -Symbol['O' 1200] -( - SymbolLine[0 1500 0 4500 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[2000 1500 2000 4500 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[0 4500 500 5000 800] -) -Symbol['P' 1200] -( - SymbolLine[500 1000 500 5000 800] - SymbolLine[0 1000 2000 1000 800] - SymbolLine[2000 1000 2500 1500 800] - SymbolLine[2500 1500 2500 2500 800] - SymbolLine[2000 3000 2500 2500 800] - SymbolLine[500 3000 2000 3000 800] -) -Symbol['Q' 1200] -( - SymbolLine[0 1500 0 4500 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1500 1000 800] - SymbolLine[1500 1000 2000 1500 800] - SymbolLine[2000 1500 2000 4000 800] - SymbolLine[1000 5000 2000 4000 800] - SymbolLine[500 5000 1000 5000 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[1000 3500 2000 5000 800] -) -Symbol['R' 1200] -( - SymbolLine[0 1000 2000 1000 800] - SymbolLine[2000 1000 2500 1500 800] - SymbolLine[2500 1500 2500 2500 800] - SymbolLine[2000 3000 2500 2500 800] - SymbolLine[500 3000 2000 3000 800] - SymbolLine[500 1000 500 5000 800] - SymbolLine[1300 3000 2500 5000 800] -) -Symbol['S' 1200] -( - SymbolLine[2000 1000 2500 1500 800] - SymbolLine[500 1000 2000 1000 800] - SymbolLine[0 1500 500 1000 800] - SymbolLine[0 1500 0 2500 800] - SymbolLine[0 2500 500 3000 800] - SymbolLine[500 3000 2000 3000 800] - SymbolLine[2000 3000 2500 3500 800] - SymbolLine[2500 3500 2500 4500 800] - SymbolLine[2000 5000 2500 4500 800] - SymbolLine[500 5000 2000 5000 800] - SymbolLine[0 4500 500 5000 800] -) -Symbol['T' 1200] -( - SymbolLine[0 1000 2000 1000 800] - SymbolLine[1000 1000 1000 5000 800] -) -Symbol['U' 1200] -( - SymbolLine[0 1000 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[2000 1000 2000 4500 800] -) -Symbol['V' 1200] -( - SymbolLine[0 1000 1000 5000 800] - SymbolLine[1000 5000 2000 1000 800] -) -Symbol['W' 1200] -( - SymbolLine[0 1000 0 3000 800] - SymbolLine[0 3000 500 5000 800] - SymbolLine[500 5000 1500 3000 800] - SymbolLine[1500 3000 2500 5000 800] - SymbolLine[2500 5000 3000 3000 800] - SymbolLine[3000 3000 3000 1000 800] -) -Symbol['X' 1200] -( - SymbolLine[0 5000 2500 1000 800] - SymbolLine[0 1000 2500 5000 800] -) -Symbol['Y' 1200] -( - SymbolLine[0 1000 1000 3000 800] - SymbolLine[1000 3000 2000 1000 800] - SymbolLine[1000 3000 1000 5000 800] -) -Symbol['Z' 1200] -( - SymbolLine[0 1000 2500 1000 800] - SymbolLine[0 5000 2500 1000 800] - SymbolLine[0 5000 2500 5000 800] -) -Symbol['[' 1200] -( - SymbolLine[0 1000 500 1000 800] - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 5000 500 5000 800] -) -Symbol['\' 1200] -( - SymbolLine[0 1500 3000 4500 800] -) -Symbol[']' 1200] -( - SymbolLine[0 1000 500 1000 800] - SymbolLine[500 1000 500 5000 800] - SymbolLine[0 5000 500 5000 800] -) -Symbol['^' 1200] -( - SymbolLine[0 1500 500 1000 800] - SymbolLine[500 1000 1000 1500 800] -) -Symbol['_' 1200] -( - SymbolLine[0 5000 2000 5000 800] -) -Symbol['a' 1200] -( - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[0 3500 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[2000 3000 2000 4500 800] - SymbolLine[2000 4500 2500 5000 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] -) -Symbol['b' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[2000 3500 2000 4500 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[0 3500 500 3000 800] -) -Symbol['c' 1200] -( - SymbolLine[500 3000 2000 3000 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[0 3500 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 2000 5000 800] -) -Symbol['d' 1200] -( - SymbolLine[2000 1000 2000 5000 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[0 3500 0 4500 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] -) -Symbol['e' 1200] -( - SymbolLine[500 5000 2000 5000 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[0 3500 0 4500 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[0 4000 2000 4000 800] - SymbolLine[2000 4000 2000 3500 800] -) -Symbol['f' 1000] -( - SymbolLine[500 1500 500 5000 800] - SymbolLine[500 1500 1000 1000 800] - SymbolLine[1000 1000 1500 1000 800] - SymbolLine[0 3000 1000 3000 800] -) -Symbol['g' 1200] -( - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[0 3500 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[0 6000 500 6500 800] - SymbolLine[500 6500 1500 6500 800] - SymbolLine[1500 6500 2000 6000 800] - SymbolLine[2000 3000 2000 6000 800] -) -Symbol['h' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[2000 3500 2000 5000 800] -) -Symbol['i' 1000] -( - SymbolLine[0 2000 0 2100 1000] - SymbolLine[0 3500 0 5000 800] -) -Symbol['j' 1000] -( - SymbolLine[500 2000 500 2100 1000] - SymbolLine[500 3500 500 6000 800] - SymbolLine[0 6500 500 6000 800] -) -Symbol['k' 1200] -( - SymbolLine[0 1000 0 5000 800] - SymbolLine[0 3500 1500 5000 800] - SymbolLine[0 3500 1000 2500 800] -) -Symbol['l' 1000] -( - SymbolLine[0 1000 0 4500 800] - SymbolLine[0 4500 500 5000 800] -) -Symbol['m' 1200] -( - SymbolLine[500 3500 500 5000 800] - SymbolLine[500 3500 1000 3000 800] - SymbolLine[1000 3000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[2000 3500 2000 5000 800] - SymbolLine[2000 3500 2500 3000 800] - SymbolLine[2500 3000 3000 3000 800] - SymbolLine[3000 3000 3500 3500 800] - SymbolLine[3500 3500 3500 5000 800] - SymbolLine[0 3000 500 3500 800] -) -Symbol['n' 1200] -( - SymbolLine[500 3500 500 5000 800] - SymbolLine[500 3500 1000 3000 800] - SymbolLine[1000 3000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[2000 3500 2000 5000 800] - SymbolLine[0 3000 500 3500 800] -) -Symbol['o' 1200] -( - SymbolLine[0 3500 0 4500 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[2000 3500 2000 4500 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[0 4500 500 5000 800] -) -Symbol['p' 1200] -( - SymbolLine[500 3500 500 6500 800] - SymbolLine[0 3000 500 3500 800] - SymbolLine[500 3500 1000 3000 800] - SymbolLine[1000 3000 2000 3000 800] - SymbolLine[2000 3000 2500 3500 800] - SymbolLine[2500 3500 2500 4500 800] - SymbolLine[2000 5000 2500 4500 800] - SymbolLine[1000 5000 2000 5000 800] - SymbolLine[500 4500 1000 5000 800] -) -Symbol['q' 1200] -( - SymbolLine[2000 3500 2000 6500 800] - SymbolLine[1500 3000 2000 3500 800] - SymbolLine[500 3000 1500 3000 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[0 3500 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] -) -Symbol['r' 1200] -( - SymbolLine[500 3500 500 5000 800] - SymbolLine[500 3500 1000 3000 800] - SymbolLine[1000 3000 2000 3000 800] - SymbolLine[0 3000 500 3500 800] -) -Symbol['s' 1200] -( - SymbolLine[500 5000 2000 5000 800] - SymbolLine[2000 5000 2500 4500 800] - SymbolLine[2000 4000 2500 4500 800] - SymbolLine[500 4000 2000 4000 800] - SymbolLine[0 3500 500 4000 800] - SymbolLine[0 3500 500 3000 800] - SymbolLine[500 3000 2000 3000 800] - SymbolLine[2000 3000 2500 3500 800] - SymbolLine[0 4500 500 5000 800] -) -Symbol['t' 1000] -( - SymbolLine[500 1000 500 4500 800] - SymbolLine[500 4500 1000 5000 800] - SymbolLine[0 2500 1000 2500 800] -) -Symbol['u' 1200] -( - SymbolLine[0 3000 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] - SymbolLine[2000 3000 2000 4500 800] -) -Symbol['v' 1200] -( - SymbolLine[0 3000 1000 5000 800] - SymbolLine[2000 3000 1000 5000 800] -) -Symbol['w' 1200] -( - SymbolLine[0 3000 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[500 5000 1000 5000 800] - SymbolLine[1000 5000 1500 4500 800] - SymbolLine[1500 3000 1500 4500 800] - SymbolLine[1500 4500 2000 5000 800] - SymbolLine[2000 5000 2500 5000 800] - SymbolLine[2500 5000 3000 4500 800] - SymbolLine[3000 3000 3000 4500 800] -) -Symbol['x' 1200] -( - SymbolLine[0 3000 2000 5000 800] - SymbolLine[0 5000 2000 3000 800] -) -Symbol['y' 1200] -( - SymbolLine[0 3000 0 4500 800] - SymbolLine[0 4500 500 5000 800] - SymbolLine[2000 3000 2000 6000 800] - SymbolLine[1500 6500 2000 6000 800] - SymbolLine[500 6500 1500 6500 800] - SymbolLine[0 6000 500 6500 800] - SymbolLine[500 5000 1500 5000 800] - SymbolLine[1500 5000 2000 4500 800] -) -Symbol['z' 1200] -( - SymbolLine[0 3000 2000 3000 800] - SymbolLine[0 5000 2000 3000 800] - SymbolLine[0 5000 2000 5000 800] -) -Symbol['{' 1200] -( - SymbolLine[500 1500 1000 1000 800] - SymbolLine[500 1500 500 2500 800] - SymbolLine[0 3000 500 2500 800] - SymbolLine[0 3000 500 3500 800] - SymbolLine[500 3500 500 4500 800] - SymbolLine[500 4500 1000 5000 800] -) -Symbol['|' 1200] -( - SymbolLine[0 1000 0 5000 800] -) -Symbol['}' 1200] -( - SymbolLine[0 1000 500 1500 800] - SymbolLine[500 1500 500 2500 800] - SymbolLine[500 2500 1000 3000 800] - SymbolLine[500 3500 1000 3000 800] - SymbolLine[500 3500 500 4500 800] - SymbolLine[0 5000 500 4500 800] -) -Symbol['~' 1200] -( - SymbolLine[0 3500 500 3000 800] - SymbolLine[500 3000 1000 3000 800] - SymbolLine[1000 3000 1500 3500 800] - SymbolLine[1500 3500 2000 3500 800] - SymbolLine[2000 3500 2500 3000 800] -) -Attribute("PCB::grid::unit" "mil") - -Element["" "Dual in-line package, medium wide (400 mil)" "" "DIP14M" 62500 22500 22000 5000 3 100 ""] -( - Pin[0 0 6000 3000 6600 2800 "1" "1" "square"] - Pin[0 10000 6000 3000 6600 2800 "2" "2" ""] - Pin[0 20000 6000 3000 6600 2800 "3" "3" "thermal(1S)"] - Pin[0 30000 6000 3000 6600 2800 "4" "4" "square,shape(3)"] - Pin[0 40000 6000 3000 6600 2800 "5" "5" "square,shape(2)"] - Pin[0 50000 6000 3000 6600 2800 "6" "6" "square,shape(4)"] - Pin[0 60000 6000 3000 6600 2800 "7" "7" "square,shape(8)"] - Pin[40000 60000 6000 3000 6600 2800 "8" "8" "square,shape(8)"] - Pin[40000 50000 6000 3000 6600 2800 "9" "9" "square,shape(4)"] - Pin[40000 40000 6000 3000 6600 2800 "10" "10" "square,shape(2)"] - Pin[40000 30000 6000 3000 6600 2800 "11" "11" "square,shape(3)"] - Pin[40000 20000 6000 3000 6600 2800 "12" "12" ""] - Pin[40000 10000 6000 3000 6600 2800 "13" "13" ""] - Pin[40000 0 6000 3000 6600 2800 "14" "14" "square,shape(1)"] - ElementLine [-5000 -5000 -5000 65000 1000] - ElementLine [-5000 65000 45000 65000 1000] - ElementLine [45000 65000 45000 -5000 1000] - ElementLine [-5000 -5000 15000 -5000 1000] - ElementLine [25000 -5000 45000 -5000 1000] - ElementArc [20000 -5000 5000 5000 0 180 1000] - - ) -Layer(1 "component") -( -) -Layer(2 "solder") -( - Line[10000 17500 67500 17500 1500 5000 "clearline"] - Line[67500 17500 77500 27500 1500 5000 "clearline"] - Line[77500 27500 85000 27500 1500 5000 "clearline"] - Line[62500 22500 37500 22500 1500 5000 "clearline"] - Line[10000 27500 67500 27500 1500 5000 "clearline"] - Line[67500 27500 77500 37500 1500 5000 "clearline"] - Line[77500 37500 85000 37500 1500 5000 "clearline"] - Line[62500 32500 45000 32500 1500 5000 "clearline"] - Line[10000 37500 67500 37500 1500 5000 "clearline"] - Line[67500 37500 77500 47500 1500 5000 "clearline"] - Line[77500 47500 85000 47500 1500 5000 "clearline"] - Line[62500 42500 27500 42500 1500 5000 ""] - Line[10000 47500 67500 47500 1500 5000 "clearline"] - Line[67500 47500 77500 57500 1500 5000 "clearline"] - Line[77500 57500 85000 57500 1500 5000 "clearline"] - Line[62500 52500 37500 52500 1500 5000 "clearline"] - Line[37500 57500 67500 57500 1500 5000 "clearline"] - Line[67500 57500 77500 67500 1500 5000 "clearline"] - Line[77500 67500 85000 67500 1500 5000 "clearline"] - Line[62500 62500 37500 62500 1500 5000 "clearline"] - Line[37500 67500 67500 67500 1500 5000 "clearline"] - Line[67500 67500 77500 77500 1500 5000 "clearline"] - Line[77500 77500 85000 77500 1500 5000 "clearline"] - Line[62500 72500 37500 72500 1500 5000 "clearline"] - Line[37500 77500 67500 77500 1500 5000 "clearline"] - Line[67500 77500 77500 87500 1500 5000 "clearline"] - Line[77500 87500 85000 87500 1500 5000 "clearline"] - Line[62500 82500 37500 82500 1500 5000 "clearline"] - Line[65000 32500 60000 32500 6000 5000 "clearline"] - Line[105000 32500 100000 32500 6000 5000 "clearline"] - Line[102500 32500 125000 32500 1500 5000 "clearline"] - Line[102500 52500 125000 52500 1500 5000 "clearline"] - Line[102500 62500 125000 62500 1500 5000 "clearline"] - Line[102500 72500 125000 72500 1500 5000 "clearline"] - Line[102500 82500 125000 82500 1500 5000 "clearline"] - Line[102500 22500 125000 22500 1500 5000 "clearline"] - Polygon("clearpoly") - ( - [55000 37500] [70000 37500] [70000 47500] [55000 47500] - ) - Polygon("clearpoly") - ( - [85000 7500] [117500 7500] [117500 92500] [85000 92500] - ) -) -Layer(3 "GND") -( -) -Layer(4 "power") -( -) -Layer(5 "signal1") -( -) -Layer(6 "signal2") -( -) -Layer(7 "signal3") -( -) -Layer(8 "signal4") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( - Text[10000 17500 0 130 "square" "clearline"] - Text[10000 27500 0 130 "fat trace" "clearline"] - Text[10000 37500 0 130 "poly" "clearline"] - Text[25000 95000 1 130 "with [square]" "clearline"] - Text[15000 92500 1 130 "shaped pins" "clearline"] -) Index: 1.1.4/doc-rnd/features/grid_local_4.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/grid_local_4.png =================================================================== --- 1.1.4/doc-rnd/features/grid_local_4.png (revision 10776) +++ 1.1.4/doc-rnd/features/grid_local_4.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/grid_local_4.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/grid_global_sparse.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/grid_global_sparse.png =================================================================== --- 1.1.4/doc-rnd/features/grid_global_sparse.png (revision 10776) +++ 1.1.4/doc-rnd/features/grid_global_sparse.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/grid_global_sparse.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/fullscreen.html =================================================================== --- 1.1.4/doc-rnd/features/fullscreen.html (revision 10776) +++ 1.1.4/doc-rnd/features/fullscreen.html (nonexistent) @@ -1,38 +0,0 @@ - - - pcb-rnd - full screen gtk - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - full screen gtk

    -On small screen the overhead of the menu line, bottom status line and left -layer selection bar is just too expensive. Since 1.1.2, the gtk hid can -be switched between the usual setup and a so called "full screen mode" -where most widgets are hidden, leaving much more screen space to the -editor widget. There's a FullScreen() action that can set or toggle -the state and a default key binding in gtk on the backslash ('\') to -toggle it. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Make hiding various parts of the GUI configurable. No plans to implement -it for the lesstif HID. - - - Index: 1.1.4/doc-rnd/features/query.html =================================================================== --- 1.1.4/doc-rnd/features/query.html (revision 10776) +++ 1.1.4/doc-rnd/features/query.html (nonexistent) @@ -1,42 +0,0 @@ - - - pcb-rnd - [query] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - [query]

    -Pcb-rnd features a flexible query language that can list (or select or find, etc.) -objects mathcing an expression. The language handles different data types, -including lists, provides means to iterate over objects and lists, supports -the common logical and arithmetic operators. -

    -The query language is the engine behind the advanced search & select -functionality. It is also the foundation of the programmable DRC. -

    -The query language is implemented as a core plugin. -

    -TODO: more details will come later, when the specification and implementation -stabilizes. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Next stage will be a programmable DRC. - - - Index: 1.1.4/doc-rnd/features/negselect.html =================================================================== --- 1.1.4/doc-rnd/features/negselect.html (revision 10776) +++ 1.1.4/doc-rnd/features/negselect.html (nonexistent) @@ -1,41 +0,0 @@ - - - pcb-rnd - negative box select - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [cycdrag] patches, negative box select

    - -When a selection is made using drag&drop (box selection), depending -on the direction the rule for object selection differ: -
      -
    • drag from top-right towards bottom-left (positive sized box): - select objects that are fully contained in the box (original behaviour) -
    • drag from bottom-left towards top-right (negative sized box): - select objects that are even partially within the box or merely touch - the edge of the box -
    - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Work more on some rough corners of the negative direction: e.g. pads are -handled as 0 width lines so the selection has to hit the center. - - - Index: 1.1.4/doc-rnd/features/intconn1.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/intconn1.png =================================================================== --- 1.1.4/doc-rnd/features/intconn1.png (revision 10776) +++ 1.1.4/doc-rnd/features/intconn1.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/intconn1.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/intconn2.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/intconn2.png =================================================================== --- 1.1.4/doc-rnd/features/intconn2.png (revision 10776) +++ 1.1.4/doc-rnd/features/intconn2.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/intconn2.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/jumper_1206.fp =================================================================== --- 1.1.4/doc-rnd/features/jumper_1206.fp (revision 10776) +++ 1.1.4/doc-rnd/features/jumper_1206.fp (nonexistent) @@ -1,7 +0,0 @@ -Element["nonetlist" "1206 jumper, 0 ohm" "" "1206" 0 0 -3150 -3150 0 100 ""] -( - Pad[-5905 -1181 -5905 1181 5118 2000 5718 "1" "1" "square,intconn(1)"] - Pad[5905 -1181 5905 1181 5118 2000 5718 "2" "2" "square,intconn(1)"] - ElementLine[-2362 -3740 2362 -3740 800] - ElementLine[-2362 3740 2362 3740 800] -) Index: 1.1.4/doc-rnd/features/intconn3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/intconn3.png =================================================================== --- 1.1.4/doc-rnd/features/intconn3.png (revision 10776) +++ 1.1.4/doc-rnd/features/intconn3.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/intconn3.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/debian_list.html =================================================================== --- 1.1.4/doc-rnd/features/debian_list.html (revision 10776) +++ 1.1.4/doc-rnd/features/debian_list.html (nonexistent) @@ -1,64 +0,0 @@ - - - - - pcb-rnd - Debian package list - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - Debian package list

    - -
    name internal dependencies description - -
    pcb-rnd pcb-rnd-core, pcb-rnd-gtk, pcb-rnd-gerber, pcb-rnd-lpr, pcb-rnd-png, pcb-rnd-propedit, pcb-rnd-query, pcb-rnd-report, pcb-rnd-svg, pcb-rnd-xy pcb-rnd is load/save compatible with gEDA/PCB and kicad and offers various auxiliary import/export formats.

    This metapackage installs the core and the most commonly used set of plugins. -

    pcb-rnd-core This package contains the core program. Most functionality, including the GUI frontend, is in the corresponding plugin package. -
    pcb-rnd-gtk pcb-rnd-core This package contains the GTK+ user-interface for pcb-rnd. -
    pcb-rnd-lesstif pcb-rnd-core This package contains the Lesstif/Motif user-interface for pcb-rnd. -
    pcb-rnd-autocrop pcb-rnd-core This package provides the autocrop feature that can resize the board to minimum around all the existing objects. -
    pcb-rnd-autoplace pcb-rnd-core This package provides the autoplace feature used to place elements automatically and offers two different algorithms to do so. -
    pcb-rnd-autoroute pcb-rnd-core This package provides the classic gEDA/pcb autorouter. -
    pcb-rnd-diag pcb-rnd-core This package provides actions for debugging/diagnostic purposes. This feature may be needed for reporting bugs. -
    pcb-rnd-distalign pcb-rnd-core This package provides actions for arranging elements in an array. -
    pcb-rnd-distaligntext pcb-rnd-core This package provides actions for arranging text objects in an array. -
    pcb-rnd-djopt pcb-rnd-core This package provides actions to clean up (optimize) tracks. It is especially useful after autorouting. -
    pcb-rnd-gcode pcb-rnd-core This package allows exporting the design to gcode, useful for CNC milling. -
    pcb-rnd-gerber pcb-rnd-core This package allows exporting the design to gerber, accepted by most PCB fab houses. -
    pcb-rnd-lpr pcb-rnd-core This package allows printing directly from the GUI, using lpr. -
    pcb-rnd-nelma pcb-rnd-core This package allows exporting the design to nelma, for numerical capacitance calculation (via external tool) -
    pcb-rnd-png pcb-rnd-core This package allows exporting the design in various bitmap formats, including png and jpeg. -
    pcb-rnd-svg pcb-rnd-core This package allows exporting the design in SVG, the Scalable Vector Graphics format. It is useful for publishing the design on the web. -
    pcb-rnd-xy pcb-rnd-core This package allows exporting the design in XY, suitable for pick&place machines. -
    pcb-rnd-fontmode pcb-rnd-core This package lets the user to turn the GUI into a PCB font editor. -
    pcb-rnd-fp-wget pcb-rnd-core This package provides a wget based footprint accessor, which allows integrating web directories of footprints in the library. The only currently supported site is gedasymbols.org. -
    pcb-rnd-edif pcb-rnd-core This package allows pcb-rnd to import netlists in the EDIF format. -
    pcb-rnd-mincut pcb-rnd-core This package upgrades the indication of short circuits: instead of highlighting two random pins/pads, it tries to determine the minimal-cut that would resolve the short. In practice this means it makes a suggestion where to cut the networks to remove the short circuit. -
    pcb-rnd-oldactions pcb-rnd-core This package provides some old user actions. These are not used daily anymore, but some old actions scripts may still depend on them. -
    pcb-rnd-polycombine pcb-rnd-core This package provides actions to combine (merge) multiple polygons into a single, more complex polygon. -
    pcb-rnd-propedit pcb-rnd-core This package provides the property editor function for the GUI. The property editor collects all properties and attributes of all selected objects in a table and allows the user to change them. -
    pcb-rnd-puller pcb-rnd-core This package provides actions to "pull" tracks, minimizing their length. -
    pcb-rnd-query pcb-rnd-core This package provides the query language used in the advanced search on the GUI. -
    pcb-rnd-renumber pcb-rnd-core This package provides various actions to automatically renumber elements on the design. These actions change the refdes of some (or all) elements. -
    pcb-rnd-report pcb-rnd-core This package provides the report action that displays basic information about design objects. Unlike propedit, report does not allow the user to manipulate any of the data reported. -
    pcb-rnd-shand-cmd pcb-rnd-core This package provides 1..2 character long shorthands for the most commonly used core commands. -
    pcb-rnd-smartdisperse pcb-rnd-core This package implements a smart algorithm to disperse elements. It is useful after importing a new design from the schematics. It is an alternative to autplace. -
    pcb-rnd-stroke pcb-rnd-core, pcb-rnd-gtk This package implements mouse gestures using libstroke. -
    pcb-rnd-teardrops pcb-rnd-core This package embeds each pin in a teardrop drawn from multiple arcs. May be useful for toner-transfer boards. -
    pcb-rnd-vendordrill pcb-rnd-core This package provides vendor drill mapping and vendor specific design rule application. -
    pcb-rnd-gsch2pcb This package provides the external tool gsch2pcb-rnd that can convert a gschem schematics to files that can be imported in pcb-rnd. - -
    - Index: 1.1.4/doc-rnd/features/oldplugins.html =================================================================== --- 1.1.4/doc-rnd/features/oldplugins.html (revision 10776) +++ 1.1.4/doc-rnd/features/oldplugins.html (nonexistent) @@ -1,69 +0,0 @@ - - - pcb-rnd - [oldplugins] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [oldplugins]

    - -In this effort I imported a set of old PCB plugins to be core plugins of -pcb-rnd. This will make it easier to keep them up to date, to defeat -the bitrot effect. The feature plugins that got imported so far: -
      -
    • autocrop -
    • boardflip -
    • distalign -
    • distaligntext -
    • jostle - doesn't work properly -
    • polycombine -
    • polystich - segfaults -
    • teardrops -
    • renumberblock - as part of the renumber plugin -
    • smaprtdisperse -
    -

    -The import/export plugins improted over the default set of the last official -mainline release: -

      -
    • import_dsn - specctra importer - compiles, parser needs a full rewrite, it tries to read an s-expression line by line with fgets() -
    • export_dsn - specctra exporter - compiles, produces valid-looking output - need tester to validate the output -
    • export_bboard - breadboard exporter - compiles, produces valid-looking output - need tester -
    • export_dxf - mechanical cad export - compiles, missing header data renders exported files unusable -
    • export_ipcd356 - electrical test output - compiles, produces valid-looking output - need tester -
    • export_openscad - 3d modeling - compiles, output sort of works, models not yet imported, need tester -
    - -Plugins that won't be imported: -
      -
    • findelement - [query] takes care of that -
    • findrat - [query] will take care of that -
    • join-found - not clear what it would do -
    • lockelements - [query] can select elements then SetFlag() should be able to lock them -
    • sedrename - [query] will take care of that -
    • upth2pth - [query] will take care of that -
    • ratsel - written in C++ -
    • stipple - written in C++ -
    - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Any interesting plugin is subject to be imported. - - - Index: 1.1.4/doc-rnd/features/debian.html =================================================================== --- 1.1.4/doc-rnd/features/debian.html (revision 10776) +++ 1.1.4/doc-rnd/features/debian.html (nonexistent) @@ -1,50 +0,0 @@ - - - pcb-rnd - [debian] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [debian] patch

    - -Our current Debian packaging reflects the modularity of pcb-rnd: it has -most plugins in separate packages. The main package is called -pcb-rnd-core: this provides the executable and the footprint library -and the batch HID. The GUI HIDs are in pcb-rnd-gtk and -pcb-rnd-lesstif - it's possible to install neither, either or both. -When there are multiple HIDs installed, the user can select one by the ---gui command line parameter or by changing the GUI preference in the -configuration (the default preference is gtk > lesstif > batch). -

    -The rest of the packages are features, importers and exporters, e.g. -pcb-rnd-svg is the SVG exporter, pcb-rnd-query is the object -query language needed for the advanced search. -

    -A metapackage called pcb-rnd is provided for convenience: it installs -the packages for the most common, yet small setup, with the GTK HID. -

    -How to get the packages: -

      -
    • decide which packages you need; this package list may help -
    • use apt-get install after configuring repo.hu's debian repository as source in your /etc/apt/sources.list -
    • use dpkg -i after manually downloading the packages from repo.hu's flat package list or from the package pool -
    • build them on your Debian box: use svn trunk, install debhelper and all the build dependencies of pcb-rnd and run "fakeroot debian/rules binary" in trunk (shorthand: "make deb") -
    - -

    plans

    -No plans - this feature is fully implemented. - - Index: 1.1.4/doc-rnd/features/ba.html =================================================================== --- 1.1.4/doc-rnd/features/ba.html (revision 10776) +++ 1.1.4/doc-rnd/features/ba.html (nonexistent) @@ -1,68 +0,0 @@ - - - pcb-rnd - back annotation - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [ba] patches

    -Back annotation was a long standing missing functionality. There has been -different suggestions, including: -
      -
    • back annotation is not needed at all, the user can do it manually -
    • pcb should generate a new netlist, the user should run diff on the netlists and manually edit the schematics -
    • gschem should be able to load netlists emitted by PCB; or gnetlist could reverse-process such a netlist -
    -

    -The current implementation allows pcb-rnd users to make deliberate pin -swapping and footprint replacement. The changes can be saved in a -"netlist patch" format. A modified gschem can load these and present them -as search results pointing to parts of the schematics that need to be changed. -There is a -demo video about how this happens in practice. -

    -The modified gschem can be checked out from svn://repo.hu/geda-gaf-ba/trunk -

    -The underlying mechanism is versatile and potentially allows more changes -to be back annotated. These are not yet accessible due to the lack of PCB -actions and GUI. - -

    Design decisions

    -This devlog entry functions -as a design decision document. - Another entry is a summary -on how the feature ended up in a private feature-fork of gschem. - -

    save/load and compatibility

    -Deliberate changes are tracked so that a new forward annotation from -the old schematics won't break them. To do this, pcb-rnd saves a -NetListPatch() section in the file. Mainline PCB can not handle this section. -Compatibility, by use case: -
      -
    • 1. No back annotation is made in pcb-rnd: the file stays compatible -
    • 2. Back annotation is made in pcb-rnd, then the changes are done on the schematics and a forward annotation is also done: the netlist patch in pcb-rnd becomes empty so the pcb file is again compatible with mainline pcb; this is called resolution of netlist patches -
    • 3. There are unresolved netlist patches saved in pcb-rnd and the user attempts to load the pcb file in mainline pcb: syntax error (but no data loss); solution: resolve the netlist patch as described in point 2. -
    • 4. Cheat for situation 3.: manually remove the NetListPatch() section from the save file. This way the back annotation info is lost, but mainline pcb can load the file again. This action is sort of "revert back annotation". -
    • 5. Any file saved by mainline PCB can be opened by pcb-rnd, back annotation does not affect that. - -
    - - -

    plans

    -Back annotation for further changes, e.g. value change, naming/renaming nets, -etc. - - Index: 1.1.4/doc-rnd/features/grid.html =================================================================== --- 1.1.4/doc-rnd/features/grid.html (revision 10776) +++ 1.1.4/doc-rnd/features/grid.html (nonexistent) @@ -1,99 +0,0 @@ - - - pcb-rnd - gtk grid fixes - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - gtk grid fixes

    - -

    Problem with the original gtk grid

    - -The original code draws every grid point on screen, even the ones that are -off the board. When the user zooms out with a dense grid, it can become too -dense - the original code turns the grid off in this case. -

    -If the grid is very dense, on a large screen the software render may slow down. -This is noticeable in pan and zoom mostly. The bottleneck is the gtk call -that draws the grid points: if there are too many of them, it's slow. - - -

    New grid

    - -To overcome this problem, pcb-rnd offers configuration settings to limit -the number of dots to be drawn. There are mainly two parallel approaches: -using a local grid or draw less dots in a global grid. The -old code defined only a global grid and did not have runtime settings for -the properties of the grid. -

    -There's a new "Grid properties" submenu in the view menu in the default -gtk hid menu file. Screenshots were taken with this menu teared-down to -demonstrate the settings. - -

    Global grid improvements

    - -The most trivial optimization is that grid points off the board are simply -not drawn: -

    - -

    -Next, the compile-time configurable "minimum distance between grid points -before it is too dense" setting is user configurable now. The default value -can be changed in any of the usual -configuration sources. However, -when the configured density is reached while zooming out, there are two options. -

    -The first, default option is to do the same that the original code did: just -hide the grid: -

    - -

    -An alternative is to use sparse global grid which means only -every 2nd, 3rd, 4th, ... Nth grid point is drawn. The cursor still snaps -to every real grid point, so the grid got sparse only on the display. Note -how the line is drawn on invisible grid points: -

    - - -

    Introduction of the local grid

    -Another approach is to use a local grid. The grid helps finding whether -existing objects are aligned or where the next move/click would end up. -These are usually interesting only in a small range around the crosshair and -less interesting on the other end of the board. Local grid draws the grid -points only near the crosshair. Such local grid follows the crosshair -everywhere: -

    - -

    -The user can configure or interactively set the radius in which the grid -points are drawn: -

    - -

    -The radius is given in "number of grid points", thus the local grid yields -a constant number of points that is independent of the actual grid size. When -a local grid gets too dense, it is hidden - there's no sparse option, since -local grids usually have too few points to make reasonable skips. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -This feature is gtk-specific and is complete. There are no plans to -implement this in the lesstif HID at the moment. - - - Index: 1.1.4/doc-rnd/features/propedit.html =================================================================== --- 1.1.4/doc-rnd/features/propedit.html (revision 10776) +++ 1.1.4/doc-rnd/features/propedit.html (nonexistent) @@ -1,65 +0,0 @@ - - - pcb-rnd - [propedit] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - [propedit]

    -Since 1.1.2, pcb-rnd core is able to attach user defined attributes -(arbitrary textual key=value pairs) to any object. The original mainline -pcb-rnd was forked from already supported attributes on some objects (e.g. -board attributes, net attributes) but not on all. However, the user had -very little access to the attributes - no GUI or action would handle them. -

    -Propedit introduces a property editor window in gtk that is able to -edit attributes and core properties of all selected objects. Core properties -include all hardwired properties of objects, such as geometry (e.g. -trace width, hole diameter, clearance) or textual data (e.g. string of -a text). -

    - -

    -Properties and attributes of the selected objects are collected in a -sorted list - each row of the list is a property (starting with p/) or -an attribute (starting with a/). For each row all values seen in the selection -are also collected so that the following values can be presented on the list, -per row: -

      -
    • the most common value -
    • minimum value (for numeric value types) -
    • maximum value (for numeric value types) -
    • average value (for numeric value types) -
    -

    -When the user clicks on a row, an edit box is activated and the value can -be changed. A combo box lists all existing values for the given row, so -it is easy to unify the value of a property or attribute among all selected -objects to one of the existing values, but the user is also free to enter -a new value. -

    -It is also possible to remove existing attributes or to add new attributes. - -

    save/load and compatibility

    -Attributes of most objects can not be saved in the original .pcb format. -The propedit feature is most useful when used with the lihata board format. - -

    plans

    -Various improvements. Currently there's no plan to make this function available -in the lesstif HID. - - - Index: 1.1.4/doc-rnd/features/pcb-fp.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/pcb-fp.png =================================================================== --- 1.1.4/doc-rnd/features/pcb-fp.png (revision 10776) +++ 1.1.4/doc-rnd/features/pcb-fp.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/pcb-fp.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/res.html =================================================================== --- 1.1.4/doc-rnd/features/res.html (revision 10776) +++ 1.1.4/doc-rnd/features/res.html (nonexistent) @@ -1,147 +0,0 @@ - - - pcb-rnd - [res] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [res] patch

    - -PCB used to have an own file format for describing resources (menu structure -and hotkey bindings, vendor drill mapping). The resource format was generic -enough to describe these things, but the syntax was somewhat wierd: mixed -positional and named fields. More precisely, composite nodes could contain -named and anonymous subnodes, and the meaning of anonymous subnodes depended -on their position in the anon-subnode-list. -

    -The code that dealt with the in-memory representation of the resource tree -was wierd and big chunks duplicated in the HIDs and vendor drill module. It -was also hard to parse a resource file with external tools. -

    -Since version 1.0.10, pcb-rnd replaces resource files with -lihata. Lihata is a small, generic -purpose container format that can describe arbitrary trees. Just like resource -file syntax, lihata is optimized for hand-editing: no need to use excess -quoting or long boilerplate blocks. -

    -Liblihata also provides a lot of helper functions that made the code -dealing with the menus and vendor drill resources much simpler and less -redundant. Since the parser is small and external, and since there are -external converter tools available, it is also easier to deal with the -files outside of the pcb executable. - -

    menu files

    -There are pcb-menu-gtk.lht and pcb-menu-lesstif.lht. They are in trunk/src -in the source tree and are instaslled in the SHAREDIR. Currently each GUI -HID (lesstif, gtk) loads the corresponding menu file. - -

    menu resource lihata structure

    -The root of a menu resource file should be a ha: with the following -children: -
      -
    • li:mouse for mouse button bindings -
    • li:main_menu for describing the main menu -
    • li:popups for describing the popup menus -
    -All children are optional, but recommended. Thus the file stucture, zoomed -out, is: -
    -ha:{
    -	li:mouse { ... }
    -	li:main_menu { ... }
    -	li:popups { ... }
    -}
    -
    - -

    li:mouse

    -The mouse subtree may contain a li: for each mouse button action; -the children of the list are further li: nodes for key modifiers, whose -children are text nodes: actions executed in order. -

    -Buttons supported are: left, right, middle, up, down - the last two -are for the scroll wheel. Modifier name should start with "press" or "release" -optionally followed by modifier key suffixes separated with dashes, e.g. -"press-alt-shift" means the given button is pressed while alt and shift -were also pressed. -

    -Example structure: -

    -	li:mouse {
    -		li:left {
    -			li:press            = { Mode(Notify) }
    -			li:press-ctrl       = { Mode(Save); Mode(None); }
    -		}
    -	}
    -
    - -

    li:main_menu

    -The main menu is a list of menubar items that may host submenu items -recursively. Each normal item is a hash with the following children: -
      -
    • li:submenu an ordered list of submenu nodes (should not have accel key or action) -
    • tip tooltip text -
    • action text or list of actions to execute when menu is selected -
    • a a key description for an accelerator key (hotkey) -
    • li:a a list of key descriptions for an accelerator keys (hotkeys); all keys will be bound to the menu and the first key is shown in the menu -
    -Special menu items are text nodes instead of hashes; they are: -
      -
    • starting with @, are dynamic, auto-generated items (e.g. layers; might be HID-dependent) -
    • a singel dash: separator -
    -

    -A key description is a text in the form of: -

      -
    • the name of the node is the visible name of the menu item -
    • <key>keyname, e.g. "<key>k" for key K, or "<key>F10" for F10 -
    • modifier<key>keyname, e.g. "Alt-<key>K" for Alt+K -
    • modifier-modifier<key>keyname, e.g. "Shift-Alt-<key>K" for Shift+Alt+K; modifiers are Alt, Shift and Ctrl; order does not matter, all three can be used together. -
    • multikey sequence: multiple of the above, separated by semicolons (protected with {} for lihata, as the text contains semicolon); e.g. "{<key>f;<key>o}" means the user presses "f" then "o". Sequences can be a dozen stroke long and any segment may use modifiers -
    - -An example menu item with submenus (can be a main menu or a submenu of -another menu item): -
    -ha:example menu item {
    -	li:submenu {
    -		ha:menu item {
    -			action=Save(ElementConnections)
    -			tip=example menu
    -		}
    -		-
    -		ha:another menu item {
    -			a={Shift-Alt<key>r}
    -			action={Action1(); Action2();}
    -		}
    -	}
    -}
    -
    - -

    li:popups

    -Each children is a hash that describes a popup menu. A popup menu behaves -exactly like a menu item, it should have a submenu list. Popup windows will -be popped up by executing an action with the name of the popup menu. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -The resource file format conversion is done. There are other parts of the code -that will probably get lihata instead of the current custom parsers, e.g. -the preferences/settings file. - - - Index: 1.1.4/doc-rnd/features/polygrid.html =================================================================== --- 1.1.4/doc-rnd/features/polygrid.html (revision 10776) +++ 1.1.4/doc-rnd/features/polygrid.html (nonexistent) @@ -1,35 +0,0 @@ - - - pcb-rnd - [polygrid] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [polygrid] patch

    - -Polygrid adds an option to the ps exporter to fill polygons with a grid -of horizontal and vertical lines instead of full fill. When toner transfer -is used or test prints are produced, the grid may save some toner. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Fix bugs. -

    -No (feature) plans - this feature is fully implemented. - - Index: 1.1.4/doc-rnd/features/scconfig.html =================================================================== --- 1.1.4/doc-rnd/features/scconfig.html (revision 10776) +++ 1.1.4/doc-rnd/features/scconfig.html (nonexistent) @@ -1,33 +0,0 @@ - - - pcb-rnd - [scconfig] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [scconfig] patch

    - -Pcb-rnd uses scconfig -for ./configure instead of autotools. Scconfig is smaller and easier -to maintain. - -

    save/load and compatibility

    -Not affected. - -

    plans

    -No plans - this feature is fully implemented by now. - - Index: 1.1.4/doc-rnd/features/fp_wget.html =================================================================== --- 1.1.4/doc-rnd/features/fp_wget.html (revision 10776) +++ 1.1.4/doc-rnd/features/fp_wget.html (nonexistent) @@ -1,55 +0,0 @@ - - - pcb-rnd - [fp_wget] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [fp_wget] patch

    - -Since version 1.0.10, pcb-rnd implements a new footprint mechanism (see -[fp_fs] and [library_t]). -The new code allows footprint backend plugins to get library from anywhere. -The [fp_wget] plugin is an implementation that: -
      -
    • downloads a library list from the web on startup into a local cache -
    • downloads footprints from the web on-demand into a local cache -
    -

    -This is all transparent, the user experience is that the remote library is -like a read-only local library reachable from the library window. -

    -A web site used as a library should be able to: -

      -
    • generate a plain text list of all footprints available -
    • return the raw footprint file by name -
    -

    -The plugin uses external program wget to communicate on the web. - - -

    How to configure for gedasymbols.org

    -Add wget@gedasymbols in the library search path (e.g. in preferences as library-newlib). - -

    save/load and compatibility

    -Not affected. - -

    plans

    -Better feedback on progress, explicit user requested refresh, refresh in -the background. - - - Index: 1.1.4/doc-rnd/features/grid_global_nosparse.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/grid_global_nosparse.png =================================================================== --- 1.1.4/doc-rnd/features/grid_global_nosparse.png (revision 10776) +++ 1.1.4/doc-rnd/features/grid_global_nosparse.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/grid_global_nosparse.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/square.html =================================================================== --- 1.1.4/doc-rnd/features/square.html (revision 10776) +++ 1.1.4/doc-rnd/features/square.html (nonexistent) @@ -1,89 +0,0 @@ - - - pcb-rnd - [square] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [square] patch

    -Most of my PCBs end up in toner transfer. There are a lot -of tricks around prototyping at home. One of the problems I often -face is small rings peeling off during rework (and rework tend to -happen on the first prototypes). The solution for this is increasing -ring size - which is not suitable if traces are passing between pins. -Another solution is to increase the area of the pin: -
      -
    • square pin: while it makes the pin slightly larger still letting traces pass between pins, it's too symmetrical and can not use up extra room -
    • DJ's teardrop plugin: this increases the area only toward the trace, whereas very often there's more room on the opposite side -
    • manually add an extra poly around the pin; with multiple pins it's hard to get the polys separate -
    • manually add a short extra track on the pin, width matching the size of the pin; this is very close, but increases workload when components are moved, layers are changed -
    - -

    -The patch takes an octagon pin and stretches points in various directions. -There are 4 bits (for left, right, up and down) to indicate in which directions -the stretch applies. Pressing 'q' on a pin cycles thru round pin, square pin, -16 stretched octagons and the original octagon. -

    -The code is also patched to handle clearances, shorts and connections (find.c). -

    -Thermals are not fully working for funny shaped pins, but it has low priority: -they still work fine for rounded and square pins and if there is a poly around -the pin, I wouldn't use shaped pins anyway. - -

    save/load and compatibility

    -This patch introduces a new pin flag called shape(n), where n is an integer -selecting the shape of the pin when the square flag is also set: -
    -Pin[40000 60000 6000 3000 6600 2800 "8" "8" "square,shape(3)"]
    -
    -Mainline PCB will load the design ignoring the custom shape and will use a -square pin. As long a traces end in the center point of the pin, this -should not break connections. -

    -Mainline PCB doesn't save shape() - once the design is loaded and saved with -mainline PCB pin shape info is lost. - -

    plans

    -In the original code there are separate code paths for round, octagonal and -square pins. The separation repeats for at least: -
      -
    • drawing the pin shape -
    • calculating the clearance -
    • checking whether things overlap or connect (pin vs pin, pin vs line, etc.) -
    • autorouter -
    -In most cases a set of hardwired constants are written in the C code. A notable -exception was the octagon pin draw function, that had x and y offsets in a const -table for 8 points and a loop to create the poly (or line segments in thin draw). -

    -The [square] feature is a good base for cleaning up the code a bit and for -moving toward a generic pin shape patch: -

      -
    • hardwired octagon calculations should be replaced to use the same x;y const offset table -
    • the table should be replaced by a struct that describes length (number of points) - alternatively use POLYAREA -
    • square pin should be renamed to polygon pin -
    • octagon flag shall be removed - it should be a configuration of the x;y const table -
    • square flag shall be removed - it should be a configuration -
    • the only flag remaining should be shape(); if a pin is not shaped, it's round -
    • the pin shape struct should have a field for compatibility - to mark the entry corresponding to the original square and octagon pins so PCB-rnd format can be converted to and from the mainline PCB format. -
    • there should be a set of pin shapes in a default configuration table, including square and octagonal; these should be static -
    • the PCB file format should be extended with an option to expand the pin shape table with custom shapes -
    • UI: shapes could be imported (converted) from polys around vias -
    • UI: since there may be a lot of pin shapes, a GUI selector alternative shall be offered while also keeping the cycle-thru 'q' key -
    - - Index: 1.1.4/doc-rnd/features/settings.html =================================================================== --- 1.1.4/doc-rnd/features/settings.html (revision 10776) +++ 1.1.4/doc-rnd/features/settings.html (nonexistent) @@ -1,49 +0,0 @@ - - - pcb-rnd - different default settings - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - settings

    - -There are a few minor changes in default settings compared to mainline -pcb. - - - - - -
    name - description - where to change - -
    layers - the default layer stack is optimized for two sided boards with 3 layers on both sides - edit or replace /usr/share/pcb-rnd/default.pcb - -
    styles & DRC - default styles and DRC settings are optimized for toner transfer - edit or replace /usr/share/pcb-rnd/default.pcb - -
    grid - on startup "enable visible grid" is on and grid is set to 25 mil - change editor/draw_grid in pcb-conf.lht (in system install dir, in user dir) or in project.lht - -
    - - - Index: 1.1.4/doc-rnd/features/tostyle.html =================================================================== --- 1.1.4/doc-rnd/features/tostyle.html (revision 10776) +++ 1.1.4/doc-rnd/features/tostyle.html (nonexistent) @@ -1,68 +0,0 @@ - - - pcb-rnd - [tostyle] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [tostyle] patch

    - -Footprints bring their own hole sizes, copper ring sizes and clearances. -These parameters often depend on the manufacturing process, and such a value -coming from a footprint may differ much from the values used on the board already. -

    -PCB has actions (and menus and hotkeys) to change sizes manually. In my practice, -I try to stick to the sizes defined in my routing styles and try to avoid -manually changing clearances or ring sizes. Still, the random values coming -from various footprints should be changed. -

    -After many years of struggling with this, I realized the feature I need is -a way to change object sizes to not a relative or absolute number but -to the current routing style. The [tostyle] patch does exactly this. -It implements the following new features: -

      -
    • change clearance size now works on elements: it changes the clearance of all pins/pads; this is the same as change drill has been working for a long time -
    • size change actions normally take a value and a unit; if the value is not a number but text style, the value is copied from the currently active routing style -
    • a new ChangeSizes() action that attempts to execute the other three change size actions with the same arguments and fails only if all of them failed; the three sizes are: main size, drill size, clearance size -
    • a menu item and hotkey binding to key 'Shift+Y' (for routing stYle) that calls ChangeSizes() of the selected or current object(s) to resize them to the current routing style -
    -

    -The new route style set works on: -

      -
    • lines and arcs: sets their line width and clearance -
    • vias and individual pins: sets their ring dia, drill dia and clearance -
    • individual pads: sets their clearance -
    • elements: set all their pins and pads -
    - -

    Example

    -GUI: select a routing style; hover above a line, a via, a pin/pad of an element -or the silk of an element; press Shift+Y; undo if necessary. -

    -CLI: select objects, execute action ChangeSizes(selected, style) -

    -CLI: to adjust drill sizes only: select objects, execute action ChangeDrillSize(selected, style) - - -

    save/load and compatibility

    -Not affected, since the patch introduces actions and UI changes, no change -related to the data model. - -

    plans

    -No plans, the feature is complete. - - - Index: 1.1.4/doc-rnd/features/propedit.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/propedit.png =================================================================== --- 1.1.4/doc-rnd/features/propedit.png (revision 10776) +++ 1.1.4/doc-rnd/features/propedit.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/propedit.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/io.html =================================================================== --- 1.1.4/doc-rnd/features/io.html (revision 10776) +++ 1.1.4/doc-rnd/features/io.html (nonexistent) @@ -1,41 +0,0 @@ - - - pcb-rnd - [io_*] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [io_*] patches

    - -Mainline PCB core was coupled with the file format; the [io] patch set is -an effort to decouple any file design I/O from core. The original file format -(plain text .pcb and .fp) lives on as plugin called io_pcb. - -

    -TODO - -

    save/load and compatibility

    -Not affected when io_pcb is used and .pcb or .fp files are loaded or saved. -

    -Using other io_* implementations will obviously result in files that are -incompatible with mainline pcb (unless mainline pcb learns how to load those -formats). - -

    plans

    -The project is still in an early phase. - - - Index: 1.1.4/doc-rnd/features/index.html =================================================================== --- 1.1.4/doc-rnd/features/index.html (revision 10776) +++ 1.1.4/doc-rnd/features/index.html (nonexistent) @@ -1,61 +0,0 @@ - - - pcb-rnd - features - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd

    -

    Change summary, per topic

    - -
    commit message tag and docdescription -
    [gpmi] scripting PCB (including GUI dialogs, actions, menus, changing the layout) -
    [intconn] component internal connections -
    [nonetlist] components that are not part of the netlist and should not cause shorts -
    [tostyle] actions, menu and hotkey to change ring dia, line width, drill dia and clearance sizes to match the values defined for the current routing style -
    [mincut] minimal cut based warnings on shorts -
    [square] change square pad to a generic shaped-pin based on the octagon pin code - this is an alternative to teardrops -
    [flagcomp] unknown flag compatibility -
    [scconfig] use scconfig instead of autotools -
    [pcb-fp] generic parametric footprints; on-the-fly footprint generation by external tools written in any language (remove m4 hardwirings) -
    [pcblib], [fp_fs], - [pcblib-param] clean up the footprint library shipped -
    [library_t] footprint library is an arbitrary tree instead of a special, 2 level tree -
    [fp_wget] web based footprint libraries, integration of gedasymbols.org -
    [res] replace resource files with lihata and enable multi-key hotkeys in both gtk and lesstif hids -
    [debian] Debian packaging the binaries configured to my own taste -
    [ba] back annotation -
    [onpoint] on-point by Robert Drehmel -
    [cycdrag] cycle drag; with additional feature: negative box select -
    [mods] modularize the code to reduce core size - for comparison, previous stats: 1.0.8, 1.0.9 -
    [unglib] remove glib dependency from core -
    [io_*] .pcb and .fp file format plugins -
    [dynstyle] dynamic routuing style: sypport more than 4 of them - with no limit -
    [conf] new, unified, config file system -
    [propedit] property/attribute editor (gtk) -
    [oldplugins] import old PCB plugins -
    [query] query language -
    routing styles routing style fixes -
    (gtk grid) gtk grid improvements: sparse global grids, local grids -
    (full screen) gtk full screen edit mode -
    (settings) minor changes in default settings - - - -
    - - - Index: 1.1.4/doc-rnd/features/pcb-fp.html =================================================================== --- 1.1.4/doc-rnd/features/pcb-fp.html (revision 10776) +++ 1.1.4/doc-rnd/features/pcb-fp.html (nonexistent) @@ -1,54 +0,0 @@ - - - pcb-rnd - [pcb-fp] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [pcb-fp] patch

    - -Pcb-fp is an effort to clean up the footprint situation: -
      -
    • replace lib and newlib with pcblib, a library that tries to provide common footprints only -
    • clear the syntax: if a footprint name contains parenthesis, it's generated (parametric footprint), else it's the name of a static footprint file -
    • parametric footprints: replace m4 with a generic, language-independent footprint generator framework -
        -
      • implement libpcb_fp, which centralizes searching and loading footprints -
      • fork gsch2pcb to gsch2pcb-rnd that uses libpcb_fp (and does not have any m4 references hardwired) -
      • fork gnet_gsch2pcb.scm (the gnetlist backend) to remove m4 heuristics -
      -
    - -

    Example

    -Intaractive parametric footprint selection in pcb-rnd: -

    - -

    -An online footprint generator web1.0 version is also available. - -

    save/load and compatibility

    -Save/load files are not affected. If a schematics is written for the new -library and depends on parametric footprints: -
      -
    • mainline gsch2pcb won't find those footprints -
    • mainline pcb won't show those footprints in the footprint selection dialog -
    - -

    plans

    -No plans - this feature is fully implemented. - - - Index: 1.1.4/doc-rnd/features/intconn.html =================================================================== --- 1.1.4/doc-rnd/features/intconn.html (revision 10776) +++ 1.1.4/doc-rnd/features/intconn.html (nonexistent) @@ -1,90 +0,0 @@ - - - pcb-rnd - [intconn] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [intconn] patch

    - -There are parts with internal connections (e.g. pin 2 and 4 of a SO8 -package are internally connected). Mainline PCB can not handle this, -leaving the following options: -
      -
    • connect both pins to the net from the schematics - this works if all the internally connected pins are required to connect to copper (common with GND or power pins) but is very inconvenient for signal pins where only one of them needs to be connected -
    • back-annotate which pin is connected - there's no easy back annotation -
    • one pin connected, the other is closer to the next target; PCB doesn't understand that they are already connected internally; normally one shouldn't use the internal connection of a component instead of copper; except for the common practice to use 0 ohm SMD resistors for jumping wires -
    -

    -The patch introduces a new pin flag intconn(g) which marks the pin -to have internal connections in group g. If there -are multiple pins using the same g value within a single element, they -are internally connected. In other words, g is a group (or net name) -within the element and pins can join to one of the numbered groups (or internal -nets). The value of g shall be between 1 and 255, 0 means no internal -connection (equivalent to the case when intconn(0) is omitted). -

    -When pin numbers are displayed (key 'd'), internal connection groups are -written in square brackets, e.g. "2 [9]" means "pin 2, internally connected -to group 9". -

    -Combined with the [nonetlist] patch, this -solves the "0-ohm 1206 jumper" problem: the element should be marked -as nonetlist, with both pins set intconn(1) - this will result in a 2 -pad element, pads internally connected, that can be part of any one network -without causing short. -

    Example

    -The first image depicts crossing traces, a common problem encountered when rats -nesting a new layout from a netlist. One method to resolve such issues is to -use a zero ohm jumper resistor that allows one signal trace to 'jump' across -another. -

    -The second image shows the layout routing the nonconflicting rats and a open -unrouted point where the rat would require one trace to cross another. -

    -In the third image a 1206 SMD footprint for a 0 Ohm 1206 resistor called J1 is -placed with an intconn between the two pads which resolves the final rat line. -

    - -

    - -

    - -

    - - - -

    save/load and compatibility

    -This patch introduces a new pin flag. In the following example -pin 2 and 4 are connected internally as group 9, while pin 3 -does not have any internal connections: -
    -Pin[40000 60000 6000 3000 6600 2800 "2" "2" "square,intconn(9)"]
    -Pin[40000 50000 6000 3000 6600 2800 "3" "3" "square"]
    -Pin[40000 40000 6000 3000 6600 2800 "4" "4" "square,intconn(9)"]
    -
    -Mainline PCB will load the design ignoring internal connections - -this may introduce new rats. -

    -Mainline PCB doesn't save intconn() and elements are embedded in the file - -once the design is loaded and saved with mainline PCB, internal connection -info is lost. - -

    plans

    -No plans - this feature is fully implemented. There is no plan for implementing -a GUI, internal connections should be hand-edited into the element. - - Index: 1.1.4/doc-rnd/features/routings.html =================================================================== --- 1.1.4/doc-rnd/features/routings.html (revision 10776) +++ 1.1.4/doc-rnd/features/routings.html (nonexistent) @@ -1,97 +0,0 @@ - - - pcb-rnd - routing style fixes - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - routing style fixes

    - -

    Number of styles

    -In the original code there are a compile-time fixed number (4) of routing -styles. This is often not enough for more complex designs. While in theory -this limit can be raised, the resulting .pcb files will be incomatible with -pcb compilations using a different number of styles. -

    -Pcb-rnd uses a dynamic vector for storing styles and allows any number -of styles from 0 up to a very large value (2^31-1). There is no compile-time -configurable limit. The number of default styles (and the actual style -configuration) is coming from the template pcb file. -

    -Creating a new style in the Route Styles dialog is not "for this session only" -anymore - styles are saved with the design. - -

    Explicit custom style

    -Pcb had 4 explicit styles and a hidden, implicit style. All drawing -action uses the hidden style. When the user selects one of the explicit -styles, its properties are copied into the implicit style. Any drawing -action uses the implicit style, this it's sort of the "pen style". -

    -In mainline PCB the implicit (or pen) style is hidden. As long as it always -matches one of the existing styles, the user doesn't even know about it. -However, if there are objects that do not comform to any of the existing -styles, it is possible to bump into this. For example: -

      -
    • draw a line using one of the existing styles -
    • increase the width (with the 's' key) a few times - now the style of the line does not match any of the existing styles -
    • use the SetSame() action over the line (hover the pointer over the line and press 'a') - it will try to set the style that corresponds to the line -
    • since no style matches the line's, the radio button gets deselected - that's good -
    • now click on the Route Style button - it will show the properties of the last selected route style, even tho it is not selected at the moment -
    -

    -In contrast, pcb-rnd offers an explicit routing style called <custom>. -If SetSame() is invoked on an object that doesn't match any of the existing styles, -the <custom> style is selected: -

      -
    • no style marked on the radio button (just like in mainline) -
    • the Route Style button opens with the <custom> style, with the values picked up from the object by SetSame -
    • the user can change the values, which will affect the implicit pen style -
    • this means the user can draw with the new settings, without having to create a permanent style -
    -

    -In other words, it is now possible to use the implicit pen style as temporal -style, to explicitly set a line width, via diameter before placing a few -unusual lines or vias, without having to create a new style. It is also -possible to pick up the style of such an unusual object later, without the -GUI confusing it with any of the existing styles. - -

    SetSame() bugs fixed

    -A line does not have drill parameters. When mainline tries to pick up -object properties for a line, it will pick thickness and clearance but -will leave hole and ring diameters unchanged. This very often results in -a mixed style: e.g. "signal" line properties picked up from a line while -"power" hole/ring properties left over from the current style selection. -Such a mixed pickup will result in the GUI get confused and not selecting any -of the styles. The expected behaviour is to select the "signal" style if the -line width/clearance matches the parameters of that style, and ignore the -drill/ring parameters. -

    -The same mixup happens for picking up arc parameters, and a similar mixup -for via parameters (a via doesn't have a line width). -

    -Pcb-rnd fixes this by searching for the matching style using only the parameters -that the given object really had. This results in valid style selection -the way the user may expect. - -

    save/load and compatibility

    -Saving a design with number of styles not equal to 4 may cause problems -when loading with mainline. The rest of these features do not affect -compatibility. - -

    plans

    -No plans - these features are fully implemented. - - Index: 1.1.4/doc-rnd/features/pcblib.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: 1.1.4/doc-rnd/features/pcblib.png =================================================================== --- 1.1.4/doc-rnd/features/pcblib.png (revision 10776) +++ 1.1.4/doc-rnd/features/pcblib.png (nonexistent) Property changes on: 1.1.4/doc-rnd/features/pcblib.png ___________________________________________________________________ Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: 1.1.4/doc-rnd/features/dynstyle.html =================================================================== --- 1.1.4/doc-rnd/features/dynstyle.html (revision 10776) +++ 1.1.4/doc-rnd/features/dynstyle.html (nonexistent) @@ -1,38 +0,0 @@ - - - pcb-rnd - [dynstyle] - - - - - - - - - -
    Main - News - People - Events & timeline - pcb-rnd -
    - - -

    pcb-rnd - the [dynstyle] patch

    - -Pcb-rnd doesn't have a hardwired limit on number of routing styles -anymore. Routing styles can be created on the fly and are saved to and loaded -from .pcb files. -

    -There's no theoretical maximum explicitly set either. An implicit maximum -exists and is sizeof(int) - should be at least 2^31 on most systems. - -

    save/load and compatibility

    -The first 4 styles are loaded and preserved by mainline. Styles above -4 would probably be deleted in a mainline load-save cycle. The number 4 -is a constant value that can be changed if mainline is recompiled. - -

    plans

    -GUI HID representation of styles (especially in menus) need more testing. - - Index: 1.1.4/Changelog =================================================================== --- 1.1.4/Changelog (revision 10776) +++ 1.1.4/Changelog (nonexistent) @@ -1,714 +0,0 @@ -pcb-rnd 1.1.4 (r5778) -~~~~~~~~~~~~~~~~~~~~~ - [gsch2pcb-rnd] - -Add: method infrastructure - -Add: a method that uses the same mechanism as import_sch - -Add: a method that uses import_sch's gnetlist backend for elements but a the usual PCB backend for the netlist - - [import_sch] - -Fix: install and use the .scm script from our own directory instead of guessing gnetlist's installation - - [debian] - -Del: remove debian/ to ease official packaging - -pcb-rnd 1.1.3 (r4479) -~~~~~~~~~~~~~~~~~~~~~ - [mods] - -Fix: the IO system remembers which format (plugin) a file is loaded or last saved with and uses that on a 'save' instead of the default one, unless a different format is explicitly requested ('save as') - -Fix: load plugins from /usr/lib/pcb-rnd/plugins instead of /usr/lib/pcb/plugins - -Fix: macro argument bug in fontmode (thanks Chad!) - -Fix: import_sch: rename the gschem forward-annotation script so that it doesn't collide with mainline's - -Cleanup: rename legacy_func to lib_legacy_func as part of the plugin lib cleanup - -Add: io_kicad: load and save kicad s-expression board layout files - -Add: io_kicad_legacy: save boards and/or modules in the old kicad format - -Add: io_lihata: preserve formatting and numeric format on load/save - -Add: io_lihata: custom indentation rules for boards (more compact, easier to read) - -Add: in export_xy: code from mainline to support IPC-7351 on element rotation guesses - -Import: autocrop original code - -Import: boardflip - -Import: distalign - -Import: distaligntext - -Import: jostle - -Import: polycombine - -Import: polystich - -Import: renumberblock (as part of the renumber plugin) - -Import: smartdisperse - -Import: teardrops - -Import: bboard exporter from git - -Import: dsn exporter from git - -Import: dxf exporter - -Import: ipcd356 exporter from git - -Import: openscad exporter from git - - [query] - -Add: query language - select/unselect objects using expressions - -Add: advanced search dialog box frontend for the query language in the GTK HID - - [core] - -Cleanup: const correctness on net creation: style is read-only - -Cleanup: move generic find-net-for-pin function from rats_patch to netlist - -Fix: changing grid should not only change it in PCB but also in the conf tree - this will deliver the conf change event that will trigger the update in gtk - -Fix: const correctness in hid_flags, pin-to-net lookups - -Fix: coord conversion rounding errors - -Fix: deselect not incrementing undo serial number (from Charles Parker); caused undo panic upon undoing a deselection - -Fix: invalid function ptr to data ptr casts - -Fix: move global netlist states from global variables to PCB struct fields (on the way to a proper lib...) - -Fix: rubber band: when move didn't happen, flags were left behind - -Fix: undo element text size bug - -Fix: plug_io file load: when multiple formats matched an explicit load format description, try them all, until one worked - -Split: generalize format-string-like variable substitution so it's easier to build custom file names (and other strings) from config templates; supports %F (file name), %N (board name), %T (UNIX time), %B (basename) and %D (dirname) - -Add: remove_menu concept in HID API - -Add: generic flag change macro that can set, clear or toggle the flag depending on an argument - -Add: hid export option to draw holes after all copper, silk and mask layers has been drawn so that holes punch through everything - -Add: layer creation and rename helper functions - -Add: obj_any - a generic type+union struct (and a list of that) for holding pcb objects of any kind - -Import: LookupConnectionByPin from mainline - -Import: clear flags by object type from mainline (import and port) - - [debian] - -Change: redo the whole script for a modular packaging of plugins - - [util] - -Add: devhelper script for testing round trips - -Add: pcb-strip (remove attributes and/or symbols from a .pcb) - - [gtk] - -Add: full screen button in the scroll-bar corner - -Fix: call the checkbox menu update function from conf change callback installed at menus, instead of assuming checkbox states are changed only from within the GUI and calling the updater directly - - [propedit] - -Add: text set applies on element texts too - - [res] - -Add: RemoveMenu() action - -Add: gtk can remove menus - -Add: update_on field - bind checkbox updating to a config var - - [scconfig] - -Fix: when generating dependency generator rules, use -MT for src_3rd targets or else gcc will ruin the target object names; this means proper dependencies in src_3rd - -Cleanup: use bison/flex output file name CLI arguments instead of the tmp/mv hacks - the code depended on bison anyway - -Add: --symbols to enable debug symbols without the extra asserts and -O0 - -pcb-rnd 1.1.2 (r3773) -~~~~~~~~~~~~~~~~~~~~~ - [cleanup] - - ANSI/C89 compliance - - char * const correctness - - [mods] - -Fix: io_pcb: do not convert measure through int (Chris' mm grid bug) - -Fix: import_sch: generate proper error messages if there's no make or gnetlist program configured - -Fix: io: qsort cmp function API bug - wrong format preference - -Fix: io: make sure the PCBChanged action is ran on revert so that route styles and other properties are updated - -Fix: fontmode broken coord-to-cell conversion rendered the font editor useless - -Cleanup: export_bom and export_xy are separate plugins; export_xy depends on export_bom because of the name escaping function - -Rename: debug plugin to diag plugin to avoid confision with --debug in ./configure command line - -Add: diag: layer dump action - -Add: diag: evalconf() action to evaluate the configuration situation of a path - -Add: io_kicad_legacy: first steps for PCB layout implemented. Mildly broken module exported. - -Add: propedit: object property editor (with gtk support) - -Add: io_lihata: initial implementation without object ordering - -Add: io_pcb: 3 different flavors of the original format (using different numeric formats) - -Add: import_sch: make and gnetlist programs configured in the default config - - [lesstif] - -Fix: compile and link even if xrender is not found - -Fix: print angle as %f in the status line as it's a floating point value - - [gtk] - -Fix: library selection window switches to arrow mode before replacing the buffer, so that the outline drawing code doesn't get confused - -Fix: library path file chooser should be a "folder chooser" not a "file chooser" - -Fix: display the correct $(path) syntax in the library window help - -Fix: when file name changes, update window title - -Fix: do not allow to zoom out so much that Coord can't handle it anymore and overflows - -Fix: work around the control bug on some mac systems - -Fix: do not draw global grid beyond board edges - -Fix: shift+tab: translate left-tab back to tab, shift is handled by the core - -Fix: when popping up the log window for a Message(), don't raise it so focus is not stolen (especially if it's already up) - -Fix: when the main window is closed while the command entry main loop is running, quit the CLI main loop first, so the Quit action can execute and break the outer main loop of the GUI - -Fix: mark the PCB changed when the route style changes so it's saved - -Add: a delete option to the route style selector - -Add: explicit route style (pen style) for sizes diverged from any known style - -Add: finish gtk preferences dialog's "Config PoV" subtree - -Add: "save as" dialog with file format widget - -Add: remember preferences tree expansion and other states when the dialog box needs to be rebooted - -Add: implement fullscreen mode - -Add: local grid implementation: optionally draw grid only in a small radius around the crosshair instead of on the whole screen (speeds up sw rendering on large screen) - -Add: global grid can be sparse (drawing every Nth grid point only); min distance is a configuration item - -Change: match gtk status line style with elegant lesstif status line - - [scconfig] - -Fix: use generic code for plugin vs. plugin dependencies, deps are coded as data - -Fix: various portability fixes for a working IRIX port - -Add: revtest and revision stamps - this tool will let Makefile automatically request the user to reconfigure - -Add: central distclean cleans src_3rd/ - -Add: --workaround-* system, with a gtk-ctrl workaround - -Add: new cli arg for mass-enabling/disabling all plugins: --all=* - - [core] - -Fix: hid input mouse scroll mixup: up and down were for scroll but left and right were for buttons. Prefix all scroll names with "scroll" (fixes macos pan-zoom-select bug) - -Fix: cancel on "new pcb" makes sure PCB never ends up NULL; worst case it tries to create an empty PCB to fall back on or exits with a fatal error if even that fails - -Fix: funchash should be case-insensitive (case insensitive actions and params) - -Fix: introduce pcb_cardinal_t instead of redeclaring X's Cardinal - -Fix: cursor position is Coord, not long - long won't work on 64 bit coords - -Fix: initialize builtins before loading plugins so later buildin <-> plugin collision can be resolved by not loading the plugin - -Fix: full-polygons are sensitive when clicked on the "clipped away" part - -Fix: non-refactored line drc enforcement - -Fix: qsort cmp function return value bug - wrong ordering of sources for the merge - -Add: RouteStyle() action accepts style name, not only index - -Add: action, change and undo code for chaning arc radii (width and height really) and start/delta angles - -Add: new, future-proof layer API, phasing out the old API - -Add: close polygon if the user clicks twice on the same point ('doubleclick'; like with the line tool; thanks to hzeller) - -Add: message log entries have severity levels; user can configure color and whether the message log should pop up for each severity - -Add: pcb-printf %mH prints human readable metric or imperial coords - -Add: inhibit draw counter: when moving an element with all rubber bands (e.g. netlists) attached, inhibit redraw them individually, redraw only once, at the end - -Add: reenable signals as detected by scconfig so that emergency save can run on crash - -Change: attribute list in all object types - -Split: layer.[ch] from misc.[ch]; the layer code is large and complex enough to get an own module; it's also in-line with the module-per-object-type idea - - [util] - -Add: workaround script to comment out #warnings in a source file (for real C89 targets) - -Add: gsch2pcb-rnd: warn for old config overriding pcb-rnd search paths - -Add: install gnet pcb forward backend so that import_sch works out of the box - -pcb-rnd 1.1.1 (r2683) -~~~~~~~~~~~~~ - [io_kicad_legacy] - - Add: save paste buffer elements to kicad (legacy) .mod as native format - - [scconfig] - -Change: remove config.manul.h (use scconfig CLI args instead), rename config.auto.h to config.h - -Change: coord type, the corresponding MAX value and abs() function should not be set manually in config.manual.h; ./configure --coord=32 or --coord=64 sets these all, 32 being the default value for now - -Change: move the dot_pcb_rnd setting from manual config header to scconfig (CLI arg) - -Fix: don't attempt to use -rdynamic for compilation, only for linking - -Fix: accept that IS_LNK may not be set (using conditional variable reference) - -Fix: working cross-compilation: proper separation of host and target tools (cp, ln, ar and friends are part of the build system, use the host version) - -Add: ./configure --enable-dmalloc detects dmalloc - -Add: detect dbus and compile the plugin if enabled - -Add: windows port: detect LoadLibrary(), _getcwd()/getwd(), _spawnvp, getpwuid, realpath, rint(), mkdtemp and mkdir/_mkdir - -Cleanup: split up config.auto.h.in: move dbus related item to dbus and gl related items to gtkhid-gl to keep central part plugin-neutral - -Cleanup: stop using HAVE_WHATEVER_H, rahter generate the #includes per function - - [core] - -API change: rtree returns success and optionally sets the number of objects found - this allows the caller to avoid long jumps to stop the search at the first hit - -Fix: action names are case-insensitive again - -Fix: don't crash if select-by-text gets empty name or cancel - -Fix: undo crashes/asserts for updating NULL rtree with selected element text - -Split: huge find.c in smaller files, per topic - -Change: use genregex minilib instead of POSIX regex, for better portability - -Cleanup: remove find.c dead code - -Cleanup: rtree API names return values instead of using 0..1 - -Cleanup: const correctness in EvaluateFileName - -Cleanup: introduce pcb_rnd(), which is a wrapper around rand() (or optionally, random()). rand() is portable, but on some very old system may be weak. - -Cleanup: introduce pcb_strdup() and pcb_strndup() and avoid using non-C89 libc calls - -Cleanup: always provide pcb_mkdir() as a portability wrapper around mkdir; all code should use this instead of mkdir() - -Cleanup: remove #ifdef wrapping of standard C89 header #includes - it's reasonable to assume/require proper C89 support more than 25 years after the standard came out - -Cleanup: a set of unused/obsolete #includes - -Cleanup: convert const.h #defines into enums (for the type, namespace and debugging); also proper name prefixing - -Cleanup: move route-style specific function from action-oriented set.c to object-oriented route-style.c - -Cleanup: rename SwapBuffers to pcb_swap_buffers for proper prefixing (win32 API name collision) - -Add: central function for looking up a routing style using a sparse list of properties - - [gtk] - -Fix: gtk gdk background image drawing: clip for negative pan to avoid artifacts and segfault - -Fix: remember Messages() that are written before the message window is set up and append them in the window when it is already constructed - -Fix: do not crash if there is no route style defined, just go with an empty style section and let the user create new styles - -Fix: rework the win32-workarounds for corss-compiling - -Fix: always update bottom style printout when the style changes, even if there's no matching stock style (thanks to miloh for reporting this) - -Add: a mandatory route style to indicate non-matching types (hidden in the menu) - -Add: optional file format combo box on the save as dialog - -Change: use round radio buttons instead of rectangular toggle buttons for the layer preferences table - on some setups gtk theme made the buttons unreadable - - [mods] - -Add: import plugin API - -Add: new features in the I/O API to support user-selected output format and listing available formats - -Split: move out netlist read from the io plug code to a separate import plugin - -Cleanup: remove edif stub, convert edif to an import plugin - -Cleanup: do not attempt to extract password entries manually in random plugins, use the central user name retrival function - easier to port, heuristics not duplicated - -Cleanup: ps export: get rid of non-portable alloca() - polygrid is used rarely, performance penalty of malloc() should not be a problem - -Cleanup: pcb I/O: do not use non-portable bzero, prefer memset() - -Fix: dbus: if there's no GUI by the time dbus is uninitialized, don't call it - - [doc-rnd] - -Split: move out developer docs from doc-rnd/ to doc-rnd/hacking - -Add: windows cross-compilation notes - -Add: hacking doc for writing importers (incldues a description of the main pcb data structures) - - [conf] - -Fix: gtk gui preferences saves editor/auto_place in the config file - -Fix: gtk preferences' general tab should also save editor/save_in_tmp - - [w32] - -Add: minipack: recipe for pkg-config - -Fix: minipack: calculate output filename for wget so that ?download suffix can be truncated - -Fix: minipack: don't attempt to build pcb-rnd from minipack (policy: minipack builds all deps then we crosscompile pcb-rnd) - -Update: minipack: gd and tiff recipes for newer versions - -pcb-rnd 1.1.0 -~~~~~~~~~~~~~ - [conf] - full rewrite of the config settings subsystem - - Del: settings, color files, preferences - everything is in the conf system from now - - Add: config settings are stored in structured lihata files on different levels - - Add: all config setting are equal - they can be stored in system, user, project or design file - - [core] - cleanup - -Fix: editing text should properly update the rtree - -Fix: Display(PinOrPadName) doesn't use crosshair directly, without checking validity, but uses getxy which asks the user in turn, if the crosshair is invalid - -Fix: ortho draw lines, polys and poly holes did not update last drawn point and generally did not work - - -Cleanup: remove a bunch of excess #includes to reduce the amount of deps - -Cleanup: rename keepaway to clearance; terminology: clearance is copper vs. copper spacing; keepaway is any other spacing - -Cleanup: generic dead-code and compiler warning removal - -Change: menus: make a new Maintenance submenu in the File menu, move printer calibration and library rescan there - - [poly] - bugfix - -Fix: don't xor-overdraw the first line of a poly rubber band while drawing the second line so it doesn't cancel itself out - -Fix: first click of the poly hole is also the first point of the hole - -Fix: reset attached object state after finishing a poly hole so that the second hole doesn't start in invalid state (caused poly duplication) - -Fix: don't let the user start drawing a poly hole if first click is not a poly - -Add: draw assumed closing rubber band line dashed - - [dynstyle] - -Fix: number of styles is not limited anymore (styles is a dynamic vector) - - [res] - -Fix: dynamic menu insertion bug: don't add new level if it is already added - - [mods] - -Fix: report doesn't crash if there's nothing to report - -Add: debug plugin to host core debugging actions so that they can be removed from core - -Add: debug plugin to tmpasm lists - -Add: io_* hooks - native file formats are plugins now - -Change: turn .pcb (.fp) file IO code into plugin io_pcb - -Add: io_pcb can save (CFR_DESIGN) config in the design as attributes - -Add: central infrastructure for per plugin help (usage), plus the help text in each plugin - -Add: fp_rehash() action to trigger a rehash - - [gtk] - -Fix: double-zoom GUI lockup, pan+scroll wheel lockup - -Fix: shift+mouse click should work - -Fix: preferences window now easily fit in 800x600 - -Fix: don't destroy the tooptip timer when it destroys itself - fixes the famous tooltip glib warning - -Fix: gtk warning/assert introduced by r1439: toolbar can not be a vbox, the parent vbox needs to be tracket separately - -Fix: abs() handling with non-int types - more proper handling of coords on corner cases like tiny objects (contributed by Chris Smith) - -Cleanup: dialog titles should be pcb-rnd, not PCB - -Add: properly remember window positions and sizes, save and reload them if the user enabled the feature - - [scconfig] - -Fix: really compile if there's no glib installed and no glib-dependent plugin selected - -Fix: remove m4 bin from config.h template - no code uses this anymore; do not even detect m4, it's not needed anywhere - -Fix: reorder link command for the main executable so that libs end up at the end of the link list (some linkers are sensitive to this) - -Fix: various random fixes for a mac port - -Del: hid.conf: not needed anymore, hid types are managed differently - -Cleanup: C89 always has atexit() and there's no on_exit - -Add: --debug (that shoudl enable asserts and -g) and a tmpasm script to set cflags accordingly - -Add: detect gettext if intl is requested - -Add: detect bison/flex (with an option to disable it) - -pcb-rnd 1.0.10 -~~~~~~~~~~~~~~ - [res] - resource->lihata conversion - -Add: new action: CreateMenu() - -Add: centralized hid keyboard handling API - -Add: optional: a gtk-clone multi-key capable menu file that copies gschem's hotkeys mostly - -Change: remove res parser, use lihata instead; affected plugins: hid_gtk, hid_lesstif, vendordrill - -API CHANGE: dynamic create menu call API takes a string path, not an already splitted array - -Update: keylist html generator util works from lihata and handles multikey - -Fix: remove hardwired layer selection key bindings, use configured hotkeys (alternative menu files may want to use the same keys differently, hardwired keys are bad) - - [library_t] - library data structure cleanup/rewrite - - Change: replace MenuEntry and related code to a library_t - - Add: allow a generic tree representation in footprint library - - [reduce] - reduce code size without losing actual functionality - -Del: extern "C": pcb is a pure C project, if someone wants to include headers from whatever other language, he should take care of it on that side - -API CHANGE: rewrite action_funchash to not use custom local hash but genht and to offer cookie based namespaces for modules - -Cleanup: rename action_funclist to funchash_core_list to decouple functions from actions - - [scconfig] - -Fix: scconfig/build doesnt' fail even if lesstif is not installed - -Fix: do not attempt to detect libgtk is the gtk hid is disabled - -Fix: don't detect gd if it's not needed; disable exporters that depend on GD if required parts are not available - -Fix: relax gcode/nelma png requirements: print a warning about reduced functionality but let them compile if there's no png but gd is present - -Fix: get the dep file sorted by target; this should avoid unintended changes introduced by unordered lists - -Change: split up the tmpasm list of modules so that it's easier to get gsch2pcb link again using whatever backend plugins - -Cleanup: move strflags test code to regression/ - -Change: portability, realpath are compat_*; compat.[ch] split to _dl and _misc - -Move: remove Makefile.in.mod, move module tmpasm files to src_plugins/ - -Add: detect libstroke and compile with the right cflags and ldflags - -Add: tool to quote files into C strings; generate compiled-in, C versions of the new lht menu files, per hid - - [mods] - -Add: API to remove functions by cookie - -Add: print warning if a module leaves anything in the func hash at exit - -Add: infrastructure for switching from one gui to another - -Add: fp_wget: web based footprint implementation, gedasymbols.org integration - -Move: command.[ch] to a shorthand command plugin (shand_cmd) - -Move: report to a feature plugin - -Move: fp_fs plugin: separate footprint code from file.[ch] - -Move: move debug actions from lesstif to comomn "oldactions" as they are not GUI-dependant and might be generally useful - -Move: hid/common/ to core hid_*, split up large, random collections of functions by purpose - -Move: split and rename action.[ch] to make room for hid-common actions.[ch] in core and avoid confusion in names; rename actions.h to hid_actions.h for naming consistency - -Move: HIDs to plugins, removing the hid/ directory - -Move: hidgl to a separate plugin (to be compiled later) - -Fix: event unbind shouldn't segfault if multiple adjacent events are free'd - -Fix: event_bind() takes cookie as const char *, not as void * to comform the convention - -Fix: hids install and uninstall actions, flags and attributes only around their do_export main loop so they don't conflict - - [leak] - cleaning up memory leaks - -Add: hid attribute remove by cookie - -Fix: lesstif and gtk hids remove their attributes - -Fix: vendordrill free()s all cache memory used when the cache is discarded - - [gtk] - -Fix: make sure menubar is always wide enough to expose all buttons (using a hidden invisible hbox of calculated size) - -Add: copy accel key menuitems from gschem and take over keyboard handling; hid_gtk now supports multi-key hotkeys - -Add: set tooltip on menu items - -Add: include all hotkeys in the tooltip for submenus - - [lesstif] - -Del: remove dumpkeys action/code: this info should be extracted from the lihata file - -Fix: there should be no global variable named 'n' in lesstif; make the stdarg thing a bit more robust and reusable - -Add: reenable code to set set menu font and color - - [core] - -Fix: draw_pad() used uninitialized pad color - -Add: SwitchHID action to change the HID module on the fly (works partially) - - [png] - -Fix: png max dpi should be 10k - modern printers easily do 2400 but some models are said to do 9600 DPI in one direction - - [gpmi] - -Fix: auto-copy .so files to src's plugin dir on compile so that running from source always has the latest .so files - - -pcb-rnd 1.0.9 -~~~~~~~~~~~~~ - [unglib] - -Fix: replace glib with minilibs in core and util/ - -Del: remove local dynamic string implementation in favor of genvector - -Move: vector.[ch] is used only by the autorouter, move it there - - [scconfig] - -Add: print warnings if glib is not found and selected components need to be left out - -Add: repeate some of the critical messages below the summary - -Fix: compiler warnings - -Fix: instead of two booleans, implement a 3-state "/controls" node with values disable, buildin, plugin for the plugins - -Change: better module summary printout at the end of ./configure - -Fix: use -fPIC on x86_64 to make sure plugins link - -Fix: gpmi plugin installation bugs - -Fix: src/plugin is cleaned on make clean - - [leak] - -API CHANGE: plugin init should return a pointer to the plugin uninit function - -Fix: a bunch of random memory leaks - -Fix: a bunch of potential buffer overruns - -Add: central infrastructure for uninit'ing GUI hids - -Fix: missing closedir() - -Add: uninit paste buffers - -Add: actions, flags and attributes are registered with a cookie so they an be deleted by cookie - -Fix: uninit plugins before hids so they have a chance to clean up registrations - -Fix: don't use dynamic strings where printing quoted string directly to a file would work - - [mods] - -Change: convert the ps and lpr exporters into configurable exporter plugins - -Rename: edif plugin to import_edif for consistency - -Change: move gcode and nelma from hid to plugin - -Move: gerber, bom and png to expoter plugins - -Cleanup: move old/unused/legacy functions to a new plugin called legacy_func - -Change: move fontmode to a separate plugin - - [core] - -Change: use a hash for flag storage - faster and simpler code - - [gpmi] - -Add: expotert hid callback for filled pad exporting - -pcb-rnd 1.0.8 -~~~~~~~~~~~~~ - [doc-rnd] - -Add: djopt examples - - [mods] - -Cleanup: split up action.c and spread the code in core and plugins - -Move: action pscalib() to the ps hid code - -Move: autoplace to a core plugin - -Move: autoroute to a core plugin - -Move: dbus to a defunct core plugin - -Move: djopt to a core plugin - -Move: edif to a core plugin - -Move: gpmi to a core plugin - -Move: import_sch to a core plugin - -Move: mincut to a core plugin - -Move: oldactions to a core plugin - -Move: puller to a core plugin - -Move: renumber to a core plugin - -Move: stroke to a core plugin - -Move: toporouter to a core plugin - -Move: vendordrill to a core plugin - - [ba] - -Add: when applying patches to the edited netlist, create missing nets - (new connections may implicitly define new nets) - -Fix: get the renumber action() fixed - -Fix: enable net(add,net,pin) action again and make it operate on the - edited netlist for the back annotation to take notes of the - changes made - - [libstroke] - -Add: menu in the gtk hid's res to toggle stroke enable - -Fix: osolete calls in libstroke action - libstroke support compiles now - -Fix: get the gtk gui call the central crosshair move event handler - instead of reproducing its code locally (... without libstroke) - - [util] - -Add: make clean - -Fix: compiler warnings, mostly unused vars in gsch2pcb - -Cleanup: indentation in gsch2pcb - - -pcb-rnd 1.0.7 -~~~~~~~~~~~~~ - -Cleanup: src/ should compile in c89 - no more // comments and variables declared in for() - -Cleanup: const correctness in src/ - -Cleanup: missing #includes in src/ - -Cleanup: unified, tab based indentation all over src/ - -Cleanup: move dmalloc include to central config.h - -Cleanup: move gts to src/3rd - -Cleanup: remove old/obsolete files inherited from the fork - -Cleanup: rename doc/ to doc-orig/ to avoid confusion and make it compile - -Fix: poly pin bounding box calculation adds clearance as rtree expects ([square]) - -Fix: loading default.pcb shouldn't override cursor pos and board sizes and shoudln't cause file date to be changed in the gui hids since it is loading a "misc" file - -Add: README in each main directory to explain what the directory is for - -pcb-rnd 1.0.6 -~~~~~~~~~~~~~ - [cycdrag] - -Add: "negative sized" selection selects anything that touches - -Add: cycle drag object action - - [scconfig] - -Fix: toporouter Makefile module adds its own action registration code, - so the central Makefile is independent of toporouter - -Add: --disable-toporouter - -Fix: use cc/cc for c compiler (so that it can be overridden) - -Fix: remove -std=gnu99: -std=c99 breaks with new gcc and -std is not - really portable - -Fix: include genht before glib.h because glib.h ruins inline - - [pinnum] - -Add: action and key binding for changing pin numbers in a footprint - - [gpmi] - -Fix: typo in hotkey name for manage plugins (reported by Bert Timmerman) - - [util] - -Fix: keylist: tolerate whitepsace in key sequences - -Fix: keylist resets locale to avoid broken table when gawk tries to - be too clever - - -pcb-rnd 1.0.5 -~~~~~~~~~~~~~ - [onpoint] - -Add: Robert Drehmel's on-point patch adapted for pcb-rnd - - [scconfig] - -Fix: properly configure and build and install even if there's space - in the source path (thanks to Jason White) - -Fix: take genht from the local copy, don't depend it being installed - -pcb-rnd 1.0.4 -~~~~~~~~~~~~~ - [ba] - -Add: back annotation - - [core] - -Fix: suppress no-font error message while loading default.pcb - the actual font is coming from the default font file - - [pcblib-param] - -Add: screw(), low level - -Fix: typo in the help of rcy() - - [mincut] - -Fix: solve debug works again - -Fix: make debug pngs during load optional - -Fix: don't use function-in-function - that's a gcc-specific feature - -Fix: don't use alloca(), use malloc() (C99) - -Add: Makefile to test against known refs - - [pcb-fp] - -Fix: gtk lib window tag print doesn't segfault if there are no tags for a footprint - -Del: local hash and library search implementation for footprint names in buffer.c - libpcb_fp should handle this - -pcb-rnd 1.0.3 -~~~~~~~~~~~~~ - [gpmi] - -Add: GPMI plugin/buildin for scripiting (import of project pcb-gpmi) - - [tostyle] - -Add: new feature to adjust the sizes of object(s) to the values of the current routing style - - [pcb-fp] - -Add: support for parsing and caching footprint tags (file elements) - -Add: the gtk HID displays tags - -Add: the gtk HID can filter for tags - - [pcblib-param] - -Add: bga() - -Add: generic qf() generator - -Add: qfn() - based on qf() - -Add: qfp() - based on qf() - -Add: plcc() - based on qf() - -Add: qsop() - based on so() - -Add: silkmark: accept multiple values - -Add: silkmark: can be external - -Add: silkmark: new styles exteranl45, dot, circle, and arc - -Add: connector() has a sequence option to change pin numbering - -Add: some tunings for connector sequence=zigzag to do something usable with etrunc=1 - - [hid] - -Add: dynamic menus: create_menu(), menu paths, runtime insertion of menus in core - -Add: dynamic menus in gtk - -Add: dynamic menus in lesstif - -Fix: more const correctness in dialog box code - - [scconfig] - -Add: ./configure --help - -Add: print configuration summary at the end - -Add: autodetect HOST (use sys/sysid) - -Add: src/3rd for central hosting of 3rd party software libs - -Add: support "buildins": plugins built into the code - -Change: move genht to src/3rd; policy: prefer genht over glib hash - -Fix: tests try to run pcb-rnd, not pcb - -Fix: central LDFLAGS and CFLAGS should contain the ldflags/cflags detected for generic use - - [pcb-mincut] - -Merge: pcb-mincut is imported in pcb-rnd, the extern repo will be removed - - [core] - -Add: event subsystem - -Add: gui_init event - -Add: generic plugin support: track plugins loaded, have a menu for managing them - -Add: more accessors to query unit details - for the gpmi scripts - -Add: pcb-printf %mI prints coordinate in internal coord format - -Add: calls for removing actions - -Add: calls for removing a hid (useful for removing exporter hids registered by scripts) - -Add: path resolution: support ~ in paths - -Add: real regex search and real string list search (in search by name actions) - -Change: switch over actions from bsearch() to a genht hash - simpler code, potentially also faster - -Fix: don't allow the registration of an action with a name that's already registered - - - [fp2anim] - -Add: optional dimension lines - -Add: more fine grained annotation control - -Change: switch over to vector fonts for better scaling - -Fix: draw rounded pads (new pad syntax only) - -Fix: make sure to generate sane arcs - - [doc-rnd] - -Add: official central key list - -pcb-rnd 1.0.2 -~~~~~~~~~~~~~ - [pcblib-param] - -Fix: central bool handling (connector() etrunc), values: on/off, true/false, 1/0 - -Fix: typo in so() parameter descriptions - -Fix: connector() typo in error() - -Add: more elaborate help syntax: easier to read with scripts - - [fp2anim] - -Fix: read multiline directives properly - a newline after each directive is still needed, tho - -Fix: allow whitepsace between directive name and opening bracket - -Fix: create all layers in advance - this fixes the case when the fp doesn't draw on some layers (the macro still exists) - -Fix: rline() is extended by width/2 if there are no rounding; it seems this how pcb defines lines - -Fix: leave extra margin in photo mode for the 3d edges - -Add: support for old-style pad() - -Add: support for Mark() (relocate the diamond) - -Add: options to turn off the grid and annotation - useful for thumbnails - - [scconfig] - -Fix: always have config.h, don't ifdef it - -Fix: glib is a core dependency that should be added even if the gtk hid is not used - -Fix: make clean removes pcb-rnd, not pcb (executable file name typo) - -Add: make clean in util/ - -Add: options to disable gd and/or jpeg or png or gif - -Add: be able to detect and configure lesstif - -Add: --disable-gtk and --disable-lesstif; --disable-xinerama and --disable-xrender for lesstif - -Add: use detected -rdynamic so that plugins can link against the executable - -Change: detect both gtk and lesstif as optional dependencies - -Cleanup: generate hidlist.h from tmpasm instead of shell to remove shell dependency - -Del: a bunch of obsolete #defines inherited from auto* - - [core] - -Add: --gui explicitly selects a gui hid - -Add: don't leave preferred order of GUIs to the chance, make it explicit - - -pcb-rnd 1.0.1 -~~~~~~~~~~~~~ - [core] - -Fix: don't read beyond the common part of the struct in IsPointInPad (since it's called for lines too, and those have much less fields) - -Fix: where stdarg is avaialble, also print messages to stderr - useful if things go wrong before a GUI is working - - [gtk] - -Fix: don't crash but write error message and exit if gpcb-menu.res is empty - - [square] - -Fix: 90 deg rotation rotates shape style - -Add: action.c and change.c code to get shaped vias - -Fix: don't change pin shape for square and octagon in rotation - - [mincut] - -Add: command line setting --enable-mincut (0 or 1) as mincut can be slow - it is a global disbale setting and make a local, per pcb setting - for enabling mincut; also add a per pcb setting/flag - -Fix: disable debug draw by default - -Fix: fall back to the old short warn method when mincut fails - -Fix: avoid segfaults by detecting broken graph early - -Workaround: if mincut sees a graph with multiple unconnected components, doesn't try to solve but falls back to randomly highlight something - - [intconn] - -Workaround: find intconn pads only on the same layer - - [nonetlist] - -Workaround: ignore nonetlist pads even if the flag is in the element name - - [scconfig] - -Add: scconfig/ - switch over from autotools to scconfig - - [pcblib] - -Cleanup: new, trimmed back pcblib/ with essential footprints only - - [pcblib-param] - -Add: new parametric footprints - no more m4-hardwiring, use your - preferred language! - -Add: acy(), alf(), rcy(), connector(), dip() - -Add: so(), tssop(), msop(), ssop() - - [pcb-fp] - -Add: central lib for footprint search and load in pcb and gsch2pcb - - [util] - -Add: gsch2pcb fork to support [nonetlist] and [pcblib-param] - - [fp2anim] - -Add: fp to animator script for fast preview - - [polygrid] - -Add: ps output: draw grid in polys instead of fill (doesn't fully work) - -Fix: set proper max value so the control is enabled - - - [debian] - -Update: build the package with scconfig and footprint changes - - -pcb-rnd 1.0.0 -~~~~~~~~~~~~~ - [square] -Add: initial implementation - [intconn] -Add: initial implementation - [nonetlist] -Add: initial implementation - [flagcomp] -Add: initial implementation - [mincut] -Add: initial implementation Index: 1.1.4/src/set.h =================================================================== --- 1.1.4/src/set.h (revision 10776) +++ 1.1.4/src/set.h (nonexistent) @@ -1,50 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for update routines */ - -#ifndef PCB_SET_H -#define PCB_SET_H - -#include "global.h" - -void SetTextScale(int); -void SetGrid(Coord, pcb_bool); -void SetZoom(double); -void SetLineSize(Coord); -void SetViaSize(Coord, pcb_bool); -void SetViaDrillingHole(Coord, pcb_bool); -void SetClearanceWidth(Coord); -void SetChangedFlag(pcb_bool); -void SetBufferNumber(int); -void SetMode(int); -void SetCrosshairRangeToBuffer(void); -void SetLocalRef(Coord, Coord, pcb_bool); -void RedrawZoom(Coord, Coord); -void SaveMode(void); -void RestoreMode(void); - -#endif Index: 1.1.4/src/plug_footprint_act.c =================================================================== --- 1.1.4/src/plug_footprint_act.c (revision 10776) +++ 1.1.4/src/plug_footprint_act.c (nonexistent) @@ -1,45 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * This module, was written and is Copyright (C) 2016 by Tibor Palinkas - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "config.h" -#include "global.h" -#include "hid.h" -#include "plug_footprint.h" - -static const char fp_rehash_syntax[] = "fp_rehash()" ; -static const char fp_rehash_help[] = "Flush the library index; rescan all library search paths and rebuild the library index. Useful if there are changes in the library during a pcb-rnd session."; -static int Action_fp_rehash(int argc, const char **argv, Coord x, Coord y) -{ - fp_rehash(); - return 0; -} - - -HID_Action conf_plug_footprint_list[] = { - {"fp_rehash", 0, Action_fp_rehash, - fp_rehash_help, fp_rehash_syntax} -}; - -REGISTER_ACTIONS(conf_plug_footprint_list, NULL) Index: 1.1.4/src/hid_color.c =================================================================== --- 1.1.4/src/hid_color.c (revision 10776) +++ 1.1.4/src/hid_color.c (nonexistent) @@ -1,41 +0,0 @@ -#include "config.h" -#include "global.h" -#include "hid_color.h" -#include -#include "compat_misc.h" - -static hidval invalid_color = { 0 }; - -#define HT_HAS_CONST_KEY -typedef char *htsh_key_t; -typedef const char *htsh_const_key_t; -typedef hidval htsh_value_t; -#define HT_INVALID_VALUE invalid_color -#define HT(x) htsh_ ## x -#include -#include -#undef HT - - -int hid_cache_color(int set, const char *name, hidval * val, void **vcache) -{ - htsh_t *cache; - htsh_entry_t *e; - - cache = (htsh_t *) * vcache; - if (cache == 0) { - cache = htsh_alloc(strhash, strkeyeq); - *vcache = cache; - } - - if (!set) { /* read */ - e = htsh_getentry(cache, (char *)name); - if (e == NULL) /* not found */ - return 0; - memcpy(val, &e->value, sizeof(hidval)); - } - else - htsh_set(cache, pcb_strdup(name), *val); /* write */ - - return 1; -} Index: 1.1.4/src/hid_color.h =================================================================== --- 1.1.4/src/hid_color.h (revision 10776) +++ 1.1.4/src/hid_color.h (nonexistent) @@ -1,13 +0,0 @@ -#ifndef PCB_HID_COLOR_H -#define PCB_HID_COLOR_H - -/* HID internal interfaces. These may ONLY be called from the HID - modules, not from the common PCB code. */ - -/* Used to cache color lookups. If set is zero, it looks up the name - and if found sets val and returns nonzero. If not found, it - returns zero. If set is nonzero, name/val is added to the - cache. */ -int hid_cache_color(int set, const char *name, hidval * val, void **cache); - -#endif Index: 1.1.4/src/rats.c =================================================================== --- 1.1.4/src/rats.c (revision 10776) +++ 1.1.4/src/rats.c (nonexistent) @@ -1,921 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * This module, rats.c, was written and is Copyright (C) 1997 by harry eaton - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* rats nest routines */ - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include - -#include "create.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "find.h" -#include "misc.h" -#include "layer.h" -#include "polygon.h" -#include "rats.h" -#include "search.h" -#include "undo.h" -#include "stub_mincut.h" -#include "route_style.h" -#include "compat_misc.h" -#include "netlist.h" - -#define TRIEDFIRST 0x1 -#define BESTFOUND 0x2 - -/* --------------------------------------------------------------------------- - * some forward declarations - */ -static pcb_bool FindPad(const char *, const char *, ConnectionType *, pcb_bool); -static pcb_bool ParseConnection(const char *, char *, char *); -static pcb_bool DrawShortestRats(NetListTypePtr, - void (*)(register ConnectionTypePtr, register ConnectionTypePtr, register RouteStyleTypePtr)); -static pcb_bool GatherSubnets(NetListTypePtr, pcb_bool, pcb_bool); -static pcb_bool CheckShorts(LibraryMenuTypePtr); -static void TransferNet(NetListTypePtr, NetTypePtr, NetTypePtr); - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static pcb_bool badnet = pcb_false; -static pcb_cardinal_t SLayer, CLayer; /* layer group holding solder/component side */ - -/* --------------------------------------------------------------------------- - * parse a connection description from a string - * puts the element name in the string and the pin number in - * the number. If a valid connection is found, it returns the - * number of characters processed from the string, otherwise - * it returns 0 - */ -static pcb_bool ParseConnection(const char *InString, char *ElementName, char *PinNum) -{ - int i, j; - - /* copy element name portion */ - for (j = 0; InString[j] != '\0' && InString[j] != '-'; j++) - ElementName[j] = InString[j]; - if (InString[j] == '-') { - for (i = j; i > 0 && ElementName[i - 1] >= 'a'; i--); - ElementName[i] = '\0'; - for (i = 0, j++; InString[j] != '\0'; i++, j++) - PinNum[i] = InString[j]; - PinNum[i] = '\0'; - return (pcb_false); - } - else { - ElementName[j] = '\0'; - Message(PCB_MSG_DEFAULT, _("Bad net-list format encountered near: \"%s\"\n"), ElementName); - return (pcb_true); - } -} - -/* --------------------------------------------------------------------------- - * Find a particular pad from an element name and pin number - */ -static pcb_bool FindPad(const char *ElementName, const char *PinNum, ConnectionType * conn, pcb_bool Same) -{ - ElementTypePtr element; - gdl_iterator_t it; - PadType *pad; - PinType *pin; - - if ((element = SearchElementByName(PCB->Data, ElementName)) == NULL) - return pcb_false; - - padlist_foreach(&element->Pad, &it, pad) { - if (NSTRCMP(PinNum, pad->Number) == 0 && (!Same || !TEST_FLAG(PCB_FLAG_DRC, pad))) { - conn->type = PCB_TYPE_PAD; - conn->ptr1 = element; - conn->ptr2 = pad; - conn->group = TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SLayer : CLayer; - - if (TEST_FLAG(PCB_FLAG_EDGE2, pad)) { - conn->X = pad->Point2.X; - conn->Y = pad->Point2.Y; - } - else { - conn->X = pad->Point1.X; - conn->Y = pad->Point1.Y; - } - return pcb_true; - } - } - - padlist_foreach(&element->Pin, &it, pin) { - if (!TEST_FLAG(PCB_FLAG_HOLE, pin) && pin->Number && NSTRCMP(PinNum, pin->Number) == 0 && (!Same || !TEST_FLAG(PCB_FLAG_DRC, pin))) { - conn->type = PCB_TYPE_PIN; - conn->ptr1 = element; - conn->ptr2 = pin; - conn->group = SLayer; /* any layer will do */ - conn->X = pin->X; - conn->Y = pin->Y; - return pcb_true; - } - } - - return pcb_false; -} - -/*-------------------------------------------------------------------------- - * parse a netlist menu entry and locate the corresponding pad - * returns pcb_true if found, and fills in Connection information - */ -pcb_bool SeekPad(LibraryEntryType * entry, ConnectionType * conn, pcb_bool Same) -{ - int j; - char ElementName[256]; - char PinNum[256]; - - if (ParseConnection(entry->ListEntry, ElementName, PinNum)) - return (pcb_false); - for (j = 0; PinNum[j] != '\0'; j++); - if (j == 0) { - Message(PCB_MSG_DEFAULT, _("Error! Netlist file is missing pin!\n" "white space after \"%s-\"\n"), ElementName); - badnet = pcb_true; - } - else { - if (FindPad(ElementName, PinNum, conn, Same)) - return (pcb_true); - if (Same) - return (pcb_false); - if (PinNum[j - 1] < '0' || PinNum[j - 1] > '9') { - Message(PCB_MSG_DEFAULT, "WARNING! Pin number ending with '%c'" - " encountered in netlist file\n" "Probably a bad netlist file format\n", PinNum[j - 1]); - } - } - Message(PCB_MSG_DEFAULT, _("Can't find %s pin %s called for in netlist.\n"), ElementName, PinNum); - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * Read the library-netlist build a pcb_true Netlist structure - */ - -NetListTypePtr ProcNetlist(LibraryTypePtr net_menu) -{ - ConnectionTypePtr connection; - ConnectionType LastPoint; - NetTypePtr net; - static NetListTypePtr Wantlist = NULL; - - if (!net_menu->MenuN) - return (NULL); - FreeNetListMemory(Wantlist); - free(Wantlist); - badnet = pcb_false; - - /* find layer groups of the component side and solder side */ - SLayer = GetLayerGroupNumberByNumber(solder_silk_layer); - CLayer = GetLayerGroupNumberByNumber(component_silk_layer); - - Wantlist = (NetListTypePtr) calloc(1, sizeof(NetListType)); - if (Wantlist) { - ALLPIN_LOOP(PCB->Data); - { - pin->Spare = NULL; - CLEAR_FLAG(PCB_FLAG_DRC, pin); - } - ENDALL_LOOP; - ALLPAD_LOOP(PCB->Data); - { - pad->Spare = NULL; - CLEAR_FLAG(PCB_FLAG_DRC, pad); - } - ENDALL_LOOP; - MENU_LOOP(net_menu); - { - if (menu->Name[0] == '*' || menu->flag == 0) { - badnet = pcb_true; - continue; - } - net = GetNetMemory(Wantlist); - if (menu->Style) { - int idx = pcb_route_style_lookup(&PCB->RouteStyle, 0, 0, 0, 0, menu->Style); - if (idx >= 0) - net->Style = PCB->RouteStyle.array+idx; - } - else /* default to NULL if none found */ - net->Style = NULL; - ENTRY_LOOP(menu); - { - if (SeekPad(entry, &LastPoint, pcb_false)) { - if (TEST_FLAG(PCB_FLAG_DRC, (PinTypePtr) LastPoint.ptr2)) - Message(PCB_MSG_DEFAULT, _ - ("Error! Element %s pin %s appears multiple times in the netlist file.\n"), - NAMEONPCB_NAME((ElementTypePtr) LastPoint.ptr1), - (LastPoint.type == - PCB_TYPE_PIN) ? ((PinTypePtr) LastPoint.ptr2)->Number : ((PadTypePtr) LastPoint.ptr2)->Number); - else { - connection = GetConnectionMemory(net); - *connection = LastPoint; - /* indicate expect net */ - connection->menu = menu; - /* mark as visited */ - SET_FLAG(PCB_FLAG_DRC, (PinTypePtr) LastPoint.ptr2); - if (LastPoint.type == PCB_TYPE_PIN) - ((PinTypePtr) LastPoint.ptr2)->Spare = (void *) menu; - else - ((PadTypePtr) LastPoint.ptr2)->Spare = (void *) menu; - } - } - else - badnet = pcb_true; - /* check for more pins with the same number */ - for (; SeekPad(entry, &LastPoint, pcb_true);) { - connection = GetConnectionMemory(net); - *connection = LastPoint; - /* indicate expect net */ - connection->menu = menu; - /* mark as visited */ - SET_FLAG(PCB_FLAG_DRC, (PinTypePtr) LastPoint.ptr2); - if (LastPoint.type == PCB_TYPE_PIN) - ((PinTypePtr) LastPoint.ptr2)->Spare = (void *) menu; - else - ((PadTypePtr) LastPoint.ptr2)->Spare = (void *) menu; - } - } - END_LOOP; - } - END_LOOP; - } - /* clear all visit marks */ - ALLPIN_LOOP(PCB->Data); - { - CLEAR_FLAG(PCB_FLAG_DRC, pin); - } - ENDALL_LOOP; - ALLPAD_LOOP(PCB->Data); - { - CLEAR_FLAG(PCB_FLAG_DRC, pad); - } - ENDALL_LOOP; - return (Wantlist); -} - -/* - * copy all connections from one net into another - * and then remove the first net from its netlist - */ -static void TransferNet(NetListTypePtr Netl, NetTypePtr SourceNet, NetTypePtr DestNet) -{ - ConnectionTypePtr conn; - - /* It would be worth checking if SourceNet is NULL here to avoid a segfault. Seb James. */ - CONNECTION_LOOP(SourceNet); - { - conn = GetConnectionMemory(DestNet); - *conn = *connection; - } - END_LOOP; - DestNet->Style = SourceNet->Style; - /* free the connection memory */ - FreeNetMemory(SourceNet); - /* remove SourceNet from its netlist */ - *SourceNet = Netl->Net[--(Netl->NetN)]; - /* zero out old garbage */ - memset(&Netl->Net[Netl->NetN], 0, sizeof(NetType)); -} - -static pcb_bool CheckShorts(LibraryMenuTypePtr theNet) -{ - pcb_bool newone, warn = pcb_false; - PointerListTypePtr generic = (PointerListTypePtr) calloc(1, sizeof(PointerListType)); - /* the first connection was starting point so - * the menu is always non-null - */ - void **menu = GetPointerMemory(generic); - - *menu = theNet; - ALLPIN_LOOP(PCB->Data); - { - ElementType *e = pin->Element; -/* TODO: should be: !TEST_FLAG(PCB_FLAG_NONETLIST, (ElementType *)pin->Element)*/ - if ((TEST_FLAG(PCB_FLAG_DRC, pin)) && (!(e->Flags.f & PCB_FLAG_NONETLIST))) { - warn = pcb_true; - if (!pin->Spare) { - Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to %s pin %s\n"), - &theNet->Name[2], UNKNOWN(NAMEONPCB_NAME(element)), UNKNOWN(pin->Number)); - stub_rat_found_short(pin, NULL, &theNet->Name[2]); - continue; - } - newone = pcb_true; - POINTER_LOOP(generic); - { - if (*ptr == pin->Spare) { - newone = pcb_false; - break; - } - } - END_LOOP; - if (newone) { - menu = GetPointerMemory(generic); - *menu = pin->Spare; - Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to net \"%s\"\n"), - &theNet->Name[2], &((LibraryMenuTypePtr) (pin->Spare))->Name[2]); - stub_rat_found_short(pin, NULL, &theNet->Name[2]); - } - } - } - ENDALL_LOOP; - ALLPAD_LOOP(PCB->Data); - { - ElementType *e = pad->Element; -/* TODO: should be: !TEST_FLAG(PCB_FLAG_NONETLIST, (ElementType *)pad->Element)*/ - if ((TEST_FLAG(PCB_FLAG_DRC, pad)) && (!(e->Flags.f & PCB_FLAG_NONETLIST)) && (!(e->Name->Flags.f & PCB_FLAG_NONETLIST))) { - warn = pcb_true; - if (!pad->Spare) { - Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to %s pad %s\n"), - &theNet->Name[2], UNKNOWN(NAMEONPCB_NAME(element)), UNKNOWN(pad->Number)); - stub_rat_found_short(NULL, pad, &theNet->Name[2]); - continue; - } - newone = pcb_true; - POINTER_LOOP(generic); - { - if (*ptr == pad->Spare) { - newone = pcb_false; - break; - } - } - END_LOOP; - if (newone) { - menu = GetPointerMemory(generic); - *menu = pad->Spare; - Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to net \"%s\"\n"), - &theNet->Name[2], &((LibraryMenuTypePtr) (pad->Spare))->Name[2]); - stub_rat_found_short(NULL, pad, &theNet->Name[2]); - } - } - } - ENDALL_LOOP; - FreePointerListMemory(generic); - free(generic); - return (warn); -} - - -/* --------------------------------------------------------------------------- - * Determine existing interconnections of the net and gather into sub-nets - * - * initially the netlist has each connection in its own individual net - * afterwards there can be many fewer nets with multiple connections each - */ -static pcb_bool GatherSubnets(NetListTypePtr Netl, pcb_bool NoWarn, pcb_bool AndRats) -{ - NetTypePtr a, b; - ConnectionTypePtr conn; - pcb_cardinal_t m, n; - pcb_bool Warned = pcb_false; - - for (m = 0; Netl->NetN > 0 && m < Netl->NetN; m++) { - a = &Netl->Net[m]; - ResetConnections(pcb_false); - RatFindHook(a->Connection[0].type, a->Connection[0].ptr1, a->Connection[0].ptr2, a->Connection[0].ptr2, pcb_false, AndRats); - /* now anybody connected to the first point has PCB_FLAG_DRC set */ - /* so move those to this subnet */ - CLEAR_FLAG(PCB_FLAG_DRC, (PinTypePtr) a->Connection[0].ptr2); - for (n = m + 1; n < Netl->NetN; n++) { - b = &Netl->Net[n]; - /* There can be only one connection in net b */ - if (TEST_FLAG(PCB_FLAG_DRC, (PinTypePtr) b->Connection[0].ptr2)) { - CLEAR_FLAG(PCB_FLAG_DRC, (PinTypePtr) b->Connection[0].ptr2); - TransferNet(Netl, b, a); - /* back up since new subnet is now at old index */ - n--; - } - } - /* now add other possible attachment points to the subnet */ - /* e.g. line end-points and vias */ - /* don't add non-manhattan lines, the auto-router can't route to them */ - ALLLINE_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_DRC, line) - && ((line->Point1.X == line->Point2.X) - || (line->Point1.Y == line->Point2.Y))) { - conn = GetConnectionMemory(a); - conn->X = line->Point1.X; - conn->Y = line->Point1.Y; - conn->type = PCB_TYPE_LINE; - conn->ptr1 = layer; - conn->ptr2 = line; - conn->group = GetLayerGroupNumberByPointer(layer); - conn->menu = NULL; /* agnostic view of where it belongs */ - conn = GetConnectionMemory(a); - conn->X = line->Point2.X; - conn->Y = line->Point2.Y; - conn->type = PCB_TYPE_LINE; - conn->ptr1 = layer; - conn->ptr2 = line; - conn->group = GetLayerGroupNumberByPointer(layer); - conn->menu = NULL; - } - } - ENDALL_LOOP; - /* add polygons so the auto-router can see them as targets */ - ALLPOLYGON_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_DRC, polygon)) { - conn = GetConnectionMemory(a); - /* make point on a vertex */ - conn->X = polygon->Clipped->contours->head.point[0]; - conn->Y = polygon->Clipped->contours->head.point[1]; - conn->type = PCB_TYPE_POLYGON; - conn->ptr1 = layer; - conn->ptr2 = polygon; - conn->group = GetLayerGroupNumberByPointer(layer); - conn->menu = NULL; /* agnostic view of where it belongs */ - } - } - ENDALL_LOOP; - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_DRC, via)) { - conn = GetConnectionMemory(a); - conn->X = via->X; - conn->Y = via->Y; - conn->type = PCB_TYPE_VIA; - conn->ptr1 = via; - conn->ptr2 = via; - conn->group = SLayer; - } - } - END_LOOP; - if (!NoWarn) - Warned |= CheckShorts(a->Connection[0].menu); - } - ResetConnections(pcb_false); - return (Warned); -} - -/* --------------------------------------------------------------------------- - * Draw a rat net (tree) having the shortest lines - * this also frees the subnet memory as they are consumed - * - * Note that the Netl we are passed is NOT the main netlist - it's the - * connectivity for ONE net. It represents the CURRENT connectivity - * state for the net, with each Netl->Net[N] representing one - * copper-connected subset of the net. - */ - -static pcb_bool -DrawShortestRats(NetListTypePtr Netl, - void (*funcp) (register ConnectionTypePtr, register ConnectionTypePtr, register RouteStyleTypePtr)) -{ - RatTypePtr line; - register float distance, temp; - register ConnectionTypePtr conn1, conn2, firstpoint, secondpoint; - PolygonTypePtr polygon; - pcb_bool changed = pcb_false; - pcb_bool havepoints; - pcb_cardinal_t n, m, j; - NetTypePtr next, subnet, theSubnet = NULL; - - /* This is just a sanity check, to make sure we're passed - * *something*. - */ - if (!Netl || Netl->NetN < 1) - return pcb_false; - - /* - * Everything inside the NetList Netl should be connected together. - * Each Net in Netl is a group of Connections which are already - * connected together somehow, either by real wires or by rats we've - * already drawn. Each Connection is a vertex within that blob of - * connected items. This loop finds the closest vertex pairs between - * each blob and draws rats that merge the blobs until there's just - * one big blob. - * - * Just to clarify, with some examples: - * - * Each Netl is one full net from a netlist, like from gnetlist. - * Each Netl->Net[N] is a subset of that net that's already - * physically connected on the pcb. - * - * So a new design with no traces yet, would have a huge list of Net[N], - * each with one pin in it. - * - * A fully routed design would have one Net[N] with all the pins - * (for that net) in it. - */ - - /* - * We keep doing this do/while loop until everything's connected. - * I.e. once per rat we add. - */ - distance = 0.0; - havepoints = pcb_true; /* so we run the loop at least once */ - while (Netl->NetN > 1 && havepoints) { - /* This is the top of the "find one rat" logic. */ - havepoints = pcb_false; - firstpoint = secondpoint = NULL; - - /* Test Net[0] vs Net[N] for N=1..max. Find the shortest - distance between any two points in different blobs. */ - subnet = &Netl->Net[0]; - for (j = 1; j < Netl->NetN; j++) { - /* - * Scan between Net[0] blob (subnet) and Net[N] blob (next). - * Note the shortest distance we find. - */ - next = &Netl->Net[j]; - for (n = subnet->ConnectionN - 1; n != -1; n--) { - conn1 = &subnet->Connection[n]; - for (m = next->ConnectionN - 1; m != -1; m--) { - conn2 = &next->Connection[m]; - /* - * At this point, conn1 and conn2 are two pins in - * different blobs of the same net. See how far - * apart they are, and if they're "closer" than what - * we already have. - */ - - /* - * Prefer to connect Connections over polygons to the - * polygons (ie assume the user wants a via to a plane, - * not a daisy chain). Further prefer to pick an existing - * via in the Net to make that connection. - */ - if (conn1->type == PCB_TYPE_POLYGON && - (polygon = (PolygonTypePtr) conn1->ptr2) && - !(distance == 0 && - firstpoint && firstpoint->type == PCB_TYPE_VIA) && IsPointInPolygonIgnoreHoles(conn2->X, conn2->Y, polygon)) { - distance = 0; - firstpoint = conn2; - secondpoint = conn1; - theSubnet = next; - havepoints = pcb_true; - } - else if (conn2->type == PCB_TYPE_POLYGON && - (polygon = (PolygonTypePtr) conn2->ptr2) && - !(distance == 0 && - firstpoint && firstpoint->type == PCB_TYPE_VIA) && IsPointInPolygonIgnoreHoles(conn1->X, conn1->Y, polygon)) { - distance = 0; - firstpoint = conn1; - secondpoint = conn2; - theSubnet = next; - havepoints = pcb_true; - } - else if ((temp = SQUARE(conn1->X - conn2->X) + SQUARE(conn1->Y - conn2->Y)) < distance || !firstpoint) { - distance = temp; - firstpoint = conn1; - secondpoint = conn2; - theSubnet = next; - havepoints = pcb_true; - } - } - } - } - - /* - * If HAVEPOINTS is pcb_true, we've found a pair of points in two - * separate blobs of the net, and need to connect them together. - */ - if (havepoints) { - if (funcp) { - (*funcp) (firstpoint, secondpoint, subnet->Style); - } - else { - /* found the shortest distance subnet, draw the rat */ - if ((line = CreateNewRat(PCB->Data, - firstpoint->X, firstpoint->Y, - secondpoint->X, secondpoint->Y, - firstpoint->group, secondpoint->group, conf_core.appearance.rat_thickness, NoFlags())) != NULL) { - if (distance == 0) - SET_FLAG(PCB_FLAG_VIA, line); - AddObjectToCreateUndoList(PCB_TYPE_RATLINE, line, line, line); - DrawRat(line); - changed = pcb_true; - } - } - - /* copy theSubnet into the current subnet */ - TransferNet(Netl, theSubnet, subnet); - } - } - - /* presently nothing to do with the new subnet */ - /* so we throw it away and free the space */ - FreeNetMemory(&Netl->Net[--(Netl->NetN)]); - /* Sadly adding a rat line messes up the sorted arrays in connection finder */ - /* hace: perhaps not necessarily now that they aren't stored in normal layers */ - if (changed) { - FreeConnectionLookupMemory(); - InitConnectionLookup(); - } - return (changed); -} - - -/* --------------------------------------------------------------------------- - * AddAllRats puts the rats nest into the layout from the loaded netlist - * if SelectedOnly is pcb_true, it will only draw rats to selected pins and pads - */ -pcb_bool -AddAllRats(pcb_bool SelectedOnly, - void (*funcp) (register ConnectionTypePtr, register ConnectionTypePtr, register RouteStyleTypePtr)) -{ - NetListTypePtr Nets, Wantlist; - NetTypePtr lonesome; - ConnectionTypePtr onepin; - pcb_bool changed, Warned = pcb_false; - - /* the netlist library has the text form - * ProcNetlist fills in the Netlist - * structure the way the final routing - * is supposed to look - */ - Wantlist = ProcNetlist(&(PCB->NetlistLib[NETLIST_EDITED])); - if (!Wantlist) { - Message(PCB_MSG_DEFAULT, _("Can't add rat lines because no netlist is loaded.\n")); - return (pcb_false); - } - changed = pcb_false; - /* initialize finding engine */ - InitConnectionLookup(); - SaveFindFlag(PCB_FLAG_DRC); - Nets = (NetListTypePtr) calloc(1, sizeof(NetListType)); - /* now we build another netlist (Nets) for each - * net in Wantlist that shows how it actually looks now, - * then fill in any missing connections with rat lines. - * - * we first assume each connection is separate - * (no routing), then gather them into groups - * if the net is all routed, the new netlist (Nets) - * will have only one net entry. - * Note that DrawShortestRats consumes all nets - * from Nets, so *Nets is empty after the - * DrawShortestRats call - */ - NET_LOOP(Wantlist); - { - CONNECTION_LOOP(net); - { - if (!SelectedOnly || TEST_FLAG(PCB_FLAG_SELECTED, (PinTypePtr) connection->ptr2)) { - lonesome = GetNetMemory(Nets); - onepin = GetConnectionMemory(lonesome); - *onepin = *connection; - lonesome->Style = net->Style; - } - } - END_LOOP; - Warned |= GatherSubnets(Nets, SelectedOnly, pcb_true); - if (Nets->NetN > 0) - changed |= DrawShortestRats(Nets, funcp); - } - END_LOOP; - FreeNetListMemory(Nets); - free(Nets); - FreeConnectionLookupMemory(); - RestoreFindFlag(); - if (funcp) - return (pcb_true); - - if (Warned || changed) { - stub_rat_proc_shorts(); - Draw(); - } - - if (Warned) - conf_core.temp.rat_warn = pcb_true; - - if (changed) { - IncrementUndoSerialNumber(); - if (ratlist_length(&PCB->Data->Rat) > 0) { - Message(PCB_MSG_DEFAULT, "%d rat line%s remaining\n", ratlist_length(&PCB->Data->Rat), ratlist_length(&PCB->Data->Rat) > 1 ? "s" : ""); - } - return (pcb_true); - } - if (!SelectedOnly && !Warned) { - if (!ratlist_length(&PCB->Data->Rat) && !badnet) - Message(PCB_MSG_DEFAULT, _("Congratulations!!\n" "The layout is complete and has no shorted nets.\n")); - else - Message(PCB_MSG_DEFAULT, _("Nothing more to add, but there are\n" - "either rat-lines in the layout, disabled nets\n" "in the net-list, or missing components\n")); - } - return (pcb_false); -} - -/* XXX: This is copied in large part from AddAllRats above; for - * maintainability, AddAllRats probably wants to be tweaked to use this - * version of the code so that we don't have duplication. */ -NetListListType CollectSubnets(pcb_bool SelectedOnly) -{ - NetListListType result = { 0, 0, NULL }; - NetListTypePtr Nets, Wantlist; - NetTypePtr lonesome; - ConnectionTypePtr onepin; - - /* the netlist library has the text form - * ProcNetlist fills in the Netlist - * structure the way the final routing - * is supposed to look - */ - Wantlist = ProcNetlist(&(PCB->NetlistLib[NETLIST_EDITED])); - if (!Wantlist) { - Message(PCB_MSG_DEFAULT, _("Can't add rat lines because no netlist is loaded.\n")); - return result; - } - /* initialize finding engine */ - InitConnectionLookup(); - SaveFindFlag(PCB_FLAG_DRC); - /* now we build another netlist (Nets) for each - * net in Wantlist that shows how it actually looks now, - * then fill in any missing connections with rat lines. - * - * we first assume each connection is separate - * (no routing), then gather them into groups - * if the net is all routed, the new netlist (Nets) - * will have only one net entry. - * Note that DrawShortestRats consumes all nets - * from Nets, so *Nets is empty after the - * DrawShortestRats call - */ - NET_LOOP(Wantlist); - { - Nets = GetNetListMemory(&result); - CONNECTION_LOOP(net); - { - if (!SelectedOnly || TEST_FLAG(PCB_FLAG_SELECTED, (PinTypePtr) connection->ptr2)) { - lonesome = GetNetMemory(Nets); - onepin = GetConnectionMemory(lonesome); - *onepin = *connection; - lonesome->Style = net->Style; - } - } - END_LOOP; - /* Note that AndRats is *FALSE* here! */ - GatherSubnets(Nets, SelectedOnly, pcb_false); - } - END_LOOP; - FreeConnectionLookupMemory(); - RestoreFindFlag(); - return result; -} - -/* - * Check to see if a particular name is the name of an already existing rats - * line - */ -static int rat_used(char *name) -{ - if (name == NULL) - return -1; - - MENU_LOOP(&(PCB->NetlistLib[NETLIST_EDITED])); - { - if (menu->Name && (strcmp(menu->Name, name) == 0)) - return 1; - } - END_LOOP; - - return 0; -} - - /* These next two functions moved from the original netlist.c as part of the - | gui code separation for the Gtk port. - */ -RatTypePtr AddNet(void) -{ - static int ratDrawn = 0; - char name1[256], *name2; - pcb_cardinal_t group1, group2; - char ratname[20]; - int found; - void *ptr1, *ptr2, *ptr3; - LibraryMenuTypePtr menu; - LibraryEntryTypePtr entry; - - if (Crosshair.AttachedLine.Point1.X == Crosshair.AttachedLine.Point2.X - && Crosshair.AttachedLine.Point1.Y == Crosshair.AttachedLine.Point2.Y) - return (NULL); - - found = SearchObjectByLocation(PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, 5); - if (found == PCB_TYPE_NONE) { - Message(PCB_MSG_DEFAULT, _("No pad/pin under rat line\n")); - return (NULL); - } - if (NAMEONPCB_NAME((ElementTypePtr) ptr1) == NULL || *NAMEONPCB_NAME((ElementTypePtr) ptr1) == 0) { - Message(PCB_MSG_DEFAULT, _("You must name the starting element first\n")); - return (NULL); - } - - /* will work for pins to since the FLAG is common */ - group1 = (TEST_FLAG(PCB_FLAG_ONSOLDER, (PadTypePtr) ptr2) ? - GetLayerGroupNumberByNumber(solder_silk_layer) : GetLayerGroupNumberByNumber(component_silk_layer)); - strcpy(name1, ConnectionName(found, ptr1, ptr2)); - found = SearchObjectByLocation(PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y, 5); - if (found == PCB_TYPE_NONE) { - Message(PCB_MSG_DEFAULT, _("No pad/pin under rat line\n")); - return (NULL); - } - if (NAMEONPCB_NAME((ElementTypePtr) ptr1) == NULL || *NAMEONPCB_NAME((ElementTypePtr) ptr1) == 0) { - Message(PCB_MSG_DEFAULT, _("You must name the ending element first\n")); - return (NULL); - } - group2 = (TEST_FLAG(PCB_FLAG_ONSOLDER, (PadTypePtr) ptr2) ? - GetLayerGroupNumberByNumber(solder_silk_layer) : GetLayerGroupNumberByNumber(component_silk_layer)); - name2 = ConnectionName(found, ptr1, ptr2); - - menu = pcb_netnode_to_netname(name1); - if (menu) { - if (pcb_netnode_to_netname(name2)) { - Message(PCB_MSG_DEFAULT, _("Both connections already in netlist - cannot merge nets\n")); - return (NULL); - } - entry = GetLibraryEntryMemory(menu); - entry->ListEntry = pcb_strdup(name2); - entry->ListEntry_dontfree = 0; - pcb_netnode_to_netname(name2); - goto ratIt; - } - /* ok, the first name did not belong to a net */ - menu = pcb_netnode_to_netname(name2); - if (menu) { - entry = GetLibraryEntryMemory(menu); - entry->ListEntry = pcb_strdup(name1); - entry->ListEntry_dontfree = 0; - pcb_netnode_to_netname(name1); - goto ratIt; - } - - /* - * neither belong to a net, so create a new one. - * - * before creating a new rats here, we need to search - * for a unique name. - */ - sprintf(ratname, " ratDrawn%i", ++ratDrawn); - while (rat_used(ratname)) { - sprintf(ratname, " ratDrawn%i", ++ratDrawn); - } - - menu = GetLibraryMenuMemory(&(PCB->NetlistLib[NETLIST_EDITED]), NULL); - menu->Name = pcb_strdup(ratname); - entry = GetLibraryEntryMemory(menu); - entry->ListEntry = pcb_strdup(name1); - entry->ListEntry_dontfree = 0; - - entry = GetLibraryEntryMemory(menu); - entry->ListEntry = pcb_strdup(name2); - entry->ListEntry_dontfree = 0; - menu->flag = 1; - -ratIt: - pcb_netlist_changed(0); - return (CreateNewRat(PCB->Data, Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, group1, group2, conf_core.appearance.rat_thickness, NoFlags())); -} - - -char *ConnectionName(int type, void *ptr1, void *ptr2) -{ - static char name[256]; - char *num; - - switch (type) { - case PCB_TYPE_PIN: - num = ((PinTypePtr) ptr2)->Number; - break; - case PCB_TYPE_PAD: - num = ((PadTypePtr) ptr2)->Number; - break; - default: - return (NULL); - } - strcpy(name, UNKNOWN(NAMEONPCB_NAME((ElementTypePtr) ptr1))); - strcat(name, "-"); - strcat(name, UNKNOWN(num)); - return (name); -} Index: 1.1.4/src/find_geo.c =================================================================== --- 1.1.4/src/find_geo.c (revision 10776) +++ 1.1.4/src/find_geo.c (nonexistent) @@ -1,696 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - -/* Generic geometric functions used by find.c lookup */ - -/* - * Intersection of line <--> circle: - * - calculate the signed distance from the line to the center, - * return false if abs(distance) > R - * - get the distance from the line <--> distancevector intersection to - * (X1,Y1) in range [0,1], return pcb_true if 0 <= distance <= 1 - * - depending on (r > 1.0 or r < 0.0) check the distance of X2,Y2 or X1,Y1 - * to X,Y - * - * Intersection of line <--> line: - * - see the description of 'LineLineIntersect()' - */ - -#define EXPAND_BOUNDS(p) if (Bloat > 0) {\ - (p)->BoundingBox.X1 -= Bloat; \ - (p)->BoundingBox.X2 += Bloat; \ - (p)->BoundingBox.Y1 -= Bloat; \ - (p)->BoundingBox.Y2 += Bloat;} - -#define IS_PV_ON_RAT(PV, Rat) \ - (IsPointOnLineEnd((PV)->X,(PV)->Y, (Rat))) - -#define IS_PV_ON_ARC(PV, Arc) \ - (TEST_FLAG(PCB_FLAG_SQUARE, (PV)) ? \ - IsArcInRectangle( \ - (PV)->X -MAX(((PV)->Thickness+1)/2 +Bloat,0), (PV)->Y -MAX(((PV)->Thickness+1)/2 +Bloat,0), \ - (PV)->X +MAX(((PV)->Thickness+1)/2 +Bloat,0), (PV)->Y +MAX(((PV)->Thickness+1)/2 +Bloat,0), \ - (Arc)) : \ - IsPointOnArc((PV)->X,(PV)->Y,MAX((PV)->Thickness/2.0 + Bloat,0.0), (Arc))) - -#define IS_PV_ON_PAD(PV,Pad) \ - ( IsPointInPad((PV)->X, (PV)->Y, MAX((PV)->Thickness/2 +Bloat,0), (Pad))) - -/* reduce arc start angle and delta to 0..360 */ -static void normalize_angles(Angle * sa, Angle * d) -{ - if (*d < 0) { - *sa += *d; - *d = -*d; - } - if (*d > 360) /* full circle */ - *d = 360; - *sa = NormalizeAngle(*sa); -} - -static int radius_crosses_arc(double x, double y, ArcTypePtr arc) -{ - double alpha = atan2(y - arc->Y, -x + arc->X) * PCB_RAD_TO_DEG; - Angle sa = arc->StartAngle, d = arc->Delta; - - normalize_angles(&sa, &d); - if (alpha < 0) - alpha += 360; - if (sa <= alpha) - return (sa + d) >= alpha; - return (sa + d - 360) >= alpha; -} - -static void get_arc_ends(Coord * box, ArcTypePtr arc) -{ - box[0] = arc->X - arc->Width * cos(PCB_M180 * arc->StartAngle); - box[1] = arc->Y + arc->Height * sin(PCB_M180 * arc->StartAngle); - box[2] = arc->X - arc->Width * cos(PCB_M180 * (arc->StartAngle + arc->Delta)); - box[3] = arc->Y + arc->Height * sin(PCB_M180 * (arc->StartAngle + arc->Delta)); -} - -/* --------------------------------------------------------------------------- - * check if two arcs intersect - * first we check for circle intersections, - * then find the actual points of intersection - * and test them to see if they are on arcs - * - * consider a, the distance from the center of arc 1 - * to the point perpendicular to the intersecting points. - * - * a = (r1^2 - r2^2 + l^2)/(2l) - * - * the perpendicular distance to the point of intersection - * is then - * - * d = sqrt(r1^2 - a^2) - * - * the points of intersection would then be - * - * x = X1 + a/l dx +- d/l dy - * y = Y1 + a/l dy -+ d/l dx - * - * where dx = X2 - X1 and dy = Y2 - Y1 - * - * - */ -static pcb_bool ArcArcIntersect(ArcTypePtr Arc1, ArcTypePtr Arc2) -{ - double x, y, dx, dy, r1, r2, a, d, l, t, t1, t2, dl; - Coord pdx, pdy; - Coord box[8]; - - t = 0.5 * Arc1->Thickness + Bloat; - t2 = 0.5 * Arc2->Thickness; - t1 = t2 + Bloat; - - /* too thin arc */ - if (t < 0 || t1 < 0) - return pcb_false; - - /* try the end points first */ - get_arc_ends(&box[0], Arc1); - get_arc_ends(&box[4], Arc2); - if (IsPointOnArc(box[0], box[1], t, Arc2) - || IsPointOnArc(box[2], box[3], t, Arc2) - || IsPointOnArc(box[4], box[5], t, Arc1) - || IsPointOnArc(box[6], box[7], t, Arc1)) - return pcb_true; - - pdx = Arc2->X - Arc1->X; - pdy = Arc2->Y - Arc1->Y; - dl = Distance(Arc1->X, Arc1->Y, Arc2->X, Arc2->Y); - /* concentric arcs, simpler intersection conditions */ - if (dl < 0.5) { - if ((Arc1->Width - t >= Arc2->Width - t2 && Arc1->Width - t <= Arc2->Width + t2) - || (Arc1->Width + t >= Arc2->Width - t2 && Arc1->Width + t <= Arc2->Width + t2)) { - Angle sa1 = Arc1->StartAngle, d1 = Arc1->Delta; - Angle sa2 = Arc2->StartAngle, d2 = Arc2->Delta; - /* NB the endpoints have already been checked, - so we just compare the angles */ - - normalize_angles(&sa1, &d1); - normalize_angles(&sa2, &d2); - /* sa1 == sa2 was caught when checking endpoints */ - if (sa1 > sa2) - if (sa1 < sa2 + d2 || sa1 + d1 - 360 > sa2) - return pcb_true; - if (sa2 > sa1) - if (sa2 < sa1 + d1 || sa2 + d2 - 360 > sa1) - return pcb_true; - } - return pcb_false; - } - r1 = Arc1->Width; - r2 = Arc2->Width; - /* arcs centerlines are too far or too near */ - if (dl > r1 + r2 || dl + r1 < r2 || dl + r2 < r1) { - /* check the nearest to the other arc's center point */ - dx = pdx * r1 / dl; - dy = pdy * r1 / dl; - if (dl + r1 < r2) { /* Arc1 inside Arc2 */ - dx = -dx; - dy = -dy; - } - - if (radius_crosses_arc(Arc1->X + dx, Arc1->Y + dy, Arc1) - && IsPointOnArc(Arc1->X + dx, Arc1->Y + dy, t, Arc2)) - return pcb_true; - - dx = -pdx * r2 / dl; - dy = -pdy * r2 / dl; - if (dl + r2 < r1) { /* Arc2 inside Arc1 */ - dx = -dx; - dy = -dy; - } - - if (radius_crosses_arc(Arc2->X + dx, Arc2->Y + dy, Arc2) - && IsPointOnArc(Arc2->X + dx, Arc2->Y + dy, t1, Arc1)) - return pcb_true; - return pcb_false; - } - - l = dl * dl; - r1 *= r1; - r2 *= r2; - a = 0.5 * (r1 - r2 + l) / l; - r1 = r1 / l; - d = r1 - a * a; - /* the circles are too far apart to touch or probably just touch: - check the nearest point */ - if (d < 0) - d = 0; - else - d = sqrt(d); - x = Arc1->X + a * pdx; - y = Arc1->Y + a * pdy; - dx = d * pdx; - dy = d * pdy; - if (radius_crosses_arc(x + dy, y - dx, Arc1) - && IsPointOnArc(x + dy, y - dx, t, Arc2)) - return pcb_true; - if (radius_crosses_arc(x + dy, y - dx, Arc2) - && IsPointOnArc(x + dy, y - dx, t1, Arc1)) - return pcb_true; - - if (radius_crosses_arc(x - dy, y + dx, Arc1) - && IsPointOnArc(x - dy, y + dx, t, Arc2)) - return pcb_true; - if (radius_crosses_arc(x - dy, y + dx, Arc2) - && IsPointOnArc(x - dy, y + dx, t1, Arc1)) - return pcb_true; - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * Tests if point is same as line end point - */ -static pcb_bool IsRatPointOnLineEnd(PointTypePtr Point, LineTypePtr Line) -{ - if ((Point->X == Line->Point1.X && Point->Y == Line->Point1.Y) - || (Point->X == Line->Point2.X && Point->Y == Line->Point2.Y)) - return (pcb_true); - return (pcb_false); -} - -static void form_slanted_rectangle(PointType p[4], LineTypePtr l) -/* writes vertices of a squared line */ -{ - double dwx = 0, dwy = 0; - if (l->Point1.Y == l->Point2.Y) - dwx = l->Thickness / 2.0; - else if (l->Point1.X == l->Point2.X) - dwy = l->Thickness / 2.0; - else { - Coord dX = l->Point2.X - l->Point1.X; - Coord dY = l->Point2.Y - l->Point1.Y; - double r = Distance(l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y); - dwx = l->Thickness / 2.0 / r * dX; - dwy = l->Thickness / 2.0 / r * dY; - } - p[0].X = l->Point1.X - dwx + dwy; - p[0].Y = l->Point1.Y - dwy - dwx; - p[1].X = l->Point1.X - dwx - dwy; - p[1].Y = l->Point1.Y - dwy + dwx; - p[2].X = l->Point2.X + dwx - dwy; - p[2].Y = l->Point2.Y + dwy + dwx; - p[3].X = l->Point2.X + dwx + dwy; - p[3].Y = l->Point2.Y + dwy - dwx; -} - -/* --------------------------------------------------------------------------- - * checks if two lines intersect - * from news FAQ: - * - * Let A,B,C,D be 2-space position vectors. Then the directed line - * segments AB & CD are given by: - * - * AB=A+r(B-A), r in [0,1] - * CD=C+s(D-C), s in [0,1] - * - * If AB & CD intersect, then - * - * A+r(B-A)=C+s(D-C), or - * - * XA+r(XB-XA)=XC+s(XD-XC) - * YA+r(YB-YA)=YC+s(YD-YC) for some r,s in [0,1] - * - * Solving the above for r and s yields - * - * (YA-YC)(XD-XC)-(XA-XC)(YD-YC) - * r = ----------------------------- (eqn 1) - * (XB-XA)(YD-YC)-(YB-YA)(XD-XC) - * - * (YA-YC)(XB-XA)-(XA-XC)(YB-YA) - * s = ----------------------------- (eqn 2) - * (XB-XA)(YD-YC)-(YB-YA)(XD-XC) - * - * Let I be the position vector of the intersection point, then - * - * I=A+r(B-A) or - * - * XI=XA+r(XB-XA) - * YI=YA+r(YB-YA) - * - * By examining the values of r & s, you can also determine some - * other limiting conditions: - * - * If 0<=r<=1 & 0<=s<=1, intersection exists - * r<0 or r>1 or s<0 or s>1 line segments do not intersect - * - * If the denominator in eqn 1 is zero, AB & CD are parallel - * If the numerator in eqn 1 is also zero, AB & CD are coincident - * - * If the intersection point of the 2 lines are needed (lines in this - * context mean infinite lines) regardless whether the two line - * segments intersect, then - * - * If r>1, I is located on extension of AB - * If r<0, I is located on extension of BA - * If s>1, I is located on extension of CD - * If s<0, I is located on extension of DC - * - * Also note that the denominators of eqn 1 & 2 are identical. - * - */ -pcb_bool LineLineIntersect(LineTypePtr Line1, LineTypePtr Line2) -{ - double s, r; - double line1_dx, line1_dy, line2_dx, line2_dy, point1_dx, point1_dy; - if (TEST_FLAG(PCB_FLAG_SQUARE, Line1)) { /* pretty reckless recursion */ - PointType p[4]; - form_slanted_rectangle(p, Line1); - return IsLineInQuadrangle(p, Line2); - } - /* here come only round Line1 because IsLineInQuadrangle() - calls LineLineIntersect() with first argument rounded */ - if (TEST_FLAG(PCB_FLAG_SQUARE, Line2)) { - PointType p[4]; - form_slanted_rectangle(p, Line2); - return IsLineInQuadrangle(p, Line1); - } - /* now all lines are round */ - - /* Check endpoints: this provides a quick exit, catches - * cases where the "real" lines don't intersect but the - * thick lines touch, and ensures that the dx/dy business - * below does not cause a divide-by-zero. */ - if (IsPointInPad(Line2->Point1.X, Line2->Point1.Y, MAX(Line2->Thickness / 2 + Bloat, 0), (PadTypePtr) Line1) - || IsPointInPad(Line2->Point2.X, Line2->Point2.Y, MAX(Line2->Thickness / 2 + Bloat, 0), (PadTypePtr) Line1) - || IsPointInPad(Line1->Point1.X, Line1->Point1.Y, MAX(Line1->Thickness / 2 + Bloat, 0), (PadTypePtr) Line2) - || IsPointInPad(Line1->Point2.X, Line1->Point2.Y, MAX(Line1->Thickness / 2 + Bloat, 0), (PadTypePtr) Line2)) - return pcb_true; - - /* setup some constants */ - line1_dx = Line1->Point2.X - Line1->Point1.X; - line1_dy = Line1->Point2.Y - Line1->Point1.Y; - line2_dx = Line2->Point2.X - Line2->Point1.X; - line2_dy = Line2->Point2.Y - Line2->Point1.Y; - point1_dx = Line1->Point1.X - Line2->Point1.X; - point1_dy = Line1->Point1.Y - Line2->Point1.Y; - - /* If either line is a point, we have failed already, since the - * endpoint check above will have caught an "intersection". */ - if ((line1_dx == 0 && line1_dy == 0) - || (line2_dx == 0 && line2_dy == 0)) - return pcb_false; - - /* set s to cross product of Line1 and the line - * Line1.Point1--Line2.Point1 (as vectors) */ - s = point1_dy * line1_dx - point1_dx * line1_dy; - - /* set r to cross product of both lines (as vectors) */ - r = line1_dx * line2_dy - line1_dy * line2_dx; - - /* No cross product means parallel lines, or maybe Line2 is - * zero-length. In either case, since we did a bounding-box - * check before getting here, the above IsPointInPad() checks - * will have caught any intersections. */ - if (r == 0.0) - return pcb_false; - - s /= r; - r = (point1_dy * line2_dx - point1_dx * line2_dy) / r; - - /* intersection is at least on AB */ - if (r >= 0.0 && r <= 1.0) - return (s >= 0.0 && s <= 1.0); - - /* intersection is at least on CD */ - /* [removed this case since it always returns pcb_false --asp] */ - return pcb_false; -} - -/*--------------------------------------------------- - * - * Check for line intersection with an arc - * - * Mostly this is like the circle/line intersection - * found in IsPointOnLine (search.c) see the detailed - * discussion for the basics there. - * - * Since this is only an arc, not a full circle we need - * to find the actual points of intersection with the - * circle, and see if they are on the arc. - * - * To do this, we translate along the line from the point Q - * plus or minus a distance delta = sqrt(Radius^2 - d^2) - * but it's handy to normalize with respect to l, the line - * length so a single projection is done (e.g. we don't first - * find the point Q - * - * The projection is now of the form - * - * Px = X1 + (r +- r2)(X2 - X1) - * Py = Y1 + (r +- r2)(Y2 - Y1) - * - * Where r2 sqrt(Radius^2 l^2 - d^2)/l^2 - * note that this is the variable d, not the symbol d described in IsPointOnLine - * (variable d = symbol d * l) - * - * The end points are hell so they are checked individually - */ -pcb_bool LineArcIntersect(LineTypePtr Line, ArcTypePtr Arc) -{ - double dx, dy, dx1, dy1, l, d, r, r2, Radius; - BoxTypePtr box; - - dx = Line->Point2.X - Line->Point1.X; - dy = Line->Point2.Y - Line->Point1.Y; - dx1 = Line->Point1.X - Arc->X; - dy1 = Line->Point1.Y - Arc->Y; - l = dx * dx + dy * dy; - d = dx * dy1 - dy * dx1; - d *= d; - - /* use the larger diameter circle first */ - Radius = Arc->Width + MAX(0.5 * (Arc->Thickness + Line->Thickness) + Bloat, 0.0); - Radius *= Radius; - r2 = Radius * l - d; - /* projection doesn't even intersect circle when r2 < 0 */ - if (r2 < 0) - return (pcb_false); - /* check the ends of the line in case the projected point */ - /* of intersection is beyond the line end */ - if (IsPointOnArc(Line->Point1.X, Line->Point1.Y, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) - return (pcb_true); - if (IsPointOnArc(Line->Point2.X, Line->Point2.Y, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) - return (pcb_true); - if (l == 0.0) - return (pcb_false); - r2 = sqrt(r2); - Radius = -(dx * dx1 + dy * dy1); - r = (Radius + r2) / l; - if (r >= 0 && r <= 1 - && IsPointOnArc(Line->Point1.X + r * dx, Line->Point1.Y + r * dy, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) - return (pcb_true); - r = (Radius - r2) / l; - if (r >= 0 && r <= 1 - && IsPointOnArc(Line->Point1.X + r * dx, Line->Point1.Y + r * dy, MAX(0.5 * Line->Thickness + Bloat, 0.0), Arc)) - return (pcb_true); - /* check arc end points */ - box = GetArcEnds(Arc); - if (IsPointInPad(box->X1, box->Y1, Arc->Thickness * 0.5 + Bloat, (PadTypePtr) Line)) - return pcb_true; - if (IsPointInPad(box->X2, box->Y2, Arc->Thickness * 0.5 + Bloat, (PadTypePtr) Line)) - return pcb_true; - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * checks if an arc has a connection to a polygon - * - * - first check if the arc can intersect with the polygon by - * evaluating the bounding boxes - * - check the two end points of the arc. If none of them matches - * - check all segments of the polygon against the arc. - */ -pcb_bool IsArcInPolygon(ArcTypePtr Arc, PolygonTypePtr Polygon) -{ - BoxTypePtr Box = (BoxType *) Arc; - - /* arcs with clearance never touch polys */ - if (TEST_FLAG(PCB_FLAG_CLEARPOLY, Polygon) && TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) - return pcb_false; - if (!Polygon->Clipped) - return pcb_false; - if (Box->X1 <= Polygon->Clipped->contours->xmax + Bloat - && Box->X2 >= Polygon->Clipped->contours->xmin - Bloat - && Box->Y1 <= Polygon->Clipped->contours->ymax + Bloat && Box->Y2 >= Polygon->Clipped->contours->ymin - Bloat) { - POLYAREA *ap; - - if (!(ap = ArcPoly(Arc, Arc->Thickness + Bloat))) - return pcb_false; /* error */ - return isects(ap, Polygon, pcb_true); - } - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * checks if a line has a connection to a polygon - * - * - first check if the line can intersect with the polygon by - * evaluating the bounding boxes - * - check the two end points of the line. If none of them matches - * - check all segments of the polygon against the line. - */ -pcb_bool IsLineInPolygon(LineTypePtr Line, PolygonTypePtr Polygon) -{ - BoxTypePtr Box = (BoxType *) Line; - POLYAREA *lp; - - /* lines with clearance never touch polygons */ - if (TEST_FLAG(PCB_FLAG_CLEARPOLY, Polygon) && TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) - return pcb_false; - if (!Polygon->Clipped) - return pcb_false; - if (TEST_FLAG(PCB_FLAG_SQUARE, Line) && (Line->Point1.X == Line->Point2.X || Line->Point1.Y == Line->Point2.Y)) { - Coord wid = (Line->Thickness + Bloat + 1) / 2; - Coord x1, x2, y1, y2; - - x1 = MIN(Line->Point1.X, Line->Point2.X) - wid; - y1 = MIN(Line->Point1.Y, Line->Point2.Y) - wid; - x2 = MAX(Line->Point1.X, Line->Point2.X) + wid; - y2 = MAX(Line->Point1.Y, Line->Point2.Y) + wid; - return IsRectangleInPolygon(x1, y1, x2, y2, Polygon); - } - if (Box->X1 <= Polygon->Clipped->contours->xmax + Bloat - && Box->X2 >= Polygon->Clipped->contours->xmin - Bloat - && Box->Y1 <= Polygon->Clipped->contours->ymax + Bloat && Box->Y2 >= Polygon->Clipped->contours->ymin - Bloat) { - if (!(lp = LinePoly(Line, Line->Thickness + Bloat))) - return FALSE; /* error */ - return isects(lp, Polygon, pcb_true); - } - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * checks if a pad connects to a non-clearing polygon - * - * The polygon is assumed to already have been proven non-clearing - */ -pcb_bool IsPadInPolygon(PadTypePtr pad, PolygonTypePtr polygon) -{ - return IsLineInPolygon((LineTypePtr) pad, polygon); -} - -/* --------------------------------------------------------------------------- - * checks if a polygon has a connection to a second one - * - * First check all points out of P1 against P2 and vice versa. - * If both fail check all lines of P1 against the ones of P2 - */ -pcb_bool IsPolygonInPolygon(PolygonTypePtr P1, PolygonTypePtr P2) -{ - if (!P1->Clipped || !P2->Clipped) - return pcb_false; - assert(P1->Clipped->contours); - assert(P2->Clipped->contours); - - /* first check if both bounding boxes intersect. If not, return quickly */ - if (P1->Clipped->contours->xmin - Bloat > P2->Clipped->contours->xmax || - P1->Clipped->contours->xmax + Bloat < P2->Clipped->contours->xmin || - P1->Clipped->contours->ymin - Bloat > P2->Clipped->contours->ymax || - P1->Clipped->contours->ymax + Bloat < P2->Clipped->contours->ymin) - return pcb_false; - - /* first check un-bloated case */ - if (isects(P1->Clipped, P2, pcb_false)) - return TRUE; - - /* now the difficult case of bloated */ - if (Bloat > 0) { - PLINE *c; - for (c = P1->Clipped->contours; c; c = c->next) { - LineType line; - VNODE *v = &c->head; - if (c->xmin - Bloat <= P2->Clipped->contours->xmax && - c->xmax + Bloat >= P2->Clipped->contours->xmin && - c->ymin - Bloat <= P2->Clipped->contours->ymax && c->ymax + Bloat >= P2->Clipped->contours->ymin) { - - line.Point1.X = v->point[0]; - line.Point1.Y = v->point[1]; - line.Thickness = 2 * Bloat; - line.Clearance = 0; - line.Flags = NoFlags(); - for (v = v->next; v != &c->head; v = v->next) { - line.Point2.X = v->point[0]; - line.Point2.Y = v->point[1]; - SetLineBoundingBox(&line); - if (IsLineInPolygon(&line, P2)) - return (pcb_true); - line.Point1.X = line.Point2.X; - line.Point1.Y = line.Point2.Y; - } - } - } - } - - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * some of the 'pad' routines are the same as for lines because the 'pad' - * struct starts with a line struct. See global.h for details - */ -pcb_bool LinePadIntersect(LineTypePtr Line, PadTypePtr Pad) -{ - return LineLineIntersect((Line), (LineTypePtr) Pad); -} - -pcb_bool ArcPadIntersect(ArcTypePtr Arc, PadTypePtr Pad) -{ - return LineArcIntersect((LineTypePtr) (Pad), (Arc)); -} - -pcb_bool BoxBoxIntersection(BoxTypePtr b1, BoxTypePtr b2) -{ - if (b2->X2 < b1->X1 || b2->X1 > b1->X2) - return pcb_false; - if (b2->Y2 < b1->Y1 || b2->Y1 > b1->Y2) - return pcb_false; - return pcb_true; -} - -static pcb_bool PadPadIntersect(PadTypePtr p1, PadTypePtr p2) -{ - return LinePadIntersect((LineTypePtr) p1, p2); -} - -static inline pcb_bool PV_TOUCH_PV(PinTypePtr PV1, PinTypePtr PV2) -{ - double t1, t2; - BoxType b1, b2; - int shape1, shape2; - - shape1 = GET_SQUARE(PV1); - shape2 = GET_SQUARE(PV2); - - if ((shape1 > 1) || (shape2 > 1)) { - POLYAREA *pl1, *pl2; - int ret; - - pl1 = PinPoly(PV1, PIN_SIZE(PV1) + Bloat, 0); - pl2 = PinPoly(PV2, PIN_SIZE(PV2) + Bloat, 0); - ret = Touching(pl1, pl2); - poly_Free(&pl1); - poly_Free(&pl2); - return ret; - } - - - t1 = MAX(PV1->Thickness / 2.0 + Bloat, 0); - t2 = MAX(PV2->Thickness / 2.0 + Bloat, 0); - if (IsPointOnPin(PV1->X, PV1->Y, t1, PV2) - || IsPointOnPin(PV2->X, PV2->Y, t2, PV1)) - return pcb_true; - if (!TEST_FLAG(PCB_FLAG_SQUARE, PV1) || !TEST_FLAG(PCB_FLAG_SQUARE, PV2)) - return pcb_false; - /* check for square/square overlap */ - b1.X1 = PV1->X - t1; - b1.X2 = PV1->X + t1; - b1.Y1 = PV1->Y - t1; - b1.Y2 = PV1->Y + t1; - t2 = PV2->Thickness / 2.0; - b2.X1 = PV2->X - t2; - b2.X2 = PV2->X + t2; - b2.Y1 = PV2->Y - t2; - b2.Y2 = PV2->Y + t2; - return BoxBoxIntersection(&b1, &b2); -} - -pcb_bool PinLineIntersect(PinTypePtr PV, LineTypePtr Line) -{ - if (TEST_FLAG(PCB_FLAG_SQUARE, PV)) { - int shape = GET_SQUARE(PV); - if (shape <= 1) { - /* the original square case */ - /* IsLineInRectangle already has Bloat factor */ - return IsLineInRectangle(PV->X - (PIN_SIZE(PV) + 1) / 2, - PV->Y - (PIN_SIZE(PV) + 1) / 2, - PV->X + (PIN_SIZE(PV) + 1) / 2, PV->Y + (PIN_SIZE(PV) + 1) / 2, Line); - } - - { - /* shaped pin case */ - POLYAREA *pl, *lp; - int ret; - - pl = PinPoly(PV, PIN_SIZE(PV), 0); - lp = LinePoly(Line, Line->Thickness + Bloat); - ret = Touching(lp, pl); - poly_Free(&pl); - poly_Free(&lp); - return ret; - } - - } - - - /* the original round pin version */ - return IsPointInPad(PV->X, PV->Y, MAX(PIN_SIZE(PV) / 2.0 + Bloat, 0.0), (PadTypePtr) Line); -} Index: 1.1.4/src/rats.h =================================================================== --- 1.1.4/src/rats.h (revision 10776) +++ 1.1.4/src/rats.h (nonexistent) @@ -1,45 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * rats.c, rats.h Copyright (C) 1997, harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for rats routines */ - -#ifndef PCB_RATS_H -#define PCB_RATS_H - -#include "global.h" - -RatTypePtr AddNet(void); -char *ConnectionName(int, void *, void *); - -pcb_bool AddAllRats(pcb_bool, void (*)(register ConnectionTypePtr, register ConnectionTypePtr, register RouteStyleTypePtr)); -pcb_bool SeekPad(LibraryEntryTypePtr, ConnectionTypePtr, pcb_bool); - -NetListTypePtr ProcNetlist(LibraryTypePtr); -NetListListType CollectSubnets(pcb_bool); - -#endif Index: 1.1.4/src/compat_lrealpath.c =================================================================== --- 1.1.4/src/compat_lrealpath.c (revision 10776) +++ 1.1.4/src/compat_lrealpath.c (nonexistent) @@ -1,156 +0,0 @@ -/* Libiberty realpath. Like realpath, but more consistent behavior. - Based on gdb_realpath from GDB. - - Copyright 2003 Free Software Foundation, Inc. - - This file is part of the libiberty library. - - 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. */ - -/* - -@deftypefn Replacement {const char*} lrealpath (const char *@var{name}) - -Given a pointer to a string containing a pathname, returns a canonical -version of the filename. Symlinks will be resolved, and ``.'' and ``..'' -components will be simplified. The returned value will be allocated using -@code{malloc}, or @code{NULL} will be returned on a memory allocation error. - -@end deftypefn - -*/ - -#include "config.h" -#include "compat_lrealpath.h" -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#include "compat_misc.h" - -/* On GNU libc systems the declaration is only visible with _GNU_SOURCE. */ -#if defined(HAVE_CANONICALIZE_FILE_NAME) \ - && defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME) -extern char *canonicalize_file_name(const char *); -#endif - -#if defined(HAVE_REALPATH) -#if defined (PATH_MAX) -#define REALPATH_LIMIT PATH_MAX -#else -#if defined (MAXPATHLEN) -#define REALPATH_LIMIT MAXPATHLEN -#endif -#endif -#else - /* cygwin has realpath, so it won't get here. */ -#if defined (_WIN32) -#define WIN32_LEAN_AND_MEAN -#include /* for GetFullPathName */ -#endif -#endif - -char *lrealpath(const char *filename) -{ - /* Method 1: The system has a compile time upper bound on a filename - path. Use that and realpath() to canonicalize the name. This is - the most common case. Note that, if there isn't a compile time - upper bound, you want to avoid realpath() at all costs. */ -#if defined(REALPATH_LIMIT) - { - char buf[REALPATH_LIMIT]; - const char *rp = realpath(filename, buf); - if (rp == NULL) - rp = filename; - return pcb_strdup(rp); - } - /* REALPATH_LIMIT */ - - /* Method 2: The host system (i.e., GNU) has the function - canonicalize_file_name() which malloc's a chunk of memory and - returns that, use that. */ -#elif defined(HAVE_CANONICALIZE_FILE_NAME) - { - char *rp = canonicalize_file_name(filename); - if (rp == NULL) - return pcb_strdup(filename); - else - return rp; - } - /* HAVE_CANONICALIZE_FILE_NAME */ - - /* Method 3: Now we're getting desperate! The system doesn't have a - compile time buffer size and no alternative function. Query the - OS, using pathconf(), for the buffer limit. Care is needed - though, some systems do not limit PATH_MAX (return -1 for - pathconf()) making it impossible to pass a correctly sized buffer - to realpath() (it could always overflow). On those systems, we - skip this. */ -#elif defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H) - { -#ifdef inline - /* Suppress compiler warnings; -Dinline means we are compiling in - --debug with -ansi -pedantic; we do know that realpath exists on the system, - because of the the ifdefs. */ - char *realpath(const char *path, char *resolved_path); -#endif - - /* Find out the max path size. */ - long path_max = pathconf("/", _PC_PATH_MAX); - if (path_max > 0) { - /* PATH_MAX is bounded. */ - char *buf, *rp, *ret; - buf = (char *) malloc(path_max); - if (buf == NULL) - return NULL; - rp = realpath(filename, buf); - ret = pcb_strdup(rp ? rp : filename); - free(buf); - return ret; - } - return NULL; - } - /* HAVE_REALPATH && HAVE_UNISTD_H */ - - /* The MS Windows method. If we don't have realpath, we assume we - don't have symlinks and just canonicalize to a Windows absolute - path. GetFullPath converts ../ and ./ in relative paths to - absolute paths, filling in current drive if one is not given - or using the current directory of a specified drive (eg, "E:foo"). - It also converts all forward slashes to back slashes. */ -#elif defined (_WIN32) - { - char buf[MAX_PATH]; - char *basename; - DWORD len = GetFullPathName(filename, MAX_PATH, buf, &basename); - if (len == 0 || len > MAX_PATH - 1) - return pcb_strdup(filename); - else { - /* The file system is case-preserving but case-insensitive, - Canonicalize to lowercase, using the codepage associated - with the process locale. */ - CharLowerBuff(buf, len); - return pcb_strdup(buf); - } - } -#else - - /* This system is a lost cause, just duplicate the filename. */ - return pcb_strdup(filename); -#endif -} Index: 1.1.4/src/list_text.c =================================================================== --- 1.1.4/src/list_text.c (revision 10776) +++ 1.1.4/src/list_text.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define TDL_DONT_UNDEF -#include "global_objs.h" -#include "list_text.h" -#include Index: 1.1.4/src/list_conf.c =================================================================== --- 1.1.4/src/list_conf.c (revision 10776) +++ 1.1.4/src/list_conf.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define FROM_CONF_C -#include "conf.h" -#include "list_conf.h" -#include Index: 1.1.4/src/hid_flags.c =================================================================== --- 1.1.4/src/hid_flags.c (revision 10776) +++ 1.1.4/src/hid_flags.c (nonexistent) @@ -1,104 +0,0 @@ -#include "config.h" - -#include -#include -#include - -#include "data.h" -#include "misc.h" -#include "conf.h" - -#include "hid.h" -#include "hid_flags.h" -#include "genht/hash.h" -#include "genht/htsp.h" -#include "error.h" -#include "hid_actions.h" - -int hid_get_flag(const char *name) -{ - const char *cp; - - if (name == NULL) - return -1; - - cp = strchr(name, '('); - if (cp == NULL) { - conf_native_t *n = conf_get_field(name); - if (n == NULL) - return -1; - if ((n->type != CFN_BOOLEAN) || (n->used != 1)) - return -1; - return n->val.boolean[0]; - } - else { - const char *end, *s; - const char *argv[2]; - if (cp != NULL) { - const HID_Action *a; - char buff[256]; - int len, multiarg; - len = cp - name; - if (len > sizeof(buff)-1) { - Message(PCB_MSG_DEFAULT, "hid_get_flag: action name too long: %s()\n", name); - return -1; - } - memcpy(buff, name, len); - buff[len] = '\0'; - a = hid_find_action(buff); - if (!a) { - Message(PCB_MSG_DEFAULT, "hid_get_flag: no action %s\n", name); - return -1; - } - cp++; - len = strlen(cp); - end = NULL; - multiarg = 0; - for(s = cp; *s != '\0'; s++) { - if (*s == ')') { - end = s; - break; - } - if (*s == ',') - multiarg = 1; - } - if (!multiarg) { - /* faster but limited way for a single arg */ - if ((len > sizeof(buff)-1) || (end == NULL)) { - Message(PCB_MSG_DEFAULT, "hid_get_flag: action arg too long or unterminated: %s\n", name); - return -1; - } - len = end - cp; - memcpy(buff, cp, len); - buff[len] = '\0'; - argv[0] = buff; - argv[1] = NULL; - return hid_actionv_(a, len > 0, argv); - } - else { - /* slower but more generic way */ - return hid_parse_command(name); - } - } - else { - fprintf(stderr, "ERROR: hid_get_flag(%s) - not a path or an action\n", name); - } - } - return -1; -} - -void hid_save_and_show_layer_ons(int *save_array) -{ - int i; - for (i = 0; i < max_copper_layer + 2; i++) { - save_array[i] = PCB->Data->Layer[i].On; - PCB->Data->Layer[i].On = 1; - } -} - -void hid_restore_layer_ons(int *save_array) -{ - int i; - for (i = 0; i < max_copper_layer + 2; i++) - PCB->Data->Layer[i].On = save_array[i]; -} Index: 1.1.4/src/list_pin.c =================================================================== --- 1.1.4/src/list_pin.c (revision 10776) +++ 1.1.4/src/list_pin.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define TDL_DONT_UNDEF -#include "global_objs.h" -#include "list_pin.h" -#include Index: 1.1.4/src/pcb-menu-lesstif.lht =================================================================== --- 1.1.4/src/pcb-menu-lesstif.lht (revision 10776) +++ 1.1.4/src/pcb-menu-lesstif.lht (nonexistent) @@ -1,499 +0,0 @@ -ha:{ - li:mouse { - li:left { - li:press = { Mode(Notify) } - li:press-shift = { Mode(Notify) } - li:release = { Mode(Release) } - li:release-shift = { Mode(Release) } - } - li:right { - li:press = { Mode(Save); Mode(Rotate); Mode(Notify); Mode(Release); Mode(Restore); } - li:press-ctrl = { Display(CycleCrosshair) } - } - li:middle { - li:press = { Pan(1) } - li:release = { Pan(0) } - li:press-ctrl = { Pan(thumb,1) } - li:release-ctrl = { Pan(thumb,0) } - } - li:scroll-up { - li:press = { Zoom(0.8) } - } - li:scroll-down { - li:press = { Zoom(1.25) } - } - #If you want zoom to center, do this instead. - #in scroll-up: - #li:press = {Zoom(0.8); Center()} - #in scroll-down: - #li:perss = {Zoom(1.25); Center()} - } - - li:main_menu { - ha:File = { - li:submenu { - ha:About... = { action=About() } - ha:Save layout = { m=S; a=Ctrls; action=Save(Layout) } - ha:Save layout as... = { m=A; a=Shift Ctrls; action=Save(LayoutAs) } - ha:Revert = { action=Load(Revert,none) } - ha:Import Schematics = { action=Import() } - ha:Load layout = { action=Load(Layout) } - ha:Load element data to paste-buffer = { li:action={PasteBuffer(Clear); Load(ElementTobuffer)} } - ha:Load layout data to paste-buffer = { li:action={PasteBuffer(Clear); Load(LayoutTobuffer)} } - ha:Load netlist file = { action=Load(Netlist) } - ha:Load vendor resource file = { action=LoadVendor() } - ha:Print layout... = { action=Print() } - ha:Export layout... = { action=Export() } - ha:Maintenance { - li:submenu { - ha:Calibrate Printer... = { action=PrintCalibrate() } - ha:Re-scan the footprint library = { action=fp_rehash() } - } - } - - - ha:Save connection data of... = { foreground=grey50; sensitive=false } - ha: a single element = { li:action={GetXY(Click to set the element mark <>); Save(ElementConnections)} } - ha: all elements = { action=Save(AllConnections) } - ha: unused pins = { action=Save(AllUnusedPins) } - - - ha:Start new layout = { a=Ctrln; action=New() } - - - ha:Quit Program = { m=Q; a=Ctrlq; action=Quit() } - } - } # File - - ha:View { - li:submenu { - ha:Flip up/down = { checked=editor/view/flip_y; a=Tab; action=SwapSides(V) } - ha:Flip left/right = { checked=editor/view/flip_x; a=ShiftTab; action=SwapSides(H) } - ha:Spin 180° = { a=CtrlTab; action=SwapSides(R) } - ha:Swap Sides = { a=Ctrl ShiftTab; action=SwapSides() } - ha:Center cursor = { a=c; action=Center() } - ha:Show soldermask = { checked=showmask; action=Display(ToggleMask) } - - - ha:Displayed element-name... = { foreground=grey50; sensitive=false } - ha:Description = { checked=ChkElementName(1); action=Display(Description) } - ha:Reference Designator = { checked=ChkElementName(2); action=Display(NameOnPCB) } - ha:Value = { checked=ChkElementName(3); action=Display(Value) } - ha:Lock Names = { checked=editor/lock_names; action=conf(toggle, editor/lock_names, design) } - ha:Only Names = { checked=editor/only_names; action=conf(toggle, editor/only_names, design) } - ha:Hide Names = { checked=editor/hide_names; action=conf(toggle, editor/hide_names, design) } - ha:Mincut on shorts = { checked=plugins/mincut/enable; action=conf(toggle, plugins/mincut/enable, design) } - - - ha:Pinout shows number = { checked=editor/show_number; action=conf(toggle, editor/show_number, design) } - ha:Open pinout menu = { a=Shiftd; action=Display(Pinout) } - ha:Zoom { - li:submenu { - ha:Zoom In 2X = { action=Zoom(-2) } - ha:Zoom In 20% = { m=Z; a=z; action=Zoom(-1.2) } - ha:Zoom Out 20% = { m=O; a=Shiftz; action=Zoom(+1.2); } - ha:Zoom Out 2X = { action=Zoom(+2) } - ha:Zoom Max = { m=M; a=v; action=Zoom() } - ha:Zoom Toggle = { a=`; action=Zoom(Toggle) } - - - ha:Zoom to 0.1mil\/px = { action={Zoom(=0.1mil)} } - ha:Zoom to 0.01mm\/px = { action={Zoom(=0.01mil)} } - ha:Zoom to 1mil\/px = { action={Zoom(=1mil)} } - ha:Zoom to 0.05mm\/px = { action={Zoom(=0.05mm)} } - ha:Zoom to 2.5mil\/px = { action={Zoom(=2.5mil)} } - ha:Zoom to 0.1mm\/px = { action={Zoom(=0.1mm)} } - ha:Zoom to 10mil\/px = { action={Zoom(=10mil)} } - } - } - ha:Grid { - li:submenu { - ha:mil = { checked=ChkGridUnits(mil); action=SetUnits(mil) } - ha:mm = { checked=ChkGridUnits(mm); action=SetUnits(mm) } - ha:Display grid = { checked=editor/draw_grid; action=conf(toggle, editor/draw_grid, design) } - ha:Realign grid = { li:action={GetXY(Click to set the grid origin); Display(ToggleGrid)} } - ha:No Grid = { checked=ChkGridSize(none); action=SetValue(Grid,1) } - - - ha:0.1 mil = { checked=ChkGridSize(0.1mil); li:action={SetUnits(mil); SetValue(Grid,0.1mil)} } - ha:1 mil = { checked=ChkGridSize(1mil); li:action={SetUnits(mil); SetValue(Grid,1mil)} } - ha:5 mil = { checked=ChkGridSize(5mil); li:action={SetUnits(mil); SetValue(Grid,5mil)} } - ha:10 mil = { checked=ChkGridSize(10mil); li:action={SetUnits(mil); SetValue(Grid,10mil)} } - ha:25 mil = { checked=ChkGridSize(25mil); li:action={SetUnits(mil); SetValue(Grid,25mil)} } - ha:50 mil = { checked=ChkGridSize(50mil); li:action={SetUnits(mil); SetValue(Grid,50mil)} } - ha:100 mil = { checked=ChkGridSize(100mil); li:action={SetUnits(mil); SetValue(Grid,100mil)} } - - - ha:0.01 mm = { checked=ChkGridSize(0.01mm); li:action={SetUnits(mm); SetValue(Grid,0.01mm)} } - ha:0.05 mm = { checked=ChkGridSize(0.05mm); li:action={SetUnits(mm); SetValue(Grid,0.05mm)} } - ha:0.1 mm = { checked=ChkGridSize(0.10mm); li:action={SetUnits(mm); SetValue(Grid,0.1mm)} } - ha:0.25 mm = { checked=ChkGridSize(0.25mm); li:action={SetUnits(mm); SetValue(Grid,0.25mm)} } - ha:0.5 mm = { checked=ChkGridSize(0.50mm); li:action={SetUnits(mm); SetValue(Grid,0.5mm)} } - ha:1 mm = { checked=ChkGridSize(1mm); li:action={SetUnits(mm); SetValue(Grid,1mm)} } - - - ha:Grid -5mil = { a=Shiftg; action=SetValue(Grid,-5,mil) } - ha:Grid +5mil = { a=g; action=SetValue(Grid,+5,mil) } - ha:Grid -0.05mm = { a=Shift Ctrlg; action=SetValue(Grid,-0.05,mm) } - ha:Grid +0.05mm = { a=Ctrlg; action=SetValue(Grid,+0.05,mm) } - } - } - - - ha:Shown Layers { - li:submenu { - @layerview - - - ha:Edit Layer Groups = { action=EditLayerGroups() } - } - } - ha:Current Layer { - li:submenu { - @layerpick - - - ha:Delete current layer = { action=MoveLayer(c,-1) } - ha:Add new layer = { action=MoveLayer(-1,c) } - ha:Move current layer up = { action=MoveLayer(c,up) } - ha:Move current layer down = { action=MoveLayer(c,down) } - } - } - } - } # View - - ha:Edit { - li:submenu { - ha:Undo last operation = { a=u; action=Undo() } - ha:Redo last undone operation = { a=Shiftr; action=Redo() } - ha:Clear undo-buffer = { a=Shift Ctrlu; action=Undo(ClearList); } - - - ha:Cut selection to buffer = { a=Ctrlx; li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer)} } - ha:Copy selection to buffer = { a=Ctrlc; li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Mode(PasteBuffer)} } - ha:Paste buffer to layout = { a=Ctrlv; action=Mode(PasteBuffer) } - - - ha:Unselect all = { a=Shift Alta; action=Unselect(All) } - ha:Select all visible = { a=Alta; action=Select(All) } - - - ha:Edit Names... = { foreground=grey50; sensitive=false } - ha: Change text on layout = { a=n; action=ChangeName(Object) } - ha: Change text on layout = { a=Shift Ctrln; action=ChangeName(Object, Number) } - ha: Edit name of layout = { action=ChangeName(Layout) } - ha: Edit name of active layer = { action=ChangeName(Layer) } - ha:Edit Attributes... = { foreground=grey50; sensitive=false } - ha: Layout = { action=Attributes(Layout) } - ha: CurrentLayer = { action=Attributes(Layer) } - ha: Element = { action=Attributes(Element) } - - - ha:Board Sizes = { action=AdjustSizes() } - ha:Route Styles { - li:submenu { - @routestyles - - - ha:Edit... = { action=AdjustStyle(0) } - } - } - } - } # Edit - - ha:Tools { - li:submenu { - ha:None = { checked=ChkMode(none); action=Mode(None) } - ha:Via = { checked=ChkMode(via); a=F1; action=Mode(Via) } - ha:Line = { checked=ChkMode(line); a=F2; action=Mode(Line) } - ha:Arc = { checked=ChkMode(arc); a=F3; action=Mode(Arc) } - ha:Text = { checked=ChkMode(text); a=F4; action=Mode(Text) } - ha:Rectangle = { checked=ChkMode(rectangle); a=F5; action=Mode(Rectangle) } - ha:Polygon = { checked=ChkMode(polygon); a=F6; action=Mode(Polygon) } - ha:Polygon Hole = { checked=ChkMode(polygonhole); action=Mode(PolygonHole); } - ha:Buffer = { checked=ChkMode(pastebuffer); a=F7; action=Mode(PasteBuffer) } - ha:Remove = { checked=ChkMode(remove); a=F8; action=Mode(Remove) } - ha:Rotate = { checked=ChkMode(rotate); a=F9; action=Mode(Rotate) } - ha:Thermal = { checked=ChkMode(thermal); a=F10; action=Mode(Thermal) } - ha:Arrow = { checked=ChkMode(arrow); a=F11; action=Mode(Arrow) } - ha:Insert Point = { checked=ChkMode(insertpoint); a=Insert; action=Mode(InsertPoint) } - ha:Move = { checked=ChkMode(move); action=Mode(Move) } - ha:Copy = { checked=ChkMode(copy); action=Mode(Copy) } - ha:Lock = { checked=ChkMode(lock); a=F12; action=Mode(Lock) } - ha:Cancel = { a=Escape; action=Mode(Cancel) } - - - ha:Command = { a={:}; action=Command() } - } - } # Tools - - ha:Settings { - li:submenu { - ha:Layer groups = { foreground=grey50; sensitive=false } - ha:Edit layer groupings = { action=EditLayerGroups() } - - - ha:'All-direction' lines = { checked=editor/all_direction_lines; a=.; action=conf(toggle, editor/all_direction_lines, design) } - ha:Auto swap line start angle = { checked=editor/swap_start_direction; action=conf(toggle, editor/swap_start_direction, design) } - ha:Orthogonal moves = { checked=editor/orthogonal_moves; action=conf(toggle, editor/orthogonal_moves, design) } - ha:Crosshair snaps to pins and pads = { checked=editor/snap_pin; action=conf(toggle, editor/snap_pin, design) } - ha:Crosshair snaps to off-grid points on lines = { checked=editor/snap_offgrid_line; action=conf(toggle, editor/snap_offgrid_line, design) } - ha:Crosshair shows DRC clearance = { checked=editor/show_drc; action=conf(toggle, editor/show_drc, design) } - ha:Auto enforce DRC clearance = { checked=editor/auto_drc; action=conf(toggle, editor/auto_drc, design) } - - - ha:Rubber band mode = { checked=editor/rubber_band_mode; action=conf(toggle, editor/rubber_band_mode, design) } - ha:Require unique element names = { checked=editor/unique_names; action=conf(toggle, editor/unique_names, design) } - ha:Auto-zero delta measurements = { checked=editor/local_ref; action=conf(toggle, editor/local_ref, design) } - ha:New lines, arcs clear polygons = { checked=editor/clear_line; action=conf(toggle, editor/clear_line, design) } - ha:New polygons are full ones = { checked=editor/full_poly; action=conf(toggle, editor/full_poly, design) } - ha:Show autorouter trials = { checked=editor/live_routing; action=conf(toggle, editor/live_routing, design) } - ha:Highlighting on line, arc points = { checked=editor/highlight_on_point; action=conf(toggle, editor/highlight_on_point, design) } - ha:Thin draw = { checked=editor/thin_draw; a=|; action=conf(toggle, editor/thin_draw, design) } - ha:Thin draw poly = { checked=editor/thin_drawpoly; a=Ctrl Shiftp; action=conf(toggle, editor/thin_draw_poly, design) } - ha:Check polygons = { checked=editor/check_planes; action=conf(toggle, editor/check_planes, design) } - - - ha:Pinout shows number = { checked=editor/show_number; action=conf(toggle, editor/show_number, design) } - ha:Pins/Via show Name/Number = { a=d; action=Display(PinOrPadName) } - ha:Enable vendor drill mapping = { checked=plugins/vendor/enable; action=conf(toggle, plugins/vendor/enable, design) } - ha:Import Settings { - li:submenu { - ha:New elements added at... = { foreground=grey50; sensitive=false } - ha: Center = { action=Import(setnewpoint,center) } - ha: Mark = { action=Import(setnewpoint,mark) } - ha: Crosshair = { action=Import(setnewpoint) } - - - ha:Set Dispersion = { action=Import(setdisperse) } - } - } - } - } # Settings - - ha:Select { - li:submenu { - ha:Select all visible objects = { action=Select(All) } - ha:Select all connected objects = { action=Select(Connection) } - - - ha:Unselect all objects = { action=Unselect(All) } - ha:unselect all connected objects = { action=Unselect(Connection) } - - - ha:Select by name = { foreground=grey50; sensitive=false } - ha:All objects = { active=rc/have_regex; action=Select(ObjectByName) } - ha:Elements = { active=rc/have_regex; action=Select(ElementByName) } - ha:Pads = { active=rc/have_regex; action=Select(PadByName) } - ha:Pins = { active=rc/have_regex; action=Select(PinByName) } - ha:Text Objects = { active=rc/have_regex; action=Select(TextByName) } - ha:Vias = { active=rc/have_regex; action=Select(ViaByName) } - - - ha:Auto-place selected elements = { a=Ctrlp; action=AutoPlaceSelected() } - ha:Disperse all elements = { action=DisperseElements(All) } - ha:Move selected elements to other side = { a=Shiftb; action=Flip(SelectedElements) } - ha:Move selected to current layer = { a=Shiftm; action=MoveToCurrentLayer(Selected) } - ha:Delete selected objects = { a=Delete; action=Delete(Selected) } - ha:Convert selection to element = { action=Select(Convert) } - - - ha:Optimize selected rats = { li:action={DeleteRats(SelectedRats); AddRats(SelectedRats)} } - ha:Auto-route selected rats = { a=Altr; action=AutoRoute(SelectedRats) } - ha:Rip up selected auto-routed tracks = { action=RipUp(Selected) } - - - ha:Change size of selected objects = { foreground=grey50; sensitive=false } - ha:ChangeSizes to Route style = { a=Shifty; action=ChangeSizes(Object,style,mil); } - ha:Lines -10 mil = { li:action={ChangeSize(SelectedLines,-10,mil); ChangeSize(SelectedArcs,-10,mil)} } - ha:Lines +10 mil = { li:action={ChangeSize(SelectedLines,+10,mil); ChangeSize(SelectedArcs,+10,mil)} } - ha:Pads -10 mil = { action=ChangeSize(SelectedPads,-10,mil) } - ha:Pads +10 mil = { action=ChangeSize(SelectedPads,+10,mil) } - ha:Pins -10 mil = { action=ChangeSize(SelectedPins,-10,mil) } - ha:Pins +10 mil = { action=ChangeSize(SelectedPins,+10,mil) } - ha:Texts -10 mil = { action=ChangeSize(SelectedTexts,-10,mil) } - ha:Texts +10 mil = { action=ChangeSize(SelectedTexts,+10,mil) } - ha:Vias -10 mil = { action=ChangeSize(SelectedVias,-10,mil) } - ha:Vias +10 mil = { action=ChangeSize(SelectedVias,+10,mil) } - - - ha:Change drilling hole of selected objects = { foreground=grey50; sensitive=false } - ha:Vias -10 mil = { action=ChangeDrillSize(SelectedVias,-10,mil) } - ha:Vias +10 mil = { action=ChangeDrillSize(SelectedVias,+10,mil) } - ha:Pins -10 mil = { action=ChangeDrillSize(SelectedPins,-10,mil) } - ha:Pins +10 mil = { action=ChangeDrillSize(SelectedPins,+10,mil) } - - - ha:Change square-flag of selected objects = { foreground=grey50; sensitive=false } - ha:Elements = { action=ChangeSquare(SelectedElements) } - ha:Pins = { action=ChangeSquare(SelectedPins) } - } - } # Select - - - ha:Buffer { - li:submenu { - ha:Copy selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Mode(PasteBuffer)} } - ha:Cut selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer)} } - ha:Paste buffer to layout = { action=Mode(PasteBuffer) } - - - ha:Rotate buffer 90 deg CCW = { a=ShiftF7; li:action={Mode(PasteBuffer); PasteBuffer(Rotate,1)} } - ha:Rotate buffer 90 deg CW = { li:action={Mode(PasteBuffer); PasteBuffer(Rotate,3)} } - ha:Arbitrarily Rotate Buffer = { li:action={Mode(PasteBuffer); FreeRotateBuffer()} } - ha:Mirror buffer (up/down) = { li:action={Mode(PasteBuffer); PasteBuffer(Mirror)} } - ha:Mirror buffer (left/right) = { li:action={Mode(PasteBuffer); PasteBuffer(Rotate,1); PasteBuffer(Mirror); PasteBuffer(Rotate,3)} } - - - ha:Clear buffer = { action=PasteBuffer(Clear) } - ha:Convert buffer to element = { action=PasteBuffer(Convert) } - ha:Break buffer elements to pieces = { action=PasteBuffer(Restore) } - ha:Save buffer elements to file = { action=Save(PasteBuffer) } - - - ha:Select current buffer = { foreground=grey50; sensitive=false } - ha:\#1 = { checked=ChkBuffer(1); a=Shift1; action=PasteBuffer(1) } - ha:\#2 = { checked=ChkBuffer(2); a=Shift2; action=PasteBuffer(2) } - ha:\#3 = { checked=ChkBuffer(3); a=Shift3; action=PasteBuffer(3) } - ha:\#4 = { checked=ChkBuffer(4); a=Shift4; action=PasteBuffer(4) } - ha:\#5 = { checked=ChkBuffer(5); a=Shift5; action=PasteBuffer(5) } - } - } # Buffer - - - ha:Connects { - li:submenu { - ha:Lookup connection to object = { a=Ctrlf; li:action={GetXY(Click on the object); Connection(Find)} } - ha:Reset scanned pads/pins/vias = { li:action={Connection(ResetPinsViasAndPads); Display(Redraw)} } - ha:Reset scanned lines/polygons = { li:action={Connection(ResetLinesAndPolygons); Display(Redraw)} } - ha:Reset all connections = { a=Shiftf; li:action={Connection(Reset); Display(Redraw)} } - - - ha:Optimize rats-nest = { a=o; li:action={Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block)} } - ha:Erase rats-nest = { a=e; action=DeleteRats(AllRats) } - ha:Erase selected rats = { a=Shifte; action=DeleteRats(SelectedRats) } - - - ha:Auto-route selected rats = { action=AutoRoute(Selected) } - ha:Auto-route all rats = { action=AutoRoute(AllRats) } - ha:Rip up all auto-routed tracks = { action=RipUp(All) } - - - ha:Auto-Optimize = { a={Shift=}; action=djopt(auto) } - ha:Debumpify = { action=djopt(debumpify) } - ha:Unjaggy = { action=djopt(unjaggy) } - ha:Vianudge = { action=djopt(vianudge) } - ha:Viatrim = { action=djopt(viatrim) } - ha:Orthopull = { action=djopt(orthopull) } - ha:SimpleOpts = { a={=}; action=djopt(simple) } - ha:Miter = { action=djopt(miter) } - ha:Puller = { a=y; action=Puller() } - ha:Global Puller = { - li:submenu { - ha:Selected = { action=GlobalPuller(selected) } - ha:Found = { action=GlobalPuller(found) } - ha:All = { action=GlobalPuller() } - } - } - ha:Only autorouted nets = { checked=plugins/djopt/auto_only; action=conf(toggle, plugins/djopt/auto_only, design) } - - - ha:Design Rule Checker = { action=DRC() } - - - ha:Apply vendor drill mapping = { action=ApplyVendor() } - } - } # Connects - - ha:Plugins = { - li:submenu { - ha:Manage plugins... = { a=Altp; action=ManagePlugins() } - } - } # Plugins - - - ha:Info { - li:submenu { - ha:Generate object report = { a=Ctrlr; action=ReportObject() } - ha:Generate drill summary = { action=Report(DrillReport) } - ha:Report found pins/pads = { action=Report(FoundPins) } - ha:Report net length = { a=r; action=Report(NetLength) } - ha:Key Bindings { - li:submenu { - ha:Remove = { a=BackSpace; action=Delete(Selected) } - ha:Remove Connected = { a=ShiftBackSpace; li:action={Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block)} } - ha:Remove Connected = { a=ShiftDelete; li:action={Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block)} } - ha:Set Same = { a=a; action=SetSame() } - ha:Flip Object = { a=b; action=Flip(Object) } - ha:Find Connections = { a=f; li:action={Connection(Reset); Connection(Find)} } - ha:ToggleHideName Object = { a=h; action=ToggleHideName(Object) } - ha:ToggleHideName SelectedElement = { a=Shifth; action=ToggleHideName(SelectedElements) } - ha:ChangeHole Object = { a=Ctrlh; action=ChangeHole(Object) } - ha:ChangeJoin Object = { a=j; action=ChangeJoin(Object) } - ha:ChangeJoin SelectedObject = { a=Shiftj; action=ChangeJoin(SelectedObjects) } - ha:Clear Object +2 mil = { a=k; action=ChangeClearSize(Object,+2,mil) } - ha:Clear Object -2 mil = { a=Shiftk; action=ChangeClearSize(Object,-2,mil) } - ha:Clear Selected +2 mil = { a=Ctrlk; action=ChangeClearSize(SelectedObjects,+2,mil) } - ha:Clear Selected -2 mil = { a=Shift Ctrlk; action=ChangeClearSize(SelectedObjects,-2,mil) } - ha:Line Tool size +5 mil = { a=l; action=SetValue(LineSize,+5,mil) } - ha:Line Tool size -5 mil = { a=Shiftl; action=SetValue(LineSize,-5,mil) } - ha:Move Object to current layer = { a=m; action=MoveToCurrentLayer(Object) } - ha:MarkCrosshair = { a=Ctrlm; action=MarkCrosshair() } - ha:Select shortest rat = { a=Shiftn; action=AddRats(Close) } - ha:AddRats to selected pins = { a=Shifto; li:action={Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(SelectedRats); Atomic(Block)} } - ha:ChangeOctagon Object = { a=Ctrlo; action=ChangeOctagon(Object) } - ha:Polygon PreviousPoint = { a=p; action=Polygon(PreviousPoint) } - ha:Polygon Close = { a=Shiftp; action=Polygon(Close) } - ha:ChangeSquare Object = { a=q; action=ChangeSquare(Object) } - ha:ChangeSize +5 mil = { a=s; action=ChangeSize(Object,+5,mil) } - ha:ChangeSize -5 mil = { a=Shifts; action=ChangeSize(Object,-5,mil) } - ha:ChangeDrill +5 mil = { a=Alts; action=ChangeDrillSize(Object,+5,mil) } - ha:ChangeDrill -5 mil = { a=Alt Shifts; action=ChangeDrillSize(Object,-5,mil) } - ha:Text Tool scale +10 mil = { a=t; action=SetValue(TextScale,+10,mil) } - ha:Text Tool scale -10 mil = { a=Shiftt; action=SetValue(TextScale,-10,mil) } - ha:Via Tool size +5 mil = { a=Shiftv; action=SetValue(ViaSize,+5,mil) } - ha:Via Tool size -5 mil = { a=Shift Ctrlv; action=SetValue(ViaSize,-5,mil) } - ha:Via Tool drill +5 mil = { a=Altv; action=SetValue(ViaDrillingHole,+5,mil) } - ha:Via Tool drill -5 mil = { a=Alt Shiftv; action=SetValue(ViaDrillingHole,-5,mil) } - ha:AddRats Selected = { a=Shiftw; action=AddRats(SelectedRats) } - ha:Add All Rats = { a=w; action=AddRats(AllRats) } - ha:Undo = { a=Altz; action=Undo() } - ha:Cycle Clip = { a=/; action=Display(CycleClip) } - ha:Arrow = { a=space; checked=ChkMode(arrow); action=Mode(Arrow) } - ha:Temp Arrow ON = { a=[; li:action={Mode(Save); Mode(Arrow); Mode(Notify)} } - ha:Temp Arrow OFF = { a=]; li:action={Mode(Release); Mode(Restore)} } - ha:Step Up = { a=Up; action=Cursor(Warp,0,1,grid) } - ha:Step Down = { a=Down; action=Cursor(Warp,0,-1,grid) } - ha:Step Left = { a=Left; action=Cursor(Warp,-1,0,grid) } - ha:Step Right = { a=Right; action=Cursor(Warp,1,0,grid) } - ha:Step +Up = { a=ShiftUp; action=Cursor(Pan,0,50,view) } - ha:Step +Down = { a=ShiftDown; action=Cursor(Pan,0,-50,view) } - ha:Step +Left = { a=ShiftLeft; action=Cursor(Pan,-50,0,view) } - ha:Step +Right = { a=ShiftRight; action=Cursor(Pan,50,0,view) } - ha:"Click" = { a=Enter; li:action={Mode(Notify); Mode(Release)} } - - - ha:layer keys { - li:submenu { - ha:Select Layer 1 = { a=1; action=SelectLayer(1) } - ha:Select Layer 2 = { a=2; action=SelectLayer(2) } - ha:Select Layer 3 = { a=3; action=SelectLayer(3) } - ha:Select Layer 4 = { a=4; action=SelectLayer(4) } - ha:Select Layer 5 = { a=5; action=SelectLayer(5) } - ha:Select Layer 6 = { a=6; action=SelectLayer(6) } - ha:Select Layer 7 = { a=7; action=SelectLayer(7) } - ha:Select Layer 8 = { a=8; action=SelectLayer(8) } - ha:Select Layer 9 = { a=9; action=SelectLayer(9) } - ha:Select Layer 10 = { a=0; action=SelectLayer(10) } - ha:Select Layer 11 = { a=Alt1; action=SelectLayer(11) } - ha:Select Layer 12 = { a=Alt2; action=SelectLayer(12) } - ha:Select Layer 13 = { a=Alt3; action=SelectLayer(13) } - ha:Select Layer 14 = { a=Alt4; action=SelectLayer(14) } - ha:Select Layer 15 = { a=Alt5; action=SelectLayer(15) } - ha:Select Layer 16 = { a=Alt6; action=SelectLayer(16) } - ha:Select Layer 17 = { a=Alt7; action=SelectLayer(17) } - ha:Select Layer 18 = { a=Alt8; action=SelectLayer(18) } - ha:Select Layer 19 = { a=Alt9; action=SelectLayer(19) } - ha:Select Layer 20 = { a=Alt0; action=SelectLayer(20) } - - - ha:Toggle Layer 1 = { a=Ctrl1; action=ToggleView(1) } - ha:Toggle Layer 2 = { a=Ctrl2; action=ToggleView(2) } - ha:Toggle Layer 3 = { a=Ctrl3; action=ToggleView(3) } - ha:Toggle Layer 4 = { a=Ctrl4; action=ToggleView(4) } - ha:Toggle Layer 5 = { a=Ctrl5; action=ToggleView(5) } - ha:Toggle Layer 6 = { a=Ctrl6; action=ToggleView(6) } - ha:Toggle Layer 7 = { a=Ctrl7; action=ToggleView(7) } - ha:Toggle Layer 8 = { a=Ctrl8; action=ToggleView(8) } - ha:Toggle Layer 9 = { a=Ctrl9; action=ToggleView(9) } - ha:Toggle Layer 10 = { a=Ctrl0; action=ToggleView(10) } - ha:Toggle Layer 11 = { a=Ctrl-Alt1; action=ToggleView(11) } - ha:Toggle Layer 12 = { a=Ctrl-Alt2; action=ToggleView(12) } - ha:Toggle Layer 13 = { a=Ctrl-Alt3; action=ToggleView(13) } - ha:Toggle Layer 14 = { a=Ctrl-Alt4; action=ToggleView(14) } - ha:Toggle Layer 15 = { a=Ctrl-Alt5; action=ToggleView(15) } - ha:Toggle Layer 16 = { a=Ctrl-Alt6; action=ToggleView(16) } - ha:Toggle Layer 17 = { a=Ctrl-Alt7; action=ToggleView(17) } - ha:Toggle Layer 18 = { a=Ctrl-Alt8; action=ToggleView(18) } - ha:Toggle Layer 19 = { a=Ctrl-Alt9; action=ToggleView(19) } - ha:Toggle Layer 20 = { a=Ctrl-Alt0; action=ToggleView(20) } - } - } # layer keys - } - } # Key Bindings - } - } # Info - - ha:Window { - li:submenu { - ha:Board Layout = { action=DoWindows(Layout) } - ha:Library = { action=DoWindows(Library) } - ha:Message Log = { action=DoWindows(Log) } - ha:Netlist = { action=DoWindows(Netlist) } - ha:Pinout = { a=Shiftd; action=Display(Pinout) } - } - } # Window - - } # main_menu -} #root Index: 1.1.4/src/compat_lrealpath.h =================================================================== --- 1.1.4/src/compat_lrealpath.h (revision 10776) +++ 1.1.4/src/compat_lrealpath.h (nonexistent) @@ -1,7 +0,0 @@ -#ifndef PCB_LREALPATH_H -#define PCB_LREALPATH_H - -/* A well-defined realpath () that is always compiled in. */ -char *lrealpath(const char *); - -#endif /* PCB_LREALPATH_H */ Index: 1.1.4/src/list_text.h =================================================================== --- 1.1.4/src/list_text.h (revision 10776) +++ 1.1.4/src/list_text.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_TEXT_H -#define LIST_TEXT_H - -/* List of Text */ -#define TDL(x) textlist_ ## x -#define TDL_LIST_T textlist_t -#define TDL_ITEM_T TextType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define textlist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/remove_act.c =================================================================== --- 1.1.4/src/remove_act.c (revision 10776) +++ 1.1.4/src/remove_act.c (nonexistent) @@ -1,107 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "data.h" -#include "action_helper.h" -#include "set.h" -#include "remove.h" -#include "funchash_core.h" - -/* --------------------------------------------------------------------------- */ - -static const char delete_syntax[] = "Delete(Object|Selected)\n" "Delete(AllRats|SelectedRats)"; - -static const char delete_help[] = "Delete stuff."; - -/* %start-doc actions Delete - -%end-doc */ - -static int ActionDelete(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - int id = funchash_get(function, NULL); - - Note.X = Crosshair.X; - Note.Y = Crosshair.Y; - - if (id == -1) { /* no arg */ - if (RemoveSelected() == pcb_false) - id = F_Object; - } - - switch (id) { - case F_Object: - SaveMode(); - SetMode(PCB_MODE_REMOVE); - NotifyMode(); - RestoreMode(); - break; - case F_Selected: - RemoveSelected(); - break; - case F_AllRats: - if (DeleteRats(pcb_false)) - SetChangedFlag(pcb_true); - break; - case F_SelectedRats: - if (DeleteRats(pcb_true)) - SetChangedFlag(pcb_true); - break; - } - - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char removeselected_syntax[] = "RemoveSelected()"; - -static const char removeselected_help[] = "Removes any selected objects."; - -/* %start-doc actions RemoveSelected - -%end-doc */ - -static int ActionRemoveSelected(int argc, const char **argv, Coord x, Coord y) -{ - if (RemoveSelected()) - SetChangedFlag(pcb_true); - return 0; -} - - -HID_Action remove_action_list[] = { - {"Delete", 0, ActionDelete, - delete_help, delete_syntax} - , - {"RemoveSelected", 0, ActionRemoveSelected, - removeselected_help, removeselected_syntax} - , -}; - -REGISTER_ACTIONS(remove_action_list, NULL) Index: 1.1.4/src/conf.c =================================================================== --- 1.1.4/src/conf.c (revision 10776) +++ 1.1.4/src/conf.c (nonexistent) @@ -1,1810 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include "conf.h" -#include "conf_core.h" -#include "conf_hid.h" -#include "hid_cfg.h" -#include "hid_init.h" -#include "hid_attrib.h" -#include "misc_util.h" -#include "error.h" -#include "paths.h" -#include "compat_fs.h" -#include "compat_misc.h" -#include "error.h" - -/* conf list node's name */ -const char *conf_list_name = "pcb-rnd-conf-v1"; -static const char *conf_user_fn = "~/" DOT_PCB_RND "/pcb-conf.lht"; - -lht_doc_t *conf_root[CFR_max_alloc]; -int conf_root_lock[CFR_max_alloc]; -int conf_lht_dirty[CFR_max_alloc]; - -htsp_t *conf_fields = NULL; -const int conf_default_prio[] = { -/* CFR_INTERNAL */ 100, -/* CFR_SYSTEM */ 200, -/* CFR_DEFAULTPCB */ 300, -/* CFR_USER */ 400, -/* CFR_ENV */ 500, -/* CFR_PROJECT */ 600, -/* CFR_DESIGN */ 700, -/* CFR_CLI */ 800, -0, 0, 0, 0, 0, 0, 0, 0, 0 /* make sure the array is addressable until CFR_max_alloc */ -}; - -extern const char *conf_internal; - -/*static lht_doc_t *conf_plugin;*/ - -static lht_node_t *conf_lht_get_confroot(lht_node_t *cwd) -{ - if (cwd == NULL) - return NULL; - - /* if it's a list with a matching name, we found it */ - if ((cwd->type == LHT_LIST) && (strcmp(cwd->name, conf_list_name) == 0)) - return cwd; - - /* else it may be the parent-hash of the list */ - if (cwd->type != LHT_HASH) - return NULL; - - return lht_dom_hash_get(cwd, conf_list_name); -} - - -int conf_load_as(conf_role_t role, const char *fn, int fn_is_text) -{ - lht_doc_t *d; - if (conf_root_lock[role]) - return -1; - if (conf_root[role] != NULL) { - lht_dom_uninit(conf_root[role]); - conf_root[role] = NULL; - } - if (fn_is_text) - d = hid_cfg_load_str(fn); - else - d = hid_cfg_load_lht(fn); - if (d == NULL) { - FILE *f; - char *efn; - resolve_path(fn, &efn, 0); - f = fopen(efn, "r"); - if (f != NULL) { /* warn only if the file is there - missing file is normal */ - Message(PCB_MSG_DEFAULT, "error: failed to load lht config: %s\n", efn); - fclose(f); - } - free(efn); - return -1; - } - - if ((d->root->type == LHT_LIST) && (strcmp(d->root->name, "pcb-rnd-conf-v1") == 0)) { - conf_root[role] = d; - return 0; - } - - if ((d->root->type == LHT_HASH) && (strcmp(d->root->name, "geda-project-v1") == 0)) { - lht_node_t *confroot; - confroot = lht_tree_path_(d, d->root, "pcb-rnd-conf-v1", 1, 0, NULL); - if ((confroot != NULL) && (confroot->type == LHT_LIST) && (strcmp(confroot->name, "li:pcb-rnd-conf-v1") == 0)) { - conf_root[role] = d; - return 0; - } - - /* project file with no config root */ - confroot = lht_dom_node_alloc(LHT_LIST, "pcb-rnd-conf-v1"); - lht_dom_hash_put(d->root, confroot); - conf_root[role] = d; - return 0; - } - - hid_cfg_error(d->root, "Root node must be either li:pcb-rnd-conf-v1 or ha:geda-project-v1\n"); - - if (d != NULL) - lht_dom_uninit(d); - return -1; -} - -conf_policy_t conf_policy_parse(const char *s) -{ - if (strcasecmp(s, "overwrite") == 0) return POL_OVERWRITE; - if (strcasecmp(s, "prepend") == 0) return POL_PREPEND; - if (strcasecmp(s, "append") == 0) return POL_APPEND; - if (strcasecmp(s, "disable") == 0) return POL_DISABLE; - return POL_invalid; -} - -const char *conf_policy_name(conf_policy_t p) -{ - switch(p) { - case POL_OVERWRITE: return "overwrite"; - case POL_PREPEND: return "prepend"; - case POL_APPEND: return "append"; - case POL_DISABLE: return "disable"; - case POL_invalid: return "(invalid)"; - } - return "(unknown)"; -} - -conf_role_t conf_role_parse(const char *s) -{ - if (strcasecmp(s, "internal") == 0) return CFR_INTERNAL; - if (strcasecmp(s, "system") == 0) return CFR_SYSTEM; - if (strcasecmp(s, "defaultpcb") == 0) return CFR_DEFAULTPCB; - if (strcasecmp(s, "user") == 0) return CFR_USER; - if (strcasecmp(s, "env") == 0) return CFR_ENV; - if (strcasecmp(s, "project") == 0) return CFR_PROJECT; - if (strcasecmp(s, "design") == 0) return CFR_DESIGN; - if (strcasecmp(s, "cli") == 0) return CFR_CLI; - return CFR_invalid; -} - -const char *conf_role_name(conf_role_t r) -{ - switch(r) { - case CFR_INTERNAL: return "internal"; - case CFR_SYSTEM: return "system"; - case CFR_DEFAULTPCB: return "defaultpcb"; - case CFR_USER: return "user"; - case CFR_ENV: return "env"; - case CFR_PROJECT: return "project"; - case CFR_DESIGN: return "design"; - case CFR_CLI: return "cli"; - case CFR_file: return "(file)"; - case CFR_binary: return "(binary)"; - - case CFR_max_alloc: - case CFR_max_real: - case CFR_invalid: return "(invalid role)"; - } - return "(unknown role)"; -} - - -void conf_extract_poliprio(lht_node_t *root, conf_policy_t *gpolicy, long *gprio) -{ - long len = strlen(root->name), p = -1; - char tmp[128]; - char *sprio, *end; - conf_policy_t pol; - - if (len >= sizeof(tmp)) { - hid_cfg_error(root, "Invalid policy-prio '%s', subtree is ignored\n", root->name); - return; - } - - memcpy(tmp, root->name, len+1); - - /* split and convert prio */ - sprio = strchr(tmp, '-'); - if (sprio != NULL) { - *sprio = '\0'; - sprio++; - p = strtol(sprio, &end, 10); - if ((*end != '\0') || (p < 0)) { - hid_cfg_error(root, "Invalid prio in '%s', subtree is ignored\n", root->name); - return; - } - } - - /* convert policy */ - pol = conf_policy_parse(tmp); - if (pol == POL_invalid) { - hid_cfg_error(root, "Invalid policy in '%s', subtree is ignored\n", root->name); - return; - } - - /* by now the syntax is checked; save the output */ - *gpolicy = pol; - if (p >= 0) - *gprio = p; -} - - -int conf_get_policy_prio(lht_node_t *node, conf_policy_t *gpolicy, long *gprio) -{ - for(;;node = node->parent) { - if (node->parent == node->doc->root) { - conf_extract_poliprio(node, gpolicy, gprio); - return 0; - } - if (node->parent == NULL) - return -1; - } -} - -static int conf_parse_increments(Increments *inc, lht_node_t *node) -{ - lht_node_t *val; - - if (node->type != LHT_HASH) { - hid_cfg_error(node, "Increments need to be a hash\n"); - return -1; - } - -#define incload(field) \ - val = lht_dom_hash_get(node, #field); \ - if (val != NULL) {\ - if (val->type == LHT_TEXT) {\ - pcb_bool succ; \ - inc->field = GetValue(val->data.text.value, NULL, NULL, &succ); \ - if (!succ) \ - hid_cfg_error(node, "invalid numeric value in increment field " #field ": %s\n", val->data.text.value); \ - } \ - else\ - hid_cfg_error(node, "increment field " #field " needs to be a text node\n"); \ - } - - incload(grid); - incload(grid_min); - incload(grid_max); - incload(size); - incload(size_min); - incload(size_max); - incload(line); - incload(line_min); - incload(line_max); - incload(clear); - incload(clear_min); - incload(clear_max); - -#undef incload - return 0; -} - -const char *conf_get_project_conf_name(const char *project_fn, const char *pcb_fn, const char **try) -{ - static char res[MAXPATHLEN]; - static const char *project_name = "project.lht"; - FILE *f; - - if (project_fn != NULL) { - strncpy(res, project_fn, sizeof(res)-1); - res[sizeof(res)-1] = '\0'; - goto check; - } - - if (pcb_fn != NULL) { - char *end; - /* replace pcb name with project_name and test */ - strncpy(res, pcb_fn, sizeof(res)-1); - res[sizeof(res)-1] = '\0'; - end = strrchr(res, PCB_DIR_SEPARATOR_C); - if (end != NULL) { - if (end+1+sizeof(project_name) >= res + sizeof(res)) - return NULL; - strcpy(end+1, project_name); - goto check; - } - /* no path in pcb, try cwd */ - strcpy(res, project_name); - goto check; - } - - /* no pcb - no project */ - *try = ""; - return NULL; - - check:; - *try = res; - f = fopen(res, "r"); - if (f != NULL) { - fclose(f); - return res; - } - - return NULL; -} - -int conf_parse_text(confitem_t *dst, int idx, conf_native_type_t type, const char *text, lht_node_t *err_node) -{ - const char *strue[] = {"true", "yes", "on", "1", NULL}; - const char *sfalse[] = {"false", "no", "off", "0", NULL}; - const char **s; - char *end; - long l; - int base = 10; - double d; - const Unit *u; - - switch(type) { - case CFN_STRING: - dst->string[idx] = text; - break; - case CFN_BOOLEAN: - while(isspace(*text)) text++; - for(s = strue; *s != NULL; s++) - if (strncasecmp(*s, text, strlen(*s)) == 0) { - dst->boolean[idx] = 1; - return 0; - } - for(s = sfalse; *s != NULL; s++) - if (strncasecmp(*s, text, strlen(*s)) == 0) { - dst->boolean[idx] = 0; - return 0; - } - hid_cfg_error(err_node, "Invalid boolean value: %s\n", text); - return -1; - case CFN_INTEGER: - if ((text[0] == '0') && (text[1] == 'x')) { - text += 2; - base = 16; - } - l = strtol(text, &end, base); - while(isspace(*end)) - end++; - if (*end == '\0') { - dst->integer[idx] = l; - return 0; - } - hid_cfg_error(err_node, "Invalid integer value: %s\n", text); - return -1; - case CFN_REAL: - d = strtod(text, &end); - if (*end == '\0') { - dst->real[idx] = d; - return 0; - } - hid_cfg_error(err_node, "Invalid numeric value: %s\n", text); - return -1; - case CFN_COORD: - { - pcb_bool succ; - dst->coord[idx] = GetValue(text, NULL, NULL, &succ); - if (!succ) - hid_cfg_error(err_node, "Invalid numeric value (coordinate): %s\n", text); - } - break; - case CFN_UNIT: - u = get_unit_struct(text); - if (u == NULL) - hid_cfg_error(err_node, "Invalid unit: %s\n", text); - else - dst->unit[idx] = u; - break; - case CFN_INCREMENTS: - return conf_parse_increments(&(dst->increments[idx]), err_node); - case CFN_COLOR: - dst->color[idx] = text; /* let the HID check validity to support flexibility of the format */ - break; - default: - /* unknown field type registered in the fields hash: internal error */ - return -1; - } - return 0; -} - -int conf_merge_patch_text(conf_native_t *dest, lht_node_t *src, int prio, conf_policy_t pol) -{ - if ((pol == POL_DISABLE) || (dest->prop[0].prio > prio)) - return 0; - - if (dest->random_flags.read_only) { - hid_cfg_error(src, "WARNING: not going to overwrite read-only value %s from a config file\n", dest->hash_path); - return 0; - } - - if (conf_parse_text(&dest->val, 0, dest->type, src->data.text.value, src) == 0) { - dest->prop[0].prio = prio; - dest->prop[0].src = src; - dest->used = 1; - dest->conf_rev = conf_rev; - } - return 0; -} - -static void conf_insert_arr(conf_native_t *dest, int offs) -{ -#define CASE_MOVE(typ, fld) \ - case typ: memmove(dest->val.fld+offs, dest->val.fld, dest->used * sizeof(dest->val.fld[0])); return - - memmove(dest->prop+offs, dest->prop, dest->used * sizeof(dest->prop[0])); - if (dest->used > 0) { - switch(dest->type) { - CASE_MOVE(CFN_STRING, string); - CASE_MOVE(CFN_BOOLEAN, boolean); - CASE_MOVE(CFN_INTEGER, integer); - CASE_MOVE(CFN_REAL, real); - CASE_MOVE(CFN_COORD, coord); - CASE_MOVE(CFN_UNIT, unit); - CASE_MOVE(CFN_COLOR, color); - CASE_MOVE(CFN_LIST, list); - CASE_MOVE(CFN_INCREMENTS, increments); - } - } -#undef CASE_MOVE - abort(); /* unhandled type */ -} - -int conf_merge_patch_array(conf_native_t *dest, lht_node_t *src_lst, int prio, conf_policy_t pol) -{ - lht_node_t *s; - int res, idx, didx, maxpr; - - if ((pol == POL_DISABLE) || (pol == POL_invalid)) - return 0; - - if (pol == POL_PREPEND) { - for(s = src_lst->data.list.first, maxpr = 0; s != NULL; s = s->next, maxpr++) ; - - if (dest->used+maxpr >= dest->array_size) - maxpr = dest->array_size - dest->used - 1; - - conf_insert_arr(dest, maxpr); - dest->used += maxpr; - } -/*printf("arr merge prio: %d\n", prio);*/ - for(s = src_lst->data.list.first, idx = 0; s != NULL; s = s->next, idx++) { - if (s->type == LHT_TEXT) { - switch(pol) { - case POL_PREPEND: - if (idx < maxpr) - didx = idx; - else - didx = dest->array_size+1; /* indicate array full */ - break; - case POL_APPEND: - didx = dest->used++; - break; - case POL_OVERWRITE: - didx = idx; - break; - case POL_DISABLE: case POL_invalid: return 0; /* compiler warning */ - } -/*printf(" didx: %d / %d '%s'\n", didx, dest->array_size, s->data.text.value);*/ - if (didx >= dest->array_size) { - hid_cfg_error(s, "Array is already full [%d] of [%d] ignored value: '%s' policy=%d\n", dest->used, dest->array_size, s->data.text.value, pol); - res = -1; - break; - } - - if (conf_parse_text(&dest->val, didx, dest->type, s->data.text.value, s) == 0) { - dest->prop[didx].prio = prio; - dest->prop[didx].src = s; - if (didx >= dest->used) - dest->used = didx+1; - } - } - else { - hid_cfg_error(s, "List item must be text\n"); - res = -1; - } - } - - return res; -} - -int conf_merge_patch_list(conf_native_t *dest, lht_node_t *src_lst, int prio, conf_policy_t pol) -{ - lht_node_t *s; - int res = 0; - conf_listitem_t *i; - - if ((pol == POL_DISABLE) || (pol == POL_invalid)) - return 0; - - if (pol == POL_OVERWRITE) { - /* overwrite the whole list: make it empty then append new elements */ - while((i = conflist_first(dest->val.list)) != NULL) - conflist_remove(i); - } - - for(s = src_lst->data.list.first; s != NULL; s = s->next) { - if (s->type == LHT_TEXT) { - i = calloc(sizeof(conf_listitem_t), 1); - i->val.string = &i->payload; - i->prop.prio = prio; - i->prop.src = s; - if (conf_parse_text(&i->val, 0, CFN_STRING, s->data.text.value, s) != 0) { - free(i); - continue; - } - - switch(pol) { - case POL_PREPEND: - conflist_insert(dest->val.list, i); - dest->used |= 1; - break; - case POL_APPEND: - case POL_OVERWRITE: - conflist_append(dest->val.list, i); - dest->used |= 1; - break; - case POL_DISABLE: case POL_invalid: return 0; /* compiler warning */ - } - } - else { - hid_cfg_error(s, "List item must be text\n"); - res = -1; - } - } - return res; -} - -int conf_merge_patch_recurse(lht_node_t *sect, int default_prio, conf_policy_t default_policy, const char *path_prefix); - -int conf_merge_patch_item(const char *path, lht_node_t *n, int default_prio, conf_policy_t default_policy) -{ - conf_native_t *target = conf_get_field(path); - int res = 0; - switch(n->type) { - case LHT_TEXT: - if (target == NULL) { - if ((strncmp(path, "plugins/", 8) != 0) && (strncmp(path, "utils/", 6) != 0))/* it is normal to have configuration for plugins and utils not loaded - ignore these */ - hid_cfg_error(n, "conf error: lht->bin conversion: can't find path '%s' - check your lht!\n", path); - break; - } - conf_merge_patch_text(target, n, default_prio, default_policy); - break; - case LHT_HASH: - if (target == NULL) /* no leaf: another level of structs */ - res |= conf_merge_patch_recurse(n, default_prio, default_policy, path); - else /* leaf: pretend it's text so it gets parsed */ - conf_merge_patch_text(target, n, default_prio, default_policy); - break; - case LHT_LIST: - if (target == NULL) - hid_cfg_error(n, "conf error: lht->bin conversion: can't find path '%s' - check your lht; may it be that it should be a hash instead of a list?\n", path); - else if (target->type == CFN_LIST) - res |= conf_merge_patch_list(target, n, default_prio, default_policy); - else if (target->array_size > 1) - res |= conf_merge_patch_array(target, n, default_prio, default_policy); - else - hid_cfg_error(n, "Attempt to initialize a scalar with a list - this node should be a text node\n"); - break; - case LHT_SYMLINK: -#warning TODO - break; - case LHT_INVALID_TYPE: - case LHT_TABLE: - /* intentionally unhandled types */ - break; - } - return res; -} - - -/* merge main subtree of a patch */ -int conf_merge_patch_recurse(lht_node_t *sect, int default_prio, conf_policy_t default_policy, const char *path_prefix) -{ - lht_dom_iterator_t it; - lht_node_t *n; - char path[256], *pathe; - char *namee; - int nl, ppl = strlen(path_prefix), res = 0; - - memcpy(path, path_prefix, ppl); - path[ppl] = '/'; - pathe = path + ppl + 1; - - for(n = lht_dom_first(&it, sect); n != NULL; n = lht_dom_next(&it)) { - nl = strlen(n->name); - memcpy(pathe, n->name, nl); - namee = pathe+nl; - *namee = '\0'; - res |= conf_merge_patch_item(path, n, default_prio, default_policy); - } - return res; -} - -int conf_merge_patch(lht_node_t *root, long gprio) -{ - conf_policy_t gpolicy; - lht_node_t *n; - lht_dom_iterator_t it; - - if (root->type != LHT_HASH) { - hid_cfg_error(root, "patch root should be a hash\n"); - return -1; - } - - conf_extract_poliprio(root, &gpolicy, &gprio); - - /* iterate over all hashes and insert them recursively */ - for(n = lht_dom_first(&it, root); n != NULL; n = lht_dom_next(&it)) - if (n->type == LHT_HASH) - conf_merge_patch_recurse(n, gprio, gpolicy, n->name); - - return 0; -} - -typedef struct { - long prio; - conf_policy_t policy; - lht_node_t *subtree; -} merge_subtree_t; - -#define GVT(x) vmst_ ## x -#define GVT_ELEM_TYPE merge_subtree_t -#define GVT_SIZE_TYPE size_t -#define GVT_DOUBLING_THRS 64 -#define GVT_START_SIZE 32 -#define GVT_FUNC -#define GVT_REALLOC(vect, ptr, size) realloc(ptr, size) -#define GVT_FREE(vect, ptr) free(ptr) -#include -#include -#include - -vmst_t merge_subtree; /* automatically initialized to all-zero */ - -static void add_subtree(int role, lht_node_t *subtree_parent_root, lht_node_t *subtree_root) -{ - merge_subtree_t *m; - - m = vmst_alloc_append(&merge_subtree, 1); - m->prio = conf_default_prio[role]; - m->policy = POL_invalid; - - conf_extract_poliprio(subtree_parent_root, &m->policy, &m->prio); - m->subtree = subtree_root; -} - -static int mst_prio_cmp(const void *a, const void *b) -{ - const merge_subtree_t *s1 = a, *s2 = b; - if (s1->prio > s2->prio) - return 1; - return -1; -} - -int conf_merge_all(const char *path) -{ - int n, ret = 0; - vmst_truncate(&merge_subtree, 0); - - for(n = 0; n < CFR_max_real; n++) { - lht_node_t *cr, *r, *r2; - if (conf_root[n] == NULL) - continue; - - cr = conf_lht_get_confroot(conf_root[n]->root); - if (cr == NULL) - continue; - - for(r = cr->data.list.first; r != NULL; r = r->next) { - if (path != NULL) { - r2 = lht_tree_path_(r->doc, r, path, 1, 0, NULL); - if (r2 != NULL) - add_subtree(n, r, r2); - } - else - add_subtree(n, r, r); - } - } - - qsort(merge_subtree.array, vmst_len(&merge_subtree), sizeof(merge_subtree_t), mst_prio_cmp); - for(n = 0; n < vmst_len(&merge_subtree); n++) { - if (path != NULL) - ret |= conf_merge_patch_item(path, merge_subtree.array[n].subtree, merge_subtree.array[n].prio, merge_subtree.array[n].policy); - else - ret |= conf_merge_patch(merge_subtree.array[n].subtree, merge_subtree.array[n].prio); - } - return ret; -} - -static void conf_field_clear(conf_native_t *f) -{ - if (strncmp(f->hash_path, "temp", 4) == 0) - return; - if (f->used > 0) { -#define clr(field) memset(f->val.field, 0, sizeof(*(f->val.field)) * f->used) - switch(f->type) { - case CFN_STRING: clr(string); break; - case CFN_BOOLEAN: clr(boolean); break; - case CFN_INTEGER: clr(integer); break; - case CFN_REAL: clr(real); break; - case CFN_COORD: clr(coord); break; - case CFN_UNIT: clr(unit); break; - case CFN_COLOR: clr(color); break; - case CFN_INCREMENTS: clr(increments); break; - case CFN_LIST: - while(conflist_first(f->val.list)) { /* need to free all items of a list before clearing the main struct */ - conf_listitem_t *i = conflist_first(f->val.list); - conflist_remove(i); - free(i); - } - clr(list); - break; - } - memset(f->prop, 0, sizeof(confprop_t) * f->used); -#undef clr - } - - f->used = 0; - f->conf_rev = conf_rev; -} - -int conf_rev = 0; -void conf_update(const char *path) -{ - conf_native_t *n; - - /* clear memory-bin data first */ - if (path == NULL) { - htsp_entry_t *e; - conf_fields_foreach(e) { - conf_hid_global_cb((conf_native_t *)e->value, val_change_pre); - conf_hid_local_cb((conf_native_t *)e->value, val_change_pre); - conf_field_clear(e->value); - } - } - else { - n = conf_get_field(path); - if (n == NULL) { - char *path_, *field; - path_ = pcb_strdup(path); - - /* It might be an array element - truncate */ - field = strrchr(path_, '['); - if (field != NULL) { - *field = '\0'; - n = conf_get_field(path_); - } - - /* It may be a field of an increment, truncate last portion */ - if (n == NULL) { - field = strrchr(path_, '/'); - if (field == NULL) { - free(path_); - return; - } - *field = '\0'; - n = conf_get_field(path_); - if (n->type != CFN_INCREMENTS) - n = NULL; - } - - /* if a valid node is found, update it */ - if (n != NULL) - conf_update(path_); - - free(path_); - return; - } - conf_field_clear(n); - conf_hid_global_cb(n, val_change_pre); - conf_hid_local_cb(n, val_change_pre); - } - - /* merge all memory-lht data to memory-bin */ - conf_merge_all(path); - conf_core_postproc(); - - if (path == NULL) { - htsp_entry_t *e; - conf_fields_foreach(e) { - conf_hid_local_cb((conf_native_t *)e->value, val_change_post); - conf_hid_global_cb((conf_native_t *)e->value, val_change_post); - } - } - else { - conf_hid_local_cb(n, val_change_post); - conf_hid_global_cb(n, val_change_post); - } - conf_rev++; -} - -static lht_node_t *conf_lht_get_first_(lht_node_t *cwd) -{ - /* assume root is a li and add to the first hash */ - cwd = conf_lht_get_confroot(cwd); - if (cwd == NULL) - return NULL; - cwd = cwd->data.list.first; - if ((cwd == NULL) || (cwd->type != LHT_HASH)) - return NULL; - return cwd; -} - -lht_node_t *conf_lht_get_first(conf_role_t target) -{ - assert(target != CFR_invalid); - assert(target >= 0); - assert(target < CFR_max_alloc); - if (conf_root[target] == NULL) - return NULL; - return conf_lht_get_first_(conf_root[target]->root); -} - -static lht_node_t *conf_lht_get_at_(conf_role_t target, const char *conf_path, const char *lht_path, int create) -{ - lht_node_t *n, *r; - n = conf_lht_get_first(target); - if (n == NULL) - return NULL; - r = lht_tree_path_(n->doc, n, lht_path, 1, 0, NULL); - if ((r == NULL) && (create)) { - conf_set_dry(target, conf_path, -1, "", POL_OVERWRITE); - r = lht_tree_path_(n->doc, n, lht_path, 1, 0, NULL); - } - return r; -} - -lht_node_t *conf_lht_get_at(conf_role_t target, const char *path, int create) -{ - lht_node_t *r; - char *pc, *end; - if (conf_root[target] == NULL) { - if (!create) - return NULL; - conf_reset(target, ""); - } - end = strchr(path, '['); - if (end == NULL) { - r = conf_lht_get_at_(target, path, path, create); - } - else { - /* lihata syntax differs from conf syntax in array indexing */ - pc = pcb_strdup(path); - pc[end-path] = '/'; - end = strchr(pc+(end-path), ']'); - if (end != NULL) - *end = '\0'; - r = conf_lht_get_at_(target, path, pc, create); - free(pc); - } - return r; -} - - -void conf_load_all(const char *project_fn, const char *pcb_fn) -{ - int i; - lht_node_t *dln; - const char *pc, *try; - - /* get the lihata node for design/default_layer_name */ - conf_load_as(CFR_INTERNAL, conf_internal, 1); - dln = conf_lht_get_at(CFR_INTERNAL, "design/default_layer_name", 1); - assert(dln != NULL); - assert(dln->type == LHT_LIST); - dln = dln->data.list.first; - - /* Set up default layer names - make sure there are enough layers (over the hardwired ones, if any) */ - for (i = 0; i < MAX_LAYER; i++) { - char buf[20]; - if (dln == NULL) { - sprintf(buf, "signal%d", i + 1); - if (conf_set_dry(CFR_INTERNAL, "design/default_layer_name", i, buf, POL_OVERWRITE) != 0) - printf("Can't set layer name\n"); - } - else - dln = dln->next; - } - - /* load config files */ - conf_load_as(CFR_SYSTEM, PCBSHAREDIR "/pcb-conf.lht", 0); - conf_load_as(CFR_USER, conf_user_fn, 0); - pc = conf_get_project_conf_name(project_fn, pcb_fn, &try); - if (pc != NULL) - conf_load_as(CFR_PROJECT, pc, 0); - conf_merge_all(NULL); - - /* create the user config (in-memory-lht) if it does not exist on disk; - this is needed so if the user makes config changes from the GUI things - get saved. */ - if (conf_root[CFR_USER] == NULL) - conf_reset(CFR_USER, conf_user_fn); -} - -void conf_load_project(const char *project_fn, const char *pcb_fn) -{ - const char *pc, *try; - - assert((project_fn != NULL) || (pcb_fn != NULL)); - - pc = conf_get_project_conf_name(project_fn, pcb_fn, &try); - if (pc != NULL) - if (conf_load_as(CFR_PROJECT, pc, 0) != 0) - pc = NULL; - if (pc == NULL) - conf_reset(CFR_PROJECT, ""); - conf_update(NULL); -} - -void conf_reg_field_(void *value, int array_size, conf_native_type_t type, const char *path, const char *desc, conf_flag_t flags) -{ - conf_native_t *node; - - if (conf_fields == NULL) { - conf_fields = htsp_alloc(strhash, strkeyeq); - assert(conf_fields != NULL); - } - assert(array_size >= 1); - - assert(htsp_get(conf_fields, path) == NULL); - - node = calloc(sizeof(conf_native_t), 1); - node->array_size = array_size; - node->type = type; - node->val.any = value; - node->prop = calloc(sizeof(confprop_t), array_size); - node->description = desc; - node->hash_path = path; - node->flags = flags; - vtp0_init(&(node->hid_data)); - - htsp_set(conf_fields, (char *)path, node); -} - -void conf_free_native(conf_native_t *node) -{ - if (node->type == CFN_LIST) { - while(conflist_first(node->val.list) != NULL) { - conf_listitem_t *first = conflist_first(node->val.list); - conflist_remove(first); - free(first); - } - } - - vtp0_uninit(&(node->hid_data)); - free(node->prop); - free(node); -} - -void conf_unreg_fields(const char *prefix) -{ - int len = strlen(prefix); - htsp_entry_t *e; - - assert(prefix[len-1] == '/'); - - conf_fields_foreach(e) { - if (strncmp(e->key, prefix, len) == 0) { - conf_free_native(e->value); - htsp_delentry(conf_fields, e); - } - } -} - -conf_native_t *conf_get_field(const char *path) -{ - return htsp_get(conf_fields, path); -} - -int conf_set_dry(conf_role_t target, const char *path_, int arr_idx, const char *new_val, conf_policy_t pol) -{ - char *path, *basename, *next, *last, *sidx, *increment_field = NULL; - conf_native_t *nat; - lht_node_t *cwd, *nn; - lht_node_type_t ty; - int idx = -1; - - /* Remove in overwrite only */ - if ((new_val == NULL) && (pol != POL_OVERWRITE)) - return -1; - - path = pcb_strdup(path_); - sidx = strrchr(path, '['); - if (sidx != NULL) { - char *end; - *sidx = '\0'; - sidx++; - idx = strtol(sidx, &end, 10); - if ((*end != ']') || (strchr(sidx, '/') != NULL)) { - free(path); - return -1; - } - if ((arr_idx >= 0) && (arr_idx != idx)) { - free(path); - return -1; - } - } - else if (arr_idx >= 0) - idx = arr_idx; - - nat = conf_get_field(path); - if (nat == NULL) { - /* might be increments */ - increment_field = strrchr(path, '/'); - if (increment_field == NULL) { - free(path); - return -1; - } - *increment_field = '\0'; - nat = conf_get_field(path); - if ((nat == NULL) || (nat->type != CFN_INCREMENTS)) { - free(path); - return -1; - } - *increment_field = '/'; - increment_field++; - } - - - if (conf_root[target] == NULL) { - free(path); - return -1; - } - if (pol == POL_DISABLE) { - free(path); - return 0; - } - if ((pol != POL_OVERWRITE) && (idx >= 0)) { - free(path); - return -1; - } - - cwd = conf_lht_get_first(target); - if (cwd == NULL) { - free(path); - return -1; - } - - if (idx >= nat->array_size) { - Message(PCB_MSG_DEFAULT, "Error: can't conf_set() %s[%d]: %d is beyond the end of the array (%d)\n", path, idx, idx, nat->array_size); - free(path); - return -1; - } - - basename = strrchr(path, '/'); - if (basename == NULL) { - free(path); - return -1; - } - *basename = '\0'; - basename++; - - /* create parents if they do not exist */ - last = next = path; - do { - next = strchr(last, '/'); - if (next != NULL) - *next = '\0'; - - nn = lht_tree_path_(conf_root[target], cwd, last, 1, 0, NULL); - if (nn == NULL) { - if (new_val == NULL) { - free(path); - return 0; - } - if (conf_root_lock[target]) { - Message(PCB_MSG_DEFAULT, "WARNING: can't set config item %s because target in-memory lihata does not have the node and is tree-locked\n", path_); - free(path); - return -1; - } - /* create a new hash node */ - nn = lht_dom_node_alloc(LHT_HASH, last); - if (lht_dom_hash_put(cwd, nn) != LHTE_SUCCESS) { - lht_dom_node_free(nn); - free(path); - return -1; - } - } - cwd = nn; - if (next != NULL) - last = next+1; - } while(next != NULL); - - /* add the last part of the path, which is either a list or a text node */ - if ((nat->array_size > 1) || (nat->type == CFN_LIST)) - ty = LHT_LIST; - else - ty = LHT_TEXT; - - nn = lht_tree_path_(conf_root[target], cwd, basename, 1, 0, NULL); - if (nn == NULL) { - if (conf_root_lock[target]) { - free(path); - return -1; - } - nn = lht_dom_node_alloc(ty, basename); - if (lht_dom_hash_put(cwd, nn) != LHTE_SUCCESS) { - lht_dom_node_free(nn); - free(path); - return -1; - } - } - cwd = nn; - - /* set value */ - if (ty == LHT_LIST) { - lht_err_t err = 0; - - if (new_val != NULL) - nn = lht_dom_node_alloc(LHT_TEXT, ""); - - if (pol == POL_OVERWRITE) { - if (idx == -1) { - /* empty the list so that we insert to an empty list which is overwriting the list */ - while(cwd->data.list.first != NULL) - lht_tree_del(cwd->data.list.first); - if (new_val != NULL) - lht_dom_list_append(cwd, nn); - } - else { - lht_node_t *old = lht_tree_list_nth(cwd, idx); - if (old != NULL) { - /* the list is large enough already: overwrite the element at idx */ - if (new_val == NULL) { - err = lht_tree_del(old); - free(path); - return 0; - } - else - err = lht_tree_list_replace_child(cwd, old, nn); - } - else if (new_val == NULL) { - free(path); - return 0; - } - else { - int n; - lht_node_t *i; - /* count members */ - for (n = 0, i = cwd->data.list.first; i != NULL; i = i->next) n++; - /* append just enough elements to get one less than needed */ - err = 0; - for(n = idx - n; n > 0; n--) { - lht_node_t *dummy = lht_dom_node_alloc(LHT_TEXT, ""); - err |= lht_dom_list_append(cwd, dummy); - } - /* append the new node */ - err |= lht_dom_list_append(cwd, nn); - } - } - } - else if ((pol == POL_PREPEND) || (pol == POL_OVERWRITE)) - err = lht_dom_list_insert(cwd, nn); - else if (pol == POL_APPEND) - err = lht_dom_list_append(cwd, nn); - if (err != LHTE_SUCCESS) { - lht_dom_node_free(nn); - free(path); - return -1; - } - cwd = nn; - } - else { - if (idx > 0) { - free(path); - return -1; /* only lists/array path should have index larger than 0 */ - } - cwd = nn; - } - - /* by now cwd is the text node we need to load with the new value; it is - either a text config value under a hash or a list item already allocated */ - if (cwd->type != LHT_TEXT) { - free(path); - return -1; - } - - if (new_val != NULL) { - if (cwd->data.text.value != NULL) - free(cwd->data.text.value); - - cwd->data.text.value = pcb_strdup(new_val); - cwd->file_name = conf_root[target]->active_file; - } - else - lht_tree_del(cwd); - - conf_lht_dirty[target]++; - - free(path); - return 0; -} - -int conf_set(conf_role_t target, const char *path, int arr_idx, const char *new_val, conf_policy_t pol) -{ - int res; - res = conf_set_dry(target, path, arr_idx, new_val, pol); - if (res < 0) - return res; - conf_update(path); - return 0; -} - -int conf_del(conf_role_t target, const char *path, int arr_idx) -{ - int res; - res = conf_set_dry(target, path, arr_idx, NULL, POL_OVERWRITE); - if (res < 0) - return res; - conf_update(path); - return 0; -} - - -int conf_set_native(conf_native_t *field, int arr_idx, const char *new_val) -{ - lht_node_t *node; - - if (arr_idx >= field->used) - return -1; - - node = field->prop[arr_idx].src; - - if (node->data.text.value != NULL) - free(node->data.text.value); - - node->data.text.value = pcb_strdup(new_val); - return 0; -} - - -int conf_set_from_cli(const char *prefix, const char *arg_, const char *val, const char **why) -{ - char *arg = NULL, *op, *s; - const char *sc; - conf_policy_t pol = POL_OVERWRITE; - int ret; - - if (prefix != NULL) { - for(sc = arg_; (*sc != '=') && (*sc != '\0'); sc++) - if (*sc == '/') - arg = pcb_strdup(arg_); /* full path, don't use prefix */ - - if (arg == NULL) { /* insert prefix */ - int pl = strlen(prefix), al = strlen(arg_); - while((pl > 0) && (prefix[pl-1] == '/')) pl--; - arg = malloc(pl+al+2); - memcpy(arg, prefix, pl); - arg[pl] = '/'; - strcpy(arg+pl+1, arg_); - } - } - else - arg = pcb_strdup(arg_); - - /* replace any - with _ in the path part; cli accepts dash but the backing C - struct field names don't */ - for(s = arg, op = NULL; (*s != '\0') && (op == NULL); s++) { - if (*s == '=') - op = s; - else if (*s == '-') - *s = '_'; - } - - /* extract val, if we need to */ - if (val == NULL) { - *why = ""; - if (op == arg) { - free(arg); - *why = "value not specified; syntax is path=val"; - return -1; - } - if (op == NULL) { - conf_native_t *n = conf_get_field(arg); - if ((n == NULL) || (n->type != CFN_BOOLEAN)) { - free(arg); - *why = "value not specified for non-boolean variable; syntax is path=val"; - return -1; - } - val = "1"; /* auto-value for boolean */ - } - else { - *op = '\0'; - val = op+1; - op--; - switch(*op) { - case '+': pol = POL_APPEND; *op = '\0'; break; - case '^': pol = POL_PREPEND; *op = '\0'; break; - } - } - } - - /* now that we have a clean path (arg) and a value, try to set the config */ - ret = conf_set(CFR_CLI, arg, -1, val, pol); - if (ret != 0) - *why = "invalid config path"; - - free(arg); - return ret; -} - -void conf_parse_arguments(const char *prefix, int *argc, char ***argv) -{ - int n, dst; - - for(n = 0, dst = 0; n < *argc; n++,dst++) { - char *a = (*argv)[n]; - const char *why; - int try_again = -1; - - if (a[0] == '-') a++; - if (a[0] == '-') a++; - - try_again = conf_set_from_cli(prefix, a, NULL, &why); - if (try_again && (n < (*argc) - 1)) { - try_again = conf_set_from_cli(prefix, a, (*argv)[n+1], &why); - if (!try_again) - n++; - } - if (try_again) - (*argv)[dst] = (*argv)[n]; - else - dst--; - } - *argc = dst; -} - -void conf_usage(const char *prefix, void (*print)(const char *name, const char *help)) -{ - htsp_entry_t *e; - int pl = (prefix == NULL ? 0 : strlen(prefix)); - - conf_fields_foreach(e) { - if ((prefix == NULL) || (strncmp(prefix, e->key, pl) == 0)) { - conf_native_t *n = e->value; - if (n->flags & CFF_USAGE) { - int kl = strlen(n->hash_path); - char *s, *name = malloc(kl+32); - const char *sc; - for(sc = n->hash_path + pl; *sc == '/'; sc++) ; - name[0] = '-'; - name[1] = '-'; - strcpy(name+2, sc); - for(s = name; *s != '\0'; s++) - if (*s == '_') - *s = '-'; - switch(n->type) { - case CFN_BOOLEAN: /* implicit true */ break; - case CFN_STRING: strcpy(s, " str"); break; - case CFN_INTEGER: strcpy(s, " int"); break; - case CFN_REAL: strcpy(s, " num"); break; - case CFN_COORD: strcpy(s, " coord"); break; - case CFN_UNIT: strcpy(s, " unit"); break; - case CFN_COLOR: strcpy(s, " color"); break; - case CFN_LIST: - case CFN_INCREMENTS: - strcpy(s, " ???"); - break; - } - print(name, n->description); - free(name); - } - } - } -} - -int conf_replace_subtree(conf_role_t dst_role, const char *dst_path, conf_role_t src_role, const char *src_path) -{ - lht_node_t *dst = conf_lht_get_at(dst_role, dst_path, 1); - lht_node_t *src, *new_src = NULL; - - if (src_role == CFR_binary) { - char *name; - lht_node_t *ch = NULL; - int isarr, i; - conf_native_t *n = conf_get_field(src_path); - - if (n == NULL) - return -1; - name = strrchr(n->hash_path, '/'); - if (name == NULL) - return -1; - - isarr = n->array_size > 1; - if (isarr) - src = lht_dom_node_alloc(LHT_LIST, name+1); - - for(i = 0; i < n->array_size; i++) { - gds_t s; - - gds_init(&s); - if (n->type == CFN_LIST) { - conf_listitem_t *it; - ch = lht_dom_node_alloc(LHT_LIST, name+1); - for(it = conflist_first(n->val.list); it != NULL; it = conflist_next(it)) { - lht_node_t *txt; - txt = lht_dom_node_alloc(LHT_TEXT, ""); - txt->data.text.value = pcb_strdup(it->payload); - lht_dom_list_append(ch, txt); - } - } - else { - conf_print_native_field((conf_pfn)pcb_append_printf, &s, 0, &n->val, n->type, n->prop+i, i); - ch = lht_dom_node_alloc(LHT_TEXT, isarr ? "" : name+1); - ch->data.text.value = s.array; - if (isarr) - lht_dom_list_append(src, ch); - s.array = NULL; - gds_uninit(&s); - } - } - - if (!isarr) - src = ch; - } - else - src = conf_lht_get_at(src_role, src_path, 0); - - if ((src == NULL) && (dst != NULL)) { - lht_tree_del(dst); - return 0; - } - - if (dst == NULL) - goto err; - - new_src = lht_dom_duptree(src); - if (new_src == NULL) - goto err; - - if (lht_tree_replace(dst, new_src) != LHTE_SUCCESS) - goto err; - - conf_lht_dirty[dst_role]++; - - lht_tree_del(dst); - if (src_role == CFR_binary) - lht_dom_node_free(src); - return 0; - - err:; - if (src_role == CFR_binary) - lht_dom_node_free(src); - if (new_src != NULL) - lht_dom_node_free(new_src); - return -1; -} - - -int conf_save_file(const char *project_fn, const char *pcb_fn, conf_role_t role, const char *fn) -{ - int fail = 1; - lht_node_t *r = conf_lht_get_first(role); - const char *try; - char *efn; - - /* do not save if there's no change */ - if (conf_lht_dirty[role] == 0) - return 0; - - if (fn == NULL) { - switch(role) { - case CFR_USER: - fn = conf_user_fn; - break; - case CFR_PROJECT: - fn = conf_get_project_conf_name(project_fn, pcb_fn, &try); - if (fn == NULL) { - Message(PCB_MSG_DEFAULT, "Error: can not save config to project file: %s does not exist - please create an empty file there first\n", try); - return -1; - } - break; - default: return -1; - } - } - - resolve_path(fn, &efn, 0); - - if (r != NULL) { - FILE *f; - f = fopen(efn, "w"); - - if ((f == NULL) && (role == CFR_USER)) { - /* create the directory and try again */ - char *path = pcb_strdup(efn), *end; - end = strrchr(path, '/'); - if (end != NULL) { - *end = '\0'; - if (pcb_mkdir(path, 0755) == 0) { - Message(PCB_MSG_DEFAULT, "Created directory %s for saving %s\n", path, fn); - f = fopen(efn, "w"); - } - else - Message(PCB_MSG_DEFAULT, "Error: failed to create directory %s for saving %s\n", path, efn); - } - free(path); - } - - if (f != NULL) { -#warning CONF TODO: a project file needs to be loaded, merged, then written (to preserve non-config nodes) - lht_dom_export(r->doc->root, f, ""); - fail = 0; - conf_lht_dirty[role] = 0; - fclose(f); - } - else - Message(PCB_MSG_DEFAULT, "Error: can't save config to %s - can't open the file for write\n", fn); - } - - free(efn); - return fail; -} - -int conf_export_to_file(const char *fn, conf_role_t role, const char *conf_path) -{ - lht_node_t *at = conf_lht_get_at(role, conf_path, 0); - lht_err_t r; - FILE *f; - - if (at == NULL) - return -1; - - f = fopen(fn, "w"); - if (f == NULL) - return -1; - - r = lht_dom_export(at, f, ""); - fclose(f); - return r; -} - - -conf_listitem_t *conf_list_first_str(conflist_t *list, const char **item_str, int *idx) -{ - conf_listitem_t *item_li; - item_li = conflist_first(list); - if (item_li == NULL) - return NULL; - if (item_li->type == CFN_STRING) { - *item_str = item_li->val.string[0]; - return item_li; - } - return conf_list_next_str(item_li, item_str, idx); -} - -conf_listitem_t *conf_list_next_str(conf_listitem_t *item_li, const char **item_str, int *idx) -{ - while((item_li = conflist_next(item_li)) != NULL) { - if (item_li->type != CFN_STRING) - continue; - /* found next string */ - *item_str = item_li->val.string[0]; - return item_li; - } - /* found end of the list */ - *item_str = NULL; - return item_li; -} - -const char *conf_concat_strlist(const conflist_t *lst, gds_t *buff, int *inited, char sep) -{ - int n; - conf_listitem_t *ci; - - if ((inited == NULL) || (!*inited)) { - gds_init(buff); - if (inited != NULL) - *inited = 1; - } - else - gds_truncate(buff, 0); - - for (n = 0, ci = conflist_first((conflist_t *)lst); ci != NULL; ci = conflist_next(ci), n++) { - const char *p = ci->val.string[0]; - if (ci->type != CFN_STRING) - continue; - if (n > 0) - gds_append(buff, sep); - gds_append_str(buff, p); - } - return buff->array; -} - -void conf_lock(conf_role_t target) -{ - conf_root_lock[target] = 1; -} - -void conf_unlock(conf_role_t target) -{ - conf_root_lock[target] = 0; -} - -int conf_islocked(conf_role_t target) -{ - return conf_root_lock[target]; -} - -int conf_isdirty(conf_role_t target) -{ - return conf_lht_dirty[target]; -} - -void conf_makedirty(conf_role_t target) -{ - conf_lht_dirty[target]++; -} -conf_role_t conf_lookup_role(const lht_node_t *nd) -{ - conf_role_t r; - for(r = 0; r < CFR_max_real; r++) - if (conf_root[r] == nd->doc) - return r; - - return CFR_invalid; -} - -void conf_reset(conf_role_t target, const char *source_fn) -{ - lht_node_t *n; - - if (conf_root[target] != NULL) - lht_dom_uninit(conf_root[target]); - - conf_root[target] = lht_dom_init(); - lht_dom_loc_newfile(conf_root[target], source_fn); - conf_root[target]->root = lht_dom_node_alloc(LHT_LIST, conf_list_name); - conf_root[target]->root->doc = conf_root[target]; - n = lht_dom_node_alloc(LHT_HASH, "overwrite"); - lht_dom_list_insert(conf_root[target]->root, n); -} - -/*****************/ -static int needs_braces(const char *s) -{ - for(; *s != '\0'; s++) - if (!isalnum(*s) && (*s != '_') && (*s != '-') && (*s != '+') && (*s != '/') && (*s != ':') && (*s != '.') && (*s != ',') && (*s != '$') && (*s != '(') && (*s != ')') && (*s != '~')) - return 1; - return 0; -} - -#define print_str_or_null(pfn, ctx, verbose, chk, out) \ - do { \ - if (chk == NULL) { \ - if (verbose) \ - ret += pfn(ctx, "");\ - } \ - else {\ - if (needs_braces(out)) \ - ret += pfn(ctx, "{%s}", out); \ - else \ - ret += pfn(ctx, "%s", out); \ - } \ - } while(0) - -int conf_print_native_field(conf_pfn pfn, void *ctx, int verbose, confitem_t *val, conf_native_type_t type, confprop_t *prop, int idx) -{ - int ret = 0; - switch(type) { - case CFN_STRING: print_str_or_null(pfn, ctx, verbose, val->string[idx], val->string[idx]); break; - case CFN_BOOLEAN: ret += pfn(ctx, "%d", val->boolean[idx]); break; - case CFN_INTEGER: ret += pfn(ctx, "%ld", val->integer[idx]); break; - case CFN_REAL: ret += pfn(ctx, "%f", val->real[idx]); break; - case CFN_COORD: ret += pfn(ctx, "%$mS", val->coord[idx]); break; - case CFN_UNIT: print_str_or_null(pfn, ctx, verbose, val->unit[idx], val->unit[idx]->suffix); break; - case CFN_COLOR: print_str_or_null(pfn, ctx, verbose, val->color[idx], val->color[idx]); break; - case CFN_INCREMENTS: - { - Increments *i = &val->increments[idx]; - ret += pfn(ctx, "{ grid=%$mS/%$mS/%$mS size=%$mS/%$mS/%$mS line=%$mS/%$mS/%$mS clear=%$mS/%$mS/%$mS}", - i->grid, i->grid_min, i->grid_max, - i->size, i->size_min, i->size_max, - i->line, i->line_min, i->line_max, - i->clear, i->clear_min, i->clear_max); - } - break; - case CFN_LIST: - { - conf_listitem_t *n; - if (conflist_length(val->list) > 0) { - ret += pfn(ctx, "{"); - for(n = conflist_first(val->list); n != NULL; n = conflist_next(n)) { - conf_print_native_field(pfn, ctx, verbose, &n->val, n->type, &n->prop, 0); - ret += pfn(ctx, ";"); - } - ret += pfn(ctx, "}"); - } - else { - if (verbose) - ret += pfn(ctx, ""); - else - ret += pfn(ctx, "{}"); - } - } - break; - } - if (verbose) { - ret += pfn(ctx, " <file_name, prop[idx].src->line); - } - ret += pfn(ctx, ">>"); - } - return ret; -} - -int conf_print_native(conf_pfn pfn, void *ctx, const char * prefix, int verbose, conf_native_t *node) -{ - int ret = 0; - if ((node->used <= 0) && (!verbose)) - return 0; - if (node->array_size > 1) { - int n; - if (!verbose) - ret += pfn(ctx, "{"); - for(n = 0; n < node->used; n++) { - if (verbose) - ret += pfn(ctx, "%s I %s[%d] = ", prefix, node->hash_path, n); - ret += conf_print_native_field(pfn, ctx, verbose, &node->val, node->type, node->prop, n); - if (verbose) - ret += pfn(ctx, " conf_rev=%d\n", node->conf_rev); - else - ret += pfn(ctx, ";"); - } - if (verbose) { - if (node->used == 0) - ret += pfn(ctx, "%s I %s[] = \n", prefix, node->hash_path); - } - else - ret += pfn(ctx, "}"); - } - else { - if (verbose) - ret += pfn(ctx, "%s I %s = ", prefix, node->hash_path); - ret += conf_print_native_field(pfn, ctx, verbose, &node->val, node->type, node->prop, 0); - if (verbose) - ret += pfn(ctx, " conf_rev=%d\n", node->conf_rev); - } - return ret; -} - - -/****************/ - -void conf_init(void) -{ - conf_reset(CFR_ENV, ""); - conf_reset(CFR_CLI, ""); - conf_reset(CFR_DESIGN, ""); - - conf_reset(CFR_file, ""); - conf_reset(CFR_binary, ""); -} - -void conf_uninit(void) -{ - int n; - htsp_entry_t *e; - - conf_hid_uninit(); - - for(n = 0; n < CFR_max_alloc; n++) - if (conf_root[n] != NULL) - lht_dom_uninit(conf_root[n]); - - conf_fields_foreach(e) { - conf_free_native(e->value); - htsp_delentry(conf_fields, e); - } - htsp_free(conf_fields); - - vmst_uninit(&merge_subtree); -} - -void conf_setf(conf_role_t role, const char *path, int idx, const char *fmt, ...) -{ - char *tmp; - va_list ap; - - va_start(ap, fmt); - tmp = pcb_strdup_vprintf(fmt, ap); - va_end(ap); - - conf_set(role, path, idx, tmp, POL_OVERWRITE); - - free(tmp); -} Index: 1.1.4/src/list_conf.h =================================================================== --- 1.1.4/src/list_conf.h (revision 10776) +++ 1.1.4/src/list_conf.h (nonexistent) @@ -1,49 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_CONF_H -#define LIST_CONF_H - -#include "conf.h" - -#include - -#ifdef FROM_CONF_C -#define TDL_DONT_UNDEF -#endif - -#define TDL(x) conflist_ ## x -#define TDL_LIST_T conflist_t -#define TDL_LIST_U conflist_u -#define TDL_ITEM_T conf_listitem_t -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define conflist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/fptr_cast.c =================================================================== --- 1.1.4/src/fptr_cast.c (revision 10776) +++ 1.1.4/src/fptr_cast.c (nonexistent) @@ -1,37 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include "fptr_cast.h" - -void *pcb_cast_f2d(pcb_fptr_t f) -{ - assert(sizeof(void *) == sizeof(pcb_fptr_t)); - return (void *)f; -} - -pcb_fptr_t pcb_cast_d2f(void *d) -{ - assert(sizeof(void *) == sizeof(pcb_fptr_t)); - return (pcb_fptr_t)d; -} - Index: 1.1.4/src/hid_flags.h =================================================================== --- 1.1.4/src/hid_flags.h (revision 10776) +++ 1.1.4/src/hid_flags.h (nonexistent) @@ -1,18 +0,0 @@ -#ifndef PCB_HID_FLAGS_H -#define PCB_HID_FLAGS_H - -/* Use this to temporarily enable all layers, so that they can be - exported even if they're not currently visible. save_array must be - MAX_LAYER+2 big. */ -void hid_save_and_show_layer_ons(int *save_array); -/* Use this to restore them. */ -void hid_restore_layer_ons(int *save_array); - - -/* Looks up an integer (usually boolean) value by conf path or by running - an action (if name has a parenthesis). When an action is run, it has 0 - or 1 argument only and the return value of the action is returned. - On error, returns -1. */ -int hid_get_flag(const char *name); - -#endif Index: 1.1.4/src/list_pin.h =================================================================== --- 1.1.4/src/list_pin.h (revision 10776) +++ 1.1.4/src/list_pin.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_PIN_H -#define LIST_PIN_H - -/* List of Pins */ -#define TDL(x) pinlist_ ## x -#define TDL_LIST_T pinlist_t -#define TDL_ITEM_T PinType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define pinlist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/conf.h =================================================================== --- 1.1.4/src/conf.h (revision 10776) +++ 1.1.4/src/conf.h (nonexistent) @@ -1,358 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_CONF_H -#define PCB_CONF_H -#include "global.h" -#include "global_typedefs.h" -#include "pcb-printf.h" -#include -#include -#include -#include "unit.h" - -typedef union confitem_u confitem_t ; -typedef struct conf_listitem_s conf_listitem_t; - -#include "list_conf.h" - -extern int conf_rev; /* increased by one each time there's a change in any of the config binaries */ - -typedef enum { - POL_PREPEND, - POL_APPEND, - POL_OVERWRITE, - POL_DISABLE, - POL_invalid -} conf_policy_t; - -typedef enum { /* bitfield */ - CFF_USAGE = 1 /* settings should be printed in usage help */ -} conf_flag_t; - - -typedef const char * CFT_STRING; -typedef int CFT_BOOLEAN; -typedef long CFT_INTEGER; -typedef double CFT_REAL; -typedef Coord CFT_COORD; -typedef Unit * CFT_UNIT; -typedef char * CFT_COLOR; -typedef conflist_t CFT_LIST; -typedef Increments CFT_INCREMENTS; - -typedef enum { - CFN_STRING, - CFN_BOOLEAN, - CFN_INTEGER, /* signed long */ - CFN_REAL, /* double */ - CFN_COORD, - CFN_UNIT, - CFN_COLOR, - CFN_LIST, - CFN_INCREMENTS -} conf_native_type_t; - -union confitem_u { - const char **string; - int *boolean; - long *integer; - double *real; - Coord *coord; - const Unit **unit; - const char **color; - conflist_t *list; - Increments *increments; - void *any; -}; - -typedef struct { - int prio; - lht_node_t *src; -} confprop_t; - -typedef struct { - /* static fields defined by the macros */ - const char *description; - const char *hash_path; /* points to the hash key once its added in the hash (else: NULL) */ - int array_size; - conf_native_type_t type; - conf_flag_t flags; - struct { - unsigned io_pcb_no_attrib:1; - unsigned read_only:1; /* set by conf_core, has no lihata, should not be overwritten */ - } random_flags; /* hack... persistent flags attached by various plugins */ - - /* dynamic fields loaded from lihata */ - confitem_t val; /* value is always an array (len 1 for the common case) */ - confprop_t *prop; /* an array of properties allocated as big as val's array */ - int used; /* number of items actually used in the arrays */ - int conf_rev; /* last changed rev */ - - /* dynamic fields for HIDs storing their data */ - vtp0_t hid_data; - vtp0_t hid_callbacks; /* vector of (const conf_hid_callbacks_t *) */ -} conf_native_t; - - -struct conf_listitem_s { - conf_native_type_t type; - confitem_t val; /* value is always an array (len 1 for the common case) */ - confprop_t prop; /* an array of properties allocated as big as val's array */ - const char *payload; - gdl_elem_t link; -}; - - -typedef enum { - CFR_INTERNAL, - CFR_SYSTEM, - CFR_DEFAULTPCB, /* default.pcb */ - CFR_USER, - CFR_ENV, /* env vars */ - CFR_PROJECT, /* project specific, from a local file */ - CFR_DESIGN, /* from the design file */ - CFR_CLI, /* from the command line */ - CFR_max_real, /* all the above are real files and should be merged */ - /* these ones are not real roles and are used in internal communication in the GUI HIDs */ - CFR_file, /* custom file */ - CFR_binary, /* the in-memory binary representation */ - CFR_max_alloc, /* all the above should have a root */ - - CFR_invalid -} conf_role_t; - -extern const int conf_default_prio[]; - -void conf_init(void); -void conf_uninit(void); - -/* Load all config files from disk into memory-lht and run conf_update to - get the binary representation updated */ -void conf_load_all(const char *project_fn, const char *pcb_fn); - -/* Load a file or a string as a role */ -int conf_load_as(conf_role_t role, const char *fn, int fn_is_text); - -/* Load a project file into CFR_PROJECT. Both project_fn and pcb_fn can't be NULL. - Leaves an initialized but empty CFR_PROJECT root if no project file was - found. Runs conf_update(NULL); */ -void conf_load_project(const char *project_fn, const char *pcb_fn); - -/* Update the binary representation from the memory-lht representation */ -void conf_update(const char *path); - -conf_native_t *conf_get_field(const char *path); -void conf_reg_field_(void *value, int array_size, conf_native_type_t type, const char *path, const char *desc, conf_flag_t flags); - -void conf_unreg_fields(const char *prefix); - -/* Set the value of path[arr_idx] in memory-lht role target to new_val using - policy pol. Only lists should be indexed. Indexing can be a [n] suffix on - path or a non-negative arr_idx. Updates the in-memory binary as well. If - new_val is NULL, the selected subtree is removed from the lihata document. */ -int conf_set(conf_role_t target, const char *path, int arr_idx, const char *new_val, conf_policy_t pol); - -/* Remove the subtree of path[arr_idx] in memory-lht role target. Same - considerations as in conf_set. */ -int conf_del(conf_role_t target, const char *path, int arr_idx); - -/* Same as conf_set, but without updating the binary - useful for multiple - conf_set_dry calls and a single all-tree conf_udpate(NULL) for transactions. */ -int conf_set_dry(conf_role_t target, const char *path_, int arr_idx, const char *new_val, conf_policy_t pol); - -/* Same as conf_set, but doesn't look up where to set things: change the value of - the lihata node backing the native field */ -int conf_set_native(conf_native_t *field, int arr_idx, const char *new_val); - -/* Process a command line argument arg_ (if val == NULL) or a pair of command line - arguments arg_ and val. In the first case assume arg_ has both a config path - and a value (may be implicit true for a boolean). In the second case val - is always the value. If prefix is not NULL, the path is prefixed with it. - On error always set *why to a const string reason. - Returns 0 on success. */ -int conf_set_from_cli(const char *prefix, const char *arg_, const char *val, const char **why); - -/* Attempt to consume argv[] using conf_set_from_cli */ -void conf_parse_arguments(const char *prefix, int *argc, char ***argv); - -#define conf_reg_field_array(globvar, field, type_name, path, desc, flags) \ - conf_reg_field_((void *)&globvar.field, (sizeof(globvar.field) / sizeof(globvar.field[0])), type_name, path, desc, flags) - -#define conf_reg_field_scalar(globvar, field, type_name, path, desc, flags) \ - conf_reg_field_((void *)&globvar.field, 1, type_name, path, desc, flags) - -/* register a config field, array or scalar, selecting the right macro */ -#define conf_reg_field(globvar, field,isarray,type_name,cpath,cname, desc, flags) \ - conf_reg_field_ ## isarray(globvar, field,type_name,cpath "/" cname, desc, flags) - -/* convert a policy text to policy value - return POL_invalid on error */ -conf_policy_t conf_policy_parse(const char *s); - -/* Return the name of the policy - always a static string, even for invalid roles */ -const char *conf_policy_name(conf_policy_t p); - -/* convert a role text to role value - return CFR_invalid on error */ -conf_role_t conf_role_parse(const char *s); - -/* Return the name of the role - always a static string, even for invalid roles */ -const char *conf_role_name(conf_role_t r); - -/* Lock/unlock the structure of a role. In a locked role value of existing - fields may be modified but the structure of the tree is static (can't - create or remove nodes). This is useful when an io_ file format supports - only a subset of settings: it can build the CFR_DESIGN tree, lock it so - settings that it wouldn't know how to save won't appear. NOTE: io_pcb - supports all settings via attributes so does not lock. */ -void conf_lock(conf_role_t target); -void conf_unlock(conf_role_t target); - - -/* replace dst_role:dst_path with a copy of src_role:src_path */ -int conf_replace_subtree(conf_role_t dst_role, const char *dst_path, conf_role_t src_role, const char *src_path); - -/* Throw out a subtree (remove all nodes from the lihata representation). - Useful for io_ plugins, on CFR_DESIGN, before loading a new file. */ -void conf_reset(conf_role_t target, const char *source_fn); - -/* Save an in-memory lihata representation to the disk */ -int conf_save_file(const char *project_fn, const char *pcb_fn, conf_role_t role, const char *fn); - -/* Returns whether a given lihata tree is locked */ -int conf_islocked(conf_role_t target); - -/* Returns whether a given lihata tree has changed since load or last save */ -int conf_isdirty(conf_role_t target); -void conf_makedirty(conf_role_t target); - -/* all configuration fields ever seen */ -extern htsp_t *conf_fields; - -/***** print fields from binary to lihata/text *****/ - -typedef int (*conf_pfn)(void *ctx, const char *fmt, ...); - -/* Prints the value of a node in a form that is suitable for lihata. Prints - a single element of an array, but prints lists as lists. Returns - the sum of conf_pfn call return values - this is usually the number of - bytes printed. */ -int conf_print_native_field(conf_pfn pfn, void *ctx, int verbose, confitem_t *val, conf_native_type_t type, confprop_t *prop, int idx); - -/* Prints the value of a node in a form that is suitable for lihata. Prints - full arrays. Returns the sum of conf_pfn call return values - this is - usually the number of bytes printed. */ -int conf_print_native(conf_pfn pfn, void *ctx, const char * prefix, int verbose, conf_native_t *node); - - -/****** utility ******/ - -void conf_setf(conf_role_t role, const char *path, int idx, const char *fmt, ...); - -#define conf_list_foreach_path_first(res, conf_list, call) \ -do { \ - conf_listitem_t *__n__; \ - const conflist_t *__lst1__ = (conf_list); \ - conflist_t *__lst__ = (conflist_t *)(__lst1__); \ - if (__lst__ != NULL) { \ - for(__n__ = conflist_first(__lst__); __n__ != NULL; __n__ = conflist_next(__n__)) { \ - char *__path__; \ - const char **__in__ = __n__->val.string; \ - if (__in__ == NULL) \ - continue; \ - resolve_path(*__in__, &__path__, 0); \ - res = call; \ - free(__path__); \ - if (res == 0) \ - break; \ - } \ - } \ -} while(0) - -/* printf("conf_list_foreach_path_first: %s using %s\n", # call, # conf_list); \*/ - -/* htsp_entry_t *e; */ -#define conf_fields_foreach(e) \ - for (e = htsp_first(conf_fields); e; e = htsp_next(conf_fields, e)) - -/* helpers to make the code shorter */ -#define conf_set_design(path, fmt, new_val) \ - conf_setf(CFR_DESIGN, path, -1, fmt, new_val) - -#define conf_set_editor(field, val) \ - conf_set(CFR_DESIGN, "editor/" #field, -1, val ? "1" : "0", POL_OVERWRITE) - -#define conf_toggle_editor(field) \ - conf_set_editor(field, !conf_core.editor.field) - -#define conf_toggle_editor_(sfield, field) \ - conf_set_editor(sfield, !conf_core.editor.field) - -/* For temporary modification/restoration of variables (hack) */ -#define conf_force_set_bool(var, val) *((CFT_BOOLEAN *)(&var)) = val -#define conf_force_set_str(var, val) *((CFT_STRING *)(&var)) = val - -/* get the first config subtree node (it's a hash and its children - are "design", "rc", ...) */ -lht_node_t *conf_lht_get_first(conf_role_t target); - -/* loop helper */ -conf_listitem_t *conf_list_first_str(conflist_t *list, const char **item_str, int *idx); -conf_listitem_t *conf_list_next_str(conf_listitem_t *item_li, const char **item_str, int *idx); - -/*conf_listitem_t *item;*/ -#define conf_loop_list(list, item, idx) \ - for (idx = 0, item = conflist_first((conflist_t *)cl); item != NULL; item = conflist_next(item), idx++) - -/*conf_listitem_t *item; const char *item_str; */ -#define conf_loop_list_str(list, item_li, item_str, idx) \ - for (idx = 0, item_li = conf_list_first_str((conflist_t *)list, &item_str, &idx); \ - item_li != NULL;\ - item_li = conf_list_next_str(item_li, &item_str, &idx)) - -const char *conf_concat_strlist(const conflist_t *lst, gds_t *buff, int *inited, char sep); - -/* Print usage help for all nodes that have the CFF_USAGE flag and whose - path starts with prefix (if prefix != NULL) */ -void conf_usage(const char *prefix, void (*print)(const char *name, const char *help)); - -/* Determine under which role a node is */ -conf_role_t conf_lookup_role(const lht_node_t *nd); - -/* Return the lihata node of a path in target, optionally creating it with the right type */ -lht_node_t *conf_lht_get_at(conf_role_t target, const char *path, int create); - -/* Write an existing conf subtree to a file */ -int conf_export_to_file(const char *fn, conf_role_t role, const char *conf_path); - -/* Determine the policy and priority of a config lihata node; - returns 0 on success but may not fill in both values, caller is - responsible for initializing them before the call. */ -int conf_get_policy_prio(lht_node_t *node, conf_policy_t *gpolicy, long *gprio); - -/* Parse text and convert the value into native form and store in one of dst - fields depending on type */ -int conf_parse_text(confitem_t *dst, int idx, conf_native_type_t type, const char *text, lht_node_t *err_node); - -/* Determine the file name of the project file - project_fn and pcb_fn can be NULL */ -const char *conf_get_project_conf_name(const char *project_fn, const char *pcb_fn, const char **out_project_fn); - -#endif Index: 1.1.4/src/fptr_cast.h =================================================================== --- 1.1.4/src/fptr_cast.h (revision 10776) +++ 1.1.4/src/fptr_cast.h (nonexistent) @@ -1,34 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Function pointer <-> data pointer casts with assert on size match. C89 - does not permit these casts but they practically work on any platform - pcb-rnd has the chance to run on. Hide the ugliness behind this API. */ - -#ifndef PCB_FPTRCAST_H -#define PCB_FPTRCAST_H -typedef void (*pcb_fptr_t)(); - -void *pcb_cast_f2d(pcb_fptr_t f); -pcb_fptr_t pcb_cast_d2f(void *d); - -#endif Index: 1.1.4/src/thermal.c =================================================================== --- 1.1.4/src/thermal.c (revision 10776) +++ 1.1.4/src/thermal.c (nonexistent) @@ -1,438 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2004,2006 Thomas Nau - * - * this file, thermal.c was written by and is - * (C) Copyright 2006, harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* negative thermal finger polygons */ - -#include "config.h" - -#include -#include - -#include "misc.h" -#include "polygon.h" -#include "thermal.h" - -static PCBTypePtr pcb; - -struct cent { - Coord x, y; - Coord s, c; - char style; - POLYAREA *p; -}; - -static POLYAREA *diag_line(Coord X, Coord Y, Coord l, Coord w, pcb_bool rt) -{ - PLINE *c; - Vector v; - Coord x1, x2, y1, y2; - - if (rt) { - x1 = (l - w) * M_SQRT1_2; - x2 = (l + w) * M_SQRT1_2; - y1 = x1; - y2 = x2; - } - else { - x2 = -(l - w) * M_SQRT1_2; - x1 = -(l + w) * M_SQRT1_2; - y1 = -x1; - y2 = -x2; - } - - v[0] = X + x1; - v[1] = Y + y2; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[0] = X - x2; - v[1] = Y - y1; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = X - x1; - v[1] = Y - y2; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = X + x2; - v[1] = Y + y1; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - return ContourToPoly(c); -} - -static POLYAREA *square_therm(PinTypePtr pin, pcb_cardinal_t style) -{ - POLYAREA *p, *p2; - PLINE *c; - Vector v; - Coord d, in, out; - - switch (style) { - case 1: - d = pcb->ThermScale * pin->Clearance * M_SQRT1_2; - out = (pin->Thickness + pin->Clearance) / 2; - in = pin->Thickness / 2; - /* top (actually bottom since +y is down) */ - v[0] = pin->X - in + d; - v[1] = pin->Y + in; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[0] = pin->X + in - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X + out - d; - v[1] = pin->Y + out; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X - out + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - p = ContourToPoly(c); - /* right */ - v[0] = pin->X + in; - v[1] = pin->Y + in - d; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[1] = pin->Y - in + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X + out; - v[1] = pin->Y - out + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[1] = pin->Y + out - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - p2 = ContourToPoly(c); - p->f = p2; - p2->b = p; - /* left */ - v[0] = pin->X - in; - v[1] = pin->Y - in + d; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[1] = pin->Y + in - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X - out; - v[1] = pin->Y + out - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[1] = pin->Y - out + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - p2 = ContourToPoly(c); - p->f->f = p2; - p2->b = p->f; - /* bottom (actually top since +y is down) */ - v[0] = pin->X + in - d; - v[1] = pin->Y - in; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[0] = pin->X - in + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X - out + d; - v[1] = pin->Y - out; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X + out - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - p2 = ContourToPoly(c); - p->f->f->f = p2; - p2->f = p; - p2->b = p->f->f; - p->b = p2; - return p; - case 4: - { - LineType l; - l.Flags = NoFlags(); - d = pin->Thickness / 2 - pcb->ThermScale * pin->Clearance; - out = pin->Thickness / 2 + pin->Clearance / 4; - in = pin->Clearance / 2; - /* top */ - l.Point1.X = pin->X - d; - l.Point2.Y = l.Point1.Y = pin->Y + out; - l.Point2.X = pin->X + d; - p = LinePoly(&l, in); - /* right */ - l.Point1.X = l.Point2.X = pin->X + out; - l.Point1.Y = pin->Y - d; - l.Point2.Y = pin->Y + d; - p2 = LinePoly(&l, in); - p->f = p2; - p2->b = p; - /* bottom */ - l.Point1.X = pin->X - d; - l.Point2.Y = l.Point1.Y = pin->Y - out; - l.Point2.X = pin->X + d; - p2 = LinePoly(&l, in); - p->f->f = p2; - p2->b = p->f; - /* left */ - l.Point1.X = l.Point2.X = pin->X - out; - l.Point1.Y = pin->Y - d; - l.Point2.Y = pin->Y + d; - p2 = LinePoly(&l, in); - p->f->f->f = p2; - p2->b = p->f->f; - p->b = p2; - p2->f = p; - return p; - } - default: /* style 2 and 5 */ - d = 0.5 * pcb->ThermScale * pin->Clearance; - if (style == 5) - d += d; - out = (pin->Thickness + pin->Clearance) / 2; - in = pin->Thickness / 2; - /* topright */ - v[0] = pin->X + in; - v[1] = pin->Y + in; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[1] = pin->Y + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 2) { - v[0] = pin->X + out; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - } - else - frac_circle(c, v[0] + pin->Clearance / 4, v[1], v, 2); - v[1] = pin->Y + in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - /* pivot 1/4 circle to next point */ - frac_circle(c, pin->X + in, pin->Y + in, v, 4); - v[0] = pin->X + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 2) { - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[1] = pin->Y + in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - } - else - frac_circle(c, v[0], v[1] - pin->Clearance / 4, v, 2); - p = ContourToPoly(c); - /* bottom right */ - v[0] = pin->X + in; - v[1] = pin->Y - d; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[1] = pin->Y - in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 2) { - v[1] = pin->Y - out; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - } - else - frac_circle(c, v[0], v[1] - pin->Clearance / 4, v, 2); - v[0] = pin->X + in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - /* pivot 1/4 circle to next point */ - frac_circle(c, pin->X + in, pin->Y - in, v, 4); - v[1] = pin->Y - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 5) - frac_circle(c, v[0] - pin->Clearance / 4, v[1], v, 2); - p2 = ContourToPoly(c); - p->f = p2; - p2->b = p; - /* bottom left */ - v[0] = pin->X - d; - v[1] = pin->Y - in; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[0] = pin->X - in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[1] = pin->Y - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 2) { - v[0] = pin->X - out; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - } - else - frac_circle(c, v[0] - pin->Clearance / 4, v[1], v, 2); - v[1] = pin->Y - in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - /* pivot 1/4 circle to next point */ - frac_circle(c, pin->X - in, pin->Y - in, v, 4); - v[0] = pin->X - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 5) - frac_circle(c, v[0], v[1] + pin->Clearance / 4, v, 2); - p2 = ContourToPoly(c); - p->f->f = p2; - p2->b = p->f; - /* top left */ - v[0] = pin->X - d; - v[1] = pin->Y + out; - if ((c = poly_NewContour(v)) == NULL) - return NULL; - v[0] = pin->X - in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - /* pivot 1/4 circle to next point (x-out, y+in) */ - frac_circle(c, pin->X - in, pin->Y + in, v, 4); - v[1] = pin->Y + d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 2) { - v[0] = pin->X - in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - } - else - frac_circle(c, v[0] + pin->Clearance / 4, v[1], v, 2); - v[1] = pin->Y + in; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - v[0] = pin->X - d; - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - if (style == 5) - frac_circle(c, v[0], v[1] + pin->Clearance / 4, v, 2); - p2 = ContourToPoly(c); - p->f->f->f = p2; - p2->f = p; - p2->b = p->f->f; - p->b = p2; - return p; - } -} - -static POLYAREA *oct_therm(PinTypePtr pin, pcb_cardinal_t style) -{ - POLYAREA *p, *p2, *m; - Coord t = 0.5 * pcb->ThermScale * pin->Clearance; - Coord w = pin->Thickness + pin->Clearance; - - p = OctagonPoly(pin->X, pin->Y, w, GET_SQUARE(pin)); - p2 = OctagonPoly(pin->X, pin->Y, pin->Thickness, GET_SQUARE(pin)); - /* make full clearance ring */ - poly_Boolean_free(p, p2, &m, PBO_SUB); - switch (style) { - default: - case 1: - p = diag_line(pin->X, pin->Y, w, t, pcb_true); - poly_Boolean_free(m, p, &p2, PBO_SUB); - p = diag_line(pin->X, pin->Y, w, t, pcb_false); - poly_Boolean_free(p2, p, &m, PBO_SUB); - return m; - case 2: - p = RectPoly(pin->X - t, pin->X + t, pin->Y - w, pin->Y + w); - poly_Boolean_free(m, p, &p2, PBO_SUB); - p = RectPoly(pin->X - w, pin->X + w, pin->Y - t, pin->Y + t); - poly_Boolean_free(p2, p, &m, PBO_SUB); - return m; - /* fix me add thermal style 4 */ - case 5: - { - Coord t = pin->Thickness / 2; - POLYAREA *q; - /* cheat by using the square therm's rounded parts */ - p = square_therm(pin, style); - q = RectPoly(pin->X - t, pin->X + t, pin->Y - t, pin->Y + t); - poly_Boolean_free(p, q, &p2, PBO_UNITE); - poly_Boolean_free(m, p2, &p, PBO_ISECT); - return p; - } - } -} - -/* ThermPoly returns a POLYAREA having all of the clearance that when - * subtracted from the plane create the desired thermal fingers. - * Usually this is 4 disjoint regions. - * - */ -POLYAREA *ThermPoly(PCBTypePtr p, PinTypePtr pin, pcb_cardinal_t laynum) -{ - ArcType a; - POLYAREA *pa, *arc; - pcb_cardinal_t style = GET_THERM(laynum, pin); - - if (style == 3) - return NULL; /* solid connection no clearance */ - pcb = p; - if (TEST_FLAG(PCB_FLAG_SQUARE, pin)) - return square_therm(pin, style); - if (TEST_FLAG(PCB_FLAG_OCTAGON, pin)) - return oct_therm(pin, style); - /* must be circular */ - switch (style) { - case 1: - case 2: - { - POLYAREA *m; - Coord t = (pin->Thickness + pin->Clearance) / 2; - Coord w = 0.5 * pcb->ThermScale * pin->Clearance; - pa = CirclePoly(pin->X, pin->Y, t); - arc = CirclePoly(pin->X, pin->Y, pin->Thickness / 2); - /* create a thin ring */ - poly_Boolean_free(pa, arc, &m, PBO_SUB); - /* fix me needs error checking */ - if (style == 2) { - /* t is the theoretically required length, but we use twice that - * to avoid descritisation errors in our circle approximation. - */ - pa = RectPoly(pin->X - t * 2, pin->X + t * 2, pin->Y - w, pin->Y + w); - poly_Boolean_free(m, pa, &arc, PBO_SUB); - pa = RectPoly(pin->X - w, pin->X + w, pin->Y - t * 2, pin->Y + t * 2); - } - else { - /* t is the theoretically required length, but we use twice that - * to avoid descritisation errors in our circle approximation. - */ - pa = diag_line(pin->X, pin->Y, t * 2, w, pcb_true); - poly_Boolean_free(m, pa, &arc, PBO_SUB); - pa = diag_line(pin->X, pin->Y, t * 2, w, pcb_false); - } - poly_Boolean_free(arc, pa, &m, PBO_SUB); - return m; - } - - - default: - a.X = pin->X; - a.Y = pin->Y; - a.Height = a.Width = pin->Thickness / 2 + pin->Clearance / 4; - a.Thickness = 1; - a.Clearance = pin->Clearance / 2; - a.Flags = NoFlags(); - a.Delta = 90 - (a.Clearance * (1. + 2. * pcb->ThermScale) * 180) / (M_PI * a.Width); - a.StartAngle = 90 - a.Delta / 2 + (style == 4 ? 0 : 45); - pa = ArcPoly(&a, a.Clearance); - if (!pa) - return NULL; - a.StartAngle += 90; - arc = ArcPoly(&a, a.Clearance); - if (!arc) - return NULL; - pa->f = arc; - arc->b = pa; - a.StartAngle += 90; - arc = ArcPoly(&a, a.Clearance); - if (!arc) - return NULL; - pa->f->f = arc; - arc->b = pa->f; - a.StartAngle += 90; - arc = ArcPoly(&a, a.Clearance); - if (!arc) - return NULL; - pa->b = arc; - pa->f->f->f = arc; - arc->b = pa->f->f; - arc->f = pa; - pa->b = arc; - return pa; - } -} Index: 1.1.4/src/list_arc.c =================================================================== --- 1.1.4/src/list_arc.c (revision 10776) +++ 1.1.4/src/list_arc.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define TDL_DONT_UNDEF -#include "global_objs.h" -#include "list_arc.h" -#include Index: 1.1.4/src/thermal.h =================================================================== --- 1.1.4/src/thermal.h (revision 10776) +++ 1.1.4/src/thermal.h (nonexistent) @@ -1,45 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for thermal routines - * - * Thermals are normal lines on the layout. The only thing unique - * about them is that they have the PCB_FLAG_USETHERMAL set so that they - * can be identified as thermals. It is handy for pcb to automatically - * make adjustments to the thermals when the user performs certain - * operations, and the functions in thermal.h help implement that. - */ - -#ifndef PCB_THERMAL_H -#define PCB_THERMAL_H - -#include -#include "global.h" -#include "mymem.h" - -POLYAREA *ThermPoly(PCBTypePtr, PinTypePtr, pcb_cardinal_t); - -#endif Index: 1.1.4/src/list_arc.h =================================================================== --- 1.1.4/src/list_arc.h (revision 10776) +++ 1.1.4/src/list_arc.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_ARC_H -#define LIST_ARC_H - -/* List of Arcs */ -#define TDL(x) arclist_ ## x -#define TDL_LIST_T arclist_t -#define TDL_ITEM_T ArcType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define arclist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/move.c =================================================================== --- 1.1.4/src/move.c (revision 10776) +++ 1.1.4/src/move.c (nonexistent) @@ -1,1051 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* functions used to move pins, elements ... - */ - -#include "config.h" -#include "conf_core.h" - -#include -#include - -#include "create.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "misc.h" -#include "move.h" -#include "polygon.h" -#include "rtree.h" -#include "search.h" -#include "select.h" -#include "undo.h" -#include "hid_actions.h" -#include "compat_misc.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void *MoveElementName(ElementTypePtr); -static void *MoveElement(ElementTypePtr); -static void *MoveVia(PinTypePtr); -static void *MoveLine(LayerTypePtr, LineTypePtr); -static void *MoveArc(LayerTypePtr, ArcTypePtr); -static void *MoveText(LayerTypePtr, TextTypePtr); -static void *MovePolygon(LayerTypePtr, PolygonTypePtr); -static void *MoveLinePoint(LayerTypePtr, LineTypePtr, PointTypePtr); -static void *MovePolygonPoint(LayerTypePtr, PolygonTypePtr, PointTypePtr); -static void *MoveLineToLayer(LayerTypePtr, LineTypePtr); -static void *MoveArcToLayer(LayerTypePtr, ArcTypePtr); -static void *MoveRatToLayer(RatTypePtr); -static void *MoveTextToLayer(LayerTypePtr, TextTypePtr); -static void *MovePolygonToLayer(LayerTypePtr, PolygonTypePtr); - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static Coord DeltaX, DeltaY; /* used by local routines as offset */ -static LayerTypePtr Dest; -static pcb_bool MoreToCome; -static ObjectFunctionType MoveFunctions = { - MoveLine, - MoveText, - MovePolygon, - MoveVia, - MoveElement, - MoveElementName, - NULL, - NULL, - MoveLinePoint, - MovePolygonPoint, - MoveArc, - NULL -}, MoveToLayerFunctions = { -MoveLineToLayer, MoveTextToLayer, MovePolygonToLayer, NULL, NULL, NULL, NULL, NULL, NULL, NULL, MoveArcToLayer, MoveRatToLayer}; - -/* --------------------------------------------------------------------------- - * moves a element by +-X and +-Y - */ -void MoveElementLowLevel(DataTypePtr Data, ElementTypePtr Element, Coord DX, Coord DY) -{ - if (Data) - r_delete_entry(Data->element_tree, (BoxType *) Element); - ELEMENTLINE_LOOP(Element); - { - MOVE_LINE_LOWLEVEL(line, DX, DY); - } - END_LOOP; - PIN_LOOP(Element); - { - if (Data) { - r_delete_entry(Data->pin_tree, (BoxType *) pin); - RestoreToPolygon(Data, PCB_TYPE_PIN, Element, pin); - } - MOVE_PIN_LOWLEVEL(pin, DX, DY); - if (Data) { - r_insert_entry(Data->pin_tree, (BoxType *) pin, 0); - ClearFromPolygon(Data, PCB_TYPE_PIN, Element, pin); - } - } - END_LOOP; - PAD_LOOP(Element); - { - if (Data) { - r_delete_entry(Data->pad_tree, (BoxType *) pad); - RestoreToPolygon(Data, PCB_TYPE_PAD, Element, pad); - } - MOVE_PAD_LOWLEVEL(pad, DX, DY); - if (Data) { - r_insert_entry(Data->pad_tree, (BoxType *) pad, 0); - ClearFromPolygon(Data, PCB_TYPE_PAD, Element, pad); - } - } - END_LOOP; - ARC_LOOP(Element); - { - MOVE_ARC_LOWLEVEL(arc, DX, DY); - } - END_LOOP; - ELEMENTTEXT_LOOP(Element); - { - if (Data && Data->name_tree[n]) - r_delete_entry(PCB->Data->name_tree[n], (BoxType *) text); - MOVE_TEXT_LOWLEVEL(text, DX, DY); - if (Data && Data->name_tree[n]) - r_insert_entry(PCB->Data->name_tree[n], (BoxType *) text, 0); - } - END_LOOP; - MOVE_BOX_LOWLEVEL(&Element->BoundingBox, DX, DY); - MOVE_BOX_LOWLEVEL(&Element->VBox, DX, DY); - MOVE(Element->MarkX, Element->MarkY, DX, DY); - if (Data) - r_insert_entry(Data->element_tree, (BoxType *) Element, 0); -} - -/* ---------------------------------------------------------------------- - * moves all names of an element to a new position - */ -static void *MoveElementName(ElementTypePtr Element) -{ - if (PCB->ElementOn && (FRONT(Element) || PCB->InvisibleObjectsOn)) { - EraseElementName(Element); - ELEMENTTEXT_LOOP(Element); - { - if (PCB->Data->name_tree[n]) - r_delete_entry(PCB->Data->name_tree[n], (BoxType *) text); - MOVE_TEXT_LOWLEVEL(text, DeltaX, DeltaY); - if (PCB->Data->name_tree[n]) - r_insert_entry(PCB->Data->name_tree[n], (BoxType *) text, 0); - } - END_LOOP; - DrawElementName(Element); - Draw(); - } - else { - ELEMENTTEXT_LOOP(Element); - { - if (PCB->Data->name_tree[n]) - r_delete_entry(PCB->Data->name_tree[n], (BoxType *) text); - MOVE_TEXT_LOWLEVEL(text, DeltaX, DeltaY); - if (PCB->Data->name_tree[n]) - r_insert_entry(PCB->Data->name_tree[n], (BoxType *) text, 0); - } - END_LOOP; - } - return (Element); -} - -/* --------------------------------------------------------------------------- - * moves an element - */ -static void *MoveElement(ElementTypePtr Element) -{ - pcb_bool didDraw = pcb_false; - - if (PCB->ElementOn && (FRONT(Element) || PCB->InvisibleObjectsOn)) { - EraseElement(Element); - MoveElementLowLevel(PCB->Data, Element, DeltaX, DeltaY); - DrawElementName(Element); - DrawElementPackage(Element); - didDraw = pcb_true; - } - else { - if (PCB->PinOn) - EraseElementPinsAndPads(Element); - MoveElementLowLevel(PCB->Data, Element, DeltaX, DeltaY); - } - if (PCB->PinOn) { - DrawElementPinsAndPads(Element); - didDraw = pcb_true; - } - if (didDraw) - Draw(); - return (Element); -} - -/* --------------------------------------------------------------------------- - * moves a via - */ -static void *MoveVia(PinTypePtr Via) -{ - r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - MOVE_VIA_LOWLEVEL(Via, DeltaX, DeltaY); - if (PCB->ViaOn) - EraseVia(Via); - r_insert_entry(PCB->Data->via_tree, (BoxType *) Via, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - if (PCB->ViaOn) { - DrawVia(Via); - Draw(); - } - return (Via); -} - -/* --------------------------------------------------------------------------- - * moves a line - */ -static void *MoveLine(LayerTypePtr Layer, LineTypePtr Line) -{ - if (Layer->On) - EraseLine(Line); - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - r_delete_entry(Layer->line_tree, (BoxType *) Line); - MOVE_LINE_LOWLEVEL(Line, DeltaX, DeltaY); - r_insert_entry(Layer->line_tree, (BoxType *) Line, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - if (Layer->On) { - DrawLine(Layer, Line); - Draw(); - } - return (Line); -} - -/* --------------------------------------------------------------------------- - * moves an arc - */ -static void *MoveArc(LayerTypePtr Layer, ArcTypePtr Arc) -{ - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - r_delete_entry(Layer->arc_tree, (BoxType *) Arc); - if (Layer->On) { - EraseArc(Arc); - MOVE_ARC_LOWLEVEL(Arc, DeltaX, DeltaY); - DrawArc(Layer, Arc); - Draw(); - } - else { - MOVE_ARC_LOWLEVEL(Arc, DeltaX, DeltaY); - } - r_insert_entry(Layer->arc_tree, (BoxType *) Arc, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - return (Arc); -} - -/* --------------------------------------------------------------------------- - * moves a text object - */ -static void *MoveText(LayerTypePtr Layer, TextTypePtr Text) -{ - RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - r_delete_entry(Layer->text_tree, (BoxType *) Text); - if (Layer->On) { - EraseText(Layer, Text); - MOVE_TEXT_LOWLEVEL(Text, DeltaX, DeltaY); - DrawText(Layer, Text); - Draw(); - } - else - MOVE_TEXT_LOWLEVEL(Text, DeltaX, DeltaY); - r_insert_entry(Layer->text_tree, (BoxType *) Text, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - return (Text); -} - -/* --------------------------------------------------------------------------- - * low level routine to move a polygon - */ -void MovePolygonLowLevel(PolygonTypePtr Polygon, Coord DeltaX, Coord DeltaY) -{ - POLYGONPOINT_LOOP(Polygon); - { - MOVE(point->X, point->Y, DeltaX, DeltaY); - } - END_LOOP; - MOVE_BOX_LOWLEVEL(&Polygon->BoundingBox, DeltaX, DeltaY); -} - -/* --------------------------------------------------------------------------- - * moves a polygon - */ -static void *MovePolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - if (Layer->On) { - ErasePolygon(Polygon); - } - r_delete_entry(Layer->polygon_tree, (BoxType *) Polygon); - MovePolygonLowLevel(Polygon, DeltaX, DeltaY); - r_insert_entry(Layer->polygon_tree, (BoxType *) Polygon, 0); - InitClip(PCB->Data, Layer, Polygon); - if (Layer->On) { - DrawPolygon(Layer, Polygon); - Draw(); - } - return (Polygon); -} - -/* --------------------------------------------------------------------------- - * moves one end of a line - */ -static void *MoveLinePoint(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) -{ - if (Layer) { - if (Layer->On) - EraseLine(Line); - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - r_delete_entry(Layer->line_tree, &Line->BoundingBox); - MOVE(Point->X, Point->Y, DeltaX, DeltaY); - SetLineBoundingBox(Line); - r_insert_entry(Layer->line_tree, &Line->BoundingBox, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - if (Layer->On) { - DrawLine(Layer, Line); - Draw(); - } - return (Line); - } - else { /* must be a rat */ - - if (PCB->RatOn) - EraseRat((RatTypePtr) Line); - r_delete_entry(PCB->Data->rat_tree, &Line->BoundingBox); - MOVE(Point->X, Point->Y, DeltaX, DeltaY); - SetLineBoundingBox(Line); - r_insert_entry(PCB->Data->rat_tree, &Line->BoundingBox, 0); - if (PCB->RatOn) { - DrawRat((RatTypePtr) Line); - Draw(); - } - return (Line); - } -} - -/* --------------------------------------------------------------------------- - * moves a polygon-point - */ -static void *MovePolygonPoint(LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) -{ - if (Layer->On) { - ErasePolygon(Polygon); - } - r_delete_entry(Layer->polygon_tree, (BoxType *) Polygon); - MOVE(Point->X, Point->Y, DeltaX, DeltaY); - SetPolygonBoundingBox(Polygon); - r_insert_entry(Layer->polygon_tree, (BoxType *) Polygon, 0); - RemoveExcessPolygonPoints(Layer, Polygon); - InitClip(PCB->Data, Layer, Polygon); - if (Layer->On) { - DrawPolygon(Layer, Polygon); - Draw(); - } - return (Point); -} - -/* --------------------------------------------------------------------------- - * moves a line between layers; lowlevel routines - */ -static void *MoveLineToLayerLowLevel(LayerType * Source, LineType * line, LayerType * Destination) -{ - r_delete_entry(Source->line_tree, (BoxType *) line); - - linelist_remove(line); - linelist_append(&(Destination->Line), line); - - if (!Destination->line_tree) - Destination->line_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Destination->line_tree, (BoxType *) line, 0); - return line; -} - -/* --------------------------------------------------------------------------- - * moves an arc between layers; lowlevel routines - */ -static void *MoveArcToLayerLowLevel(LayerType * Source, ArcType * arc, LayerType * Destination) -{ - r_delete_entry(Source->arc_tree, (BoxType *) arc); - - arclist_remove(arc); - arclist_append(&Destination->Arc, arc); - - if (!Destination->arc_tree) - Destination->arc_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Destination->arc_tree, (BoxType *) arc, 0); - return arc; -} - - -/* --------------------------------------------------------------------------- - * moves an arc between layers - */ -static void *MoveArcToLayer(LayerType * Layer, ArcType * Arc) -{ - ArcTypePtr newone; - - if (TEST_FLAG(PCB_FLAG_LOCK, Arc)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - return NULL; - } - if (Dest == Layer && Layer->On) { - DrawArc(Layer, Arc); - Draw(); - } - if (((long int) Dest == -1) || Dest == Layer) - return (Arc); - AddObjectToMoveToLayerUndoList(PCB_TYPE_ARC, Layer, Arc, Arc); - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - if (Layer->On) - EraseArc(Arc); - newone = (ArcTypePtr) MoveArcToLayerLowLevel(Layer, Arc, Dest); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Dest, Arc); - if (Dest->On) - DrawArc(Dest, newone); - Draw(); - return (newone); -} - -/* --------------------------------------------------------------------------- - * moves a line between layers - */ -static void *MoveRatToLayer(RatType * Rat) -{ - LineTypePtr newone; - /*Coord X1 = Rat->Point1.X, Y1 = Rat->Point1.Y; - Coord X1 = Rat->Point1.X, Y1 = Rat->Point1.Y; - if PCB_FLAG_VIA - if we're on a pin, add a thermal - else make a via and a wire, but 0-length wire not good - else as before */ - - newone = CreateNewLineOnLayer(Dest, Rat->Point1.X, Rat->Point1.Y, - Rat->Point2.X, Rat->Point2.Y, conf_core.design.line_thickness, 2 * conf_core.design.clearance, Rat->Flags); - if (conf_core.editor.clear_line) - conf_set_editor(clear_line, 1); - if (!newone) - return (NULL); - AddObjectToCreateUndoList(PCB_TYPE_LINE, Dest, newone, newone); - if (PCB->RatOn) - EraseRat(Rat); - MoveObjectToRemoveUndoList(PCB_TYPE_RATLINE, Rat, Rat, Rat); - DrawLine(Dest, newone); - Draw(); - return (newone); -} - -/* --------------------------------------------------------------------------- - * moves a line between layers - */ - -struct via_info { - Coord X, Y; - jmp_buf env; -}; - -static r_dir_t moveline_callback(const BoxType * b, void *cl) -{ - struct via_info *i = (struct via_info *) cl; - PinTypePtr via; - - if ((via = - CreateNewVia(PCB->Data, i->X, i->Y, - conf_core.design.via_thickness, 2 * conf_core.design.clearance, PCB_FLAG_NO, conf_core.design.via_drilling_hole, NULL, NoFlags())) != NULL) { - AddObjectToCreateUndoList(PCB_TYPE_VIA, via, via, via); - DrawVia(via); - } - longjmp(i->env, 1); -} - -static void *MoveLineToLayer(LayerType * Layer, LineType * Line) -{ - struct via_info info; - BoxType sb; - LineTypePtr newone; - void *ptr1, *ptr2, *ptr3; - - if (TEST_FLAG(PCB_FLAG_LOCK, Line)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - return NULL; - } - if (Dest == Layer && Layer->On) { - DrawLine(Layer, Line); - Draw(); - } - if (((long int) Dest == -1) || Dest == Layer) - return (Line); - - AddObjectToMoveToLayerUndoList(PCB_TYPE_LINE, Layer, Line, Line); - if (Layer->On) - EraseLine(Line); - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - newone = (LineTypePtr) MoveLineToLayerLowLevel(Layer, Line, Dest); - Line = NULL; - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Dest, newone); - if (Dest->On) - DrawLine(Dest, newone); - Draw(); - if (!PCB->ViaOn || MoreToCome || - GetLayerGroupNumberByPointer(Layer) == - GetLayerGroupNumberByPointer(Dest) || TEST_SILK_LAYER(Layer) || TEST_SILK_LAYER(Dest)) - return (newone); - /* consider via at Point1 */ - sb.X1 = newone->Point1.X - newone->Thickness / 2; - sb.X2 = newone->Point1.X + newone->Thickness / 2; - sb.Y1 = newone->Point1.Y - newone->Thickness / 2; - sb.Y2 = newone->Point1.Y + newone->Thickness / 2; - if ((SearchObjectByLocation(PCB_TYPEMASK_PIN, &ptr1, &ptr2, &ptr3, - newone->Point1.X, newone->Point1.Y, conf_core.design.via_thickness / 2) == PCB_TYPE_NONE)) { - info.X = newone->Point1.X; - info.Y = newone->Point1.Y; - if (setjmp(info.env) == 0) - r_search(Layer->line_tree, &sb, NULL, moveline_callback, &info, NULL); - } - /* consider via at Point2 */ - sb.X1 = newone->Point2.X - newone->Thickness / 2; - sb.X2 = newone->Point2.X + newone->Thickness / 2; - sb.Y1 = newone->Point2.Y - newone->Thickness / 2; - sb.Y2 = newone->Point2.Y + newone->Thickness / 2; - if ((SearchObjectByLocation(PCB_TYPEMASK_PIN, &ptr1, &ptr2, &ptr3, - newone->Point2.X, newone->Point2.Y, conf_core.design.via_thickness / 2) == PCB_TYPE_NONE)) { - info.X = newone->Point2.X; - info.Y = newone->Point2.Y; - if (setjmp(info.env) == 0) - r_search(Layer->line_tree, &sb, NULL, moveline_callback, &info, NULL); - } - Draw(); - return (newone); -} - -/* --------------------------------------------------------------------------- - * moves a text object between layers; lowlevel routines - */ -static void *MoveTextToLayerLowLevel(LayerType * Source, TextType * text, LayerType * Destination) -{ - RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Source, text); - r_delete_entry(Source->text_tree, (BoxType *) text); - - textlist_remove(text); - textlist_append(&Destination->Text, text); - - if (GetLayerGroupNumberByNumber(solder_silk_layer) == GetLayerGroupNumberByPointer(Destination)) - SET_FLAG(PCB_FLAG_ONSOLDER, text); - else - CLEAR_FLAG(PCB_FLAG_ONSOLDER, text); - - /* re-calculate the bounding box (it could be mirrored now) */ - SetTextBoundingBox(&PCB->Font, text); - if (!Destination->text_tree) - Destination->text_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Destination->text_tree, (BoxType *) text, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_TEXT, Destination, text); - - return text; -} - -/* --------------------------------------------------------------------------- - * moves a text object between layers - */ -static void *MoveTextToLayer(LayerType * layer, TextType * text) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, text)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - return NULL; - } - if (Dest != layer) { - AddObjectToMoveToLayerUndoList(PCB_TYPE_TEXT, layer, text, text); - if (layer->On) - EraseText(layer, text); - text = MoveTextToLayerLowLevel(layer, text, Dest); - if (Dest->On) - DrawText(Dest, text); - if (layer->On || Dest->On) - Draw(); - } - return text; -} - -/* --------------------------------------------------------------------------- - * moves a polygon between layers; lowlevel routines - */ -static void *MovePolygonToLayerLowLevel(LayerType * Source, PolygonType * polygon, LayerType * Destination) -{ - r_delete_entry(Source->polygon_tree, (BoxType *) polygon); - - polylist_remove(polygon); - polylist_append(&Destination->Polygon, polygon); - - if (!Destination->polygon_tree) - Destination->polygon_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Destination->polygon_tree, (BoxType *) polygon, 0); - - return polygon; -} - -struct mptlc { - pcb_cardinal_t snum, dnum; - int type; - PolygonTypePtr polygon; -} mptlc; - -r_dir_t mptl_pin_callback(const BoxType * b, void *cl) -{ - struct mptlc *d = (struct mptlc *) cl; - PinTypePtr pin = (PinTypePtr) b; - if (!TEST_THERM(d->snum, pin) || !IsPointInPolygon(pin->X, pin->Y, pin->Thickness + pin->Clearance + 2, d->polygon)) - return R_DIR_NOT_FOUND; - if (d->type == PCB_TYPE_PIN) - AddObjectToFlagUndoList(PCB_TYPE_PIN, pin->Element, pin, pin); - else - AddObjectToFlagUndoList(PCB_TYPE_VIA, pin, pin, pin); - ASSIGN_THERM(d->dnum, GET_THERM(d->snum, pin), pin); - CLEAR_THERM(d->snum, pin); - return R_DIR_FOUND_CONTINUE; -} - -/* --------------------------------------------------------------------------- - * moves a polygon between layers - */ -static void *MovePolygonToLayer(LayerType * Layer, PolygonType * Polygon) -{ - PolygonTypePtr newone; - struct mptlc d; - - if (TEST_FLAG(PCB_FLAG_LOCK, Polygon)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - return NULL; - } - if (((long int) Dest == -1) || (Layer == Dest)) - return (Polygon); - AddObjectToMoveToLayerUndoList(PCB_TYPE_POLYGON, Layer, Polygon, Polygon); - if (Layer->On) - ErasePolygon(Polygon); - /* Move all of the thermals with the polygon */ - d.snum = GetLayerNumber(PCB->Data, Layer); - d.dnum = GetLayerNumber(PCB->Data, Dest); - d.polygon = Polygon; - d.type = PCB_TYPE_PIN; - r_search(PCB->Data->pin_tree, &Polygon->BoundingBox, NULL, mptl_pin_callback, &d, NULL); - d.type = PCB_TYPE_VIA; - r_search(PCB->Data->via_tree, &Polygon->BoundingBox, NULL, mptl_pin_callback, &d, NULL); - newone = (struct polygon_st *) MovePolygonToLayerLowLevel(Layer, Polygon, Dest); - InitClip(PCB->Data, Dest, newone); - if (Dest->On) { - DrawPolygon(Dest, newone); - Draw(); - } - return (newone); -} - -/* --------------------------------------------------------------------------- - * moves the object identified by its data pointers and the type - * not we don't bump the undo serial number - */ -void *MoveObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) -{ - void *result; - /* setup offset */ - DeltaX = DX; - DeltaY = DY; - AddObjectToMoveUndoList(Type, Ptr1, Ptr2, Ptr3, DX, DY); - result = ObjectOperation(&MoveFunctions, Type, Ptr1, Ptr2, Ptr3); - return (result); -} - -/* --------------------------------------------------------------------------- - * moves the object identified by its data pointers and the type - * as well as all attached rubberband lines - */ -void *MoveObjectAndRubberband(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) -{ - RubberbandTypePtr ptr; - void *ptr2; - - pcb_draw_inhibit_inc(); - - /* setup offset */ - DeltaX = DX; - DeltaY = DY; - if (DX == 0 && DY == 0) { - int n; - - /* first clear any marks that we made in the line flags */ - for(n = 0, ptr = Crosshair.AttachedObject.Rubberband; n < Crosshair.AttachedObject.RubberbandN; n++, ptr++) - CLEAR_FLAG(PCB_FLAG_RUBBEREND, ptr->Line); - - return (NULL); - } - - /* move all the lines... and reset the counter */ - ptr = Crosshair.AttachedObject.Rubberband; - while (Crosshair.AttachedObject.RubberbandN) { - /* first clear any marks that we made in the line flags */ - CLEAR_FLAG(PCB_FLAG_RUBBEREND, ptr->Line); - AddObjectToMoveUndoList(PCB_TYPE_LINE_POINT, ptr->Layer, ptr->Line, ptr->MovedPoint, DX, DY); - MoveLinePoint(ptr->Layer, ptr->Line, ptr->MovedPoint); - Crosshair.AttachedObject.RubberbandN--; - ptr++; - } - - AddObjectToMoveUndoList(Type, Ptr1, Ptr2, Ptr3, DX, DY); - ptr2 = ObjectOperation(&MoveFunctions, Type, Ptr1, Ptr2, Ptr3); - IncrementUndoSerialNumber(); - - pcb_draw_inhibit_dec(); - Draw(); - - return (ptr2); -} - -/* --------------------------------------------------------------------------- - * moves the object identified by its data pointers and the type - * to a new layer without changing it's position - */ -void *MoveObjectToLayer(int Type, void *Ptr1, void *Ptr2, void *Ptr3, LayerTypePtr Target, pcb_bool enmasse) -{ - void *result; - - /* setup global identifiers */ - Dest = Target; - MoreToCome = enmasse; - result = ObjectOperation(&MoveToLayerFunctions, Type, Ptr1, Ptr2, Ptr3); - IncrementUndoSerialNumber(); - return (result); -} - -/* --------------------------------------------------------------------------- - * moves the selected objects to a new layer without changing their - * positions - */ -pcb_bool MoveSelectedObjectsToLayer(LayerTypePtr Target) -{ - pcb_bool changed; - - /* setup global identifiers */ - Dest = Target; - MoreToCome = pcb_true; - changed = SelectedOperation(&MoveToLayerFunctions, pcb_true, PCB_TYPEMASK_ALL); - /* passing pcb_true to above operation causes Undoserial to auto-increment */ - return (changed); -} - -/* --------------------------------------------------------------------------- - * moves the selected layers to a new index in the layer list. - */ - -static void move_one_thermal(int old_index, int new_index, PinType * pin) -{ - int t1 = 0, i; - int oi = old_index, ni = new_index; - - if (old_index != -1) - t1 = GET_THERM(old_index, pin); - - if (oi == -1) - oi = MAX_LAYER - 1; /* inserting a layer */ - if (ni == -1) - ni = MAX_LAYER - 1; /* deleting a layer */ - - if (oi < ni) { - for (i = oi; i < ni; i++) - ASSIGN_THERM(i, GET_THERM(i + 1, pin), pin); - } - else { - for (i = oi; i > ni; i--) - ASSIGN_THERM(i, GET_THERM(i - 1, pin), pin); - } - - if (new_index != -1) - ASSIGN_THERM(new_index, t1, pin); - else - ASSIGN_THERM(ni, 0, pin); -} - -static void move_all_thermals(int old_index, int new_index) -{ - VIA_LOOP(PCB->Data); - { - move_one_thermal(old_index, new_index, via); - } - END_LOOP; - - ALLPIN_LOOP(PCB->Data); - { - move_one_thermal(old_index, new_index, pin); - } - ENDALL_LOOP; -} - -static int LastLayerInComponentGroup(int layer) -{ - int cgroup = GetLayerGroupNumberByNumber(max_group + COMPONENT_LAYER); - int lgroup = GetLayerGroupNumberByNumber(layer); - if (cgroup == lgroup && PCB->LayerGroups.Number[lgroup] == 2) - return 1; - return 0; -} - -static int LastLayerInSolderGroup(int layer) -{ - int sgroup = GetLayerGroupNumberByNumber(max_group + SOLDER_LAYER); - int lgroup = GetLayerGroupNumberByNumber(layer); - if (sgroup == lgroup && PCB->LayerGroups.Number[lgroup] == 2) - return 1; - return 0; -} - -int MoveLayer(int old_index, int new_index) -{ - int groups[MAX_LAYER + 2], l, g; - LayerType saved_layer; - int saved_group; - - AddLayerChangeToUndoList(old_index, new_index); - IncrementUndoSerialNumber(); - - if (old_index < -1 || old_index >= max_copper_layer) { - Message(PCB_MSG_DEFAULT, "Invalid old layer %d for move: must be -1..%d\n", old_index, max_copper_layer - 1); - return 1; - } - if (new_index < -1 || new_index > max_copper_layer || new_index >= MAX_LAYER) { - Message(PCB_MSG_DEFAULT, "Invalid new layer %d for move: must be -1..%d\n", new_index, max_copper_layer); - return 1; - } - if (old_index == new_index) - return 0; - - if (new_index == -1 && LastLayerInComponentGroup(old_index)) { - gui->confirm_dialog("You can't delete the last top-side layer\n", "Ok", NULL); - return 1; - } - - if (new_index == -1 && LastLayerInSolderGroup(old_index)) { - gui->confirm_dialog("You can't delete the last bottom-side layer\n", "Ok", NULL); - return 1; - } - - for (g = 0; g < MAX_LAYER + 2; g++) - groups[g] = -1; - - for (g = 0; g < MAX_LAYER; g++) - for (l = 0; l < PCB->LayerGroups.Number[g]; l++) - groups[PCB->LayerGroups.Entries[g][l]] = g; - - if (old_index == -1) { - LayerTypePtr lp; - if (max_copper_layer == MAX_LAYER) { - Message(PCB_MSG_DEFAULT, "No room for new layers\n"); - return 1; - } - /* Create a new layer at new_index. */ - lp = &PCB->Data->Layer[new_index]; - memmove(&PCB->Data->Layer[new_index + 1], - &PCB->Data->Layer[new_index], (max_copper_layer - new_index + 2) * sizeof(LayerType)); - memmove(&groups[new_index + 1], &groups[new_index], (max_copper_layer - new_index + 2) * sizeof(int)); - max_copper_layer++; - memset(lp, 0, sizeof(LayerType)); - lp->On = 1; - lp->Name = pcb_strdup("New Layer"); - lp->Color = conf_core.appearance.color.layer[new_index]; - lp->SelectedColor = conf_core.appearance.color.layer_selected[new_index]; - for (l = 0; l < max_copper_layer; l++) - if (LayerStack[l] >= new_index) - LayerStack[l]++; - LayerStack[max_copper_layer - 1] = new_index; - } - else if (new_index == -1) { - /* Delete the layer at old_index */ - memmove(&PCB->Data->Layer[old_index], - &PCB->Data->Layer[old_index + 1], (max_copper_layer - old_index + 2 - 1) * sizeof(LayerType)); - memset(&PCB->Data->Layer[max_copper_layer + 1], 0, sizeof(LayerType)); - memmove(&groups[old_index], &groups[old_index + 1], (max_copper_layer - old_index + 2 - 1) * sizeof(int)); - for (l = 0; l < max_copper_layer; l++) - if (LayerStack[l] == old_index) - memmove(LayerStack + l, LayerStack + l + 1, (max_copper_layer - l - 1) * sizeof(LayerStack[0])); - max_copper_layer--; - for (l = 0; l < max_copper_layer; l++) - if (LayerStack[l] > old_index) - LayerStack[l]--; - } - else { - /* Move an existing layer */ - memcpy(&saved_layer, &PCB->Data->Layer[old_index], sizeof(LayerType)); - saved_group = groups[old_index]; - if (old_index < new_index) { - memmove(&PCB->Data->Layer[old_index], &PCB->Data->Layer[old_index + 1], (new_index - old_index) * sizeof(LayerType)); - memmove(&groups[old_index], &groups[old_index + 1], (new_index - old_index) * sizeof(int)); - } - else { - memmove(&PCB->Data->Layer[new_index + 1], &PCB->Data->Layer[new_index], (old_index - new_index) * sizeof(LayerType)); - memmove(&groups[new_index + 1], &groups[new_index], (old_index - new_index) * sizeof(int)); - } - memcpy(&PCB->Data->Layer[new_index], &saved_layer, sizeof(LayerType)); - groups[new_index] = saved_group; - } - - move_all_thermals(old_index, new_index); - - for (g = 0; g < MAX_LAYER; g++) - PCB->LayerGroups.Number[g] = 0; - for (l = 0; l < max_copper_layer + 2; l++) { - int i; - g = groups[l]; - if (g >= 0) { - i = PCB->LayerGroups.Number[g]++; - PCB->LayerGroups.Entries[g][i] = l; - } - } - - for (g = 0; g < MAX_LAYER; g++) - if (PCB->LayerGroups.Number[g] == 0) { - memmove(&PCB->LayerGroups.Number[g], - &PCB->LayerGroups.Number[g + 1], (MAX_LAYER - g - 1) * sizeof(PCB->LayerGroups.Number[g])); - memmove(&PCB->LayerGroups.Entries[g], - &PCB->LayerGroups.Entries[g + 1], (MAX_LAYER - g - 1) * sizeof(PCB->LayerGroups.Entries[g])); - } - - hid_action("LayersChanged"); - gui->invalidate_all(); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char movelayer_syntax[] = "MoveLayer(old,new)"; - -static const char movelayer_help[] = "Moves/Creates/Deletes Layers."; - -/* %start-doc actions MoveLayer - -Moves a layer, creates a new layer, or deletes a layer. - -@table @code - -@item old -The is the layer number to act upon. Allowed values are: -@table @code - -@item c -Currently selected layer. - -@item -1 -Create a new layer. - -@item number -An existing layer number. - -@end table - -@item new -Specifies where to move the layer to. Allowed values are: -@table @code -@item -1 -Deletes the layer. - -@item up -Moves the layer up. - -@item down -Moves the layer down. - -@item c -Creates a new layer. - -@end table - -@end table - -%end-doc */ - -int MoveLayerAction(int argc, const char **argv, Coord x, Coord y) -{ - int old_index, new_index; - int new_top = -1; - - if (argc != 2) { - Message(PCB_MSG_DEFAULT, "Usage; MoveLayer(old,new)"); - return 1; - } - - if (strcmp(argv[0], "c") == 0) - old_index = INDEXOFCURRENT; - else - old_index = atoi(argv[0]); - - if (strcmp(argv[1], "c") == 0) { - new_index = INDEXOFCURRENT; - if (new_index < 0) - new_index = 0; - } - else if (strcmp(argv[1], "up") == 0) { - new_index = INDEXOFCURRENT - 1; - if (new_index < 0) - return 1; - new_top = new_index; - } - else if (strcmp(argv[1], "down") == 0) { - new_index = INDEXOFCURRENT + 1; - if (new_index >= max_copper_layer) - return 1; - new_top = new_index; - } - else - new_index = atoi(argv[1]); - - if (MoveLayer(old_index, new_index)) - return 1; - - if (new_index == -1) { - new_top = old_index; - if (new_top >= max_copper_layer) - new_top--; - new_index = new_top; - } - if (old_index == -1) - new_top = new_index; - - if (new_top != -1) - ChangeGroupVisibility(new_index, 1, 1); - - return 0; -} - -HID_Action move_action_list[] = { - {"MoveLayer", 0, MoveLayerAction, - movelayer_help, movelayer_syntax} -}; - -REGISTER_ACTIONS(move_action_list, NULL) Index: 1.1.4/src/polygon1.c =================================================================== --- 1.1.4/src/polygon1.c (revision 10776) +++ 1.1.4/src/polygon1.c (nonexistent) @@ -1,3190 +0,0 @@ -/* - polygon clipping functions. harry eaton implemented the algorithm - described in "A Closed Set of Algorithms for Performing Set - Operations on Polygonal Regions in the Plane" which the original - code did not do. I also modified it for integer coordinates - and faster computation. The license for this modified copy was - switched to the GPL per term (3) of the original LGPL license. - Copyright (C) 2006 harry eaton - - based on: - poly_Boolean: a polygon clip library - Copyright (C) 1997 Alexey Nikitin, Michael Leonov - (also the authors of the paper describing the actual algorithm) - leonov@propro.iis.nsk.su - - in turn based on: - nclip: a polygon clip library - Copyright (C) 1993 Klamer Schutte - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - polygon1.c - (C) 1997 Alexey Nikitin, Michael Leonov - (C) 1993 Klamer Schutte - - all cases where original (Klamer Schutte) code is present - are marked -*/ - -#include -#include -#include -#include -#include -#include - -#include "rtree.h" -#include "heap.h" -#include "pcb-printf.h" - -#define ROUND(a) (long)((a) > 0 ? ((a) + 0.5) : ((a) - 0.5)) - -#define EPSILON (1E-8) -#define IsZero(a, b) (fabs((a) - (b)) < EPSILON) - -/*********************************************************************/ -/* L o n g V e c t o r S t u f f */ -/*********************************************************************/ - -#define Vcopy(a,b) {(a)[0]=(b)[0];(a)[1]=(b)[1];} -int vect_equal(Vector v1, Vector v2); -void vect_init(Vector v, double x, double y); -void vect_sub(Vector res, Vector v2, Vector v3); - -void vect_min(Vector res, Vector v2, Vector v3); -void vect_max(Vector res, Vector v2, Vector v3); - -double vect_dist2(Vector v1, Vector v2); -double vect_det2(Vector v1, Vector v2); -double vect_len2(Vector v1); - -int vect_inters2(Vector A, Vector B, Vector C, Vector D, Vector S1, Vector S2); - -/* note that a vertex v's Flags.status represents the edge defined by - * v to v->next (i.e. the edge is forward of v) - */ -#define ISECTED 3 -#define UNKNWN 0 -#define INSIDE 1 -#define OUTSIDE 2 -#define SHARED 3 -#define SHARED2 4 - -#define TOUCHES 99 - -#define NODE_LABEL(n) ((n)->Flags.status) -#define LABEL_NODE(n,l) ((n)->Flags.status = (l)) - -#define error(code) longjmp(*(e), code) - -#define MemGet(ptr, type) \ - if (UNLIKELY (((ptr) = (type *)malloc(sizeof(type))) == NULL)) \ - error(err_no_memory); - -#undef DEBUG_LABEL -#undef DEBUG_ALL_LABELS -#undef DEBUG_JUMP -#undef DEBUG_GATHER -#undef DEBUG_ANGLE -#undef DEBUG -#ifdef DEBUG -#include -static void DEBUGP(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - pcb_vfprintf(stderr, fmt, ap); - va_end(ap); -} -#else -static void DEBUGP(const char *fmt, ...) { } -#endif - -/* ///////////////////////////////////////////////////////////////////////////// * / -/ * 2-Dimensional stuff -/ * ///////////////////////////////////////////////////////////////////////////// */ - -#define Vsub2(r,a,b) {(r)[0] = (a)[0] - (b)[0]; (r)[1] = (a)[1] - (b)[1];} -#define Vadd2(r,a,b) {(r)[0] = (a)[0] + (b)[0]; (r)[1] = (a)[1] + (b)[1];} -#define Vsca2(r,a,s) {(r)[0] = (a)[0] * (s); (r)[1] = (a)[1] * (s);} -#define Vcpy2(r,a) {(r)[0] = (a)[0]; (r)[1] = (a)[1];} -#define Vequ2(a,b) ((a)[0] == (b)[0] && (a)[1] == (b)[1]) -#define Vadds(r,a,b,s) {(r)[0] = ((a)[0] + (b)[0]) * (s); (r)[1] = ((a)[1] + (b)[1]) * (s);} -#define Vswp2(a,b) { long t; \ - t = (a)[0], (a)[0] = (b)[0], (b)[0] = t; \ - t = (a)[1], (a)[1] = (b)[1], (b)[1] = t; \ -} - -#ifdef DEBUG -static char *theState(VNODE * v); - -static void pline_dump(VNODE * v) -{ - VNODE *s, *n; - - s = v; - do { - n = v->next; - pcb_fprintf(stderr, "Line [%#mS %#mS %#mS %#mS 10 10 \"%s\"]\n", - v->point[0], v->point[1], n->point[0], n->point[1], theState(v)); - } - while ((v = v->next) != s); -} - -static void poly_dump(POLYAREA * p) -{ - POLYAREA *f = p; - PLINE *pl; - - do { - pl = p->contours; - do { - pline_dump(&pl->head); - fprintf(stderr, "NEXT PLINE\n"); - } - while ((pl = pl->next) != NULL); - fprintf(stderr, "NEXT POLY\n"); - } - while ((p = p->f) != f); -} -#endif - -/***************************************************************/ -/* routines for processing intersections */ - -/* -node_add - (C) 1993 Klamer Schutte - (C) 1997 Alexey Nikitin, Michael Leonov - (C) 2006 harry eaton - - returns a bit field in new_point that indicates where the - point was. - 1 means a new node was created and inserted - 4 means the intersection was not on the dest point -*/ -static VNODE *node_add_single(VNODE * dest, Vector po) -{ - VNODE *p; - - if (vect_equal(po, dest->point)) - return dest; - if (vect_equal(po, dest->next->point)) - return dest->next; - p = poly_CreateNode(po); - if (p == NULL) - return NULL; - p->cvc_prev = p->cvc_next = NULL; - p->Flags.status = UNKNWN; - return p; -} /* node_add */ - -#define ISECT_BAD_PARAM (-1) -#define ISECT_NO_MEMORY (-2) - - -/* -new_descriptor - (C) 2006 harry eaton -*/ -static CVCList *new_descriptor(VNODE * a, char poly, char side) -{ - CVCList *l = (CVCList *) malloc(sizeof(CVCList)); - Vector v; - register double ang, dx, dy; - - if (!l) - return NULL; - l->head = NULL; - l->parent = a; - l->poly = poly; - l->side = side; - l->next = l->prev = l; - if (side == 'P') /* previous */ - vect_sub(v, a->prev->point, a->point); - else /* next */ - vect_sub(v, a->next->point, a->point); - /* Uses slope/(slope+1) in quadrant 1 as a proxy for the angle. - * It still has the same monotonic sort result - * and is far less expensive to compute than the real angle. - */ - if (vect_equal(v, vect_zero)) { - if (side == 'P') { - if (a->prev->cvc_prev == (CVCList *) - 1) - a->prev->cvc_prev = a->prev->cvc_next = NULL; - poly_ExclVertex(a->prev); - vect_sub(v, a->prev->point, a->point); - } - else { - if (a->next->cvc_prev == (CVCList *) - 1) - a->next->cvc_prev = a->next->cvc_next = NULL; - poly_ExclVertex(a->next); - vect_sub(v, a->next->point, a->point); - } - } - assert(!vect_equal(v, vect_zero)); - dx = fabs((double) v[0]); - dy = fabs((double) v[1]); - ang = dy / (dy + dx); - /* now move to the actual quadrant */ - if (v[0] < 0 && v[1] >= 0) - ang = 2.0 - ang; /* 2nd quadrant */ - else if (v[0] < 0 && v[1] < 0) - ang += 2.0; /* 3rd quadrant */ - else if (v[0] >= 0 && v[1] < 0) - ang = 4.0 - ang; /* 4th quadrant */ - l->angle = ang; - assert(ang >= 0.0 && ang <= 4.0); -#ifdef DEBUG_ANGLE - DEBUGP("node on %c at %#mD assigned angle %g on side %c\n", poly, a->point[0], a->point[1], ang, side); -#endif - return l; -} - -/* -insert_descriptor - (C) 2006 harry eaton - - argument a is a cross-vertex node. - argument poly is the polygon it comes from ('A' or 'B') - argument side is the side this descriptor goes on ('P' for previous - 'N' for next. - argument start is the head of the list of cvclists -*/ -static CVCList *insert_descriptor(VNODE * a, char poly, char side, CVCList * start) -{ - CVCList *l, *newone, *big, *small; - - if (!(newone = new_descriptor(a, poly, side))) - return NULL; - /* search for the CVCList for this point */ - if (!start) { - start = newone; /* return is also new, so we know where start is */ - start->head = newone; /* circular list */ - return newone; - } - else { - l = start; - do { - assert(l->head); - if (l->parent->point[0] == a->point[0] - && l->parent->point[1] == a->point[1]) { /* this CVCList is at our point */ - start = l; - newone->head = l->head; - break; - } - if (l->head->parent->point[0] == start->parent->point[0] - && l->head->parent->point[1] == start->parent->point[1]) { - /* this seems to be a new point */ - /* link this cvclist to the list of all cvclists */ - for (; l->head != newone; l = l->next) - l->head = newone; - newone->head = start; - return newone; - } - l = l->head; - } - while (1); - } - assert(start); - l = big = small = start; - do { - if (l->next->angle < l->angle) { /* find start/end of list */ - small = l->next; - big = l; - } - else if (newone->angle >= l->angle && newone->angle <= l->next->angle) { - /* insert new cvc if it lies between existing points */ - newone->prev = l; - newone->next = l->next; - l->next = l->next->prev = newone; - return newone; - } - } - while ((l = l->next) != start); - /* didn't find it between points, it must go on an end */ - if (big->angle <= newone->angle) { - newone->prev = big; - newone->next = big->next; - big->next = big->next->prev = newone; - return newone; - } - assert(small->angle >= newone->angle); - newone->next = small; - newone->prev = small->prev; - small->prev = small->prev->next = newone; - return newone; -} - -/* -node_add_point - (C) 1993 Klamer Schutte - (C) 1997 Alexey Nikitin, Michael Leonov - - return 1 if new node in b, 2 if new node in a and 3 if new node in both -*/ - -static VNODE *node_add_single_point(VNODE * a, Vector p) -{ - VNODE *next_a, *new_node; - - next_a = a->next; - - new_node = node_add_single(a, p); - assert(new_node != NULL); - - new_node->cvc_prev = new_node->cvc_next = (CVCList *) - 1; - - if (new_node == a || new_node == next_a) - return NULL; - - return new_node; -} /* node_add_point */ - -/* -node_label - (C) 2006 harry eaton -*/ -static unsigned int node_label(VNODE * pn) -{ - CVCList *first_l, *l; - char this_poly; - int region = UNKNWN; - - assert(pn); - assert(pn->cvc_next); - this_poly = pn->cvc_next->poly; - /* search counter-clockwise in the cross vertex connectivity (CVC) list - * - * check for shared edges (that could be prev or next in the list since the angles are equal) - * and check if this edge (pn -> pn->next) is found between the other poly's entry and exit - */ - if (pn->cvc_next->angle == pn->cvc_next->prev->angle) - l = pn->cvc_next->prev; - else - l = pn->cvc_next->next; - - first_l = l; - while ((l->poly == this_poly) && (l != first_l->prev)) - l = l->next; - assert(l->poly != this_poly); - - assert(l && l->angle >= 0 && l->angle <= 4.0); - if (l->poly != this_poly) { - if (l->side == 'P') { - if (l->parent->prev->point[0] == pn->next->point[0] && l->parent->prev->point[1] == pn->next->point[1]) { - region = SHARED2; - pn->shared = l->parent->prev; - } - else - region = INSIDE; - } - else { - if (l->angle == pn->cvc_next->angle) { - assert(l->parent->next->point[0] == pn->next->point[0] && l->parent->next->point[1] == pn->next->point[1]); - region = SHARED; - pn->shared = l->parent; - } - else - region = OUTSIDE; - } - } - if (region == UNKNWN) { - for (l = l->next; l != pn->cvc_next; l = l->next) { - if (l->poly != this_poly) { - if (l->side == 'P') - region = INSIDE; - else - region = OUTSIDE; - break; - } - } - } - assert(region != UNKNWN); - assert(NODE_LABEL(pn) == UNKNWN || NODE_LABEL(pn) == region); - LABEL_NODE(pn, region); - if (region == SHARED || region == SHARED2) - return UNKNWN; - return region; -} /* node_label */ - -/* - add_descriptors - (C) 2006 harry eaton -*/ -static CVCList *add_descriptors(PLINE * pl, char poly, CVCList * list) -{ - VNODE *node = &pl->head; - - do { - if (node->cvc_prev) { - assert(node->cvc_prev == (CVCList *) - 1 && node->cvc_next == (CVCList *) - 1); - list = node->cvc_prev = insert_descriptor(node, poly, 'P', list); - if (!node->cvc_prev) - return NULL; - list = node->cvc_next = insert_descriptor(node, poly, 'N', list); - if (!node->cvc_next) - return NULL; - } - } - while ((node = node->next) != &pl->head); - return list; -} - -static inline void cntrbox_adjust(PLINE * c, Vector p) -{ - c->xmin = min(c->xmin, p[0]); - c->xmax = max(c->xmax, p[0] + 1); - c->ymin = min(c->ymin, p[1]); - c->ymax = max(c->ymax, p[1] + 1); -} - -/* some structures for handling segment intersections using the rtrees */ - -typedef struct seg { - BoxType box; - VNODE *v; - PLINE *p; - int intersected; -} seg; - -typedef struct _insert_node_task insert_node_task; - -struct _insert_node_task { - insert_node_task *next; - seg *node_seg; - VNODE *new_node; -}; - -typedef struct info { - double m, b; - rtree_t *tree; - VNODE *v; - struct seg *s; - jmp_buf *env, sego, *touch; - int need_restart; - insert_node_task *node_insert_list; -} info; - -typedef struct contour_info { - PLINE *pa; - jmp_buf restart; - jmp_buf *getout; - int need_restart; - insert_node_task *node_insert_list; -} contour_info; - - -/* - * adjust_tree() - * (C) 2006 harry eaton - * This replaces the segment in the tree with the two new segments after - * a vertex has been added - */ -static int adjust_tree(rtree_t * tree, struct seg *s) -{ - struct seg *q; - - q = (seg *) malloc(sizeof(struct seg)); - if (!q) - return 1; - q->intersected = 0; - q->v = s->v; - q->p = s->p; - q->box.X1 = min(q->v->point[0], q->v->next->point[0]); - q->box.X2 = max(q->v->point[0], q->v->next->point[0]) + 1; - q->box.Y1 = min(q->v->point[1], q->v->next->point[1]); - q->box.Y2 = max(q->v->point[1], q->v->next->point[1]) + 1; - r_insert_entry(tree, (const BoxType *) q, 1); - q = (seg *) malloc(sizeof(struct seg)); - if (!q) - return 1; - q->intersected = 0; - q->v = s->v->next; - q->p = s->p; - q->box.X1 = min(q->v->point[0], q->v->next->point[0]); - q->box.X2 = max(q->v->point[0], q->v->next->point[0]) + 1; - q->box.Y1 = min(q->v->point[1], q->v->next->point[1]); - q->box.Y2 = max(q->v->point[1], q->v->next->point[1]) + 1; - r_insert_entry(tree, (const BoxType *) q, 1); - r_delete_entry(tree, (const BoxType *) s); - return 0; -} - -/* - * seg_in_region() - * (C) 2006, harry eaton - * This prunes the search for boxes that don't intersect the segment. - */ -static r_dir_t seg_in_region(const BoxType * b, void *cl) -{ - struct info *i = (struct info *) cl; - double y1, y2; - /* for zero slope the search is aligned on the axis so it is already pruned */ - if (i->m == 0.) - return R_DIR_FOUND_CONTINUE; - y1 = i->m * b->X1 + i->b; - y2 = i->m * b->X2 + i->b; - if (min(y1, y2) >= b->Y2) - return R_DIR_NOT_FOUND; - if (max(y1, y2) < b->Y1) - return R_DIR_NOT_FOUND; - return R_DIR_FOUND_CONTINUE; /* might intersect */ -} - -/* Prepend a deferred node-insertion task to a list */ -static insert_node_task *prepend_insert_node_task(insert_node_task * list, seg * seg, VNODE * new_node) -{ - insert_node_task *task = (insert_node_task *) malloc(sizeof(*task)); - task->node_seg = seg; - task->new_node = new_node; - task->next = list; - return task; -} - -/* - * seg_in_seg() - * (C) 2006 harry eaton - * This routine checks if the segment in the tree intersect the search segment. - * If it does, the plines are marked as intersected and the point is marked for - * the cvclist. If the point is not already a vertex, a new vertex is inserted - * and the search for intersections starts over at the beginning. - * That is potentially a significant time penalty, but it does solve the snap rounding - * problem. There are efficient algorithms for finding intersections with snap - * rounding, but I don't have time to implement them right now. - */ -static r_dir_t seg_in_seg(const BoxType * b, void *cl) -{ - struct info *i = (struct info *) cl; - struct seg *s = (struct seg *) b; - Vector s1, s2; - int cnt; - VNODE *new_node; - - /* When new nodes are added at the end of a pass due to an intersection - * the segments may be altered. If either segment we're looking at has - * already been intersected this pass, skip it until the next pass. - */ - if (s->intersected || i->s->intersected) - return R_DIR_NOT_FOUND; - - cnt = vect_inters2(s->v->point, s->v->next->point, i->v->point, i->v->next->point, s1, s2); - if (!cnt) - return R_DIR_NOT_FOUND; - if (i->touch) /* if checking touches one find and we're done */ - longjmp(*i->touch, TOUCHES); - i->s->p->Flags.status = ISECTED; - s->p->Flags.status = ISECTED; - for (; cnt; cnt--) { - pcb_bool done_insert_on_i = pcb_false; - new_node = node_add_single_point(i->v, cnt > 1 ? s2 : s1); - if (new_node != NULL) { -#ifdef DEBUG_INTERSECT - DEBUGP("new intersection on segment \"i\" at %#mD\n", cnt > 1 ? s2[0] : s1[0], cnt > 1 ? s2[1] : s1[1]); -#endif - i->node_insert_list = prepend_insert_node_task(i->node_insert_list, i->s, new_node); - i->s->intersected = 1; - done_insert_on_i = pcb_true; - } - new_node = node_add_single_point(s->v, cnt > 1 ? s2 : s1); - if (new_node != NULL) { -#ifdef DEBUG_INTERSECT - DEBUGP("new intersection on segment \"s\" at %#mD\n", cnt > 1 ? s2[0] : s1[0], cnt > 1 ? s2[1] : s1[1]); -#endif - i->node_insert_list = prepend_insert_node_task(i->node_insert_list, s, new_node); - s->intersected = 1; - return R_DIR_NOT_FOUND; /* Keep looking for intersections with segment "i" */ - } - /* Skip any remaining r_search hits against segment i, as any further - * intersections will be rejected until the next pass anyway. - */ - if (done_insert_on_i) - longjmp(*i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static void *make_edge_tree(PLINE * pb) -{ - struct seg *s; - VNODE *bv; - rtree_t *ans = r_create_tree(NULL, 0, 0); - bv = &pb->head; - do { - s = (seg *) malloc(sizeof(struct seg)); - s->intersected = 0; - if (bv->point[0] < bv->next->point[0]) { - s->box.X1 = bv->point[0]; - s->box.X2 = bv->next->point[0] + 1; - } - else { - s->box.X2 = bv->point[0] + 1; - s->box.X1 = bv->next->point[0]; - } - if (bv->point[1] < bv->next->point[1]) { - s->box.Y1 = bv->point[1]; - s->box.Y2 = bv->next->point[1] + 1; - } - else { - s->box.Y2 = bv->point[1] + 1; - s->box.Y1 = bv->next->point[1]; - } - s->v = bv; - s->p = pb; - r_insert_entry(ans, (const BoxType *) s, 1); - } - while ((bv = bv->next) != &pb->head); - return (void *) ans; -} - -static r_dir_t get_seg(const BoxType * b, void *cl) -{ - struct info *i = (struct info *) cl; - struct seg *s = (struct seg *) b; - if (i->v == s->v) { - i->s = s; - return R_DIR_CANCEL; /* found */ - } - return R_DIR_NOT_FOUND; -} - -/* - * intersect() (and helpers) - * (C) 2006, harry eaton - * This uses an rtree to find A-B intersections. Whenever a new vertex is - * added, the search for intersections is re-started because the rounding - * could alter the topology otherwise. - * This should use a faster algorithm for snap rounding intersection finding. - * The best algorithm is probably found in: - * - * "Improved output-sensitive snap rounding," John Hershberger, Proceedings - * of the 22nd annual symposium on Computational geometry, 2006, pp 357-366. - * http://doi.acm.org/10.1145/1137856.1137909 - * - * Algorithms described by de Berg, or Goodrich or Halperin, or Hobby would - * probably work as well. - * - */ - -static r_dir_t contour_bounds_touch(const BoxType * b, void *cl) -{ - contour_info *c_info = (contour_info *) cl; - PLINE *pa = c_info->pa; - PLINE *pb = (PLINE *) b; - PLINE *rtree_over; - PLINE *looping_over; - VNODE *av; /* node iterators */ - struct info info; - BoxType box; - jmp_buf restart; - - /* Have seg_in_seg return to our desired location if it touches */ - info.env = &restart; - info.touch = c_info->getout; - info.need_restart = 0; - info.node_insert_list = c_info->node_insert_list; - - /* Pick which contour has the fewer points, and do the loop - * over that. The r_tree makes hit-testing against a contour - * faster, so we want to do that on the bigger contour. - */ - if (pa->Count < pb->Count) { - rtree_over = pb; - looping_over = pa; - } - else { - rtree_over = pa; - looping_over = pb; - } - - av = &looping_over->head; - do { /* Loop over the nodes in the smaller contour */ - r_dir_t rres; - /* check this edge for any insertions */ - double dx; - info.v = av; - /* compute the slant for region trimming */ - dx = av->next->point[0] - av->point[0]; - if (dx == 0) - info.m = 0; - else { - info.m = (av->next->point[1] - av->point[1]) / dx; - info.b = av->point[1] - info.m * av->point[0]; - } - box.X2 = (box.X1 = av->point[0]) + 1; - box.Y2 = (box.Y1 = av->point[1]) + 1; - - /* fill in the segment in info corresponding to this node */ - rres = r_search(looping_over->tree, &box, NULL, get_seg, &info, NULL); - assert(rres == R_DIR_CANCEL); - - /* If we're going to have another pass anyway, skip this */ - if (info.s->intersected && info.node_insert_list != NULL) - continue; - - if (setjmp(restart)) - continue; - - /* NB: If this actually hits anything, we are teleported back to the beginning */ - info.tree = rtree_over->tree; - if (info.tree) { - int seen; - r_search(info.tree, &info.s->box, seg_in_region, seg_in_seg, &info, &seen); - if (UNLIKELY(seen)) - assert(0); /* XXX: Memory allocation failure */ - } - } - while ((av = av->next) != &looping_over->head); - - c_info->node_insert_list = info.node_insert_list; - if (info.need_restart) - c_info->need_restart = 1; - return R_DIR_NOT_FOUND; -} - -static int intersect_impl(jmp_buf * jb, POLYAREA * b, POLYAREA * a, int add) -{ - POLYAREA *t; - PLINE *pa; - contour_info c_info; - int need_restart = 0; - insert_node_task *task; - c_info.need_restart = 0; - c_info.node_insert_list = NULL; - - /* Search the r-tree of the object with most contours - * We loop over the contours of "a". Swap if necessary. - */ - if (a->contour_tree->size > b->contour_tree->size) { - t = b; - b = a; - a = t; - } - - for (pa = a->contours; pa; pa = pa->next) { /* Loop over the contours of POLYAREA "a" */ - BoxType sb; - jmp_buf out; - int retval; - - c_info.getout = NULL; - c_info.pa = pa; - - if (!add) { - retval = setjmp(out); - if (retval) { - /* The intersection test short-circuited back here, - * we need to clean up, then longjmp to jb */ - longjmp(*jb, retval); - } - c_info.getout = &out; - } - - sb.X1 = pa->xmin; - sb.Y1 = pa->ymin; - sb.X2 = pa->xmax + 1; - sb.Y2 = pa->ymax + 1; - - r_search(b->contour_tree, &sb, NULL, contour_bounds_touch, &c_info, NULL); - if (c_info.need_restart) - need_restart = 1; - } - - /* Process any deferred node insertions */ - task = c_info.node_insert_list; - while (task != NULL) { - insert_node_task *next = task->next; - - /* Do insertion */ - task->new_node->prev = task->node_seg->v; - task->new_node->next = task->node_seg->v->next; - task->node_seg->v->next->prev = task->new_node; - task->node_seg->v->next = task->new_node; - task->node_seg->p->Count++; - - cntrbox_adjust(task->node_seg->p, task->new_node->point); - if (adjust_tree(task->node_seg->p->tree, task->node_seg)) - assert(0); /* XXX: Memory allocation failure */ - - need_restart = 1; /* Any new nodes could intersect */ - - free(task); - task = next; - } - - return need_restart; -} - -static int intersect(jmp_buf * jb, POLYAREA * b, POLYAREA * a, int add) -{ - int call_count = 1; - while (intersect_impl(jb, b, a, add)) - call_count++; - return 0; -} - -static void M_POLYAREA_intersect(jmp_buf * e, POLYAREA * afst, POLYAREA * bfst, int add) -{ - POLYAREA *a = afst, *b = bfst; - PLINE *curcA, *curcB; - CVCList *the_list = NULL; - - if (a == NULL || b == NULL) - error(err_bad_parm); - do { - do { - if (a->contours->xmax >= b->contours->xmin && - a->contours->ymax >= b->contours->ymin && - a->contours->xmin <= b->contours->xmax && a->contours->ymin <= b->contours->ymax) { - if (UNLIKELY(intersect(e, a, b, add))) - error(err_no_memory); - } - } - while (add && (a = a->f) != afst); - for (curcB = b->contours; curcB != NULL; curcB = curcB->next) - if (curcB->Flags.status == ISECTED) { - the_list = add_descriptors(curcB, 'B', the_list); - if (UNLIKELY(the_list == NULL)) - error(err_no_memory); - } - } - while (add && (b = b->f) != bfst); - do { - for (curcA = a->contours; curcA != NULL; curcA = curcA->next) - if (curcA->Flags.status == ISECTED) { - the_list = add_descriptors(curcA, 'A', the_list); - if (UNLIKELY(the_list == NULL)) - error(err_no_memory); - } - } - while (add && (a = a->f) != afst); -} /* M_POLYAREA_intersect */ - -static inline int cntrbox_inside(PLINE * c1, PLINE * c2) -{ - assert(c1 != NULL && c2 != NULL); - return ((c1->xmin >= c2->xmin) && (c1->ymin >= c2->ymin) && (c1->xmax <= c2->xmax) && (c1->ymax <= c2->ymax)); -} - -/*****************************************************************/ -/* Routines for making labels */ - -static r_dir_t count_contours_i_am_inside(const BoxType * b, void *cl) -{ - PLINE *me = (PLINE *) cl; - PLINE *check = (PLINE *) b; - - if (poly_ContourInContour(check, me)) - return R_DIR_FOUND_CONTINUE; - return R_DIR_NOT_FOUND; -} - -/* cntr_in_M_POLYAREA -returns poly is inside outfst ? TRUE : FALSE */ -static int cntr_in_M_POLYAREA(PLINE * poly, POLYAREA * outfst, BOOLp test) -{ - POLYAREA *outer = outfst; - heap_t *heap; - - assert(poly != NULL); - assert(outer != NULL); - - heap = heap_create(); - do { - if (cntrbox_inside(poly, outer->contours)) - heap_insert(heap, outer->contours->area, (void *) outer); - } - /* if checking touching, use only the first polygon */ - while (!test && (outer = outer->f) != outfst); - /* we need only check the smallest poly container - * but we must loop in case the box container is not - * the poly container */ - do { - int cnt; - - if (heap_is_empty(heap)) - break; - outer = (POLYAREA *) heap_remove_smallest(heap); - - r_search(outer->contour_tree, (BoxType *) poly, NULL, count_contours_i_am_inside, poly, &cnt); - switch (cnt) { - case 0: /* Didn't find anything in this piece, Keep looking */ - break; - case 1: /* Found we are inside this piece, and not any of its holes */ - heap_destroy(&heap); - return TRUE; - case 2: /* Found inside a hole in the smallest polygon so far. No need to check the other polygons */ - heap_destroy(&heap); - return FALSE; - default: - printf("Something strange here\n"); - break; - } - } - while (1); - heap_destroy(&heap); - return FALSE; -} /* cntr_in_M_POLYAREA */ - -#ifdef DEBUG - -static char *theState(VNODE * v) -{ - static char u[] = "UNKNOWN"; - static char i[] = "INSIDE"; - static char o[] = "OUTSIDE"; - static char s[] = "SHARED"; - static char s2[] = "SHARED2"; - - switch (NODE_LABEL(v)) { - case INSIDE: - return i; - case OUTSIDE: - return o; - case SHARED: - return s; - case SHARED2: - return s2; - default: - return u; - } -} - -#ifdef DEBUG_ALL_LABELS -static void print_labels(PLINE * a) -{ - VNODE *c = &a->head; - - do { - DEBUGP("%#mD->%#mD labeled %s\n", c->point[0], c->point[1], c->next->point[0], c->next->point[1], theState(c)); - } - while ((c = c->next) != &a->head); -} -#endif -#endif - -/* -label_contour - (C) 2006 harry eaton - (C) 1993 Klamer Schutte - (C) 1997 Alexey Nikitin, Michael Leonov -*/ - -static BOOLp label_contour(PLINE * a) -{ - VNODE *cur = &a->head; - VNODE *first_labelled = NULL; - int label = UNKNWN; - - do { - if (cur->cvc_next) { /* examine cross vertex */ - label = node_label(cur); - if (first_labelled == NULL) - first_labelled = cur; - continue; - } - - if (first_labelled == NULL) - continue; - - /* This labels nodes which aren't cross-connected */ - assert(label == INSIDE || label == OUTSIDE); - LABEL_NODE(cur, label); - } - while ((cur = cur->next) != first_labelled); -#ifdef DEBUG_ALL_LABELS - print_labels(a); - DEBUGP("\n\n"); -#endif - return FALSE; -} /* label_contour */ - -static BOOLp cntr_label_POLYAREA(PLINE * poly, POLYAREA * ppl, BOOLp test) -{ - assert(ppl != NULL && ppl->contours != NULL); - if (poly->Flags.status == ISECTED) { - label_contour(poly); /* should never get here when BOOLp is pcb_true */ - } - else if (cntr_in_M_POLYAREA(poly, ppl, test)) { - if (test) - return TRUE; - poly->Flags.status = INSIDE; - } - else { - if (test) - return pcb_false; - poly->Flags.status = OUTSIDE; - } - return FALSE; -} /* cntr_label_POLYAREA */ - -static BOOLp M_POLYAREA_label_separated(PLINE * afst, POLYAREA * b, BOOLp touch) -{ - PLINE *curc = afst; - - for (curc = afst; curc != NULL; curc = curc->next) { - if (cntr_label_POLYAREA(curc, b, touch) && touch) - return TRUE; - } - return FALSE; -} - -static BOOLp M_POLYAREA_label(POLYAREA * afst, POLYAREA * b, BOOLp touch) -{ - POLYAREA *a = afst; - PLINE *curc; - - assert(a != NULL); - do { - for (curc = a->contours; curc != NULL; curc = curc->next) - if (cntr_label_POLYAREA(curc, b, touch)) { - if (touch) - return TRUE; - } - } - while (!touch && (a = a->f) != afst); - return FALSE; -} - -/****************************************************************/ - -/* routines for temporary storing resulting contours */ -static void InsCntr(jmp_buf * e, PLINE * c, POLYAREA ** dst) -{ - POLYAREA *newp; - - if (*dst == NULL) { - MemGet(*dst, POLYAREA); - (*dst)->f = (*dst)->b = *dst; - newp = *dst; - } - else { - MemGet(newp, POLYAREA); - newp->f = *dst; - newp->b = (*dst)->b; - newp->f->b = newp->b->f = newp; - } - newp->contours = c; - newp->contour_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(newp->contour_tree, (BoxTypePtr) c, 0); - c->next = NULL; -} /* InsCntr */ - -static void -PutContour(jmp_buf * e, PLINE * cntr, POLYAREA ** contours, PLINE ** holes, - POLYAREA * owner, POLYAREA * parent, PLINE * parent_contour) -{ - assert(cntr != NULL); - assert(cntr->Count > 2); - cntr->next = NULL; - - if (cntr->Flags.orient == PLF_DIR) { - if (owner != NULL) - r_delete_entry(owner->contour_tree, (BoxType *) cntr); - InsCntr(e, cntr, contours); - } - /* put hole into temporary list */ - else { - /* if we know this belongs inside the parent, put it there now */ - if (parent_contour) { - cntr->next = parent_contour->next; - parent_contour->next = cntr; - if (owner != parent) { - if (owner != NULL) - r_delete_entry(owner->contour_tree, (BoxType *) cntr); - r_insert_entry(parent->contour_tree, (BoxType *) cntr, 0); - } - } - else { - cntr->next = *holes; - *holes = cntr; /* let cntr be 1st hole in list */ - /* We don't insert the holes into an r-tree, - * they just form a linked list */ - if (owner != NULL) - r_delete_entry(owner->contour_tree, (BoxType *) cntr); - } - } -} /* PutContour */ - -static inline void remove_contour(POLYAREA * piece, PLINE * prev_contour, PLINE * contour, int remove_rtree_entry) -{ - if (piece->contours == contour) - piece->contours = contour->next; - else if (prev_contour != NULL) { - assert(prev_contour->next == contour); - prev_contour->next = contour->next; - } - - contour->next = NULL; - - if (remove_rtree_entry) - r_delete_entry(piece->contour_tree, (BoxType *) contour); -} - -struct polyarea_info { - BoxType BoundingBox; - POLYAREA *pa; -}; - -static r_dir_t heap_it(const BoxType * b, void *cl) -{ - heap_t *heap = (heap_t *) cl; - struct polyarea_info *pa_info = (struct polyarea_info *) b; - PLINE *p = pa_info->pa->contours; - if (p->Count == 0) - return R_DIR_NOT_FOUND; /* how did this happen? */ - heap_insert(heap, p->area, pa_info); - return R_DIR_FOUND_CONTINUE; -} - -struct find_inside_info { - jmp_buf jb; - PLINE *want_inside; - PLINE *result; -}; - -static r_dir_t find_inside(const BoxType * b, void *cl) -{ - struct find_inside_info *info = (struct find_inside_info *) cl; - PLINE *check = (PLINE *) b; - /* Do test on check to see if it inside info->want_inside */ - /* If it is: */ - if (check->Flags.orient == PLF_DIR) { - return R_DIR_NOT_FOUND; - } - if (poly_ContourInContour(info->want_inside, check)) { - info->result = check; - longjmp(info->jb, 1); - } - return R_DIR_NOT_FOUND; -} - -static void InsertHoles(jmp_buf * e, POLYAREA * dest, PLINE ** src) -{ - POLYAREA *curc; - PLINE *curh, *container; - heap_t *heap; - rtree_t *tree; - int i; - int num_polyareas = 0; - struct polyarea_info *all_pa_info, *pa_info; - - if (*src == NULL) - return; /* empty hole list */ - if (dest == NULL) - error(err_bad_parm); /* empty contour list */ - - /* Count dest polyareas */ - curc = dest; - do { - num_polyareas++; - } - while ((curc = curc->f) != dest); - - /* make a polyarea info table */ - /* make an rtree of polyarea info table */ - all_pa_info = (struct polyarea_info *) malloc(sizeof(struct polyarea_info) * num_polyareas); - tree = r_create_tree(NULL, 0, 0); - i = 0; - curc = dest; - do { - all_pa_info[i].BoundingBox.X1 = curc->contours->xmin; - all_pa_info[i].BoundingBox.Y1 = curc->contours->ymin; - all_pa_info[i].BoundingBox.X2 = curc->contours->xmax; - all_pa_info[i].BoundingBox.Y2 = curc->contours->ymax; - all_pa_info[i].pa = curc; - r_insert_entry(tree, (const BoxType *) &all_pa_info[i], 0); - i++; - } - while ((curc = curc->f) != dest); - - /* loop through the holes and put them where they belong */ - while ((curh = *src) != NULL) { - *src = curh->next; - - container = NULL; - /* build a heap of all of the polys that the hole is inside its bounding box */ - heap = heap_create(); - r_search(tree, (BoxType *) curh, NULL, heap_it, heap, NULL); - if (heap_is_empty(heap)) { -#ifndef NDEBUG -#ifdef DEBUG - poly_dump(dest); -#endif -#endif - poly_DelContour(&curh); - error(err_bad_parm); - } - /* Now search the heap for the container. If there was only one item - * in the heap, assume it is the container without the expense of - * proving it. - */ - pa_info = (struct polyarea_info *) heap_remove_smallest(heap); - if (heap_is_empty(heap)) { /* only one possibility it must be the right one */ - assert(poly_ContourInContour(pa_info->pa->contours, curh)); - container = pa_info->pa->contours; - } - else { - do { - if (poly_ContourInContour(pa_info->pa->contours, curh)) { - container = pa_info->pa->contours; - break; - } - if (heap_is_empty(heap)) - break; - pa_info = (struct polyarea_info *) heap_remove_smallest(heap); - } - while (1); - } - heap_destroy(&heap); - if (container == NULL) { - /* bad input polygons were given */ -#ifndef NDEBUG -#ifdef DEBUG - poly_dump(dest); -#endif -#endif - curh->next = NULL; - poly_DelContour(&curh); - error(err_bad_parm); - } - else { - /* Need to check if this new hole means we need to kick out any old ones for reprocessing */ - while (1) { - struct find_inside_info info; - PLINE *prev; - - info.want_inside = curh; - - /* Set jump return */ - if (setjmp(info.jb)) { - /* Returned here! */ - } - else { - info.result = NULL; - /* Rtree search, calling back a routine to longjmp back with data about any hole inside the added one */ - /* Be sure not to bother jumping back to report the main contour! */ - r_search(pa_info->pa->contour_tree, (BoxType *) curh, NULL, find_inside, &info, NULL); - - /* Nothing found? */ - break; - } - - /* We need to find the contour before it, so we can update its next pointer */ - prev = container; - while (prev->next != info.result) { - prev = prev->next; - } - - /* Remove hole from the contour */ - remove_contour(pa_info->pa, prev, info.result, TRUE); - - /* Add hole as the next on the list to be processed in this very function */ - info.result->next = *src; - *src = info.result; - } - /* End check for kicked out holes */ - - /* link at front of hole list */ - curh->next = container->next; - container->next = curh; - r_insert_entry(pa_info->pa->contour_tree, (BoxTypePtr) curh, 0); - - } - } - r_destroy_tree(&tree); - free(all_pa_info); -} /* InsertHoles */ - - -/****************************************************************/ -/* routines for collecting result */ - -typedef enum { - FORW, BACKW -} DIRECTION; - -/* Start Rule */ -typedef int (*S_Rule) (VNODE *, DIRECTION *); - -/* Jump Rule */ -typedef int (*J_Rule) (char, VNODE *, DIRECTION *); - -static int UniteS_Rule(VNODE * cur, DIRECTION * initdir) -{ - *initdir = FORW; - return (NODE_LABEL(cur) == OUTSIDE) || (NODE_LABEL(cur) == SHARED); -} - -static int IsectS_Rule(VNODE * cur, DIRECTION * initdir) -{ - *initdir = FORW; - return (NODE_LABEL(cur) == INSIDE) || (NODE_LABEL(cur) == SHARED); -} - -static int SubS_Rule(VNODE * cur, DIRECTION * initdir) -{ - *initdir = FORW; - return (NODE_LABEL(cur) == OUTSIDE) || (NODE_LABEL(cur) == SHARED2); -} - -static int XorS_Rule(VNODE * cur, DIRECTION * initdir) -{ - if (cur->Flags.status == INSIDE) { - *initdir = BACKW; - return TRUE; - } - if (cur->Flags.status == OUTSIDE) { - *initdir = FORW; - return TRUE; - } - return FALSE; -} - -static int IsectJ_Rule(char p, VNODE * v, DIRECTION * cdir) -{ - assert(*cdir == FORW); - return (v->Flags.status == INSIDE || v->Flags.status == SHARED); -} - -static int UniteJ_Rule(char p, VNODE * v, DIRECTION * cdir) -{ - assert(*cdir == FORW); - return (v->Flags.status == OUTSIDE || v->Flags.status == SHARED); -} - -static int XorJ_Rule(char p, VNODE * v, DIRECTION * cdir) -{ - if (v->Flags.status == INSIDE) { - *cdir = BACKW; - return TRUE; - } - if (v->Flags.status == OUTSIDE) { - *cdir = FORW; - return TRUE; - } - return FALSE; -} - -static int SubJ_Rule(char p, VNODE * v, DIRECTION * cdir) -{ - if (p == 'B' && v->Flags.status == INSIDE) { - *cdir = BACKW; - return TRUE; - } - if (p == 'A' && v->Flags.status == OUTSIDE) { - *cdir = FORW; - return TRUE; - } - if (v->Flags.status == SHARED2) { - if (p == 'A') - *cdir = FORW; - else - *cdir = BACKW; - return TRUE; - } - return FALSE; -} - -/* return the edge that comes next. - * if the direction is BACKW, then we return the next vertex - * so that prev vertex has the flags for the edge - * - * returns pcb_true if an edge is found, pcb_false otherwise - */ -static int jump(VNODE ** cur, DIRECTION * cdir, J_Rule rule) -{ - CVCList *d, *start; - VNODE *e; - DIRECTION newone; - - if (!(*cur)->cvc_prev) { /* not a cross-vertex */ - if (*cdir == FORW ? (*cur)->Flags.mark : (*cur)->prev->Flags.mark) - return FALSE; - return TRUE; - } -#ifdef DEBUG_JUMP - DEBUGP("jump entering node at %$mD\n", (*cur)->point[0], (*cur)->point[1]); -#endif - if (*cdir == FORW) - d = (*cur)->cvc_prev->prev; - else - d = (*cur)->cvc_next->prev; - start = d; - do { - e = d->parent; - if (d->side == 'P') - e = e->prev; - newone = *cdir; - if (!e->Flags.mark && rule(d->poly, e, &newone)) { - if ((d->side == 'N' && newone == FORW) || (d->side == 'P' && newone == BACKW)) { -#ifdef DEBUG_JUMP - if (newone == FORW) - DEBUGP("jump leaving node at %#mD\n", e->next->point[0], e->next->point[1]); - else - DEBUGP("jump leaving node at %#mD\n", e->point[0], e->point[1]); -#endif - *cur = d->parent; - *cdir = newone; - return TRUE; - } - } - } - while ((d = d->prev) != start); - return FALSE; -} - -static int Gather(VNODE * start, PLINE ** result, J_Rule v_rule, DIRECTION initdir) -{ - VNODE *cur = start, *newn; - DIRECTION dir = initdir; -#ifdef DEBUG_GATHER - DEBUGP("gather direction = %d\n", dir); -#endif - assert(*result == NULL); - do { - /* see where to go next */ - if (!jump(&cur, &dir, v_rule)) - break; - /* add edge to polygon */ - if (!*result) { - *result = poly_NewContour(cur->point); - if (*result == NULL) - return err_no_memory; - } - else { - if ((newn = poly_CreateNode(cur->point)) == NULL) - return err_no_memory; - poly_InclVertex((*result)->head.prev, newn); - } -#ifdef DEBUG_GATHER - DEBUGP("gather vertex at %#mD\n", cur->point[0], cur->point[1]); -#endif - /* Now mark the edge as included. */ - newn = (dir == FORW ? cur : cur->prev); - newn->Flags.mark = 1; - /* for SHARED edge mark both */ - if (newn->shared) - newn->shared->Flags.mark = 1; - - /* Advance to the next edge. */ - cur = (dir == FORW ? cur->next : cur->prev); - } - while (1); - return err_ok; -} /* Gather */ - -static void Collect1(jmp_buf * e, VNODE * cur, DIRECTION dir, POLYAREA ** contours, PLINE ** holes, J_Rule j_rule) -{ - PLINE *p = NULL; /* start making contour */ - int errc = err_ok; - if ((errc = Gather(dir == FORW ? cur : cur->next, &p, j_rule, dir)) != err_ok) { - if (p != NULL) - poly_DelContour(&p); - error(errc); - } - if (!p) - return; - poly_PreContour(p, TRUE); - if (p->Count > 2) { -#ifdef DEBUG_GATHER - DEBUGP("adding contour with %d vertices and direction %c\n", p->Count, p->Flags.orient ? 'F' : 'B'); -#endif - PutContour(e, p, contours, holes, NULL, NULL, NULL); - } - else { - /* some sort of computation error ? */ -#ifdef DEBUG_GATHER - DEBUGP("Bad contour! Not enough points!!\n"); -#endif - poly_DelContour(&p); - } -} - -static void Collect(jmp_buf * e, PLINE * a, POLYAREA ** contours, PLINE ** holes, S_Rule s_rule, J_Rule j_rule) -{ - VNODE *cur, *other; - DIRECTION dir; - - cur = &a->head; - do { - if (s_rule(cur, &dir) && cur->Flags.mark == 0) - Collect1(e, cur, dir, contours, holes, j_rule); - other = cur; - if ((other->cvc_prev && jump(&other, &dir, j_rule))) - Collect1(e, other, dir, contours, holes, j_rule); - } - while ((cur = cur->next) != &a->head); -} /* Collect */ - - -static int -cntr_Collect(jmp_buf * e, PLINE ** A, POLYAREA ** contours, PLINE ** holes, - int action, POLYAREA * owner, POLYAREA * parent, PLINE * parent_contour) -{ - PLINE *tmprev; - - if ((*A)->Flags.status == ISECTED) { - switch (action) { - case PBO_UNITE: - Collect(e, *A, contours, holes, UniteS_Rule, UniteJ_Rule); - break; - case PBO_ISECT: - Collect(e, *A, contours, holes, IsectS_Rule, IsectJ_Rule); - break; - case PBO_XOR: - Collect(e, *A, contours, holes, XorS_Rule, XorJ_Rule); - break; - case PBO_SUB: - Collect(e, *A, contours, holes, SubS_Rule, SubJ_Rule); - break; - }; - } - else { - switch (action) { - case PBO_ISECT: - if ((*A)->Flags.status == INSIDE) { - tmprev = *A; - /* disappear this contour (rtree entry removed in PutContour) */ - *A = tmprev->next; - tmprev->next = NULL; - PutContour(e, tmprev, contours, holes, owner, NULL, NULL); - return TRUE; - } - break; - case PBO_XOR: - if ((*A)->Flags.status == INSIDE) { - tmprev = *A; - /* disappear this contour (rtree entry removed in PutContour) */ - *A = tmprev->next; - tmprev->next = NULL; - poly_InvContour(tmprev); - PutContour(e, tmprev, contours, holes, owner, NULL, NULL); - return TRUE; - } - /* break; *//* Fall through (I think this is correct! pcjc2) */ - case PBO_UNITE: - case PBO_SUB: - if ((*A)->Flags.status == OUTSIDE) { - tmprev = *A; - /* disappear this contour (rtree entry removed in PutContour) */ - *A = tmprev->next; - tmprev->next = NULL; - PutContour(e, tmprev, contours, holes, owner, parent, parent_contour); - return TRUE; - } - break; - } - } - return FALSE; -} /* cntr_Collect */ - -static void M_B_AREA_Collect(jmp_buf * e, POLYAREA * bfst, POLYAREA ** contours, PLINE ** holes, int action) -{ - POLYAREA *b = bfst; - PLINE **cur, **next, *tmp; - - assert(b != NULL); - do { - for (cur = &b->contours; *cur != NULL; cur = next) { - next = &((*cur)->next); - if ((*cur)->Flags.status == ISECTED) - continue; - - if ((*cur)->Flags.status == INSIDE) - switch (action) { - case PBO_XOR: - case PBO_SUB: - poly_InvContour(*cur); - case PBO_ISECT: - tmp = *cur; - *cur = tmp->next; - next = cur; - tmp->next = NULL; - tmp->Flags.status = UNKNWN; - PutContour(e, tmp, contours, holes, b, NULL, NULL); - break; - case PBO_UNITE: - break; /* nothing to do - already included */ - } - else if ((*cur)->Flags.status == OUTSIDE) - switch (action) { - case PBO_XOR: - case PBO_UNITE: - /* include */ - tmp = *cur; - *cur = tmp->next; - next = cur; - tmp->next = NULL; - tmp->Flags.status = UNKNWN; - PutContour(e, tmp, contours, holes, b, NULL, NULL); - break; - case PBO_ISECT: - case PBO_SUB: - break; /* do nothing, not included */ - } - } - } - while ((b = b->f) != bfst); -} - - -static inline int contour_is_first(POLYAREA * a, PLINE * cur) -{ - return (a->contours == cur); -} - - -static inline int contour_is_last(PLINE * cur) -{ - return (cur->next == NULL); -} - - -static inline void remove_polyarea(POLYAREA ** list, POLYAREA * piece) -{ - /* If this item was the start of the list, advance that pointer */ - if (*list == piece) - *list = (*list)->f; - - /* But reset it to NULL if it wraps around and hits us again */ - if (*list == piece) - *list = NULL; - - piece->b->f = piece->f; - piece->f->b = piece->b; - piece->f = piece->b = piece; -} - -static void M_POLYAREA_separate_isected(jmp_buf * e, POLYAREA ** pieces, PLINE ** holes, PLINE ** isected) -{ - POLYAREA *a = *pieces; - POLYAREA *anext; - PLINE *curc, *next, *prev; - int finished; - - if (a == NULL) - return; - - /* TODO: STASH ENOUGH INFORMATION EARLIER ON, SO WE CAN REMOVE THE INTERSECTED - CONTOURS WITHOUT HAVING TO WALK THE FULL DATA-STRUCTURE LOOKING FOR THEM. */ - - do { - int hole_contour = 0; - int is_outline = 1; - - anext = a->f; - finished = (anext == *pieces); - - prev = NULL; - for (curc = a->contours; curc != NULL; curc = next, is_outline = 0) { - int is_first = contour_is_first(a, curc); - int is_last = contour_is_last(curc); - int isect_contour = (curc->Flags.status == ISECTED); - - next = curc->next; - - if (isect_contour || hole_contour) { - - /* Reset the intersection flags, since we keep these pieces */ - if (curc->Flags.status != ISECTED) - curc->Flags.status = UNKNWN; - - remove_contour(a, prev, curc, !(is_first && is_last)); - - if (isect_contour) { - /* Link into the list of intersected contours */ - curc->next = *isected; - *isected = curc; - } - else if (hole_contour) { - /* Link into the list of holes */ - curc->next = *holes; - *holes = curc; - } - else { - assert(0); - } - - if (is_first && is_last) { - remove_polyarea(pieces, a); - poly_Free(&a); /* NB: Sets a to NULL */ - } - - } - else { - /* Note the item we just didn't delete as the next - candidate for having its "next" pointer adjusted. - Saves walking the contour list when we delete one. */ - prev = curc; - } - - /* If we move or delete an outer contour, we need to move any holes - we wish to keep within that contour to the holes list. */ - if (is_outline && isect_contour) - hole_contour = 1; - - } - - /* If we deleted all the pieces of the polyarea, *pieces is NULL */ - } - while ((a = anext), *pieces != NULL && !finished); -} - - -struct find_inside_m_pa_info { - jmp_buf jb; - POLYAREA *want_inside; - PLINE *result; -}; - -static r_dir_t find_inside_m_pa(const BoxType * b, void *cl) -{ - struct find_inside_m_pa_info *info = (struct find_inside_m_pa_info *) cl; - PLINE *check = (PLINE *) b; - /* Don't report for the main contour */ - if (check->Flags.orient == PLF_DIR) - return R_DIR_NOT_FOUND; - /* Don't look at contours marked as being intersected */ - if (check->Flags.status == ISECTED) - return R_DIR_NOT_FOUND; - if (cntr_in_M_POLYAREA(check, info->want_inside, FALSE)) { - info->result = check; - longjmp(info->jb, 1); - } - return R_DIR_NOT_FOUND; -} - - -static void M_POLYAREA_update_primary(jmp_buf * e, POLYAREA ** pieces, PLINE ** holes, int action, POLYAREA * bpa) -{ - POLYAREA *a = *pieces; - POLYAREA *b; - POLYAREA *anext; - PLINE *curc, *next, *prev; - BoxType box; - /* int inv_inside = 0; */ - int del_inside = 0; - int del_outside = 0; - int finished; - - if (a == NULL) - return; - - switch (action) { - case PBO_ISECT: - del_outside = 1; - break; - case PBO_UNITE: - case PBO_SUB: - del_inside = 1; - break; - case PBO_XOR: /* NOT IMPLEMENTED OR USED */ - /* inv_inside = 1; */ - assert(0); - break; - } - - box = *((BoxType *) bpa->contours); - b = bpa; - while ((b = b->f) != bpa) { - BoxType *b_box = (BoxType *) b->contours; - MAKEMIN(box.X1, b_box->X1); - MAKEMIN(box.Y1, b_box->Y1); - MAKEMAX(box.X2, b_box->X2); - MAKEMAX(box.Y2, b_box->Y2); - } - - if (del_inside) { - - do { - anext = a->f; - finished = (anext == *pieces); - - /* Test the outer contour first, as we may need to remove all children */ - - /* We've not yet split intersected contours out, just ignore them */ - if (a->contours->Flags.status != ISECTED && - /* Pre-filter on bounding box */ - ((a->contours->xmin >= box.X1) && (a->contours->ymin >= box.Y1) - && (a->contours->xmax <= box.X2) - && (a->contours->ymax <= box.Y2)) && - /* Then test properly */ - cntr_in_M_POLYAREA(a->contours, bpa, FALSE)) { - - /* Delete this contour, all children -> holes queue */ - - /* Delete the outer contour */ - curc = a->contours; - remove_contour(a, NULL, curc, FALSE); /* Rtree deleted in poly_Free below */ - /* a->contours now points to the remaining holes */ - poly_DelContour(&curc); - - if (a->contours != NULL) { - /* Find the end of the list of holes */ - curc = a->contours; - while (curc->next != NULL) - curc = curc->next; - - /* Take the holes and prepend to the holes queue */ - curc->next = *holes; - *holes = a->contours; - a->contours = NULL; - } - - remove_polyarea(pieces, a); - poly_Free(&a); /* NB: Sets a to NULL */ - - continue; - } - - /* Loop whilst we find INSIDE contours to delete */ - while (1) { - struct find_inside_m_pa_info info; - PLINE *prev; - - info.want_inside = bpa; - - /* Set jump return */ - if (setjmp(info.jb)) { - /* Returned here! */ - } - else { - info.result = NULL; - /* r-tree search, calling back a routine to longjmp back with - * data about any hole inside the B polygon. - * NB: Does not jump back to report the main contour! - */ - r_search(a->contour_tree, &box, NULL, find_inside_m_pa, &info, NULL); - - /* Nothing found? */ - break; - } - - /* We need to find the contour before it, so we can update its next pointer */ - prev = a->contours; - while (prev->next != info.result) { - prev = prev->next; - } - - /* Remove hole from the contour */ - remove_contour(a, prev, info.result, TRUE); - poly_DelContour(&info.result); - } - /* End check for deleted holes */ - - /* If we deleted all the pieces of the polyarea, *pieces is NULL */ - } - while ((a = anext), *pieces != NULL && !finished); - - return; - } - else { - /* This path isn't optimised for speed */ - } - - do { - int hole_contour = 0; - int is_outline = 1; - - anext = a->f; - finished = (anext == *pieces); - - prev = NULL; - for (curc = a->contours; curc != NULL; curc = next, is_outline = 0) { - int is_first = contour_is_first(a, curc); - int is_last = contour_is_last(curc); - int del_contour = 0; - - next = curc->next; - - if (del_outside) - del_contour = curc->Flags.status != ISECTED && !cntr_in_M_POLYAREA(curc, bpa, FALSE); - - /* Skip intersected contours */ - if (curc->Flags.status == ISECTED) { - prev = curc; - continue; - } - - /* Reset the intersection flags, since we keep these pieces */ - curc->Flags.status = UNKNWN; - - if (del_contour || hole_contour) { - - remove_contour(a, prev, curc, !(is_first && is_last)); - - if (del_contour) { - /* Delete the contour */ - poly_DelContour(&curc); /* NB: Sets curc to NULL */ - } - else if (hole_contour) { - /* Link into the list of holes */ - curc->next = *holes; - *holes = curc; - } - else { - assert(0); - } - - if (is_first && is_last) { - remove_polyarea(pieces, a); - poly_Free(&a); /* NB: Sets a to NULL */ - } - - } - else { - /* Note the item we just didn't delete as the next - candidate for having its "next" pointer adjusted. - Saves walking the contour list when we delete one. */ - prev = curc; - } - - /* If we move or delete an outer contour, we need to move any holes - we wish to keep within that contour to the holes list. */ - if (is_outline && del_contour) - hole_contour = 1; - - } - - /* If we deleted all the pieces of the polyarea, *pieces is NULL */ - } - while ((a = anext), *pieces != NULL && !finished); -} - -static void -M_POLYAREA_Collect_separated(jmp_buf * e, PLINE * afst, POLYAREA ** contours, PLINE ** holes, int action, BOOLp maybe) -{ - PLINE **cur, **next; - - for (cur = &afst; *cur != NULL; cur = next) { - next = &((*cur)->next); - /* if we disappear a contour, don't advance twice */ - if (cntr_Collect(e, cur, contours, holes, action, NULL, NULL, NULL)) - next = cur; - } -} - -static void M_POLYAREA_Collect(jmp_buf * e, POLYAREA * afst, POLYAREA ** contours, PLINE ** holes, int action, BOOLp maybe) -{ - POLYAREA *a = afst; - POLYAREA *parent = NULL; /* Quiet compiler warning */ - PLINE **cur, **next, *parent_contour; - - assert(a != NULL); - while ((a = a->f) != afst); - /* now the non-intersect parts are collected in temp/holes */ - do { - if (maybe && a->contours->Flags.status != ISECTED) - parent_contour = a->contours; - else - parent_contour = NULL; - - /* Take care of the first contour - so we know if we - * can shortcut reparenting some of its children - */ - cur = &a->contours; - if (*cur != NULL) { - next = &((*cur)->next); - /* if we disappear a contour, don't advance twice */ - if (cntr_Collect(e, cur, contours, holes, action, a, NULL, NULL)) { - parent = (*contours)->b; /* InsCntr inserts behind the head */ - next = cur; - } - else - parent = a; - cur = next; - } - for (; *cur != NULL; cur = next) { - next = &((*cur)->next); - /* if we disappear a contour, don't advance twice */ - if (cntr_Collect(e, cur, contours, holes, action, a, parent, parent_contour)) - next = cur; - } - } - while ((a = a->f) != afst); -} - -/* determine if two polygons touch or overlap */ -BOOLp Touching(POLYAREA * a, POLYAREA * b) -{ - jmp_buf e; - int code; - - if ((code = setjmp(e)) == 0) { -#ifdef DEBUG - if (!poly_Valid(a)) - return -1; - if (!poly_Valid(b)) - return -1; -#endif - M_POLYAREA_intersect(&e, a, b, pcb_false); - - if (M_POLYAREA_label(a, b, TRUE)) - return TRUE; - if (M_POLYAREA_label(b, a, TRUE)) - return TRUE; - } - else if (code == TOUCHES) - return TRUE; - return FALSE; -} - -/* the main clipping routines */ -int poly_Boolean(const POLYAREA * a_org, const POLYAREA * b_org, POLYAREA ** res, int action) -{ - POLYAREA *a = NULL, *b = NULL; - - if (!poly_M_Copy0(&a, a_org) || !poly_M_Copy0(&b, b_org)) - return err_no_memory; - - return poly_Boolean_free(a, b, res, action); -} /* poly_Boolean */ - -/* just like poly_Boolean but frees the input polys */ -int poly_Boolean_free(POLYAREA * ai, POLYAREA * bi, POLYAREA ** res, int action) -{ - POLYAREA *a = ai, *b = bi; - PLINE *a_isected = NULL; - PLINE *p, *holes = NULL; - jmp_buf e; - int code; - - *res = NULL; - - if (!a) { - switch (action) { - case PBO_XOR: - case PBO_UNITE: - *res = bi; - return err_ok; - case PBO_SUB: - case PBO_ISECT: - if (b != NULL) - poly_Free(&b); - return err_ok; - } - } - if (!b) { - switch (action) { - case PBO_SUB: - case PBO_XOR: - case PBO_UNITE: - *res = ai; - return err_ok; - case PBO_ISECT: - if (a != NULL) - poly_Free(&a); - return err_ok; - } - } - - if ((code = setjmp(e)) == 0) { -#ifdef DEBUG - assert(poly_Valid(a)); - assert(poly_Valid(b)); -#endif - - /* intersect needs to make a list of the contours in a and b which are intersected */ - M_POLYAREA_intersect(&e, a, b, TRUE); - - /* We could speed things up a lot here if we only processed the relevant contours */ - /* NB: Relevant parts of a are labeled below */ - M_POLYAREA_label(b, a, FALSE); - - *res = a; - M_POLYAREA_update_primary(&e, res, &holes, action, b); - M_POLYAREA_separate_isected(&e, res, &holes, &a_isected); - M_POLYAREA_label_separated(a_isected, b, FALSE); - M_POLYAREA_Collect_separated(&e, a_isected, res, &holes, action, FALSE); - M_B_AREA_Collect(&e, b, res, &holes, action); - poly_Free(&b); - - /* free a_isected */ - while ((p = a_isected) != NULL) { - a_isected = p->next; - poly_DelContour(&p); - } - - InsertHoles(&e, *res, &holes); - } - /* delete holes if any left */ - while ((p = holes) != NULL) { - holes = p->next; - poly_DelContour(&p); - } - - if (code) { - poly_Free(res); - return code; - } - assert(!*res || poly_Valid(*res)); - return code; -} /* poly_Boolean_free */ - -static void clear_marks(POLYAREA * p) -{ - POLYAREA *n = p; - PLINE *c; - VNODE *v; - - do { - for (c = n->contours; c; c = c->next) { - v = &c->head; - do { - v->Flags.mark = 0; - } - while ((v = v->next) != &c->head); - } - } - while ((n = n->f) != p); -} - -/* compute the intersection and subtraction (divides "a" into two pieces) - * and frees the input polys. This assumes that bi is a single simple polygon. - */ -int poly_AndSubtract_free(POLYAREA * ai, POLYAREA * bi, POLYAREA ** aandb, POLYAREA ** aminusb) -{ - POLYAREA *a = ai, *b = bi; - PLINE *p, *holes = NULL; - jmp_buf e; - int code; - - *aandb = NULL; - *aminusb = NULL; - - if ((code = setjmp(e)) == 0) { - -#ifdef DEBUG - if (!poly_Valid(a)) - return -1; - if (!poly_Valid(b)) - return -1; -#endif - M_POLYAREA_intersect(&e, a, b, TRUE); - - M_POLYAREA_label(a, b, FALSE); - M_POLYAREA_label(b, a, FALSE); - - M_POLYAREA_Collect(&e, a, aandb, &holes, PBO_ISECT, FALSE); - InsertHoles(&e, *aandb, &holes); - assert(poly_Valid(*aandb)); - /* delete holes if any left */ - while ((p = holes) != NULL) { - holes = p->next; - poly_DelContour(&p); - } - holes = NULL; - clear_marks(a); - clear_marks(b); - M_POLYAREA_Collect(&e, a, aminusb, &holes, PBO_SUB, FALSE); - InsertHoles(&e, *aminusb, &holes); - poly_Free(&a); - poly_Free(&b); - assert(poly_Valid(*aminusb)); - } - /* delete holes if any left */ - while ((p = holes) != NULL) { - holes = p->next; - poly_DelContour(&p); - } - - - if (code) { - poly_Free(aandb); - poly_Free(aminusb); - return code; - } - assert(!*aandb || poly_Valid(*aandb)); - assert(!*aminusb || poly_Valid(*aminusb)); - return code; -} /* poly_AndSubtract_free */ - -static inline int cntrbox_pointin(PLINE * c, Vector p) -{ - return (p[0] >= c->xmin && p[1] >= c->ymin && p[0] <= c->xmax && p[1] <= c->ymax); - -} - -static inline int node_neighbours(VNODE * a, VNODE * b) -{ - return (a == b) || (a->next == b) || (b->next == a) || (a->next == b->next); -} - -VNODE *poly_CreateNode(Vector v) -{ - VNODE *res; - Coord *c; - - assert(v); - res = (VNODE *) calloc(1, sizeof(VNODE)); - if (res == NULL) - return NULL; - /* bzero (res, sizeof (VNODE) - sizeof(Vector)); */ - c = res->point; - *c++ = *v++; - *c = *v; - return res; -} - -void poly_IniContour(PLINE * c) -{ - if (c == NULL) - return; - /* bzero (c, sizeof(PLINE)); */ - c->head.next = c->head.prev = &c->head; - c->xmin = c->ymin = 0x7fffffff; - c->xmax = c->ymax = 0x80000000; - c->is_round = FALSE; - c->cx = 0; - c->cy = 0; - c->radius = 0; -} - -PLINE *poly_NewContour(Vector v) -{ - PLINE *res; - - res = (PLINE *) calloc(1, sizeof(PLINE)); - if (res == NULL) - return NULL; - - poly_IniContour(res); - - if (v != NULL) { - Vcopy(res->head.point, v); - cntrbox_adjust(res, v); - } - - return res; -} - -void poly_ClrContour(PLINE * c) -{ - VNODE *cur; - - assert(c != NULL); - while ((cur = c->head.next) != &c->head) { - poly_ExclVertex(cur); - free(cur); - } - poly_IniContour(c); -} - -void poly_DelContour(PLINE ** c) -{ - VNODE *cur, *prev; - - if (*c == NULL) - return; - for (cur = (*c)->head.prev; cur != &(*c)->head; cur = prev) { - prev = cur->prev; - if (cur->cvc_next != NULL) { - free(cur->cvc_next); - free(cur->cvc_prev); - } - free(cur); - } - if ((*c)->head.cvc_next != NULL) { - free((*c)->head.cvc_next); - free((*c)->head.cvc_prev); - } - /* FIXME -- strict aliasing violation. */ - if ((*c)->tree) { - rtree_t *r = (*c)->tree; - r_destroy_tree(&r); - } - free(*c), *c = NULL; -} - -void poly_PreContour(PLINE * C, BOOLp optimize) -{ - double area = 0; - VNODE *p, *c; - Vector p1, p2; - - assert(C != NULL); - - if (optimize) { - for (c = (p = &C->head)->next; c != &C->head; c = (p = c)->next) { - /* if the previous node is on the same line with this one, we should remove it */ - Vsub2(p1, c->point, p->point); - Vsub2(p2, c->next->point, c->point); - /* If the product below is zero then - * the points on either side of c - * are on the same line! - * So, remove the point c - */ - - if (vect_det2(p1, p2) == 0) { - poly_ExclVertex(c); - free(c); - c = p; - } - } - } - C->Count = 0; - C->xmin = C->xmax = C->head.point[0]; - C->ymin = C->ymax = C->head.point[1]; - - p = (c = &C->head)->prev; - if (c != p) { - do { - /* calculate area for orientation */ - area += (double) (p->point[0] - c->point[0]) * (p->point[1] + c->point[1]); - cntrbox_adjust(C, c->point); - C->Count++; - } - while ((c = (p = c)->next) != &C->head); - } - C->area = PCB_ABS(area); - if (C->Count > 2) - C->Flags.orient = ((area < 0) ? PLF_INV : PLF_DIR); - C->tree = (rtree_t *) make_edge_tree(C); -} /* poly_PreContour */ - -static r_dir_t flip_cb(const BoxType * b, void *cl) -{ - struct seg *s = (struct seg *) b; - s->v = s->v->prev; - return R_DIR_FOUND_CONTINUE; -} - -void poly_InvContour(PLINE * c) -{ - VNODE *cur, *next; - int r; - - assert(c != NULL); - cur = &c->head; - do { - next = cur->next; - cur->next = cur->prev; - cur->prev = next; - /* fix the segment tree */ - } - while ((cur = next) != &c->head); - c->Flags.orient ^= 1; - if (c->tree) { - r_search(c->tree, NULL, NULL, flip_cb, NULL, &r); - assert(r == c->Count); - } -} - -void poly_ExclVertex(VNODE * node) -{ - assert(node != NULL); - if (node->cvc_next) { - free(node->cvc_next); - free(node->cvc_prev); - } - node->prev->next = node->next; - node->next->prev = node->prev; -} - -void poly_InclVertex(VNODE * after, VNODE * node) -{ - double a, b; - assert(after != NULL); - assert(node != NULL); - - node->prev = after; - node->next = after->next; - after->next = after->next->prev = node; - /* remove points on same line */ - if (node->prev->prev == node) - return; /* we don't have 3 points in the poly yet */ - a = (node->point[1] - node->prev->prev->point[1]); - a *= (node->prev->point[0] - node->prev->prev->point[0]); - b = (node->point[0] - node->prev->prev->point[0]); - b *= (node->prev->point[1] - node->prev->prev->point[1]); - if (fabs(a - b) < EPSILON) { - VNODE *t = node->prev; - t->prev->next = node; - node->prev = t->prev; - free(t); - } -} - -BOOLp poly_CopyContour(PLINE ** dst, PLINE * src) -{ - VNODE *cur, *newnode; - - assert(src != NULL); - *dst = NULL; - *dst = poly_NewContour(src->head.point); - if (*dst == NULL) - return FALSE; - - (*dst)->Count = src->Count; - (*dst)->Flags.orient = src->Flags.orient; - (*dst)->xmin = src->xmin, (*dst)->xmax = src->xmax; - (*dst)->ymin = src->ymin, (*dst)->ymax = src->ymax; - (*dst)->area = src->area; - - for (cur = src->head.next; cur != &src->head; cur = cur->next) { - if ((newnode = poly_CreateNode(cur->point)) == NULL) - return FALSE; - /* newnode->Flags = cur->Flags; */ - poly_InclVertex((*dst)->head.prev, newnode); - } - (*dst)->tree = (rtree_t *) make_edge_tree(*dst); - return TRUE; -} - -/**********************************************************************/ -/* polygon routines */ - -BOOLp poly_Copy0(POLYAREA ** dst, const POLYAREA * src) -{ - *dst = NULL; - if (src != NULL) - *dst = (POLYAREA *) calloc(1, sizeof(POLYAREA)); - if (*dst == NULL) - return FALSE; - (*dst)->contour_tree = r_create_tree(NULL, 0, 0); - - return poly_Copy1(*dst, src); -} - -BOOLp poly_Copy1(POLYAREA * dst, const POLYAREA * src) -{ - PLINE *cur, **last = &dst->contours; - - *last = NULL; - dst->f = dst->b = dst; - - for (cur = src->contours; cur != NULL; cur = cur->next) { - if (!poly_CopyContour(last, cur)) - return FALSE; - r_insert_entry(dst->contour_tree, (BoxTypePtr) * last, 0); - last = &(*last)->next; - } - return TRUE; -} - -void poly_M_Incl(POLYAREA ** list, POLYAREA * a) -{ - if (*list == NULL) - a->f = a->b = a, *list = a; - else { - a->f = *list; - a->b = (*list)->b; - (*list)->b = (*list)->b->f = a; - } -} - -BOOLp poly_M_Copy0(POLYAREA ** dst, const POLYAREA * srcfst) -{ - const POLYAREA *src = srcfst; - POLYAREA *di; - - *dst = NULL; - if (src == NULL) - return FALSE; - do { - if ((di = poly_Create()) == NULL || !poly_Copy1(di, src)) - return FALSE; - poly_M_Incl(dst, di); - } - while ((src = src->f) != srcfst); - return TRUE; -} - -BOOLp poly_InclContour(POLYAREA * p, PLINE * c) -{ - PLINE *tmp; - - if ((c == NULL) || (p == NULL)) - return FALSE; - if (c->Flags.orient == PLF_DIR) { - if (p->contours != NULL) - return FALSE; - p->contours = c; - } - else { - if (p->contours == NULL) - return FALSE; - /* link at front of hole list */ - tmp = p->contours->next; - p->contours->next = c; - c->next = tmp; - } - r_insert_entry(p->contour_tree, (BoxTypePtr) c, 0); - return TRUE; -} - -typedef struct pip { - int f; - Vector p; - jmp_buf env; -} pip; - - -static r_dir_t crossing(const BoxType * b, void *cl) -{ - struct seg *s = (struct seg *) b; - struct pip *p = (struct pip *) cl; - - if (s->v->point[1] <= p->p[1]) { - if (s->v->next->point[1] > p->p[1]) { - Vector v1, v2; - pcb_long64_t cross; - Vsub2(v1, s->v->next->point, s->v->point); - Vsub2(v2, p->p, s->v->point); - cross = (pcb_long64_t) v1[0] * v2[1] - (pcb_long64_t) v2[0] * v1[1]; - if (cross == 0) { - p->f = 1; - longjmp(p->env, 1); - } - if (cross > 0) - p->f += 1; - } - } - else { - if (s->v->next->point[1] <= p->p[1]) { - Vector v1, v2; - pcb_long64_t cross; - Vsub2(v1, s->v->next->point, s->v->point); - Vsub2(v2, p->p, s->v->point); - cross = (pcb_long64_t) v1[0] * v2[1] - (pcb_long64_t) v2[0] * v1[1]; - if (cross == 0) { - p->f = 1; - longjmp(p->env, 1); - } - if (cross < 0) - p->f -= 1; - } - } - return R_DIR_FOUND_CONTINUE; -} - -int poly_InsideContour(PLINE * c, Vector p) -{ - struct pip info; - BoxType ray; - - if (!cntrbox_pointin(c, p)) - return FALSE; - info.f = 0; - info.p[0] = ray.X1 = p[0]; - info.p[1] = ray.Y1 = p[1]; - ray.X2 = 0x7fffffff; - ray.Y2 = p[1] + 1; - if (setjmp(info.env) == 0) - r_search(c->tree, &ray, NULL, crossing, &info, NULL); - return info.f; -} - -BOOLp poly_CheckInside(POLYAREA * p, Vector v0) -{ - PLINE *cur; - - if ((p == NULL) || (v0 == NULL) || (p->contours == NULL)) - return FALSE; - cur = p->contours; - if (poly_InsideContour(cur, v0)) { - for (cur = cur->next; cur != NULL; cur = cur->next) - if (poly_InsideContour(cur, v0)) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOLp poly_M_CheckInside(POLYAREA * p, Vector v0) -{ - POLYAREA *cur; - - if ((p == NULL) || (v0 == NULL)) - return FALSE; - cur = p; - do { - if (poly_CheckInside(cur, v0)) - return TRUE; - } - while ((cur = cur->f) != p); - return FALSE; -} - -static double dot(Vector A, Vector B) -{ - return (double) A[0] * (double) B[0] + (double) A[1] * (double) B[1]; -} - -/* Compute whether point is inside a triangle formed by 3 other pints */ -/* Algorithm from http://www.blackpawn.com/texts/pointinpoly/default.html */ -static int point_in_triangle(Vector A, Vector B, Vector C, Vector P) -{ - Vector v0, v1, v2; - double dot00, dot01, dot02, dot11, dot12; - double invDenom; - double u, v; - - /* Compute vectors */ - v0[0] = C[0] - A[0]; - v0[1] = C[1] - A[1]; - v1[0] = B[0] - A[0]; - v1[1] = B[1] - A[1]; - v2[0] = P[0] - A[0]; - v2[1] = P[1] - A[1]; - - /* Compute dot products */ - dot00 = dot(v0, v0); - dot01 = dot(v0, v1); - dot02 = dot(v0, v2); - dot11 = dot(v1, v1); - dot12 = dot(v1, v2); - - /* Compute barycentric coordinates */ - invDenom = 1. / (dot00 * dot11 - dot01 * dot01); - u = (dot11 * dot02 - dot01 * dot12) * invDenom; - v = (dot00 * dot12 - dot01 * dot02) * invDenom; - - /* Check if point is in triangle */ - return (u > 0.0) && (v > 0.0) && (u + v < 1.0); -} - - -/* Returns the dot product of Vector A->B, and a vector - * orthogonal to Vector C->D. The result is not normalised, so will be - * weighted by the magnitude of the C->D vector. - */ -static double dot_orthogonal_to_direction(Vector A, Vector B, Vector C, Vector D) -{ - Vector l1, l2, l3; - l1[0] = B[0] - A[0]; - l1[1] = B[1] - A[1]; - l2[0] = D[0] - C[0]; - l2[1] = D[1] - C[1]; - - l3[0] = -l2[1]; - l3[1] = l2[0]; - - return dot(l1, l3); -} - -/* Algorithm from http://www.exaflop.org/docs/cgafaq/cga2.html - * - * "Given a simple polygon, find some point inside it. Here is a method based - * on the proof that there exists an internal diagonal, in [O'Rourke, 13-14]. - * The idea is that the midpoint of a diagonal is interior to the polygon. - * - * 1. Identify a convex vertex v; let its adjacent vertices be a and b. - * 2. For each other vertex q do: - * 2a. If q is inside avb, compute distance to v (orthogonal to ab). - * 2b. Save point q if distance is a new min. - * 3. If no point is inside, return midpoint of ab, or centroid of avb. - * 4. Else if some point inside, qv is internal: return its midpoint." - * - * [O'Rourke]: Computational Geometry in C (2nd Ed.) - * Joseph O'Rourke, Cambridge University Press 1998, - * ISBN 0-521-64010-5 Pbk, ISBN 0-521-64976-5 Hbk - */ -static void poly_ComputeInteriorPoint(PLINE * poly, Vector v) -{ - VNODE *pt1, *pt2, *pt3, *q; - VNODE *min_q = NULL; - double dist; - double min_dist = 0.0; - double dir = (poly->Flags.orient == PLF_DIR) ? 1. : -1; - - /* Find a convex node on the polygon */ - pt1 = &poly->head; - do { - double dot_product; - - pt2 = pt1->next; - pt3 = pt2->next; - - dot_product = dot_orthogonal_to_direction(pt1->point, pt2->point, pt3->point, pt2->point); - - if (dot_product * dir > 0.) - break; - } - while ((pt1 = pt1->next) != &poly->head); - - /* Loop over remaining vertices */ - q = pt3; - do { - /* Is current vertex "q" outside pt1 pt2 pt3 triangle? */ - if (!point_in_triangle(pt1->point, pt2->point, pt3->point, q->point)) - continue; - - /* NO: compute distance to pt2 (v) orthogonal to pt1 - pt3) */ - /* Record minimum */ - dist = dot_orthogonal_to_direction(q->point, pt2->point, pt1->point, pt3->point); - if (min_q == NULL || dist < min_dist) { - min_dist = dist; - min_q = q; - } - } - while ((q = q->next) != pt2); - - /* Were any "q" found inside pt1 pt2 pt3? */ - if (min_q == NULL) { - /* NOT FOUND: Return midpoint of pt1 pt3 */ - v[0] = (pt1->point[0] + pt3->point[0]) / 2; - v[1] = (pt1->point[1] + pt3->point[1]) / 2; - } - else { - /* FOUND: Return mid point of min_q, pt2 */ - v[0] = (pt2->point[0] + min_q->point[0]) / 2; - v[1] = (pt2->point[1] + min_q->point[1]) / 2; - } -} - - -/* NB: This function assumes the caller _knows_ the contours do not - * intersect. If the contours intersect, the result is undefined. - * It will return the correct result if the two contours share - * common points between their contours. (Identical contours - * are treated as being inside each other). - */ -int poly_ContourInContour(PLINE * poly, PLINE * inner) -{ - Vector point; - assert(poly != NULL); - assert(inner != NULL); - if (cntrbox_inside(inner, poly)) { - /* We need to prove the "inner" contour is not outside - * "poly" contour. If it is outside, we can return. - */ - if (!poly_InsideContour(poly, inner->head.point)) - return 0; - - poly_ComputeInteriorPoint(inner, point); - return poly_InsideContour(poly, point); - } - return 0; -} - -void poly_Init(POLYAREA * p) -{ - p->f = p->b = p; - p->contours = NULL; - p->contour_tree = r_create_tree(NULL, 0, 0); -} - -POLYAREA *poly_Create(void) -{ - POLYAREA *res; - - if ((res = (POLYAREA *) malloc(sizeof(POLYAREA))) != NULL) - poly_Init(res); - return res; -} - -void poly_FreeContours(PLINE ** pline) -{ - PLINE *pl; - - while ((pl = *pline) != NULL) { - *pline = pl->next; - poly_DelContour(&pl); - } -} - -void poly_Free(POLYAREA ** p) -{ - POLYAREA *cur; - - if (*p == NULL) - return; - for (cur = (*p)->f; cur != *p; cur = (*p)->f) { - poly_FreeContours(&cur->contours); - r_destroy_tree(&cur->contour_tree); - cur->f->b = cur->b; - cur->b->f = cur->f; - free(cur); - } - poly_FreeContours(&cur->contours); - r_destroy_tree(&cur->contour_tree); - free(*p), *p = NULL; -} - -static BOOLp inside_sector(VNODE * pn, Vector p2) -{ - Vector cdir, ndir, pdir; - int p_c, n_c, p_n; - - assert(pn != NULL); - vect_sub(cdir, p2, pn->point); - vect_sub(pdir, pn->point, pn->prev->point); - vect_sub(ndir, pn->next->point, pn->point); - - p_c = vect_det2(pdir, cdir) >= 0; - n_c = vect_det2(ndir, cdir) >= 0; - p_n = vect_det2(pdir, ndir) >= 0; - - if ((p_n && p_c && n_c) || ((!p_n) && (p_c || n_c))) - return TRUE; - else - return FALSE; -} /* inside_sector */ - -/* returns TRUE if bad contour */ -BOOLp poly_ChkContour(PLINE * a) -{ - VNODE *a1, *a2, *hit1, *hit2; - Vector i1, i2; - int icnt; - - assert(a != NULL); - a1 = &a->head; - do { - a2 = a1; - do { - if (!node_neighbours(a1, a2) && (icnt = vect_inters2(a1->point, a1->next->point, a2->point, a2->next->point, i1, i2)) > 0) { - if (icnt > 1) - return TRUE; - - if (vect_dist2(i1, a1->point) < EPSILON) - hit1 = a1; - else if (vect_dist2(i1, a1->next->point) < EPSILON) - hit1 = a1->next; - else - hit1 = NULL; - - if (vect_dist2(i1, a2->point) < EPSILON) - hit2 = a2; - else if (vect_dist2(i1, a2->next->point) < EPSILON) - hit2 = a2->next; - else - hit2 = NULL; - - if ((hit1 == NULL) && (hit2 == NULL)) { - /* If the intersection didn't land on an end-point of either - * line, we know the lines cross and we return TRUE. - */ - return TRUE; - } - else if (hit1 == NULL) { - /* An end-point of the second line touched somewhere along the - length of the first line. Check where the second line leads. */ - if (inside_sector(hit2, a1->point) != inside_sector(hit2, a1->next->point)) - return TRUE; - } - else if (hit2 == NULL) { - /* An end-point of the first line touched somewhere along the - length of the second line. Check where the first line leads. */ - if (inside_sector(hit1, a2->point) != inside_sector(hit1, a2->next->point)) - return TRUE; - } - else { - /* Both lines intersect at an end-point. Check where they lead. */ - if (inside_sector(hit1, hit2->prev->point) != inside_sector(hit1, hit2->next->point)) - return TRUE; - } - } - } - while ((a2 = a2->next) != &a->head); - } - while ((a1 = a1->next) != &a->head); - return FALSE; -} - -void poly_bbox(POLYAREA * p, BoxType * b) -{ - PLINE *n; - /*int cnt;*/ - - n = p->contours; - b->X1 = b->X2 = n->xmin; - b->Y1 = b->Y2 = n->ymin; - - for (/*cnt = 0*/; /*cnt < 2 */ n != NULL; n = n->next) { - if (n->xmin < b->X1) - b->X1 = n->xmin; - if (n->ymin < b->Y1) - b->Y1 = n->ymin; - if (n->xmax > b->X2) - b->X2 = n->xmax; - if (n->ymax > b->Y2) - b->Y2 = n->ymax; -/* if (n == p->contours) - cnt++;*/ - } -} - - -BOOLp poly_Valid(POLYAREA * p) -{ - PLINE *c; - - if ((p == NULL) || (p->contours == NULL)) - return FALSE; - - if (p->contours->Flags.orient == PLF_INV || poly_ChkContour(p->contours)) { -#ifndef NDEBUG - VNODE *v, *n; - DEBUGP("Invalid Outer PLINE\n"); - if (p->contours->Flags.orient == PLF_INV) - DEBUGP("failed orient\n"); - if (poly_ChkContour(p->contours)) - DEBUGP("failed self-intersection\n"); - v = &p->contours->head; - do { - n = v->next; - pcb_fprintf(stderr, "Line [%#mS %#mS %#mS %#mS 100 100 \"\"]\n", v->point[0], v->point[1], n->point[0], n->point[1]); - } - while ((v = v->next) != &p->contours->head); -#endif - return FALSE; - } - for (c = p->contours->next; c != NULL; c = c->next) { - if (c->Flags.orient == PLF_DIR || poly_ChkContour(c) || !poly_ContourInContour(p->contours, c)) { -#ifndef NDEBUG - VNODE *v, *n; - DEBUGP("Invalid Inner PLINE orient = %d\n", c->Flags.orient); - if (c->Flags.orient == PLF_DIR) - DEBUGP("failed orient\n"); - if (poly_ChkContour(c)) - DEBUGP("failed self-intersection\n"); - if (!poly_ContourInContour(p->contours, c)) - DEBUGP("failed containment\n"); - v = &c->head; - do { - n = v->next; - pcb_fprintf(stderr, "Line [%#mS %#mS %#mS %#mS 100 100 \"\"]\n", v->point[0], v->point[1], n->point[0], n->point[1]); - } - while ((v = v->next) != &c->head); -#endif - return FALSE; - } - } - return TRUE; -} - - -Vector vect_zero = { (long) 0, (long) 0 }; - -/*********************************************************************/ -/* L o n g V e c t o r S t u f f */ -/*********************************************************************/ - -void vect_init(Vector v, double x, double y) -{ - v[0] = (long) x; - v[1] = (long) y; -} /* vect_init */ - -#define Vzero(a) ((a)[0] == 0. && (a)[1] == 0.) - -#define Vsub(a,b,c) {(a)[0]=(b)[0]-(c)[0];(a)[1]=(b)[1]-(c)[1];} - -int vect_equal(Vector v1, Vector v2) -{ - return (v1[0] == v2[0] && v1[1] == v2[1]); -} /* vect_equal */ - - -void vect_sub(Vector res, Vector v1, Vector v2) -{ -Vsub(res, v1, v2)} /* vect_sub */ - -void vect_min(Vector v1, Vector v2, Vector v3) -{ - v1[0] = (v2[0] < v3[0]) ? v2[0] : v3[0]; - v1[1] = (v2[1] < v3[1]) ? v2[1] : v3[1]; -} /* vect_min */ - -void vect_max(Vector v1, Vector v2, Vector v3) -{ - v1[0] = (v2[0] > v3[0]) ? v2[0] : v3[0]; - v1[1] = (v2[1] > v3[1]) ? v2[1] : v3[1]; -} /* vect_max */ - -double vect_len2(Vector v) -{ - return ((double) v[0] * v[0] + (double) v[1] * v[1]); /* why sqrt? only used for compares */ -} - -double vect_dist2(Vector v1, Vector v2) -{ - double dx = v1[0] - v2[0]; - double dy = v1[1] - v2[1]; - - return (dx * dx + dy * dy); /* why sqrt */ -} - -/* value has sign of angle between vectors */ -double vect_det2(Vector v1, Vector v2) -{ - return (((double) v1[0] * v2[1]) - ((double) v2[0] * v1[1])); -} - -static double vect_m_dist(Vector v1, Vector v2) -{ - double dx = v1[0] - v2[0]; - double dy = v1[1] - v2[1]; - double dd = (dx * dx + dy * dy); /* sqrt */ - - if (dx > 0) - return +dd; - if (dx < 0) - return -dd; - if (dy > 0) - return +dd; - return -dd; -} /* vect_m_dist */ - -/* -vect_inters2 - (C) 1993 Klamer Schutte - (C) 1997 Michael Leonov, Alexey Nikitin -*/ - -int vect_inters2(Vector p1, Vector p2, Vector q1, Vector q2, Vector S1, Vector S2) -{ - double s, t, deel; - double rpx, rpy, rqx, rqy; - - if (max(p1[0], p2[0]) < min(q1[0], q2[0]) || - max(q1[0], q2[0]) < min(p1[0], p2[0]) || max(p1[1], p2[1]) < min(q1[1], q2[1]) || max(q1[1], q2[1]) < min(p1[1], p2[1])) - return 0; - - rpx = p2[0] - p1[0]; - rpy = p2[1] - p1[1]; - rqx = q2[0] - q1[0]; - rqy = q2[1] - q1[1]; - - deel = rpy * rqx - rpx * rqy; /* -vect_det(rp,rq); */ - - /* coordinates are 30-bit integers so deel will be exactly zero - * if the lines are parallel - */ - - if (deel == 0) { /* parallel */ - double dc1, dc2, d1, d2, h; /* Check to see whether p1-p2 and q1-q2 are on the same line */ - Vector hp1, hq1, hp2, hq2, q1p1, q1q2; - - Vsub2(q1p1, q1, p1); - Vsub2(q1q2, q1, q2); - - - /* If this product is not zero then p1-p2 and q1-q2 are not on same line! */ - if (vect_det2(q1p1, q1q2) != 0) - return 0; - dc1 = 0; /* m_len(p1 - p1) */ - - dc2 = vect_m_dist(p1, p2); - d1 = vect_m_dist(p1, q1); - d2 = vect_m_dist(p1, q2); - -/* Sorting the independent points from small to large */ - Vcpy2(hp1, p1); - Vcpy2(hp2, p2); - Vcpy2(hq1, q1); - Vcpy2(hq2, q2); - if (dc1 > dc2) { /* hv and h are used as help-variable. */ - Vswp2(hp1, hp2); - h = dc1, dc1 = dc2, dc2 = h; - } - if (d1 > d2) { - Vswp2(hq1, hq2); - h = d1, d1 = d2, d2 = h; - } - -/* Now the line-pieces are compared */ - - if (dc1 < d1) { - if (dc2 < d1) - return 0; - if (dc2 < d2) { - Vcpy2(S1, hp2); - Vcpy2(S2, hq1); - } - else { - Vcpy2(S1, hq1); - Vcpy2(S2, hq2); - }; - } - else { - if (dc1 > d2) - return 0; - if (dc2 < d2) { - Vcpy2(S1, hp1); - Vcpy2(S2, hp2); - } - else { - Vcpy2(S1, hp1); - Vcpy2(S2, hq2); - }; - } - return (Vequ2(S1, S2) ? 1 : 2); - } - else { /* not parallel */ - /* - * We have the lines: - * l1: p1 + s(p2 - p1) - * l2: q1 + t(q2 - q1) - * And we want to know the intersection point. - * Calculate t: - * p1 + s(p2-p1) = q1 + t(q2-q1) - * which is similar to the two equations: - * p1x + s * rpx = q1x + t * rqx - * p1y + s * rpy = q1y + t * rqy - * Multiplying these by rpy resp. rpx gives: - * rpy * p1x + s * rpx * rpy = rpy * q1x + t * rpy * rqx - * rpx * p1y + s * rpx * rpy = rpx * q1y + t * rpx * rqy - * Subtracting these gives: - * rpy * p1x - rpx * p1y = rpy * q1x - rpx * q1y + t * ( rpy * rqx - rpx * rqy ) - * So t can be isolated: - * t = (rpy * ( p1x - q1x ) + rpx * ( - p1y + q1y )) / ( rpy * rqx - rpx * rqy ) - * and s can be found similarly - * s = (rqy * (q1x - p1x) + rqx * (p1y - q1y))/( rqy * rpx - rqx * rpy) - */ - - if (Vequ2(q1, p1) || Vequ2(q1, p2)) { - S1[0] = q1[0]; - S1[1] = q1[1]; - } - else if (Vequ2(q2, p1) || Vequ2(q2, p2)) { - S1[0] = q2[0]; - S1[1] = q2[1]; - } - else { - s = (rqy * (p1[0] - q1[0]) + rqx * (q1[1] - p1[1])) / deel; - if (s < 0 || s > 1.) - return 0; - t = (rpy * (p1[0] - q1[0]) + rpx * (q1[1] - p1[1])) / deel; - if (t < 0 || t > 1.) - return 0; - - S1[0] = q1[0] + ROUND(t * rqx); - S1[1] = q1[1] + ROUND(t * rqy); - } - return 1; - } -} /* vect_inters2 */ - -/* how about expanding polygons so that edges can be arcs rather than - * lines. Consider using the third coordinate to store the radius of the - * arc. The arc would pass through the vertex points. Positive radius - * would indicate the arc bows left (center on right of P1-P2 path) - * negative radius would put the center on the other side. 0 radius - * would mean the edge is a line instead of arc - * The intersections of the two circles centered at the vertex points - * would determine the two possible arc centers. If P2.x > P1.x then - * the center with smaller Y is selected for positive r. If P2.y > P1.y - * then the center with greater X is selected for positive r. - * - * the vec_inters2() routine would then need to handle line-line - * line-arc and arc-arc intersections. - * - * perhaps reverse tracing the arc would require look-ahead to check - * for arcs - */ Index: 1.1.4/src/move.h =================================================================== --- 1.1.4/src/move.h (revision 10776) +++ 1.1.4/src/move.h (nonexistent) @@ -1,106 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for move routines */ - -#ifndef PCB_MOVE_H -#define PCB_MOVE_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * some useful transformation macros and constants - */ -#define MOVE(xs,ys,deltax,deltay) \ - { \ - ((xs) += (deltax)); \ - ((ys) += (deltay)); \ - } -#define MOVE_BOX_LOWLEVEL(b,dx,dy) \ - { \ - MOVE((b)->X1,(b)->Y1,(dx),(dy)) \ - MOVE((b)->X2,(b)->Y2,(dx),(dy)) \ - } -#define MOVE_VIA_LOWLEVEL(v,dx,dy) \ - { \ - MOVE((v)->X,(v)->Y,(dx),(dy)) \ - MOVE_BOX_LOWLEVEL(&((v)->BoundingBox),(dx),(dy)); \ - } -#define MOVE_PIN_LOWLEVEL(p,dx,dy) \ - { \ - MOVE((p)->X,(p)->Y,(dx),(dy)) \ - MOVE_BOX_LOWLEVEL(&((p)->BoundingBox),(dx),(dy)); \ - } - -#define MOVE_ARC_LOWLEVEL(a,dx,dy) \ - { \ - MOVE((a)->X,(a)->Y,(dx),(dy)) \ - MOVE_BOX_LOWLEVEL(&((a)->BoundingBox),(dx),(dy)); \ - } -/* Rather than mode the line bounding box, we set it so the point bounding - * boxes are updated too. - */ -#define MOVE_LINE_LOWLEVEL(l,dx,dy) \ - { \ - MOVE((l)->Point1.X,(l)->Point1.Y,(dx),(dy)) \ - MOVE((l)->Point2.X,(l)->Point2.Y,(dx),(dy)) \ - SetLineBoundingBox ((l)); \ - } -#define MOVE_PAD_LOWLEVEL(p,dx,dy) \ - { \ - MOVE((p)->Point1.X,(p)->Point1.Y,(dx),(dy)) \ - MOVE((p)->Point2.X,(p)->Point2.Y,(dx),(dy)) \ - SetPadBoundingBox ((p)); \ - } -#define MOVE_TEXT_LOWLEVEL(t,dx,dy) \ - { \ - MOVE_BOX_LOWLEVEL(&((t)->BoundingBox),(dx),(dy)); \ - MOVE((t)->X, (t)->Y, (dx), (dy)); \ - } - -#define MOVE_TYPES \ - (PCB_TYPE_VIA | PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT | PCB_TYPE_ELEMENT_NAME | \ - PCB_TYPE_POLYGON | PCB_TYPE_POLYGON_POINT | PCB_TYPE_LINE_POINT | PCB_TYPE_ARC) -#define MOVETOLAYER_TYPES \ - (PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_POLYGON | PCB_TYPE_RATLINE | PCB_TYPE_ARC) - - -/* --------------------------------------------------------------------------- - * prototypes - */ -void MovePolygonLowLevel(PolygonTypePtr, Coord, Coord); -void MoveElementLowLevel(DataTypePtr, ElementTypePtr, Coord, Coord); -void *MoveObject(int, void *, void *, void *, Coord, Coord); -void *MoveObjectToLayer(int, void *, void *, void *, LayerTypePtr, pcb_bool); -void *MoveObjectAndRubberband(int, void *, void *, void *, Coord, Coord); -pcb_bool MoveSelectedObjectsToLayer(LayerTypePtr); - -/* index is 0..MAX_LAYER-1. If old_index is -1, a new layer is - inserted at that index. If new_index is -1, the specified layer is - deleted. Returns non-zero on error, zero if OK. */ -int MoveLayer(int old_index, int new_index); - -#endif Index: 1.1.4/src/funchash_core.h =================================================================== --- 1.1.4/src/funchash_core.h (revision 10776) +++ 1.1.4/src/funchash_core.h (nonexistent) @@ -1,10 +0,0 @@ -/* central, auto-generated enum of core function IDs */ - -#include "funchash.h" - -#define action_entry(x) F_ ## x, -typedef enum { -#include "funchash_core_list.h" -F_END -} FunctionID; -#undef action_entry Index: 1.1.4/src/globalconst.h =================================================================== --- 1.1.4/src/globalconst.h (revision 10776) +++ 1.1.4/src/globalconst.h (nonexistent) @@ -1,119 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* global constants - * most of these values are also required by files outside the source tree - * (manuals...) - */ - -#ifndef __GLOBALCONST_INCLUDED__ -#define __GLOBALCONST_INCLUDED__ - -#include "config.h" - - -/* frame between the groundplane and the copper or mask - noone seems - to remember what these two are for; changing them may have unforeseen - side effects. */ -#define GROUNDPLANEFRAME PCB_MIL_TO_COORD(15) -#define MASKFRAME PCB_MIL_TO_COORD(3) - -/* --------------------------------------------------------------------------- - * some limit specifications - */ -#define LARGE_VALUE (COORD_MAX / 2 - 1) /* maximum extent of board and elements */ - -#define MAX_LAYER 16 /* max number of layer, check source */ - /* code for more changes, a *lot* more changes */ -#define MIN_LINESIZE PCB_MIL_TO_COORD(0.01) /* thickness of lines */ -#define MAX_LINESIZE LARGE_VALUE -#define MIN_ARCSIZE PCB_MIL_TO_COORD(0.01) -#define MAX_ARCSIZE LARGE_VALUE -#define MIN_TEXTSCALE 10 /* scaling of text objects in percent */ -#define MAX_TEXTSCALE 10000 -#define MIN_PINORVIASIZE PCB_MIL_TO_COORD(20) /* size of a pin or via */ -#define MIN_PINORVIAHOLE PCB_MIL_TO_COORD(4) /* size of a pins or vias drilling hole */ -#define MAX_PINORVIASIZE LARGE_VALUE -#define MIN_PINORVIACOPPER PCB_MIL_TO_COORD(4) /* min difference outer-inner diameter */ -#define MIN_PADSIZE PCB_MIL_TO_COORD(1) /* min size of a pad */ -#define MAX_PADSIZE LARGE_VALUE /* max size of a pad */ -#define MIN_DRC_VALUE PCB_MIL_TO_COORD(0.1) -#define MAX_DRC_VALUE PCB_MIL_TO_COORD(500) -#define MIN_DRC_SILK PCB_MIL_TO_COORD(1) -#define MAX_DRC_SILK PCB_MIL_TO_COORD(30) -#define MIN_DRC_DRILL PCB_MIL_TO_COORD(1) -#define MAX_DRC_DRILL PCB_MIL_TO_COORD(50) -#define MIN_DRC_RING 0 -#define MAX_DRC_RING PCB_MIL_TO_COORD(100) -#define MIN_GRID 1 -#define MAX_GRID PCB_MIL_TO_COORD(1000) -#define MAX_FONTPOSITION 255 /* upper limit of characters in my font */ - -#define MAX_COORD LARGE_VALUE /* coordinate limits */ -#define MIN_SIZE PCB_MIL_TO_COORD(10) /* lowest width and height of the board */ -#define MAX_BUFFER 5 /* number of pastebuffers */ - /* additional changes in menu.c are */ - /* also required to select more buffers */ - -#define DEFAULT_DRILLINGHOLE 40 /* default inner/outer ratio for */ - /* pins/vias in percent */ - -#if MAX_LINESIZE > MAX_PINORVIASIZE /* maximum size value */ -#define MAX_SIZE MAX_LINESIZE -#else -#define MAX_SIZE MAX_PINORVIASIZE -#endif - -#ifndef MAXPATHLEN /* maximum path length */ -#ifdef PATH_MAX -#define MAXPATHLEN PATH_MAX -#else -#define MAXPATHLEN 2048 -#endif -#endif - -#define MAX_LINE_POINT_DISTANCE 0 /* maximum distance when searching */ - /* line points */ -#define MAX_POLYGON_POINT_DISTANCE 0 /* maximum distance when searching */ - /* polygon points */ -#define MAX_ELEMENTNAMES 3 /* number of supported names of */ - /* an element */ -#define MAX_NETLIST_LINE_LENGTH 255 /* maximum line length for netlist files */ -#define MAX_MODESTACK_DEPTH 16 /* maximum depth of mode stack */ -#define MIN_GRID_DISTANCE 4 /* minimum distance between point */ - /* to enable grid drawing */ - /* size of diamond element mark */ -#define EMARK_SIZE PCB_MIL_TO_COORD (10) - - -/**** Font ***/ -/* These are used in debug draw font rendering (e.g. pin names) and reverse - scale calculations (e.g. when report is trying to figure how the font - is scaled. Changing these values is not really supported. */ -#define FONT_CAPHEIGHT PCB_MIL_TO_COORD (45) /* (Approximate) capheight size of the default PCB font */ -#define DEFAULT_CELLSIZE 50 /* default cell size for symbols */ - -#endif Index: 1.1.4/src/check_icon.data =================================================================== --- 1.1.4/src/check_icon.data (revision 10776) +++ 1.1.4/src/check_icon.data (nonexistent) @@ -1,4 +0,0 @@ -#define check_icon_width 8 -#define check_icon_height 8 -static unsigned char check_icon_bits[] = { - 0x80, 0xc0, 0x61, 0x31, 0x1b, 0x0f, 0x06, 0x00}; Index: 1.1.4/src/clip.c =================================================================== --- 1.1.4/src/clip.c (revision 10776) +++ 1.1.4/src/clip.c (nonexistent) @@ -1,111 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 2004 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -#include "config.h" -#include "clip.h" -#include - -/* Clip the line to the clipBox - * return pcb_true if something to be drawn - * pcb_false if the whole thing is clipped - */ -pcb_bool ClipLine(double minx, double miny, double maxx, double maxy, double *x1, double *y1, double *x2, double *y2, double margin) -{ - double d, r; - - minx -= margin; - miny -= margin; - maxx += margin; - maxy += margin; - - /* clip first point on left side */ - if (*x1 < minx) { - if (*x2 < minx) - return pcb_false; - d = *x2 - *x1; - r = (minx - *x1) / d; - *x1 = minx; - *y1 += r * (*y2 - *y1); - } - /* clip second point on left side */ - if (*x2 < minx) { - d = *x1 - *x2; - r = (minx - *x2) / d; - *x2 = minx; - *y2 += r * (*y1 - *y2); - } - /* clip first point on right side */ - if (*x1 > maxx) { - if (*x2 > maxx) - return pcb_false; - d = *x2 - *x1; - r = (maxx - *x1) / d; - *x1 = maxx; - *y1 += r * (*y2 - *y1); - } - /* clip second point on right side */ - if (*x2 > maxx) { - d = *x1 - *x2; - r = (maxx - *x2) / d; - *x2 = maxx; - *y2 += r * (*y1 - *y2); - } - - /* clip first point on top */ - if (*y1 < miny) { - if (*y2 < miny) - return pcb_false; - d = *y2 - *y1; - r = (miny - *y1) / d; - *y1 = miny; - *x1 += r * (*x2 - *x1); - } - /* clip second point on top */ - if (*y2 < miny) { - d = *y1 - *y2; - r = (miny - *y2) / d; - *y2 = miny; - *x2 += r * (*x1 - *x2); - } - /* clip first point on bottom */ - if (*y1 > maxy) { - if (*y2 > maxy) - return pcb_false; - d = *y2 - *y1; - r = (maxy - *y1) / d; - *y1 = maxy; - *x1 += r * (*x2 - *x1); - } - /* clip second point on top */ - if (*y2 > maxy) { - d = *y1 - *y2; - r = (maxy - *y2) / d; - *y2 = maxy; - *x2 += r * (*x1 - *x2); - } - return pcb_true; -} Index: 1.1.4/src/list_common.h =================================================================== --- 1.1.4/src/list_common.h (revision 10776) +++ 1.1.4/src/list_common.h (nonexistent) @@ -1,35 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_COMMON_H -#define LIST_COMMON_H - -/* iterate over all items of list and call func(item) */ -#define list_map0(list, itemtype, func) \ - do { \ - itemtype *__item__; \ - gdl_iterator_t it; \ - linelist_foreach((list), &it, __item__) \ - func(__item__); \ - } while(0) - -#endif Index: 1.1.4/src/icons/lock.dat =================================================================== --- 1.1.4/src/icons/lock.dat (revision 10776) +++ 1.1.4/src/icons/lock.dat (nonexistent) @@ -1,9 +0,0 @@ -#define lock_width 21 -#define lock_height 21 -static unsigned char lock_bits[] = { - 0x00, 0x1f, 0x00, 0x80, 0x31, 0x00, 0x80, 0x20, 0x00, 0xc0, 0x60, 0x00, - 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0xf0, 0xff, 0x01, 0x10, 0x00, 0x01, - 0xf0, 0xff, 0x01, 0x10, 0x00, 0x01, 0xf0, 0xff, 0x01, 0x10, 0x00, 0x01, - 0xf0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x84, 0xb1, 0x04, 0x44, 0x8a, 0x04, - 0x44, 0x8a, 0x02, 0x44, 0x8a, 0x01, 0x44, 0x8a, 0x02, 0x44, 0x8a, 0x04, - 0x9c, 0xb1, 0x04}; Index: 1.1.4/src/icons/lcurs.dat =================================================================== --- 1.1.4/src/icons/lcurs.dat (revision 10776) +++ 1.1.4/src/icons/lcurs.dat (nonexistent) @@ -1,6 +0,0 @@ -#define lcurs_width 16 -#define lcurs_height 16 -static unsigned char lcurs_bits[] = { - 0xf0, 0x0f, 0xf0, 0x0f, 0xf8, 0x1f, 0x38, 0x1c, 0x1c, 0x3c, 0x1c, 0x38, - 0x1c, 0x30, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, - 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f}; Index: 1.1.4/src/icons/hand.dat =================================================================== --- 1.1.4/src/icons/hand.dat (revision 10776) +++ 1.1.4/src/icons/hand.dat (nonexistent) @@ -1,9 +0,0 @@ -#define hand_width 21 -#define hand_height 21 -static unsigned char hand_bits[] = { - 0x00, 0x02, 0x00, 0x20, 0x25, 0x00, 0x50, 0x55, 0x02, 0x50, 0x55, 0x05, - 0x50, 0x55, 0x05, 0xd3, 0xd4, 0x06, 0x95, 0x48, 0x02, 0x19, 0x40, 0x01, - 0x12, 0x00, 0x01, 0x04, 0x80, 0x00, 0x08, 0x80, 0x00, 0x10, 0x80, 0x00, - 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x38, 0x26, 0x02, 0x48, 0x69, 0x02, - 0x48, 0xe9, 0x02, 0x38, 0xaf, 0x02, 0x08, 0xa9, 0x03, 0x08, 0x29, 0x03, - 0x08, 0x29, 0x02}; Index: 1.1.4/src/icons/Makefile.am =================================================================== --- 1.1.4/src/icons/Makefile.am (revision 10776) +++ 1.1.4/src/icons/Makefile.am (nonexistent) @@ -1,4 +0,0 @@ -## $Id$ - -EXTRA_DIST= hand.dat hcurs.dat lcurs.dat lock.dat - Index: 1.1.4/src/icons/hcurs.dat =================================================================== --- 1.1.4/src/icons/hcurs.dat (revision 10776) +++ 1.1.4/src/icons/hcurs.dat (nonexistent) @@ -1,8 +0,0 @@ -#define hcurs_width 16 -#define hcurs_height 16 -#define hcurs_x_hot 7 -#define hcurs_y_hot 9 -static unsigned char hcurs_bits[] = { - 0x80, 0x00, 0xc8, 0x09, 0xdc, 0x1d, 0xdc, 0x1d, 0xdc, 0x1d, 0xfc, 0xcf, - 0x38, 0xee, 0x1f, 0x78, 0x0f, 0x78, 0x07, 0x30, 0x07, 0x30, 0x0e, 0x38, - 0x1e, 0x3c, 0x3c, 0x1e, 0xf8, 0x0f, 0xf0, 0x0f}; Index: 1.1.4/src/const.h =================================================================== --- 1.1.4/src/const.h (revision 10776) +++ 1.1.4/src/const.h (nonexistent) @@ -1,176 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* global source constants */ - -#ifndef PCB_CONST_H -#define PCB_CONST_H - -#include -#include - -/* --------------------------------------------------------------------------- - * the layer-numbers of the two additional special layers - * 'component' and 'solder'. The offset of MAX_LAYER is not added - */ -#define SOLDER_LAYER 0 -#define COMPONENT_LAYER 1 - -/* --------------------------------------------------------------------------- - * some math constants - */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#ifndef M_SQRT1_2 -#define M_SQRT1_2 0.707106781 /* 1/sqrt(2) */ -#endif -#define PCB_M180 (M_PI/180.0) -#define PCB_RAD_TO_DEG (180.0/M_PI) -#define PCB_TAN_22_5_DEGREE_2 0.207106781 /* 0.5*tan(22.5) */ -#define PCB_COS_22_5_DEGREE 0.923879533 /* cos(22.5) */ -#define PCB_TAN_30_DEGREE 0.577350269 /* tan(30) */ -#define PCB_TAN_60_DEGREE 1.732050808 /* tan(60) */ -#define PCB_LN_2_OVER_2 0.346573590 - -/* PCB/physical unit conversions */ -#define PCB_COORD_TO_MIL(n) ((n) / 25400.0) -#define PCB_MIL_TO_COORD(n) ((n) * 25400.0) -#define PCB_COORD_TO_MM(n) ((n) / 1000000.0) -#define PCB_MM_TO_COORD(n) ((n) * 1000000.0) -#define PCB_COORD_TO_INCH(n) (PCB_COORD_TO_MIL(n) / 1000.0) -#define PCB_INCH_TO_COORD(n) (PCB_MIL_TO_COORD(n) * 1000.0) -#define PCB_COORD_TO_DECIMIL(n) (PCB_COORD_TO_MIL(n) * 10.0) -#define PCB_DECIMIL_TO_COORD(n) (PCB_MIL_TO_COORD(n) / 10.0) - -/* These need to be carefully written to avoid overflows, and return - a Coord type. */ -#define PCB_SCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * ((double)(TEXTSCALE) / 100.0))) -#define PCB_UNPCB_SCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * (100.0 / (double)(TEXTSCALE)))) - -/* --------------------------------------------------------------------------- - * modes - */ -typedef enum { - PCB_MODE_NO = 0, /* no mode selected */ - PCB_MODE_VIA = 1, /* draw vias */ - PCB_MODE_LINE = 2, /* draw lines */ - PCB_MODE_RECTANGLE = 3, /* create rectangles */ - PCB_MODE_POLYGON = 4, /* draw filled polygons */ - PCB_MODE_PASTE_BUFFER = 5, /* paste objects from buffer */ - PCB_MODE_TEXT = 6, /* create text objects */ - PCB_MODE_ROTATE = 102, /* rotate objects */ - PCB_MODE_REMOVE = 103, /* remove objects */ - PCB_MODE_MOVE = 104, /* move objects */ - PCB_MODE_COPY = 105, /* copy objects */ - PCB_MODE_INSERT_POINT = 106, /* insert point into line/polygon */ - PCB_MODE_RUBBERBAND_MOVE = 107, /* move objects and attached lines */ - PCB_MODE_THERMAL = 108, /* toggle thermal layer flag */ - PCB_MODE_ARC = 109, /* draw arcs */ - PCB_MODE_ARROW = 110, /* selection with arrow mode */ - PCB_MODE_PAN = 0, /* same as no mode */ - PCB_MODE_LOCK = 111, /* lock/unlock objects */ - PCB_MODE_POLYGON_HOLE = 112 /* cut holes in filled polygons */ -} pcb_mode_t; - -/* --------------------------------------------------------------------------- - * object flags - */ - -/* %start-doc pcbfile ~objectflags -@node Object Flags -@section Object Flags - -Note that object flags can be given numerically (like @code{0x0147}) -or symbolically (like @code{"found,showname,square"}. Some numeric -values are reused for different object types. The table below lists -the numeric value followed by the symbolic name. -%end-doc */ -typedef enum { - PCB_FLAG_NO = 0x00000, - PCB_FLAG_PIN = 0x00001, /*!< If set, this object is a pin. This flag is for internal use only. */ - PCB_FLAG_VIA = 0x00002, /*!< Likewise, for vias. */ - PCB_FLAG_FOUND = 0x00004, /*!< If set, this object has been found by @code{FindConnection()}. */ - PCB_FLAG_HOLE = 0x00008, /*!< For pins and vias, this flag means that the pin or via is a hole without a copper annulus. */ - PCB_FLAG_NOPASTE = 0x00008, /*!< Pad should not receive solderpaste. This is to support fiducials */ - PCB_FLAG_RAT = 0x00010, /*!< If set for a line, indicates that this line is a rat line instead of a copper trace. */ - PCB_FLAG_PININPOLY = 0x00010, /*!< For pins and pads, this flag is used internally to indicate that the pin or pad overlaps a polygon on some layer.*/ - PCB_FLAG_CLEARPOLY = 0x00010, /*!< For polygons, this flag means that pins and vias will normally clear these polygons (thus, thermals are required for electrical connection). When clear, polygons will solidly connect to pins and vias. */ - PCB_FLAG_HIDENAME = 0x00010, /*!< For elements, when set the name of the element is hidden. */ - PCB_FLAG_DISPLAYNAME = 0x00020, /*!< For elements, when set the names of pins are shown. */ - PCB_FLAG_CLEARLINE = 0x00020, /*!< For lines and arcs, the line/arc will clear polygons instead of connecting to them. */ - PCB_FLAG_FULLPOLY = 0x00020, /*!< For polygons, the full polygon is drawn (i.e. all parts instead of only the biggest one). */ - PCB_FLAG_SELECTED = 0x00040, /*!< Set when the object is selected. */ - PCB_FLAG_ONSOLDER = 0x00080, /*!< For elements and pads, indicates that they are on the solder side. */ - PCB_FLAG_AUTO = 0x00080, /*!< For lines and vias, indicates that these were created by the autorouter. */ - PCB_FLAG_SQUARE = 0x00100, /*!< For pins and pads, indicates a square (vs round) pin/pad. */ - PCB_FLAG_RUBBEREND = 0x00200, /*!< For lines, used internally for rubber band moves: indicates one end already rubber banding. */ - PCB_FLAG_WARN = 0x00200, /*!< For pins, vias, and pads, set to indicate a warning. */ - PCB_FLAG_USETHERMAL = 0x00400, /*!< Obsolete, indicates that pins/vias should be drawn with thermal fingers. */ - PCB_FLAG_ONSILK = 0x00400, /*!< Obsolete, old files used this to indicate lines drawn on silk. (Used by io_pcb for compatibility.) */ - PCB_FLAG_OCTAGON = 0x00800, /*!< Draw pins and vias as octagons. */ - PCB_FLAG_DRC = 0x01000, /*!< Set for objects that fail DRC: flag like FOUND flag for DRC checking. */ - PCB_FLAG_LOCK = 0x02000, /*!< Set for locked objects. */ - PCB_FLAG_EDGE2 = 0x04000, /*!< For pads, indicates that the second point is closer to the edge. For pins, indicates that the pin is closer to a horizontal edge and thus pinout text should be vertical. (Padr.Point2 is closer to outside edge also pinout text for pins is vertical) */ - PCB_FLAG_VISIT = 0x08000, /*!< marker to avoid re-visiting an object */ - PCB_FLAG_NONETLIST = 0x10000, /* element is not on the netlist and should not interfere with the netlist */ - PCB_FLAG_MINCUT = 0x20000, /* used by the mincut short find code */ - PCB_FLAG_ONPOINT = 0x40000 /*!< crosshair is on line point or arc point */ -/* PCB_FLAG_NOCOPY = (PCB_FLAG_FOUND | CONNECTEDFLAG | PCB_FLAG_ONPOINT)*/ -} pcb_flag_t; - -/* --------------------------------------------------------------------------- - * object types (bitfield) - */ -typedef enum { - PCB_TYPE_NONE = 0x00000, /* special: no object */ - PCB_TYPE_VIA = 0x00001, - PCB_TYPE_ELEMENT = 0x00002, - PCB_TYPE_LINE = 0x00004, - PCB_TYPE_POLYGON = 0x00008, - PCB_TYPE_TEXT = 0x00010, - PCB_TYPE_RATLINE = 0x00020, - - PCB_TYPE_PIN = 0x00100, /* objects that are part */ - PCB_TYPE_PAD = 0x00200, /* 'pin' of SMD element */ - PCB_TYPE_ELEMENT_NAME = 0x00400, /* of others */ - PCB_TYPE_POLYGON_POINT = 0x00800, - PCB_TYPE_LINE_POINT = 0x01000, - PCB_TYPE_ELEMENT_LINE = 0x02000, - PCB_TYPE_ARC = 0x04000, - PCB_TYPE_ELEMENT_ARC = 0x08000, - - PCB_TYPE_LOCKED = 0x10000, /* used to tell search to include locked items. */ - PCB_TYPE_NET = 0x20000, /* used to select whole net. */ - - /* groups/properties */ - PCB_TYPEMASK_PIN = (PCB_TYPE_VIA | PCB_TYPE_PIN), - PCB_TYPEMASK_LOCK = (PCB_TYPE_VIA | PCB_TYPE_LINE | PCB_TYPE_ARC | PCB_TYPE_POLYGON | PCB_TYPE_ELEMENT | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT_NAME | PCB_TYPE_LOCKED), - - PCB_TYPEMASK_ALL = (~0) /* all bits set */ -} pcb_obj_type_t; - -#endif Index: 1.1.4/src/clip.h =================================================================== --- 1.1.4/src/clip.h (revision 10776) +++ 1.1.4/src/clip.h (nonexistent) @@ -1,44 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 2004 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for inserting points into objects */ - -#ifndef PCB_CLIP_H -#define PCB_CLIP_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * prototypes - */ - -/* Clip X,Y to the given bounding box, plus a margin. Returns TRUE if - there is something left to be drawn. */ -pcb_bool ClipLine(double minx, double miny, double maxx, double maxy, - double *x1, double *y1, double *x2, double *y2, double margin); - -#endif Index: 1.1.4/src/box.h =================================================================== --- 1.1.4/src/box.h (revision 10776) +++ 1.1.4/src/box.h (nonexistent) @@ -1,206 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, box.h, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* random box-related utilities. */ - -#ifndef PCB_BOX_H -#define PCB_BOX_H - -#include -#include "global.h" - -#include "misc_util.h" - -typedef enum { NORTH = 0, EAST = 1, SOUTH = 2, WEST = 3, NE = 4, SE = 5, SW = 6, NW = 7, ALL = 8 -} direction_t; - -/* rotates box 90-degrees cw */ -/* that's a strange rotation! */ -#define ROTATEBOX_CW(box) { Coord t;\ - t = (box).X1; (box).X1 = -(box).Y2; (box).Y2 = (box).X2;\ - (box).X2 = -(box).Y1; (box).Y1 = t;\ -} -#define ROTATEBOX_TO_NORTH(box, dir) do { Coord t;\ - switch(dir) {\ - case EAST: \ - t = (box).X1; (box).X1 = (box).Y1; (box).Y1 = -(box).X2;\ - (box).X2 = (box).Y2; (box).Y2 = -t; break;\ - case SOUTH: \ - t = (box).X1; (box).X1 = -(box).X2; (box).X2 = -t;\ - t = (box).Y1; (box).Y1 = -(box).Y2; (box).Y2 = -t; break;\ - case WEST: \ - t = (box).X1; (box).X1 = -(box).Y2; (box).Y2 = (box).X2;\ - (box).X2 = -(box).Y1; (box).Y1 = t; break;\ - case NORTH: break;\ - default: assert(0);\ - }\ - } while (0) -#define ROTATEBOX_FROM_NORTH(box, dir) do { Coord t;\ - switch(dir) {\ - case WEST: \ - t = (box).X1; (box).X1 = (box).Y1; (box).Y1 = -(box).X2;\ - (box).X2 = (box).Y2; (box).Y2 = -t; break;\ - case SOUTH: \ - t = (box).X1; (box).X1 = -(box).X2; (box).X2 = -t;\ - t = (box).Y1; (box).Y1 = -(box).Y2; (box).Y2 = -t; break;\ - case EAST: \ - t = (box).X1; (box).X1 = -(box).Y2; (box).Y2 = (box).X2;\ - (box).X2 = -(box).Y1; (box).Y1 = t; break;\ - case NORTH: break;\ - default: assert(0);\ - }\ - } while (0) - -/* to avoid overflow, we calculate centers this way */ -#define CENTER_X(b) ((b).X1 + ((b).X2 - (b).X1)/2) -#define CENTER_Y(b) ((b).Y1 + ((b).Y2 - (b).Y1)/2) -/* some useful box utilities. */ - -typedef struct cheap_point { - Coord X, Y; -} CheapPointType; - - -/* note that boxes are closed on top and left and open on bottom and right. */ -/* this means that top-left corner is in box, *but bottom-right corner is - * not*. */ -static inline PCB_FUNC_UNUSED pcb_bool point_in_box(const BoxType * box, Coord X, Coord Y) -{ - return (X >= box->X1) && (Y >= box->Y1) && (X < box->X2) && (Y < box->Y2); -} - -static inline PCB_FUNC_UNUSED pcb_bool point_in_closed_box(const BoxType * box, Coord X, Coord Y) -{ - return (X >= box->X1) && (Y >= box->Y1) && (X <= box->X2) && (Y <= box->Y2); -} - -static inline PCB_FUNC_UNUSED pcb_bool box_is_good(const BoxType * b) -{ - return (b->X1 < b->X2) && (b->Y1 < b->Y2); -} - -static inline PCB_FUNC_UNUSED pcb_bool box_intersect(const BoxType * a, const BoxType * b) -{ - return (a->X1 < b->X2) && (b->X1 < a->X2) && (a->Y1 < b->Y2) && (b->Y1 < a->Y2); -} - -static inline PCB_FUNC_UNUSED CheapPointType closest_point_in_box(const CheapPointType * from, const BoxType * box) -{ - CheapPointType r; - assert(box->X1 < box->X2 && box->Y1 < box->Y2); - r.X = (from->X < box->X1) ? box->X1 : (from->X > box->X2 - 1) ? box->X2 - 1 : from->X; - r.Y = (from->Y < box->Y1) ? box->Y1 : (from->Y > box->Y2 - 1) ? box->Y2 - 1 : from->Y; - assert(point_in_box(box, r.X, r.Y)); - return r; -} - -static inline PCB_FUNC_UNUSED pcb_bool box_in_box(const BoxType * outer, const BoxType * inner) -{ - return (outer->X1 <= inner->X1) && (inner->X2 <= outer->X2) && (outer->Y1 <= inner->Y1) && (inner->Y2 <= outer->Y2); -} - -static inline PCB_FUNC_UNUSED BoxType clip_box(const BoxType * box, const BoxType * clipbox) -{ - BoxType r; - assert(box_intersect(box, clipbox)); - r.X1 = MAX(box->X1, clipbox->X1); - r.X2 = MIN(box->X2, clipbox->X2); - r.Y1 = MAX(box->Y1, clipbox->Y1); - r.Y2 = MIN(box->Y2, clipbox->Y2); - assert(box_in_box(clipbox, &r)); - return r; -} - -static inline PCB_FUNC_UNUSED BoxType shrink_box(const BoxType * box, Coord amount) -{ - BoxType r = *box; - r.X1 += amount; - r.Y1 += amount; - r.X2 -= amount; - r.Y2 -= amount; - return r; -} - -static inline PCB_FUNC_UNUSED BoxType bloat_box(const BoxType * box, Coord amount) -{ - return shrink_box(box, -amount); -} - -/* construct a minimum box that touches the input box at the center */ -static inline PCB_FUNC_UNUSED BoxType box_center(const BoxType * box) -{ - BoxType r; - r.X1 = box->X1 + (box->X2 - box->X1) / 2; - r.X2 = r.X1 + 1; - r.Y1 = box->Y1 + (box->Y2 - box->Y1) / 2; - r.Y2 = r.Y1 + 1; - return r; -} - -/* construct a minimum box that touches the input box at the corner */ -static inline PCB_FUNC_UNUSED BoxType box_corner(const BoxType * box) -{ - BoxType r; - r.X1 = box->X1; - r.X2 = r.X1 + 1; - r.Y1 = box->Y1; - r.Y2 = r.Y1 + 1; - return r; -} - -/* construct a box that holds a single point */ -static inline PCB_FUNC_UNUSED BoxType point_box(Coord X, Coord Y) -{ - BoxType r; - r.X1 = X; - r.X2 = X + 1; - r.Y1 = Y; - r.Y2 = Y + 1; - return r; -} - -/* close a bounding box by pushing its upper right corner */ -static inline PCB_FUNC_UNUSED void close_box(BoxType * r) -{ - r->X2++; - r->Y2++; -} - -/* return the square of the minimum distance from a point to some point - * inside a box. The box is half-closed! That is, the top-left corner - * is considered in the box, but the bottom-right corner is not. */ -static inline PCB_FUNC_UNUSED double dist2_to_box(const CheapPointType * p, const BoxType * b) -{ - CheapPointType r = closest_point_in_box(p, b); - return Distance(r.X, r.Y, p->X, p->Y); -} - -#endif /* __BOX_H_INCLUDED__ */ Index: 1.1.4/src/create.c =================================================================== --- 1.1.4/src/create.c (revision 10776) +++ 1.1.4/src/create.c (nonexistent) @@ -1,952 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* functions used to create vias, pins ... */ - -#include "config.h" - -#include -#include -#include -#include - -#include "conf_core.h" - -#include "create.h" -#include "data.h" -#include "error.h" -#include "misc.h" -#include "layer.h" -#include "rtree.h" -#include "search.h" -#include "undo.h" -#include "plug_io.h" -#include "stub_vendor.h" -#include "hid_actions.h" -#include "paths.h" -#include "misc_util.h" -#include "compat_misc.h" - -/* --------------------------------------------------------------------------- - * some local identifiers - */ - -/* current object ID; incremented after each creation of an object */ -static long int ID = 1; - -static pcb_bool be_lenient = pcb_false; - -/* ---------------------------------------------------------------------- - * some local prototypes - */ -static void AddTextToElement(TextTypePtr, FontTypePtr, Coord, Coord, unsigned, char *, int, FlagType); - -/* --------------------------------------------------------------------------- - * Set the lenience mode. - */ - -void CreateBeLenient(pcb_bool v) -{ - be_lenient = v; -} - -/* --------------------------------------------------------------------------- - * creates a new paste buffer - */ -DataTypePtr CreateNewBuffer(void) -{ - DataTypePtr data; - data = (DataTypePtr) calloc(1, sizeof(DataType)); - data->pcb = (PCBTypePtr) PCB; - return data; -} - -/* --------------------------------------------------------------------------- - * Perhaps PCB should internally just use the Settings colors? For now, - * use this to set PCB colors so the config can reassign PCB colors. - */ -void pcb_colors_from_settings(PCBTypePtr ptr) -{ - int i; - - /* copy default settings */ - ptr->ConnectedColor = conf_core.appearance.color.connected; - ptr->ElementColor = conf_core.appearance.color.element; - ptr->ElementColor_nonetlist = conf_core.appearance.color.element_nonetlist; - ptr->RatColor = conf_core.appearance.color.rat; - ptr->InvisibleObjectsColor = conf_core.appearance.color.invisible_objects; - ptr->InvisibleMarkColor = conf_core.appearance.color.invisible_mark; - ptr->ElementSelectedColor = conf_core.appearance.color.element_selected; - ptr->RatSelectedColor = conf_core.appearance.color.rat_selected; - ptr->PinColor = conf_core.appearance.color.pin; - ptr->PinSelectedColor = conf_core.appearance.color.pin_selected; - ptr->PinNameColor = conf_core.appearance.color.pin_name; - ptr->ViaColor = conf_core.appearance.color.via; - ptr->ViaSelectedColor = conf_core.appearance.color.via_selected; - ptr->WarnColor = conf_core.appearance.color.warn; - ptr->MaskColor = conf_core.appearance.color.mask; - for (i = 0; i < MAX_LAYER; i++) { - ptr->Data->Layer[i].Color = conf_core.appearance.color.layer[i]; - ptr->Data->Layer[i].SelectedColor = conf_core.appearance.color.layer_selected[i]; - } - ptr->Data->Layer[component_silk_layer].Color = - conf_core.editor.show_solder_side ? conf_core.appearance.color.invisible_objects : conf_core.appearance.color.element; - ptr->Data->Layer[component_silk_layer].SelectedColor = conf_core.appearance.color.element_selected; - ptr->Data->Layer[solder_silk_layer].Color = conf_core.editor.show_solder_side ? conf_core.appearance.color.element : conf_core.appearance.color.invisible_objects; - ptr->Data->Layer[solder_silk_layer].SelectedColor = conf_core.appearance.color.element_selected; -} - -/* --------------------------------------------------------------------------- - * creates a new PCB - */ -PCBTypePtr CreateNewPCB_(pcb_bool SetDefaultNames) -{ - PCBTypePtr ptr, save; - int i; - - /* allocate memory, switch all layers on and copy resources */ - ptr = (PCBTypePtr) calloc(1, sizeof(PCBType)); - ptr->Data = CreateNewBuffer(); - ptr->Data->pcb = (PCBTypePtr) ptr; - - ptr->ThermStyle = 4; - ptr->IsleArea = 2.e8; - ptr->SilkActive = pcb_false; - ptr->RatDraw = pcb_false; - - /* NOTE: we used to set all the pcb flags on ptr here, but we don't need to do that anymore due to the new conf system */ - /* this is the most useful starting point for now */ - - ptr->Grid = conf_core.editor.grid; - ParseGroupString(conf_core.design.groups, &ptr->LayerGroups, MAX_LAYER); - save = PCB; - PCB = ptr; - hid_action("RouteStylesChanged"); - PCB = save; - ptr->Zoom = conf_core.editor.zoom; - ptr->MaxWidth = conf_core.design.max_width; - ptr->MaxHeight = conf_core.design.max_height; - ptr->ID = ID++; - ptr->ThermScale = 0.5; - - ptr->Bloat = conf_core.design.bloat; - ptr->Shrink = conf_core.design.shrink; - ptr->minWid = conf_core.design.min_wid; - ptr->minSlk = conf_core.design.min_slk; - ptr->minDrill = conf_core.design.min_drill; - ptr->minRing = conf_core.design.min_ring; - - for (i = 0; i < MAX_LAYER; i++) - ptr->Data->Layer[i].Name = pcb_strdup(conf_core.design.default_layer_name[i]); - - CreateDefaultFont(ptr); - - return (ptr); -} - -PCBTypePtr CreateNewPCB() -{ - PCBTypePtr old, nw; - int dpcb; - - old = PCB; - - PCB = NULL; - - dpcb = -1; - pcb_io_err_inhibit_inc(); - conf_list_foreach_path_first(dpcb, &conf_core.rc.default_pcb_file, LoadPCB(__path__, NULL, pcb_false, 1)); - pcb_io_err_inhibit_dec(); - - if (dpcb == 0) { - nw = PCB; - if (nw->Filename != NULL) { - /* make sure the new PCB doesn't inherit the name of the default pcb */ - free(nw->Filename); - nw->Filename = NULL; - } - } - else { - nw = NULL; - } - - PCB = old; - return nw; -} - - -/* This post-processing step adds the top and bottom silk layers to a - * pre-existing PCB. - */ -int CreateNewPCBPost(PCBTypePtr pcb, int use_defaults) -{ - /* copy default settings */ - pcb_colors_from_settings(pcb); - - return 0; -} - -/* --------------------------------------------------------------------------- - * creates a new via - */ -PinTypePtr -CreateNewVia(DataTypePtr Data, - Coord X, Coord Y, - Coord Thickness, Coord Clearance, Coord Mask, Coord DrillingHole, const char *Name, FlagType Flags) -{ - PinTypePtr Via; - - if (!be_lenient) { - VIA_LOOP(Data); - { - if (Distance(X, Y, via->X, via->Y) <= via->DrillingHole / 2 + DrillingHole / 2) { - Message(PCB_MSG_DEFAULT, _("%m+Dropping via at %$mD because it's hole would overlap with the via " - "at %$mD\n"), conf_core.editor.grid_unit->allow, X, Y, via->X, via->Y); - return (NULL); /* don't allow via stacking */ - } - } - END_LOOP; - } - - Via = GetViaMemory(Data); - - if (!Via) - return (Via); - /* copy values */ - Via->X = X; - Via->Y = Y; - Via->Thickness = Thickness; - Via->Clearance = Clearance; - Via->Mask = Mask; - Via->DrillingHole = stub_vendorDrillMap(DrillingHole); - if (Via->DrillingHole != DrillingHole) { - Message(PCB_MSG_DEFAULT, _("%m+Mapped via drill hole to %$mS from %$mS per vendor table\n"), - conf_core.editor.grid_unit->allow, Via->DrillingHole, DrillingHole); - } - - Via->Name = pcb_strdup_null(Name); - Via->Flags = Flags; - CLEAR_FLAG(PCB_FLAG_WARN, Via); - SET_FLAG(PCB_FLAG_VIA, Via); - Via->ID = ID++; - - /* - * don't complain about MIN_PINORVIACOPPER on a mounting hole (pure - * hole) - */ - if (!TEST_FLAG(PCB_FLAG_HOLE, Via) && (Via->Thickness < Via->DrillingHole + MIN_PINORVIACOPPER)) { - Via->Thickness = Via->DrillingHole + MIN_PINORVIACOPPER; - Message(PCB_MSG_DEFAULT, _("%m+Increased via thickness to %$mS to allow enough copper" - " at %$mD.\n"), conf_core.editor.grid_unit->allow, Via->Thickness, Via->X, Via->Y); - } - - pcb_add_via(Data, Via); - return (Via); -} - -void pcb_add_via(DataType *Data, PinType *Via) -{ - SetPinBoundingBox(Via); - if (!Data->via_tree) - Data->via_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Data->via_tree, (BoxTypePtr) Via, 0); -} - -struct line_info { - Coord X1, X2, Y1, Y2; - Coord Thickness; - FlagType Flags; - LineType test, *ans; - jmp_buf env; -}; - -static r_dir_t line_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct line_info *i = (struct line_info *) cl; - - if (line->Point1.X == i->X1 && line->Point2.X == i->X2 && line->Point1.Y == i->Y1 && line->Point2.Y == i->Y2) { - i->ans = (LineTypePtr) (-1); - longjmp(i->env, 1); - } - /* check the other point order */ - if (line->Point1.X == i->X1 && line->Point2.X == i->X2 && line->Point1.Y == i->Y1 && line->Point2.Y == i->Y2) { - i->ans = (LineTypePtr) (-1); - longjmp(i->env, 1); - } - if (line->Point2.X == i->X1 && line->Point1.X == i->X2 && line->Point2.Y == i->Y1 && line->Point1.Y == i->Y2) { - i->ans = (LineTypePtr) - 1; - longjmp(i->env, 1); - } - /* remove unnecessary line points */ - if (line->Thickness == i->Thickness - /* don't merge lines if the clear flags differ */ - && TEST_FLAG(PCB_FLAG_CLEARLINE, line) == TEST_FLAG(PCB_FLAG_CLEARLINE, i)) { - if (line->Point1.X == i->X1 && line->Point1.Y == i->Y1) { - i->test.Point1.X = line->Point2.X; - i->test.Point1.Y = line->Point2.Y; - i->test.Point2.X = i->X2; - i->test.Point2.Y = i->Y2; - if (IsPointOnLine(i->X1, i->Y1, 0.0, &i->test)) { - i->ans = line; - longjmp(i->env, 1); - } - } - else if (line->Point2.X == i->X1 && line->Point2.Y == i->Y1) { - i->test.Point1.X = line->Point1.X; - i->test.Point1.Y = line->Point1.Y; - i->test.Point2.X = i->X2; - i->test.Point2.Y = i->Y2; - if (IsPointOnLine(i->X1, i->Y1, 0.0, &i->test)) { - i->ans = line; - longjmp(i->env, 1); - } - } - else if (line->Point1.X == i->X2 && line->Point1.Y == i->Y2) { - i->test.Point1.X = line->Point2.X; - i->test.Point1.Y = line->Point2.Y; - i->test.Point2.X = i->X1; - i->test.Point2.Y = i->Y1; - if (IsPointOnLine(i->X2, i->Y2, 0.0, &i->test)) { - i->ans = line; - longjmp(i->env, 1); - } - } - else if (line->Point2.X == i->X2 && line->Point2.Y == i->Y2) { - i->test.Point1.X = line->Point1.X; - i->test.Point1.Y = line->Point1.Y; - i->test.Point2.X = i->X1; - i->test.Point2.Y = i->Y1; - if (IsPointOnLine(i->X2, i->Y2, 0.0, &i->test)) { - i->ans = line; - longjmp(i->env, 1); - } - } - } - return R_DIR_NOT_FOUND; -} - - -/* --------------------------------------------------------------------------- - * creates a new line on a layer and checks for overlap and extension - */ -LineTypePtr -CreateDrawnLineOnLayer(LayerTypePtr Layer, - Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness, Coord Clearance, FlagType Flags) -{ - struct line_info info; - BoxType search; - - search.X1 = MIN(X1, X2); - search.X2 = MAX(X1, X2); - search.Y1 = MIN(Y1, Y2); - search.Y2 = MAX(Y1, Y2); - if (search.Y2 == search.Y1) - search.Y2++; - if (search.X2 == search.X1) - search.X2++; - info.X1 = X1; - info.X2 = X2; - info.Y1 = Y1; - info.Y2 = Y2; - info.Thickness = Thickness; - info.Flags = Flags; - info.test.Thickness = 0; - info.test.Flags = NoFlags(); - info.ans = NULL; - /* prevent stacking of duplicate lines - * and remove needless intermediate points - * verify that the layer is on the board first! - */ - if (setjmp(info.env) == 0) { - r_search(Layer->line_tree, &search, NULL, line_callback, &info, NULL); - return CreateNewLineOnLayer(Layer, X1, Y1, X2, Y2, Thickness, Clearance, Flags); - } - - if ((void *) info.ans == (void *) (-1)) - return NULL; /* stacked line */ - /* remove unnecessary points */ - if (info.ans) { - /* must do this BEFORE getting new line memory */ - MoveObjectToRemoveUndoList(PCB_TYPE_LINE, Layer, info.ans, info.ans); - X1 = info.test.Point1.X; - X2 = info.test.Point2.X; - Y1 = info.test.Point1.Y; - Y2 = info.test.Point2.Y; - } - return CreateNewLineOnLayer(Layer, X1, Y1, X2, Y2, Thickness, Clearance, Flags); -} - -LineTypePtr -CreateNewLineOnLayer(LayerTypePtr Layer, - Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness, Coord Clearance, FlagType Flags) -{ - LineTypePtr Line; - - Line = GetLineMemory(Layer); - if (!Line) - return (Line); - Line->ID = ID++; - Line->Flags = Flags; - CLEAR_FLAG(PCB_FLAG_RAT, Line); - Line->Thickness = Thickness; - Line->Clearance = Clearance; - Line->Point1.X = X1; - Line->Point1.Y = Y1; - Line->Point1.ID = ID++; - Line->Point2.X = X2; - Line->Point2.Y = Y2; - Line->Point2.ID = ID++; - pcb_add_line_on_layer(Layer, Line); - return (Line); -} - -void pcb_add_line_on_layer(LayerType *Layer, LineType *Line) -{ - SetLineBoundingBox(Line); - if (!Layer->line_tree) - Layer->line_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); -} - - -/* --------------------------------------------------------------------------- - * creates a new rat-line - */ -RatTypePtr -CreateNewRat(DataTypePtr Data, Coord X1, Coord Y1, - Coord X2, Coord Y2, pcb_cardinal_t group1, pcb_cardinal_t group2, Coord Thickness, FlagType Flags) -{ - RatTypePtr Line = GetRatMemory(Data); - - if (!Line) - return (Line); - - Line->ID = ID++; - Line->Flags = Flags; - SET_FLAG(PCB_FLAG_RAT, Line); - Line->Thickness = Thickness; - Line->Point1.X = X1; - Line->Point1.Y = Y1; - Line->Point1.ID = ID++; - Line->Point2.X = X2; - Line->Point2.Y = Y2; - Line->Point2.ID = ID++; - Line->group1 = group1; - Line->group2 = group2; - SetLineBoundingBox((LineTypePtr) Line); - if (!Data->rat_tree) - Data->rat_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Data->rat_tree, &Line->BoundingBox, 0); - return (Line); -} - -/* --------------------------------------------------------------------------- - * creates a new arc on a layer - */ -ArcTypePtr -CreateNewArcOnLayer(LayerTypePtr Layer, - Coord X1, Coord Y1, - Coord width, Coord height, Angle sa, Angle dir, Coord Thickness, Coord Clearance, FlagType Flags) -{ - ArcTypePtr Arc; - - ARC_LOOP(Layer); - { - if (arc->X == X1 && arc->Y == Y1 && arc->Width == width && - NormalizeAngle(arc->StartAngle) == NormalizeAngle(sa) && arc->Delta == dir) - return (NULL); /* prevent stacked arcs */ - } - END_LOOP; - Arc = GetArcMemory(Layer); - if (!Arc) - return (Arc); - - Arc->ID = ID++; - Arc->Flags = Flags; - Arc->Thickness = Thickness; - Arc->Clearance = Clearance; - Arc->X = X1; - Arc->Y = Y1; - Arc->Width = width; - Arc->Height = height; - Arc->StartAngle = sa; - Arc->Delta = dir; - pcb_add_arc_on_layer(Layer, Arc); - return (Arc); -} - -void pcb_add_arc_on_layer(LayerType *Layer, ArcType *Arc) -{ - SetArcBoundingBox(Arc); - if (!Layer->arc_tree) - Layer->arc_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); -} - -/* --------------------------------------------------------------------------- - * creates a new polygon from the old formats rectangle data - */ -PolygonTypePtr CreateNewPolygonFromRectangle(LayerTypePtr Layer, Coord X1, Coord Y1, Coord X2, Coord Y2, FlagType Flags) -{ - PolygonTypePtr polygon = CreateNewPolygon(Layer, Flags); - if (!polygon) - return (polygon); - - CreateNewPointInPolygon(polygon, X1, Y1); - CreateNewPointInPolygon(polygon, X2, Y1); - CreateNewPointInPolygon(polygon, X2, Y2); - CreateNewPointInPolygon(polygon, X1, Y2); - - pcb_add_polygon_on_layer(Layer, polygon); - return (polygon); -} - -void pcb_add_polygon_on_layer(LayerType *Layer, PolygonType *polygon) -{ - SetPolygonBoundingBox(polygon); - if (!Layer->polygon_tree) - Layer->polygon_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Layer->polygon_tree, (BoxTypePtr) polygon, 0); -} - -/* --------------------------------------------------------------------------- - * creates a new text on a layer - */ -TextTypePtr -CreateNewText(LayerTypePtr Layer, FontTypePtr PCBFont, - Coord X, Coord Y, unsigned Direction, int Scale, char *TextString, FlagType Flags) -{ - TextType *text; - - if (TextString == NULL) - return NULL; - - text = GetTextMemory(Layer); - if (text == NULL) - return NULL; - - /* copy values, width and height are set by drawing routine - * because at this point we don't know which symbols are available - */ - text->X = X; - text->Y = Y; - text->Direction = Direction; - text->Flags = Flags; - text->Scale = Scale; - text->TextString = pcb_strdup(TextString); - - pcb_add_text_on_layer(Layer, text, PCBFont); - - return (text); -} - -void pcb_add_text_on_layer(LayerType *Layer, TextType *text, FontType *PCBFont) -{ - /* calculate size of the bounding box */ - SetTextBoundingBox(PCBFont, text); - text->ID = ID++; - if (!Layer->text_tree) - Layer->text_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Layer->text_tree, (BoxTypePtr) text, 0); -} - - - -/* --------------------------------------------------------------------------- - * creates a new polygon on a layer - */ -PolygonTypePtr CreateNewPolygon(LayerTypePtr Layer, FlagType Flags) -{ - PolygonTypePtr polygon = GetPolygonMemory(Layer); - - /* copy values */ - polygon->Flags = Flags; - polygon->ID = ID++; - polygon->Clipped = NULL; - polygon->NoHoles = NULL; - polygon->NoHolesValid = 0; - return (polygon); -} - -/* --------------------------------------------------------------------------- - * creates a new point in a polygon - */ -PointTypePtr CreateNewPointInPolygon(PolygonTypePtr Polygon, Coord X, Coord Y) -{ - PointTypePtr point = GetPointMemoryInPolygon(Polygon); - - /* copy values */ - point->X = X; - point->Y = Y; - point->ID = ID++; - return (point); -} - -/* --------------------------------------------------------------------------- - * creates a new hole in a polygon - */ -PolygonType *CreateNewHoleInPolygon(PolygonType * Polygon) -{ - pcb_cardinal_t *holeindex = GetHoleIndexMemoryInPolygon(Polygon); - *holeindex = Polygon->PointN; - return Polygon; -} - -/* --------------------------------------------------------------------------- - * creates an new element - * memory is allocated if needed - */ -ElementTypePtr -CreateNewElement(DataTypePtr Data, ElementTypePtr Element, - FontTypePtr PCBFont, - FlagType Flags, - char *Description, char *NameOnPCB, char *Value, - Coord TextX, Coord TextY, pcb_uint8_t Direction, int TextScale, FlagType TextFlags, pcb_bool uniqueName) -{ -#ifdef DEBUG - printf("Entered CreateNewElement.....\n"); -#endif - - if (!Element) - Element = GetElementMemory(Data); - - /* copy values and set additional information */ - TextScale = MAX(MIN_TEXTSCALE, TextScale); - AddTextToElement(&DESCRIPTION_TEXT(Element), PCBFont, TextX, TextY, Direction, Description, TextScale, TextFlags); - if (uniqueName) - NameOnPCB = UniqueElementName(Data, NameOnPCB); - AddTextToElement(&NAMEONPCB_TEXT(Element), PCBFont, TextX, TextY, Direction, NameOnPCB, TextScale, TextFlags); - AddTextToElement(&VALUE_TEXT(Element), PCBFont, TextX, TextY, Direction, Value, TextScale, TextFlags); - DESCRIPTION_TEXT(Element).Element = Element; - NAMEONPCB_TEXT(Element).Element = Element; - VALUE_TEXT(Element).Element = Element; - Element->Flags = Flags; - Element->ID = ID++; - -#ifdef DEBUG - printf(" .... Leaving CreateNewElement.\n"); -#endif - - return (Element); -} - -/* --------------------------------------------------------------------------- - * creates a new arc in an element - */ -ArcTypePtr -CreateNewArcInElement(ElementTypePtr Element, - Coord X, Coord Y, Coord Width, Coord Height, Angle angle, Angle delta, Coord Thickness) -{ - ArcType *arc = GetElementArcMemory(Element); - - /* set Delta (0,360], StartAngle in [0,360) */ - if (delta < 0) { - delta = -delta; - angle -= delta; - } - angle = NormalizeAngle(angle); - delta = NormalizeAngle(delta); - if (delta == 0) - delta = 360; - - /* copy values */ - arc->X = X; - arc->Y = Y; - arc->Width = Width; - arc->Height = Height; - arc->StartAngle = angle; - arc->Delta = delta; - arc->Thickness = Thickness; - arc->ID = ID++; - return arc; -} - -/* --------------------------------------------------------------------------- - * creates a new line for an element - */ -LineTypePtr CreateNewLineInElement(ElementTypePtr Element, Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness) -{ - LineType *line; - - if (Thickness == 0) - return NULL; - - line = GetElementLineMemory(Element); - - /* copy values */ - line->Point1.X = X1; - line->Point1.Y = Y1; - line->Point2.X = X2; - line->Point2.Y = Y2; - line->Thickness = Thickness; - line->Flags = NoFlags(); - line->ID = ID++; - return line; -} - -/* --------------------------------------------------------------------------- - * creates a new pin in an element - */ -PinTypePtr -CreateNewPin(ElementTypePtr Element, - Coord X, Coord Y, - Coord Thickness, Coord Clearance, Coord Mask, Coord DrillingHole, char *Name, char *Number, FlagType Flags) -{ - PinTypePtr pin = GetPinMemory(Element); - - /* copy values */ - pin->X = X; - pin->Y = Y; - pin->Thickness = Thickness; - pin->Clearance = Clearance; - pin->Mask = Mask; - pin->Name = pcb_strdup_null(Name); - pin->Number = pcb_strdup_null(Number); - pin->Flags = Flags; - CLEAR_FLAG(PCB_FLAG_WARN, pin); - SET_FLAG(PCB_FLAG_PIN, pin); - pin->ID = ID++; - pin->Element = Element; - - /* - * If there is no vendor drill map installed, this will simply - * return DrillingHole. - */ - pin->DrillingHole = stub_vendorDrillMap(DrillingHole); - - /* Unless we should not map drills on this element, map them! */ - if (stub_vendorIsElementMappable(Element)) { - if (pin->DrillingHole < MIN_PINORVIASIZE) { - Message(PCB_MSG_DEFAULT, _("%m+Did not map pin #%s (%s) drill hole because %$mS is below the minimum allowed size\n"), - conf_core.editor.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); - pin->DrillingHole = DrillingHole; - } - else if (pin->DrillingHole > MAX_PINORVIASIZE) { - Message(PCB_MSG_DEFAULT, _("%m+Did not map pin #%s (%s) drill hole because %$mS is above the maximum allowed size\n"), - conf_core.editor.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); - pin->DrillingHole = DrillingHole; - } - else if (!TEST_FLAG(PCB_FLAG_HOLE, pin) - && (pin->DrillingHole > pin->Thickness - MIN_PINORVIACOPPER)) { - Message(PCB_MSG_DEFAULT, _("%m+Did not map pin #%s (%s) drill hole because %$mS does not leave enough copper\n"), - conf_core.editor.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); - pin->DrillingHole = DrillingHole; - } - } - else { - pin->DrillingHole = DrillingHole; - } - - if (pin->DrillingHole != DrillingHole) { - Message(PCB_MSG_DEFAULT, _("%m+Mapped pin drill hole to %$mS from %$mS per vendor table\n"), - conf_core.editor.grid_unit->allow, pin->DrillingHole, DrillingHole); - } - - return (pin); -} - -/* --------------------------------------------------------------------------- - * creates a new pad in an element - */ -PadTypePtr -CreateNewPad(ElementTypePtr Element, - Coord X1, Coord Y1, Coord X2, - Coord Y2, Coord Thickness, Coord Clearance, Coord Mask, char *Name, char *Number, FlagType Flags) -{ - PadTypePtr pad = GetPadMemory(Element); - - /* copy values */ - if (X1 > X2 || (X1 == X2 && Y1 > Y2)) { - pad->Point1.X = X2; - pad->Point1.Y = Y2; - pad->Point2.X = X1; - pad->Point2.Y = Y1; - } - else { - pad->Point1.X = X1; - pad->Point1.Y = Y1; - pad->Point2.X = X2; - pad->Point2.Y = Y2; - } - pad->Thickness = Thickness; - pad->Clearance = Clearance; - pad->Mask = Mask; - pad->Name = pcb_strdup_null(Name); - pad->Number = pcb_strdup_null(Number); - pad->Flags = Flags; - CLEAR_FLAG(PCB_FLAG_WARN, pad); - pad->ID = ID++; - pad->Element = Element; - return (pad); -} - -/* --------------------------------------------------------------------------- - * creates a new textobject as part of an element - * copies the values to the appropriate text object - */ -static void -AddTextToElement(TextTypePtr Text, FontTypePtr PCBFont, - Coord X, Coord Y, unsigned Direction, char *TextString, int Scale, FlagType Flags) -{ - free(Text->TextString); - Text->TextString = (TextString && *TextString) ? pcb_strdup(TextString) : NULL; - Text->X = X; - Text->Y = Y; - Text->Direction = Direction; - Text->Flags = Flags; - Text->Scale = Scale; - - /* calculate size of the bounding box */ - SetTextBoundingBox(PCBFont, Text); - Text->ID = ID++; -} - -/* --------------------------------------------------------------------------- - * creates a new line in a symbol - */ -LineTypePtr CreateNewLineInSymbol(SymbolTypePtr Symbol, Coord X1, Coord Y1, Coord X2, Coord Y2, Coord Thickness) -{ - LineTypePtr line = Symbol->Line; - - /* realloc new memory if necessary and clear it */ - if (Symbol->LineN >= Symbol->LineMax) { - Symbol->LineMax += STEP_SYMBOLLINE; - line = (LineTypePtr) realloc(line, Symbol->LineMax * sizeof(LineType)); - Symbol->Line = line; - memset(line + Symbol->LineN, 0, STEP_SYMBOLLINE * sizeof(LineType)); - } - - /* copy values */ - line = line + Symbol->LineN++; - line->Point1.X = X1; - line->Point1.Y = Y1; - line->Point2.X = X2; - line->Point2.Y = Y2; - line->Thickness = Thickness; - return (line); -} - -/* --------------------------------------------------------------------------- - * parses a file with font information and installs it into the provided PCB - * checks directories given as colon separated list by resource fontPath - * if the fonts filename doesn't contain a directory component - */ -void CreateDefaultFont(PCBTypePtr pcb) -{ - int res = -1; - pcb_io_err_inhibit_inc(); - conf_list_foreach_path_first(res, &conf_core.rc.default_font_file, ParseFont(&pcb->Font, __path__)); - pcb_io_err_inhibit_dec(); - - if (res != 0) { - const char *s; - gds_t buff; - s = conf_concat_strlist(&conf_core.rc.default_font_file, &buff, NULL, ':'); - Message(PCB_MSG_ERROR, _("Can't find font-symbol-file - there won't be font in this design. Searched: '%s'\n"), s); - gds_uninit(&buff); - } -} - -/* --------------------------------------------------------------------------- - * adds a new line to the rubberband list of 'Crosshair.AttachedObject' - * if Layer == 0 it is a rat line - */ -RubberbandTypePtr CreateNewRubberbandEntry(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr MovedPoint) -{ - RubberbandTypePtr ptr = GetRubberbandMemory(); - - /* we toggle the PCB_FLAG_RUBBEREND of the line to determine if */ - /* both points are being moved. */ - TOGGLE_FLAG(PCB_FLAG_RUBBEREND, Line); - ptr->Layer = Layer; - ptr->Line = Line; - ptr->MovedPoint = MovedPoint; - return (ptr); -} - -/* --------------------------------------------------------------------------- - * Add a new net to the netlist menu - */ -LibraryMenuTypePtr CreateNewNet(LibraryTypePtr lib, char *name, const char *style) -{ - LibraryMenuTypePtr menu; - char temp[64]; - - sprintf(temp, " %s", name); - menu = GetLibraryMenuMemory(lib, NULL); - menu->Name = pcb_strdup(temp); - menu->flag = 1; /* net is enabled by default */ - if (style == NULL || NSTRCMP("(unknown)", style) == 0) - menu->Style = NULL; - else - menu->Style = pcb_strdup(style); - return (menu); -} - -/* --------------------------------------------------------------------------- - * Add a connection to the net - */ -LibraryEntryTypePtr CreateNewConnection(LibraryMenuTypePtr net, char *conn) -{ - LibraryEntryTypePtr entry = GetLibraryEntryMemory(net); - - entry->ListEntry = pcb_strdup_null(conn); - entry->ListEntry_dontfree = 0; - - return (entry); -} - -/* --------------------------------------------------------------------------- - * Add an attribute to a list. - */ -AttributeTypePtr CreateNewAttribute(AttributeListTypePtr list, const char *name, const char *value) -{ - if (list->Number >= list->Max) { - list->Max += 10; - list->List = (AttributeType *) realloc(list->List, list->Max * sizeof(AttributeType)); - } - list->List[list->Number].name = pcb_strdup_null(name); - list->List[list->Number].value = pcb_strdup_null(value); - list->Number++; - return &list->List[list->Number - 1]; -} - -void CreateIDBump(int min_id) -{ - if (ID < min_id) - ID = min_id; -} - -void CreateIDReset(void) -{ - ID = 1; -} - -long int CreateIDGet(void) -{ - return ID++; -} Index: 1.1.4/src/stub_stroke.c =================================================================== --- 1.1.4/src/stub_stroke.c (revision 10776) +++ 1.1.4/src/stub_stroke.c (nonexistent) @@ -1,38 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include "error.h" -#include "pcb_bool.h" - -pcb_bool mid_stroke = pcb_false; - -static void stub_stroke_record_dummy(int ev_x, int ev_y) -{ -} - -static void stub_stroke_start_dummy(void) -{ - Message(PCB_MSG_DEFAULT, "Can not use libstroke: not compiled as a buildin and not loaded as a plugin\n"); -} - -void (*stub_stroke_record)(int ev_x, int ev_y) = stub_stroke_record_dummy; -void (*stub_stroke_start)(void) = stub_stroke_start_dummy; -void (*stub_stroke_finish)(void) = stub_stroke_start_dummy; Index: 1.1.4/src/create.h =================================================================== --- 1.1.4/src/create.h (revision 10776) +++ 1.1.4/src/create.h (nonexistent) @@ -1,81 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for create routines */ - -#ifndef PCB_CREATE_H -#define PCB_CREATE_H - -#include "global.h" - -/* TRUE during file loads, for example to allow overlapping vias. - FALSE otherwise, to stop the user from doing normally dangerous - things. */ -void CreateBeLenient(pcb_bool); - -DataTypePtr CreateNewBuffer(void); -void pcb_colors_from_settings(PCBTypePtr); -PCBTypePtr CreateNewPCB_(pcb_bool); -PCBTypePtr CreateNewPCB(); -/* Called after PCB->Data->LayerN is set. Returns zero if no errors, - else nonzero. */ -int CreateNewPCBPost(PCBTypePtr, int /* set defaults */ ); -PinTypePtr CreateNewVia(DataTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, const char *, FlagType); -LineTypePtr CreateDrawnLineOnLayer(LayerTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, FlagType); -LineTypePtr CreateNewLineOnLayer(LayerTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, FlagType); -RatTypePtr CreateNewRat(DataTypePtr, Coord, Coord, Coord, Coord, pcb_cardinal_t, pcb_cardinal_t, Coord, FlagType); -ArcTypePtr CreateNewArcOnLayer(LayerTypePtr, Coord, Coord, Coord, Coord, Angle, Angle, Coord, Coord, FlagType); -PolygonTypePtr CreateNewPolygonFromRectangle(LayerTypePtr, Coord, Coord, Coord, Coord, FlagType); -TextTypePtr CreateNewText(LayerTypePtr, FontTypePtr, Coord, Coord, unsigned, int, char *, FlagType); -PolygonTypePtr CreateNewPolygon(LayerTypePtr, FlagType); -PointTypePtr CreateNewPointInPolygon(PolygonTypePtr, Coord, Coord); -PolygonType *CreateNewHoleInPolygon(PolygonType * polygon); -ElementTypePtr CreateNewElement(DataTypePtr, ElementTypePtr, - FontTypePtr, FlagType, char *, char *, char *, Coord, Coord, pcb_uint8_t, int, FlagType, pcb_bool); -LineTypePtr CreateNewLineInElement(ElementTypePtr, Coord, Coord, Coord, Coord, Coord); -ArcTypePtr CreateNewArcInElement(ElementTypePtr, Coord, Coord, Coord, Coord, Angle, Angle, Coord); -PinTypePtr CreateNewPin(ElementTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, char *, char *, FlagType); -PadTypePtr CreateNewPad(ElementTypePtr, Coord, Coord, Coord, Coord, Coord, Coord, Coord, char *, char *, FlagType); -LineTypePtr CreateNewLineInSymbol(SymbolTypePtr, Coord, Coord, Coord, Coord, Coord); -void CreateDefaultFont(PCBTypePtr); -RubberbandTypePtr CreateNewRubberbandEntry(LayerTypePtr, LineTypePtr, PointTypePtr); -LibraryMenuTypePtr CreateNewNet(LibraryTypePtr, char *, const char *); -LibraryEntryTypePtr CreateNewConnection(LibraryMenuTypePtr, char *); - -AttributeTypePtr CreateNewAttribute(AttributeListTypePtr list, const char *name, const char *value); - -void CreateIDBump(int min_id); -void CreateIDReset(void); -long int CreateIDGet(void); - -/* Add objects without creating them or making any "sanity modifications" to them */ -void pcb_add_via(DataType *Data, PinType *Via); -void pcb_add_line_on_layer(LayerType *Layer, LineType *Line); -void pcb_add_arc_on_layer(LayerType *Layer, ArcType *Arc); -void pcb_add_polygon_on_layer(LayerType *Layer, PolygonType *polygon); -void pcb_add_text_on_layer(LayerType *ly, TextType *text, FontType *PCBFont); - -#endif Index: 1.1.4/src/stub_stroke.h =================================================================== --- 1.1.4/src/stub_stroke.h (revision 10776) +++ 1.1.4/src/stub_stroke.h (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -extern pcb_bool mid_stroke; -extern void (*stub_stroke_record)(int ev_x, int ev_y); -extern void (*stub_stroke_start)(void); -extern void (*stub_stroke_finish)(void); Index: 1.1.4/src/gui_act.c =================================================================== --- 1.1.4/src/gui_act.c (revision 10776) +++ 1.1.4/src/gui_act.c (nonexistent) @@ -1,1273 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" -#include "data.h" -#include "action_helper.h" -#include "error.h" -#include "undo.h" -#include "funchash_core.h" - -#include "draw.h" -#include "search.h" -#include "crosshair.h" -#include "find.h" -#include "set.h" -#include "misc.h" -#include "misc_util.h" -#include "stub_stroke.h" -#include "hid_actions.h" -#include "hid_init.h" -#include "route_style.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- */ -/* Toggle actions are kept for compatibility; new code should use the conf system instead */ -static const char display_syntax[] = - "Display(NameOnPCB|Description|Value)\n" - "Display(Grid|Redraw)\n" - "Display(CycleClip|CycleCrosshair|ToggleAllDirections|ToggleStartDirection)\n" - "Display(ToggleGrid|ToggleRubberBandMode|ToggleUniqueNames)\n" - "Display(ToggleMask|ToggleName|ToggleClearLine|ToggleFullPoly)\n" - "Display(ToggleSnapPin|ToggleSnapOffGridLine|ToggleHighlightOnPoint)\n" - "Display(ToggleThindraw|ToggleThindrawPoly|ToggleOrthoMove|ToggleLocalRef)\n" - "Display(ToggleCheckPlanes|ToggleShowDRC|ToggleAutoDRC)\n" - "Display(ToggleLiveRoute|LockNames|OnlyNames)\n" "Display(Pinout|PinOrPadName)"; - -static const char display_help[] = "Several display-related actions."; - -/* %start-doc actions Display - -@table @code - -@item NameOnPCB -@item Description -@item Value -Specify whether all elements show their name, description, or value. - -@item Redraw -Redraw the whole board. - -@item ToggleAllDirections -When clear, lines can be drawn at any angle. When set, lines are -restricted to multiples of 45 degrees and requested lines may be -broken up according to the clip setting. - -@item CycleClip -Changes the way lines are restricted to 45 degree increments. The -various settings are: straight only, orthogonal then angled, and angled -then orthogonal. If AllDirections is set, this action disables it. - -@item CycleCrosshair -Changes crosshair drawing. Crosshair may accept form of 4-ray, -8-ray and 12-ray cross. - -@item ToggleRubberBandMode -If set, moving an object moves all the lines attached to it too. - -@item ToggleStartDirection -If set, each time you set a point in a line, the Clip toggles between -orth-angle and angle-ortho. - -@item ToggleUniqueNames -If set, you will not be permitted to change the name of an element to -match that of another element. - -@item ToggleSnapPin -If set, pin centers and pad end points are treated as additional grid -points that the cursor can snap to. - -@item ToggleSnapOffGridLine -If set, snap at some sensible point along a line. - -@item ToggleHighlightOnPoint -If set, highlights lines and arcs when the crosshair is on one of their -two (end) points. - -@item ToggleLocalRef -If set, the mark is automatically set to the beginning of any move, so -you can see the relative distance you've moved. - -@item ToggleThindraw -If set, objects on the screen are drawn as outlines (lines are drawn -as center-lines). This lets you see line endpoints hidden under pins, -for example. - -@item ToggleThindrawPoly -If set, polygons on the screen are drawn as outlines. - -@item ToggleShowDRC -If set, pending objects (i.e. lines you're in the process of drawing) -will be drawn with an outline showing how far away from other copper -you need to be. - -@item ToggleLiveRoute -If set, the progress of the autorouter will be visible on the screen. - -@item ToggleAutoDRC -If set, you will not be permitted to make connections which violate -the current DRC and netlist settings. - -@item ToggleCheckPlanes -If set, lines and arcs aren't drawn, which usually leaves just the -polygons. If you also disable all but the layer you're interested in, -this allows you to check for isolated regions. - -@item ToggleOrthoMove -If set, the crosshair is only allowed to move orthogonally from its -previous position. I.e. you can move an element or line up, down, -left, or right, but not up+left or down+right. - -@item ToggleName -Selects whether the pinouts show the pin names or the pin numbers. - -@item ToggleLockNames -If set, text will ignore left mouse clicks and actions that work on -objects under the mouse. You can still select text with a lasso (left -mouse drag) and perform actions on the selection. - -@item ToggleOnlyNames -If set, only text will be sensitive for mouse clicks and actions that -work on objects under the mouse. You can still select other objects -with a lasso (left mouse drag) and perform actions on the selection. - -@item ToggleMask -Turns the solder mask on or off. - -@item ToggleClearLine -When set, the clear-line flag causes new lines and arcs to have their -``clear polygons'' flag set, so they won't be electrically connected -to any polygons they overlap. - -@item ToggleFullPoly -When set, the full-poly flag causes new polygons to have their -``full polygon'' flag set, so all parts of them will be displayed -instead of only the biggest one. - -@item ToggleGrid -Resets the origin of the current grid to be wherever the mouse pointer -is (not where the crosshair currently is). If you provide two numbers -after this, the origin is set to that coordinate. - -@item Grid -Toggles whether the grid is displayed or not. - -@item Pinout -Causes the pinout of the element indicated by the cursor to be -displayed, usually in a separate window. - -@item PinOrPadName -Toggles whether the names of pins, pads, or (yes) vias will be -displayed. If the cursor is over an element, all of its pins and pads -are affected. - -@end table - -%end-doc */ - -static enum crosshair_shape CrosshairShapeIncrement(enum crosshair_shape shape) -{ - switch (shape) { - case Basic_Crosshair_Shape: - shape = Union_Jack_Crosshair_Shape; - break; - case Union_Jack_Crosshair_Shape: - shape = Dozen_Crosshair_Shape; - break; - case Dozen_Crosshair_Shape: - shape = Crosshair_Shapes_Number; - break; - case Crosshair_Shapes_Number: - shape = Basic_Crosshair_Shape; - break; - } - return shape; -} - -static int ActionDisplay(int argc, const char **argv, Coord childX, Coord childY) -{ - const char *function, *str_dir; - int id; - int err = 0; - - function = ACTION_ARG(0); - str_dir = ACTION_ARG(1); - - if (function && (!str_dir || !*str_dir)) { - switch (id = funchash_get(function, NULL)) { - - /* redraw layout */ - case F_ClearAndRedraw: - case F_Redraw: - Redraw(); - break; - - /* change the displayed name of elements */ - case F_Value: - case F_NameOnPCB: - case F_Description: - ELEMENT_LOOP(PCB->Data); - { - EraseElementName(element); - } - END_LOOP; - switch (id) { - case F_Value: - if (conf_core.editor.description || conf_core.editor.name_on_pcb) { - conf_set_editor(description, 0); - conf_set_editor(name_on_pcb, 0); - } - else - conf_set_editor(name_on_pcb, 0); /* need to write once so the event is triggered */ - break; - case F_NameOnPCB: - if (conf_core.editor.description || !conf_core.editor.name_on_pcb) { - conf_set_editor(description, 0); - conf_set_editor(name_on_pcb, 1); - } - else - conf_set_editor(name_on_pcb, 1); /* need to write once so the event is triggered */ - break; - case F_Description: - if (!conf_core.editor.description || conf_core.editor.name_on_pcb) { - conf_set_editor(description, 1); - conf_set_editor(name_on_pcb, 0); - } - else - conf_set_editor(name_on_pcb, 0); /* need to write once so the event is triggered */ - break; - } - ELEMENT_LOOP(PCB->Data); - { - DrawElementName(element); - } - END_LOOP; - Draw(); - break; - - /* toggle line-adjust flag */ - case F_ToggleAllDirections: - conf_toggle_editor(all_direction_lines); - AdjustAttachedObjects(); - break; - - case F_CycleClip: - notify_crosshair_change(pcb_false); - if (conf_core.editor.all_direction_lines) { - conf_toggle_editor(all_direction_lines); - conf_setf(CFR_DESIGN,"editor/line_refraction",-1,"%d",0); - } - else { - conf_setf(CFR_DESIGN,"editor/line_refraction",-1,"%d",(conf_core.editor.line_refraction +1) % 3); - } - AdjustAttachedObjects(); - notify_crosshair_change(pcb_true); - break; - - case F_CycleCrosshair: - notify_crosshair_change(pcb_false); - Crosshair.shape = CrosshairShapeIncrement(Crosshair.shape); - if (Crosshair_Shapes_Number == Crosshair.shape) - Crosshair.shape = Basic_Crosshair_Shape; - notify_crosshair_change(pcb_true); - break; - - case F_ToggleRubberBandMode: - notify_crosshair_change(pcb_false); - conf_toggle_editor(rubber_band_mode); - notify_crosshair_change(pcb_true); - break; - - case F_ToggleStartDirection: - notify_crosshair_change(pcb_false); - conf_toggle_editor(swap_start_direction); - notify_crosshair_change(pcb_true); - break; - - case F_ToggleUniqueNames: - conf_toggle_editor(unique_names); - break; - - case F_ToggleSnapPin: - notify_crosshair_change(pcb_false); - conf_toggle_editor(snap_pin); - notify_crosshair_change(pcb_true); - break; - - case F_ToggleSnapOffGridLine: - notify_crosshair_change(pcb_false); - conf_toggle_editor(snap_offgrid_line); - notify_crosshair_change(pcb_true); - break; - - case F_ToggleHighlightOnPoint: - notify_crosshair_change(pcb_false); - conf_toggle_editor(highlight_on_point); - notify_crosshair_change(pcb_true); - break; - - case F_ToggleLocalRef: - conf_toggle_editor(local_ref); - break; - - case F_ToggleThindraw: - conf_toggle_editor(thin_draw); - Redraw(); - break; - - case F_ToggleThindrawPoly: - conf_toggle_editor(thin_draw_poly); - Redraw(); - break; - - case F_ToggleLockNames: - conf_toggle_editor(lock_names); - conf_set_editor(only_names, 0); - break; - - case F_ToggleOnlyNames: - conf_toggle_editor(only_names); - conf_set_editor(lock_names, 0); - break; - - case F_ToggleHideNames: - conf_toggle_editor(hide_names); - Redraw(); - break; - - case F_ToggleStroke: - conf_toggle_editor(enable_stroke); - break; - - case F_ToggleShowDRC: - conf_toggle_editor(show_drc); - break; - - case F_ToggleLiveRoute: - conf_toggle_editor(live_routing); - break; - - case F_ToggleAutoDRC: - notify_crosshair_change(pcb_false); - conf_toggle_editor(auto_drc); - if (conf_core.editor.auto_drc && conf_core.editor.mode == PCB_MODE_LINE) { - if (ResetConnections(pcb_true)) { - IncrementUndoSerialNumber(); - Draw(); - } - if (Crosshair.AttachedLine.State != STATE_FIRST) - LookupConnection(Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, pcb_true, 1, PCB_FLAG_FOUND); - } - notify_crosshair_change(pcb_true); - break; - - case F_ToggleCheckPlanes: - conf_toggle_editor(check_planes); - Redraw(); - break; - - case F_ToggleOrthoMove: - conf_toggle_editor(orthogonal_moves); - break; - - case F_ToggleName: - conf_toggle_editor(show_number); - Redraw(); - break; - - case F_ToggleMask: - conf_toggle_editor(show_mask); - Redraw(); - break; - - case F_ToggleClearLine: - conf_toggle_editor(clear_line); - break; - - case F_ToggleFullPoly: - conf_toggle_editor(full_poly); - break; - - /* shift grid alignment */ - case F_ToggleGrid: - { - Coord oldGrid = PCB->Grid; - - PCB->Grid = 1; - if (MoveCrosshairAbsolute(Crosshair.X, Crosshair.Y)) - notify_crosshair_change(pcb_true); /* first notify was in MoveCrosshairAbs */ - SetGrid(oldGrid, pcb_true); - } - break; - - /* toggle displaying of the grid */ - case F_Grid: - conf_toggle_editor(draw_grid); - Redraw(); - break; - - /* display the pinout of an element */ - case F_Pinout: - { - ElementTypePtr element; - void *ptrtmp; - Coord x, y; - - gui->get_coords(_("Click on an element"), &x, &y); - if ((SearchScreen(x, y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) { - element = (ElementTypePtr) ptrtmp; - gui->show_item(element); - } - break; - } - - /* toggle displaying of pin/pad/via names */ - case F_PinOrPadName: - { - void *ptr1, *ptr2, *ptr3; - Coord x, y; - gui->get_coords(_("Click on an element"), &x, &y); - - switch (SearchScreen(x, y, - PCB_TYPE_ELEMENT | PCB_TYPE_PIN | PCB_TYPE_PAD | - PCB_TYPE_VIA, (void **) &ptr1, (void **) &ptr2, (void **) &ptr3)) { - case PCB_TYPE_ELEMENT: - PIN_LOOP((ElementTypePtr) ptr1); - { - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, pin)) - ErasePinName(pin); - else - DrawPinName(pin); - AddObjectToFlagUndoList(PCB_TYPE_PIN, ptr1, pin, pin); - TOGGLE_FLAG(PCB_FLAG_DISPLAYNAME, pin); - } - END_LOOP; - PAD_LOOP((ElementTypePtr) ptr1); - { - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, pad)) - ErasePadName(pad); - else - DrawPadName(pad); - AddObjectToFlagUndoList(PCB_TYPE_PAD, ptr1, pad, pad); - TOGGLE_FLAG(PCB_FLAG_DISPLAYNAME, pad); - } - END_LOOP; - SetChangedFlag(pcb_true); - IncrementUndoSerialNumber(); - Draw(); - break; - - case PCB_TYPE_PIN: - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, (PinTypePtr) ptr2)) - ErasePinName((PinTypePtr) ptr2); - else - DrawPinName((PinTypePtr) ptr2); - AddObjectToFlagUndoList(PCB_TYPE_PIN, ptr1, ptr2, ptr3); - TOGGLE_FLAG(PCB_FLAG_DISPLAYNAME, (PinTypePtr) ptr2); - SetChangedFlag(pcb_true); - IncrementUndoSerialNumber(); - Draw(); - break; - - case PCB_TYPE_PAD: - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, (PadTypePtr) ptr2)) - ErasePadName((PadTypePtr) ptr2); - else - DrawPadName((PadTypePtr) ptr2); - AddObjectToFlagUndoList(PCB_TYPE_PAD, ptr1, ptr2, ptr3); - TOGGLE_FLAG(PCB_FLAG_DISPLAYNAME, (PadTypePtr) ptr2); - SetChangedFlag(pcb_true); - IncrementUndoSerialNumber(); - Draw(); - break; - case PCB_TYPE_VIA: - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, (PinTypePtr) ptr2)) - EraseViaName((PinTypePtr) ptr2); - else - DrawViaName((PinTypePtr) ptr2); - AddObjectToFlagUndoList(PCB_TYPE_VIA, ptr1, ptr2, ptr3); - TOGGLE_FLAG(PCB_FLAG_DISPLAYNAME, (PinTypePtr) ptr2); - SetChangedFlag(pcb_true); - IncrementUndoSerialNumber(); - Draw(); - break; - } - break; - } - default: - err = 1; - } - } - else if (function && str_dir) { - switch (funchash_get(function, NULL)) { - case F_ToggleGrid: - if (argc > 2) { - PCB->GridOffsetX = GetValue(argv[1], NULL, NULL, NULL); - PCB->GridOffsetY = GetValue(argv[2], NULL, NULL, NULL); - if (conf_core.editor.draw_grid) - Redraw(); - } - break; - - default: - err = 1; - break; - } - } - - if (!err) - return 0; - - AFAIL(display); -} -/* --------------------------------------------------------------------------- */ - -static const char mode_syntax[] = - "Mode(Arc|Arrow|Copy|InsertPoint|Line|Lock|Move|None|PasteBuffer)\n" - "Mode(Polygon|Rectangle|Remove|Rotate|Text|Thermal|Via)\n" "Mode(Notify|Release|Cancel|Stroke)\n" "Mode(Save|Restore)"; - -static const char mode_help[] = "Change or use the tool mode."; - -/* %start-doc actions Mode - -@table @code - -@item Arc -@itemx Arrow -@itemx Copy -@itemx InsertPoint -@itemx Line -@itemx Lock -@itemx Move -@itemx None -@itemx PasteBuffer -@itemx Polygon -@itemx Rectangle -@itemx Remove -@itemx Rotate -@itemx Text -@itemx Thermal -@itemx Via -Select the indicated tool. - -@item Notify -Called when you press the mouse button, or move the mouse. - -@item Release -Called when you release the mouse button. - -@item Cancel -Cancels any pending tool activity, allowing you to restart elsewhere. -For example, this allows you to start a new line rather than attach a -line to the previous line. - -@item Escape -Similar to Cancel but calling this action a second time will return -to the Arrow tool. - -@item Stroke -If your @code{pcb} was built with libstroke, this invokes the stroke -input method. If not, this will restart a drawing mode if you were -drawing, else it will select objects. - -@item Save -Remembers the current tool. - -@item Restore -Restores the tool to the last saved tool. - -@end table - -%end-doc */ - -static int ActionMode(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - - if (function) { - Note.X = Crosshair.X; - Note.Y = Crosshair.Y; - notify_crosshair_change(pcb_false); - switch (funchash_get(function, NULL)) { - case F_Arc: - SetMode(PCB_MODE_ARC); - break; - case F_Arrow: - SetMode(PCB_MODE_ARROW); - break; - case F_Copy: - SetMode(PCB_MODE_COPY); - break; - case F_InsertPoint: - SetMode(PCB_MODE_INSERT_POINT); - break; - case F_Line: - SetMode(PCB_MODE_LINE); - break; - case F_Lock: - SetMode(PCB_MODE_LOCK); - break; - case F_Move: - SetMode(PCB_MODE_MOVE); - break; - case F_None: - SetMode(PCB_MODE_NO); - break; - case F_Cancel: - { - int saved_mode = conf_core.editor.mode; - SetMode(PCB_MODE_NO); - SetMode(saved_mode); - } - break; - case F_Escape: - { - switch (conf_core.editor.mode) { - case PCB_MODE_VIA: - case PCB_MODE_PASTE_BUFFER: - case PCB_MODE_TEXT: - case PCB_MODE_ROTATE: - case PCB_MODE_REMOVE: - case PCB_MODE_MOVE: - case PCB_MODE_COPY: - case PCB_MODE_INSERT_POINT: - case PCB_MODE_RUBBERBAND_MOVE: - case PCB_MODE_THERMAL: - case PCB_MODE_LOCK: - SetMode(PCB_MODE_NO); - SetMode(PCB_MODE_ARROW); - break; - - case PCB_MODE_LINE: - if (Crosshair.AttachedLine.State == STATE_FIRST) - SetMode(PCB_MODE_ARROW); - else { - SetMode(PCB_MODE_NO); - SetMode(PCB_MODE_LINE); - } - break; - - case PCB_MODE_RECTANGLE: - if (Crosshair.AttachedBox.State == STATE_FIRST) - SetMode(PCB_MODE_ARROW); - else { - SetMode(PCB_MODE_NO); - SetMode(PCB_MODE_RECTANGLE); - } - break; - - case PCB_MODE_POLYGON: - if (Crosshair.AttachedLine.State == STATE_FIRST) - SetMode(PCB_MODE_ARROW); - else { - SetMode(PCB_MODE_NO); - SetMode(PCB_MODE_POLYGON); - } - break; - - case PCB_MODE_POLYGON_HOLE: - if (Crosshair.AttachedLine.State == STATE_FIRST) - SetMode(PCB_MODE_ARROW); - else { - SetMode(PCB_MODE_NO); - SetMode(PCB_MODE_POLYGON_HOLE); - } - break; - - case PCB_MODE_ARC: - if (Crosshair.AttachedBox.State == STATE_FIRST) - SetMode(PCB_MODE_ARROW); - else { - SetMode(PCB_MODE_NO); - SetMode(PCB_MODE_ARC); - } - break; - - case PCB_MODE_ARROW: - break; - - default: - break; - } - } - break; - - case F_Notify: - NotifyMode(); - break; - case F_PasteBuffer: - SetMode(PCB_MODE_PASTE_BUFFER); - break; - case F_Polygon: - SetMode(PCB_MODE_POLYGON); - break; - case F_PolygonHole: - SetMode(PCB_MODE_POLYGON_HOLE); - break; - case F_Release: - if ((mid_stroke) && (conf_core.editor.enable_stroke)) - stub_stroke_finish(); - else - ReleaseMode(); - break; - case F_Remove: - SetMode(PCB_MODE_REMOVE); - break; - case F_Rectangle: - SetMode(PCB_MODE_RECTANGLE); - break; - case F_Rotate: - SetMode(PCB_MODE_ROTATE); - break; - case F_Stroke: - if (conf_core.editor.enable_stroke) { - stub_stroke_start(); - break; - } - /* Handle middle mouse button restarts of drawing mode. If not in - | a drawing mode, middle mouse button will select objects. - */ - if (conf_core.editor.mode == PCB_MODE_LINE && Crosshair.AttachedLine.State != STATE_FIRST) { - SetMode(PCB_MODE_LINE); - } - else if (conf_core.editor.mode == PCB_MODE_ARC && Crosshair.AttachedBox.State != STATE_FIRST) - SetMode(PCB_MODE_ARC); - else if (conf_core.editor.mode == PCB_MODE_RECTANGLE && Crosshair.AttachedBox.State != STATE_FIRST) - SetMode(PCB_MODE_RECTANGLE); - else if (conf_core.editor.mode == PCB_MODE_POLYGON && Crosshair.AttachedLine.State != STATE_FIRST) - SetMode(PCB_MODE_POLYGON); - else { - SaveMode(); - saved_mode = pcb_true; - SetMode(PCB_MODE_ARROW); - NotifyMode(); - } - break; - case F_Text: - SetMode(PCB_MODE_TEXT); - break; - case F_Thermal: - SetMode(PCB_MODE_THERMAL); - break; - case F_Via: - SetMode(PCB_MODE_VIA); - break; - - case F_Restore: /* restore the last saved mode */ - RestoreMode(); - break; - - case F_Save: /* save currently selected mode */ - SaveMode(); - break; - } - notify_crosshair_change(pcb_true); - return 0; - } - - AFAIL(mode); -} - -/* ---------------------------------------------------------------- */ -static const char cycledrag_syntax[] = "CycleDrag()\n"; - -static const char cycledrag_help[] = "Cycle through which object is being dragged"; - -#define close_enough(a, b) ((((a)-(b)) > 0) ? ((a)-(b) < (SLOP * pixel_slop)) : ((a)-(b) > -(SLOP * pixel_slop))) -static int ActionCycleDrag(int argc, const char **argv, Coord x, Coord y) -{ - void *ptr1, *ptr2, *ptr3; - int over = 0; - - if (Crosshair.drags == NULL) - return 0; - - do { - Crosshair.drags_current++; - if (Crosshair.drags_current >= Crosshair.drags_len) { - Crosshair.drags_current = 0; - over++; - } - - if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_LINE) != PCB_TYPE_NONE) { - /* line has two endpoints, check which one is close to the original x;y */ - LineType *l = ptr2; - if (close_enough(Note.X, l->Point1.X) && close_enough(Note.Y, l->Point1.Y)) { - Crosshair.AttachedObject.Type = PCB_TYPE_LINE_POINT; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = &l->Point1; - return 0; - } - if (close_enough(Note.X, l->Point2.X) && close_enough(Note.Y, l->Point2.Y)) { - Crosshair.AttachedObject.Type = PCB_TYPE_LINE_POINT; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = &l->Point2; - return 0; - } - } - else if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_VIA) != PCB_TYPE_NONE) { - Crosshair.AttachedObject.Type = PCB_TYPE_VIA; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = ptr3; - return 0; - } - else if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_PAD) != PCB_TYPE_NONE) { - Crosshair.AttachedObject.Type = PCB_TYPE_ELEMENT; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr1; - Crosshair.AttachedObject.Ptr3 = ptr1; - return 0; - } - else if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_ARC) != PCB_TYPE_NONE) { - Crosshair.AttachedObject.Type = PCB_TYPE_ARC; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = ptr3; - return 0; - } - - } while (over <= 1); - - return -1; -} - -#undef close_enough - -/* -------------------------------------------------------------------------- */ - -static const char message_syntax[] = "Message(message)"; - -static const char message_help[] = "Writes a message to the log window."; - -/* %start-doc actions Message - -This action displays a message to the log window. This action is primarily -provided for use by other programs which may interface with PCB. If -multiple arguments are given, each one is sent to the log window -followed by a newline. - -%end-doc */ - -static int ActionMessage(int argc, const char **argv, Coord x, Coord y) -{ - int i; - - if (argc < 1) - AFAIL(message); - - for (i = 0; i < argc; i++) { - Message(PCB_MSG_DEFAULT, argv[i]); - Message(PCB_MSG_DEFAULT, "\n"); - } - - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char togglehidename_syntax[] = "ToggleHideName(Object|SelectedElements)"; - -static const char togglehidename_help[] = "Toggles the visibility of element names."; - -/* %start-doc actions ToggleHideName - -If names are hidden you won't see them on the screen and they will not -appear on the silk layer when you print the layout. - -%end-doc */ - -static int ActionToggleHideName(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function && PCB->ElementOn) { - switch (funchash_get(function, NULL)) { - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { - AddObjectToFlagUndoList(type, ptr1, ptr2, ptr3); - EraseElementName((ElementTypePtr) ptr2); - TOGGLE_FLAG(PCB_FLAG_HIDENAME, (ElementTypePtr) ptr2); - DrawElementName((ElementTypePtr) ptr2); - Draw(); - IncrementUndoSerialNumber(); - } - break; - } - case F_SelectedElements: - case F_Selected: - { - pcb_bool changed = pcb_false; - ELEMENT_LOOP(PCB->Data); - { - if ((TEST_FLAG(PCB_FLAG_SELECTED, element) || TEST_FLAG(PCB_FLAG_SELECTED, &NAMEONPCB_TEXT(element))) - && (FRONT(element) || PCB->InvisibleObjectsOn)) { - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT, element, element, element); - EraseElementName(element); - TOGGLE_FLAG(PCB_FLAG_HIDENAME, element); - DrawElementName(element); - changed = pcb_true; - } - } - END_LOOP; - if (changed) { - Draw(); - IncrementUndoSerialNumber(); - } - } - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char markcrosshair_syntax[] = "MarkCrosshair()\n" "MarkCrosshair(Center)"; - -static const char markcrosshair_help[] = "Set/Reset the Crosshair mark."; - -/* %start-doc actions MarkCrosshair - -The ``mark'' is a small X-shaped target on the display which is -treated like a second origin (the normal origin is the upper let -corner of the board). The GUI will display a second set of -coordinates for this mark, which tells you how far you are from it. - -If no argument is given, the mark is toggled - disabled if it was -enabled, or enabled at the current cursor position of disabled. If -the @code{Center} argument is given, the mark is moved to the current -cursor location. - -%end-doc */ - -static int ActionMarkCrosshair(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (!function || !*function) { - if (Marked.status) { - notify_mark_change(pcb_false); - Marked.status = pcb_false; - notify_mark_change(pcb_true); - } - else { - notify_mark_change(pcb_false); - Marked.status = pcb_false; - Marked.status = pcb_true; - Marked.X = Crosshair.X; - Marked.Y = Crosshair.Y; - notify_mark_change(pcb_true); - } - } - else if (funchash_get(function, NULL) == F_Center) { - notify_mark_change(pcb_false); - Marked.status = pcb_true; - Marked.X = Crosshair.X; - Marked.Y = Crosshair.Y; - notify_mark_change(pcb_true); - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char routestyle_syntax[] = "RouteStyle(1|2|3|4)"; - -static const char routestyle_help[] = "Copies the indicated routing style into the current sizes."; - -/* %start-doc actions RouteStyle - -%end-doc */ - -static int ActionRouteStyle(int argc, const char **argv, Coord x, Coord y) -{ - const char *str = ACTION_ARG(0); - RouteStyleType *rts; - int number; - - if (str) { - char *end; - number = strtol(str, &end, 10); - - if (*end != '\0') { /* if not an integer, find by name */ - int n; - number = -1; - for(n = 0; n < vtroutestyle_len(&PCB->RouteStyle); n++) { - rts = &PCB->RouteStyle.array[n]; - if (strcasecmp(rts->name, str) == 0) { - number = n + 1; - break; - } - } - } - - if (number > 0 && number <= vtroutestyle_len(&PCB->RouteStyle)) { - rts = &PCB->RouteStyle.array[number - 1]; - SetLineSize(rts->Thick); - SetViaSize(rts->Diameter, pcb_true); - SetViaDrillingHole(rts->Hole, pcb_true); - SetClearanceWidth(rts->Clearance); - hid_action("RouteStylesChanged"); - } - else - Message(PCB_MSG_DEFAULT, "Error: invalid route style name or index\n"); - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char createmenu_syntax[] = "CreateMenu(path | path, action, mnemonic, accel, tooltip, cookie)"; -static const char createmenu_help[] = "Creates a new menu, popup (only path specified) or submenu (at least path and action are specified)"; - -/* %start-doc actions RouteStyle - -%end-doc */ - -static int ActionCreateMenu(int argc, const char **argv, Coord x, Coord y) -{ - if (gui == NULL) { - Message(PCB_MSG_DEFAULT, "Error: can't create menu, there's no GUI hid loaded\n"); - return 1; - } - - if (argc > 0) { - gui->create_menu(argv[0], (argc > 1) ? argv[1] : NULL, (argc > 2) ? argv[2] : NULL, (argc > 3) ? argv[3] : NULL, (argc > 4) ? argv[4] : NULL, (argc > 5) ? argv[5] : NULL); - return 0; - } - - AFAIL(message); -} - -/* --------------------------------------------------------------------------- */ - -static const char removemenu_syntax[] = "RemoveMenu(path|cookie)"; -static const char removemenu_help[] = "Recursively removes a new menu, popup (only path specified) or submenu. "; - -/* %start-doc actions RouteStyle - -%end-doc */ - -static int ActionRemoveMenu(int argc, const char **argv, Coord x, Coord y) -{ - if (gui == NULL) { - Message(PCB_MSG_ERROR, "can't remove menu, there's no GUI hid loaded\n"); - return 1; - } - - if (gui->remove_menu == NULL) { - Message(PCB_MSG_ERROR, "can't remove menu, the GUI doesn't support it\n"); - return 1; - } - - if (argc > 0) { - if (gui->remove_menu(argv[0]) != 0) - Message(PCB_MSG_ERROR, "failed to remove some of the menu items\n"); - return 0; - } - - AFAIL(message); -} - -/* --------------------------------------------------------------------------- */ - -static const char setsame_syntax[] = "SetSame()"; - -static const char setsame_help[] = "Sets current layer and sizes to match indicated item."; - -/* %start-doc actions SetSame - -When invoked over any line, arc, polygon, or via, this changes the -current layer to be the layer that item is on, and changes the current -sizes (thickness, clearance, drill, etc) according to that item. - -%end-doc */ -static void set_same_(Coord Thick, Coord Diameter, Coord Hole, Coord Clearance, char *Name) -{ - int known; - known = pcb_route_style_lookup(&PCB->RouteStyle, Thick, Diameter, Hole, Clearance, Name); - if (known < 0) { - /* unknown style, set properties */ - if (Thick != 0) { pcb_custom_route_style.Thick = Thick; conf_set_design("design/line_thickness", "%$mS", Thick); } - if (Clearance != 0) { pcb_custom_route_style.Clearance = Clearance; conf_set_design("design/clearance", "%$mS", Clearance); } - if (Diameter != 0) { pcb_custom_route_style.Diameter = Diameter; conf_set_design("design/via_thickness", "%$mS", Diameter); } - if (Hole != 0) { pcb_custom_route_style.Hole = Hole; conf_set_design("design/via_drilling_hole", "%$mS", Hole); } - } - else - pcb_use_route_style_idx(&PCB->RouteStyle, known); -} - -static int ActionSetSame(int argc, const char **argv, Coord x, Coord y) -{ - void *ptr1, *ptr2, *ptr3; - int type; - LayerTypePtr layer = CURRENT; - - type = SearchScreen(x, y, CLONE_TYPES, &ptr1, &ptr2, &ptr3); -/* set layer current and size from line or arc */ - switch (type) { - case PCB_TYPE_LINE: - notify_crosshair_change(pcb_false); - set_same_(((LineTypePtr) ptr2)->Thickness, 0, 0, ((LineTypePtr) ptr2)->Clearance / 2, NULL); - layer = (LayerTypePtr) ptr1; - if (conf_core.editor.mode != PCB_MODE_LINE) - SetMode(PCB_MODE_LINE); - notify_crosshair_change(pcb_true); - hid_action("RouteStylesChanged"); - break; - - case PCB_TYPE_ARC: - notify_crosshair_change(pcb_false); - set_same_(((ArcTypePtr) ptr2)->Thickness, 0, 0, ((ArcTypePtr) ptr2)->Clearance / 2, NULL); - layer = (LayerTypePtr) ptr1; - if (conf_core.editor.mode != PCB_MODE_ARC) - SetMode(PCB_MODE_ARC); - notify_crosshair_change(pcb_true); - hid_action("RouteStylesChanged"); - break; - - case PCB_TYPE_POLYGON: - layer = (LayerTypePtr) ptr1; - break; - - case PCB_TYPE_VIA: - notify_crosshair_change(pcb_false); - set_same_(0, ((PinTypePtr) ptr2)->Thickness, ((PinTypePtr) ptr2)->DrillingHole, ((PinTypePtr) ptr2)->Clearance / 2, NULL); - if (conf_core.editor.mode != PCB_MODE_VIA) - SetMode(PCB_MODE_VIA); - notify_crosshair_change(pcb_true); - hid_action("RouteStylesChanged"); - break; - - default: - return 1; - } - if (layer != CURRENT) { - ChangeGroupVisibility(GetLayerNumber(PCB->Data, layer), pcb_true, pcb_true); - Redraw(); - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char switchhid_syntax[] = "SwitchHID(lesstif|gtk|batch)"; - -static const char switchhid_help[] = "Switch to another HID."; - -/* %start-doc actions SwitchHID - -Switch to another HID. - -%end-doc */ - -static int ActionSwitchHID(int argc, const char **argv, Coord x, Coord y) -{ - HID *ng = hid_find_gui(argv[0]); - int chg; - - if (ng == NULL) { - Message(PCB_MSG_DEFAULT, "No such HID."); - return 1; - } - - next_gui = ng; - chg = PCB->Changed; - QuitApplication(); - PCB->Changed = chg; - - return 0; -} - - -/* --------------------------------------------------------------------------- */ - -/* This action is provided for CLI convience */ -static const char fullscreen_syntax[] = "FullScreen(on|off|toggle)\n"; - -static const char fullscreen_help[] = "Hide widgets to get edit area full screen"; - -static int FullScreen(int argc, const char **argv, Coord x, Coord y) -{ - const char *op = argv == NULL ? NULL : argv[0]; - - if ((op == NULL) || (strcmp(op, "toggle") == 0)) - conf_setf(CFR_DESIGN, "editor/fullscreen", -1, "%d", !conf_core.editor.fullscreen, POL_OVERWRITE); - else if (strcmp(op, "on") == 0) - conf_set(CFR_DESIGN, "editor/fullscreen", -1, "1", POL_OVERWRITE); - else if (strcmp(op, "off") == 0) - conf_set(CFR_DESIGN, "editor/fullscreen", -1, "0", POL_OVERWRITE); - - - return 0; -} - - - -HID_Action gui_action_list[] = { - {"Display", 0, ActionDisplay, - display_help, display_syntax} - , - {"CycleDrag", 0, ActionCycleDrag, - cycledrag_help, cycledrag_syntax} - , - {"FullScreen", 0, FullScreen, fullscreen_help, fullscreen_syntax} - , - {"MarkCrosshair", 0, ActionMarkCrosshair, - markcrosshair_help, markcrosshair_syntax} - , - {"Message", 0, ActionMessage, - message_help, message_syntax} - , - {"Mode", 0, ActionMode, - mode_help, mode_syntax} - , - {"ToggleHideName", 0, ActionToggleHideName, - togglehidename_help, togglehidename_syntax} - , - {"SetSame", N_("Select item to use attributes from"), ActionSetSame, - setsame_help, setsame_syntax} - , - {"RouteStyle", 0, ActionRouteStyle, - routestyle_help, routestyle_syntax} - , - {"CreateMenu", 0, ActionCreateMenu, - createmenu_help, createmenu_syntax} - , - {"RemoveMenu", 0, ActionRemoveMenu, - removemenu_help, removemenu_syntax} - , - {"SwitchHID", 0, ActionSwitchHID, - switchhid_help, switchhid_syntax} -}; - -REGISTER_ACTIONS(gui_action_list, NULL) Index: 1.1.4/src/vtlibrary.c =================================================================== --- 1.1.4/src/vtlibrary.c (revision 10776) +++ 1.1.4/src/vtlibrary.c (nonexistent) @@ -1,3 +0,0 @@ -#define GVT_DONT_UNDEF -#include "vtlibrary.h" -#include Index: 1.1.4/src/polygon_act.c =================================================================== --- 1.1.4/src/polygon_act.c (revision 10776) +++ 1.1.4/src/polygon_act.c (nonexistent) @@ -1,144 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" - -#include "data.h" -#include "action_helper.h" -#include "undo.h" -#include "funchash_core.h" - -#include "polygon.h" -#include "draw.h" -#include "search.h" -#include "crosshair.h" - -/* --------------------------------------------------------------------------- */ - -static const char morphpolygon_syntax[] = "MorphPolygon(Object|Selected)"; - -static const char morphpolygon_help[] = "Converts dead polygon islands into separate polygons."; - -/* %start-doc actions MorphPolygon - -If a polygon is divided into unconnected "islands", you can use -this command to convert the otherwise disappeared islands into -separate polygons. Be sure the cursor is over a portion of the -polygon that remains visible. Very small islands that may flake -off are automatically deleted. - -%end-doc */ - -static int ActionMorphPolygon(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, PCB_TYPE_POLYGON, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { - MorphPolygon((LayerType *) ptr1, (PolygonType *) ptr3); - Draw(); - IncrementUndoSerialNumber(); - } - break; - } - case F_Selected: - case F_SelectedObjects: - ALLPOLYGON_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, polygon)) - MorphPolygon(layer, polygon); - } - ENDALL_LOOP; - Draw(); - IncrementUndoSerialNumber(); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char polygon_syntax[] = "Polygon(Close|PreviousPoint)"; - -static const char polygon_help[] = "Some polygon related stuff."; - -/* %start-doc actions Polygon - -Polygons need a special action routine to make life easier. - -@table @code - -@item Close -Creates the final segment of the polygon. This may fail if clipping -to 45 degree lines is switched on, in which case a warning is issued. - -@item PreviousPoint -Resets the newly entered corner to the previous one. The Undo action -will call Polygon(PreviousPoint) when appropriate to do so. - -@end table - -%end-doc */ - -static int ActionPolygon(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function && conf_core.editor.mode == PCB_MODE_POLYGON) { - notify_crosshair_change(pcb_false); - switch (funchash_get(function, NULL)) { - /* close open polygon if possible */ - case F_Close: - ClosePolygon(); - break; - - /* go back to the previous point */ - case F_PreviousPoint: - GoToPreviousPoint(); - break; - } - notify_crosshair_change(pcb_true); - } - return 0; -} - - -HID_Action polygon_action_list[] = { - {"MorphPolygon", 0, ActionMorphPolygon, - morphpolygon_help, morphpolygon_syntax} - , - {"Polygon", 0, ActionPolygon, - polygon_help, polygon_syntax} -}; - -REGISTER_ACTIONS(polygon_action_list, NULL) Index: 1.1.4/src/list_poly.c =================================================================== --- 1.1.4/src/list_poly.c (revision 10776) +++ 1.1.4/src/list_poly.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define TDL_DONT_UNDEF -#include "global_objs.h" -#include "list_poly.h" -#include Index: 1.1.4/src/select.c =================================================================== --- 1.1.4/src/select.c (revision 10776) +++ 1.1.4/src/select.c (nonexistent) @@ -1,964 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* select routines - */ - -#include "config.h" -#include "conf_core.h" - -#include "data.h" -#include "draw.h" -#include "error.h" -#include "search.h" -#include "select.h" -#include "undo.h" -#include "rats.h" -#include "misc.h" -#include "find.h" -#include "layer.h" -#include "compat_misc.h" - -#include - -void pcb_select_element(ElementType *element, pcb_change_flag_t how, int redraw) -{ - /* select all pins and names of the element */ - PIN_LOOP(element); - { - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - CHANGE_FLAG(how, PCB_FLAG_SELECTED, pin); - } - END_LOOP; - PAD_LOOP(element); - { - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - CHANGE_FLAG(how, PCB_FLAG_SELECTED, pad); - } - END_LOOP; - ELEMENTTEXT_LOOP(element); - { - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT_NAME, element, text, text); - CHANGE_FLAG(how, PCB_FLAG_SELECTED, text); - } - END_LOOP; - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT, element, element, element); - CHANGE_FLAG(how, PCB_FLAG_SELECTED, element); - - if (redraw) { - if (PCB->ElementOn && ((TEST_FLAG(PCB_FLAG_ONSOLDER, element) != 0) == SWAP_IDENT || PCB->InvisibleObjectsOn)) - if (PCB->ElementOn) { - DrawElementName(element); - DrawElementPackage(element); - } - if (PCB->PinOn) - DrawElementPinsAndPads(element); - } -} - -void pcb_select_element_name(ElementType *element, pcb_change_flag_t how, int redraw) -{ - /* select all names of the element */ - ELEMENTTEXT_LOOP(element); - { - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT_NAME, element, text, text); - CHANGE_FLAG(how, PCB_FLAG_SELECTED, text); - } - END_LOOP; - - if (redraw) - DrawElementName(element); -} - - -/* --------------------------------------------------------------------------- - * toggles the selection of any kind of object - * the different types are defined by search.h - */ -pcb_bool SelectObject(void) -{ - void *ptr1, *ptr2, *ptr3; - LayerTypePtr layer; - int type; - - pcb_bool changed = pcb_true; - - type = SearchScreen(Crosshair.X, Crosshair.Y, SELECT_TYPES, &ptr1, &ptr2, &ptr3); - if (type == PCB_TYPE_NONE || TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) - return (pcb_false); - switch (type) { - case PCB_TYPE_VIA: - AddObjectToFlagUndoList(PCB_TYPE_VIA, ptr1, ptr1, ptr1); - TOGGLE_FLAG(PCB_FLAG_SELECTED, (PinTypePtr) ptr1); - DrawVia((PinTypePtr) ptr1); - break; - - case PCB_TYPE_LINE: - { - LineType *line = (LineTypePtr) ptr2; - - layer = (LayerTypePtr) ptr1; - AddObjectToFlagUndoList(PCB_TYPE_LINE, ptr1, ptr2, ptr2); - TOGGLE_FLAG(PCB_FLAG_SELECTED, line); - DrawLine(layer, line); - break; - } - - case PCB_TYPE_RATLINE: - { - RatTypePtr rat = (RatTypePtr) ptr2; - - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, ptr1, ptr1, ptr1); - TOGGLE_FLAG(PCB_FLAG_SELECTED, rat); - DrawRat(rat); - break; - } - - case PCB_TYPE_ARC: - { - ArcType *arc = (ArcTypePtr) ptr2; - - layer = (LayerTypePtr) ptr1; - AddObjectToFlagUndoList(PCB_TYPE_ARC, ptr1, ptr2, ptr2); - TOGGLE_FLAG(PCB_FLAG_SELECTED, arc); - DrawArc(layer, arc); - break; - } - - case PCB_TYPE_TEXT: - { - TextType *text = (TextTypePtr) ptr2; - - layer = (LayerTypePtr) ptr1; - AddObjectToFlagUndoList(PCB_TYPE_TEXT, ptr1, ptr2, ptr2); - TOGGLE_FLAG(PCB_FLAG_SELECTED, text); - DrawText(layer, text); - break; - } - - case PCB_TYPE_POLYGON: - { - PolygonType *poly = (PolygonTypePtr) ptr2; - - layer = (LayerTypePtr) ptr1; - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, ptr1, ptr2, ptr2); - TOGGLE_FLAG(PCB_FLAG_SELECTED, poly); - DrawPolygon(layer, poly); - /* changing memory order no longer effects draw order */ - break; - } - - case PCB_TYPE_PIN: - AddObjectToFlagUndoList(PCB_TYPE_PIN, ptr1, ptr2, ptr2); - TOGGLE_FLAG(PCB_FLAG_SELECTED, (PinTypePtr) ptr2); - DrawPin((PinTypePtr) ptr2); - break; - - case PCB_TYPE_PAD: - AddObjectToFlagUndoList(PCB_TYPE_PAD, ptr1, ptr2, ptr2); - TOGGLE_FLAG(PCB_FLAG_SELECTED, (PadTypePtr) ptr2); - DrawPad((PadTypePtr) ptr2); - break; - - case PCB_TYPE_ELEMENT_NAME: - pcb_select_element_name((ElementType *) ptr1, PCB_CHGFLG_TOGGLE, 1); - break; - - case PCB_TYPE_ELEMENT: - pcb_select_element((ElementType *) ptr1, PCB_CHGFLG_TOGGLE, 1); - break; - } - Draw(); - IncrementUndoSerialNumber(); - return (changed); -} - -/* ---------------------------------------------------------------------- - * selects/unselects or lists visible objects within the passed box - * If len is NULL: - * Flag determines if the block is to be selected or unselected - * returns non-NULL if the state of any object has changed - * if len is non-NULL: - * returns a list of object IDs matched the search and loads len with the - * length of the list. Returns NULL on no match. - */ -static long int *ListBlock_(BoxTypePtr Box, pcb_bool Flag, int *len) -{ - int changed = 0; - int used = 0, alloced = 0; - long int *list = NULL; - -/* append an object to the return list OR set the flag if there's no list */ -#define append(undo_type, p1, obj) \ -do { \ - if (len == NULL) { \ - AddObjectToFlagUndoList (undo_type, p1, obj, obj); \ - ASSIGN_FLAG (PCB_FLAG_SELECTED, Flag, obj); \ - } \ - else { \ - if (used >= alloced) { \ - alloced += 64; \ - list = realloc(list, sizeof(*list) * alloced); \ - } \ - list[used] = obj->ID; \ - used++; \ - } \ - changed = 1; \ -} while(0) - - if (IS_BOX_NEGATIVE(Box) && ((Box->X1 == Box->X2) || (Box->Y2 == Box->Y1))) { - if (len != NULL) - *len = 0; - return NULL; - } - - if (PCB->RatOn || !Flag) - RAT_LOOP(PCB->Data); - { - if (LINE_NEAR_BOX((LineTypePtr) line, Box) && !TEST_FLAG(PCB_FLAG_LOCK, line) && TEST_FLAG(PCB_FLAG_SELECTED, line) != Flag) { - append(PCB_TYPE_RATLINE, line, line); - if (PCB->RatOn) - DrawRat(line); - } - } - END_LOOP; - - /* check layers */ - LAYER_LOOP(PCB->Data, max_copper_layer + 2); - { - if (layer == &PCB->Data->SILKLAYER) { - if (!(PCB->ElementOn || !Flag)) - continue; - } - else if (layer == &PCB->Data->BACKSILKLAYER) { - if (!(PCB->InvisibleObjectsOn || !Flag)) - continue; - } - else if (!(layer->On || !Flag)) - continue; - - LINE_LOOP(layer); - { - if (LINE_NEAR_BOX(line, Box) - && !TEST_FLAG(PCB_FLAG_LOCK, line) - && TEST_FLAG(PCB_FLAG_SELECTED, line) != Flag) { - append(PCB_TYPE_LINE, layer, line); - if (layer->On) - DrawLine(layer, line); - } - } - END_LOOP; - ARC_LOOP(layer); - { - if (ARC_NEAR_BOX(arc, Box) - && !TEST_FLAG(PCB_FLAG_LOCK, arc) - && TEST_FLAG(PCB_FLAG_SELECTED, arc) != Flag) { - append(PCB_TYPE_ARC, layer, arc); - if (layer->On) - DrawArc(layer, arc); - } - } - END_LOOP; - TEXT_LOOP(layer); - { - if (!Flag || TEXT_IS_VISIBLE(PCB, layer, text)) { - if (TEXT_NEAR_BOX(text, Box) - && !TEST_FLAG(PCB_FLAG_LOCK, text) - && TEST_FLAG(PCB_FLAG_SELECTED, text) != Flag) { - append(PCB_TYPE_TEXT, layer, text); - if (TEXT_IS_VISIBLE(PCB, layer, text)) - DrawText(layer, text); - } - } - } - END_LOOP; - POLYGON_LOOP(layer); - { - if (POLYGON_NEAR_BOX(polygon, Box) - && !TEST_FLAG(PCB_FLAG_LOCK, polygon) - && TEST_FLAG(PCB_FLAG_SELECTED, polygon) != Flag) { - append(PCB_TYPE_POLYGON, layer, polygon); - if (layer->On) - DrawPolygon(layer, polygon); - } - } - END_LOOP; - } - END_LOOP; - - /* elements */ - ELEMENT_LOOP(PCB->Data); - { - { - pcb_bool gotElement = pcb_false; - if ((PCB->ElementOn || !Flag) - && !TEST_FLAG(PCB_FLAG_LOCK, element) - && ((TEST_FLAG(PCB_FLAG_ONSOLDER, element) != 0) == SWAP_IDENT || PCB->InvisibleObjectsOn)) { - if (BOX_NEAR_BOX(&ELEMENT_TEXT(PCB, element).BoundingBox, Box) - && !TEST_FLAG(PCB_FLAG_LOCK, &ELEMENT_TEXT(PCB, element)) - && TEST_FLAG(PCB_FLAG_SELECTED, &ELEMENT_TEXT(PCB, element)) != Flag) { - /* select all names of element */ - ELEMENTTEXT_LOOP(element); - { - append(PCB_TYPE_ELEMENT_NAME, element, text); - } - END_LOOP; - if (PCB->ElementOn) - DrawElementName(element); - } - if ((PCB->PinOn || !Flag) && ELEMENT_NEAR_BOX(element, Box)) - if (TEST_FLAG(PCB_FLAG_SELECTED, element) != Flag) { - append(PCB_TYPE_ELEMENT, element, element); - PIN_LOOP(element); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, pin) != Flag) { - append(PCB_TYPE_PIN, element, pin); - if (PCB->PinOn) - DrawPin(pin); - } - } - END_LOOP; - PAD_LOOP(element); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, pad) != Flag) { - append(PCB_TYPE_PAD, element, pad); - if (PCB->PinOn) - DrawPad(pad); - } - } - END_LOOP; - if (PCB->PinOn) - DrawElement(element); - gotElement = pcb_true; - } - } - if ((PCB->PinOn || !Flag) && !TEST_FLAG(PCB_FLAG_LOCK, element) && !gotElement) { - PIN_LOOP(element); - { - if ((VIA_OR_PIN_NEAR_BOX(pin, Box) - && TEST_FLAG(PCB_FLAG_SELECTED, pin) != Flag)) { - append(PCB_TYPE_PIN, element, pin); - if (PCB->PinOn) - DrawPin(pin); - } - } - END_LOOP; - PAD_LOOP(element); - { - if (PAD_NEAR_BOX(pad, Box) - && TEST_FLAG(PCB_FLAG_SELECTED, pad) != Flag - && (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) == SWAP_IDENT || PCB->InvisibleObjectsOn || !Flag)) { - append(PCB_TYPE_PAD, element, pad); - if (PCB->PinOn) - DrawPad(pad); - } - } - END_LOOP; - } - } - } - END_LOOP; - /* end with vias */ - if (PCB->ViaOn || !Flag) - VIA_LOOP(PCB->Data); - { - if (VIA_OR_PIN_NEAR_BOX(via, Box) - && !TEST_FLAG(PCB_FLAG_LOCK, via) - && TEST_FLAG(PCB_FLAG_SELECTED, via) != Flag) { - append(PCB_TYPE_VIA, via, via); - if (PCB->ViaOn) - DrawVia(via); - } - } - END_LOOP; - - if (changed) { - Draw(); - IncrementUndoSerialNumber(); - } - - if (len == NULL) { - static long int non_zero; - return (changed ? &non_zero : NULL); - } - else { - *len = used; - return list; - } -} - -#undef append - -/* ---------------------------------------------------------------------- - * selects/unselects all visible objects within the passed box - * Flag determines if the block is to be selected or unselected - * returns pcb_true if the state of any object has changed - */ -pcb_bool SelectBlock(BoxTypePtr Box, pcb_bool Flag) -{ - /* do not list, set flag */ - return (ListBlock_(Box, Flag, NULL) == NULL) ? pcb_false : pcb_true; -} - -/* ---------------------------------------------------------------------- - * List all visible objects within the passed box - */ -long int *ListBlock(BoxTypePtr Box, int *len) -{ - return ListBlock_(Box, 1, len); -} - -/* ---------------------------------------------------------------------- - * performs several operations on the passed object - */ -void *ObjectOperation(ObjectFunctionTypePtr F, int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - switch (Type) { - case PCB_TYPE_LINE: - if (F->Line) - return (F->Line((LayerTypePtr) Ptr1, (LineTypePtr) Ptr2)); - break; - - case PCB_TYPE_ARC: - if (F->Arc) - return (F->Arc((LayerTypePtr) Ptr1, (ArcTypePtr) Ptr2)); - break; - - case PCB_TYPE_LINE_POINT: - if (F->LinePoint) - return (F->LinePoint((LayerTypePtr) Ptr1, (LineTypePtr) Ptr2, (PointTypePtr) Ptr3)); - break; - - case PCB_TYPE_TEXT: - if (F->Text) - return (F->Text((LayerTypePtr) Ptr1, (TextTypePtr) Ptr2)); - break; - - case PCB_TYPE_POLYGON: - if (F->Polygon) - return (F->Polygon((LayerTypePtr) Ptr1, (PolygonTypePtr) Ptr2)); - break; - - case PCB_TYPE_POLYGON_POINT: - if (F->Point) - return (F->Point((LayerTypePtr) Ptr1, (PolygonTypePtr) Ptr2, (PointTypePtr) Ptr3)); - break; - - case PCB_TYPE_VIA: - if (F->Via) - return (F->Via((PinTypePtr) Ptr1)); - break; - - case PCB_TYPE_ELEMENT: - if (F->Element) - return (F->Element((ElementTypePtr) Ptr1)); - break; - - case PCB_TYPE_PIN: - if (F->Pin) - return (F->Pin((ElementTypePtr) Ptr1, (PinTypePtr) Ptr2)); - break; - - case PCB_TYPE_PAD: - if (F->Pad) - return (F->Pad((ElementTypePtr) Ptr1, (PadTypePtr) Ptr2)); - break; - - case PCB_TYPE_ELEMENT_NAME: - if (F->ElementName) - return (F->ElementName((ElementTypePtr) Ptr1)); - break; - - case PCB_TYPE_RATLINE: - if (F->Rat) - return (F->Rat((RatTypePtr) Ptr1)); - break; - } - return (NULL); -} - -/* ---------------------------------------------------------------------- - * performs several operations on selected objects which are also visible - * The lowlevel procedures are passed together with additional information - * resets the selected flag if requested - * returns pcb_true if anything has changed - */ -pcb_bool SelectedOperation(ObjectFunctionTypePtr F, pcb_bool Reset, int type) -{ - pcb_bool changed = pcb_false; - - /* check lines */ - if (type & PCB_TYPE_LINE && F->Line) - VISIBLELINE_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, line)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_LINE, layer, line, line); - CLEAR_FLAG(PCB_FLAG_SELECTED, line); - } - F->Line(layer, line); - changed = pcb_true; - } - } - ENDALL_LOOP; - - /* check arcs */ - if (type & PCB_TYPE_ARC && F->Arc) - VISIBLEARC_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, arc)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_ARC, layer, arc, arc); - CLEAR_FLAG(PCB_FLAG_SELECTED, arc); - } - F->Arc(layer, arc); - changed = pcb_true; - } - } - ENDALL_LOOP; - - /* check text */ - if (type & PCB_TYPE_TEXT && F->Text) - ALLTEXT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, text) && TEXT_IS_VISIBLE(PCB, layer, text)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_TEXT, layer, text, text); - CLEAR_FLAG(PCB_FLAG_SELECTED, text); - } - F->Text(layer, text); - changed = pcb_true; - } - } - ENDALL_LOOP; - - /* check polygons */ - if (type & PCB_TYPE_POLYGON && F->Polygon) - VISIBLEPOLYGON_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, polygon)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, layer, polygon, polygon); - CLEAR_FLAG(PCB_FLAG_SELECTED, polygon); - } - F->Polygon(layer, polygon); - changed = pcb_true; - } - } - ENDALL_LOOP; - - /* elements silkscreen */ - if (type & PCB_TYPE_ELEMENT && PCB->ElementOn && F->Element) - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, element)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT, element, element, element); - CLEAR_FLAG(PCB_FLAG_SELECTED, element); - } - F->Element(element); - changed = pcb_true; - } - } - END_LOOP; - if (type & PCB_TYPE_ELEMENT_NAME && PCB->ElementOn && F->ElementName) - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, &ELEMENT_TEXT(PCB, element))) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT_NAME, element, &ELEMENT_TEXT(PCB, element), &ELEMENT_TEXT(PCB, element)); - CLEAR_FLAG(PCB_FLAG_SELECTED, &ELEMENT_TEXT(PCB, element)); - } - F->ElementName(element); - changed = pcb_true; - } - } - END_LOOP; - - if (type & PCB_TYPE_PIN && PCB->PinOn && F->Pin) - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, pin)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - CLEAR_FLAG(PCB_FLAG_SELECTED, pin); - } - F->Pin(element, pin); - changed = pcb_true; - } - } - END_LOOP; - } - END_LOOP; - - if (type & PCB_TYPE_PAD && PCB->PinOn && F->Pad) - ELEMENT_LOOP(PCB->Data); - { - PAD_LOOP(element); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, pad)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - CLEAR_FLAG(PCB_FLAG_SELECTED, pad); - } - F->Pad(element, pad); - changed = pcb_true; - } - } - END_LOOP; - } - END_LOOP; - - /* process vias */ - if (type & PCB_TYPE_VIA && PCB->ViaOn && F->Via) - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, via)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); - CLEAR_FLAG(PCB_FLAG_SELECTED, via); - } - F->Via(via); - changed = pcb_true; - } - } - END_LOOP; - /* and rat-lines */ - if (type & PCB_TYPE_RATLINE && PCB->RatOn && F->Rat) - RAT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, line)) { - if (Reset) { - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, line, line, line); - CLEAR_FLAG(PCB_FLAG_SELECTED, line); - } - F->Rat(line); - changed = pcb_true; - } - } - END_LOOP; - if (Reset && changed) - IncrementUndoSerialNumber(); - return (changed); -} - -/* ---------------------------------------------------------------------- - * selects/unselects all objects which were found during a connection scan - * Flag determines if they are to be selected or unselected - * returns pcb_true if the state of any object has changed - * - * text objects and elements cannot be selected by this routine - */ -pcb_bool SelectConnection(pcb_bool Flag) -{ - pcb_bool changed = pcb_false; - - if (PCB->RatOn) - RAT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, line)) { - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, line, line, line); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, line); - DrawRat(line); - changed = pcb_true; - } - } - END_LOOP; - - VISIBLELINE_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, line) && !TEST_FLAG(PCB_FLAG_LOCK, line)) { - AddObjectToFlagUndoList(PCB_TYPE_LINE, layer, line, line); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, line); - DrawLine(layer, line); - changed = pcb_true; - } - } - ENDALL_LOOP; - VISIBLEARC_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, arc) && !TEST_FLAG(PCB_FLAG_LOCK, arc)) { - AddObjectToFlagUndoList(PCB_TYPE_ARC, layer, arc, arc); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, arc); - DrawArc(layer, arc); - changed = pcb_true; - } - } - ENDALL_LOOP; - VISIBLEPOLYGON_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, polygon) && !TEST_FLAG(PCB_FLAG_LOCK, polygon)) { - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, layer, polygon, polygon); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, polygon); - DrawPolygon(layer, polygon); - changed = pcb_true; - } - } - ENDALL_LOOP; - - if (PCB->PinOn && PCB->ElementOn) { - ALLPIN_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_LOCK, element) && TEST_FLAG(PCB_FLAG_FOUND, pin)) { - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, pin); - DrawPin(pin); - changed = pcb_true; - } - } - ENDALL_LOOP; - ALLPAD_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_LOCK, element) && TEST_FLAG(PCB_FLAG_FOUND, pad)) { - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, pad); - DrawPad(pad); - changed = pcb_true; - } - } - ENDALL_LOOP; - } - - if (PCB->ViaOn) - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, via) && !TEST_FLAG(PCB_FLAG_LOCK, via)) { - AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, via); - DrawVia(via); - changed = pcb_true; - } - } - END_LOOP; - return (changed); -} - -/* --------------------------------------------------------------------------- - * selects objects as defined by Type by name; - * it's a case insensitive match - * returns pcb_true if any object has been selected - */ -#define REGEXEC(arg) \ - (method == SM_REGEX ? regexec_match_all(regex, (arg)) : strlst_match(pat, (arg))) - -static int regexec_match_all(re_sei_t *preg, const char *string) -{ - return !!re_sei_exec(preg, string); -} - -/* case insensitive match of each element in the array pat against name - returns 1 if any of them matched */ -static int strlst_match(const char **pat, const char *name) -{ - for (; *pat != NULL; pat++) - if (strcasecmp(*pat, name) == 0) - return 1; - return 0; -} - -pcb_bool SelectObjectByName(int Type, const char *name_pattern, pcb_bool Flag, search_method_t method) -{ - pcb_bool changed = pcb_false; - const char **pat = NULL; - char *pattern_copy = NULL; - re_sei_t *regex; - - if (method == SM_REGEX) { - /* compile the regular expression */ - regex = re_sei_comp(name_pattern); - if (re_sei_errno(regex) != 0) { - Message(PCB_MSG_DEFAULT, _("regexp error: %s\n"), re_error_str(re_sei_errno(regex))); - re_sei_free(regex); - return (pcb_false); - } - } - else { - char *s, *next; - int n, w; - - /* We're going to mess with the delimiters. Create a copy. */ - pattern_copy = pcb_strdup(name_pattern); - - /* count the number of patterns */ - for (s = pattern_copy, w = 0; *s != '\0'; s++) { - if (*s == '|') - w++; - } - - pat = malloc((w + 2) * sizeof(char *)); /* make room for the NULL too */ - for (s = pattern_copy, n = 0; s != NULL; s = next) { - char *end; -/*fprintf(stderr, "S: '%s'\n", s, next);*/ - while (isspace(*s)) - s++; - next = strchr(s, '|'); - if (next != NULL) { - *next = '\0'; - next++; - } - end = s + strlen(s) - 1; - while ((end >= s) && (isspace(*end))) { - *end = '\0'; - end--; - } - if (*s != '\0') { - pat[n] = s; - n++; - } - } - pat[n] = NULL; - } - - /* loop over all visible objects with names */ - if (Type & PCB_TYPE_TEXT) - ALLTEXT_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_LOCK, text) - && TEXT_IS_VISIBLE(PCB, layer, text) - && text->TextString && REGEXEC(text->TextString) - && TEST_FLAG(PCB_FLAG_SELECTED, text) != Flag) { - AddObjectToFlagUndoList(PCB_TYPE_TEXT, layer, text, text); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, text); - DrawText(layer, text); - changed = pcb_true; - } - } - ENDALL_LOOP; - - if (PCB->ElementOn && (Type & PCB_TYPE_ELEMENT)) - ELEMENT_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_LOCK, element) - && ((TEST_FLAG(PCB_FLAG_ONSOLDER, element) != 0) == SWAP_IDENT || PCB->InvisibleObjectsOn) - && TEST_FLAG(PCB_FLAG_SELECTED, element) != Flag) { - const char* name = ELEMENT_NAME(PCB, element); - if (name && REGEXEC(name)) { - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT, element, element, element); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, element); - PIN_LOOP(element); - { - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, pin); - } - END_LOOP; - PAD_LOOP(element); - { - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, pad); - } - END_LOOP; - ELEMENTTEXT_LOOP(element); - { - AddObjectToFlagUndoList(PCB_TYPE_ELEMENT_NAME, element, text, text); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, text); - } - END_LOOP; - DrawElementName(element); - DrawElement(element); - changed = pcb_true; - } - } - } - END_LOOP; - if (PCB->PinOn && (Type & PCB_TYPE_PIN)) - ALLPIN_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_LOCK, element) - && pin->Name && REGEXEC(pin->Name) - && TEST_FLAG(PCB_FLAG_SELECTED, pin) != Flag) { - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, pin); - DrawPin(pin); - changed = pcb_true; - } - } - ENDALL_LOOP; - if (PCB->PinOn && (Type & PCB_TYPE_PAD)) - ALLPAD_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_LOCK, element) - && ((TEST_FLAG(PCB_FLAG_ONSOLDER, pad) != 0) == SWAP_IDENT || PCB->InvisibleObjectsOn) - && TEST_FLAG(PCB_FLAG_SELECTED, pad) != Flag) - if (pad->Name && REGEXEC(pad->Name)) { - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, pad); - DrawPad(pad); - changed = pcb_true; - } - } - ENDALL_LOOP; - if (PCB->ViaOn && (Type & PCB_TYPE_VIA)) - VIA_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_LOCK, via) - && via->Name && REGEXEC(via->Name) && TEST_FLAG(PCB_FLAG_SELECTED, via) != Flag) { - AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); - ASSIGN_FLAG(PCB_FLAG_SELECTED, Flag, via); - DrawVia(via); - changed = pcb_true; - } - } - END_LOOP; - if (Type & PCB_TYPE_NET) { - InitConnectionLookup(); - changed = ResetConnections(pcb_true) || changed; - - MENU_LOOP(&(PCB->NetlistLib[NETLIST_EDITED])); - { - pcb_cardinal_t i; - LibraryEntryType *entry; - ConnectionType conn; - - /* Name[0] and Name[1] are special purpose, not the actual name */ - if (menu->Name && menu->Name[0] != '\0' && menu->Name[1] != '\0' && REGEXEC(menu->Name + 2)) { - for (i = menu->EntryN, entry = menu->Entry; i; i--, entry++) - if (SeekPad(entry, &conn, pcb_false)) - RatFindHook(conn.type, conn.ptr1, conn.ptr2, conn.ptr2, pcb_true, pcb_true); - } - } - END_LOOP; - - changed = SelectConnection(Flag) || changed; - changed = ResetConnections(pcb_false) || changed; - FreeConnectionLookupMemory(); - } - - if (method == SM_REGEX) - re_sei_free(regex); - - if (changed) { - IncrementUndoSerialNumber(); - Draw(); - } - if (pat != NULL) - free(pat); - if (pattern_copy != NULL) - free(pattern_copy); - return (changed); -} Index: 1.1.4/src/vtlibrary.h =================================================================== --- 1.1.4/src/vtlibrary.h (revision 10776) +++ 1.1.4/src/vtlibrary.h (nonexistent) @@ -1,74 +0,0 @@ -#include -#include -#include "global_objs.h" - -typedef enum { - LIB_INVALID, - LIB_DIR, - LIB_FOOTPRINT -} library_type_t; - -typedef enum { - PCB_FP_INVALID, - PCB_FP_DIR, /* used temporarily during the mapping - a finalized tree wouldn't have this */ - PCB_FP_FILE, - PCB_FP_PARAMETRIC -} fp_type_t; - - -typedef struct library_s library_t; - -/* Elem=library_t; init=none */ - -/* all public symbols are wrapped in GVT() - see vt_t(7) */ -#define GVT(x) vtlib_ ## x - -/* Array elem type - see vt_t(7) */ -#define GVT_ELEM_TYPE library_t - -/* Type that represents array lengths - see vt_t(7) */ -#define GVT_SIZE_TYPE size_t - -/* Below this length, always double allocation size when the array grows */ -#define GVT_DOUBLING_THRS 64 - -/* Initial array size when the first element is written */ -#define GVT_START_SIZE 8 - -/* Optional prefix for function definitions (e.g. static inline) */ -#define GVT_FUNC - -/* Enable this to set all new bytes ever allocated to this value - see - vt_set_new_bytes_to(7) */ -#define GVT_SET_NEW_BYTES_TO 0 - - -/* Include the actual header implementation */ -#include - -/* Memory allocator - see vt_allocation(7) */ -#define GVT_REALLOC(vect, ptr, size) realloc(ptr, size) -#define GVT_FREE(vect, ptr) free(ptr) - -/* clean up #defines */ -#include - -/* An element of a library: either a directory or a footprint */ -struct library_s { - char *name; /* visible name */ - library_type_t type; - library_t *parent; - - union { - struct { /* type == LIB_DIR */ - vtlib_t children; - } dir; - struct { /* type == LIB_FOOTPRINT */ - char *loc_info; - void *backend_data; - fp_type_t type; - void **tags; /* an array of void * tag IDs; last tag ID is NULL */ - } fp; - } data; -} ; - Index: 1.1.4/src/list_poly.h =================================================================== --- 1.1.4/src/list_poly.h (revision 10776) +++ 1.1.4/src/list_poly.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_POLY_H -#define LIST_POLY_H - -/* List of Lines */ -#define TDL(x) polylist_ ## x -#define TDL_LIST_T polylist_t -#define TDL_ITEM_T PolygonType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define polylist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/select.h =================================================================== --- 1.1.4/src/select.h (revision 10776) +++ 1.1.4/src/select.h (nonexistent) @@ -1,58 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for select routines */ - -#ifndef PCB_SELECT_H -#define PCB_SELECT_H - -#include "global.h" - -#define SELECT_TYPES \ - (PCB_TYPE_VIA | PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_POLYGON | PCB_TYPE_ELEMENT | \ - PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_ELEMENT_NAME | PCB_TYPE_RATLINE | PCB_TYPE_ARC) - -pcb_bool SelectObject(void); -pcb_bool SelectBlock(BoxTypePtr, pcb_bool); -long int *ListBlock(BoxTypePtr Box, int *len); -pcb_bool SelectedOperation(ObjectFunctionTypePtr, pcb_bool, int); -void *ObjectOperation(ObjectFunctionTypePtr, int, void *, void *, void *); -pcb_bool SelectConnection(pcb_bool); - -typedef enum { - SM_REGEX = 0, - SM_LIST = 1 -} search_method_t; - -pcb_bool SelectObjectByName(int, const char *, pcb_bool, search_method_t); - -/* New API */ - -/* Change the selection of an element or element name (these have side effects) */ -void pcb_select_element(ElementType *element, pcb_change_flag_t how, int redraw); -void pcb_select_element_name(ElementType *element, pcb_change_flag_t how, int redraw); - -#endif Index: 1.1.4/src/hid_init.c =================================================================== --- 1.1.4/src/hid_init.c (revision 10776) +++ 1.1.4/src/hid_init.c (nonexistent) @@ -1,228 +0,0 @@ -#include "config.h" - -#include -#include -#include - -#include "global.h" -#include "hid.h" -#include "hid_nogui.h" - -/* for dlopen() and friends; will also solve all system-dependent includes - and provides a dl-compat layer on windows. Also solves the opendir related - includes. */ -#include "compat_dl.h" - -#include "global.h" -#include "misc.h" -#include "plugins.h" -#include "hid_attrib.h" -#include "hid_flags.h" -#include "misc_util.h" -#include "conf_core.h" -#include "compat_misc.h" -#include "compat_inc.h" -#include "fptr_cast.h" - -HID **hid_list = 0; -int hid_num_hids = 0; - -HID *gui = NULL; -HID *next_gui = NULL; -HID *exporter = NULL; - -int pixel_slop = 1; - -static void hid_load_dir(char *dirname) -{ - DIR *dir; - struct dirent *de; - - dir = opendir(dirname); - if (!dir) { - free(dirname); - return; - } - while ((de = readdir(dir)) != NULL) { - void *sym; - pcb_uninit_t (*symv) (); - pcb_uninit_t uninit; - void *so; - char *basename, *path, *symname; - struct stat st; - - basename = pcb_strdup(de->d_name); - if (strlen(basename) > 3 && strcasecmp(basename + strlen(basename) - 3, ".so") == 0) - basename[strlen(basename) - 3] = 0; - else if (strlen(basename) > 4 && strcasecmp(basename + strlen(basename) - 4, ".dll") == 0) - basename[strlen(basename) - 4] = 0; - path = Concat(dirname, PCB_DIR_SEPARATOR_S, de->d_name, NULL); - - if (stat(path, &st) == 0 && ( -/* mingw and win32 do not support S_IXGRP or S_IXOTH */ -#if defined(S_IXGRP) - (st.st_mode & S_IXGRP) || -#endif -#if defined(S_IXOTH) - (st.st_mode & S_IXOTH) || -#endif - (st.st_mode & S_IXUSR)) - && S_ISREG(st.st_mode)) { - if ((so = dlopen(path, RTLD_NOW | RTLD_GLOBAL)) == NULL) { - fprintf(stderr, "dl_error: %s\n", dlerror()); - } - else { - plugin_info_t *inf = plugin_find(basename); - if (inf == NULL) { - symname = Concat("hid_", basename, "_init", NULL); - if ((sym = dlsym(so, symname)) != NULL) { - symv = (pcb_uninit_t (*)())pcb_cast_d2f(sym); - uninit = symv(); - } - else if ((sym = dlsym(so, "pcb_plugin_init")) != NULL) { - symv = (pcb_uninit_t (*)()) pcb_cast_d2f(sym); - uninit = symv(); - } - else - uninit = NULL; - plugin_register(basename, path, so, 1, uninit); - free(symname); - } - else - Message(PCB_MSG_ERROR, "Can't load %s because it'd provide plugin %s that is already loaded from %s\n", path, basename, (*inf->path == '<' ? "" : inf->path)); - } - } - free(basename); - free(path); - } - free(dirname); - closedir(dir); -} - -void hid_init() -{ - hid_actions_init(); - - /* Setup a "nogui" default HID */ - gui = hid_nogui_get_hid(); - -#warning TODO: make this configurable - hid_load_dir(Concat(conf_core.rc.path.exec_prefix, PCB_DIR_SEPARATOR_S, "lib", - PCB_DIR_SEPARATOR_S, "pcb-rnd", PCB_DIR_SEPARATOR_S, "plugins", PCB_DIR_SEPARATOR_S, HOST, NULL)); - hid_load_dir(Concat(conf_core.rc.path.exec_prefix, PCB_DIR_SEPARATOR_S, "lib", - PCB_DIR_SEPARATOR_S, "pcb-rnd", PCB_DIR_SEPARATOR_S, "plugins", NULL)); - - /* conf_core.rc.path.home is set by the conf_core immediately on startup */ - if (conf_core.rc.path.home != NULL) { - hid_load_dir(Concat(conf_core.rc.path.home, PCB_DIR_SEPARATOR_S, DOT_PCB_RND, PCB_DIR_SEPARATOR_S, "plugins", PCB_DIR_SEPARATOR_S, HOST, NULL)); - hid_load_dir(Concat(conf_core.rc.path.home, PCB_DIR_SEPARATOR_S, DOT_PCB_RND, PCB_DIR_SEPARATOR_S, "plugins", NULL)); - } - hid_load_dir(Concat("plugins", PCB_DIR_SEPARATOR_S, HOST, NULL)); - hid_load_dir(Concat("plugins", NULL)); -} - -void hid_uninit(void) -{ - if (hid_num_hids > 0) { - int i; - for (i = hid_num_hids-1; i >= 0; i--) { - if (hid_list[i]->uninit != NULL) - hid_list[i]->uninit(hid_list[i]); - } - } - free(hid_list); - - hid_actions_uninit(); - hid_attributes_uninit(); -} - -void hid_register_hid(HID * hid) -{ - int i; - int sz = (hid_num_hids + 2) * sizeof(HID *); - - if (hid->struct_size != sizeof(HID)) { - fprintf(stderr, "Warning: hid \"%s\" has an incompatible ABI.\n", hid->name); - return; - } - - for (i = 0; i < hid_num_hids; i++) - if (hid == hid_list[i]) - return; - - hid_num_hids++; - if (hid_list) - hid_list = (HID **) realloc(hid_list, sz); - else - hid_list = (HID **) malloc(sz); - - hid_list[hid_num_hids - 1] = hid; - hid_list[hid_num_hids] = 0; -} - -void hid_remove_hid(HID * hid) -{ - int i; - - for (i = 0; i < hid_num_hids; i++) { - if (hid == hid_list[i]) { - hid_list[i] = hid_list[hid_num_hids - 1]; - hid_list[hid_num_hids - 1] = 0; - hid_num_hids--; - return; - } - } -} - - -HID *hid_find_gui(const char *preference) -{ - int i; - - if (preference != NULL) { - for (i = 0; i < hid_num_hids; i++) - if (!hid_list[i]->printer && !hid_list[i]->exporter && !strcmp(hid_list[i]->name, preference)) - return hid_list[i]; - return NULL; - } - - for (i = 0; i < hid_num_hids; i++) - if (!hid_list[i]->printer && !hid_list[i]->exporter) - return hid_list[i]; - - fprintf(stderr, "Error: No GUI available.\n"); - exit(1); -} - -HID *hid_find_printer() -{ - int i; - - for (i = 0; i < hid_num_hids; i++) - if (hid_list[i]->printer) - return hid_list[i]; - - return 0; -} - -HID *hid_find_exporter(const char *which) -{ - int i; - - for (i = 0; i < hid_num_hids; i++) - if (hid_list[i]->exporter && strcmp(which, hid_list[i]->name) == 0) - return hid_list[i]; - - fprintf(stderr, "Invalid exporter %s, available ones:", which); - for (i = 0; i < hid_num_hids; i++) - if (hid_list[i]->exporter) - fprintf(stderr, " %s", hid_list[i]->name); - fprintf(stderr, "\n"); - - return 0; -} - -HID **hid_enumerate() -{ - return hid_list; -} Index: 1.1.4/src/find_deadcode.c =================================================================== --- 1.1.4/src/find_deadcode.c (revision 10776) +++ 1.1.4/src/find_deadcode.c (nonexistent) @@ -1,145 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - -/* Dead code - no calls to these functions from anywhere in the code */ -#error do not compile this - - -static int LOT_Linecallback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, line) && LineLineIntersect(&i->line, line)) - longjmp(i->env, 1); - return 0; -} - -static int LOT_Arccallback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!arc->Thickness) - return 0; - if (!TEST_FLAG(TheFlag, arc) && LineArcIntersect(&i->line, arc)) - longjmp(i->env, 1); - return 0; -} - -static int LOT_Padcallback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER) - && LinePadIntersect(&i->line, pad)) - longjmp(i->env, 1); - return 0; -} - -static pcb_bool PVTouchesLine(LineTypePtr line) -{ - struct lo_info info; - - info.line = *line; - EXPAND_BOUNDS(&info.line); - if (setjmp(info.env) == 0) - r_search(PCB->Data->via_tree, (BoxType *) & info.line, NULL, pv_touch_callback, &info, NULL); - else - return pcb_true; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pin_tree, (BoxType *) & info.line, NULL, pv_touch_callback, &info, NULL); - else - return pcb_true; - - return (pcb_false); -} - -static pcb_bool LOTouchesLine(LineTypePtr Line, pcb_cardinal_t LayerGroup) -{ - pcb_cardinal_t entry; - struct lo_info info; - - - /* the maximum possible distance */ - - info.line = *Line; - EXPAND_BOUNDS(&info.line); - - /* loop over all layers of the group */ - for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { - pcb_cardinal_t layer = PCB->LayerGroups.Entries[LayerGroup][entry]; - - /* handle normal layers */ - if (layer < max_copper_layer) { - gdl_iterator_t it; - PolygonType *polygon; - - /* find the first line that touches coordinates */ - - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.line, NULL, LOT_Linecallback, &info, NULL); - else - return (pcb_true); - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.line, NULL, LOT_Arccallback, &info, NULL); - else - return (pcb_true); - - /* now check all polygons */ - polylist_foreach(&(PCB->Data->Layer[layer].Polygon), &it, polygon) { - if (!TEST_FLAG(TheFlag, polygon) - && IsLineInPolygon(Line, polygon)) - return (pcb_true); - } - } - else { - /* handle special 'pad' layers */ - info.layer = layer - max_copper_layer; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pad_tree, &info.line.BoundingBox, NULL, LOT_Padcallback, &info, NULL); - else - return pcb_true; - } - } - return (pcb_false); -} - -/* returns pcb_true if nothing un-found touches the passed line - * returns pcb_false if it would touch something not yet found - * doesn't include rat-lines in the search - */ - -pcb_bool lineClear(LineTypePtr line, pcb_cardinal_t group) -{ - if (LOTouchesLine(line, group)) - return (pcb_false); - if (PVTouchesLine(line)) - return (pcb_false); - return (pcb_true); -} Index: 1.1.4/src/stub_vendor.c =================================================================== --- 1.1.4/src/stub_vendor.c (revision 10776) +++ 1.1.4/src/stub_vendor.c (nonexistent) @@ -1,38 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "stub_vendor.h" - -static int stub_vendorDrillMap_dummy(int dia) -{ - return dia; -} - -static pcb_bool stub_vendorIsElementMappable_dummy(ElementTypePtr e) -{ - return pcb_false; -} - -int (*stub_vendorDrillMap)(int) = stub_vendorDrillMap_dummy; -pcb_bool (*stub_vendorIsElementMappable)(ElementTypePtr) = stub_vendorIsElementMappable_dummy; - - Index: 1.1.4/src/buildin.c.in =================================================================== --- 1.1.4/src/buildin.c.in (revision 10776) +++ 1.1.4/src/buildin.c.in (nonexistent) @@ -1,14 +0,0 @@ -print [@ -/**** This file autogenerated by scconfig, do not edit ****/ -#include -#include "plugins.h" -#include "buildin.h" - -@?/local/pcb/buildin_init_extern@ - -void buildin_init(void) -{ - pcb_uninit_t uninit_func; -@?/local/pcb/buildin_init_code@ -} -@] Index: 1.1.4/src/pcb-conf.lht =================================================================== --- 1.1.4/src/pcb-conf.lht (revision 10776) +++ 1.1.4/src/pcb-conf.lht (nonexistent) @@ -1,250 +0,0 @@ -li:pcb-rnd-conf-v1 { - ha:overwrite { - ha:editor { - grid_unit = mil - grid = 25 mil - ha:increments_mm { - grid=0.1mm - grid_min=0.01mm - grid_max=1mm - size=0.2mm - size_min=0.01mm - size_max=0.5mm - line=0.1mm - line_min=0.005mm - line_max=9.5mm - clear=0.05mm - clear_min=0.005mm - clear_max=0.5mm - } - ha:increments_mil { - grid=5 mil - grid_min=1 mil - grid_max=25 mil - size=10 mil - size_min = 1 mil - size_max = 10 mil - line=5 mil - line_min = 0.5 mil - line_max = 10 mil - clear=2 mil - clear_min = 0.5 mil - clear_max = 10 mil - } - zoom = 1 - mode = 110 - buffer_number = 0 - clear_line = 1 - full_poly = 0 - unique_names = 0 - snap_pin = 1 - snap_offgrid_line = 1 - highlight_on_point = 0 - show_solder_side = 0 - save_last_command = 0 - save_in_tmp = 0 - draw_grid = 1 - all_direction_lines = 0 - line_refraction = 1 - rubber_band_mode = 0 - swap_start_direction = 0 - show_drc = 0 - auto_drc = 0 - show_number = 0 - orthogonal_moves = 0 - reset_after_element = 1 - auto_place = 0 - lock_names = 0 - only_names = 0 - thin_draw = 0 - thin_draw_poly = 0 - local_ref = 0 - check_planes = 0 - show_mask = 0 - hide_names = 0 - description = 0 - name_on_pcb = 0 - enable_stroke = 0 - live_routing = 0 - beep_when_finished = 0 - click_time = 200 - ha:view { - flip_x = 0 - flip_y = 0 - } - undo_warning_size = 1024 - fullscreen = 0 - } # editor - - ha:rc { - verbose = 0 - backup_interval = 60 -# font_command = {} -# file_command = {} -# file_path = {} - library_shell = {} - - emergency_name = {PCB.%ld.save} - backup_name = {PCB.%P.backup} - - li:library_search_paths = { - ../pcblib - ~/pcblib/ - $(rc.path.share)/pcblib - } - - keep_save_backups = false - save_command = {} - - li:default_font_file = { - {./default_font} - {$(rc.path.share)/default_font} - } - li:default_pcb_file = { - {./default.pcb} - {$(rc.path.share)/default.pcb} - } - -# script_filename = {} -# action_string = {} -# rat_path = {} -# rat_command = {} - li:preferred_gui = { gtk; lesstif } - } # rc - - ha:design { -# via_thickness = 0 -# via_drilling_hole = 0 -# line_thickness = 0 -# clearance = 0 -# max_width = 0 -# max_height = 0 -# alignment_distance = 0 -# bloat = 0 -# shrink = 0 -# min_wid = 0 -# min_slk = 0 -# min_drill = 0 -# min_ring = 0 - text_scale = 100 -# poly_isle_area = 0 -# li:default_layer_name = {layername1; layername2} -# background_image = {} -# fab_author = {} -# initial_layer_stack = {} - groups = {} - routes = {} - } # design - - ha:appearance { - rat_thickness = 0.25 mm - mark_size = 50 mil - - ha:loglevels { - debug_tag = {} - debug_popup = false - info_tag = {} - info_popup = false - warning_tag = {} - warning_popup = true - error_tag = {} - error_popup = true - } - ha:color { - black = {#000000} - white = {#ffffff} - background = {#e5e5e5} - crosshair = {#ff0000} - cross = {#cdcd00} - via = {#7f7f7f} - via_selected = {#00ffff} - pin = {#4d4d4d} - pin_selected = {#00ffff} - pin_name = {#ff0000} - element = {#000000} - element_nonetlist = {#777777} - rat = {#b8860b} - invisible_objects = {#cccccc} - invisible_mark = {#cccccc} - element_selected = {#00ffff} - rat_selected = {#00ffff} - connected = {#00ff00} - off_limit = {#cccccc} - grid = {#ff0000} - li:layer = { - {#8b2323}; {#3a5fcd}; {#104e8b}; {#cd3700}; {#548b54}; - {#8b7355}; {#00868b}; {#228b22}; {#8b2323}; {#3a5fcd}; - {#104e8b}; {#cd3700}; {#548b54}; {#8b7355}; {#00868b}; - {#228b22}; - } - li:layer_selected = { - {#00ffff}; {#00ffff}; {#00ffff}; {#00ffff}; {#00ffff}; - {#00ffff}; {#00ffff}; {#00ffff}; {#00ffff}; {#00ffff}; - {#00ffff}; {#00ffff}; {#00ffff}; {#00ffff}; {#00ffff}; - {#00ffff}; - } - warn = {#ff8000} - mask = {#ff0000} - } - ha:pinout { -# name_length = 0 -# zoom = 0 - offset_x = 25400 - offset_y = 25400 - text_offset_x = 0.1 mm - text_offset_y = 0.1 mm - } - ha:messages { -# char_per_line = 0 - } -# ha:misc { -# volume = 0 -# } misc; - } # appearance; - - ha:plugins { - ha:io_lihata { - aux_pcb_pattern = {%D.%B.lht.pcb} - } - ha:mincut { - enable = 1 - } - ha:djopt { - auto_only = 1 - } - ha:vendor { - enable = 0 - } - ha:import_sch { - gnetlist_program = gnetlist - make_program = make - } - ha:hid_gtk { - compact_horizontal = 1 - compact_vertical = 1 - use_command_window = 0 - history_size = 16 - ha:local_grid { - enable = 0 - radius = 16 - } - ha:global_grid { - sparse = 0 - min_dist_px = 4 - } - } - ha:report { - columns = 8 - } - } # plugins - - ha:utils { - ha:gsch2pcb-rnd { - remove_unfound_elements = 1 - quiet_mode = 0 - verbose = 0 - } - } # utils - } # main -} # root - Index: 1.1.4/src/hid_init.h =================================================================== --- 1.1.4/src/hid_init.h (revision 10776) +++ 1.1.4/src/hid_init.h (nonexistent) @@ -1,47 +0,0 @@ -#ifndef PCB_HID_INIT_H -#define PCB_HID_INIT_H - -/* NULL terminated list of all static HID structures. Built by - hid_register_hid, used by hid_find_*() and hid_enumerate(). The - order in this list is the same as the order of hid_register_hid - calls. */ -extern HID **hid_list; - -/* Count of entries in the above. */ -extern int hid_num_hids; - -/* Call this as soon as possible from main(). No other HID calls are - valid until this is called. */ -void hid_init(void); - -/* Call this at exit */ -void hid_uninit(void); - -/* When PCB runs in interactive mode, this is called to instantiate - one GUI HID which happens to be the GUI. This HID is the one that - interacts with the mouse and keyboard. */ -HID *hid_find_gui(const char *preference); - -/* Finds the one printer HID and instantiates it. */ -HID *hid_find_printer(void); - -/* Finds the indicated exporter HID and instantiates it. */ -HID *hid_find_exporter(const char *); - -/* This returns a NULL-terminated array of available HIDs. The only - real reason to use this is to locate all the export-style HIDs. */ -HID **hid_enumerate(void); - -/* HID internal interfaces. These may ONLY be called from the HID - modules, not from the common PCB code. */ - -/* A HID may use this if it does not need command line arguments in - any special format; for example, the Lesstif HID needs to use the - Xt parser, but the Postscript HID can use this function. */ -void hid_parse_command_line(int *argc, char ***argv); - -/* Called by the init funcs, used to set up hid_list. */ -extern void hid_register_hid(HID * hid); -void hid_remove_hid(HID * hid); - -#endif Index: 1.1.4/src/crosshair.c =================================================================== --- 1.1.4/src/crosshair.c (revision 10776) +++ 1.1.4/src/crosshair.c (nonexistent) @@ -1,1241 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * 15 Oct 2008 Ineiev: add different crosshair shapes - * - * 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 - * - */ - -/* crosshair stuff */ - -#include "config.h" - -#include -#include - -#include "conf_core.h" - -#include "box.h" -#include "crosshair.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "line.h" -#include "rtree.h" -#include "search.h" -#include "polygon.h" -#include "misc.h" -#include "misc_util.h" -#include "hid_actions.h" -#include "layer.h" -#include "compat_misc.h" - -typedef struct { - int x, y; -} point; - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void XORPolygon(PolygonTypePtr, Coord, Coord, int); -static void XORDrawElement(ElementTypePtr, Coord, Coord); -static void XORDrawBuffer(BufferTypePtr); -static void XORDrawInsertPointObject(void); -static void XORDrawMoveOrCopyObject(void); -static void XORDrawAttachedLine(Coord, Coord, Coord, Coord, Coord); -static void XORDrawAttachedArc(Coord); - -static void thindraw_moved_pv(PinType * pv, Coord x, Coord y) -{ - /* Make a copy of the pin structure, moved to the correct position */ - PinType moved_pv = *pv; - moved_pv.X += x; - moved_pv.Y += y; - - gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &moved_pv, pcb_true, pcb_false); -} - -static void draw_dashed_line(hidGC GC, Coord x1, Coord y1, Coord x2, Coord y2) -{ -/* TODO: we need a real geo lib... using double here is plain wrong */ - double dx = x2-x1, dy = y2-y1; - double len_squared = dx*dx + dy*dy; - int n; - const int segs = 11; /* must be odd */ - - if (len_squared < 1000000) { - /* line too short, just draw it - TODO: magic value; with a proper geo lib this would be gone anyway */ - gui->draw_line(Crosshair.GC, x1, y1, x2, y2); - return; - } - - /* first seg is drawn from x1, y1 with no rounding error due to n-1 == 0 */ - for(n = 1; n < segs; n+=2) - gui->draw_line(Crosshair.GC, - x1 + (dx * (double)(n-1) / (double)segs), y1 + (dy * (double)(n-1) / (double)segs), - x1 + (dx * (double)n / (double)segs), y1 + (dy * (double)n / (double)segs)); - - - /* make sure the last segment is drawn properly to x2 and y2, don't leave - room for rounding errors */ - gui->draw_line(Crosshair.GC, - x2 - (dx / (double)segs), y2 - (dy / (double)segs), - x2, y2); -} - -/* --------------------------------------------------------------------------- - * creates a tmp polygon with coordinates converted to screen system - */ -static void XORPolygon(PolygonTypePtr polygon, Coord dx, Coord dy, int dash_last) -{ - pcb_cardinal_t i; - for (i = 0; i < polygon->PointN; i++) { - pcb_cardinal_t next = next_contour_point(polygon, i); - - if (next == 0) { /* last line: sometimes the implicit closing line */ - if (i == 1) /* corner case: don't draw two lines on top of each other - with XOR it looks bad */ - continue; - - if (dash_last) { - draw_dashed_line(Crosshair.GC, - polygon->Points[i].X + dx, - polygon->Points[i].Y + dy, polygon->Points[next].X + dx, polygon->Points[next].Y + dy); - break; /* skip normal line draw below */ - } - } - - /* normal contour line */ - gui->draw_line(Crosshair.GC, - polygon->Points[i].X + dx, - polygon->Points[i].Y + dy, polygon->Points[next].X + dx, polygon->Points[next].Y + dy); - } -} - -/*----------------------------------------------------------- - * Draws the outline of an arc - */ -static void XORDrawAttachedArc(Coord thick) -{ - ArcType arc; - BoxTypePtr bx; - Coord wx, wy; - Angle sa, dir; - Coord wid = thick / 2; - - wx = Crosshair.X - Crosshair.AttachedBox.Point1.X; - wy = Crosshair.Y - Crosshair.AttachedBox.Point1.Y; - if (wx == 0 && wy == 0) - return; - arc.X = Crosshair.AttachedBox.Point1.X; - arc.Y = Crosshair.AttachedBox.Point1.Y; - if (XOR(Crosshair.AttachedBox.otherway, coord_abs(wy) > coord_abs(wx))) { - arc.X = Crosshair.AttachedBox.Point1.X + coord_abs(wy) * SGNZ(wx); - sa = (wx >= 0) ? 0 : 180; -#ifdef ARC45 - if (coord_abs(wy) >= 2 * coord_abs(wx)) - dir = (SGNZ(wx) == SGNZ(wy)) ? 45 : -45; - else -#endif - dir = (SGNZ(wx) == SGNZ(wy)) ? 90 : -90; - } - else { - arc.Y = Crosshair.AttachedBox.Point1.Y + coord_abs(wx) * SGNZ(wy); - sa = (wy >= 0) ? -90 : 90; -#ifdef ARC45 - if (coord_abs(wx) >= 2 * coord_abs(wy)) - dir = (SGNZ(wx) == SGNZ(wy)) ? -45 : 45; - else -#endif - dir = (SGNZ(wx) == SGNZ(wy)) ? -90 : 90; - wy = wx; - } - wy = coord_abs(wy); - arc.StartAngle = sa; - arc.Delta = dir; - arc.Width = arc.Height = wy; - bx = GetArcEnds(&arc); - /* sa = sa - 180; */ - gui->draw_arc(Crosshair.GC, arc.X, arc.Y, wy + wid, wy + wid, sa, dir); - if (wid > pixel_slop) { - gui->draw_arc(Crosshair.GC, arc.X, arc.Y, wy - wid, wy - wid, sa, dir); - gui->draw_arc(Crosshair.GC, bx->X1, bx->Y1, wid, wid, sa, -180 * SGN(dir)); - gui->draw_arc(Crosshair.GC, bx->X2, bx->Y2, wid, wid, sa + dir, 180 * SGN(dir)); - } -} - -/*----------------------------------------------------------- - * Draws the outline of a line - */ -static void XORDrawAttachedLine(Coord x1, Coord y1, Coord x2, Coord y2, Coord thick) -{ - Coord dx, dy, ox, oy; - double h; - - dx = x2 - x1; - dy = y2 - y1; - if (dx != 0 || dy != 0) - h = 0.5 * thick / sqrt(SQUARE(dx) + SQUARE(dy)); - else - h = 0.0; - ox = dy * h + 0.5 * SGN(dy); - oy = -(dx * h + 0.5 * SGN(dx)); - gui->draw_line(Crosshair.GC, x1 + ox, y1 + oy, x2 + ox, y2 + oy); - if (coord_abs(ox) >= pixel_slop || coord_abs(oy) >= pixel_slop) { - Angle angle = atan2(dx, dy) * 57.295779; - gui->draw_line(Crosshair.GC, x1 - ox, y1 - oy, x2 - ox, y2 - oy); - gui->draw_arc(Crosshair.GC, x1, y1, thick / 2, thick / 2, angle - 180, 180); - gui->draw_arc(Crosshair.GC, x2, y2, thick / 2, thick / 2, angle, 180); - } -} - -/* --------------------------------------------------------------------------- - * draws the elements of a loaded circuit which is to be merged in - */ -static void XORDrawElement(ElementTypePtr Element, Coord DX, Coord DY) -{ - /* if no silkscreen, draw the bounding box */ - if (arclist_length(&Element->Arc) == 0 && linelist_length(&Element->Line) == 0) { - gui->draw_line(Crosshair.GC, - DX + Element->BoundingBox.X1, - DY + Element->BoundingBox.Y1, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y2); - gui->draw_line(Crosshair.GC, - DX + Element->BoundingBox.X1, - DY + Element->BoundingBox.Y2, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y2); - gui->draw_line(Crosshair.GC, - DX + Element->BoundingBox.X2, - DY + Element->BoundingBox.Y2, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y1); - gui->draw_line(Crosshair.GC, - DX + Element->BoundingBox.X2, - DY + Element->BoundingBox.Y1, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y1); - } - else { - ELEMENTLINE_LOOP(Element); - { - gui->draw_line(Crosshair.GC, DX + line->Point1.X, DY + line->Point1.Y, DX + line->Point2.X, DY + line->Point2.Y); - } - END_LOOP; - - /* arc coordinates and angles have to be converted to X11 notation */ - ARC_LOOP(Element); - { - gui->draw_arc(Crosshair.GC, DX + arc->X, DY + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); - } - END_LOOP; - } - /* pin coordinates and angles have to be converted to X11 notation */ - PIN_LOOP(Element); - { - thindraw_moved_pv(pin, DX, DY); - } - END_LOOP; - - /* pads */ - PAD_LOOP(Element); - { - if (PCB->InvisibleObjectsOn || (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) != 0) == conf_core.editor.show_solder_side) { - /* Make a copy of the pad structure, moved to the correct position */ - PadType moved_pad = *pad; - moved_pad.Point1.X += DX; - moved_pad.Point1.Y += DY; - moved_pad.Point2.X += DX; - moved_pad.Point2.Y += DY; - - gui->thindraw_pcb_pad(Crosshair.GC, &moved_pad, pcb_false, pcb_false); - } - } - END_LOOP; - /* mark */ - gui->draw_line(Crosshair.GC, - Element->MarkX + DX - EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY - EMARK_SIZE); - gui->draw_line(Crosshair.GC, - Element->MarkX + DX + EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY - EMARK_SIZE); - gui->draw_line(Crosshair.GC, - Element->MarkX + DX - EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY + EMARK_SIZE); - gui->draw_line(Crosshair.GC, - Element->MarkX + DX + EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY + EMARK_SIZE); -} - -/* --------------------------------------------------------------------------- - * draws all visible and attached objects of the pastebuffer - */ -static void XORDrawBuffer(BufferTypePtr Buffer) -{ - pcb_cardinal_t i; - Coord x, y; - - /* set offset */ - x = Crosshair.X - Buffer->X; - y = Crosshair.Y - Buffer->Y; - - /* draw all visible layers */ - for (i = 0; i < max_copper_layer + 2; i++) - if (PCB->Data->Layer[i].On) { - LayerTypePtr layer = &Buffer->Data->Layer[i]; - - LINE_LOOP(layer); - { -/* - XORDrawAttachedLine(x +line->Point1.X, - y +line->Point1.Y, x +line->Point2.X, - y +line->Point2.Y, line->Thickness); -*/ - gui->draw_line(Crosshair.GC, x + line->Point1.X, y + line->Point1.Y, x + line->Point2.X, y + line->Point2.Y); - } - END_LOOP; - ARC_LOOP(layer); - { - gui->draw_arc(Crosshair.GC, x + arc->X, y + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); - } - END_LOOP; - TEXT_LOOP(layer); - { - BoxTypePtr box = &text->BoundingBox; - gui->draw_rect(Crosshair.GC, x + box->X1, y + box->Y1, x + box->X2, y + box->Y2); - } - END_LOOP; - /* the tmp polygon has n+1 points because the first - * and the last one are set to the same coordinates - */ - POLYGON_LOOP(layer); - { - XORPolygon(polygon, x, y, 0); - } - END_LOOP; - } - - /* draw elements if visible */ - if (PCB->PinOn && PCB->ElementOn) - ELEMENT_LOOP(Buffer->Data); - { - if (FRONT(element) || PCB->InvisibleObjectsOn) - XORDrawElement(element, x, y); - } - END_LOOP; - - /* and the vias */ - if (PCB->ViaOn) - VIA_LOOP(Buffer->Data); - { - thindraw_moved_pv(via, x, y); - } - END_LOOP; -} - -/* --------------------------------------------------------------------------- - * draws the rubberband to insert points into polygons/lines/... - */ -static void XORDrawInsertPointObject(void) -{ - LineTypePtr line = (LineTypePtr) Crosshair.AttachedObject.Ptr2; - PointTypePtr point = (PointTypePtr) Crosshair.AttachedObject.Ptr3; - - if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { - gui->draw_line(Crosshair.GC, point->X, point->Y, line->Point1.X, line->Point1.Y); - gui->draw_line(Crosshair.GC, point->X, point->Y, line->Point2.X, line->Point2.Y); - } -} - -/* --------------------------------------------------------------------------- - * draws the attached object while in PCB_MODE_MOVE or PCB_MODE_COPY - */ -static void XORDrawMoveOrCopyObject(void) -{ - RubberbandTypePtr ptr; - pcb_cardinal_t i; - Coord dx = Crosshair.X - Crosshair.AttachedObject.X, dy = Crosshair.Y - Crosshair.AttachedObject.Y; - - switch (Crosshair.AttachedObject.Type) { - case PCB_TYPE_VIA: - { - PinTypePtr via = (PinTypePtr) Crosshair.AttachedObject.Ptr1; - thindraw_moved_pv(via, dx, dy); - break; - } - - case PCB_TYPE_LINE: - { - LineTypePtr line = (LineTypePtr) Crosshair.AttachedObject.Ptr2; - - XORDrawAttachedLine(line->Point1.X + dx, line->Point1.Y + dy, line->Point2.X + dx, line->Point2.Y + dy, line->Thickness); - break; - } - - case PCB_TYPE_ARC: - { - ArcTypePtr Arc = (ArcTypePtr) Crosshair.AttachedObject.Ptr2; - - gui->draw_arc(Crosshair.GC, Arc->X + dx, Arc->Y + dy, Arc->Width, Arc->Height, Arc->StartAngle, Arc->Delta); - break; - } - - case PCB_TYPE_POLYGON: - { - PolygonTypePtr polygon = (PolygonTypePtr) Crosshair.AttachedObject.Ptr2; - - /* the tmp polygon has n+1 points because the first - * and the last one are set to the same coordinates - */ - XORPolygon(polygon, dx, dy, 0); - break; - } - - case PCB_TYPE_LINE_POINT: - { - LineTypePtr line; - PointTypePtr point; - - line = (LineTypePtr) Crosshair.AttachedObject.Ptr2; - point = (PointTypePtr) Crosshair.AttachedObject.Ptr3; - if (point == &line->Point1) - XORDrawAttachedLine(point->X + dx, point->Y + dy, line->Point2.X, line->Point2.Y, line->Thickness); - else - XORDrawAttachedLine(point->X + dx, point->Y + dy, line->Point1.X, line->Point1.Y, line->Thickness); - break; - } - - case PCB_TYPE_POLYGON_POINT: - { - PolygonTypePtr polygon; - PointTypePtr point; - pcb_cardinal_t point_idx, prev, next; - - polygon = (PolygonTypePtr) Crosshair.AttachedObject.Ptr2; - point = (PointTypePtr) Crosshair.AttachedObject.Ptr3; - point_idx = polygon_point_idx(polygon, point); - - /* get previous and following point */ - prev = prev_contour_point(polygon, point_idx); - next = next_contour_point(polygon, point_idx); - - /* draw the two segments */ - gui->draw_line(Crosshair.GC, polygon->Points[prev].X, polygon->Points[prev].Y, point->X + dx, point->Y + dy); - gui->draw_line(Crosshair.GC, point->X + dx, point->Y + dy, polygon->Points[next].X, polygon->Points[next].Y); - break; - } - - case PCB_TYPE_ELEMENT_NAME: - { - /* locate the element "mark" and draw an association line from crosshair to it */ - ElementTypePtr element = (ElementTypePtr) Crosshair.AttachedObject.Ptr1; - - gui->draw_line(Crosshair.GC, element->MarkX, element->MarkY, Crosshair.X, Crosshair.Y); - /* fall through to move the text as a box outline */ - } - case PCB_TYPE_TEXT: - { - TextTypePtr text = (TextTypePtr) Crosshair.AttachedObject.Ptr2; - BoxTypePtr box = &text->BoundingBox; - gui->draw_rect(Crosshair.GC, box->X1 + dx, box->Y1 + dy, box->X2 + dx, box->Y2 + dy); - break; - } - - /* pin/pad movements result in moving an element */ - case PCB_TYPE_PAD: - case PCB_TYPE_PIN: - case PCB_TYPE_ELEMENT: - XORDrawElement((ElementTypePtr) Crosshair.AttachedObject.Ptr2, dx, dy); - break; - } - - /* draw the attached rubberband lines too */ - i = Crosshair.AttachedObject.RubberbandN; - ptr = Crosshair.AttachedObject.Rubberband; - while (i) { - PointTypePtr point1, point2; - - if (TEST_FLAG(PCB_FLAG_VIA, ptr->Line)) { - /* this is a rat going to a polygon. do not draw for rubberband */ ; - } - else if (TEST_FLAG(PCB_FLAG_RUBBEREND, ptr->Line)) { - /* 'point1' is always the fix-point */ - if (ptr->MovedPoint == &ptr->Line->Point1) { - point1 = &ptr->Line->Point2; - point2 = &ptr->Line->Point1; - } - else { - point1 = &ptr->Line->Point1; - point2 = &ptr->Line->Point2; - } - XORDrawAttachedLine(point1->X, point1->Y, point2->X + dx, point2->Y + dy, ptr->Line->Thickness); - } - else if (ptr->MovedPoint == &ptr->Line->Point1) - XORDrawAttachedLine(ptr->Line->Point1.X + dx, - ptr->Line->Point1.Y + dy, ptr->Line->Point2.X + dx, ptr->Line->Point2.Y + dy, ptr->Line->Thickness); - - ptr++; - i--; - } -} - -/* --------------------------------------------------------------------------- - * draws additional stuff that follows the crosshair - */ -void DrawAttached(void) -{ - switch (conf_core.editor.mode) { - case PCB_MODE_VIA: - { - /* Make a dummy via structure to draw from */ - PinType via; - via.X = Crosshair.X; - via.Y = Crosshair.Y; - via.Thickness = conf_core.design.via_thickness; - via.Clearance = 2 * conf_core.design.clearance; - via.DrillingHole = conf_core.design.via_drilling_hole; - via.Mask = 0; - via.Flags = NoFlags(); - - gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &via, pcb_true, pcb_false); - - if (conf_core.editor.show_drc) { - /* XXX: Naughty cheat - use the mask to draw DRC clearance! */ - via.Mask = conf_core.design.via_thickness + PCB->Bloat * 2; - gui->set_color(Crosshair.GC, conf_core.appearance.color.cross); - gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &via, pcb_false, pcb_true); - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); - } - break; - } - - /* the attached line is used by both LINEMODE, PCB_MODE_POLYGON and PCB_MODE_POLYGON_HOLE */ - case PCB_MODE_POLYGON: - case PCB_MODE_POLYGON_HOLE: - /* draw only if starting point is set */ - if (Crosshair.AttachedLine.State != STATE_FIRST) - gui->draw_line(Crosshair.GC, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); - - /* draw attached polygon only if in PCB_MODE_POLYGON or PCB_MODE_POLYGON_HOLE */ - if (Crosshair.AttachedPolygon.PointN > 1) { - XORPolygon(&Crosshair.AttachedPolygon, 0, 0, 1); - } - break; - - case PCB_MODE_ARC: - if (Crosshair.AttachedBox.State != STATE_FIRST) { - XORDrawAttachedArc(conf_core.design.line_thickness); - if (conf_core.editor.show_drc) { - gui->set_color(Crosshair.GC, conf_core.appearance.color.cross); - XORDrawAttachedArc(conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); - } - - } - break; - - case PCB_MODE_LINE: - /* draw only if starting point exists and the line has length */ - if (Crosshair.AttachedLine.State != STATE_FIRST && Crosshair.AttachedLine.draw) { - XORDrawAttachedLine(Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness); - /* draw two lines ? */ - if (conf_core.editor.line_refraction) - XORDrawAttachedLine(Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, - Crosshair.X, Crosshair.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness); - if (conf_core.editor.show_drc) { - gui->set_color(Crosshair.GC, conf_core.appearance.color.cross); - XORDrawAttachedLine(Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); - if (conf_core.editor.line_refraction) - XORDrawAttachedLine(Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, - Crosshair.X, Crosshair.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); - } - } - break; - - case PCB_MODE_PASTE_BUFFER: - XORDrawBuffer(PASTEBUFFER); - break; - - case PCB_MODE_COPY: - case PCB_MODE_MOVE: - XORDrawMoveOrCopyObject(); - break; - - case PCB_MODE_INSERT_POINT: - XORDrawInsertPointObject(); - break; - } - - /* an attached box does not depend on a special mode */ - if (Crosshair.AttachedBox.State == STATE_SECOND || Crosshair.AttachedBox.State == STATE_THIRD) { - Coord x1, y1, x2, y2; - - x1 = Crosshair.AttachedBox.Point1.X; - y1 = Crosshair.AttachedBox.Point1.Y; - x2 = Crosshair.AttachedBox.Point2.X; - y2 = Crosshair.AttachedBox.Point2.Y; - gui->draw_rect(Crosshair.GC, x1, y1, x2, y2); - } -} - - -/* -------------------------------------------------------------------------- - * draw the marker position - */ -void DrawMark(void) -{ - Coord ms = conf_core.appearance.mark_size; - - /* Mark is not drawn when it is not set */ - if (!Marked.status) - return; - - gui->draw_line(Crosshair.GC, Marked.X - ms, Marked.Y - ms, Marked.X + ms, Marked.Y + ms); - gui->draw_line(Crosshair.GC, Marked.X + ms, Marked.Y - ms, Marked.X - ms, Marked.Y + ms); -} - -/* --------------------------------------------------------------------------- - * Returns the nearest grid-point to the given Coord - */ -Coord GridFit(Coord x, Coord grid_spacing, Coord grid_offset) -{ - x -= grid_offset; - x = grid_spacing * pcb_round((double) x / grid_spacing); - x += grid_offset; - return x; -} - - -/* --------------------------------------------------------------------------- - * notify the GUI that data relating to the crosshair is being changed. - * - * The argument passed is pcb_false to notify "changes are about to happen", - * and pcb_true to notify "changes have finished". - * - * Each call with a 'pcb_false' parameter must be matched with a following one - * with a 'pcb_true' parameter. Unmatched 'pcb_true' calls are currently not permitted, - * but might be allowed in the future. - * - * GUIs should not complain if they receive extra calls with 'pcb_true' as parameter. - * They should initiate a redraw of the crosshair attached objects - which may - * (if necessary) mean repainting the whole screen if the GUI hasn't tracked the - * location of existing attached drawing. - */ -void notify_crosshair_change(pcb_bool changes_complete) -{ - if (gui->notify_crosshair_change) - gui->notify_crosshair_change(changes_complete); -} - - -/* --------------------------------------------------------------------------- - * notify the GUI that data relating to the mark is being changed. - * - * The argument passed is pcb_false to notify "changes are about to happen", - * and pcb_true to notify "changes have finished". - * - * Each call with a 'pcb_false' parameter must be matched with a following one - * with a 'pcb_true' parameter. Unmatched 'pcb_true' calls are currently not permitted, - * but might be allowed in the future. - * - * GUIs should not complain if they receive extra calls with 'pcb_true' as parameter. - * They should initiate a redraw of the mark - which may (if necessary) mean - * repainting the whole screen if the GUI hasn't tracked the mark's location. - */ -void notify_mark_change(pcb_bool changes_complete) -{ - if (gui->notify_mark_change) - gui->notify_mark_change(changes_complete); -} - - -/* --------------------------------------------------------------------------- - * Convenience for plugins using the old {Hide,Restore}Crosshair API. - * This links up to notify the GUI of the expected changes using the new APIs. - * - * Use of this old API is deprecated, as the names don't necessarily reflect - * what all GUIs may do in response to the notifications. Keeping these APIs - * is aimed at easing transition to the newer API, they will emit a harmless - * warning at the time of their first use. - * - */ -void HideCrosshair(void) -{ - static pcb_bool warned_old_api = pcb_false; - if (!warned_old_api) { - Message(PCB_MSG_DEFAULT, _("WARNING: A plugin is using the deprecated API HideCrosshair().\n" - " This API may be removed in a future release of PCB.\n")); - warned_old_api = pcb_true; - } - - notify_crosshair_change(pcb_false); - notify_mark_change(pcb_false); -} - -void RestoreCrosshair(void) -{ - static pcb_bool warned_old_api = pcb_false; - if (!warned_old_api) { - Message(PCB_MSG_DEFAULT, _("WARNING: A plugin is using the deprecated API RestoreCrosshair().\n" - " This API may be removed in a future release of PCB.\n")); - warned_old_api = pcb_true; - } - - notify_crosshair_change(pcb_true); - notify_mark_change(pcb_true); -} - -/* - * Below is the implementation of the "highlight on endpoint" functionality. - * This highlights lines and arcs when the crosshair is on of their (two) - * endpoints. - */ -struct onpoint_search_info { - CrosshairType *crosshair; - Coord X; - Coord Y; -}; - -static r_dir_t onpoint_line_callback(const BoxType * box, void *cl) -{ - struct onpoint_search_info *info = (struct onpoint_search_info *) cl; - CrosshairType *crosshair = info->crosshair; - LineType *line = (LineType *) box; - -#ifdef DEBUG_ONPOINT - printf("X=%ld Y=%ld X1=%ld Y1=%ld X2=%ld Y2=%ld\n", info->X, info->Y, - line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y); -#endif - if ((line->Point1.X == info->X && line->Point1.Y == info->Y) || (line->Point2.X == info->X && line->Point2.Y == info->Y)) { - OnpointType op; - op.type = PCB_TYPE_LINE; - op.obj.line = line; - vtop_append(&crosshair->onpoint_objs, op); - SET_FLAG(PCB_FLAG_ONPOINT, (AnyObjectType *) line); - DrawLine(NULL, line); - return R_DIR_FOUND_CONTINUE; - } - else { - return R_DIR_NOT_FOUND; - } -} - -#define close_enough(v1, v2) (coord_abs((v1)-(v2)) < 10) - -static r_dir_t onpoint_arc_callback(const BoxType * box, void *cl) -{ - struct onpoint_search_info *info = (struct onpoint_search_info *) cl; - CrosshairType *crosshair = info->crosshair; - ArcType *arc = (ArcType *) box; - Coord p1x, p1y, p2x, p2y; - - p1x = arc->X - arc->Width * cos(TO_RADIANS(arc->StartAngle)); - p1y = arc->Y + arc->Height * sin(TO_RADIANS(arc->StartAngle)); - p2x = arc->X - arc->Width * cos(TO_RADIANS(arc->StartAngle + arc->Delta)); - p2y = arc->Y + arc->Height * sin(TO_RADIANS(arc->StartAngle + arc->Delta)); - - /* printf("p1=%ld;%ld p2=%ld;%ld info=%ld;%ld\n", p1x, p1y, p2x, p2y, info->X, info->Y); */ - - if ((close_enough(p1x, info->X) && close_enough(p1y, info->Y)) || (close_enough(p2x, info->X) && close_enough(p2y, info->Y))) { - OnpointType op; - op.type = PCB_TYPE_ARC; - op.obj.arc = arc; - vtop_append(&crosshair->onpoint_objs, op); - SET_FLAG(PCB_FLAG_ONPOINT, (AnyObjectType *) arc); - DrawArc(NULL, arc); - return R_DIR_FOUND_CONTINUE; - } - else { - return R_DIR_NOT_FOUND; - } -} - -void DrawLineOrArc(int type, void *obj) -{ - switch (type) { - case PCB_TYPE_LINE_POINT: - /* Attention: We can use a NULL pointer here for the layer, - * because it is not used in the DrawLine() function anyways. - * ATM DrawLine() only calls AddPart() internally, which invalidates - * the area specified by the line's bounding box. - */ - DrawLine(NULL, (LineType *) obj); - break; -#if 0 - case ARCPOINT_TYPE: - /* See comment above */ - DrawArc(NULL, (ArcType *) obj); - break; -#endif - } -} - - -#define op_swap(crosshair) \ -do { \ - vtop_t __tmp__ = crosshair->onpoint_objs; \ - crosshair->onpoint_objs = crosshair->old_onpoint_objs; \ - crosshair->old_onpoint_objs = __tmp__; \ -} while(0) - -static void *onpoint_find(vtop_t *vect, void *obj_ptr) -{ - int i; - - for (i = 0; i < vect->used; i++) { - OnpointType *op = &(vect->array[i]); - if (op->obj.any == obj_ptr) - return op; - } - return NULL; -} - -/* - * Searches for lines or arcs which have points that are exactly - * at the given coordinates and adds them to the crosshair's - * object list along with their respective type. - */ -static void onpoint_work(CrosshairType * crosshair, Coord X, Coord Y) -{ - BoxType SearchBox = point_box(X, Y); - struct onpoint_search_info info; - int i; - pcb_bool redraw = pcb_false; - - op_swap(crosshair); - - /* Do not truncate to 0 because that may free the array */ - vtop_truncate(&crosshair->onpoint_objs, 1); - crosshair->onpoint_objs.used = 0; - - - info.crosshair = crosshair; - info.X = X; - info.Y = Y; - - for (i = 0; i < max_copper_layer; i++) { - LayerType *layer = &PCB->Data->Layer[i]; - /* Only find points of arcs and lines on currently visible layers. */ - if (!layer->On) - continue; - r_search(layer->line_tree, &SearchBox, NULL, onpoint_line_callback, &info, NULL); - r_search(layer->arc_tree, &SearchBox, NULL, onpoint_arc_callback, &info, NULL); - } - - /* Undraw the old objects */ - for (i = 0; i < crosshair->old_onpoint_objs.used; i++) { - OnpointType *op = &crosshair->old_onpoint_objs.array[i]; - - /* only remove and redraw those which aren't in the new list */ - if (onpoint_find(&crosshair->onpoint_objs, op->obj.any) != NULL) - continue; - - CLEAR_FLAG(PCB_FLAG_ONPOINT, (AnyObjectType *) op->obj.any); - DrawLineOrArc(op->type, op->obj.any); - redraw = pcb_true; - } - - /* draw the new objects */ - for (i = 0; i < crosshair->onpoint_objs.used; i++) { - OnpointType *op = &crosshair->onpoint_objs.array[i]; - - /* only draw those which aren't in the old list */ - if (onpoint_find(&crosshair->old_onpoint_objs, op->obj.any) != NULL) - continue; - DrawLineOrArc(op->type, op->obj.any); - redraw = pcb_true; - } - - if (redraw) { - Redraw(); - } -} - -/* --------------------------------------------------------------------------- - * Returns the square of the given number - */ -static double square(double x) -{ - return x * x; -} - -static double crosshair_sq_dist(CrosshairType * crosshair, Coord x, Coord y) -{ - return square(x - crosshair->X) + square(y - crosshair->Y); -} - -struct snap_data { - CrosshairType *crosshair; - double nearest_sq_dist; - pcb_bool nearest_is_grid; - Coord x, y; -}; - -/* Snap to a given location if it is the closest thing we found so far. - * If "prefer_to_grid" is set, the passed location will take preference - * over a closer grid points we already snapped to UNLESS the user is - * pressing the SHIFT key. If the SHIFT key is pressed, the closest object - * (including grid points), is always preferred. - */ -static void check_snap_object(struct snap_data *snap_data, Coord x, Coord y, pcb_bool prefer_to_grid) -{ - double sq_dist; - - sq_dist = crosshair_sq_dist(snap_data->crosshair, x, y); - if (sq_dist < snap_data->nearest_sq_dist || (prefer_to_grid && snap_data->nearest_is_grid && !gui->shift_is_pressed())) { - snap_data->x = x; - snap_data->y = y; - snap_data->nearest_sq_dist = sq_dist; - snap_data->nearest_is_grid = pcb_false; - } -} - -static void check_snap_offgrid_line(struct snap_data *snap_data, Coord nearest_grid_x, Coord nearest_grid_y) -{ - void *ptr1, *ptr2, *ptr3; - int ans; - LineType *line; - Coord try_x, try_y; - double dx, dy; - double dist; - - if (!conf_core.editor.snap_pin) - return; - - /* Code to snap at some sensible point along a line */ - /* Pick the nearest grid-point in the x or y direction - * to align with, then adjust until we hit the line - */ - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_LINE, &ptr1, &ptr2, &ptr3); - - if (ans == PCB_TYPE_NONE) - return; - - line = (LineType *) ptr2; - - /* Allow snapping to off-grid lines when drawing new lines (on - * the same layer), and when moving a line end-point - * (but don't snap to the same line) - */ - if ((conf_core.editor.mode != PCB_MODE_LINE || CURRENT != ptr1) && - (conf_core.editor.mode != PCB_MODE_MOVE || - Crosshair.AttachedObject.Ptr1 != ptr1 || - Crosshair.AttachedObject.Type != PCB_TYPE_LINE_POINT || Crosshair.AttachedObject.Ptr2 == line)) - return; - - dx = line->Point2.X - line->Point1.X; - dy = line->Point2.Y - line->Point1.Y; - - /* Try snapping along the X axis */ - if (dy != 0.) { - /* Move in the X direction until we hit the line */ - try_x = (nearest_grid_y - line->Point1.Y) / dy * dx + line->Point1.X; - try_y = nearest_grid_y; - check_snap_object(snap_data, try_x, try_y, pcb_true); - } - - /* Try snapping along the Y axis */ - if (dx != 0.) { - try_x = nearest_grid_x; - try_y = (nearest_grid_x - line->Point1.X) / dx * dy + line->Point1.Y; - check_snap_object(snap_data, try_x, try_y, pcb_true); - } - - if (dx != dy) { /* If line not parallel with dX = dY direction.. */ - /* Try snapping diagonally towards the line in the dX = dY direction */ - - if (dy == 0) - dist = line->Point1.Y - nearest_grid_y; - else - dist = ((line->Point1.X - nearest_grid_x) - (line->Point1.Y - nearest_grid_y) * dx / dy) / (1 - dx / dy); - - try_x = nearest_grid_x + dist; - try_y = nearest_grid_y + dist; - - check_snap_object(snap_data, try_x, try_y, pcb_true); - } - - if (dx != -dy) { /* If line not parallel with dX = -dY direction.. */ - /* Try snapping diagonally towards the line in the dX = -dY direction */ - - if (dy == 0) - dist = nearest_grid_y - line->Point1.Y; - else - dist = ((line->Point1.X - nearest_grid_x) - (line->Point1.Y - nearest_grid_y) * dx / dy) / (1 + dx / dy); - - try_x = nearest_grid_x + dist; - try_y = nearest_grid_y - dist; - - check_snap_object(snap_data, try_x, try_y, pcb_true); - } -} - -/* --------------------------------------------------------------------------- - * recalculates the passed coordinates to fit the current grid setting - */ -void FitCrosshairIntoGrid(Coord X, Coord Y) -{ - Coord nearest_grid_x, nearest_grid_y; - void *ptr1, *ptr2, *ptr3; - struct snap_data snap_data; - int ans; - - Crosshair.X = PCB_CLAMP(X, Crosshair.MinX, Crosshair.MaxX); - Crosshair.Y = PCB_CLAMP(Y, Crosshair.MinY, Crosshair.MaxY); - - if (PCB->RatDraw) { - nearest_grid_x = -PCB_MIL_TO_COORD(6); - nearest_grid_y = -PCB_MIL_TO_COORD(6); - } - else { - nearest_grid_x = GridFit(Crosshair.X, PCB->Grid, PCB->GridOffsetX); - nearest_grid_y = GridFit(Crosshair.Y, PCB->Grid, PCB->GridOffsetY); - - if (Marked.status && conf_core.editor.orthogonal_moves) { - Coord dx = Crosshair.X - Marked.X; - Coord dy = Crosshair.Y - Marked.Y; - if (PCB_ABS(dx) > PCB_ABS(dy)) - nearest_grid_y = Marked.Y; - else - nearest_grid_x = Marked.X; - } - - } - - snap_data.crosshair = &Crosshair; - snap_data.nearest_sq_dist = crosshair_sq_dist(&Crosshair, nearest_grid_x, nearest_grid_y); - snap_data.nearest_is_grid = pcb_true; - snap_data.x = nearest_grid_x; - snap_data.y = nearest_grid_y; - - ans = PCB_TYPE_NONE; - if (!PCB->RatDraw) - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, &ptr3); - - if (ans & PCB_TYPE_ELEMENT) { - ElementType *el = (ElementType *) ptr1; - check_snap_object(&snap_data, el->MarkX, el->MarkY, pcb_false); - } - - ans = PCB_TYPE_NONE; - if (PCB->RatDraw || conf_core.editor.snap_pin) - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_PAD, &ptr1, &ptr2, &ptr3); - - /* Avoid self-snapping when moving */ - if (ans != PCB_TYPE_NONE && - conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT && ptr1 == Crosshair.AttachedObject.Ptr1) - ans = PCB_TYPE_NONE; - - if (ans != PCB_TYPE_NONE && - (conf_core.editor.mode == PCB_MODE_LINE || (conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT))) { - PadTypePtr pad = (PadTypePtr) ptr2; - LayerType *desired_layer; - pcb_cardinal_t desired_group; - pcb_cardinal_t SLayer, CLayer; - int found_our_layer = pcb_false; - - desired_layer = CURRENT; - if (conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT) { - desired_layer = (LayerType *) Crosshair.AttachedObject.Ptr1; - } - - /* find layer groups of the component side and solder side */ - SLayer = GetLayerGroupNumberByNumber(solder_silk_layer); - CLayer = GetLayerGroupNumberByNumber(component_silk_layer); - desired_group = TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SLayer : CLayer; - - GROUP_LOOP(PCB->Data, desired_group); - { - if (layer == desired_layer) { - found_our_layer = pcb_true; - break; - } - } - END_LOOP; - - if (found_our_layer == pcb_false) - ans = PCB_TYPE_NONE; - } - - if (ans != PCB_TYPE_NONE) { - PadType *pad = (PadType *) ptr2; - check_snap_object(&snap_data, (pad->Point1.X + pad->Point2.X) / 2, (pad->Point1.Y + pad->Point2.Y) / 2, pcb_true); - } - - ans = PCB_TYPE_NONE; - if (PCB->RatDraw || conf_core.editor.snap_pin) - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3); - - /* Avoid self-snapping when moving */ - if (ans != PCB_TYPE_NONE && - conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT && ptr1 == Crosshair.AttachedObject.Ptr1) - ans = PCB_TYPE_NONE; - - if (ans != PCB_TYPE_NONE) { - PinType *pin = (PinType *) ptr2; - check_snap_object(&snap_data, pin->X, pin->Y, pcb_true); - } - - ans = PCB_TYPE_NONE; - if (conf_core.editor.snap_pin) - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_VIA, &ptr1, &ptr2, &ptr3); - - /* Avoid snapping vias to any other vias */ - if (conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_VIA && (ans & PCB_TYPEMASK_PIN)) - ans = PCB_TYPE_NONE; - - if (ans != PCB_TYPE_NONE) { - PinType *pin = (PinType *) ptr2; - check_snap_object(&snap_data, pin->X, pin->Y, pcb_true); - } - - ans = PCB_TYPE_NONE; - if (conf_core.editor.snap_pin) - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_LINE_POINT, &ptr1, &ptr2, &ptr3); - - if (ans != PCB_TYPE_NONE) { - PointType *pnt = (PointType *) ptr3; - check_snap_object(&snap_data, pnt->X, pnt->Y, pcb_true); - } - - /* - * Snap to offgrid points on lines. - */ - if (conf_core.editor.snap_offgrid_line) - check_snap_offgrid_line(&snap_data, nearest_grid_x, nearest_grid_y); - - ans = PCB_TYPE_NONE; - if (conf_core.editor.snap_pin) - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_POLYGON_POINT, &ptr1, &ptr2, &ptr3); - - if (ans != PCB_TYPE_NONE) { - PointType *pnt = (PointType *) ptr3; - check_snap_object(&snap_data, pnt->X, pnt->Y, pcb_true); - } - - if (snap_data.x >= 0 && snap_data.y >= 0) { - Crosshair.X = snap_data.x; - Crosshair.Y = snap_data.y; - } - - if (conf_core.editor.highlight_on_point) - onpoint_work(&Crosshair, Crosshair.X, Crosshair.Y); - - if (conf_core.editor.mode == PCB_MODE_ARROW) { - ans = SearchScreenGridSlop(Crosshair.X, Crosshair.Y, PCB_TYPE_LINE_POINT, &ptr1, &ptr2, &ptr3); - if (ans == PCB_TYPE_NONE) - hid_action("PointCursor"); - else if (!TEST_FLAG(PCB_FLAG_SELECTED, (LineType *) ptr2)) - hid_actionl("PointCursor", "True", NULL); - } - - if (conf_core.editor.mode == PCB_MODE_LINE && Crosshair.AttachedLine.State != STATE_FIRST && conf_core.editor.auto_drc) - EnforceLineDRC(); - - gui->set_crosshair(Crosshair.X, Crosshair.Y, HID_SC_DO_NOTHING); -} - -/* --------------------------------------------------------------------------- - * move crosshair relative (has to be switched off) - */ -void MoveCrosshairRelative(Coord DeltaX, Coord DeltaY) -{ - FitCrosshairIntoGrid(Crosshair.X + DeltaX, Crosshair.Y + DeltaY); -} - -/* --------------------------------------------------------------------------- - * move crosshair absolute - * return pcb_true if the crosshair was moved from its existing position - */ -pcb_bool MoveCrosshairAbsolute(Coord X, Coord Y) -{ - Coord x, y, z; - x = Crosshair.X; - y = Crosshair.Y; - FitCrosshairIntoGrid(X, Y); - if (Crosshair.X != x || Crosshair.Y != y) { - /* back up to old position to notify the GUI - * (which might want to erase the old crosshair) */ - z = Crosshair.X; - Crosshair.X = x; - x = z; - z = Crosshair.Y; - Crosshair.Y = y; - notify_crosshair_change(pcb_false); /* Our caller notifies when it has done */ - /* now move forward again */ - Crosshair.X = x; - Crosshair.Y = z; - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * sets the valid range for the crosshair cursor - */ -void SetCrosshairRange(Coord MinX, Coord MinY, Coord MaxX, Coord MaxY) -{ - Crosshair.MinX = MAX(0, MinX); - Crosshair.MinY = MAX(0, MinY); - Crosshair.MaxX = MIN(PCB->MaxWidth, MaxX); - Crosshair.MaxY = MIN(PCB->MaxHeight, MaxY); - - /* force update of position */ - MoveCrosshairRelative(0, 0); -} - -/* --------------------------------------------------------------------------- - * initializes crosshair stuff - * clears the struct, allocates to graphical contexts - */ -void InitCrosshair(void) -{ - Crosshair.GC = gui->make_gc(); - - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); - gui->set_draw_xor(Crosshair.GC, 1); - gui->set_line_cap(Crosshair.GC, Trace_Cap); - gui->set_line_width(Crosshair.GC, 1); - - /* set initial shape */ - Crosshair.shape = Basic_Crosshair_Shape; - - /* set default limits */ - Crosshair.MinX = Crosshair.MinY = 0; - Crosshair.MaxX = PCB->MaxWidth; - Crosshair.MaxY = PCB->MaxHeight; - - /* Initialize the onpoint data. */ - memset(&Crosshair.onpoint_objs, 0, sizeof(vtop_t)); - memset(&Crosshair.old_onpoint_objs, 0, sizeof(vtop_t)); - - /* clear the mark */ - Marked.status = pcb_false; -} - -/* --------------------------------------------------------------------------- - * exits crosshair routines, release GCs - */ -void DestroyCrosshair(void) -{ - FreePolygonMemory(&Crosshair.AttachedPolygon); - gui->destroy_gc(Crosshair.GC); -} Index: 1.1.4/src/object_act.c =================================================================== --- 1.1.4/src/object_act.c (revision 10776) +++ 1.1.4/src/object_act.c (nonexistent) @@ -1,1024 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" - -#include "data.h" -#include "action_helper.h" -#include "change.h" -#include "error.h" -#include "undo.h" -#include "funchash_core.h" - -#include "search.h" -#include "move.h" -#include "draw.h" -#include "mirror.h" -#include "rotate.h" -#include "set.h" -#include "copy.h" -#include "misc.h" -#include "rubberband.h" -#include "buffer.h" -#include "remove.h" -#include "create.h" -#include "misc_util.h" -#include "compat_misc.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- */ - -static ElementType *element_cache = NULL; - -static ElementType *find_element_by_refdes(const char *refdes) -{ - if (element_cache && NAMEONPCB_NAME(element_cache) - && strcmp(NAMEONPCB_NAME(element_cache), refdes) == 0) - return element_cache; - - ELEMENT_LOOP(PCB->Data); - { - if (NAMEONPCB_NAME(element) - && strcmp(NAMEONPCB_NAME(element), refdes) == 0) { - element_cache = element; - return element_cache; - } - } - END_LOOP; - return NULL; -} - -static AttributeType *lookup_attr(AttributeListTypePtr list, const char *name) -{ - int i; - for (i = 0; i < list->Number; i++) - if (strcmp(list->List[i].name, name) == 0) - return &list->List[i]; - return NULL; -} - -static void delete_attr(AttributeListTypePtr list, AttributeType * attr) -{ - int idx = attr - list->List; - if (idx < 0 || idx >= list->Number) - return; - if (list->Number - idx > 1) - memmove(attr, attr + 1, (list->Number - idx - 1) * sizeof(AttributeType)); - list->Number--; -} - -/* ------------------------------------------------------------ */ - -static const char attributes_syntax[] = "Attributes(Layout|Layer|Element)\n" "Attributes(Layer,layername)"; - -static const char attributes_help[] = - "Let the user edit the attributes of the layout, current or given\n" "layer, or selected element."; - -/* %start-doc actions Attributes - -This just pops up a dialog letting the user edit the attributes of the -pcb, an element, or a layer. - -%end-doc */ - - -static int ActionAttributes(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *layername = ACTION_ARG(1); - char *buf; - - if (!function) - AFAIL(attributes); - - if (!gui->edit_attributes) { - Message(PCB_MSG_DEFAULT, _("This GUI doesn't support Attribute Editing\n")); - return 1; - } - - switch (funchash_get(function, NULL)) { - case F_Layout: - { - gui->edit_attributes("Layout Attributes", &(PCB->Attributes)); - return 0; - } - - case F_Layer: - { - LayerType *layer = CURRENT; - if (layername) { - int i; - layer = NULL; - for (i = 0; i < max_copper_layer; i++) - if (strcmp(PCB->Data->Layer[i].Name, layername) == 0) { - layer = &(PCB->Data->Layer[i]); - break; - } - if (layer == NULL) { - Message(PCB_MSG_DEFAULT, _("No layer named %s\n"), layername); - return 1; - } - } - buf = (char *) malloc(strlen(layer->Name) + strlen("Layer X Attributes")); - sprintf(buf, "Layer %s Attributes", layer->Name); - gui->edit_attributes(buf, &(layer->Attributes)); - free(buf); - return 0; - } - - case F_Element: - { - int n_found = 0; - ElementType *e = NULL; - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, element)) { - e = element; - n_found++; - } - } - END_LOOP; - if (n_found > 1) { - Message(PCB_MSG_DEFAULT, _("Too many elements selected\n")); - return 1; - } - if (n_found == 0) { - void *ptrtmp; - gui->get_coords(_("Click on an element"), &x, &y); - if ((SearchScreen(x, y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) - e = (ElementTypePtr) ptrtmp; - else { - Message(PCB_MSG_DEFAULT, _("No element found there\n")); - return 1; - } - } - - if (NAMEONPCB_NAME(e)) { - buf = (char *) malloc(strlen(NAMEONPCB_NAME(e)) + strlen("Element X Attributes")); - sprintf(buf, "Element %s Attributes", NAMEONPCB_NAME(e)); - } - else { - buf = pcb_strdup("Unnamed Element Attributes"); - } - gui->edit_attributes(buf, &(e->Attributes)); - free(buf); - break; - } - - default: - AFAIL(attributes); - } - - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char disperseelements_syntax[] = "DisperseElements(All|Selected)"; - -static const char disperseelements_help[] = "Disperses elements."; - -/* %start-doc actions DisperseElements - -Normally this is used when starting a board, by selecting all elements -and then dispersing them. This scatters the elements around the board -so that you can pick individual ones, rather than have all the -elements at the same 0,0 coordinate and thus impossible to choose -from. - -%end-doc */ - -#define GAP PCB_MIL_TO_COORD(100) - -static int ActionDisperseElements(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - Coord minx = GAP, miny = GAP, maxy = GAP, dx, dy; - int all = 0, bad = 0; - - if (!function || !*function) { - bad = 1; - } - else { - switch (funchash_get(function, NULL)) { - case F_All: - all = 1; - break; - - case F_Selected: - all = 0; - break; - - default: - bad = 1; - } - } - - if (bad) { - AFAIL(disperseelements); - } - - - ELEMENT_LOOP(PCB->Data); - { - /* - * If we want to disperse selected elements, maybe we need smarter - * code here to avoid putting components on top of others which - * are not selected. For now, I'm assuming that this is typically - * going to be used either with a brand new design or a scratch - * design holding some new components - */ - if (!TEST_FLAG(PCB_FLAG_LOCK, element) && (all || TEST_FLAG(PCB_FLAG_SELECTED, element))) { - - /* figure out how much to move the element */ - dx = minx - element->BoundingBox.X1; - - /* snap to the grid */ - dx -= (element->MarkX + dx) % PCB->Grid; - - /* - * and add one grid size so we make sure we always space by GAP or - * more - */ - dx += PCB->Grid; - - /* Figure out if this row has room. If not, start a new row */ - if (GAP + element->BoundingBox.X2 + dx > PCB->MaxWidth) { - miny = maxy + GAP; - minx = GAP; - } - - /* figure out how much to move the element */ - dx = minx - element->BoundingBox.X1; - dy = miny - element->BoundingBox.Y1; - - /* snap to the grid */ - dx -= (element->MarkX + dx) % PCB->Grid; - dx += PCB->Grid; - dy -= (element->MarkY + dy) % PCB->Grid; - dy += PCB->Grid; - - /* move the element */ - MoveElementLowLevel(PCB->Data, element, dx, dy); - - /* and add to the undo list so we can undo this operation */ - AddObjectToMoveUndoList(PCB_TYPE_ELEMENT, NULL, NULL, element, dx, dy); - - /* keep track of how tall this row is */ - minx += element->BoundingBox.X2 - element->BoundingBox.X1 + GAP; - if (maxy < element->BoundingBox.Y2) { - maxy = element->BoundingBox.Y2; - } - } - - } - END_LOOP; - - /* done with our action so increment the undo # */ - IncrementUndoSerialNumber(); - - Redraw(); - SetChangedFlag(pcb_true); - - return 0; -} - -#undef GAP - -/* -------------------------------------------------------------------------- */ - -static const char flip_syntax[] = "Flip(Object|Selected|SelectedElements)"; - -static const char flip_help[] = "Flip an element to the opposite side of the board."; - -/* %start-doc actions Flip - -Note that the location of the element will be symmetric about the -cursor location; i.e. if the part you are pointing at will still be at -the same spot once the element is on the other side. When flipping -multiple elements, this retains their positions relative to each -other, not their absolute positions on the board. - -%end-doc */ - -static int ActionFlip(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - ElementTypePtr element; - void *ptrtmp; - int err = 0; - - if (function) { - switch (funchash_get(function, NULL)) { - case F_Object: - if ((SearchScreen(x, y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) { - element = (ElementTypePtr) ptrtmp; - ChangeElementSide(element, 2 * Crosshair.Y - PCB->MaxHeight); - IncrementUndoSerialNumber(); - Draw(); - } - break; - case F_Selected: - case F_SelectedElements: - ChangeSelectedElementSide(); - break; - default: - err = 1; - break; - } - if (!err) - return 0; - } - - AFAIL(flip); -} -/* --------------------------------------------------------------------------- */ - -static const char moveobject_syntax[] = "MoveObject(X,Y,dim)"; - -static const char moveobject_help[] = "Moves the object under the crosshair."; - -/* %start-doc actions MoveObject - -The @code{X} and @code{Y} are treated like @code{delta} is for many -other objects. For each, if it's prefixed by @code{+} or @code{-}, -then that amount is relative. Otherwise, it's absolute. Units can be -@code{mil} or @code{mm}; if unspecified, units are PCB's internal -units, currently 1/100 mil. - -%end-doc */ - -static int ActionMoveObject(int argc, const char **argv, Coord x, Coord y) -{ - const char *x_str = ACTION_ARG(0); - const char *y_str = ACTION_ARG(1); - const char *units = ACTION_ARG(2); - Coord nx, ny; - pcb_bool absolute1, absolute2; - void *ptr1, *ptr2, *ptr3; - int type; - - ny = GetValue(y_str, units, &absolute1, NULL); - nx = GetValue(x_str, units, &absolute2, NULL); - - type = SearchScreen(x, y, MOVE_TYPES, &ptr1, &ptr2, &ptr3); - if (type == PCB_TYPE_NONE) { - Message(PCB_MSG_DEFAULT, _("Nothing found under crosshair\n")); - return 1; - } - if (absolute1) - nx -= x; - if (absolute2) - ny -= y; - Crosshair.AttachedObject.RubberbandN = 0; - if (conf_core.editor.rubber_band_mode) - LookupRubberbandLines(type, ptr1, ptr2, ptr3); - if (type == PCB_TYPE_ELEMENT) - LookupRatLines(type, ptr1, ptr2, ptr3); - MoveObjectAndRubberband(type, ptr1, ptr2, ptr3, nx, ny); - SetChangedFlag(pcb_true); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char movetocurrentlayer_syntax[] = "MoveToCurrentLayer(Object|SelectedObjects)"; - -static const char movetocurrentlayer_help[] = "Moves objects to the current layer."; - -/* %start-doc actions MoveToCurrentLayer - -Note that moving an element from a component layer to a solder layer, -or from solder to component, won't automatically flip it. Use the -@code{Flip()} action to do that. - -%end-doc */ - -static int ActionMoveToCurrentLayer(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, MOVETOLAYER_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (MoveObjectToLayer(type, ptr1, ptr2, ptr3, CURRENT, pcb_false)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedObjects: - case F_Selected: - if (MoveSelectedObjectsToLayer(CURRENT)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* ---------------------------------------------------------------- */ -static const char elementlist_syntax[] = "ElementList(Start|Done|Need,,,)"; - -static const char elementlist_help[] = "Adds the given element if it doesn't already exist."; - -/* %start-doc actions elementlist - -@table @code - -@item Start -Indicates the start of an element list; call this before any Need -actions. - -@item Need -Searches the board for an element with a matching refdes. - -If found, the value and footprint are updated. - -If not found, a new element is created with the given footprint and value. - -@item Done -Compares the list of elements needed since the most recent -@code{start} with the list of elements actually on the board. Any -elements that weren't listed are selected, so that the user may delete -them. - -@end table - -%end-doc */ - -static int number_of_footprints_not_found; - -static int parse_layout_attribute_units(const char *name, int def) -{ - const char *as = AttributeGet(PCB, name); - if (!as) - return def; - return GetValue(as, NULL, NULL, NULL); -} - -static int ActionElementList(int argc, const char **argv, Coord x, Coord y) -{ - ElementType *e = NULL; - const char *refdes, *value, *footprint; - const char *args[3]; - const char *function = argv[0]; - char *old; - -#ifdef DEBUG - printf("Entered ActionElementList, executing function %s\n", function); -#endif - - if (strcasecmp(function, "start") == 0) { - ELEMENT_LOOP(PCB->Data); - { - CLEAR_FLAG(PCB_FLAG_FOUND, element); - } - END_LOOP; - element_cache = NULL; - number_of_footprints_not_found = 0; - return 0; - } - - if (strcasecmp(function, "done") == 0) { - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, element)) { - CLEAR_FLAG(PCB_FLAG_FOUND, element); - } - else if (!EMPTY_STRING_P(NAMEONPCB_NAME(element))) { - /* Unnamed elements should remain untouched */ - SET_FLAG(PCB_FLAG_SELECTED, element); - } - } - END_LOOP; - if (number_of_footprints_not_found > 0) - gui->confirm_dialog("Not all requested footprints were found.\n" "See the message log for details", "Ok", NULL); - return 0; - } - - if (strcasecmp(function, "need") != 0) - AFAIL(elementlist); - - if (argc != 4) - AFAIL(elementlist); - - argc--; - argv++; - - refdes = ACTION_ARG(0); - footprint = ACTION_ARG(1); - value = ACTION_ARG(2); - - args[0] = footprint; - args[1] = refdes; - args[2] = value; - -#ifdef DEBUG - printf(" ... footprint = %s\n", footprint); - printf(" ... refdes = %s\n", refdes); - printf(" ... value = %s\n", value); -#endif - - e = find_element_by_refdes(refdes); - - if (!e) { - Coord nx, ny, d; - -#ifdef DEBUG - printf(" ... Footprint not on board, need to add it.\n"); -#endif - /* Not on board, need to add it. */ - if (LoadFootprint(argc, args, x, y)) { - number_of_footprints_not_found++; - return 1; - } - - nx = PCB->MaxWidth / 2; - ny = PCB->MaxHeight / 2; - d = MIN(PCB->MaxWidth, PCB->MaxHeight) / 10; - - nx = parse_layout_attribute_units("import::newX", nx); - ny = parse_layout_attribute_units("import::newY", ny); - d = parse_layout_attribute_units("import::disperse", d); - - if (d > 0) { - nx += pcb_rand() % (d * 2) - d; - ny += pcb_rand() % (d * 2) - d; - } - - if (nx < 0) - nx = 0; - if (nx >= PCB->MaxWidth) - nx = PCB->MaxWidth - 1; - if (ny < 0) - ny = 0; - if (ny >= PCB->MaxHeight) - ny = PCB->MaxHeight - 1; - - /* Place components onto center of board. */ - if (CopyPastebufferToLayout(nx, ny)) - SetChangedFlag(pcb_true); - } - - else if (e && strcmp(DESCRIPTION_NAME(e), footprint) != 0) { -#ifdef DEBUG - printf(" ... Footprint on board, but different from footprint loaded.\n"); -#endif - int er, pr, i; - Coord mx, my; - ElementType *pe; - - /* Different footprint, we need to swap them out. */ - if (LoadFootprint(argc, args, x, y)) { - number_of_footprints_not_found++; - return 1; - } - - er = ElementOrientation(e); - pe = elementlist_first(&(PASTEBUFFER->Data->Element)); - if (!FRONT(e)) - MirrorElementCoordinates(PASTEBUFFER->Data, pe, pe->MarkY * 2 - PCB->MaxHeight); - pr = ElementOrientation(pe); - - mx = e->MarkX; - my = e->MarkY; - - if (er != pr) - RotateElementLowLevel(PASTEBUFFER->Data, pe, pe->MarkX, pe->MarkY, (er - pr + 4) % 4); - - for (i = 0; i < MAX_ELEMENTNAMES; i++) { - pe->Name[i].X = e->Name[i].X - mx + pe->MarkX; - pe->Name[i].Y = e->Name[i].Y - my + pe->MarkY; - pe->Name[i].Direction = e->Name[i].Direction; - pe->Name[i].Scale = e->Name[i].Scale; - } - - RemoveElement(e); - - if (CopyPastebufferToLayout(mx, my)) - SetChangedFlag(pcb_true); - } - - /* Now reload footprint */ - element_cache = NULL; - e = find_element_by_refdes(refdes); - - old = ChangeElementText(PCB, PCB->Data, e, NAMEONPCB_INDEX, pcb_strdup(refdes)); - if (old) - free(old); - old = ChangeElementText(PCB, PCB->Data, e, VALUE_INDEX, pcb_strdup(value)); - if (old) - free(old); - - SET_FLAG(PCB_FLAG_FOUND, e); - -#ifdef DEBUG - printf(" ... Leaving ActionElementList.\n"); -#endif - - return 0; -} - -/* ---------------------------------------------------------------- */ -static const char elementsetattr_syntax[] = "ElementSetAttr(refdes,name[,value])"; - -static const char elementsetattr_help[] = "Sets or clears an element-specific attribute."; - -/* %start-doc actions elementsetattr - -If a value is specified, the named attribute is added (if not already -present) or changed (if it is) to the given value. If the value is -not specified, the given attribute is removed if present. - -%end-doc */ - -static int ActionElementSetAttr(int argc, const char **argv, Coord x, Coord y) -{ - ElementType *e = NULL; - const char *refdes, *name, *value; - AttributeType *attr; - - if (argc < 2) { - AFAIL(elementsetattr); - } - - refdes = argv[0]; - name = argv[1]; - value = ACTION_ARG(2); - - ELEMENT_LOOP(PCB->Data); - { - if (NSTRCMP(refdes, NAMEONPCB_NAME(element)) == 0) { - e = element; - break; - } - } - END_LOOP; - - if (!e) { - Message(PCB_MSG_DEFAULT, _("Cannot change attribute of %s - element not found\n"), refdes); - return 1; - } - - attr = lookup_attr(&e->Attributes, name); - - if (attr && value) { - free(attr->value); - attr->value = pcb_strdup(value); - } - if (attr && !value) { - delete_attr(&e->Attributes, attr); - } - if (!attr && value) { - CreateNewAttribute(&e->Attributes, name, value); - } - - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char ripup_syntax[] = "RipUp(All|Selected|Element)"; - -static const char ripup_help[] = "Ripup auto-routed tracks, or convert an element to parts."; - -/* %start-doc actions RipUp - -@table @code - -@item All -Removes all lines and vias which were created by the autorouter. - -@item Selected -Removes all selected lines and vias which were created by the -autorouter. - -@item Element -Converts the element under the cursor to parts (vias and lines). Note -that this uses the highest numbered paste buffer. - -@end table - -%end-doc */ - -static int ActionRipUp(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - pcb_bool changed = pcb_false; - - if (function) { - switch (funchash_get(function, NULL)) { - case F_All: - ALLLINE_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_AUTO, line) && !TEST_FLAG(PCB_FLAG_LOCK, line)) { - RemoveObject(PCB_TYPE_LINE, layer, line, line); - changed = pcb_true; - } - } - ENDALL_LOOP; - ALLARC_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_AUTO, arc) && !TEST_FLAG(PCB_FLAG_LOCK, arc)) { - RemoveObject(PCB_TYPE_ARC, layer, arc, arc); - changed = pcb_true; - } - } - ENDALL_LOOP; - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_AUTO, via) && !TEST_FLAG(PCB_FLAG_LOCK, via)) { - RemoveObject(PCB_TYPE_VIA, via, via, via); - changed = pcb_true; - } - } - END_LOOP; - - if (changed) { - IncrementUndoSerialNumber(); - SetChangedFlag(pcb_true); - } - break; - case F_Selected: - VISIBLELINE_LOOP(PCB->Data); - { - if (TEST_FLAGS(PCB_FLAG_AUTO | PCB_FLAG_SELECTED, line) - && !TEST_FLAG(PCB_FLAG_LOCK, line)) { - RemoveObject(PCB_TYPE_LINE, layer, line, line); - changed = pcb_true; - } - } - ENDALL_LOOP; - if (PCB->ViaOn) - VIA_LOOP(PCB->Data); - { - if (TEST_FLAGS(PCB_FLAG_AUTO | PCB_FLAG_SELECTED, via) - && !TEST_FLAG(PCB_FLAG_LOCK, via)) { - RemoveObject(PCB_TYPE_VIA, via, via, via); - changed = pcb_true; - } - } - END_LOOP; - if (changed) { - IncrementUndoSerialNumber(); - SetChangedFlag(pcb_true); - } - break; - case F_Element: - { - void *ptr1, *ptr2, *ptr3; - - if (SearchScreen(Crosshair.X, Crosshair.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, &ptr3) != PCB_TYPE_NONE) { - Note.Buffer = conf_core.editor.buffer_number; - SetBufferNumber(MAX_BUFFER - 1); - ClearBuffer(PASTEBUFFER); - CopyObjectToBuffer(PASTEBUFFER->Data, PCB->Data, PCB_TYPE_ELEMENT, ptr1, ptr2, ptr3); - SmashBufferElement(PASTEBUFFER); - PASTEBUFFER->X = 0; - PASTEBUFFER->Y = 0; - SaveUndoSerialNumber(); - EraseObject(PCB_TYPE_ELEMENT, ptr1, ptr1); - MoveObjectToRemoveUndoList(PCB_TYPE_ELEMENT, ptr1, ptr2, ptr3); - RestoreUndoSerialNumber(); - CopyPastebufferToLayout(0, 0); - SetBufferNumber(Note.Buffer); - SetChangedFlag(pcb_true); - } - } - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char minmaskgap_syntax[] = "MinMaskGap(delta)\n" "MinMaskGap(Selected, delta)"; - -static const char minmaskgap_help[] = "Ensures the mask is a minimum distance from pins and pads."; - -/* %start-doc actions MinMaskGap - -Checks all specified pins and/or pads, and increases the mask if -needed to ensure a minimum distance between the pin or pad edge and -the mask edge. - -%end-doc */ - -static int ActionMinMaskGap(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *delta = ACTION_ARG(1); - const char *units = ACTION_ARG(2); - pcb_bool absolute; - Coord value; - int flags; - - if (!function) - return 1; - if (strcasecmp(function, "Selected") == 0) - flags = PCB_FLAG_SELECTED; - else { - units = delta; - delta = function; - flags = 0; - } - value = 2 * GetValue(delta, units, &absolute, NULL); - - SaveUndoSerialNumber(); - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (!TEST_FLAGS(flags, pin)) - continue; - if (pin->Mask < pin->Thickness + value) { - ChangeObjectMaskSize(PCB_TYPE_PIN, element, pin, 0, pin->Thickness + value, 1); - RestoreUndoSerialNumber(); - } - } - END_LOOP; - PAD_LOOP(element); - { - if (!TEST_FLAGS(flags, pad)) - continue; - if (pad->Mask < pad->Thickness + value) { - ChangeObjectMaskSize(PCB_TYPE_PAD, element, pad, 0, pad->Thickness + value, 1); - RestoreUndoSerialNumber(); - } - } - END_LOOP; - } - END_LOOP; - VIA_LOOP(PCB->Data); - { - if (!TEST_FLAGS(flags, via)) - continue; - if (via->Mask && via->Mask < via->Thickness + value) { - ChangeObjectMaskSize(PCB_TYPE_VIA, via, 0, 0, via->Thickness + value, 1); - RestoreUndoSerialNumber(); - } - } - END_LOOP; - RestoreUndoSerialNumber(); - IncrementUndoSerialNumber(); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char mincleargap_syntax[] = "MinClearGap(delta)\n" "MinClearGap(Selected, delta)"; - -static const char mincleargap_help[] = "Ensures that polygons are a minimum distance from objects."; - -/* %start-doc actions MinClearGap - -Checks all specified objects, and increases the polygon clearance if -needed to ensure a minimum distance between their edges and the -polygon edges. - -%end-doc */ - -static int ActionMinClearGap(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *delta = ACTION_ARG(1); - const char *units = ACTION_ARG(2); - pcb_bool absolute; - Coord value; - int flags; - - if (!function) - return 1; - if (strcasecmp(function, "Selected") == 0) - flags = PCB_FLAG_SELECTED; - else { - units = delta; - delta = function; - flags = 0; - } - value = 2 * GetValue(delta, units, &absolute, NULL); - - SaveUndoSerialNumber(); - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (!TEST_FLAGS(flags, pin)) - continue; - if (pin->Clearance < value) { - ChangeObjectClearSize(PCB_TYPE_PIN, element, pin, 0, value, 1); - RestoreUndoSerialNumber(); - } - } - END_LOOP; - PAD_LOOP(element); - { - if (!TEST_FLAGS(flags, pad)) - continue; - if (pad->Clearance < value) { - ChangeObjectClearSize(PCB_TYPE_PAD, element, pad, 0, value, 1); - RestoreUndoSerialNumber(); - } - } - END_LOOP; - } - END_LOOP; - VIA_LOOP(PCB->Data); - { - if (!TEST_FLAGS(flags, via)) - continue; - if (via->Clearance < value) { - ChangeObjectClearSize(PCB_TYPE_VIA, via, 0, 0, value, 1); - RestoreUndoSerialNumber(); - } - } - END_LOOP; - ALLLINE_LOOP(PCB->Data); - { - if (!TEST_FLAGS(flags, line)) - continue; - if (line->Clearance < value) { - ChangeObjectClearSize(PCB_TYPE_LINE, layer, line, 0, value, 1); - RestoreUndoSerialNumber(); - } - } - ENDALL_LOOP; - ALLARC_LOOP(PCB->Data); - { - if (!TEST_FLAGS(flags, arc)) - continue; - if (arc->Clearance < value) { - ChangeObjectClearSize(PCB_TYPE_ARC, layer, arc, 0, value, 1); - RestoreUndoSerialNumber(); - } - } - ENDALL_LOOP; - RestoreUndoSerialNumber(); - IncrementUndoSerialNumber(); - return 0; -} - - -HID_Action object_action_list[] = { - {"Attributes", 0, ActionAttributes, - attributes_help, attributes_syntax} - , - {"DisperseElements", 0, ActionDisperseElements, - disperseelements_help, disperseelements_syntax} - , - {"Flip", N_("Click on Object or Flip Point"), ActionFlip, - flip_help, flip_syntax} - , - {"MoveObject", N_("Select an Object"), ActionMoveObject, - moveobject_help, moveobject_syntax} - , - {"MoveToCurrentLayer", 0, ActionMoveToCurrentLayer, - movetocurrentlayer_help, movetocurrentlayer_syntax} - , - {"ElementList", 0, ActionElementList, - elementlist_help, elementlist_syntax} - , - {"ElementSetAttr", 0, ActionElementSetAttr, - elementsetattr_help, elementsetattr_syntax} - , - {"RipUp", 0, ActionRipUp, - ripup_help, ripup_syntax} - , - {"MinMaskGap", 0, ActionMinMaskGap, - minmaskgap_help, minmaskgap_syntax} - , - {"MinClearGap", 0, ActionMinClearGap, - mincleargap_help, mincleargap_syntax} -}; - -REGISTER_ACTIONS(object_action_list, NULL) Index: 1.1.4/src/stub_vendor.h =================================================================== --- 1.1.4/src/stub_vendor.h (revision 10776) +++ 1.1.4/src/stub_vendor.h (nonexistent) @@ -1,32 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_STUB_VENDOR_H -#define PCB_STUB_VENDOR_H - -#include "config.h" -#include "global.h" - -extern int (*stub_vendorDrillMap)(int); -extern pcb_bool (*stub_vendorIsElementMappable)(ElementTypePtr); - -#endif /* __VENDOR_H__ */ Index: 1.1.4/src/crosshair.h =================================================================== --- 1.1.4/src/crosshair.h (revision 10776) +++ 1.1.4/src/crosshair.h (nonexistent) @@ -1,55 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for crosshair routines */ - -#ifndef PCB_CROSSHAIR_H -#define PCB_CROSSHAIR_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * all possible states of an attached object - */ -#define STATE_FIRST 0 /* initial state */ -#define STATE_SECOND 1 -#define STATE_THIRD 2 - -Coord GridFit(Coord x, Coord grid_spacing, Coord grid_offset); -void notify_crosshair_change(pcb_bool changes_complete); -void notify_mark_change(pcb_bool changes_complete); -void HideCrosshair(void); -void RestoreCrosshair(void); -void DrawAttached(void); -void DrawMark(void); -void MoveCrosshairRelative(Coord, Coord); -pcb_bool MoveCrosshairAbsolute(Coord, Coord); -void SetCrosshairRange(Coord, Coord, Coord, Coord); -void InitCrosshair(void); -void DestroyCrosshair(void); -void FitCrosshairIntoGrid(Coord, Coord); - -#endif Index: 1.1.4/src/insert.c =================================================================== --- 1.1.4/src/insert.c (revision 10776) +++ 1.1.4/src/insert.c (nonexistent) @@ -1,278 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* functions used to insert points into objects - */ - -#include "config.h" -#include "conf_core.h" - -#include "create.h" -#include "crosshair.h" -#include "data.h" -#include "draw.h" -#include "line.h" -#include "misc.h" -#include "polygon.h" -#include "rtree.h" -#include "search.h" -#include "select.h" -#include "set.h" -#include "undo.h" -#include "misc_util.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void *InsertPointIntoLine(LayerTypePtr, LineTypePtr); -static void *InsertPointIntoPolygon(LayerTypePtr, PolygonTypePtr); -static void *InsertPointIntoRat(RatTypePtr); - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static Coord InsertX, InsertY; /* used by local routines as offset */ -static pcb_cardinal_t InsertAt; -static pcb_bool InsertLast; -static pcb_bool Forcible; -static ObjectFunctionType InsertFunctions = { - InsertPointIntoLine, - NULL, - InsertPointIntoPolygon, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - InsertPointIntoRat -}; - -/* --------------------------------------------------------------------------- - * inserts a point into a rat-line - */ -static void *InsertPointIntoRat(RatTypePtr Rat) -{ - LineTypePtr newone; - - newone = CreateDrawnLineOnLayer(CURRENT, Rat->Point1.X, Rat->Point1.Y, - InsertX, InsertY, conf_core.design.line_thickness, 2 * conf_core.design.clearance, Rat->Flags); - if (!newone) - return newone; - AddObjectToCreateUndoList(PCB_TYPE_LINE, CURRENT, newone, newone); - EraseRat(Rat); - DrawLine(CURRENT, newone); - newone = CreateDrawnLineOnLayer(CURRENT, Rat->Point2.X, Rat->Point2.Y, - InsertX, InsertY, conf_core.design.line_thickness, 2 * conf_core.design.clearance, Rat->Flags); - if (newone) { - AddObjectToCreateUndoList(PCB_TYPE_LINE, CURRENT, newone, newone); - DrawLine(CURRENT, newone); - } - MoveObjectToRemoveUndoList(PCB_TYPE_RATLINE, Rat, Rat, Rat); - Draw(); - return (newone); -} - -/* --------------------------------------------------------------------------- - * inserts a point into a line - */ -static void *InsertPointIntoLine(LayerTypePtr Layer, LineTypePtr Line) -{ - LineTypePtr line; - Coord X, Y; - - if (((Line->Point1.X == InsertX) && (Line->Point1.Y == InsertY)) || - ((Line->Point2.X == InsertX) && (Line->Point2.Y == InsertY))) - return (NULL); - X = Line->Point2.X; - Y = Line->Point2.Y; - AddObjectToMoveUndoList(PCB_TYPE_LINE_POINT, Layer, Line, &Line->Point2, InsertX - X, InsertY - Y); - EraseLine(Line); - r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - Line->Point2.X = InsertX; - Line->Point2.Y = InsertY; - SetLineBoundingBox(Line); - r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - DrawLine(Layer, Line); - /* we must create after playing with Line since creation may - * invalidate the line pointer - */ - if ((line = CreateDrawnLineOnLayer(Layer, InsertX, InsertY, X, Y, Line->Thickness, Line->Clearance, Line->Flags))) { - AddObjectToCreateUndoList(PCB_TYPE_LINE, Layer, line, line); - DrawLine(Layer, line); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, line); - /* creation call adds it to the rtree */ - } - Draw(); - return (line); -} - -/* --------------------------------------------------------------------------- - * inserts a point into a polygon - */ -static void *InsertPointIntoPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - PointType save; - pcb_cardinal_t n; - LineType line; - - if (!Forcible) { - /* - * first make sure adding the point is sensible - */ - line.Thickness = 0; - line.Point1 = Polygon->Points[prev_contour_point(Polygon, InsertAt)]; - line.Point2 = Polygon->Points[InsertAt]; - if (IsPointOnLine((float) InsertX, (float) InsertY, 0.0, &line)) - return (NULL); - } - /* - * second, shift the points up to make room for the new point - */ - ErasePolygon(Polygon); - r_delete_entry(Layer->polygon_tree, (BoxTypePtr) Polygon); - save = *CreateNewPointInPolygon(Polygon, InsertX, InsertY); - for (n = Polygon->PointN - 1; n > InsertAt; n--) - Polygon->Points[n] = Polygon->Points[n - 1]; - - /* Shift up indices of any holes */ - for (n = 0; n < Polygon->HoleIndexN; n++) - if (Polygon->HoleIndex[n] > InsertAt || (InsertLast && Polygon->HoleIndex[n] == InsertAt)) - Polygon->HoleIndex[n]++; - - Polygon->Points[InsertAt] = save; - SetChangedFlag(pcb_true); - AddObjectToInsertPointUndoList(PCB_TYPE_POLYGON_POINT, Layer, Polygon, &Polygon->Points[InsertAt]); - - SetPolygonBoundingBox(Polygon); - r_insert_entry(Layer->polygon_tree, (BoxType *) Polygon, 0); - InitClip(PCB->Data, Layer, Polygon); - if (Forcible || !RemoveExcessPolygonPoints(Layer, Polygon)) { - DrawPolygon(Layer, Polygon); - Draw(); - } - return (&Polygon->Points[InsertAt]); -} - -/* --------------------------------------------------------------------------- - * inserts point into objects - */ -void *InsertPointIntoObject(int Type, void *Ptr1, void *Ptr2, pcb_cardinal_t * Ptr3, Coord DX, Coord DY, pcb_bool Force, pcb_bool insert_last) -{ - void *ptr; - - /* setup offset */ - InsertX = DX; - InsertY = DY; - InsertAt = *Ptr3; - InsertLast = insert_last; - Forcible = Force; - - /* the operation insert the points to the undo-list */ - ptr = ObjectOperation(&InsertFunctions, Type, Ptr1, Ptr2, Ptr3); - if (ptr != NULL) - IncrementUndoSerialNumber(); - return (ptr); -} - -/* --------------------------------------------------------------------------- - * adjusts the insert point to make 45 degree lines as necessary - */ -PointTypePtr AdjustInsertPoint(void) -{ - static PointType InsertedPoint; - double m; - Coord x, y, m1, m2; - LineTypePtr line = (LineTypePtr) Crosshair.AttachedObject.Ptr2; - - if (Crosshair.AttachedObject.State == STATE_FIRST) - return NULL; - Crosshair.AttachedObject.Ptr3 = &InsertedPoint; - if (gui->shift_is_pressed()) { - AttachedLineType myline; - /* only force 45 degree for nearest point */ - if (Distance(Crosshair.X, Crosshair.Y, line->Point1.X, line->Point1.Y) < - Distance(Crosshair.X, Crosshair.Y, line->Point2.X, line->Point2.Y)) - myline.Point1 = myline.Point2 = line->Point1; - else - myline.Point1 = myline.Point2 = line->Point2; - FortyFiveLine(&myline); - InsertedPoint.X = myline.Point2.X; - InsertedPoint.Y = myline.Point2.Y; - return &InsertedPoint; - } - if (conf_core.editor.all_direction_lines) { - InsertedPoint.X = Crosshair.X; - InsertedPoint.Y = Crosshair.Y; - return &InsertedPoint; - } - if (Crosshair.X == line->Point1.X) - m1 = 2; /* 2 signals infinite slope */ - else { - m = (double) (Crosshair.X - line->Point1.X) / (Crosshair.Y - line->Point1.Y); - m1 = 0; - if (m > PCB_TAN_30_DEGREE) - m1 = (m > PCB_TAN_60_DEGREE) ? 2 : 1; - else if (m < -PCB_TAN_30_DEGREE) - m1 = (m < -PCB_TAN_60_DEGREE) ? 2 : -1; - } - if (Crosshair.X == line->Point2.X) - m2 = 2; /* 2 signals infinite slope */ - else { - m = (double) (Crosshair.X - line->Point1.X) / (Crosshair.Y - line->Point1.Y); - m2 = 0; - if (m > PCB_TAN_30_DEGREE) - m2 = (m > PCB_TAN_60_DEGREE) ? 2 : 1; - else if (m < -PCB_TAN_30_DEGREE) - m2 = (m < -PCB_TAN_60_DEGREE) ? 2 : -1; - } - if (m1 == m2) { - InsertedPoint.X = line->Point1.X; - InsertedPoint.Y = line->Point1.Y; - return &InsertedPoint; - } - if (m1 == 2) { - x = line->Point1.X; - y = line->Point2.Y + m2 * (line->Point1.X - line->Point2.X); - } - else if (m2 == 2) { - x = line->Point2.X; - y = line->Point1.Y + m1 * (line->Point2.X - line->Point1.X); - } - else { - x = (line->Point2.Y - line->Point1.Y + m1 * line->Point1.X - m2 * line->Point2.X) / (m1 - m2); - y = (m1 * line->Point2.Y - m1 * m2 * line->Point2.X - m2 * line->Point1.Y + m1 * m2 * line->Point1.X) / (m1 - m2); - } - InsertedPoint.X = x; - InsertedPoint.Y = y; - return &InsertedPoint; -} Index: 1.1.4/src/pcb-printf.c =================================================================== --- 1.1.4/src/pcb-printf.c (revision 10776) +++ 1.1.4/src/pcb-printf.c (nonexistent) @@ -1,875 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2011 Andrew Poelstra - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Andrew Poelstra, 16966 60A Ave, V3S 8X5 Surrey, BC, Canada - * asp11@sfu.ca - * - */ - -/*! \file - * \brief Implementation of printf wrapper to output pcb coords and angles - * \par Description - * For details of all supported specifiers, see the comment at the - * top of pcb-printf.h - */ - -#include -#include "config.h" -#include "global.h" - -#include "pcb-printf.h" - -const char *pcb_printf_slot[PCB_PRINTF_SLOT_max] = -{ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 user formats */ - "%mr", /* original unitless cmil file format coord */ - "%.07$$mS" /* safe file format coord */ -}; - -static int min_sig_figs(double d) -{ - char buf[50]; - int rv; - - if (d == 0) - return 0; - - /* Normalize to x.xxxx... form */ - if (d < 0) - d *= -1; - while (d >= 10) - d /= 10; - while (d < 1) - d *= 10; - - rv = sprintf(buf, "%g", d); - return rv; -} - -/* Truncate trailing 0's from str */ -static void do_trunc0(char *str) -{ - char *end = str + strlen(str) - 1; - while((end > str) && (*end == '0') && (end[-1] != '.')) { - *end = '\0'; - end--; - } -} - - -/* Create sprintf specifier, using default_prec no precision is given */ -static inline void make_printf_spec(char *printf_spec_new, const char *printf_spec, int precision, int *trunc0) -{ - int i = 0; - - while (printf_spec[i] == '%' || isdigit(printf_spec[i]) || - printf_spec[i] == '-' || printf_spec[i] == '+' || printf_spec[i] == '#' || printf_spec[i] == '0') - ++i; - - if (printf_spec[i] == '.') { - if ((printf_spec[i+1] == '0') && (isdigit(printf_spec[i+2]))) - *trunc0 = 1; - sprintf(printf_spec_new, ", %sf", printf_spec); - } - else - sprintf(printf_spec_new, ", %s.%df", printf_spec, precision); -} - - -/* sprintf a value */ -#define sprintf_lc_safe(is_file_mode, out, fmt, val) \ -do { \ - if (is_file_mode) { \ - setlocale(LC_ALL, "C"); \ - sprintf(out, fmt, val); \ - setlocale(LC_ALL, ""); \ - } \ - else \ - sprintf(out, fmt, val); \ - if (trunc0) \ - do_trunc0(filemode_buff); \ -} while(0) - -/* append a suffix, with or without space */ -static int inline append_suffix(gds_t *dest, enum e_suffix suffix_type, const char *suffix) -{ - switch (suffix_type) { - case NO_SUFFIX: - break; - case SUFFIX: - if (gds_append(dest, ' ') != 0) return -1; - /* deliberate fall-thru */ - case FILE_MODE: - if (gds_append_str(dest, suffix) != 0) return -1; - break; - } - return 0; -} - - -/* \brief Internal coord-to-string converter for pcb-printf - * \par Function Description - * Converts a (group of) measurement(s) to a comma-delimited - * string, with appropriate units. If more than one coord is - * given, the list is enclosed in parens to make the scope of - * the unit suffix clear. - * - * \param [in] dest Append the output to this dynamic string - * \param [in] coord Array of coords to convert - * \param [in] n_coords Number of coords in array - * \param [in] printf_spec printf sub-specifier to use with %f - * \param [in] e_allow Bitmap of units the function may use - * \param [in] suffix_type Whether to add a suffix - * - * \return 0 on success, -1 on error - */ -static int CoordsToString(gds_t *dest, Coord coord[], int n_coords, const gds_t *printf_spec_, enum e_allow allow, - enum e_suffix suffix_type) -{ - char filemode_buff[128]; /* G_ASCII_DTOSTR_BUF_SIZE */ - char printf_spec_new_local[256]; - double *value, value_local[32]; - enum e_family family; - const char *suffix; - int i, n, retval = -1, trunc0 = 0; - const char *printf_spec = printf_spec_->array; - char *printf_spec_new; - - if (n_coords > (sizeof(value_local) / sizeof(value_local[0]))) { - value = malloc(n_coords * sizeof *value); - if (value == NULL) - return -1; - } - else - value = value_local; - - if (allow == 0) - allow = ALLOW_ALL; - - i = printf_spec_->used + 64; - if (i > sizeof(printf_spec_new_local)) - printf_spec_new = malloc(i); - else - printf_spec_new = printf_spec_new_local; - - /* Check our freedom in choosing units */ - if ((allow & ALLOW_IMPERIAL) == 0) - family = METRIC; - else if ((allow & ALLOW_METRIC) == 0) - family = IMPERIAL; - else { - int met_votes = 0, imp_votes = 0; - - for (i = 0; i < n_coords; ++i) - if (min_sig_figs(PCB_COORD_TO_MIL(coord[i])) < min_sig_figs(PCB_COORD_TO_MM(coord[i]))) - ++imp_votes; - else - ++met_votes; - - if (imp_votes > met_votes) - family = IMPERIAL; - else - family = METRIC; - } - - /* Set base unit */ - for (i = 0; i < n_coords; ++i) { - switch (family) { - case METRIC: - value[i] = PCB_COORD_TO_MM(coord[i]); - break; - case IMPERIAL: - value[i] = PCB_COORD_TO_MIL(coord[i]); - break; - } - } - - /* Determine scale factor -- find smallest unit that brings - * the whole group above unity */ - for (n = 0; n < get_n_units(); ++n) { - if ((Units[n].allow & allow) != 0 && (Units[n].family == family)) { - int n_above_one = 0; - - for (i = 0; i < n_coords; ++i) - if (fabs(value[i] * Units[n].scale_factor) > 1) - ++n_above_one; - if (n_above_one == n_coords) - break; - } - } - /* If nothing worked, wind back to the smallest allowable unit */ - if (n == get_n_units()) { - do { - --n; - } while ((Units[n].allow & allow) == 0 || Units[n].family != family); - } - - /* Apply scale factor */ - suffix = Units[n].suffix; - for (i = 0; i < n_coords; ++i) - value[i] = value[i] * Units[n].scale_factor; - - make_printf_spec(printf_spec_new, printf_spec, Units[n].default_prec, &trunc0); - - /* Actually sprintf the values in place - * (+ 2 skips the ", " for first value) */ - if (n_coords > 1) - if (gds_append(dest, '(') != 0) - goto err; - - sprintf_lc_safe((suffix_type == FILE_MODE), filemode_buff, printf_spec_new + 2, value[0]); - if (gds_append_str(dest, filemode_buff) != 0) - goto err; - - for (i = 1; i < n_coords; ++i) { - sprintf_lc_safe((suffix_type == FILE_MODE), filemode_buff, printf_spec_new, value[i]); - if (gds_append_str(dest, filemode_buff) != 0) - goto err; - } - if (n_coords > 1) - if (gds_append(dest, ')') != 0) goto err; - - - /* Append suffix */ - if (value[0] != 0 || n_coords > 1) - if (append_suffix(dest, suffix_type, suffix) != 0) - goto err; - - retval = 0; -err:; - if (printf_spec_new != printf_spec_new_local) - free(printf_spec_new); - - if (value != value_local) - free(value); - return retval; -} - -typedef struct { - int score_factor; - - enum e_allow base; - double down_limit; - enum e_allow down; - double up_limit; - enum e_allow up; - - /* persistent, calculated once */ - const Unit *base_unit, *down_unit, *up_unit; -} human_coord_t; - -/* Conversion preference table */ -static human_coord_t human_coord[] = { - {2, ALLOW_MM, 0.001, ALLOW_UM, 1000.0, ALLOW_M ,NULL,NULL,NULL}, - {1, ALLOW_MIL, 0, 0, 1000.0, ALLOW_IN ,NULL,NULL,NULL} -}; -#define NUM_HUMAN_COORD (sizeof(human_coord) / sizeof(human_coord[0])) - -static inline int try_human_coord(Coord coord, const Unit *unit, double down_limit, double up_limit, int score_factor, double *value, unsigned int *best, const char **suffix) -{ - double v, frac; - long int digs, zeros; - unsigned int score; - - /* convert the value to the proposed unit */ - if (unit->family == METRIC) - v = PCB_COORD_TO_MM(coord); - else - v = PCB_COORD_TO_MIL(coord); - v = v * unit->scale_factor; - - /* Check if neighbour units are better */ - if ((down_limit > 0) && (v < down_limit)) - return -1; - if ((up_limit > 0) && (v > up_limit)) - return +1; - - /* count trailing zeros after the decimal point up to 8 digits */ - frac = v - floor(v); - digs = frac * 100000000.0; - if (digs != 0) - for(zeros = 0; (digs % 10) == 0; zeros++, digs /= 10); - else - zeros = 8; - - /* score is higher for more zeroes */ - score = score_factor + 8 * zeros; - -/* printf("try: %s '%.8f' -> %.8f %d score=%d\n", unit->suffix, v, frac, zeros, score);*/ - - /* update the best score */ - if (score > *best) { - *value = v; - *best = score; - *suffix = unit->suffix; - } - - return 0; -} - -/* Same as CoordsToString but take only one coord and print it in human readable format */ -static int CoordsToHumanString(gds_t *dest, Coord coord, const gds_t *printf_spec_, enum e_suffix suffix_type) -{ - char filemode_buff[128]; /* G_ASCII_DTOSTR_BUF_SIZE */ - char printf_spec_new_local[256]; - char *printf_spec_new; - int i, retval = -1, trunc0; - const char *printf_spec = printf_spec_->array; - const char *suffix; - double value; - unsigned int best_score = 0; - - i = printf_spec_->used + 64; - if (i > sizeof(printf_spec_new_local)) - printf_spec_new = malloc(i); - else - printf_spec_new = printf_spec_new_local; - - /* cache unit lookup */ - if (human_coord[0].base_unit == NULL) { - for(i = 0; i < NUM_HUMAN_COORD; i++) { - human_coord[i].base_unit = get_unit_struct_by_allow(human_coord[i].base); - human_coord[i].down_unit = get_unit_struct_by_allow(human_coord[i].down); - human_coord[i].up_unit = get_unit_struct_by_allow(human_coord[i].up); - } - } - - for(i = 0; i < NUM_HUMAN_COORD; i++) { - int res; - /* try the base units first */ - res = try_human_coord(coord, human_coord[i].base_unit, human_coord[i].down_limit, human_coord[i].up_limit, human_coord[i].score_factor,&value, &best_score, &suffix); - if (res < 0) - try_human_coord(coord, human_coord[i].down_unit, 0, 0, human_coord[i].score_factor, &value, &best_score, &suffix); - else if (res > 0) - try_human_coord(coord, human_coord[i].up_unit, 0, 0, human_coord[i].score_factor,&value, &best_score, &suffix); - } - - make_printf_spec(printf_spec_new, printf_spec, 8, &trunc0); - sprintf_lc_safe((suffix_type == FILE_MODE), filemode_buff, printf_spec_new + 2, value); - if (gds_append_str(dest, filemode_buff) != 0) - goto err; - - if (value != 0) { - if (suffix_type == NO_SUFFIX) - suffix_type = SUFFIX; - if (append_suffix(dest, suffix_type, suffix) != 0) - goto err; - } - - err:; - if (printf_spec_new != printf_spec_new_local) - free(printf_spec_new); - return retval; -} - -/* \brief Main low level pcb-printf function - * \par Function Description - * This is a printf wrapper that accepts new format specifiers to - * output pcb coords as various units. See the comment at the top - * of pcb-printf.h for full details. - * - * \param [in] string Append anything new at the end of this dynamic string (must be initialized before the call) - * \param [in] fmt Format specifier - * \param [in] args Arguments to specifier - * - * \return 0 on success - */ -int pcb_append_vprintf(gds_t *string, const char *fmt, va_list args) -{ - gds_t spec; - char tmp[128]; /* large enough for rendering a long long int */ - int tmplen, retval = -1, slot_recursion = 0; - char *free_fmt = NULL; - enum e_allow mask = ALLOW_ALL; - - gds_init(&spec); - - new_fmt:; - while (*fmt) { - enum e_suffix suffix = NO_SUFFIX; - - if (*fmt == '%') { - const char *ext_unit = ""; - Coord value[10]; - int count, i; - - gds_truncate(&spec, 0); - - /* Get printf sub-specifiers */ - if (gds_append(&spec, *fmt++) != 0) goto err; - while (isdigit(*fmt) || *fmt == '.' || *fmt == ' ' || *fmt == '*' - || *fmt == '#' || *fmt == 'l' || *fmt == 'L' || *fmt == 'h' - || *fmt == '+' || *fmt == '-' || *fmt == '[') { - if (*fmt == '*') { - char itmp[32]; - int ilen; - ilen = sprintf(itmp, "%d", va_arg(args, int)); - if (gds_append_len(&spec, itmp, ilen) != 0) goto err; - fmt++; - } - else - if (gds_append(&spec, *fmt++) != 0) goto err; - } - - /* check if specifier is %[] */ - if ((gds_len(&spec) > 2) && (spec.array[1] == '[')) { - int slot = atoi(spec.array+2); - gds_t new_spec; - if ((slot < 0) || (slot > PCB_PRINTF_SLOT_max)) { - fprintf(stderr, "Internal error: invalid printf slot addressed: '%s'\n", spec.array); - abort(); - } - slot_recursion++; - if (slot_recursion > 16) { - fprintf(stderr, "Internal error: printf slot recursion too deep on addressed: '%s'\n", spec.array); - abort(); - } - if (pcb_printf_slot[slot] == NULL) { - fprintf(stderr, "Internal error: printf empty slot reference: '%s'\n", spec.array); - abort(); - } - gds_init(&new_spec); - gds_append_str(&new_spec, pcb_printf_slot[slot]); - if (*fmt == ']') - fmt++; - gds_append_str(&new_spec, fmt); - if (free_fmt != NULL) - free(free_fmt); - fmt = free_fmt = new_spec.array; - memset(&new_spec, 0, sizeof(new_spec)); - gds_truncate(&spec, 0); - goto new_fmt; - } - else - slot_recursion = 0; - - /* Get our sub-specifiers */ - if (*fmt == '#') { - mask = ALLOW_CMIL; /* This must be pcb's base unit */ - fmt++; - } - if (*fmt == '$') { - suffix = SUFFIX; - fmt++; - if (*fmt == '$') { - fmt++; - suffix = FILE_MODE; - } - } - /* Tack full specifier onto specifier */ - if (*fmt != 'm') - if (gds_append(&spec, *fmt) != 0) goto err; - switch (*fmt) { - /* Printf specs */ - case 'o': - case 'i': - case 'd': - case 'u': - case 'x': - case 'X': - if (spec.array[1] == 'l') { -#if 0 -/* C89 does not have long long int - best to avoid %lld */ - if (spec.array[2] == 'l') - tmplen = sprintf(tmp, spec.array, va_arg(args, long long)); - else -#endif - tmplen = sprintf(tmp, spec.array, va_arg(args, long)); - } - else { - tmplen = sprintf(tmp, spec.array, va_arg(args, int)); - } - if (gds_append_len(string, tmp, tmplen) != 0) goto err; - break; - case 'e': - case 'E': - case 'f': - case 'g': - case 'G': - if (strchr(spec.array, '*')) { - int prec = va_arg(args, int); - tmplen = sprintf(tmp, spec.array, va_arg(args, double), prec); - } - else - tmplen = sprintf(tmp, spec.array, va_arg(args, double)); - if (gds_append_len(string, tmp, tmplen) != 0) goto err; - break; - case 'c': - if (spec.array[1] == 'l' && sizeof(int) <= sizeof(wchar_t)) - tmplen = sprintf(tmp, spec.array, va_arg(args, wchar_t)); - else - tmplen = sprintf(tmp, spec.array, va_arg(args, int)); - if (gds_append_len(string, tmp, tmplen) != 0) goto err; - break; - case 's': - if (spec.array[0] == 'l') { - /* TODO: convert wchar to char and append it */ - fprintf(stderr, "Internal error: appending %%ls is not supported\n"); - abort(); - } - else { - const char *s = va_arg(args, const char *); - if (s == NULL) s = "(null)"; - if (gds_append_str(string, s) != 0) goto err; - } - break; - case 'n': - /* Depending on gcc settings, this will probably break with - * some silly "can't put %n in writable data space" message */ - tmplen = sprintf(tmp, spec.array, va_arg(args, int *)); - if (gds_append_len(string, tmp, tmplen) != 0) goto err; - break; - case 'p': - tmplen = sprintf(tmp, spec.array, va_arg(args, void *)); - if (gds_append_len(string, tmp, tmplen) != 0) goto err; - break; - case '%': - if (gds_append(string, '%') != 0) goto err; - break; - /* Our specs */ - case 'm': - ++fmt; - if (*fmt == '*') - ext_unit = va_arg(args, const char *); - if (*fmt != '+' && *fmt != 'a' && *fmt != 'A') - value[0] = va_arg(args, Coord); - count = 1; - switch (*fmt) { - case 'I': - if (CoordsToString(string, value, 1, &spec, ALLOW_NM, NO_SUFFIX) != 0) goto err; - break; - case 's': - if (CoordsToString(string, value, 1, &spec, ALLOW_MM | ALLOW_MIL, suffix) != 0) goto err; - break; - case 'S': - if (CoordsToString(string, value, 1, &spec, mask & ALLOW_NATURAL, suffix) != 0) goto err; - break; - case 'H': - if (CoordsToHumanString(string, value[0], &spec, suffix) != 0) goto err; - break; - case 'M': - if (CoordsToString(string, value, 1, &spec, mask & ALLOW_METRIC, suffix) != 0) goto err; - break; - case 'L': - if (CoordsToString(string, value, 1, &spec, mask & ALLOW_IMPERIAL, suffix) != 0) goto err; - break; - case 'k': - if (CoordsToString(string, value, 1, &spec, mask & ALLOW_DMIL, suffix) != 0) goto err; - break; - case 'r': - if (CoordsToString(string, value, 1, &spec, ALLOW_READABLE, NO_SUFFIX) != 0) goto err; - break; - /* All these fallthroughs are deliberate */ - case '9': - value[count++] = va_arg(args, Coord); - case '8': - value[count++] = va_arg(args, Coord); - case '7': - value[count++] = va_arg(args, Coord); - case '6': - value[count++] = va_arg(args, Coord); - case '5': - value[count++] = va_arg(args, Coord); - case '4': - value[count++] = va_arg(args, Coord); - case '3': - value[count++] = va_arg(args, Coord); - case '2': - case 'D': - value[count++] = va_arg(args, Coord); - if (CoordsToString(string, value, count, &spec, mask & ALLOW_ALL, suffix) != 0) goto err; - break; - case 'd': - value[1] = va_arg(args, Coord); - if (CoordsToString(string, value, 2, &spec, ALLOW_MM | ALLOW_MIL, suffix) != 0) goto err; - break; - case '*': - { - int found = 0; - for (i = 0; i < get_n_units(); ++i) { - if (strcmp(ext_unit, Units[i].suffix) == 0) { - if (CoordsToString(string, value, 1, &spec, Units[i].allow, suffix) != 0) goto err; - found = 1; - break; - } - } - if (!found) - if (CoordsToString(string, value, 1, &spec, mask & ALLOW_ALL, suffix) != 0) goto err; - } - break; - case 'a': - if (gds_append_len(&spec, ".0f", 3) != 0) goto err; - if (suffix == SUFFIX) - if (gds_append_len(&spec, " deg", 4) != 0) goto err; - tmplen = sprintf(tmp, spec.array, (double) va_arg(args, Angle)); - if (gds_append_len(string, tmp, tmplen) != 0) goto err; - break; - case 'A': - if (gds_append_len(&spec, ".0f", 3) != 0) goto err; - /* if (suffix == SUFFIX) - if (gds_append_len(&spec, " deg", 4) != 0) goto err;*/ - tmplen = sprintf(tmp, spec.array, 10*((double) va_arg(args, Angle))); /* kicad legacy needs decidegrees */ - if (gds_append_len(string, tmp, tmplen) != 0) goto err; - break; - case '+': - mask = va_arg(args, enum e_allow); - break; - default: - { - int found = 0; - for (i = 0; i < get_n_units(); ++i) { - if (*fmt == Units[i].printf_code) { - if (CoordsToString(string, value, 1, &spec, Units[i].allow, suffix) != 0) goto err; - found = 1; - break; - } - } - if (!found) - if (CoordsToString(string, value, 1, &spec, ALLOW_ALL, suffix) != 0) goto err; - } - break; - } - break; - } - } - else - if (gds_append(string, *fmt) != 0) goto err; - ++fmt; - } - - retval = 0; -err:; - gds_uninit(&spec); - if (free_fmt != NULL) - free(free_fmt); - - return retval; -} - -/* \brief Wrapper for pcb_append_vprintf that outputs to a string - * - * \param [in] string Pointer to string to output into - * \param [in] fmt Format specifier - * - * \return The length of the written string - */ -int pcb_sprintf(char *string, const char *fmt, ...) -{ - gds_t str; - va_list args; - - gds_init(&str); - va_start(args, fmt); - - /* pretend the string is already allocated to something huge; this doesn't - make the code less safe but saves a copy */ - str.array = string; - str.alloced = 1<<31; - str.no_realloc = 1; - - pcb_append_vprintf(&str, fmt, args); - - va_end(args); - return str.used; -} - -/* \brief Wrapper for pcb_append_vprintf that outputs to a string with a size limit - * - * \param [in] string Pointer to string to output into - * \param [in] len Maximum length - * \param [in] fmt Format specifier - * - * \return The length of the written string - */ -int pcb_snprintf(char *string, size_t len, const char *fmt, ...) -{ - gds_t str; - va_list args; - - gds_init(&str); - va_start(args, fmt); - - str.array = string; - str.alloced = len; - str.no_realloc = 1; - - pcb_append_vprintf(&str, fmt, args); - - va_end(args); - return str.used; -} - -/* \brief Wrapper for pcb_append_vprintf that outputs to a file - * - * \param [in] fh File to output to - * \param [in] fmt Format specifier - * - * \return The length of the written string - */ -int pcb_fprintf(FILE * fh, const char *fmt, ...) -{ - int rv; - va_list args; - - va_start(args, fmt); - rv = pcb_vfprintf(fh, fmt, args); - va_end(args); - - return rv; -} - -/* \brief Wrapper for pcb_append_vprintf that outputs to a file - * - * \param [in] fh File to output to - * \param [in] fmt Format specifier - * \param [in] args Arguments to specifier - * - * \return The length of the written string - */ -int pcb_vfprintf(FILE * fh, const char *fmt, va_list args) -{ - int rv; - gds_t str; - gds_init(&str); - - if (fh == NULL) - rv = -1; - else { - pcb_append_vprintf(&str, fmt, args); - rv = fprintf(fh, "%s", str.array); - } - - gds_uninit(&str); - return rv; -} - -/* \brief Wrapper for pcb_append_vprintf that outputs to stdout - * - * \param [in] fmt Format specifier - * - * \return The length of the written string - */ -int pcb_printf(const char *fmt, ...) -{ - int rv; - gds_t str; - va_list args; - - gds_init(&str); - va_start(args, fmt); - - pcb_append_vprintf(&str, fmt, args); - rv = printf("%s", str.array); - - va_end(args); - gds_uninit(&str); - return rv; -} - -/* \brief Wrapper for pcb_append_vprintf that outputs to a newly allocated string - * - * \param [in] fmt Format specifier - * - * \return The newly allocated string. Must be freed with free. - */ -char *pcb_strdup_printf(const char *fmt, ...) -{ - gds_t str; - va_list args; - - gds_init(&str); - - va_start(args, fmt); - pcb_append_vprintf(&str, fmt, args); - va_end(args); - - return str.array; /* no other allocation has been made */ -} - -/* \brief Wrapper for pcb_append_vprintf that outputs to a string - * - * \param [in] string Pointer to string to output into - * \param [in] fmt Format specifier - * - * \return return the new string; must be free()'d later - */ -char *pcb_strdup_vprintf(const char *fmt, va_list args) -{ - gds_t str; - gds_init(&str); - - pcb_append_vprintf(&str, fmt, args); - - return str.array; /* no other allocation has been made */ -} - - -/* \brief Wrapper for pcb_append_vprintf that appends to a string using vararg API - * - * \param [in] str Existing dynamic string - * \param [in] fmt Format specifier - * - * \return 0 on success - */ -int pcb_append_printf(gds_t *str, const char *fmt, ...) -{ - int retval; - - va_list args; - va_start(args, fmt); - retval = pcb_append_vprintf(str, fmt, args); - va_end(args); - - return retval; -} - - -char *pcb_strdup_subst(const char *template, int (*cb)(gds_t *s, const char **input)) -{ - gds_t s; - const char *curr, *next; - - gds_init(&s); - for(curr = template;;) { - next = strchr(curr, '%'); - if (next == NULL) { - gds_append_str(&s, curr); - return s.array; - } - if (next > curr) - gds_append_len(&s, curr, next-curr); - next++; - switch(*next) { - case '%': - gds_append(&s, '%'); - curr = next+1; - break; - default: - if (cb(&s, &next) != 0) { - /* keep the directive intact */ - gds_append(&s, '%'); - } - curr = next; - } - } - abort(); /* can't get here */ -} Index: 1.1.4/src/undo.c =================================================================== --- 1.1.4/src/undo.c (revision 10776) +++ 1.1.4/src/undo.c (nonexistent) @@ -1,1669 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* functions used to undo operations - * - * Description: - * There are two lists which hold - * - information about a command - * - data of removed objects - * Both lists are organized as first-in-last-out which means that the undo - * list can always use the last entry of the remove list. - * A serial number is incremented whenever an operation is completed. - * An operation itself may consist of several basic instructions. - * E.g.: removing all selected objects is one operation with exactly one - * serial number even if the remove function is called several times. - * - * a lock flag ensures that no infinite loops occur - */ - -#include "config.h" - -#include -#include - -#include "buffer.h" -#include "change.h" -#include "create.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "insert.h" -#include "layer.h" -#include "misc.h" -#include "mirror.h" -#include "move.h" -#include "polygon.h" -#include "remove.h" -#include "rotate.h" -#include "rtree.h" -#include "search.h" -#include "set.h" -#include "undo.h" -#include "strflags.h" -#include "conf_core.h" -#include "compat_misc.h" -#include "netlist.h" - -static pcb_bool between_increment_and_restore = pcb_false; -static pcb_bool added_undo_between_increment_and_restore = pcb_false; - -/* --------------------------------------------------------------------------- - * some local data types - */ -typedef struct { /* information about a change command */ - char *Name; -} ChangeNameType, *ChangeNameTypePtr; - -typedef struct { /* information about a move command */ - Coord DX, DY; /* movement vector */ -} MoveType, *MoveTypePtr; - -typedef struct { /* information about removed polygon points */ - Coord X, Y; /* data */ - int ID; - pcb_cardinal_t Index; /* index in a polygons array of points */ - pcb_bool last_in_contour; /* Whether the point was the last in its contour */ -} RemovedPointType, *RemovedPointTypePtr; - -typedef struct { /* information about rotation */ - Coord CenterX, CenterY; /* center of rotation */ - pcb_cardinal_t Steps; /* number of steps */ -} RotateType, *RotateTypePtr; - -typedef struct { /* information about moves between layers */ - pcb_cardinal_t OriginalLayer; /* the index of the original layer */ -} MoveToLayerType, *MoveToLayerTypePtr; - -typedef struct { /* information about layer changes */ - int old_index; - int new_index; -} LayerChangeType, *LayerChangeTypePtr; - -typedef struct { /* information about poly clear/restore */ - pcb_bool Clear; /* pcb_true was clear, pcb_false was restore */ - LayerTypePtr Layer; -} ClearPolyType, *ClearPolyTypePtr; - -typedef struct { - Angle angle[2]; -} AngleChangeType; - -typedef struct { /* information about netlist lib changes */ - LibraryTypePtr old; - LibraryTypePtr lib; -} NetlistChangeType, *NetlistChangeTypePtr; - -typedef struct { /* holds information about an operation */ - int Serial, /* serial number of operation */ - Type, /* type of operation */ - Kind, /* type of object with given ID */ - ID; /* object ID */ - union { /* some additional information */ - ChangeNameType ChangeName; - MoveType Move; - RemovedPointType RemovedPoint; - RotateType Rotate; - MoveToLayerType MoveToLayer; - FlagType Flags; - Coord Size; - LayerChangeType LayerChange; - ClearPolyType ClearPoly; - NetlistChangeType NetlistChange; - long int CopyID; - AngleChangeType AngleChange; - } Data; -} UndoListType, *UndoListTypePtr; - -/* --------------------------------------------------------------------------- - * some local variables - */ -static DataTypePtr RemoveList = NULL; /* list of removed objects */ -static UndoListTypePtr UndoList = NULL; /* list of operations */ -static int Serial = 1, /* serial number */ - SavedSerial; -static size_t UndoN, RedoN, /* number of entries */ - UndoMax; -static pcb_bool Locked = pcb_false; /* do not add entries if */ -static pcb_bool andDraw = pcb_true; - /* flag is set; prevents from */ - /* infinite loops */ - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static UndoListTypePtr GetUndoSlot(int, int, int); -static void DrawRecoveredObject(int, void *, void *, void *); -static pcb_bool UndoRotate(UndoListTypePtr); -static pcb_bool UndoChangeName(UndoListTypePtr); -static pcb_bool UndoCopyOrCreate(UndoListTypePtr); -static pcb_bool UndoMove(UndoListTypePtr); -static pcb_bool UndoRemove(UndoListTypePtr); -static pcb_bool UndoRemovePoint(UndoListTypePtr); -static pcb_bool UndoInsertPoint(UndoListTypePtr); -static pcb_bool UndoRemoveContour(UndoListTypePtr); -static pcb_bool UndoInsertContour(UndoListTypePtr); -static pcb_bool UndoMoveToLayer(UndoListTypePtr); -static pcb_bool UndoFlag(UndoListTypePtr); -static pcb_bool UndoMirror(UndoListTypePtr); -static pcb_bool UndoChangeSize(UndoListTypePtr); -static pcb_bool UndoChange2ndSize(UndoListTypePtr); -static pcb_bool UndoChangeAngles(UndoListTypePtr); -static pcb_bool UndoChangeRadii(UndoListTypePtr); -static pcb_bool UndoChangeClearSize(UndoListTypePtr); -static pcb_bool UndoChangeMaskSize(UndoListTypePtr); -static pcb_bool UndoClearPoly(UndoListTypePtr); -static int PerformUndo(UndoListTypePtr); - -/* --------------------------------------------------------------------------- - * adds a command plus some data to the undo list - */ -static UndoListTypePtr GetUndoSlot(int CommandType, int ID, int Kind) -{ - UndoListTypePtr ptr; - void *ptr1, *ptr2, *ptr3; - int type; - size_t limit = ((size_t)conf_core.editor.undo_warning_size) * 1024; - -#ifdef DEBUG_ID - if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, ID, Kind) == PCB_TYPE_NONE) - Message(PCB_MSG_DEFAULT, "hace: ID (%d) and Type (%x) mismatch in AddObject...\n", ID, Kind); -#endif - - /* allocate memory */ - if (UndoN >= UndoMax) { - size_t size; - - UndoMax += STEP_UNDOLIST; - size = UndoMax * sizeof(UndoListType); - UndoList = (UndoListTypePtr) realloc(UndoList, size); - memset(&UndoList[UndoN], 0, STEP_REMOVELIST * sizeof(UndoListType)); - - /* ask user to flush the table because of it's size */ - if (size > limit) { - size_t l2; - l2 = (size / limit + 1) * limit; - Message(PCB_MSG_DEFAULT, _("Size of 'undo-list' exceeds %li kb\n"), (long) (l2 >> 10)); - } - } - - /* free structures from the pruned redo list */ - - for (ptr = &UndoList[UndoN]; RedoN; ptr++, RedoN--) - switch (ptr->Type) { - case UNDO_CHANGENAME: - case UNDO_CHANGEPINNUM: - free(ptr->Data.ChangeName.Name); - break; - case UNDO_REMOVE: - type = SearchObjectByID(RemoveList, &ptr1, &ptr2, &ptr3, ptr->ID, ptr->Kind); - if (type != PCB_TYPE_NONE) { - DestroyObject(RemoveList, type, ptr1, ptr2, ptr3); - } - break; - default: - break; - } - - if (between_increment_and_restore) - added_undo_between_increment_and_restore = pcb_true; - - /* copy typefield and serial number to the list */ - ptr = &UndoList[UndoN++]; - ptr->Type = CommandType; - ptr->Kind = Kind; - ptr->ID = ID; - ptr->Serial = Serial; - return (ptr); -} - -/* --------------------------------------------------------------------------- - * redraws the recovered object - */ -static void DrawRecoveredObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (Type & (PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_POLYGON | PCB_TYPE_ARC)) { - LayerTypePtr layer; - - layer = LAYER_PTR(GetLayerNumber(RemoveList, (LayerTypePtr) Ptr1)); - DrawObject(Type, (void *) layer, Ptr2); - } - else - DrawObject(Type, Ptr1, Ptr2); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a 'rotate' operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoRotate(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - /* lookup entry by it's ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - RotateObject(type, ptr1, ptr2, ptr3, - Entry->Data.Rotate.CenterX, Entry->Data.Rotate.CenterY, (4 - Entry->Data.Rotate.Steps) & 0x03); - Entry->Data.Rotate.Steps = (4 - Entry->Data.Rotate.Steps) & 0x03; - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a clear/restore poly operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoClearPoly(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - if (Entry->Data.ClearPoly.Clear) - RestoreToPolygon(PCB->Data, type, Entry->Data.ClearPoly.Layer, ptr3); - else - ClearFromPolygon(PCB->Data, type, Entry->Data.ClearPoly.Layer, ptr3); - Entry->Data.ClearPoly.Clear = !Entry->Data.ClearPoly.Clear; - return pcb_true; - } - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * recovers an object from a 'change name' operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoChangeName(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - /* lookup entry by it's ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - Entry->Data.ChangeName.Name = (char *) (ChangeObjectName(type, ptr1, ptr2, ptr3, Entry->Data.ChangeName.Name)); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a 'change oinnum' operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoChangePinnum(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - /* lookup entry by it's ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - Entry->Data.ChangeName.Name = (char *) (ChangeObjectPinnum(type, ptr1, ptr2, ptr3, Entry->Data.ChangeName.Name)); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a 2ndSize change operation - */ -static pcb_bool UndoChange2ndSize(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - Coord swap; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - swap = ((PinTypePtr) ptr2)->DrillingHole; - if (andDraw) - EraseObject(type, ptr1, ptr2); - ((PinTypePtr) ptr2)->DrillingHole = Entry->Data.Size; - Entry->Data.Size = swap; - DrawObject(type, ptr1, ptr2); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a ChangeAngles change operation - */ -static pcb_bool UndoChangeAngles(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - double old_sa, old_da; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type == PCB_TYPE_ARC) { - LayerTypePtr Layer = (LayerTypePtr) ptr1; - ArcTypePtr a = (ArcTypePtr) ptr2; - r_delete_entry(Layer->arc_tree, (BoxTypePtr) a); - old_sa = a->StartAngle; - old_da = a->Delta; - if (andDraw) - EraseObject(type, Layer, a); - a->StartAngle = Entry->Data.AngleChange.angle[0]; - a->Delta = Entry->Data.AngleChange.angle[1]; - SetArcBoundingBox(a); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) a, 0); - Entry->Data.AngleChange.angle[0] = old_sa; - Entry->Data.AngleChange.angle[1] = old_da; - DrawObject(type, ptr1, a); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a ChangeRadii change operation - */ -static pcb_bool UndoChangeRadii(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - Coord old_w, old_h; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type == PCB_TYPE_ARC) { - LayerTypePtr Layer = (LayerTypePtr) ptr1; - ArcTypePtr a = (ArcTypePtr) ptr2; - r_delete_entry(Layer->arc_tree, (BoxTypePtr) a); - old_w = a->Width; - old_h = a->Height; - if (andDraw) - EraseObject(type, Layer, a); - a->Width = Entry->Data.Move.DX; - a->Height = Entry->Data.Move.DY; - SetArcBoundingBox(a); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) a, 0); - Entry->Data.Move.DX = old_w; - Entry->Data.Move.DY = old_h; - DrawObject(type, ptr1, a); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a clearance size change operation - */ -static pcb_bool UndoChangeClearSize(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - Coord swap; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - swap = ((PinTypePtr) ptr2)->Clearance; - RestoreToPolygon(PCB->Data, type, ptr1, ptr2); - if (andDraw) - EraseObject(type, ptr1, ptr2); - ((PinTypePtr) ptr2)->Clearance = Entry->Data.Size; - ClearFromPolygon(PCB->Data, type, ptr1, ptr2); - Entry->Data.Size = swap; - if (andDraw) - DrawObject(type, ptr1, ptr2); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a mask size change operation - */ -static pcb_bool UndoChangeMaskSize(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - Coord swap; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type & (PCB_TYPE_VIA | PCB_TYPE_PIN | PCB_TYPE_PAD)) { - swap = (type == PCB_TYPE_PAD ? ((PadTypePtr) ptr2)->Mask : ((PinTypePtr) ptr2)->Mask); - if (andDraw) - EraseObject(type, ptr1, ptr2); - if (type == PCB_TYPE_PAD) - ((PadTypePtr) ptr2)->Mask = Entry->Data.Size; - else - ((PinTypePtr) ptr2)->Mask = Entry->Data.Size; - Entry->Data.Size = swap; - if (andDraw) - DrawObject(type, ptr1, ptr2); - return (pcb_true); - } - return (pcb_false); -} - - -/* --------------------------------------------------------------------------- - * recovers an object from a Size change operation - */ -static pcb_bool UndoChangeSize(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3, *ptr1e; - int type; - Coord swap; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type == PCB_TYPE_ELEMENT_NAME) - ptr1e = NULL; - else - ptr1e = ptr1; - - if (type != PCB_TYPE_NONE) { - /* Wow! can any object be treated as a pin type for size change?? */ - /* pins, vias, lines, and arcs can. Text can't but it has it's own mechanism */ - swap = ((PinTypePtr) ptr2)->Thickness; - RestoreToPolygon(PCB->Data, type, ptr1, ptr2); - if ((andDraw) && (ptr1e != NULL)) - EraseObject(type, ptr1e, ptr2); - ((PinTypePtr) ptr2)->Thickness = Entry->Data.Size; - Entry->Data.Size = swap; - ClearFromPolygon(PCB->Data, type, ptr1, ptr2); - if (andDraw) - DrawObject(type, ptr1, ptr2); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a FLAG change operation - */ -static pcb_bool UndoFlag(UndoListTypePtr Entry) -{ - void *ptr1, *ptr1e, *ptr2, *ptr3; - int type; - FlagType swap; - int must_redraw; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - FlagType f1, f2; - PinTypePtr pin = (PinTypePtr) ptr2; - - if ((type == PCB_TYPE_ELEMENT) || (type == PCB_TYPE_ELEMENT_NAME)) - ptr1e = NULL; - else - ptr1e = ptr1; - - swap = pin->Flags; - - must_redraw = 0; - f1 = MaskFlags(pin->Flags, ~DRAW_FLAGS); - f2 = MaskFlags(Entry->Data.Flags, ~DRAW_FLAGS); - - if (!FLAGS_EQUAL(f1, f2)) - must_redraw = 1; - - if (andDraw && must_redraw && (ptr1e != NULL)) - EraseObject(type, ptr1e, ptr2); - - pin->Flags = Entry->Data.Flags; - - Entry->Data.Flags = swap; - - if (andDraw && must_redraw) - DrawObject(type, ptr1, ptr2); - return (pcb_true); - } - Message(PCB_MSG_DEFAULT, "hace Internal error: Can't find ID %d type %08x\n", Entry->ID, Entry->Kind); - Message(PCB_MSG_DEFAULT, "for UndoFlag Operation. Previous flags: %s\n", flags_to_string(Entry->Data.Flags, 0)); - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a mirror operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoMirror(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - /* lookup entry by ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type == PCB_TYPE_ELEMENT) { - ElementTypePtr element = (ElementTypePtr) ptr3; - if (andDraw) - EraseElement(element); - MirrorElementCoordinates(PCB->Data, element, Entry->Data.Move.DY); - if (andDraw) - DrawElement(element); - return (pcb_true); - } - Message(PCB_MSG_DEFAULT, "hace Internal error: UndoMirror on object type %d\n", type); - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a 'copy' or 'create' operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoCopyOrCreate(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - /* lookup entry by it's ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - if (!RemoveList) - RemoveList = CreateNewBuffer(); - if (andDraw) - EraseObject(type, ptr1, ptr2); - /* in order to make this re-doable we move it to the RemoveList */ - MoveObjectToBuffer(RemoveList, PCB->Data, type, ptr1, ptr2, ptr3); - Entry->Type = UNDO_REMOVE; - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers an object from a 'move' operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoMove(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - /* lookup entry by it's ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - MoveObject(type, ptr1, ptr2, ptr3, -Entry->Data.Move.DX, -Entry->Data.Move.DY); - Entry->Data.Move.DX *= -1; - Entry->Data.Move.DY *= -1; - return (pcb_true); - } - return (pcb_false); -} - -/* ---------------------------------------------------------------------- - * recovers an object from a 'remove' operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoRemove(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - /* lookup entry by it's ID */ - type = SearchObjectByID(RemoveList, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - if (andDraw) - DrawRecoveredObject(type, ptr1, ptr2, ptr3); - MoveObjectToBuffer(PCB->Data, RemoveList, type, ptr1, ptr2, ptr3); - Entry->Type = UNDO_CREATE; - return (pcb_true); - } - return (pcb_false); -} - -/* ---------------------------------------------------------------------- - * recovers an object from a 'move to another layer' operation - * returns pcb_true if anything has been recovered - */ -static pcb_bool UndoMoveToLayer(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - int type, swap; - - /* lookup entry by it's ID */ - type = SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, Entry->ID, Entry->Kind); - if (type != PCB_TYPE_NONE) { - swap = GetLayerNumber(PCB->Data, (LayerTypePtr) ptr1); - MoveObjectToLayer(type, ptr1, ptr2, ptr3, LAYER_PTR(Entry->Data.MoveToLayer.OriginalLayer), pcb_true); - Entry->Data.MoveToLayer.OriginalLayer = swap; - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * recovers a removed polygon point - * returns pcb_true on success - */ -static pcb_bool UndoRemovePoint(UndoListTypePtr Entry) -{ - LayerTypePtr layer; - PolygonTypePtr polygon; - void *ptr3; - int type; - - /* lookup entry (polygon not point was saved) by it's ID */ - assert(Entry->Kind == PCB_TYPE_POLYGON); - type = SearchObjectByID(PCB->Data, (void **) &layer, (void **) &polygon, &ptr3, Entry->ID, Entry->Kind); - switch (type) { - case PCB_TYPE_POLYGON: /* restore the removed point */ - { - /* recover the point */ - if (andDraw && layer->On) - ErasePolygon(polygon); - InsertPointIntoObject(PCB_TYPE_POLYGON, layer, polygon, - &Entry->Data.RemovedPoint.Index, - Entry->Data.RemovedPoint.X, - Entry->Data.RemovedPoint.Y, pcb_true, Entry->Data.RemovedPoint.last_in_contour); - - polygon->Points[Entry->Data.RemovedPoint.Index].ID = Entry->Data.RemovedPoint.ID; - if (andDraw && layer->On) - DrawPolygon(layer, polygon); - Entry->Type = UNDO_INSERT_POINT; - Entry->ID = Entry->Data.RemovedPoint.ID; - Entry->Kind = PCB_TYPE_POLYGON_POINT; - return (pcb_true); - } - - default: - return (pcb_false); - } -} - -/* --------------------------------------------------------------------------- - * recovers an inserted polygon point - * returns pcb_true on success - */ -static pcb_bool UndoInsertPoint(UndoListTypePtr Entry) -{ - LayerTypePtr layer; - PolygonTypePtr polygon; - PointTypePtr pnt; - int type; - pcb_cardinal_t point_idx; - pcb_cardinal_t hole; - pcb_bool last_in_contour = pcb_false; - - assert(Entry->Kind == PCB_TYPE_POLYGON_POINT); - /* lookup entry by it's ID */ - type = SearchObjectByID(PCB->Data, (void **) &layer, (void **) &polygon, (void **) &pnt, Entry->ID, Entry->Kind); - switch (type) { - case PCB_TYPE_POLYGON_POINT: /* removes an inserted polygon point */ - { - if (andDraw && layer->On) - ErasePolygon(polygon); - - /* Check whether this point was at the end of its contour. - * If so, we need to flag as such when re-adding the point - * so it goes back in the correct place - */ - point_idx = polygon_point_idx(polygon, pnt); - for (hole = 0; hole < polygon->HoleIndexN; hole++) - if (point_idx == polygon->HoleIndex[hole] - 1) - last_in_contour = pcb_true; - if (point_idx == polygon->PointN - 1) - last_in_contour = pcb_true; - Entry->Data.RemovedPoint.last_in_contour = last_in_contour; - - Entry->Data.RemovedPoint.X = pnt->X; - Entry->Data.RemovedPoint.Y = pnt->Y; - Entry->Data.RemovedPoint.ID = pnt->ID; - Entry->ID = polygon->ID; - Entry->Kind = PCB_TYPE_POLYGON; - Entry->Type = UNDO_REMOVE_POINT; - Entry->Data.RemovedPoint.Index = point_idx; - DestroyObject(PCB->Data, PCB_TYPE_POLYGON_POINT, layer, polygon, pnt); - if (andDraw && layer->On) - DrawPolygon(layer, polygon); - return (pcb_true); - } - - default: - return (pcb_false); - } -} - -static pcb_bool UndoSwapCopiedObject(UndoListTypePtr Entry) -{ - void *ptr1, *ptr2, *ptr3; - void *ptr1b, *ptr2b, *ptr3b; - AnyObjectType *obj, *obj2; - int type; - long int swap_id; - - /* lookup entry by it's ID */ - type = SearchObjectByID(RemoveList, &ptr1, &ptr2, &ptr3, Entry->Data.CopyID, Entry->Kind); - if (type == PCB_TYPE_NONE) - return pcb_false; - - type = SearchObjectByID(PCB->Data, &ptr1b, &ptr2b, &ptr3b, Entry->ID, Entry->Kind); - if (type == PCB_TYPE_NONE) - return FALSE; - - obj = (AnyObjectType *) ptr2; - obj2 = (AnyObjectType *) ptr2b; - - swap_id = obj->ID; - obj->ID = obj2->ID; - obj2->ID = swap_id; - - MoveObjectToBuffer(RemoveList, PCB->Data, type, ptr1b, ptr2b, ptr3b); - - if (andDraw) - DrawRecoveredObject(Entry->Kind, ptr1, ptr2, ptr3); - - obj = (AnyObjectType *) MoveObjectToBuffer(PCB->Data, RemoveList, type, ptr1, ptr2, ptr3); - if (Entry->Kind == PCB_TYPE_POLYGON) - InitClip(PCB->Data, (LayerTypePtr) ptr1b, (PolygonType *) obj); - return (pcb_true); -} - -/* --------------------------------------------------------------------------- - * recovers an removed polygon point - * returns pcb_true on success - */ -static pcb_bool UndoRemoveContour(UndoListTypePtr Entry) -{ - assert(Entry->Kind == PCB_TYPE_POLYGON); - return UndoSwapCopiedObject(Entry); -} - -/* --------------------------------------------------------------------------- - * recovers an inserted polygon point - * returns pcb_true on success - */ -static pcb_bool UndoInsertContour(UndoListTypePtr Entry) -{ - assert(Entry->Kind == PCB_TYPE_POLYGON); - return UndoSwapCopiedObject(Entry); -} - -/* --------------------------------------------------------------------------- - * undo a layer change - * returns pcb_true on success - */ -static pcb_bool UndoLayerChange(UndoListTypePtr Entry) -{ - LayerChangeTypePtr l = &Entry->Data.LayerChange; - int tmp; - - tmp = l->new_index; - l->new_index = l->old_index; - l->old_index = tmp; - - if (MoveLayer(l->old_index, l->new_index)) - return pcb_false; - else - return pcb_true; -} - -/* --------------------------------------------------------------------------- - * undo a netlist change - * returns pcb_true on success - */ -static pcb_bool UndoNetlistChange(UndoListTypePtr Entry) -{ - NetlistChangeTypePtr l = &Entry->Data.NetlistChange; - unsigned int i, j; - LibraryTypePtr lib, saved; - - lib = l->lib; - saved = l->old; - - /* iterate over each net */ - for (i = 0; i < lib->MenuN; i++) { - free(lib->Menu[i].Name); - free(lib->Menu[i].directory); - free(lib->Menu[i].Style); - - /* iterate over each pin on the net */ - for (j = 0; j < lib->Menu[i].EntryN; j++) { - if (!lib->Menu[i].Entry[j].ListEntry_dontfree) - free((char*)lib->Menu[i].Entry[j].ListEntry); - - free((char*)lib->Menu[i].Entry[j].Package); - free((char*)lib->Menu[i].Entry[j].Value); - free((char*)lib->Menu[i].Entry[j].Description); - } - } - - free(lib->Menu); - - *lib = *saved; - - pcb_netlist_changed(0); - return pcb_true; -} - -/* --------------------------------------------------------------------------- - * undo of any 'hard to recover' operation - * - * returns the bitfield for the types of operations that were undone - */ -int Undo(pcb_bool draw) -{ - UndoListTypePtr ptr; - int Types = 0; - int unique; - pcb_bool error_undoing = pcb_false; - - unique = conf_core.editor.unique_names; - conf_force_set_bool(conf_core.editor.unique_names, 0); - - andDraw = draw; - - if (Serial == 0) { - Message(PCB_MSG_DEFAULT, _("ERROR: Attempt to Undo() with Serial == 0\n" " Please save your work and report this bug.\n")); - return 0; - } - - if (UndoN == 0) { - Message(PCB_MSG_DEFAULT, _("Nothing to undo - buffer is empty\n")); - return 0; - } - - Serial--; - - ptr = &UndoList[UndoN - 1]; - - if (ptr->Serial > Serial) { - Message(PCB_MSG_DEFAULT, _("ERROR: Bad undo serial number %d in undo stack - expecting %d or lower\n" - " Please save your work and report this bug.\n"), ptr->Serial, Serial); - - /* It is likely that the serial number got corrupted through some bad - * use of the SaveUndoSerialNumber() / RestoreUndoSerialNumber() APIs. - * - * Reset the serial number to be consistent with that of the last - * operation on the undo stack in the hope that this might clear - * the problem and allow the user to hit Undo again. - */ - Serial = ptr->Serial + 1; - return 0; - } - - LockUndo(); /* lock undo module to prevent from loops */ - - /* Loop over all entries with the correct serial number */ - for (; UndoN && ptr->Serial == Serial; ptr--, UndoN--, RedoN++) { - int undid = PerformUndo(ptr); - if (undid == 0) - error_undoing = pcb_true; - Types |= undid; - } - - UnlockUndo(); - - if (error_undoing) - Message(PCB_MSG_DEFAULT, _("ERROR: Failed to undo some operations\n")); - - if (Types && andDraw) - Draw(); - - /* restore the unique flag setting */ - conf_force_set_bool(conf_core.editor.unique_names, unique); - - return Types; -} - -static int PerformUndo(UndoListTypePtr ptr) -{ - switch (ptr->Type) { - case UNDO_CHANGENAME: - if (UndoChangeName(ptr)) - return (UNDO_CHANGENAME); - break; - - case UNDO_CHANGEPINNUM: - if (UndoChangePinnum(ptr)) - return (UNDO_CHANGEPINNUM); - break; - - case UNDO_CREATE: - if (UndoCopyOrCreate(ptr)) - return (UNDO_CREATE); - break; - - case UNDO_MOVE: - if (UndoMove(ptr)) - return (UNDO_MOVE); - break; - - case UNDO_REMOVE: - if (UndoRemove(ptr)) - return (UNDO_REMOVE); - break; - - case UNDO_REMOVE_POINT: - if (UndoRemovePoint(ptr)) - return (UNDO_REMOVE_POINT); - break; - - case UNDO_INSERT_POINT: - if (UndoInsertPoint(ptr)) - return (UNDO_INSERT_POINT); - break; - - case UNDO_REMOVE_CONTOUR: - if (UndoRemoveContour(ptr)) - return (UNDO_REMOVE_CONTOUR); - break; - - case UNDO_INSERT_CONTOUR: - if (UndoInsertContour(ptr)) - return (UNDO_INSERT_CONTOUR); - break; - - case UNDO_ROTATE: - if (UndoRotate(ptr)) - return (UNDO_ROTATE); - break; - - case UNDO_CLEAR: - if (UndoClearPoly(ptr)) - return (UNDO_CLEAR); - break; - - case UNDO_MOVETOLAYER: - if (UndoMoveToLayer(ptr)) - return (UNDO_MOVETOLAYER); - break; - - case UNDO_FLAG: - if (UndoFlag(ptr)) - return (UNDO_FLAG); - break; - - case UNDO_CHANGESIZE: - if (UndoChangeSize(ptr)) - return (UNDO_CHANGESIZE); - break; - - case UNDO_CHANGECLEARSIZE: - if (UndoChangeClearSize(ptr)) - return (UNDO_CHANGECLEARSIZE); - break; - - case UNDO_CHANGEMASKSIZE: - if (UndoChangeMaskSize(ptr)) - return (UNDO_CHANGEMASKSIZE); - break; - - case UNDO_CHANGE2NDSIZE: - if (UndoChange2ndSize(ptr)) - return (UNDO_CHANGE2NDSIZE); - break; - - case UNDO_CHANGEANGLES: - if (UndoChangeAngles(ptr)) - return (UNDO_CHANGEANGLES); - break; - - case UNDO_CHANGERADII: - if (UndoChangeRadii(ptr)) - return (UNDO_CHANGERADII); - break; - - case UNDO_LAYERCHANGE: - if (UndoLayerChange(ptr)) - return (UNDO_LAYERCHANGE); - break; - - case UNDO_NETLISTCHANGE: - if (UndoNetlistChange(ptr)) - return (UNDO_NETLISTCHANGE); - break; - - case UNDO_MIRROR: - if (UndoMirror(ptr)) - return (UNDO_MIRROR); - break; - } - return 0; -} - -/* --------------------------------------------------------------------------- - * redo of any 'hard to recover' operation - * - * returns the number of operations redone - */ -int Redo(pcb_bool draw) -{ - UndoListTypePtr ptr; - int Types = 0; - pcb_bool error_undoing = pcb_false; - - andDraw = draw; - - if (RedoN == 0) { - Message(PCB_MSG_DEFAULT, _("Nothing to redo. Perhaps changes have been made since last undo\n")); - return 0; - } - - ptr = &UndoList[UndoN]; - - if (ptr->Serial < Serial) { - Message(PCB_MSG_DEFAULT, _("ERROR: Bad undo serial number %d in redo stack - expecting %d or higher\n" - " Please save your work and report this bug.\n"), ptr->Serial, Serial); - - /* It is likely that the serial number got corrupted through some bad - * use of the SaveUndoSerialNumber() / RestoreUndoSerialNumber() APIs. - * - * Reset the serial number to be consistent with that of the first - * operation on the redo stack in the hope that this might clear - * the problem and allow the user to hit Redo again. - */ - Serial = ptr->Serial; - return 0; - } - - LockUndo(); /* lock undo module to prevent from loops */ - - /* and loop over all entries with the correct serial number */ - for (; RedoN && ptr->Serial == Serial; ptr++, UndoN++, RedoN--) { - int undid = PerformUndo(ptr); - if (undid == 0) - error_undoing = pcb_true; - Types |= undid; - } - - /* Make next serial number current */ - Serial++; - - UnlockUndo(); - - if (error_undoing) - Message(PCB_MSG_DEFAULT, _("ERROR: Failed to redo some operations\n")); - - if (Types && andDraw) - Draw(); - - return Types; -} - -/* --------------------------------------------------------------------------- - * restores the serial number of the undo list - */ -void RestoreUndoSerialNumber(void) -{ - if (added_undo_between_increment_and_restore) - Message(PCB_MSG_DEFAULT, _("ERROR: Operations were added to the Undo stack with an incorrect serial number\n")); - between_increment_and_restore = pcb_false; - added_undo_between_increment_and_restore = pcb_false; - Serial = SavedSerial; -} - -/* --------------------------------------------------------------------------- - * saves the serial number of the undo list - */ -void SaveUndoSerialNumber(void) -{ - Bumped = pcb_false; - between_increment_and_restore = pcb_false; - added_undo_between_increment_and_restore = pcb_false; - SavedSerial = Serial; -} - -/* --------------------------------------------------------------------------- - * increments the serial number of the undo list - * it's not done automatically because some operations perform more - * than one request with the same serial # - */ -void IncrementUndoSerialNumber(void) -{ - if (!Locked) { - /* Set the changed flag if anything was added prior to this bump */ - if (UndoN > 0 && UndoList[UndoN - 1].Serial == Serial) - SetChangedFlag(pcb_true); - Serial++; - Bumped = pcb_true; - between_increment_and_restore = pcb_true; - } -} - -/* --------------------------------------------------------------------------- - * releases memory of the undo- and remove list - */ -void ClearUndoList(pcb_bool Force) -{ - UndoListTypePtr undo; - - if (UndoN && (Force || gui->confirm_dialog("OK to clear 'undo' buffer?", 0))) { - /* release memory allocated by objects in undo list */ - for (undo = UndoList; UndoN; undo++, UndoN--) { - if ((undo->Type == UNDO_CHANGENAME) || (undo->Type == UNDO_CHANGEPINNUM)) - free(undo->Data.ChangeName.Name); - } - free(UndoList); - UndoList = NULL; - if (RemoveList) { - FreeDataMemory(RemoveList); - free(RemoveList); - RemoveList = NULL; - } - - /* reset some counters */ - UndoN = UndoMax = RedoN = 0; - } - - /* reset counter in any case */ - Serial = 1; -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of clearpoly objects - */ -void AddObjectToClearPolyUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_bool clear) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CLEAR, OBJECT_ID(Ptr3), Type); - undo->Data.ClearPoly.Clear = clear; - undo->Data.ClearPoly.Layer = (LayerTypePtr) Ptr1; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of mirrored objects - */ -void AddObjectToMirrorUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord yoff) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_MIRROR, OBJECT_ID(Ptr3), Type); - undo->Data.Move.DY = yoff; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of rotated objects - */ -void AddObjectToRotateUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord CenterX, Coord CenterY, pcb_uint8_t Steps) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_ROTATE, OBJECT_ID(Ptr3), Type); - undo->Data.Rotate.CenterX = CenterX; - undo->Data.Rotate.CenterY = CenterY; - undo->Data.Rotate.Steps = Steps; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of removed objects and removes it from - * the current PCB - */ -void MoveObjectToRemoveUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (Locked) - return; - - if (!RemoveList) - RemoveList = CreateNewBuffer(); - - GetUndoSlot(UNDO_REMOVE, OBJECT_ID(Ptr3), Type); - MoveObjectToBuffer(RemoveList, PCB->Data, Type, Ptr1, Ptr2, Ptr3); -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of removed polygon/... points - */ -void AddObjectToRemovePointUndoList(int Type, void *Ptr1, void *Ptr2, pcb_cardinal_t index) -{ - UndoListTypePtr undo; - PolygonTypePtr polygon = (PolygonTypePtr) Ptr2; - pcb_cardinal_t hole; - pcb_bool last_in_contour = pcb_false; - - if (!Locked) { - switch (Type) { - case PCB_TYPE_POLYGON_POINT: - { - /* save the ID of the parent object; else it will be - * impossible to recover the point - */ - undo = GetUndoSlot(UNDO_REMOVE_POINT, OBJECT_ID(polygon), PCB_TYPE_POLYGON); - undo->Data.RemovedPoint.X = polygon->Points[index].X; - undo->Data.RemovedPoint.Y = polygon->Points[index].Y; - undo->Data.RemovedPoint.ID = polygon->Points[index].ID; - undo->Data.RemovedPoint.Index = index; - - /* Check whether this point was at the end of its contour. - * If so, we need to flag as such when re-adding the point - * so it goes back in the correct place - */ - for (hole = 0; hole < polygon->HoleIndexN; hole++) - if (index == polygon->HoleIndex[hole] - 1) - last_in_contour = pcb_true; - if (index == polygon->PointN - 1) - last_in_contour = pcb_true; - undo->Data.RemovedPoint.last_in_contour = last_in_contour; - } - break; - } - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of inserted polygon/... points - */ -void AddObjectToInsertPointUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (!Locked) - GetUndoSlot(UNDO_INSERT_POINT, OBJECT_ID(Ptr3), Type); -} - -static void CopyObjectToUndoList(int undo_type, int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - UndoListTypePtr undo; - AnyObjectType *copy; - - if (Locked) - return; - - if (!RemoveList) - RemoveList = CreateNewBuffer(); - - undo = GetUndoSlot(undo_type, OBJECT_ID(Ptr2), Type); - copy = (AnyObjectType *) CopyObjectToBuffer(RemoveList, PCB->Data, Type, Ptr1, Ptr2, Ptr3); - undo->Data.CopyID = copy->ID; -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of removed contours - * (Actually just takes a copy of the whole polygon to restore) - */ -void AddObjectToRemoveContourUndoList(int Type, LayerType * Layer, PolygonType * Polygon) -{ - CopyObjectToUndoList(UNDO_REMOVE_CONTOUR, Type, Layer, Polygon, NULL); -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of insert contours - * (Actually just takes a copy of the whole polygon to restore) - */ -void AddObjectToInsertContourUndoList(int Type, LayerType * Layer, PolygonType * Polygon) -{ - CopyObjectToUndoList(UNDO_INSERT_CONTOUR, Type, Layer, Polygon, NULL); -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of moved objects - */ -void AddObjectToMoveUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_MOVE, OBJECT_ID(Ptr3), Type); - undo->Data.Move.DX = DX; - undo->Data.Move.DY = DY; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects with changed names - */ -void AddObjectToChangeNameUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *OldName) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGENAME, OBJECT_ID(Ptr3), Type); - undo->Data.ChangeName.Name = OldName; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects with changed pinnums - */ -void AddObjectToChangePinnumUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *OldName) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGEPINNUM, OBJECT_ID(Ptr3), Type); - undo->Data.ChangeName.Name = OldName; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects moved to another layer - */ -void AddObjectToMoveToLayerUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_MOVETOLAYER, OBJECT_ID(Ptr3), Type); - undo->Data.MoveToLayer.OriginalLayer = GetLayerNumber(PCB->Data, (LayerTypePtr) Ptr1); - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of created objects - */ -void AddObjectToCreateUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (!Locked) - GetUndoSlot(UNDO_CREATE, OBJECT_ID(Ptr3), Type); - ClearFromPolygon(PCB->Data, Type, Ptr1, Ptr2); -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects with flags changed - */ -void AddObjectToFlagUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_FLAG, OBJECT_ID(Ptr2), Type); - undo->Data.Flags = ((PinTypePtr) Ptr2)->Flags; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects with Size changes - */ -void AddObjectToSizeUndoList(int Type, void *ptr1, void *ptr2, void *ptr3) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGESIZE, OBJECT_ID(ptr2), Type); - switch (Type) { - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - undo->Data.Size = ((PinTypePtr) ptr2)->Thickness; - break; - case PCB_TYPE_LINE: - case PCB_TYPE_ELEMENT_LINE: - undo->Data.Size = ((LineTypePtr) ptr2)->Thickness; - break; - case PCB_TYPE_TEXT: - case PCB_TYPE_ELEMENT_NAME: - undo->Data.Size = ((TextTypePtr) ptr2)->Scale; - break; - case PCB_TYPE_PAD: - undo->Data.Size = ((PadTypePtr) ptr2)->Thickness; - break; - case PCB_TYPE_ARC: - case PCB_TYPE_ELEMENT_ARC: - undo->Data.Size = ((ArcTypePtr) ptr2)->Thickness; - break; - } - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects with Size changes - */ -void AddObjectToClearSizeUndoList(int Type, void *ptr1, void *ptr2, void *ptr3) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGECLEARSIZE, OBJECT_ID(ptr2), Type); - switch (Type) { - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - undo->Data.Size = ((PinTypePtr) ptr2)->Clearance; - break; - case PCB_TYPE_LINE: - undo->Data.Size = ((LineTypePtr) ptr2)->Clearance; - break; - case PCB_TYPE_PAD: - undo->Data.Size = ((PadTypePtr) ptr2)->Clearance; - break; - case PCB_TYPE_ARC: - undo->Data.Size = ((ArcTypePtr) ptr2)->Clearance; - break; - } - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects with Size changes - */ -void AddObjectToMaskSizeUndoList(int Type, void *ptr1, void *ptr2, void *ptr3) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGEMASKSIZE, OBJECT_ID(ptr2), Type); - switch (Type) { - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - undo->Data.Size = ((PinTypePtr) ptr2)->Mask; - break; - case PCB_TYPE_PAD: - undo->Data.Size = ((PadTypePtr) ptr2)->Mask; - break; - } - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of objects with 2ndSize changes - */ -void AddObjectTo2ndSizeUndoList(int Type, void *ptr1, void *ptr2, void *ptr3) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGE2NDSIZE, OBJECT_ID(ptr2), Type); - if (Type == PCB_TYPE_PIN || Type == PCB_TYPE_VIA) - undo->Data.Size = ((PinTypePtr) ptr2)->DrillingHole; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of changed angles. Note that you must - * call this before changing the angles, passing the new start/delta. - */ -void AddObjectToChangeAnglesUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - UndoListTypePtr undo; - ArcTypePtr a = (ArcTypePtr) Ptr3; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGEANGLES, OBJECT_ID(Ptr3), Type); - undo->Data.AngleChange.angle[0] = a->StartAngle; - undo->Data.AngleChange.angle[1] = a->Delta; - } -} - -/* --------------------------------------------------------------------------- - * adds an object to the list of changed radii. Note that you must - * call this before changing the radii, passing the new width/height. - */ -void AddObjectToChangeRadiiUndoList(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - UndoListTypePtr undo; - ArcTypePtr a = (ArcTypePtr) Ptr3; - - if (!Locked) { - undo = GetUndoSlot(UNDO_CHANGERADII, OBJECT_ID(Ptr3), Type); - undo->Data.Move.DX = a->Width; - undo->Data.Move.DY = a->Height; - } -} - -/* --------------------------------------------------------------------------- - * adds a layer change (new, delete, move) to the undo list. - */ -void AddLayerChangeToUndoList(int old_index, int new_index) -{ - UndoListTypePtr undo; - - if (!Locked) { - undo = GetUndoSlot(UNDO_LAYERCHANGE, 0, 0); - undo->Data.LayerChange.old_index = old_index; - undo->Data.LayerChange.new_index = new_index; - } -} - -/* --------------------------------------------------------------------------- - * adds a netlist change to the undo list - */ -void AddNetlistLibToUndoList(LibraryTypePtr lib) -{ - UndoListTypePtr undo; - unsigned int i, j; - LibraryTypePtr old; - - if (!Locked) { - undo = GetUndoSlot(UNDO_NETLISTCHANGE, 0, 0); - /* keep track of where the data needs to go */ - undo->Data.NetlistChange.lib = lib; - - /* and what the old data is that we'll need to restore */ - undo->Data.NetlistChange.old = (LibraryTypePtr) malloc(sizeof(LibraryTypePtr)); - old = undo->Data.NetlistChange.old; - old->MenuN = lib->MenuN; - old->MenuMax = lib->MenuMax; - old->Menu = (LibraryMenuTypePtr) malloc(old->MenuMax * sizeof(LibraryMenuType)); - if (old->Menu == NULL) { - fprintf(stderr, "malloc() failed in AddNetlistLibToUndoList\n"); - exit(1); - } - - /* iterate over each net */ - for (i = 0; i < lib->MenuN; i++) { - old->Menu[i].EntryN = lib->Menu[i].EntryN; - old->Menu[i].EntryMax = lib->Menu[i].EntryMax; - - old->Menu[i].Name = lib->Menu[i].Name ? pcb_strdup(lib->Menu[i].Name) : NULL; - - old->Menu[i].directory = lib->Menu[i].directory ? pcb_strdup(lib->Menu[i].directory) : NULL; - - old->Menu[i].Style = lib->Menu[i].Style ? pcb_strdup(lib->Menu[i].Style) : NULL; - - - old->Menu[i].Entry = (LibraryEntryTypePtr) malloc(old->Menu[i].EntryMax * sizeof(LibraryEntryType)); - if (old->Menu[i].Entry == NULL) { - fprintf(stderr, "malloc() failed in AddNetlistLibToUndoList\n"); - exit(1); - } - - /* iterate over each pin on the net */ - for (j = 0; j < lib->Menu[i].EntryN; j++) { - - old->Menu[i].Entry[j].ListEntry = lib->Menu[i].Entry[j].ListEntry ? pcb_strdup(lib->Menu[i].Entry[j].ListEntry) : NULL; - old->Menu[i].Entry[j].ListEntry_dontfree = 0; - - old->Menu[i].Entry[j].Package = lib->Menu[i].Entry[j].Package ? pcb_strdup(lib->Menu[i].Entry[j].Package) : NULL; - - old->Menu[i].Entry[j].Value = lib->Menu[i].Entry[j].Value ? pcb_strdup(lib->Menu[i].Entry[j].Value) : NULL; - - old->Menu[i].Entry[j].Description = - lib->Menu[i].Entry[j].Description ? pcb_strdup(lib->Menu[i].Entry[j].Description) : NULL; - - - } - } - - } -} - -/* --------------------------------------------------------------------------- - * set lock flag - */ -void LockUndo(void) -{ - Locked = pcb_true; -} - -/* --------------------------------------------------------------------------- - * reset lock flag - */ -void UnlockUndo(void) -{ - Locked = pcb_false; -} - -/* --------------------------------------------------------------------------- - * return undo lock state - */ -pcb_bool Undoing(void) -{ - return (Locked); -} - -#ifndef NDEBUG -static const char *undo_type2str(int type) -{ - static char buff[32]; - switch(type) { - case UNDO_CHANGENAME: return "changename"; - case UNDO_MOVE: return "move"; - case UNDO_REMOVE: return "remove"; - case UNDO_REMOVE_POINT: return "remove_point"; - case UNDO_INSERT_POINT: return "insert_point"; - case UNDO_REMOVE_CONTOUR: return "remove_contour"; - case UNDO_INSERT_CONTOUR: return "insert_contour"; - case UNDO_ROTATE: return "rotate"; - case UNDO_CREATE: return "create"; - case UNDO_MOVETOLAYER: return "movetolayer"; - case UNDO_FLAG: return "flag"; - case UNDO_CHANGESIZE: return "changesize"; - case UNDO_CHANGE2NDSIZE: return "change2ndsize"; - case UNDO_MIRROR: return "mirror"; - case UNDO_CHANGECLEARSIZE: return "chngeclearsize"; - case UNDO_CHANGEMASKSIZE: return "changemasksize"; - case UNDO_CHANGEANGLES: return "changeangles"; - case UNDO_CHANGERADII: return "changeradii"; - case UNDO_LAYERCHANGE: return "layerchange"; - case UNDO_CLEAR: return "clear"; - case UNDO_NETLISTCHANGE: return "netlistchange"; - case UNDO_CHANGEPINNUM: return "changepinnum"; - } - sprintf(buff, "Unknown %d", type); - return buff; -} - -void undo_dump() -{ - size_t n; - int last_serial = -2; - for(n = 0; n < UndoN; n++) { - if (last_serial != UndoList[n].Serial) { - printf("--- serial=%d\n", UndoList[n].Serial); - last_serial = UndoList[n].Serial; - } - printf(" type=%s kind=%d ID=%d\n", undo_type2str(UndoList[n].Type), UndoList[n].Kind, UndoList[n].ID); - } -} - -#endif Index: 1.1.4/src/draw_fab.c =================================================================== --- 1.1.4/src/draw_fab.c (revision 10776) +++ 1.1.4/src/draw_fab.c (nonexistent) @@ -1,297 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2003 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* Change History: - * 10/11/96 11:37 AJF Added support for a Text() driver function. - * This was done out of a pressing need to force text to be printed on the - * silkscreen layer. Perhaps the design is not the best. - */ - - -/* printing routines - */ -#include "config.h" - -#include -#include - - -#include "data.h" -#include "draw.h" -#include "drill.h" -#include "misc.h" -#include "draw_fab.h" -#include "polygon.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- - * prints a FAB drawing. - */ - -#define TEXT_SIZE PCB_MIL_TO_COORD(150) -#define TEXT_LINE PCB_MIL_TO_COORD(150) -#define DRILL_MARK_SIZE PCB_MIL_TO_COORD(16) -#define FAB_LINE_W PCB_MIL_TO_COORD(8) - -static void fab_line(hidGC gc, int x1, int y1, int x2, int y2) -{ - gui->draw_line(gc, x1, y1, x2, y2); -} - -static void fab_circle(hidGC gc, int x, int y, int r) -{ - gui->draw_arc(gc, x, y, r, r, 0, 180); - gui->draw_arc(gc, x, y, r, r, 180, 180); -} - -/* align is 0=left, 1=center, 2=right, add 8 for underline */ -static void text_at(hidGC gc, int x, int y, int align, const char *fmt, ...) -{ - char tmp[512]; - int w = 0, i; - TextType t; - va_list a; - FontTypePtr font = &PCB->Font; - va_start(a, fmt); - vsprintf(tmp, fmt, a); - va_end(a); - t.Direction = 0; - t.TextString = tmp; - t.Scale = PCB_COORD_TO_MIL(TEXT_SIZE); /* pcnt of 100mil base height */ - t.Flags = NoFlags(); - t.X = x; - t.Y = y; - for (i = 0; tmp[i]; i++) - w += (font->Symbol[(int) tmp[i]].Width + font->Symbol[(int) tmp[i]].Delta); - w = PCB_SCALE_TEXT(w, t.Scale); - t.X -= w * (align & 3) / 2; - if (t.X < 0) - t.X = 0; - DrawTextLowLevel(&t, 0); - if (align & 8) - fab_line(gc, t.X, - t.Y + PCB_SCALE_TEXT(font->MaxHeight, t.Scale) + PCB_MIL_TO_COORD(10), - t.X + w, t.Y + PCB_SCALE_TEXT(font->MaxHeight, t.Scale) + PCB_MIL_TO_COORD(10)); -} - -/* Y, +, X, circle, square */ -static void drill_sym(hidGC gc, int idx, int x, int y) -{ - int type = idx % 5; - int size = idx / 5; - int s2 = (size + 1) * DRILL_MARK_SIZE; - int i; - switch (type) { - case 0: /* Y */ ; - fab_line(gc, x, y, x, y + s2); - fab_line(gc, x, y, x + s2 * 13 / 15, y - s2 / 2); - fab_line(gc, x, y, x - s2 * 13 / 15, y - s2 / 2); - for (i = 1; i <= size; i++) - fab_circle(gc, x, y, i * DRILL_MARK_SIZE); - break; - case 1: /* + */ - ; - fab_line(gc, x, y - s2, x, y + s2); - fab_line(gc, x - s2, y, x + s2, y); - for (i = 1; i <= size; i++) { - fab_line(gc, x - i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE); - fab_line(gc, x - i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x - i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - fab_line(gc, x - i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - fab_line(gc, x + i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - } - break; - case 2: /* X */ ; - fab_line(gc, x - s2 * 3 / 4, y - s2 * 3 / 4, x + s2 * 3 / 4, y + s2 * 3 / 4); - fab_line(gc, x - s2 * 3 / 4, y + s2 * 3 / 4, x + s2 * 3 / 4, y - s2 * 3 / 4); - for (i = 1; i <= size; i++) { - fab_line(gc, x - i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE); - fab_line(gc, x - i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x - i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - fab_line(gc, x - i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - fab_line(gc, x + i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - } - break; - case 3: /* circle */ ; - for (i = 0; i <= size; i++) - fab_circle(gc, x, y, (i + 1) * DRILL_MARK_SIZE - DRILL_MARK_SIZE / 2); - break; - case 4: /* square */ - for (i = 1; i <= size + 1; i++) { - fab_line(gc, x - i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE); - fab_line(gc, x - i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x - i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - fab_line(gc, x - i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - fab_line(gc, x + i * DRILL_MARK_SIZE, y - i * DRILL_MARK_SIZE, x + i * DRILL_MARK_SIZE, y + i * DRILL_MARK_SIZE); - } - break; - } -} - -static int count_drill_lines(DrillInfoTypePtr AllDrills) -{ - int n, ds = 0; - for (n = AllDrills->DrillN - 1; n >= 0; n--) { - DrillTypePtr drill = &(AllDrills->Drill[n]); - if (drill->PinCount + drill->ViaCount > drill->UnplatedCount) - ds++; - if (drill->UnplatedCount) - ds++; - } - return ds; -} - - -int DrawFab_overhang(void) -{ - DrillInfoTypePtr AllDrills = GetDrillInfo(PCB->Data); - int ds = count_drill_lines(AllDrills); - if (ds < 4) - ds = 4; - return (ds + 2) * TEXT_LINE; -} - -void DrawFab(hidGC gc) -{ - DrillInfoTypePtr AllDrills; - int i, n, yoff, total_drills = 0, ds = 0; - time_t currenttime; - char utcTime[64]; - AllDrills = GetDrillInfo(PCB->Data); - RoundDrillInfo(AllDrills, PCB_MIL_TO_COORD(1)); - yoff = -TEXT_LINE; - - /* count how many drill description lines will be needed */ - ds = count_drill_lines(AllDrills); - - /* - * When we only have a few drill sizes we need to make sure the - * drill table header doesn't fall on top of the board info - * section. - */ - if (ds < 4) { - yoff -= (4 - ds) * TEXT_LINE; - } - - gui->set_line_width(gc, FAB_LINE_W); - - for (n = AllDrills->DrillN - 1; n >= 0; n--) { - int plated_sym = -1, unplated_sym = -1; - DrillTypePtr drill = &(AllDrills->Drill[n]); - if (drill->PinCount + drill->ViaCount > drill->UnplatedCount) - plated_sym = --ds; - if (drill->UnplatedCount) - unplated_sym = --ds; - gui->set_color(gc, PCB->PinColor); - for (i = 0; i < drill->PinN; i++) - drill_sym(gc, TEST_FLAG(PCB_FLAG_HOLE, drill->Pin[i]) ? unplated_sym : plated_sym, drill->Pin[i]->X, drill->Pin[i]->Y); - if (plated_sym != -1) { - drill_sym(gc, plated_sym, TEXT_SIZE, yoff + TEXT_SIZE / 4); - text_at(gc, PCB_MIL_TO_COORD(1350), yoff, PCB_MIL_TO_COORD(2), "YES"); - text_at(gc, PCB_MIL_TO_COORD(980), yoff, PCB_MIL_TO_COORD(2), "%d", drill->PinCount + drill->ViaCount - drill->UnplatedCount); - - if (unplated_sym != -1) - yoff -= TEXT_LINE; - } - if (unplated_sym != -1) { - drill_sym(gc, unplated_sym, TEXT_SIZE, yoff + TEXT_SIZE / 4); - text_at(gc, PCB_MIL_TO_COORD(1400), yoff, PCB_MIL_TO_COORD(2), "NO"); - text_at(gc, PCB_MIL_TO_COORD(980), yoff, PCB_MIL_TO_COORD(2), "%d", drill->UnplatedCount); - } - gui->set_color(gc, PCB->ElementColor); - text_at(gc, PCB_MIL_TO_COORD(450), yoff, PCB_MIL_TO_COORD(2), "%0.3f", PCB_COORD_TO_INCH(drill->DrillSize) + 0.0004); - if (plated_sym != -1 && unplated_sym != -1) - text_at(gc, PCB_MIL_TO_COORD(450), yoff + TEXT_LINE, PCB_MIL_TO_COORD(2), "%0.3f", PCB_COORD_TO_INCH(drill->DrillSize) + 0.0004); - yoff -= TEXT_LINE; - total_drills += drill->PinCount; - total_drills += drill->ViaCount; - } - - gui->set_color(gc, PCB->ElementColor); - text_at(gc, 0, yoff, PCB_MIL_TO_COORD(9), "Symbol"); - text_at(gc, PCB_MIL_TO_COORD(410), yoff, PCB_MIL_TO_COORD(9), "Diam. (Inch)"); - text_at(gc, PCB_MIL_TO_COORD(950), yoff, PCB_MIL_TO_COORD(9), "Count"); - text_at(gc, PCB_MIL_TO_COORD(1300), yoff, PCB_MIL_TO_COORD(9), "Plated?"); - yoff -= TEXT_LINE; - text_at(gc, 0, yoff, 0, - "There are %d different drill sizes used in this layout, %d holes total", AllDrills->DrillN, total_drills); - /* Create a portable timestamp. */ - currenttime = time(NULL); - { - /* avoid gcc complaints */ - const char *fmt = "%c UTC"; - strftime(utcTime, sizeof utcTime, fmt, gmtime(¤ttime)); - } - yoff = -TEXT_LINE; - for (i = 0; i < max_copper_layer; i++) { - LayerType *l = LAYER_PTR(i); - if (l->Name && (linelist_length(&l->Line) || arclist_length(&l->Arc))) { - if (strcmp("route", l->Name) == 0) - break; - if (strcmp("outline", l->Name) == 0) - break; - } - } - if (i == max_copper_layer) { - gui->set_line_width(gc, PCB_MIL_TO_COORD(10)); - gui->draw_line(gc, 0, 0, PCB->MaxWidth, 0); - gui->draw_line(gc, 0, 0, 0, PCB->MaxHeight); - gui->draw_line(gc, PCB->MaxWidth, 0, PCB->MaxWidth, PCB->MaxHeight); - gui->draw_line(gc, 0, PCB->MaxHeight, PCB->MaxWidth, PCB->MaxHeight); - /*FPrintOutline (); */ - gui->set_line_width(gc, FAB_LINE_W); - text_at(gc, PCB_MIL_TO_COORD(2000), yoff, 0, - "Maximum Dimensions: %f mils wide, %f mils high", PCB_COORD_TO_MIL(PCB->MaxWidth), PCB_COORD_TO_MIL(PCB->MaxHeight)); - text_at(gc, PCB->MaxWidth / 2, PCB->MaxHeight + PCB_MIL_TO_COORD(20), 1, - "Board outline is the centerline of this %f mil" - " rectangle - 0,0 to %f,%f mils", - PCB_COORD_TO_MIL(FAB_LINE_W), PCB_COORD_TO_MIL(PCB->MaxWidth), PCB_COORD_TO_MIL(PCB->MaxHeight)); - } - else { - LayerTypePtr layer = LAYER_PTR(i); - gui->set_line_width(gc, PCB_MIL_TO_COORD(10)); - LINE_LOOP(layer); - { - gui->draw_line(gc, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y); - } - END_LOOP; - ARC_LOOP(layer); - { - gui->draw_arc(gc, arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); - } - END_LOOP; - TEXT_LOOP(layer); - { - DrawTextLowLevel(text, 0); - } - END_LOOP; - gui->set_line_width(gc, FAB_LINE_W); - text_at(gc, PCB->MaxWidth / 2, PCB->MaxHeight + PCB_MIL_TO_COORD(20), 1, "Board outline is the centerline of this path"); - } - yoff -= TEXT_LINE; - text_at(gc, PCB_MIL_TO_COORD(2000), yoff, 0, "Date: %s", utcTime); - yoff -= TEXT_LINE; - text_at(gc, PCB_MIL_TO_COORD(2000), yoff, 0, "Author: %s", pcb_author()); - yoff -= TEXT_LINE; - text_at(gc, PCB_MIL_TO_COORD(2000), yoff, 0, "Title: %s - Fabrication Drawing", UNKNOWN(PCB->Name)); -} Index: 1.1.4/src/find_drc.c =================================================================== --- 1.1.4/src/find_drc.c (revision 10776) +++ 1.1.4/src/find_drc.c (nonexistent) @@ -1,830 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - -/* DRC related functions */ - -static void GotoError(void); -static pcb_bool DRCFind(int What, void *ptr1, void *ptr2, void *ptr3); - -static DrcViolationType - * pcb_drc_violation_new(const char *title, - const char *explanation, - Coord x, Coord y, - Angle angle, - pcb_bool have_measured, - Coord measured_value, - Coord required_value, int object_count, long int *object_id_list, int *object_type_list) -{ - DrcViolationType *violation = (DrcViolationType *) malloc(sizeof(DrcViolationType)); - - violation->title = pcb_strdup(title); - violation->explanation = pcb_strdup(explanation); - violation->x = x; - violation->y = y; - violation->angle = angle; - violation->have_measured = have_measured; - violation->measured_value = measured_value; - violation->required_value = required_value; - violation->object_count = object_count; - violation->object_id_list = object_id_list; - violation->object_type_list = object_type_list; - - return violation; -} - -static void pcb_drc_violation_free(DrcViolationType * violation) -{ - free(violation->title); - free(violation->explanation); - free(violation); -} - -static gds_t drc_dialog_message; -static void reset_drc_dialog_message(void) -{ - gds_truncate(&drc_dialog_message, 0); - if (gui->drc_gui != NULL) - gui->drc_gui->reset_drc_dialog_message(); -} - -static void append_drc_dialog_message(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - pcb_append_vprintf(&drc_dialog_message, fmt, ap); - va_end(ap); -} - -static void GotoError(void); - -/*---------------------------------------------------------------------------- - * Build a list of the of offending items by ID. (Currently just "thing") - */ -static void BuildObjectList(int *object_count, long int **object_id_list, int **object_type_list) -{ - *object_count = 0; - *object_id_list = NULL; - *object_type_list = NULL; - - switch (thing_type) { - case PCB_TYPE_LINE: - case PCB_TYPE_ARC: - case PCB_TYPE_POLYGON: - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - case PCB_TYPE_PAD: - case PCB_TYPE_ELEMENT: - case PCB_TYPE_RATLINE: - *object_count = 1; - *object_id_list = (long int *) malloc(sizeof(long int)); - *object_type_list = (int *) malloc(sizeof(int)); - **object_id_list = ((AnyObjectType *) thing_ptr3)->ID; - **object_type_list = thing_type; - return; - - default: - fprintf(stderr, _("Internal error in BuildObjectList: unknown object type %i\n"), thing_type); - } -} - - - -/*---------------------------------------------------------------------------- - * Locate the coordinatates of offending item (thing) - */ -static void LocateError(Coord * x, Coord * y) -{ - switch (thing_type) { - case PCB_TYPE_LINE: - { - LineTypePtr line = (LineTypePtr) thing_ptr3; - *x = (line->Point1.X + line->Point2.X) / 2; - *y = (line->Point1.Y + line->Point2.Y) / 2; - break; - } - case PCB_TYPE_ARC: - { - ArcTypePtr arc = (ArcTypePtr) thing_ptr3; - *x = arc->X; - *y = arc->Y; - break; - } - case PCB_TYPE_POLYGON: - { - PolygonTypePtr polygon = (PolygonTypePtr) thing_ptr3; - *x = (polygon->Clipped->contours->xmin + polygon->Clipped->contours->xmax) / 2; - *y = (polygon->Clipped->contours->ymin + polygon->Clipped->contours->ymax) / 2; - break; - } - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - { - PinTypePtr pin = (PinTypePtr) thing_ptr3; - *x = pin->X; - *y = pin->Y; - break; - } - case PCB_TYPE_PAD: - { - PadTypePtr pad = (PadTypePtr) thing_ptr3; - *x = (pad->Point1.X + pad->Point2.X) / 2; - *y = (pad->Point1.Y + pad->Point2.Y) / 2; - break; - } - case PCB_TYPE_ELEMENT: - { - ElementTypePtr element = (ElementTypePtr) thing_ptr3; - *x = element->MarkX; - *y = element->MarkY; - break; - } - default: - return; - } -} - - -static void append_drc_violation(DrcViolationType * violation) -{ - if (gui->drc_gui != NULL) { - gui->drc_gui->append_drc_violation(violation); - } - else { - /* Fallback to formatting the violation message as text */ - append_drc_dialog_message("%s\n", violation->title); - append_drc_dialog_message(_("%m+near %$mD\n"), conf_core.editor.grid_unit->allow, violation->x, violation->y); - GotoError(); - } - - if (gui->drc_gui == NULL || gui->drc_gui->log_drc_violations) { - Message(PCB_MSG_DEFAULT, _("WARNING! Design Rule error - %s\n"), violation->title); - Message(PCB_MSG_DEFAULT, _("%m+near location %$mD\n"), conf_core.editor.grid_unit->allow, violation->x, violation->y); - } -} - - -/* - * message when asked about continuing DRC checks after next - * violation is found. - */ -#define DRC_CONTINUE _("Press Next to continue DRC checking") -#define DRC_NEXT _("Next") -#define DRC_CANCEL _("Cancel") - -static int throw_drc_dialog(void) -{ - int r; - - if (gui->drc_gui != NULL) { - r = gui->drc_gui->throw_drc_dialog(); - } - else { - /* Fallback to formatting the violation message as text */ - append_drc_dialog_message(DRC_CONTINUE); - r = gui->confirm_dialog(drc_dialog_message.array, DRC_CANCEL, DRC_NEXT); - reset_drc_dialog_message(); - } - return r; -} - -/* DRC clearance callback */ -static r_dir_t drc_callback(DataTypePtr data, LayerTypePtr layer, PolygonTypePtr polygon, int type, void *ptr1, void *ptr2) -{ - const char *message; - Coord x, y; - int object_count; - long int *object_id_list; - int *object_type_list; - DrcViolationType *violation; - - LineTypePtr line = (LineTypePtr) ptr2; - ArcTypePtr arc = (ArcTypePtr) ptr2; - PinTypePtr pin = (PinTypePtr) ptr2; - PadTypePtr pad = (PadTypePtr) ptr2; - - thing_type = type; - thing_ptr1 = ptr1; - thing_ptr2 = ptr2; - thing_ptr3 = ptr2; - switch (type) { - case PCB_TYPE_LINE: - if (line->Clearance < 2 * PCB->Bloat) { - AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); - SET_FLAG(TheFlag, line); - message = _("Line with insufficient clearance inside polygon\n"); - goto doIsBad; - } - break; - case PCB_TYPE_ARC: - if (arc->Clearance < 2 * PCB->Bloat) { - AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); - SET_FLAG(TheFlag, arc); - message = _("Arc with insufficient clearance inside polygon\n"); - goto doIsBad; - } - break; - case PCB_TYPE_PAD: - if (pad->Clearance && pad->Clearance < 2 * PCB->Bloat) - if (IsPadInPolygon(pad, polygon)) { - AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); - SET_FLAG(TheFlag, pad); - message = _("Pad with insufficient clearance inside polygon\n"); - goto doIsBad; - } - break; - case PCB_TYPE_PIN: - if (pin->Clearance && pin->Clearance < 2 * PCB->Bloat) { - AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); - SET_FLAG(TheFlag, pin); - message = _("Pin with insufficient clearance inside polygon\n"); - goto doIsBad; - } - break; - case PCB_TYPE_VIA: - if (pin->Clearance && pin->Clearance < 2 * PCB->Bloat) { - AddObjectToFlagUndoList(type, ptr1, ptr2, ptr2); - SET_FLAG(TheFlag, pin); - message = _("Via with insufficient clearance inside polygon\n"); - goto doIsBad; - } - break; - default: - Message(PCB_MSG_DEFAULT, "hace: Bad Plow object in callback\n"); - } - return R_DIR_NOT_FOUND; - -doIsBad: - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, layer, polygon, polygon); - SET_FLAG(PCB_FLAG_FOUND, polygon); - DrawPolygon(layer, polygon); - DrawObject(type, ptr1, ptr2); - drcerr_count++; - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(message, _("Circuits that are too close may bridge during imaging, etching,\n" "plating, or soldering processes resulting in a direct short."), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - FALSE, /* MEASUREMENT OF ERROR UNKNOWN */ - 0, /* MAGNITUDE OF ERROR UNKNOWN */ - PCB->Bloat, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - return R_DIR_FOUND_CONTINUE; - } - IncrementUndoSerialNumber(); - Undo(pcb_true); - return R_DIR_NOT_FOUND; -} - - - -/*----------------------------------------------------------------------------- - * Check for DRC violations - * see if the connectivity changes when everything is bloated, or shrunk - */ -int DRCAll(void) -{ - Coord x, y; - int object_count; - long int *object_id_list; - int *object_type_list; - DrcViolationType *violation; - int tmpcnt; - int nopastecnt = 0; - - reset_drc_dialog_message(); - - IsBad = pcb_false; - drcerr_count = 0; - SaveStackAndVisibility(); - ResetStackAndVisibility(); - hid_action("LayersChanged"); - InitConnectionLookup(); - - TheFlag = PCB_FLAG_FOUND | PCB_FLAG_DRC | PCB_FLAG_SELECTED; - - if (ResetConnections(pcb_true)) { - IncrementUndoSerialNumber(); - Draw(); - } - - User = pcb_false; - - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (!TEST_FLAG(PCB_FLAG_DRC, pin) - && DRCFind(PCB_TYPE_PIN, (void *) element, (void *) pin, (void *) pin)) { - IsBad = pcb_true; - break; - } - } - END_LOOP; - if (IsBad) - break; - PAD_LOOP(element); - { - - /* count up how many pads have no solderpaste openings */ - if (TEST_FLAG(PCB_FLAG_NOPASTE, pad)) - nopastecnt++; - - if (!TEST_FLAG(PCB_FLAG_DRC, pad) - && DRCFind(PCB_TYPE_PAD, (void *) element, (void *) pad, (void *) pad)) { - IsBad = pcb_true; - break; - } - } - END_LOOP; - if (IsBad) - break; - } - END_LOOP; - if (!IsBad) - VIA_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_DRC, via) - && DRCFind(PCB_TYPE_VIA, (void *) via, (void *) via, (void *) via)) { - IsBad = pcb_true; - break; - } - } - END_LOOP; - - TheFlag = (IsBad) ? PCB_FLAG_DRC : (PCB_FLAG_FOUND | PCB_FLAG_DRC | PCB_FLAG_SELECTED); - ResetConnections(pcb_false); - TheFlag = PCB_FLAG_SELECTED; - /* check minimum widths and polygon clearances */ - if (!IsBad) { - COPPERLINE_LOOP(PCB->Data); - { - /* check line clearances in polygons */ - PlowsPolygon(PCB->Data, PCB_TYPE_LINE, layer, line, drc_callback); - if (IsBad) - break; - if (line->Thickness < PCB->minWid) { - AddObjectToFlagUndoList(PCB_TYPE_LINE, layer, line, line); - SET_FLAG(TheFlag, line); - DrawLine(layer, line); - drcerr_count++; - SetThing(PCB_TYPE_LINE, layer, line, line); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Line width is too thin"), _("Process specifications dictate a minimum feature-width\n" "that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - line->Thickness, PCB->minWid, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - IncrementUndoSerialNumber(); - Undo(pcb_false); - } - } - ENDALL_LOOP; - } - if (!IsBad) { - COPPERARC_LOOP(PCB->Data); - { - PlowsPolygon(PCB->Data, PCB_TYPE_ARC, layer, arc, drc_callback); - if (IsBad) - break; - if (arc->Thickness < PCB->minWid) { - AddObjectToFlagUndoList(PCB_TYPE_ARC, layer, arc, arc); - SET_FLAG(TheFlag, arc); - DrawArc(layer, arc); - drcerr_count++; - SetThing(PCB_TYPE_ARC, layer, arc, arc); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Arc width is too thin"), _("Process specifications dictate a minimum feature-width\n" "that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - arc->Thickness, PCB->minWid, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - IncrementUndoSerialNumber(); - Undo(pcb_false); - } - } - ENDALL_LOOP; - } - if (!IsBad) { - ALLPIN_LOOP(PCB->Data); - { - PlowsPolygon(PCB->Data, PCB_TYPE_PIN, element, pin, drc_callback); - if (IsBad) - break; - if (!TEST_FLAG(PCB_FLAG_HOLE, pin) && pin->Thickness - pin->DrillingHole < 2 * PCB->minRing) { - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - SET_FLAG(TheFlag, pin); - DrawPin(pin); - drcerr_count++; - SetThing(PCB_TYPE_PIN, element, pin, pin); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Pin annular ring too small"), _("Annular rings that are too small may erode during etching,\n" "resulting in a broken connection"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - (pin->Thickness - pin->DrillingHole) / 2, - PCB->minRing, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - IncrementUndoSerialNumber(); - Undo(pcb_false); - } - if (pin->DrillingHole < PCB->minDrill) { - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - SET_FLAG(TheFlag, pin); - DrawPin(pin); - drcerr_count++; - SetThing(PCB_TYPE_PIN, element, pin, pin); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Pin drill size is too small"), _("Process rules dictate the minimum drill size which can be used"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - pin->DrillingHole, PCB->minDrill, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - IncrementUndoSerialNumber(); - Undo(pcb_false); - } - } - ENDALL_LOOP; - } - if (!IsBad) { - ALLPAD_LOOP(PCB->Data); - { - PlowsPolygon(PCB->Data, PCB_TYPE_PAD, element, pad, drc_callback); - if (IsBad) - break; - if (pad->Thickness < PCB->minWid) { - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - SET_FLAG(TheFlag, pad); - DrawPad(pad); - drcerr_count++; - SetThing(PCB_TYPE_PAD, element, pad, pad); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Pad is too thin"), _("Pads which are too thin may erode during etching,\n" "resulting in a broken or unreliable connection"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - pad->Thickness, PCB->minWid, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - IncrementUndoSerialNumber(); - Undo(pcb_false); - } - } - ENDALL_LOOP; - } - if (!IsBad) { - VIA_LOOP(PCB->Data); - { - PlowsPolygon(PCB->Data, PCB_TYPE_VIA, via, via, drc_callback); - if (IsBad) - break; - if (!TEST_FLAG(PCB_FLAG_HOLE, via) && via->Thickness - via->DrillingHole < 2 * PCB->minRing) { - AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); - SET_FLAG(TheFlag, via); - DrawVia(via); - drcerr_count++; - SetThing(PCB_TYPE_VIA, via, via, via); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Via annular ring too small"), _("Annular rings that are too small may erode during etching,\n" "resulting in a broken connection"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - (via->Thickness - via->DrillingHole) / 2, - PCB->minRing, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - IncrementUndoSerialNumber(); - Undo(pcb_false); - } - if (via->DrillingHole < PCB->minDrill) { - AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); - SET_FLAG(TheFlag, via); - DrawVia(via); - drcerr_count++; - SetThing(PCB_TYPE_VIA, via, via, via); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Via drill size is too small"), _("Process rules dictate the minimum drill size which can be used"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - via->DrillingHole, PCB->minDrill, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - IncrementUndoSerialNumber(); - Undo(pcb_false); - } - } - END_LOOP; - } - - FreeConnectionLookupMemory(); - TheFlag = PCB_FLAG_FOUND; - Bloat = 0; - - /* check silkscreen minimum widths outside of elements */ - /* XXX - need to check text and polygons too! */ - TheFlag = PCB_FLAG_SELECTED; - if (!IsBad) { - SILKLINE_LOOP(PCB->Data); - { - if (line->Thickness < PCB->minSlk) { - SET_FLAG(TheFlag, line); - DrawLine(layer, line); - drcerr_count++; - SetThing(PCB_TYPE_LINE, layer, line, line); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Silk line is too thin"), _("Process specifications dictate a minimum silkscreen feature-width\n" "that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - line->Thickness, PCB->minSlk, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - } - } - ENDALL_LOOP; - } - - /* check silkscreen minimum widths inside of elements */ - /* XXX - need to check text and polygons too! */ - TheFlag = PCB_FLAG_SELECTED; - if (!IsBad) { - ELEMENT_LOOP(PCB->Data); - { - tmpcnt = 0; - ELEMENTLINE_LOOP(element); - { - if (line->Thickness < PCB->minSlk) - tmpcnt++; - } - END_LOOP; - if (tmpcnt > 0) { - const char *title; - const char *name; - char *buffer; - int buflen; - - SET_FLAG(TheFlag, element); - DrawElement(element); - drcerr_count++; - SetThing(PCB_TYPE_ELEMENT, element, element, element); - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - - title = _("Element %s has %i silk lines which are too thin"); - name = UNKNOWN(NAMEONPCB_NAME(element)); - - /* -4 is for the %s and %i place-holders */ - /* +11 is the max printed length for a 32 bit integer */ - /* +1 is for the \0 termination */ - buflen = strlen(title) - 4 + strlen(name) + 11 + 1; - buffer = (char *) malloc(buflen); - pcb_snprintf(buffer, buflen, title, name, tmpcnt); - - violation = pcb_drc_violation_new(buffer, _("Process specifications dictate a minimum silkscreen\n" "feature-width that can reliably be reproduced"), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - TRUE, /* MEASUREMENT OF ERROR KNOWN */ - 0, /* MINIMUM OFFENDING WIDTH UNKNOWN */ - PCB->minSlk, object_count, object_id_list, object_type_list); - free(buffer); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - if (!throw_drc_dialog()) { - IsBad = pcb_true; - break; - } - } - } - END_LOOP; - } - - - if (IsBad) { - IncrementUndoSerialNumber(); - } - - - RestoreStackAndVisibility(); - hid_action("LayersChanged"); - gui->invalidate_all(); - - if (nopastecnt > 0) { - Message(PCB_MSG_DEFAULT, _("Warning: %d pad%s the nopaste flag set.\n"), nopastecnt, nopastecnt > 1 ? "s have" : " has"); - } - return IsBad ? -drcerr_count : drcerr_count; -} - - - -/*----------------------------------------------------------------------------- - * Check for DRC violations on a single net starting from the pad or pin - * sees if the connectivity changes when everything is bloated, or shrunk - */ -static pcb_bool DRCFind(int What, void *ptr1, void *ptr2, void *ptr3) -{ - Coord x, y; - int object_count; - long int *object_id_list; - int *object_type_list; - DrcViolationType *violation; - - if (PCB->Shrink != 0) { - Bloat = -PCB->Shrink; - TheFlag = PCB_FLAG_DRC | PCB_FLAG_SELECTED; - ListStart(What, ptr1, ptr2, ptr3); - DoIt(pcb_true, pcb_false); - /* ok now the shrunk net has the PCB_FLAG_SELECTED set */ - DumpList(); - TheFlag = PCB_FLAG_FOUND; - ListStart(What, ptr1, ptr2, ptr3); - Bloat = 0; - drc = pcb_true; /* abort the search if we find anything not already found */ - if (DoIt(pcb_true, pcb_false)) { - DumpList(); - /* make the flag changes undoable */ - TheFlag = PCB_FLAG_FOUND | PCB_FLAG_SELECTED; - ResetConnections(pcb_false); - User = pcb_true; - drc = pcb_false; - Bloat = -PCB->Shrink; - TheFlag = PCB_FLAG_SELECTED; - ListStart(What, ptr1, ptr2, ptr3); - DoIt(pcb_true, pcb_true); - DumpList(); - ListStart(What, ptr1, ptr2, ptr3); - TheFlag = PCB_FLAG_FOUND; - Bloat = 0; - drc = pcb_true; - DoIt(pcb_true, pcb_true); - DumpList(); - User = pcb_false; - drc = pcb_false; - drcerr_count++; - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Potential for broken trace"), _("Insufficient overlap between objects can lead to broken tracks\n" "due to registration errors with old wheel style photo-plotters."), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - FALSE, /* MEASUREMENT OF ERROR UNKNOWN */ - 0, /* MAGNITUDE OF ERROR UNKNOWN */ - PCB->Shrink, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - - if (!throw_drc_dialog()) - return (pcb_true); - IncrementUndoSerialNumber(); - Undo(pcb_true); - } - DumpList(); - } - /* now check the bloated condition */ - drc = pcb_false; - ResetConnections(pcb_false); - TheFlag = PCB_FLAG_FOUND; - ListStart(What, ptr1, ptr2, ptr3); - Bloat = PCB->Bloat; - drc = pcb_true; - while (DoIt(pcb_true, pcb_false)) { - DumpList(); - /* make the flag changes undoable */ - TheFlag = PCB_FLAG_FOUND | PCB_FLAG_SELECTED; - ResetConnections(pcb_false); - User = pcb_true; - drc = pcb_false; - Bloat = 0; - TheFlag = PCB_FLAG_SELECTED; - ListStart(What, ptr1, ptr2, ptr3); - DoIt(pcb_true, pcb_true); - DumpList(); - TheFlag = PCB_FLAG_FOUND; - ListStart(What, ptr1, ptr2, ptr3); - Bloat = PCB->Bloat; - drc = pcb_true; - DoIt(pcb_true, pcb_true); - DumpList(); - drcerr_count++; - LocateError(&x, &y); - BuildObjectList(&object_count, &object_id_list, &object_type_list); - violation = pcb_drc_violation_new(_("Copper areas too close"), _("Circuits that are too close may bridge during imaging, etching,\n" "plating, or soldering processes resulting in a direct short."), x, y, 0, /* ANGLE OF ERROR UNKNOWN */ - FALSE, /* MEASUREMENT OF ERROR UNKNOWN */ - 0, /* MAGNITUDE OF ERROR UNKNOWN */ - PCB->Bloat, object_count, object_id_list, object_type_list); - append_drc_violation(violation); - pcb_drc_violation_free(violation); - free(object_id_list); - free(object_type_list); - User = pcb_false; - drc = pcb_false; - if (!throw_drc_dialog()) - return (pcb_true); - IncrementUndoSerialNumber(); - Undo(pcb_true); - /* highlight the rest of the encroaching net so it's not reported again */ - TheFlag |= PCB_FLAG_SELECTED; - Bloat = 0; - ListStart(thing_type, thing_ptr1, thing_ptr2, thing_ptr3); - DoIt(pcb_true, pcb_true); - DumpList(); - drc = pcb_true; - Bloat = PCB->Bloat; - ListStart(What, ptr1, ptr2, ptr3); - } - drc = pcb_false; - DumpList(); - TheFlag = PCB_FLAG_FOUND | PCB_FLAG_SELECTED; - ResetConnections(pcb_false); - return (pcb_false); -} - -/*---------------------------------------------------------------------------- - * center the display to show the offending item (thing) - */ -static void GotoError(void) -{ - Coord X, Y; - - LocateError(&X, &Y); - - switch (thing_type) { - case PCB_TYPE_LINE: - case PCB_TYPE_ARC: - case PCB_TYPE_POLYGON: - ChangeGroupVisibility(GetLayerNumber(PCB->Data, (LayerTypePtr) thing_ptr1), pcb_true, pcb_true); - } - CenterDisplay(X, Y); -} Index: 1.1.4/src/pcb-printf.h =================================================================== --- 1.1.4/src/pcb-printf.h (revision 10776) +++ 1.1.4/src/pcb-printf.h (nonexistent) @@ -1,126 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2011 Andrew Poelstra - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Andrew Poelstra, 16966 60A Ave, V3S 8X5 Surrey, BC, Canada - * asp11@sfu.ca - * - */ - -/* This file defines a wrapper around sprintf, that - * defines new specifiers that take pcb Coord objects - * as input. - * - * There is a fair bit of nasty (repetitious) code in - * here, but I feel the gain in clarity for output - * code elsewhere in the project will make it worth - * it. - * - * The new specifiers are: - * %mI outout a raw internal coordinate without any suffix - * %mm output a measure in mm - * %mM output a measure in scaled (mm/um) metric - * %ml output a measure in mil - * %mk output a measure in decimil (kicad legacy format) - * %mL output a measure in scaled (mil/in) imperial - * %ms output a measure in most natural mm/mil units - * %mS output a measure in most natural scaled units - * %mH output a measure in most human readable scaled units - * %md output a pair of measures in most natural mm/mil units - * %mD output a pair of measures in most natural scaled units - * %m3 output 3 measures in most natural scaled units - * ... - * %m9 output 9 measures in most natural scaled units - * %m* output a measure with unit given as an additional - * const char* parameter - * %m+ accepts an e_allow parameter that masks all subsequent - * "natural" (S/D/3/.../9) specifiers to only use certain - * units - * %mr output a measure in a unit readable by parse_l.l - * (outputs in centimil without units - compatibility with mainline) - * %ma output an angle in degrees (expects degrees) - * - * These accept the usual printf modifiers for %f, as well as - * $ output a unit suffix after the measure (with space between measure and unit) - * $$ output a unit suffix after the measure (without space) - * .n number of digits after the decimal point (the usual %f modifier) - * .0n where n is a digit; same as %.n, but truncates trailing zeros - * [n] use stored format n - * # prevents all scaling for %mS/D/1/.../9 (this should - * ONLY be used for debug code since its output exposes - * pcb's base units). - * - * The usual printf(3) precision and length modifiers should work with - * any format specifier that outputs coords, e.g. %.3mm will output in - * mm up to 3 decimal digits after the decimal point. - * - * KNOWN ISSUES: - * No support for %zu size_t printf spec - */ - -#ifndef PCB_PCB_PRINTF_H -#define PCB_PCB_PRINTF_H - -#include -#include -#include "unit.h" - -void initialize_units(); - -int pcb_fprintf(FILE * f, const char *fmt, ...); -int pcb_vfprintf(FILE * f, const char *fmt, va_list args); -int pcb_sprintf(char *string, const char *fmt, ...); -int pcb_snprintf(char *string, size_t len, const char *fmt, ...); -int pcb_printf(const char *fmt, ...); -char *pcb_strdup_printf(const char *fmt, ...); -char *pcb_strdup_vprintf(const char *fmt, va_list args); - -int pcb_append_printf(gds_t *str, const char *fmt, ...); -int pcb_append_vprintf(gds_t *string, const char *fmt, va_list args); - -/* Predefined slots (macros): %[n] will use the nth string from this list. - The first 8 are user-definable. */ -typedef enum { - PCB_PRINTF_SLOT_USER0, - PCB_PRINTF_SLOT_USER1, - PCB_PRINTF_SLOT_USER2, - PCB_PRINTF_SLOT_USER3, - PCB_PRINTF_SLOT_USER4, - PCB_PRINTF_SLOT_USER5, - PCB_PRINTF_SLOT_USER6, - PCB_PRINTF_SLOT_USER7, - PCB_PRINTF_SLOT_FF_ORIG_COORD, /* %[8] original .pcb file format coord prints */ - PCB_PRINTF_SLOT_FF_SAFE_COORD, /* %[9] safe .pcb file format coord print that doesn't lose precision */ - PCB_PRINTF_SLOT_max -} pcb_printf_slot_idx_t; -extern const char *pcb_printf_slot[PCB_PRINTF_SLOT_max]; - -/* strdup and return a template; also attempt to replace printf-like formatting - directives (e.g. %P) using an user provided callback function. The callback - function needs to recognize the directive at **input (pointing to the byte - after the %) and append the substitution to s and increase *input to point - beyond the format directive. The callback returns 0 on success or -1 - on unknown directive (whcih will be copied verbatim). %% will always - be translated into a single %, without calling cb. -*/ -char *pcb_strdup_subst(const char *template, int (*cb)(gds_t *s, const char **input)); - -#endif Index: 1.1.4/src/buffer.c =================================================================== --- 1.1.4/src/buffer.c (revision 10776) +++ 1.1.4/src/buffer.c (nonexistent) @@ -1,1449 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* functions used by paste- and move/copy buffer - */ - -#include "config.h" -#include "conf_core.h" - -#include -#include - -#include "action_helper.h" -#include "buffer.h" -#include "copy.h" -#include "create.h" -#include "crosshair.h" -#include "data.h" -#include "error.h" -#include "plug_io.h" -#include "mirror.h" -#include "misc.h" -#include "misc_util.h" -#include "polygon.h" -#include "rotate.h" -#include "remove.h" -#include "rtree.h" -#include "select.h" -#include "set.h" -#include "funchash_core.h" -#include "compat_misc.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void *AddViaToBuffer(PinTypePtr); -static void *AddLineToBuffer(LayerTypePtr, LineTypePtr); -static void *AddArcToBuffer(LayerTypePtr, ArcTypePtr); -static void *AddRatToBuffer(RatTypePtr); -static void *AddTextToBuffer(LayerTypePtr, TextTypePtr); -static void *AddPolygonToBuffer(LayerTypePtr, PolygonTypePtr); -static void *AddElementToBuffer(ElementTypePtr); -static void *MoveViaToBuffer(PinTypePtr); -static void *MoveLineToBuffer(LayerTypePtr, LineTypePtr); -static void *MoveArcToBuffer(LayerTypePtr, ArcTypePtr); -static void *MoveRatToBuffer(RatTypePtr); -static void *MoveTextToBuffer(LayerTypePtr, TextTypePtr); -static void *MovePolygonToBuffer(LayerTypePtr, PolygonTypePtr); -static void *MoveElementToBuffer(ElementTypePtr); -static void SwapBuffer(BufferTypePtr); - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static DataTypePtr Dest, Source; - -static ObjectFunctionType AddBufferFunctions = { - AddLineToBuffer, - AddTextToBuffer, - AddPolygonToBuffer, - AddViaToBuffer, - AddElementToBuffer, - NULL, - NULL, - NULL, - NULL, - NULL, - AddArcToBuffer, - AddRatToBuffer -}, MoveBufferFunctions = { -MoveLineToBuffer, - MoveTextToBuffer, - MovePolygonToBuffer, MoveViaToBuffer, MoveElementToBuffer, NULL, NULL, NULL, NULL, NULL, MoveArcToBuffer, MoveRatToBuffer}; - -static int ExtraFlag = 0; - -/* --------------------------------------------------------------------------- - * copies a via to paste buffer - */ -static void *AddViaToBuffer(PinTypePtr Via) -{ - return (CreateNewVia(Dest, Via->X, Via->Y, Via->Thickness, Via->Clearance, - Via->Mask, Via->DrillingHole, Via->Name, MaskFlags(Via->Flags, PCB_FLAG_FOUND | ExtraFlag))); -} - -/* --------------------------------------------------------------------------- - * copies a rat-line to paste buffer - */ -static void *AddRatToBuffer(RatTypePtr Rat) -{ - return (CreateNewRat(Dest, Rat->Point1.X, Rat->Point1.Y, - Rat->Point2.X, Rat->Point2.Y, Rat->group1, - Rat->group2, Rat->Thickness, MaskFlags(Rat->Flags, PCB_FLAG_FOUND | ExtraFlag))); -} - -/* --------------------------------------------------------------------------- - * copies a line to buffer - */ -static void *AddLineToBuffer(LayerTypePtr Layer, LineTypePtr Line) -{ - LineTypePtr line; - LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; - - line = CreateNewLineOnLayer(layer, Line->Point1.X, Line->Point1.Y, - Line->Point2.X, Line->Point2.Y, - Line->Thickness, Line->Clearance, MaskFlags(Line->Flags, PCB_FLAG_FOUND | ExtraFlag)); - if (line && Line->Number) - line->Number = pcb_strdup(Line->Number); - return (line); -} - -/* --------------------------------------------------------------------------- - * copies an arc to buffer - */ -static void *AddArcToBuffer(LayerTypePtr Layer, ArcTypePtr Arc) -{ - LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; - - return (CreateNewArcOnLayer(layer, Arc->X, Arc->Y, - Arc->Width, Arc->Height, Arc->StartAngle, Arc->Delta, - Arc->Thickness, Arc->Clearance, MaskFlags(Arc->Flags, PCB_FLAG_FOUND | ExtraFlag))); -} - -/* --------------------------------------------------------------------------- - * copies a text to buffer - */ -static void *AddTextToBuffer(LayerTypePtr Layer, TextTypePtr Text) -{ - LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; - - return (CreateNewText(layer, &PCB->Font, Text->X, Text->Y, - Text->Direction, Text->Scale, Text->TextString, MaskFlags(Text->Flags, ExtraFlag))); -} - -/* --------------------------------------------------------------------------- - * copies a polygon to buffer - */ -static void *AddPolygonToBuffer(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - LayerTypePtr layer = &Dest->Layer[GetLayerNumber(Source, Layer)]; - PolygonTypePtr polygon; - - polygon = CreateNewPolygon(layer, Polygon->Flags); - CopyPolygonLowLevel(polygon, Polygon); - - /* Update the polygon r-tree. Unlike similarly named functions for - * other objects, CreateNewPolygon does not do this as it creates a - * skeleton polygon object, which won't have correct bounds. - */ - if (!layer->polygon_tree) - layer->polygon_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); - - CLEAR_FLAG(PCB_FLAG_FOUND | ExtraFlag, polygon); - return (polygon); -} - -/* --------------------------------------------------------------------------- - * copies a element to buffer - */ -static void *AddElementToBuffer(ElementTypePtr Element) -{ - ElementTypePtr element; - - element = GetElementMemory(Dest); - CopyElementLowLevel(Dest, element, Element, pcb_false, 0, 0); - CLEAR_FLAG(ExtraFlag, element); - if (ExtraFlag) { - ELEMENTTEXT_LOOP(element); - { - CLEAR_FLAG(ExtraFlag, text); - } - END_LOOP; - PIN_LOOP(element); - { - CLEAR_FLAG(PCB_FLAG_FOUND | ExtraFlag, pin); - } - END_LOOP; - PAD_LOOP(element); - { - CLEAR_FLAG(PCB_FLAG_FOUND | ExtraFlag, pad); - } - END_LOOP; - } - return (element); -} - -/* --------------------------------------------------------------------------- - * moves a via to paste buffer without allocating memory for the name - */ -static void *MoveViaToBuffer(PinType * via) -{ - RestoreToPolygon(Source, PCB_TYPE_VIA, via, via); - - r_delete_entry(Source->via_tree, (BoxType *) via); - pinlist_remove(via); - pinlist_append(&Dest->Via, via); - - CLEAR_FLAG(PCB_FLAG_WARN | PCB_FLAG_FOUND, via); - - if (!Dest->via_tree) - Dest->via_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Dest->via_tree, (BoxType *) via, 0); - ClearFromPolygon(Dest, PCB_TYPE_VIA, via, via); - return via; -} - -/* --------------------------------------------------------------------------- - * moves a rat-line to paste buffer - */ -static void *MoveRatToBuffer(RatType * rat) -{ - r_delete_entry(Source->rat_tree, (BoxType *) rat); - - ratlist_remove(rat); - ratlist_append(&Dest->Rat, rat); - - CLEAR_FLAG(PCB_FLAG_FOUND, rat); - - if (!Dest->rat_tree) - Dest->rat_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Dest->rat_tree, (BoxType *) rat, 0); - return rat; -} - -/* --------------------------------------------------------------------------- - * moves a line to buffer - */ -static void *MoveLineToBuffer(LayerType * layer, LineType * line) -{ - LayerTypePtr lay = &Dest->Layer[GetLayerNumber(Source, layer)]; - - RestoreToPolygon(Source, PCB_TYPE_LINE, layer, line); - r_delete_entry(layer->line_tree, (BoxType *) line); - - linelist_remove(line); - linelist_append(&(lay->Line), line); - - CLEAR_FLAG(PCB_FLAG_FOUND, line); - - if (!lay->line_tree) - lay->line_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(lay->line_tree, (BoxType *) line, 0); - ClearFromPolygon(Dest, PCB_TYPE_LINE, lay, line); - return (line); -} - -/* --------------------------------------------------------------------------- - * moves an arc to buffer - */ -static void *MoveArcToBuffer(LayerType * layer, ArcType * arc) -{ - LayerType *lay = &Dest->Layer[GetLayerNumber(Source, layer)]; - - RestoreToPolygon(Source, PCB_TYPE_ARC, layer, arc); - r_delete_entry(layer->arc_tree, (BoxType *) arc); - - arclist_remove(arc); - arclist_append(&lay->Arc, arc); - - CLEAR_FLAG(PCB_FLAG_FOUND, arc); - - if (!lay->arc_tree) - lay->arc_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(lay->arc_tree, (BoxType *) arc, 0); - ClearFromPolygon(Dest, PCB_TYPE_ARC, lay, arc); - return (arc); -} - -/* --------------------------------------------------------------------------- - * moves a text to buffer without allocating memory for the name - */ -static void *MoveTextToBuffer(LayerType * layer, TextType * text) -{ - LayerType *lay = &Dest->Layer[GetLayerNumber(Source, layer)]; - - r_delete_entry(layer->text_tree, (BoxType *) text); - RestoreToPolygon(Source, PCB_TYPE_TEXT, layer, text); - - textlist_remove(text); - textlist_append(&lay->Text, text); - - if (!lay->text_tree) - lay->text_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(lay->text_tree, (BoxType *) text, 0); - ClearFromPolygon(Dest, PCB_TYPE_TEXT, lay, text); - return (text); -} - -/* --------------------------------------------------------------------------- - * moves a polygon to buffer. Doesn't allocate memory for the points - */ -static void *MovePolygonToBuffer(LayerType * layer, PolygonType * polygon) -{ - LayerType *lay = &Dest->Layer[GetLayerNumber(Source, layer)]; - - r_delete_entry(layer->polygon_tree, (BoxType *) polygon); - - polylist_remove(polygon); - polylist_append(&lay->Polygon, polygon); - - CLEAR_FLAG(PCB_FLAG_FOUND, polygon); - - if (!lay->polygon_tree) - lay->polygon_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(lay->polygon_tree, (BoxType *) polygon, 0); - return (polygon); -} - -/* --------------------------------------------------------------------------- - * moves a element to buffer without allocating memory for pins/names - */ -static void *MoveElementToBuffer(ElementType * element) -{ - /* - * Delete the element from the source (remove it from trees, - * restore to polygons) - */ - r_delete_element(Source, element); - - elementlist_remove(element); - elementlist_append(&Dest->Element, element); - - PIN_LOOP(element); - { - RestoreToPolygon(Source, PCB_TYPE_PIN, element, pin); - CLEAR_FLAG(PCB_FLAG_WARN | PCB_FLAG_FOUND, pin); - } - END_LOOP; - PAD_LOOP(element); - { - RestoreToPolygon(Source, PCB_TYPE_PAD, element, pad); - CLEAR_FLAG(PCB_FLAG_WARN | PCB_FLAG_FOUND, pad); - } - END_LOOP; - SetElementBoundingBox(Dest, element, &PCB->Font); - /* - * Now clear the from the polygons in the destination - */ - PIN_LOOP(element); - { - ClearFromPolygon(Dest, PCB_TYPE_PIN, element, pin); - } - END_LOOP; - PAD_LOOP(element); - { - ClearFromPolygon(Dest, PCB_TYPE_PAD, element, pad); - } - END_LOOP; - - return element; -} - -/* --------------------------------------------------------------------------- - * calculates the bounding box of the buffer - */ -void SetBufferBoundingBox(BufferTypePtr Buffer) -{ - BoxTypePtr box = GetDataBoundingBox(Buffer->Data); - - if (box) - Buffer->BoundingBox = *box; -} - -/* --------------------------------------------------------------------------- - * clears the contents of the paste buffer - */ -void ClearBuffer(BufferTypePtr Buffer) -{ - if (Buffer && Buffer->Data) { - FreeDataMemory(Buffer->Data); - Buffer->Data->pcb = PCB; - } -} - -/* ---------------------------------------------------------------------- - * copies all selected and visible objects to the paste buffer - * returns true if any objects have been removed - */ -void AddSelectedToBuffer(BufferTypePtr Buffer, Coord X, Coord Y, pcb_bool LeaveSelected) -{ - /* switch crosshair off because adding objects to the pastebuffer - * may change the 'valid' area for the cursor - */ - if (!LeaveSelected) - ExtraFlag = PCB_FLAG_SELECTED; - notify_crosshair_change(pcb_false); - Source = PCB->Data; - Dest = Buffer->Data; - SelectedOperation(&AddBufferFunctions, pcb_false, PCB_TYPEMASK_ALL); - - /* set origin to passed or current position */ - if (X || Y) { - Buffer->X = X; - Buffer->Y = Y; - } - else { - Buffer->X = Crosshair.X; - Buffer->Y = Crosshair.Y; - } - notify_crosshair_change(pcb_true); - ExtraFlag = 0; -} - -/* --------------------------------------------------------------------------- - * loads element data from file/library into buffer - * parse the file with disabled 'PCB mode' (see parser) - * returns pcb_false on error - * if successful, update some other stuff and reposition the pastebuffer - */ -pcb_bool LoadElementToBuffer(BufferTypePtr Buffer, const char *Name) -{ - ElementTypePtr element; - - ClearBuffer(Buffer); - if (!ParseElement(Buffer->Data, Name)) { - if (conf_core.editor.show_solder_side) - SwapBuffer(Buffer); - SetBufferBoundingBox(Buffer); - if (elementlist_length(&Buffer->Data->Element)) { - element = elementlist_first(&Buffer->Data->Element); - Buffer->X = element->MarkX; - Buffer->Y = element->MarkY; - } - else { - Buffer->X = 0; - Buffer->Y = 0; - } - return (pcb_true); - } - - /* release memory which might have been acquired */ - ClearBuffer(Buffer); - return (pcb_false); -} - - -/*--------------------------------------------------------------------------- - * Searches for the given element by "footprint" name, and loads it - * into the buffer. - */ - -/* Returns zero on success, non-zero on error. */ -int LoadFootprintByName(BufferTypePtr Buffer, const char *Footprint) -{ - return !LoadElementToBuffer(Buffer, Footprint); -} - - -static const char loadfootprint_syntax[] = "LoadFootprint(filename[,refdes,value])"; - -static const char loadfootprint_help[] = "Loads a single footprint by name."; - -/* %start-doc actions LoadFootprint - -Loads a single footprint by name, rather than by reference or through -the library. If a refdes and value are specified, those are inserted -into the footprint as well. The footprint remains in the paste buffer. - -%end-doc */ - -int LoadFootprint(int argc, const char **argv, Coord x, Coord y) -{ - const char *name = ACTION_ARG(0); - const char *refdes = ACTION_ARG(1); - const char *value = ACTION_ARG(2); - ElementTypePtr e; - - if (!name) - AFAIL(loadfootprint); - - if (LoadFootprintByName(PASTEBUFFER, name)) - return 1; - - if (elementlist_length(&PASTEBUFFER->Data->Element) == 0) { - Message(PCB_MSG_DEFAULT, "Footprint %s contains no elements", name); - return 1; - } - if (elementlist_length(&PASTEBUFFER->Data->Element) > 1) { - Message(PCB_MSG_DEFAULT, "Footprint %s contains multiple elements", name); - return 1; - } - - e = elementlist_first(&PASTEBUFFER->Data->Element); - - if (e->Name[0].TextString) - free(e->Name[0].TextString); - e->Name[0].TextString = pcb_strdup(name); - - if (e->Name[1].TextString) - free(e->Name[1].TextString); - e->Name[1].TextString = refdes ? pcb_strdup(refdes) : 0; - - if (e->Name[2].TextString) - free(e->Name[2].TextString); - e->Name[2].TextString = value ? pcb_strdup(value) : 0; - - return 0; -} - -/*--------------------------------------------------------------------------- - * - * break buffer element into pieces - */ -pcb_bool SmashBufferElement(BufferTypePtr Buffer) -{ - ElementTypePtr element; - pcb_cardinal_t group; - LayerTypePtr clayer, slayer; - - if (elementlist_length(&Buffer->Data->Element) != 1) { - Message(PCB_MSG_DEFAULT, _("Error! Buffer doesn't contain a single element\n")); - return (pcb_false); - } - /* - * At this point the buffer should contain just a single element. - * Now we detach the single element from the buffer and then clear the - * buffer, ready to receive the smashed elements. As a result of detaching - * it the single element is orphaned from the buffer and thus will not be - * free()'d by FreeDataMemory (called via ClearBuffer). This leaves it - * around for us to smash bits off it. It then becomes our responsibility, - * however, to free the single element when we're finished with it. - */ - element = elementlist_first(&Buffer->Data->Element); - elementlist_remove(element); - ClearBuffer(Buffer); - ELEMENTLINE_LOOP(element); - { - CreateNewLineOnLayer(&Buffer->Data->SILKLAYER, - line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y, line->Thickness, 0, NoFlags()); - if (line) - line->Number = pcb_strdup_null(NAMEONPCB_NAME(element)); - } - END_LOOP; - ARC_LOOP(element); - { - CreateNewArcOnLayer(&Buffer->Data->SILKLAYER, - arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness, 0, NoFlags()); - } - END_LOOP; - PIN_LOOP(element); - { - FlagType f = NoFlags(); - AddFlags(f, PCB_FLAG_VIA); - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) - AddFlags(f, PCB_FLAG_HOLE); - - CreateNewVia(Buffer->Data, pin->X, pin->Y, pin->Thickness, pin->Clearance, pin->Mask, pin->DrillingHole, pin->Number, f); - } - END_LOOP; - group = GetLayerGroupNumberByNumber(SWAP_IDENT ? solder_silk_layer : component_silk_layer); - clayer = &Buffer->Data->Layer[PCB->LayerGroups.Entries[group][0]]; - group = GetLayerGroupNumberByNumber(SWAP_IDENT ? component_silk_layer : solder_silk_layer); - slayer = &Buffer->Data->Layer[PCB->LayerGroups.Entries[group][0]]; - PAD_LOOP(element); - { - LineTypePtr line; - line = CreateNewLineOnLayer(TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? slayer : clayer, - pad->Point1.X, pad->Point1.Y, - pad->Point2.X, pad->Point2.Y, pad->Thickness, pad->Clearance, NoFlags()); - if (line) - line->Number = pcb_strdup_null(pad->Number); - } - END_LOOP; - FreeElementMemory(element); - RemoveFreeElement(element); - return (pcb_true); -} - -/*--------------------------------------------------------------------------- - * - * see if a polygon is a rectangle. If so, canonicalize it. - */ - -static int polygon_is_rectangle(PolygonTypePtr poly) -{ - int i, best; - PointType temp[4]; - if (poly->PointN != 4 || poly->HoleIndexN != 0) - return 0; - best = 0; - for (i = 1; i < 4; i++) - if (poly->Points[i].X < poly->Points[best].X || poly->Points[i].Y < poly->Points[best].Y) - best = i; - for (i = 0; i < 4; i++) - temp[i] = poly->Points[(i + best) % 4]; - if (temp[0].X == temp[1].X) - memcpy(poly->Points, temp, sizeof(temp)); - else { - /* reverse them */ - poly->Points[0] = temp[0]; - poly->Points[1] = temp[3]; - poly->Points[2] = temp[2]; - poly->Points[3] = temp[1]; - } - if (poly->Points[0].X == poly->Points[1].X - && poly->Points[1].Y == poly->Points[2].Y - && poly->Points[2].X == poly->Points[3].X && poly->Points[3].Y == poly->Points[0].Y) - return 1; - return 0; -} - -/*--------------------------------------------------------------------------- - * - * convert buffer contents into an element - */ -pcb_bool ConvertBufferToElement(BufferTypePtr Buffer) -{ - ElementTypePtr Element; - pcb_cardinal_t group; - pcb_cardinal_t pin_n = 1; - pcb_bool hasParts = pcb_false, crooked = pcb_false; - int onsolder; - pcb_bool warned = pcb_false; - - if (Buffer->Data->pcb == 0) - Buffer->Data->pcb = PCB; - - Element = CreateNewElement(PCB->Data, NULL, &PCB->Font, NoFlags(), - NULL, NULL, NULL, PASTEBUFFER->X, - PASTEBUFFER->Y, 0, 100, MakeFlags(SWAP_IDENT ? PCB_FLAG_ONSOLDER : PCB_FLAG_NO), pcb_false); - if (!Element) - return (pcb_false); - VIA_LOOP(Buffer->Data); - { - char num[8]; - if (via->Mask < via->Thickness) - via->Mask = via->Thickness + 2 * MASKFRAME; - if (via->Name) - CreateNewPin(Element, via->X, via->Y, via->Thickness, - via->Clearance, via->Mask, via->DrillingHole, - NULL, via->Name, MaskFlags(via->Flags, PCB_FLAG_VIA | PCB_FLAG_FOUND | PCB_FLAG_SELECTED | PCB_FLAG_WARN)); - else { - sprintf(num, "%d", pin_n++); - CreateNewPin(Element, via->X, via->Y, via->Thickness, - via->Clearance, via->Mask, via->DrillingHole, - NULL, num, MaskFlags(via->Flags, PCB_FLAG_VIA | PCB_FLAG_FOUND | PCB_FLAG_SELECTED | PCB_FLAG_WARN)); - } - hasParts = pcb_true; - } - END_LOOP; - - for (onsolder = 0; onsolder < 2; onsolder++) { - int silk_layer; - int onsolderflag; - - if ((!onsolder) == (!SWAP_IDENT)) { - silk_layer = component_silk_layer; - onsolderflag = PCB_FLAG_NO; - } - else { - silk_layer = solder_silk_layer; - onsolderflag = PCB_FLAG_ONSOLDER; - } - -#define MAYBE_WARN() \ - if (onsolder && !hasParts && !warned) \ - { \ - warned = pcb_true; \ - Message \ - (PCB_MSG_WARNING, _("Warning: All of the pads are on the opposite\n" \ - "side from the component - that's probably not what\n" \ - "you wanted\n")); \ - } \ - - /* get the component-side SM pads */ - group = GetLayerGroupNumberByNumber(silk_layer); - GROUP_LOOP(Buffer->Data, group); - { - char num[8]; - LINE_LOOP(layer); - { - sprintf(num, "%d", pin_n++); - CreateNewPad(Element, line->Point1.X, - line->Point1.Y, line->Point2.X, - line->Point2.Y, line->Thickness, - line->Clearance, - line->Thickness + line->Clearance, NULL, line->Number ? line->Number : num, MakeFlags(onsolderflag)); - MAYBE_WARN(); - hasParts = pcb_true; - } - END_LOOP; - POLYGON_LOOP(layer); - { - Coord x1, y1, x2, y2, w, h, t; - - if (!polygon_is_rectangle(polygon)) { - crooked = pcb_true; - continue; - } - - w = polygon->Points[2].X - polygon->Points[0].X; - h = polygon->Points[1].Y - polygon->Points[0].Y; - t = (w < h) ? w : h; - x1 = polygon->Points[0].X + t / 2; - y1 = polygon->Points[0].Y + t / 2; - x2 = x1 + (w - t); - y2 = y1 + (h - t); - - sprintf(num, "%d", pin_n++); - CreateNewPad(Element, - x1, y1, x2, y2, t, - 2 * conf_core.design.clearance, t + conf_core.design.clearance, NULL, num, MakeFlags(PCB_FLAG_SQUARE | onsolderflag)); - MAYBE_WARN(); - hasParts = pcb_true; - } - END_LOOP; - } - END_LOOP; - } - - /* now add the silkscreen. NOTE: elements must have pads or pins too */ - LINE_LOOP(&Buffer->Data->SILKLAYER); - { - if (line->Number && !NAMEONPCB_NAME(Element)) - NAMEONPCB_NAME(Element) = pcb_strdup(line->Number); - CreateNewLineInElement(Element, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y, line->Thickness); - hasParts = pcb_true; - } - END_LOOP; - ARC_LOOP(&Buffer->Data->SILKLAYER); - { - CreateNewArcInElement(Element, arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness); - hasParts = pcb_true; - } - END_LOOP; - if (!hasParts) { - DestroyObject(PCB->Data, PCB_TYPE_ELEMENT, Element, Element, Element); - Message(PCB_MSG_DEFAULT, _("There was nothing to convert!\n" "Elements must have some silk, pads or pins.\n")); - return (pcb_false); - } - if (crooked) - Message(PCB_MSG_DEFAULT, _("There were polygons that can't be made into pins!\n" "So they were not included in the element\n")); - Element->MarkX = Buffer->X; - Element->MarkY = Buffer->Y; - if (SWAP_IDENT) - SET_FLAG(PCB_FLAG_ONSOLDER, Element); - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - ClearBuffer(Buffer); - MoveObjectToBuffer(Buffer->Data, PCB->Data, PCB_TYPE_ELEMENT, Element, Element, Element); - SetBufferBoundingBox(Buffer); - return (pcb_true); -} - -/* --------------------------------------------------------------------------- - * load PCB into buffer - * parse the file with enabled 'PCB mode' (see parser) - * if successful, update some other stuff - */ -pcb_bool LoadLayoutToBuffer(BufferTypePtr Buffer, const char *Filename, const char *fmt) -{ - PCBTypePtr newPCB = CreateNewPCB(); - - /* new data isn't added to the undo list */ - if (!ParsePCB(newPCB, Filename, fmt, CFR_invalid)) { - /* clear data area and replace pointer */ - ClearBuffer(Buffer); - free(Buffer->Data); - Buffer->Data = newPCB->Data; - newPCB->Data = NULL; - Buffer->X = newPCB->CursorX; - Buffer->Y = newPCB->CursorY; - RemovePCB(newPCB); - Buffer->Data->pcb = PCB; - return (pcb_true); - } - - /* release unused memory */ - RemovePCB(newPCB); - Buffer->Data->pcb = PCB; - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * rotates the contents of the pastebuffer - */ -void RotateBuffer(BufferTypePtr Buffer, pcb_uint8_t Number) -{ - /* rotate vias */ - VIA_LOOP(Buffer->Data); - { - r_delete_entry(Buffer->Data->via_tree, (BoxType *) via); - ROTATE_VIA_LOWLEVEL(via, Buffer->X, Buffer->Y, Number); - SetPinBoundingBox(via); - r_insert_entry(Buffer->Data->via_tree, (BoxType *) via, 0); - } - END_LOOP; - - /* elements */ - ELEMENT_LOOP(Buffer->Data); - { - RotateElementLowLevel(Buffer->Data, element, Buffer->X, Buffer->Y, Number); - } - END_LOOP; - - /* all layer related objects */ - ALLLINE_LOOP(Buffer->Data); - { - r_delete_entry(layer->line_tree, (BoxType *) line); - RotateLineLowLevel(line, Buffer->X, Buffer->Y, Number); - r_insert_entry(layer->line_tree, (BoxType *) line, 0); - } - ENDALL_LOOP; - ALLARC_LOOP(Buffer->Data); - { - r_delete_entry(layer->arc_tree, (BoxType *) arc); - RotateArcLowLevel(arc, Buffer->X, Buffer->Y, Number); - r_insert_entry(layer->arc_tree, (BoxType *) arc, 0); - } - ENDALL_LOOP; - ALLTEXT_LOOP(Buffer->Data); - { - r_delete_entry(layer->text_tree, (BoxType *) text); - RotateTextLowLevel(text, Buffer->X, Buffer->Y, Number); - r_insert_entry(layer->text_tree, (BoxType *) text, 0); - } - ENDALL_LOOP; - ALLPOLYGON_LOOP(Buffer->Data); - { - r_delete_entry(layer->polygon_tree, (BoxType *) polygon); - RotatePolygonLowLevel(polygon, Buffer->X, Buffer->Y, Number); - r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); - } - ENDALL_LOOP; - - /* finally the origin and the bounding box */ - ROTATE(Buffer->X, Buffer->Y, Buffer->X, Buffer->Y, Number); - RotateBoxLowLevel(&Buffer->BoundingBox, Buffer->X, Buffer->Y, Number); -} - -static void free_rotate(Coord * x, Coord * y, Coord cx, Coord cy, double cosa, double sina) -{ - double nx, ny; - Coord px = *x - cx; - Coord py = *y - cy; - - nx = px * cosa + py * sina; - ny = py * cosa - px * sina; - - *x = nx + cx; - *y = ny + cy; -} - -void -FreeRotateElementLowLevel(DataTypePtr Data, ElementTypePtr Element, Coord X, Coord Y, double cosa, double sina, Angle angle) -{ - /* solder side objects need a different orientation */ - - /* the text subroutine decides by itself if the direction - * is to be corrected - */ -#if 0 - ELEMENTTEXT_LOOP(Element); - { - if (Data && Data->name_tree[n]) - r_delete_entry(Data->name_tree[n], (BoxType *) text); - RotateTextLowLevel(text, X, Y, Number); - } - END_LOOP; -#endif - ELEMENTLINE_LOOP(Element); - { - free_rotate(&line->Point1.X, &line->Point1.Y, X, Y, cosa, sina); - free_rotate(&line->Point2.X, &line->Point2.Y, X, Y, cosa, sina); - SetLineBoundingBox(line); - } - END_LOOP; - PIN_LOOP(Element); - { - /* pre-delete the pins from the pin-tree before their coordinates change */ - if (Data) - r_delete_entry(Data->pin_tree, (BoxType *) pin); - RestoreToPolygon(Data, PCB_TYPE_PIN, Element, pin); - free_rotate(&pin->X, &pin->Y, X, Y, cosa, sina); - SetPinBoundingBox(pin); - } - END_LOOP; - PAD_LOOP(Element); - { - /* pre-delete the pads before their coordinates change */ - if (Data) - r_delete_entry(Data->pad_tree, (BoxType *) pad); - RestoreToPolygon(Data, PCB_TYPE_PAD, Element, pad); - free_rotate(&pad->Point1.X, &pad->Point1.Y, X, Y, cosa, sina); - free_rotate(&pad->Point2.X, &pad->Point2.Y, X, Y, cosa, sina); - SetLineBoundingBox((LineType *) pad); - } - END_LOOP; - ARC_LOOP(Element); - { - free_rotate(&arc->X, &arc->Y, X, Y, cosa, sina); - arc->StartAngle = NormalizeAngle(arc->StartAngle + angle); - } - END_LOOP; - - free_rotate(&Element->MarkX, &Element->MarkY, X, Y, cosa, sina); - SetElementBoundingBox(Data, Element, &PCB->Font); - ClearFromPolygon(Data, PCB_TYPE_ELEMENT, Element, Element); -} - -void FreeRotateBuffer(BufferTypePtr Buffer, Angle angle) -{ - double cosa, sina; - - cosa = cos(angle * M_PI / 180.0); - sina = sin(angle * M_PI / 180.0); - - /* rotate vias */ - VIA_LOOP(Buffer->Data); - { - r_delete_entry(Buffer->Data->via_tree, (BoxType *) via); - free_rotate(&via->X, &via->Y, Buffer->X, Buffer->Y, cosa, sina); - SetPinBoundingBox(via); - r_insert_entry(Buffer->Data->via_tree, (BoxType *) via, 0); - } - END_LOOP; - - /* elements */ - ELEMENT_LOOP(Buffer->Data); - { - FreeRotateElementLowLevel(Buffer->Data, element, Buffer->X, Buffer->Y, cosa, sina, angle); - } - END_LOOP; - - /* all layer related objects */ - ALLLINE_LOOP(Buffer->Data); - { - r_delete_entry(layer->line_tree, (BoxType *) line); - free_rotate(&line->Point1.X, &line->Point1.Y, Buffer->X, Buffer->Y, cosa, sina); - free_rotate(&line->Point2.X, &line->Point2.Y, Buffer->X, Buffer->Y, cosa, sina); - SetLineBoundingBox(line); - r_insert_entry(layer->line_tree, (BoxType *) line, 0); - } - ENDALL_LOOP; - ALLARC_LOOP(Buffer->Data); - { - r_delete_entry(layer->arc_tree, (BoxType *) arc); - free_rotate(&arc->X, &arc->Y, Buffer->X, Buffer->Y, cosa, sina); - arc->StartAngle = NormalizeAngle(arc->StartAngle + angle); - r_insert_entry(layer->arc_tree, (BoxType *) arc, 0); - } - ENDALL_LOOP; - /* FIXME: rotate text */ - ALLPOLYGON_LOOP(Buffer->Data); - { - r_delete_entry(layer->polygon_tree, (BoxType *) polygon); - POLYGONPOINT_LOOP(polygon); - { - free_rotate(&point->X, &point->Y, Buffer->X, Buffer->Y, cosa, sina); - } - END_LOOP; - SetPolygonBoundingBox(polygon); - r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); - } - ENDALL_LOOP; - - SetBufferBoundingBox(Buffer); -} - - -/* -------------------------------------------------------------------------- */ - -static const char freerotatebuffer_syntax[] = "FreeRotateBuffer([Angle])"; - -static const char freerotatebuffer_help[] = - "Rotates the current paste buffer contents by the specified angle. The\n" - "angle is given in degrees. If no angle is given, the user is prompted\n" "for one.\n"; - -/* %start-doc actions FreeRotateBuffer - -Rotates the contents of the pastebuffer by an arbitrary angle. If no -angle is given, the user is prompted for one. - -%end-doc */ - -int ActionFreeRotateBuffer(int argc, const char **argv, Coord x, Coord y) -{ - const char *angle_s; - - if (argc < 1) - angle_s = gui->prompt_for("Enter Rotation (degrees, CCW):", "0"); - else - angle_s = argv[0]; - - notify_crosshair_change(pcb_false); - FreeRotateBuffer(PASTEBUFFER, strtod(angle_s, 0)); - notify_crosshair_change(pcb_true); - return 0; -} - -/* --------------------------------------------------------------------------- - * initializes the buffers by allocating memory - */ -void InitBuffers(void) -{ - int i; - - for (i = 0; i < MAX_BUFFER; i++) - Buffers[i].Data = CreateNewBuffer(); -} - -void UninitBuffers(void) -{ - int i; - - for (i = 0; i < MAX_BUFFER; i++) { - ClearBuffer(Buffers+i); - free(Buffers[i].Data); - } -} - -void pcb_swap_buffers(void) -{ - int i; - - for (i = 0; i < MAX_BUFFER; i++) - SwapBuffer(&Buffers[i]); - SetCrosshairRangeToBuffer(); -} - -void MirrorBuffer(BufferTypePtr Buffer) -{ - int i; - - if (elementlist_length(&Buffer->Data->Element)) { - Message(PCB_MSG_DEFAULT, _("You can't mirror a buffer that has elements!\n")); - return; - } - for (i = 0; i < max_copper_layer + 2; i++) { - LayerTypePtr layer = Buffer->Data->Layer + i; - if (textlist_length(&layer->Text)) { - Message(PCB_MSG_DEFAULT, _("You can't mirror a buffer that has text!\n")); - return; - } - } - /* set buffer offset to 'mark' position */ - Buffer->X = SWAP_X(Buffer->X); - Buffer->Y = SWAP_Y(Buffer->Y); - VIA_LOOP(Buffer->Data); - { - via->X = SWAP_X(via->X); - via->Y = SWAP_Y(via->Y); - } - END_LOOP; - ALLLINE_LOOP(Buffer->Data); - { - line->Point1.X = SWAP_X(line->Point1.X); - line->Point1.Y = SWAP_Y(line->Point1.Y); - line->Point2.X = SWAP_X(line->Point2.X); - line->Point2.Y = SWAP_Y(line->Point2.Y); - } - ENDALL_LOOP; - ALLARC_LOOP(Buffer->Data); - { - arc->X = SWAP_X(arc->X); - arc->Y = SWAP_Y(arc->Y); - arc->StartAngle = SWAP_ANGLE(arc->StartAngle); - arc->Delta = SWAP_DELTA(arc->Delta); - SetArcBoundingBox(arc); - } - ENDALL_LOOP; - ALLPOLYGON_LOOP(Buffer->Data); - { - POLYGONPOINT_LOOP(polygon); - { - point->X = SWAP_X(point->X); - point->Y = SWAP_Y(point->Y); - } - END_LOOP; - SetPolygonBoundingBox(polygon); - } - ENDALL_LOOP; - SetBufferBoundingBox(Buffer); -} - - -/* --------------------------------------------------------------------------- - * flip components/tracks from one side to the other - */ -static void SwapBuffer(BufferTypePtr Buffer) -{ - int j, k; - pcb_cardinal_t sgroup, cgroup; - LayerType swap; - - ELEMENT_LOOP(Buffer->Data); - { - r_delete_element(Buffer->Data, element); - MirrorElementCoordinates(Buffer->Data, element, 0); - } - END_LOOP; - /* set buffer offset to 'mark' position */ - Buffer->X = SWAP_X(Buffer->X); - Buffer->Y = SWAP_Y(Buffer->Y); - VIA_LOOP(Buffer->Data); - { - r_delete_entry(Buffer->Data->via_tree, (BoxType *) via); - via->X = SWAP_X(via->X); - via->Y = SWAP_Y(via->Y); - SetPinBoundingBox(via); - r_insert_entry(Buffer->Data->via_tree, (BoxType *) via, 0); - } - END_LOOP; - ALLLINE_LOOP(Buffer->Data); - { - r_delete_entry(layer->line_tree, (BoxType *) line); - line->Point1.X = SWAP_X(line->Point1.X); - line->Point1.Y = SWAP_Y(line->Point1.Y); - line->Point2.X = SWAP_X(line->Point2.X); - line->Point2.Y = SWAP_Y(line->Point2.Y); - SetLineBoundingBox(line); - r_insert_entry(layer->line_tree, (BoxType *) line, 0); - } - ENDALL_LOOP; - ALLARC_LOOP(Buffer->Data); - { - r_delete_entry(layer->arc_tree, (BoxType *) arc); - arc->X = SWAP_X(arc->X); - arc->Y = SWAP_Y(arc->Y); - arc->StartAngle = SWAP_ANGLE(arc->StartAngle); - arc->Delta = SWAP_DELTA(arc->Delta); - SetArcBoundingBox(arc); - r_insert_entry(layer->arc_tree, (BoxType *) arc, 0); - } - ENDALL_LOOP; - ALLPOLYGON_LOOP(Buffer->Data); - { - r_delete_entry(layer->polygon_tree, (BoxType *) polygon); - POLYGONPOINT_LOOP(polygon); - { - point->X = SWAP_X(point->X); - point->Y = SWAP_Y(point->Y); - } - END_LOOP; - SetPolygonBoundingBox(polygon); - r_insert_entry(layer->polygon_tree, (BoxType *) polygon, 0); - /* hmmm, how to handle clip */ - } - ENDALL_LOOP; - ALLTEXT_LOOP(Buffer->Data); - { - r_delete_entry(layer->text_tree, (BoxType *) text); - text->X = SWAP_X(text->X); - text->Y = SWAP_Y(text->Y); - TOGGLE_FLAG(PCB_FLAG_ONSOLDER, text); - SetTextBoundingBox(&PCB->Font, text); - r_insert_entry(layer->text_tree, (BoxType *) text, 0); - } - ENDALL_LOOP; - /* swap silkscreen layers */ - swap = Buffer->Data->Layer[solder_silk_layer]; - Buffer->Data->Layer[solder_silk_layer] = Buffer->Data->Layer[component_silk_layer]; - Buffer->Data->Layer[component_silk_layer] = swap; - - /* swap layer groups when balanced */ - sgroup = GetLayerGroupNumberByNumber(solder_silk_layer); - cgroup = GetLayerGroupNumberByNumber(component_silk_layer); - if (PCB->LayerGroups.Number[cgroup] == PCB->LayerGroups.Number[sgroup]) { - for (j = k = 0; j < PCB->LayerGroups.Number[sgroup]; j++) { - int t1, t2; - pcb_cardinal_t cnumber = PCB->LayerGroups.Entries[cgroup][k]; - pcb_cardinal_t snumber = PCB->LayerGroups.Entries[sgroup][j]; - - if (snumber >= max_copper_layer) - continue; - swap = Buffer->Data->Layer[snumber]; - - while (cnumber >= max_copper_layer) { - k++; - cnumber = PCB->LayerGroups.Entries[cgroup][k]; - } - Buffer->Data->Layer[snumber] = Buffer->Data->Layer[cnumber]; - Buffer->Data->Layer[cnumber] = swap; - k++; - /* move the thermal flags with the layers */ - ALLPIN_LOOP(Buffer->Data); - { - t1 = TEST_THERM(snumber, pin); - t2 = TEST_THERM(cnumber, pin); - ASSIGN_THERM(snumber, t2, pin); - ASSIGN_THERM(cnumber, t1, pin); - } - ENDALL_LOOP; - VIA_LOOP(Buffer->Data); - { - t1 = TEST_THERM(snumber, via); - t2 = TEST_THERM(cnumber, via); - ASSIGN_THERM(snumber, t2, via); - ASSIGN_THERM(cnumber, t1, via); - } - END_LOOP; - } - } - SetBufferBoundingBox(Buffer); -} - -/* ---------------------------------------------------------------------- - * moves the passed object to the passed buffer and removes it - * from its original place - */ -void *MoveObjectToBuffer(DataTypePtr Destination, DataTypePtr Src, int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - /* setup local identifiers used by move operations */ - Dest = Destination; - Source = Src; - return (ObjectOperation(&MoveBufferFunctions, Type, Ptr1, Ptr2, Ptr3)); -} - -/* ---------------------------------------------------------------------- - * Adds the passed object to the passed buffer - */ -void *CopyObjectToBuffer(DataTypePtr Destination, DataTypePtr Src, int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - /* setup local identifiers used by Add operations */ - Dest = Destination; - Source = Src; - return (ObjectOperation(&AddBufferFunctions, Type, Ptr1, Ptr2, Ptr3)); -} - -/* ---------------------------------------------------------------------- */ - -static const char pastebuffer_syntax[] = - "PasteBuffer(AddSelected|Clear|1..MAX_BUFFER)\n" - "PasteBuffer(Rotate, 1..3)\n" "PasteBuffer(Convert|Restore|Mirror)\n" "PasteBuffer(ToLayout, X, Y, units)\n" "PasteBuffer(Save, Filename, [format], [force])"; - -static const char pastebuffer_help[] = "Various operations on the paste buffer."; - -/* %start-doc actions PasteBuffer - -There are a number of paste buffers; the actual limit is a -compile-time constant @code{MAX_BUFFER} in @file{globalconst.h}. It -is currently @code{5}. One of these is the ``current'' paste buffer, -often referred to as ``the'' paste buffer. - -@table @code - -@item AddSelected -Copies the selected objects to the current paste buffer. - -@item Clear -Remove all objects from the current paste buffer. - -@item Convert -Convert the current paste buffer to an element. Vias are converted to -pins, lines are converted to pads. - -@item Restore -Convert any elements in the paste buffer back to vias and lines. - -@item Mirror -Flip all objects in the paste buffer vertically (up/down flip). To mirror -horizontally, combine this with rotations. - -@item Rotate -Rotates the current buffer. The number to pass is 1..3, where 1 means -90 degrees counter clockwise, 2 means 180 degrees, and 3 means 90 -degrees clockwise (270 CCW). - -@item Save -Saves any elements in the current buffer to the indicated file. If -format is specified, try to use that file format, else use the default. -If force is specified, overwrite target, don't ask. - -@item ToLayout -Pastes any elements in the current buffer to the indicated X, Y -coordinates in the layout. The @code{X} and @code{Y} are treated like -@code{delta} is for many other objects. For each, if it's prefixed by -@code{+} or @code{-}, then that amount is relative to the last -location. Otherwise, it's absolute. Units can be -@code{mil} or @code{mm}; if unspecified, units are PCB's internal -units, currently 1/100 mil. - - -@item 1..MAX_BUFFER -Selects the given buffer to be the current paste buffer. - -@end table - -%end-doc */ - -static int ActionPasteBuffer(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = argc ? argv[0] : ""; - const char *sbufnum = argc > 1 ? argv[1] : ""; - const char *fmt = argc > 2 ? argv[2] : NULL; - const char *forces = argc > 3 ? argv[3] : NULL; - const char *name; - static char *default_file = NULL; - pcb_bool free_name = pcb_false; - int force = (forces != NULL) && ((*forces == '1') || (*forces == 'y') || (*forces == 'Y')); - - notify_crosshair_change(pcb_false); - if (function) { - switch (funchash_get(function, NULL)) { - /* clear contents of paste buffer */ - case F_Clear: - ClearBuffer(PASTEBUFFER); - break; - - /* copies objects to paste buffer */ - case F_AddSelected: - AddSelectedToBuffer(PASTEBUFFER, 0, 0, pcb_false); - break; - - /* converts buffer contents into an element */ - case F_Convert: - ConvertBufferToElement(PASTEBUFFER); - break; - - /* break up element for editing */ - case F_Restore: - SmashBufferElement(PASTEBUFFER); - break; - - /* Mirror buffer */ - case F_Mirror: - MirrorBuffer(PASTEBUFFER); - break; - - case F_Rotate: - if (sbufnum) { - RotateBuffer(PASTEBUFFER, (pcb_uint8_t) atoi(sbufnum)); - SetCrosshairRangeToBuffer(); - } - break; - - case F_Save: - if (elementlist_length(&PASTEBUFFER->Data->Element) == 0) { - Message(PCB_MSG_DEFAULT, _("Buffer has no elements!\n")); - break; - } - free_name = pcb_false; - if (argc <= 1) { - name = gui->fileselect(_("Save Paste Buffer As ..."), - _("Choose a file to save the contents of the\n" - "paste buffer to.\n"), default_file, ".fp", "footprint", 0); - - if (default_file) { - free(default_file); - default_file = NULL; - } - if (name && *name) { - default_file = pcb_strdup(name); - } - free_name = pcb_true; - } - - else - name = argv[1]; - - { - FILE *exist; - - if ((!force) && ((exist = fopen(name, "r")))) { - fclose(exist); - if (gui->confirm_dialog(_("File exists! Ok to overwrite?"), 0)) - SaveBufferElements(name, fmt); - } - else - SaveBufferElements(name, fmt); - - if (free_name && name) - free((char*)name); - } - break; - - case F_ToLayout: - { - static Coord oldx = 0, oldy = 0; - Coord x, y; - pcb_bool absolute; - - if (argc == 1) { - x = y = 0; - } - else if (argc == 3 || argc == 4) { - x = GetValue(ACTION_ARG(1), ACTION_ARG(3), &absolute, NULL); - if (!absolute) - x += oldx; - y = GetValue(ACTION_ARG(2), ACTION_ARG(3), &absolute, NULL); - if (!absolute) - y += oldy; - } - else { - notify_crosshair_change(pcb_true); - AFAIL(pastebuffer); - } - - oldx = x; - oldy = y; - if (CopyPastebufferToLayout(x, y)) - SetChangedFlag(pcb_true); - } - break; - - /* set number */ - default: - { - int number = atoi(function); - - /* correct number */ - if (number) - SetBufferNumber(number - 1); - } - } - } - - notify_crosshair_change(pcb_true); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -HID_Action buffer_action_list[] = { - {"FreeRotateBuffer", 0, ActionFreeRotateBuffer, - freerotatebuffer_help, freerotatebuffer_syntax} - , - {"LoadFootprint", 0, LoadFootprint, - loadfootprint_help, loadfootprint_syntax} - , - {"PasteBuffer", 0, ActionPasteBuffer, - pastebuffer_help, pastebuffer_syntax} -}; - -REGISTER_ACTIONS(buffer_action_list, NULL) Index: 1.1.4/src/hid_attrib.c =================================================================== --- 1.1.4/src/hid_attrib.c (revision 10776) +++ 1.1.4/src/hid_attrib.c (nonexistent) @@ -1,226 +0,0 @@ -#include "config.h" -#include "global.h" -#include "hid_attrib.h" -#include "misc.h" -#include "misc_util.h" -#include "pcb-printf.h" -#include "compat_fs.h" -#include "error.h" - -HID_AttrNode *hid_attr_nodes = 0; - -void hid_register_attributes(HID_Attribute * a, int n, const char *cookie, int copy) -{ - HID_AttrNode *ha; - - /* printf("%d attributes registered\n", n); */ - ha = (HID_AttrNode *) malloc(sizeof(HID_AttrNode)); - ha->next = hid_attr_nodes; - hid_attr_nodes = ha; - ha->attributes = a; - ha->n = n; - ha->cookie = cookie; -} - -void hid_attributes_uninit(void) -{ - HID_AttrNode *ha, *next; - for (ha = hid_attr_nodes; ha; ha = next) { - next = ha->next; - if (ha->cookie != NULL) - fprintf(stderr, "WARNING: attribute %s by %s is not uninited, check your plugins' uninit!\n", ha->attributes->name, ha->cookie); - free(ha); - } - hid_attr_nodes = NULL; -} - -void hid_remove_attributes_by_cookie(const char *cookie) -{ - HID_AttrNode *ha, *next, *prev = NULL; - for (ha = hid_attr_nodes; ha; ha = next) { - next = ha->next; - if (ha->cookie == cookie) { - if (prev == NULL) - hid_attr_nodes = next; - else - prev->next = next; - free(ha); - } - else - prev = ha; - } -} - -void hid_parse_command_line(int *argc, char ***argv) -{ - HID_AttrNode *ha; - int i, e, ok; - - for (ha = hid_attr_nodes; ha; ha = ha->next) - for (i = 0; i < ha->n; i++) { - HID_Attribute *a = ha->attributes + i; - switch (a->type) { - case HID_Label: - break; - case HID_Integer: - if (a->value) - *(int *) a->value = a->default_val.int_value; - break; - case HID_Coord: - if (a->value) - *(Coord *) a->value = a->default_val.coord_value; - break; - case HID_Boolean: - if (a->value) - *(char *) a->value = a->default_val.int_value; - break; - case HID_Real: - if (a->value) - *(double *) a->value = a->default_val.real_value; - break; - case HID_String: - if (a->value) - *(const char **) a->value = a->default_val.str_value; - break; - case HID_Enum: - if (a->value) - *(int *) a->value = a->default_val.int_value; - break; - case HID_Mixed: - if (a->value) { - *(HID_Attr_Val *) a->value = a->default_val; - case HID_Unit: - if (a->value) - *(int *) a->value = a->default_val.int_value; - break; - } - break; - default: - abort(); - } - } - - while (*argc && (*argv)[0][0] == '-' && (*argv)[0][1] == '-') { - int bool_val; - int arg_ofs; - - bool_val = 1; - arg_ofs = 2; - try_no_arg: - for (ha = hid_attr_nodes; ha; ha = ha->next) - for (i = 0; i < ha->n; i++) - if (strcmp((*argv)[0] + arg_ofs, ha->attributes[i].name) == 0) { - HID_Attribute *a = ha->attributes + i; - char *ep; - const Unit *unit; - switch (ha->attributes[i].type) { - case HID_Label: - break; - case HID_Integer: - if (a->value) - *(int *) a->value = strtol((*argv)[1], 0, 0); - else - a->default_val.int_value = strtol((*argv)[1], 0, 0); - (*argc)--; - (*argv)++; - break; - case HID_Coord: - if (a->value) - *(Coord *) a->value = GetValue((*argv)[1], NULL, NULL, NULL); - else - a->default_val.coord_value = GetValue((*argv)[1], NULL, NULL, NULL); - (*argc)--; - (*argv)++; - break; - case HID_Real: - if (a->value) - *(double *) a->value = strtod((*argv)[1], 0); - else - a->default_val.real_value = strtod((*argv)[1], 0); - (*argc)--; - (*argv)++; - break; - case HID_String: - if (a->value) - *(char **) a->value = (*argv)[1]; - else - a->default_val.str_value = (*argv)[1]; - (*argc)--; - (*argv)++; - break; - case HID_Boolean: - if (a->value) - *(char *) a->value = bool_val; - else - a->default_val.int_value = bool_val; - break; - case HID_Mixed: - a->default_val.real_value = strtod((*argv)[1], &ep); - goto do_enum; - case HID_Enum: - ep = (*argv)[1]; - do_enum: - ok = 0; - for (e = 0; a->enumerations[e]; e++) - if (strcmp(a->enumerations[e], ep) == 0) { - ok = 1; - a->default_val.int_value = e; - a->default_val.str_value = ep; - break; - } - if (!ok) { - fprintf(stderr, "ERROR: \"%s\" is an unknown value for the --%s option\n", (*argv)[1], a->name); - exit(1); - } - (*argc)--; - (*argv)++; - break; - case HID_Path: - abort(); - a->default_val.str_value = (*argv)[1]; - (*argc)--; - (*argv)++; - break; - case HID_Unit: - unit = get_unit_struct((*argv)[1]); - if (unit == NULL) { - fprintf(stderr, "ERROR: unit \"%s\" is unknown to pcb (option --%s)\n", (*argv)[1], a->name); - exit(1); - } - a->default_val.int_value = unit->index; - a->default_val.str_value = unit->suffix; - (*argc)--; - (*argv)++; - break; - } - (*argc)--; - (*argv)++; - ha = 0; - goto got_match; - } - if (bool_val == 1 && strncmp((*argv)[0], "--no-", 5) == 0) { - bool_val = 0; - arg_ofs = 5; - goto try_no_arg; - } - fprintf(stderr, "unrecognized option: %s\n", (*argv)[0]); - exit(1); - got_match:; - } -} - -void hid_usage_option(const char *name, const char *help) -{ - fprintf(stderr, "%-20s %s\n", name, help); -} - -void hid_usage(HID_Attribute * a, int numa) -{ - for (; numa > 0; numa--,a++) { - const char *help; - if (a->help_text == NULL) help = ""; - else if (a->help_text == ATTR_UNDOCUMENTED) help = ""; - else help = a->help_text; - hid_usage_option(a->name, help); - } -} Index: 1.1.4/src/insert.h =================================================================== --- 1.1.4/src/insert.h (revision 10776) +++ 1.1.4/src/insert.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for inserting points into objects */ - -#ifndef PCB_INSERT_H -#define PCB_INSERT_H - -#include "global.h" - -#define INSERT_TYPES (PCB_TYPE_POLYGON | PCB_TYPE_LINE | PCB_TYPE_RATLINE) - -/* --------------------------------------------------------------------------- - * prototypes - */ -void *InsertPointIntoObject(int, void *, void *, pcb_cardinal_t *, Coord, Coord, pcb_bool, pcb_bool); -PointTypePtr AdjustInsertPoint(void); - -#endif Index: 1.1.4/src/conf_hid.c =================================================================== --- 1.1.4/src/conf_hid.c (revision 10776) +++ 1.1.4/src/conf_hid.c (nonexistent) @@ -1,137 +0,0 @@ -#include "conf_hid.h" -#include -#include -#include "error.h" -#include "conf_core.h" - -typedef struct { - const conf_hid_callbacks_t *cb; - conf_hid_id_t id; -} conf_hid_t; - -void *conf_hid_set_data(conf_native_t *cfg, conf_hid_id_t id, void *data) -{ - void **old = vtp0_get(&cfg->hid_data, id, 0); - vtp0_set(&cfg->hid_data, id, data); - return old == NULL ? NULL : *old; -} - -void *conf_hid_get_data(conf_native_t *cfg, conf_hid_id_t id) -{ - void **old = vtp0_get(&cfg->hid_data, id, 0); - return old == NULL ? NULL : *old; -} - -const conf_hid_callbacks_t *conf_hid_set_cb(conf_native_t *cfg, conf_hid_id_t id, const conf_hid_callbacks_t *cbs) -{ - void **old = vtp0_get(&cfg->hid_callbacks, id, 0); - vtp0_set(&cfg->hid_callbacks, id, (void *)cbs); - return (const conf_hid_callbacks_t *)(old == NULL ? NULL : *old); -} - - -static int conf_hid_id_next = 0; -static htpp_t *conf_hid_ids = NULL; - -static void conf_hid_init(void) -{ - if (conf_hid_ids == NULL) - conf_hid_ids = htpp_alloc(ptrhash, ptrkeyeq); -} - -void conf_hid_uninit(void) -{ - if (conf_hid_ids != NULL) { - htpp_free(conf_hid_ids); - conf_hid_ids = NULL; - } -} - -conf_hid_id_t conf_hid_reg(const char *cookie, const conf_hid_callbacks_t *cb) -{ - conf_hid_t *h; - - if (cookie == NULL) - return -1; - - conf_hid_init(); - if (htpp_getentry(conf_hid_ids, (void *)cookie) != NULL) - return -1; /* already registered */ - - h = malloc(sizeof(conf_hid_t)); - h->cb = cb; - h->id = conf_hid_id_next++; - htpp_set(conf_hid_ids, (void *)cookie, h); - return h->id; -} - -void conf_hid_unreg(const char *cookie) -{ - htsp_entry_t *e; - conf_hid_t *h = htpp_pop(conf_hid_ids, (void *)cookie); - - if (h == NULL) - return; - - /* remove local callbacks */ - conf_fields_foreach(e) { - int len; - conf_native_t *cfg = e->value; - len = vtp0_len(&cfg->hid_callbacks); - - conf_hid_local_cb(cfg, unreg_item); - - /* truncate the list if there are empty items at the end */ - if (len > h->id) { - int last; - cfg->hid_callbacks.array[h->id] = NULL; - for(last = len-1; last >= 0; last--) - if (cfg->hid_callbacks.array[last] != NULL) - break; - if (last < len) - vtp0_truncate(&cfg->hid_callbacks, last+1); - } - } - - if ((h->cb != NULL) && (h->cb->unreg_item != NULL)) { - conf_fields_foreach(e) { - conf_native_t *cfg = e->value; - h->cb->unreg_item(cfg); - } - } - - free(h); -} - -typedef void (*cb_t)(conf_native_t *cfg); -void conf_hid_global_cb_(conf_native_t *item, int offs) -{ - htpp_entry_t *e; - if (conf_hid_ids == NULL) - return; - for (e = htpp_first(conf_hid_ids); e; e = htpp_next(conf_hid_ids, e)) { - conf_hid_t *h = e->value; - const conf_hid_callbacks_t *cbs = h->cb; - if (cbs != NULL) { - char *s = (char *)&cbs->val_change_pre; - cb_t *cb = (cb_t *)(s + offs); - if ((*cb) != NULL) - (*cb)(item); - } - } -} - - -void conf_loglevel_props(enum pcb_message_level level, const char **tag, int *popup) -{ - *tag = NULL; - *popup = 0; - switch(level) { - case PCB_MSG_DEBUG: *tag = conf_core.appearance.loglevels.debug_tag; *popup = conf_core.appearance.loglevels.debug_popup; break; - case PCB_MSG_INFO: *tag = conf_core.appearance.loglevels.info_tag; *popup = conf_core.appearance.loglevels.info_popup; break; - case PCB_MSG_WARNING: *tag = conf_core.appearance.loglevels.warning_tag; *popup = conf_core.appearance.loglevels.warning_popup; break; - case PCB_MSG_ERROR: *tag = conf_core.appearance.loglevels.error_tag; *popup = conf_core.appearance.loglevels.error_popup; break; - break; - } -} - Index: 1.1.4/src/undo.h =================================================================== --- 1.1.4/src/undo.h (revision 10776) +++ 1.1.4/src/undo.h (nonexistent) @@ -1,76 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for undo routines */ - -#ifndef PCB_UNDO_H -#define PCB_UNDO_H - -#include "global.h" - -#define DRAW_FLAGS (PCB_FLAG_RAT | PCB_FLAG_SELECTED \ - | PCB_FLAG_HIDENAME | PCB_FLAG_HOLE | PCB_FLAG_OCTAGON | PCB_FLAG_FOUND | PCB_FLAG_CLEARLINE) - - /* different layers */ - -int Undo(pcb_bool); -int Redo(pcb_bool); -void IncrementUndoSerialNumber(void); -void SaveUndoSerialNumber(void); -void RestoreUndoSerialNumber(void); -void ClearUndoList(pcb_bool); -void MoveObjectToRemoveUndoList(int, void *, void *, void *); -void AddObjectToRemovePointUndoList(int, void *, void *, pcb_cardinal_t); -void AddObjectToInsertPointUndoList(int, void *, void *, void *); -void AddObjectToRemoveContourUndoList(int, LayerType *, PolygonType *); -void AddObjectToInsertContourUndoList(int, LayerType *, PolygonType *); -void AddObjectToMoveUndoList(int, void *, void *, void *, Coord, Coord); -void AddObjectToChangeNameUndoList(int, void *, void *, void *, char *); -void AddObjectToChangePinnumUndoList(int, void *, void *, void *, char *); -void AddObjectToRotateUndoList(int, void *, void *, void *, Coord, Coord, pcb_uint8_t); -void AddObjectToCreateUndoList(int, void *, void *, void *); -void AddObjectToMirrorUndoList(int, void *, void *, void *, Coord); -void AddObjectToMoveToLayerUndoList(int, void *, void *, void *); -void AddObjectToFlagUndoList(int, void *, void *, void *); -void AddObjectToSizeUndoList(int, void *, void *, void *); -void AddObjectTo2ndSizeUndoList(int, void *, void *, void *); -void AddObjectToClearSizeUndoList(int, void *, void *, void *); -void AddObjectToMaskSizeUndoList(int, void *, void *, void *); -void AddObjectToChangeAnglesUndoList(int, void *, void *, void *); -void AddObjectToChangeRadiiUndoList(int, void *, void *, void *); -void AddObjectToClearPolyUndoList(int, void *, void *, void *, pcb_bool); -void AddLayerChangeToUndoList(int, int); -void AddNetlistLibToUndoList(LibraryTypePtr); -void LockUndo(void); -void UnlockUndo(void); -pcb_bool Undoing(void); - -/* Publish actions - these may be useful for other actions */ -int ActionUndo(int argc, const char **argv, Coord x, Coord y); -int ActionRedo(int argc, const char **argv, Coord x, Coord y); -int ActionAtomic(int argc, const char **argv, Coord x, Coord y); - -#endif Index: 1.1.4/src/mirror.c =================================================================== --- 1.1.4/src/mirror.c (revision 10776) +++ 1.1.4/src/mirror.c (nonexistent) @@ -1,98 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* functions used to change the mirror flag of an object - * - * an undo operation is not implemented because it's easy to - * recover an object - */ - -#include "config.h" - -#include - -#include "data.h" -#include "mirror.h" -#include "misc.h" -#include "polygon.h" - -/* --------------------------------------------------------------------------- - * mirrors the coordinates of an element - * an additional offset is passed - */ -void MirrorElementCoordinates(DataTypePtr Data, ElementTypePtr Element, Coord yoff) -{ - r_delete_element(Data, Element); - ELEMENTLINE_LOOP(Element); - { - line->Point1.X = SWAP_X(line->Point1.X); - line->Point1.Y = SWAP_Y(line->Point1.Y) + yoff; - line->Point2.X = SWAP_X(line->Point2.X); - line->Point2.Y = SWAP_Y(line->Point2.Y) + yoff; - } - END_LOOP; - PIN_LOOP(Element); - { - RestoreToPolygon(Data, PCB_TYPE_PIN, Element, pin); - pin->X = SWAP_X(pin->X); - pin->Y = SWAP_Y(pin->Y) + yoff; - } - END_LOOP; - PAD_LOOP(Element); - { - RestoreToPolygon(Data, PCB_TYPE_PAD, Element, pad); - pad->Point1.X = SWAP_X(pad->Point1.X); - pad->Point1.Y = SWAP_Y(pad->Point1.Y) + yoff; - pad->Point2.X = SWAP_X(pad->Point2.X); - pad->Point2.Y = SWAP_Y(pad->Point2.Y) + yoff; - TOGGLE_FLAG(PCB_FLAG_ONSOLDER, pad); - } - END_LOOP; - ARC_LOOP(Element); - { - arc->X = SWAP_X(arc->X); - arc->Y = SWAP_Y(arc->Y) + yoff; - arc->StartAngle = SWAP_ANGLE(arc->StartAngle); - arc->Delta = SWAP_DELTA(arc->Delta); - } - END_LOOP; - ELEMENTTEXT_LOOP(Element); - { - text->X = SWAP_X(text->X); - text->Y = SWAP_Y(text->Y) + yoff; - TOGGLE_FLAG(PCB_FLAG_ONSOLDER, text); - } - END_LOOP; - Element->MarkX = SWAP_X(Element->MarkX); - Element->MarkY = SWAP_Y(Element->MarkY) + yoff; - - /* now toggle the solder-side flag */ - TOGGLE_FLAG(PCB_FLAG_ONSOLDER, Element); - /* this inserts all of the rtree data too */ - SetElementBoundingBox(Data, Element, &PCB->Font); - ClearFromPolygon(Data, PCB_TYPE_ELEMENT, Element, Element); -} Index: 1.1.4/src/draw_fab.h =================================================================== --- 1.1.4/src/draw_fab.h (revision 10776) +++ 1.1.4/src/draw_fab.h (nonexistent) @@ -1,39 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for printing routines */ - -#ifndef PCB_PRINT_H -#define PCB_PRINT_H - -#include - -#include "global.h" - -int DrawFab_overhang(void); -void DrawFab(hidGC gc); - -#endif Index: 1.1.4/src/compat_fs.c =================================================================== --- 1.1.4/src/compat_fs.c (revision 10776) +++ 1.1.4/src/compat_fs.c (nonexistent) @@ -1,303 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2004,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* misc functions used by several modules */ - -#include "config.h" - -#include "compat_inc.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "compat_fs.h" -#include "compat_misc.h" - -#include - -#include "global.h" - -#include "error.h" -#include "mymem.h" - -/* ---------------------------------------------------------------------- - * returns pointer to current working directory. If 'path' is not - * NULL, then the current working directory is copied to the array - * pointed to by 'path' - */ -char *GetWorkingDirectory(char *path) -{ -#if defined(HAVE_GETCWD) - return getcwd(path, MAXPATHLEN); -#elif defined(HAVE__GETCWD) - return _getcwd(path, MAXPATHLEN); -#else - /* seems that some BSD releases lack of a prototype for getwd() */ - return getwd(path); -#endif -} - -#if defined(USE_MKDIR) -# define MKDIR mkdir -#elif defined(USE__MKDIR) -# define MKDIR _mkdir -#else -# error no mkdir() available -#endif -int pcb_mkdir(const char *path, int mode) -{ -#if MKDIR_NUM_ARGS == 1 - return MKDIR(path); -#elif MKDIR_NUM_ARGS == 2 - return MKDIR(path, mode); -#else -# error invalid number of arguments for mkdir -#endif -} -#undef MKDIR - -int pcb_file_readable(const char *path) -{ - FILE *f; - f = fopen(path, "r"); - if (f != NULL) { - fclose(f); - return 1; - } - return 0; -} - -int pcb_spawnvp(const char **argv) -{ -#if defined(USE_SPAWNVP) - int result = _spawnvp(_P_WAIT, argv[0], (const char *const *) argv); - if (result == -1) - return 1; - else - return 0; -#elif defined(USE_FORK_WAIT) - int pid; - pid = fork(); - if (pid < 0) { - /* error */ - Message(PCB_MSG_DEFAULT, _("Cannot fork!")); - return 1; - } - else if (pid == 0) { - /* Child */ - execvp(argv[0], (char* const*) argv); - exit(1); - } - else { - int rv; - /* Parent */ - wait(&rv); - } - return 0; -#else -# error Do not know how to run a background process. -#endif -} - - -/* - * Creates a new temporary file name. Hopefully the operating system - * provides a mkdtemp() function to securely create a temporary - * directory with mode 0700. If so then that directory is created and - * the returned string is made up of the directory plus the name - * variable. For example: - * - * tempfile_name_new ("myfile") might return - * "/var/tmp/pcb.123456/myfile". - * - * If mkdtemp() is not available then 'name' is ignored and the - * insecure tmpnam() function is used. - * - * Files/names created with tempfile_name_new() should be unlinked - * with tempfile_unlink to make sure the temporary directory is also - * removed when mkdtemp() is used. - */ -char *tempfile_name_new(const char *name) -{ - char *tmpfile = NULL; -#ifdef HAVE_MKDTEMP -#ifdef inline - /* Suppress compiler warnings; -Dinline means we are compiling in - --debug with -ansi -pedantic; we do know that mkdtemp exists on the system, - since HAVE_MKDTEMP is set. */ - char *mkdtemp(char *template); -#endif - const char *tmpdir; - char *mytmpdir; - size_t len; -#endif - - assert(name != NULL); - -#ifdef HAVE_MKDTEMP -#define TEMPLATE "pcb.XXXXXXXX" - - - tmpdir = getenv("TMPDIR"); - - /* FIXME -- what about win32? */ - if (tmpdir == NULL) { - tmpdir = "/tmp"; - } - - mytmpdir = (char *) malloc(sizeof(char) * (strlen(tmpdir) + 1 + strlen(TEMPLATE) + 1)); - if (mytmpdir == NULL) { - fprintf(stderr, "tempfile_name_new(): malloc failed()\n"); - exit(1); - } - - *mytmpdir = '\0'; - (void) strcat(mytmpdir, tmpdir); - (void) strcat(mytmpdir, PCB_DIR_SEPARATOR_S); - (void) strcat(mytmpdir, TEMPLATE); - if (mkdtemp(mytmpdir) == NULL) { - fprintf(stderr, "pcb_spawnvp(): mkdtemp (\"%s\") failed\n", mytmpdir); - free(mytmpdir); - return NULL; - } - - - len = strlen(mytmpdir) + /* the temp directory name */ - 1 + /* the directory sep. */ - strlen(name) + /* the file name */ - 1 /* the \0 termination */ - ; - - tmpfile = (char *) malloc(sizeof(char) * len); - - *tmpfile = '\0'; - (void) strcat(tmpfile, mytmpdir); - (void) strcat(tmpfile, PCB_DIR_SEPARATOR_S); - (void) strcat(tmpfile, name); - - free(mytmpdir); -#undef TEMPLATE -#else - /* - * tmpnam() uses a static buffer so pcb_strdup() the result right away - * in case someone decides to create multiple temp names. - */ - tmpfile = pcb_strdup(tmpnam(NULL)); -#ifdef __WIN32__ - { - /* Guile doesn't like \ separators */ - char *c; - for (c = tmpfile; *c; c++) - if (*c == '\\') - *c = '/'; - } -#endif -#endif - - return tmpfile; -} - -/* - * Unlink a temporary file. If we have mkdtemp() then our temp file - * lives in a temporary directory and we need to remove that directory - * too. - */ -int tempfile_unlink(char *name) -{ -#ifdef DEBUG - /* SDB says: Want to keep old temp files for examination when debugging */ - return 0; -#endif - -#ifdef HAVE_MKDTEMP - int e, rc2 = 0; - char *dname; - - unlink(name); - /* it is possible that the file was never created so it is OK if the - unlink fails */ - - /* now figure out the directory name to remove */ - e = strlen(name) - 1; - while (e > 0 && name[e] != PCB_DIR_SEPARATOR_C) { - e--; - } - - dname = pcb_strdup(name); - dname[e] = '\0'; - - /* - * at this point, e *should* point to the end of the directory part - * but lets make sure. - */ - if (e > 0) { - rc2 = rmdir(dname); - if (rc2 != 0) { - perror(dname); - } - - } - else { - fprintf(stderr, _("tempfile_unlink(): Unable to determine temp directory name from the temp file\n")); - fprintf(stderr, "tempfile_unlink(): \"%s\"\n", name); - rc2 = -1; - } - - /* name was allocated with malloc */ - free(dname); - free(name); - - /* - * FIXME - should also return -1 if the temp file exists and was not - * removed. - */ - if (rc2 != 0) { - return -1; - } - -#else - int rc = unlink(name); - - if (rc != 0) { - fprintf(stderr, _("Failed to unlink \"%s\"\n"), name); - free(name); - return rc; - } - free(name); - -#endif - - return 0; -} Index: 1.1.4/src/plug_footprint.c =================================================================== --- 1.1.4/src/plug_footprint.c (revision 10776) +++ 1.1.4/src/plug_footprint.c (nonexistent) @@ -1,405 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -#include "config.h" - -#include "plug_footprint.h" -#include "plugins.h" - -#include -#include -#include "conf_core.h" -#include "plugins.h" -#include "error.h" -#include "compat_misc.h" - -plug_fp_t *plug_fp_chain = NULL; -library_t library; - -int fp_dupname(const char *name, char **basename, char **params) -{ - char *newname, *s; - - *basename = newname = pcb_strdup(name); - s = strchr(newname, '('); - if (s == NULL) { - *params = NULL; - return 0; - } - - /* split at '(' */ - *s = '\0'; - *params = s + 1; - s = *params + strlen(*params) - 1; - - /* strip ')' */ - if (*s == ')') - *s = '\0'; - - return 1; -} - -static htsp_t *fp_tags = NULL; - -const void *fp_tag(const char *tag, int alloc) -{ - htsp_entry_t *e; - static char *counter = NULL; - - if (fp_tags == NULL) - fp_tags = htsp_alloc(strhash, strkeyeq); - e = htsp_getentry(fp_tags, tag); - if ((e == NULL) && alloc) { - htsp_set(fp_tags, pcb_strdup(tag), (void *) counter); - counter++; - e = htsp_getentry(fp_tags, tag); - } - return e == NULL ? NULL : e->key; -} - -void fp_init() -{ - library.type = LIB_DIR; - library.name = pcb_strdup("/"); /* All names are eventually free()'d */ -} - -void fp_uninit() -{ - htsp_entry_t *e; - fp_free_children(&library); - if (fp_tags != NULL) { - for (e = htsp_first(fp_tags); e; e = htsp_next(fp_tags, e)) - free(e->key); - htsp_free(fp_tags); - fp_tags = NULL; - } -} - -const char *fp_tagname(const void *tagid) -{ - return (char *) tagid; -} - -FILE *fp_fopen(const char *path, const char *name, fp_fopen_ctx_t *fctx) -{ - FILE *res = NULL; - HOOK_CALL(plug_fp_t, plug_fp_chain, fopen, res, != NULL, (self, path, name, fctx)); - return res; -} - -void fp_fclose(FILE * f, fp_fopen_ctx_t *fctx) -{ - if (fctx->backend->fclose != NULL) - fctx->backend->fclose(fctx->backend, f, fctx); -} - -library_t *fp_append_entry(library_t *parent, const char *name, fp_type_t type, void *tags[]) -{ - library_t *entry; /* Pointer to individual menu entry */ - - assert(parent->type == LIB_DIR); - entry = get_library_memory(parent); - if (entry == NULL) - return NULL; - - if (type == PCB_FP_PARAMETRIC) { - /* concat name and () */ - /* do not use pcb_strdup_printf or Concat here, do not increase gsch2pcb-rnd deps */ - int nl = strlen(name); - entry->name = malloc(nl+3); - memcpy(entry->name, name, nl); - strcpy(entry->name+nl, "()"); - } - else - entry->name = pcb_strdup(name); - - entry->type = LIB_FOOTPRINT; - entry->data.fp.type = type; - entry->data.fp.tags = tags; - entry->data.fp.loc_info = NULL; - entry->data.fp.backend_data = NULL; - return entry; -} - -library_t *fp_lib_search_len(library_t *dir, const char *name, int name_len) -{ - library_t *l; - int n; - - if (dir->type != LIB_DIR) - return NULL; - - for(n = 0, l = dir->data.dir.children.array; n < dir->data.dir.children.used; n++, l++) - if (strncmp(l->name, name, name_len) == 0) - return l; - - return NULL; -} - -library_t *fp_lib_search(library_t *dir, const char *name) -{ - library_t *l; - int n; - - if (dir->type != LIB_DIR) - return NULL; - - for(n = 0, l = dir->data.dir.children.array; n < dir->data.dir.children.used; n++, l++) - if (strcmp(l->name, name) == 0) - return l; - - return NULL; -} - - -library_t *fp_mkdir_len(library_t *parent, const char *name, int name_len) -{ - library_t *l = get_library_memory(parent); - - if (name_len > 0) - l->name = pcb_strndup(name, name_len); - else - l->name = pcb_strdup(name); - l->parent = parent; - l->type = LIB_DIR; - vtlib_init(&l->data.dir.children); - return l; -} - -library_t *fp_mkdir_p(const char *path) -{ - library_t *l, *parent = NULL; - const char *next; - - /* search for the last existing dir in the path */ - - while(*path == '/') path++; - for(parent = l = &library; l != NULL; parent = l,path = next) { - next = strchr(path, '/'); - if (next == NULL) - l = fp_lib_search(l, path); - else - l = fp_lib_search_len(l, path, next-path); - - /* skip path sep */ - if (next != NULL) { - while(*next == '/') next++; - if (*next == '\0') - next = NULL; - } - - /* last elem of the path */ - if (next == NULL) { - if (l != NULL) - return l; - break; /* found a non-existing node */ - } - - if (l == NULL) - break; - } - - /* by now path points to the first non-existing dir, under parent */ - for(;path != NULL; path = next) { - next = strchr(path, '/'); - parent = fp_mkdir_len(parent, path, next-path); - if (next != NULL) { - while(*next == '/') next++; - if (*next == '\0') - next = NULL; - } - } - - return parent; -} - -void fp_sort_children(library_t *parent) -{ -/* int i; - qsort(lib->Menu, lib->MenuN, sizeof(lib->Menu[0]), netlist_sort); - for (i = 0; i < lib->MenuN; i++) - qsort(lib->Menu[i].Entry, lib->Menu[i].EntryN, sizeof(lib->Menu[i].Entry[0]), netnode_sort);*/ -} - -void fp_free_entry(library_t *l) -{ - switch(l->type) { - case LIB_DIR: - fp_free_children(l); - vtlib_uninit(&(l->data.dir.children)); - break; - case LIB_FOOTPRINT: - if (l->data.fp.loc_info != NULL) - free(l->data.fp.loc_info); - if (l->data.fp.tags != NULL) - free(l->data.fp.tags); - break; - case LIB_INVALID: break; /* suppress compiler warning */ - } - if (l->name != NULL) { - free(l->name); - l->name = NULL; - } - l->type = LIB_INVALID; -} - -void fp_free_children(library_t *parent) -{ - int n; - library_t *l; - - assert(parent->type == LIB_DIR); - - for(n = 0, l = parent->data.dir.children.array; n < parent->data.dir.children.used; n++, l++) - fp_free_entry(l); - - vtlib_truncate(&(parent->data.dir.children), 0); -} - - -void fp_rmdir(library_t *dir) -{ - library_t *l, *parent = dir->parent; - int n; - fp_free_entry(dir); - if (parent != NULL) { - for(n = 0, l = parent->data.dir.children.array; n < parent->data.dir.children.used; n++,l++) { - if (l == dir) { - vtlib_remove(&(parent->data.dir.children), n, 1); - break; - } - } - } -} - -/* Debug functions */ -void fp_dump_dir(library_t *dir, int level) -{ - library_t *l; - int n, p; - - for(n = 0, l = dir->data.dir.children.array; n < dir->data.dir.children.used; n++, l++) { - for(p = 0; p < level; p++) - putchar(' '); - if (l->type == LIB_DIR) { - printf("%s/\n", l->name); - fp_dump_dir(l, level+1); - } - else if (l->type == LIB_FOOTPRINT) - printf("%s\n", l->name); - else - printf("*INVALID*\n"); - } -} - -void fp_dump() -{ - fp_dump_dir(&library, 0); -} - -/* This function loads the newlib footprints into the Library. - * It examines all directories pointed to by the search paths - * (normally Settings.LibraryTree). - * In each directory specified there, it looks both in that directory, - * as well as *one* level down. It calls the subfunction - * fp_fs_load_dir to put the footprints into PCB's internal - * datastructures. - */ -static int fp_read_lib_all_(const char *searchpath) -{ - char toppath[MAXPATHLEN + 1]; /* String holding abs path to top level library dir */ - char *libpaths; /* String holding list of library paths to search */ - char *p; /* Helper string used in iteration */ - int n_footprints = 0; /* Running count of footprints found */ - int res; - - /* Initialize path, working by writing 0 into every byte. */ - memset(toppath, 0, sizeof toppath); - - /* Additional loop to allow for multiple 'newlib' style library directories - * called out in Settings.LibraryTree - */ - libpaths = pcb_strdup(searchpath); - for (p = strtok(libpaths, PCB_PATH_DELIMETER); p && *p; p = strtok(NULL, PCB_PATH_DELIMETER)) { - /* remove trailing path delimiter */ - strncpy(toppath, p, sizeof(toppath) - 1); - -#ifdef DEBUG - printf("In ParseLibraryTree, looking for newlib footprints inside top level directory %s ... \n", toppath); -#endif - - /* Next read in any footprints in the top level dir */ - res = -1; - HOOK_CALL(plug_fp_t, plug_fp_chain, load_dir, res, >= 0, (self, toppath)); - if (res >= 0) - n_footprints += res; - else - Message(PCB_MSG_DEFAULT, "Warning: footprint library list error on %s\n", toppath); - } - -#ifdef DEBUG - printf("Leaving ParseLibraryTree, found %d footprints.\n", n_footprints); -#endif - - free(libpaths); - return n_footprints; -} - -static gds_t fpds_paths; -static int fpds_inited = 0; - -const char *fp_default_search_path(void) -{ - return conf_concat_strlist(&conf_core.rc.library_search_paths, &fpds_paths, &fpds_inited, ':'); -} - -int fp_host_uninit(void) -{ - if (fpds_inited) - gds_uninit(&fpds_paths); - return 0; -} - -int fp_read_lib_all(void) -{ - FILE *resultFP = NULL; - - /* List all footprint libraries. Then sort the whole - * library. - */ - if (fp_read_lib_all_(fp_default_search_path()) > 0 || resultFP != NULL) { - fp_sort_children(&library); - return 0; - } - - return (1); -} - -int fp_rehash(void) -{ - fp_free_children(&library); - return fp_read_lib_all(); -} Index: 1.1.4/src/change_act.c =================================================================== --- 1.1.4/src/change_act.c (revision 10776) +++ 1.1.4/src/change_act.c (nonexistent) @@ -1,1582 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* action routines for output window - */ - -#include - -#include "config.h" -#include "conf_core.h" - -#include "data.h" -#include "funchash_core.h" - -#include "action_helper.h" -#include "hid_actions.h" -#include "change.h" -#include "draw.h" -#include "search.h" -#include "misc.h" -#include "set.h" -#include "error.h" -#include "undo.h" -#include "rubberband.h" -#include "misc_util.h" -#include "compat_misc.h" -#include "layer.h" - -static void ChangeFlag(const char *, const char *, int, const char *); -static int ActionChangeSize(int argc, const char **argv, Coord x, Coord y); -static int ActionChange2ndSize(int argc, const char **argv, Coord x, Coord y); - -/* --------------------------------------------------------------------------- */ - -static const char changeclearsize_syntax[] = - "ChangeClearSize(Object, delta|style)\n" - "ChangeClearSize(SelectedPins|SelectedPads|SelectedVias, delta|style)\n" - "ChangeClearSize(SelectedLines|SelectedArcs, delta|style)\n" "ChangeClearSize(Selected|SelectedObjects, delta|style)"; - -static const char changeclearsize_help[] = "Changes the clearance size of objects."; - -/* %start-doc actions ChangeClearSize - -If the solder mask is currently showing, this action changes the -solder mask clearance. If the mask is not showing, this action -changes the polygon clearance. - -%end-doc */ - -static int ActionChangeClearSize(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *delta = ACTION_ARG(1); - const char *units = ACTION_ARG(2); - pcb_bool absolute; - Coord value; - int type = PCB_TYPE_NONE; - void *ptr1, *ptr2, *ptr3; - - if (function && delta) { - int funcid = funchash_get(function, NULL); - - if (funcid == F_Object) { - gui->get_coords(_("Select an Object"), &x, &y); - type = SearchScreen(x, y, CHANGECLEARSIZE_TYPES, &ptr1, &ptr2, &ptr3); - } - - if (strcmp(argv[1], "style") == 0) { - if ((type == PCB_TYPE_NONE) || (type == PCB_TYPE_POLYGON)) /* workaround: SearchScreen(CHANGECLEARSIZE_TYPES) wouldn't return elements */ - type = SearchScreen(x, y, CHANGE2NDSIZE_TYPES, &ptr1, &ptr2, &ptr3); - if (get_style_size(funcid, &value, type, 2) != 0) - return 1; - absolute = 1; - value *= 2; - } - else - value = 2 * GetValue(delta, units, &absolute, NULL); - switch (funchash_get(function, NULL)) { - case F_Object: - { - if (type != PCB_TYPE_NONE) - if (ChangeObjectClearSize(type, ptr1, ptr2, ptr3, value, absolute)) - SetChangedFlag(pcb_true); - break; - } - case F_SelectedVias: - if (ChangeSelectedClearSize(PCB_TYPE_VIA, value, absolute)) - SetChangedFlag(pcb_true); - break; - case F_SelectedPads: - if (ChangeSelectedClearSize(PCB_TYPE_PAD, value, absolute)) - SetChangedFlag(pcb_true); - break; - case F_SelectedPins: - if (ChangeSelectedClearSize(PCB_TYPE_PIN, value, absolute)) - SetChangedFlag(pcb_true); - break; - case F_SelectedLines: - if (ChangeSelectedClearSize(PCB_TYPE_LINE, value, absolute)) - SetChangedFlag(pcb_true); - break; - case F_SelectedArcs: - if (ChangeSelectedClearSize(PCB_TYPE_ARC, value, absolute)) - SetChangedFlag(pcb_true); - break; - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedClearSize(CHANGECLEARSIZE_TYPES, value, absolute)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changeflag_syntax[] = - "ChangeFlag(Object|Selected|SelectedObjects, flag, value)\n" - "ChangeFlag(SelectedLines|SelectedPins|SelectedVias, flag, value)\n" - "ChangeFlag(SelectedPads|SelectedTexts|SelectedNames, flag, value)\n" - "ChangeFlag(SelectedElements, flag, value)\n" "flag = square | octagon | thermal | join\n" "value = 0 | 1"; - -static const char changeflag_help[] = "Sets or clears flags on objects."; - -/* %start-doc actions ChangeFlag - -Toggles the given flag on the indicated object(s). The flag may be -one of the flags listed above (square, octagon, thermal, join). The -value may be the number 0 or 1. If the value is 0, the flag is -cleared. If the value is 1, the flag is set. - -%end-doc */ - -static int ActionChangeFlag(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *flag = ACTION_ARG(1); - int value = argc > 2 ? atoi(argv[2]) : -1; - if (value != 0 && value != 1) - AFAIL(changeflag); - - ChangeFlag(function, flag, value, "ChangeFlag"); - return 0; -} - - -static void ChangeFlag(const char *what, const char *flag_name, int value, - const char *cmd_name) -{ - pcb_bool(*set_object) (int, void *, void *, void *); - pcb_bool(*set_selected) (int); - - if (NSTRCMP(flag_name, "square") == 0) { - set_object = value ? SetObjectSquare : ClrObjectSquare; - set_selected = value ? SetSelectedSquare : ClrSelectedSquare; - } - else if (NSTRCMP(flag_name, "octagon") == 0) { - set_object = value ? SetObjectOctagon : ClrObjectOctagon; - set_selected = value ? SetSelectedOctagon : ClrSelectedOctagon; - } - else if (NSTRCMP(flag_name, "join") == 0) { - /* Note: these are backwards, because the flag is "clear" but - the command is "join". */ - set_object = value ? ClrObjectJoin : SetObjectJoin; - set_selected = value ? ClrSelectedJoin : SetSelectedJoin; - } - else { - Message(PCB_MSG_DEFAULT, _("%s(): Flag \"%s\" is not valid\n"), cmd_name, flag_name); - return; - } - - switch (funchash_get(what, NULL)) { - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - if ((type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - if (set_object(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedVias: - if (set_selected(PCB_TYPE_VIA)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (set_selected(PCB_TYPE_PIN)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPads: - if (set_selected(PCB_TYPE_PAD)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedLines: - if (set_selected(PCB_TYPE_LINE)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedTexts: - if (set_selected(PCB_TYPE_TEXT)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedNames: - if (set_selected(PCB_TYPE_ELEMENT_NAME)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedElements: - if (set_selected(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (set_selected(CHANGESIZE_TYPES)) - SetChangedFlag(pcb_true); - break; - } -} - -/* --------------------------------------------------------------------------- */ - -static const char changehold_syntax[] = "ChangeHole(ToggleObject|Object|SelectedVias|Selected)"; - -static const char changehold_help[] = "Changes the hole flag of objects."; - -/* %start-doc actions ChangeHole - -The "hole flag" of a via determines whether the via is a -plated-through hole (not set), or an unplated hole (set). - -%end-doc */ - -static int ActionChangeHole(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, PCB_TYPE_VIA, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE && ChangeHole((PinTypePtr) ptr3)) - IncrementUndoSerialNumber(); - break; - } - - case F_SelectedVias: - case F_Selected: - if (ChangeSelectedHole()) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changepaste_syntax[] = "ChangePaste(ToggleObject|Object|SelectedPads|Selected)"; - -static const char changepaste_help[] = "Changes the no paste flag of objects."; - -/* %start-doc actions ChangePaste - -The "no paste flag" of a pad determines whether the solderpaste - stencil will have an opening for the pad (no set) or if there will be - no solderpaste on the pad (set). This is used for things such as - fiducial pads. - -%end-doc */ - -static int ActionChangePaste(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, PCB_TYPE_PAD, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE && ChangePaste((PadTypePtr) ptr3)) - IncrementUndoSerialNumber(); - break; - } - - case F_SelectedPads: - case F_Selected: - if (ChangeSelectedPaste()) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - - -/* --------------------------------------------------------------------------- */ - -static const char changesizes_syntax[] = - "ChangeSizes(Object, delta|style)\n" - "ChangeSizes(SelectedObjects|Selected, delta|style)\n" - "ChangeSizes(SelectedLines|SelectedPins|SelectedVias, delta|style)\n" - "ChangeSizes(SelectedPads|SelectedTexts|SelectedNames, delta|style)\n" "ChangeSizes(SelectedElements, delta|style)"; - -static const char changesizes_help[] = "Changes all sizes of objects."; - -/* %start-doc actions ChangeSize - -Call ActionChangeSize, ActionChangeDrillSize and ActionChangeClearSize -with the same arguments. If any of them did not fail, return success. -%end-doc */ - -static int ActionChangeSizes(int argc, const char **argv, Coord x, Coord y) -{ - int a, b, c; - SaveUndoSerialNumber(); - a = ActionChangeSize(argc, argv, x, y); - RestoreUndoSerialNumber(); - b = ActionChange2ndSize(argc, argv, x, y); - RestoreUndoSerialNumber(); - c = ActionChangeClearSize(argc, argv, x, y); - RestoreUndoSerialNumber(); - IncrementUndoSerialNumber(); - return !(!a || !b || !c); -} - -/* --------------------------------------------------------------------------- */ - -static const char changesize_syntax[] = - "ChangeSize(Object, delta|style)\n" - "ChangeSize(SelectedObjects|Selected, delta|style)\n" - "ChangeSize(SelectedLines|SelectedPins|SelectedVias, delta|style)\n" - "ChangeSize(SelectedPads|SelectedTexts|SelectedNames, delta|style)\n" "ChangeSize(SelectedElements, delta|style)"; - -static const char changesize_help[] = "Changes the size of objects."; - -/* %start-doc actions ChangeSize - -For lines and arcs, this changes the width. For pins and vias, this -changes the overall diameter of the copper annulus. For pads, this -changes the width and, indirectly, the length. For texts and names, -this changes the scaling factor. For elements, this changes the width -of the silk layer lines and arcs for this element. - -%end-doc */ - -static int ActionChangeSize(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *delta = ACTION_ARG(1); - const char *units = ACTION_ARG(2); - pcb_bool absolute; /* indicates if absolute size is given */ - Coord value; - int type = PCB_TYPE_NONE, tostyle = 0; - void *ptr1, *ptr2, *ptr3; - - - if (function && delta) { - int funcid = funchash_get(function, NULL); - - if (funcid == F_Object) - type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); - - if (strcmp(argv[1], "style") == 0) { - if (get_style_size(funcid, &value, type, 0) != 0) - return 1; - absolute = 1; - tostyle = 1; - } - else - value = GetValue(delta, units, &absolute, NULL); - switch (funcid) { - case F_Object: - { - if (type != PCB_TYPE_NONE) - if (TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - if (tostyle) { - if (ChangeObject1stSize(type, ptr1, ptr2, ptr3, value, absolute)) - SetChangedFlag(pcb_true); - } - else { - if (ChangeObjectSize(type, ptr1, ptr2, ptr3, value, absolute)) - SetChangedFlag(pcb_true); - } - break; - } - case F_SelectedVias: - if (ChangeSelectedSize(PCB_TYPE_VIA, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (ChangeSelectedSize(PCB_TYPE_PIN, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPads: - if (ChangeSelectedSize(PCB_TYPE_PAD, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedArcs: - if (ChangeSelectedSize(PCB_TYPE_ARC, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedLines: - if (ChangeSelectedSize(PCB_TYPE_LINE, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedTexts: - if (ChangeSelectedSize(PCB_TYPE_TEXT, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedNames: - if (ChangeSelectedSize(PCB_TYPE_ELEMENT_NAME, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedElements: - if (ChangeSelectedSize(PCB_TYPE_ELEMENT, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedSize(CHANGESIZE_TYPES, value, absolute)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changedrillsize_syntax[] = - "ChangeDrillSize(Object, delta|style)\n" "ChangeDrillSize(SelectedPins|SelectedVias|Selected|SelectedObjects, delta|style)"; - -static const char changedrillsize_help[] = "Changes the drilling hole size of objects."; - -/* %start-doc actions ChangeDrillSize - -%end-doc */ - -static int ActionChange2ndSize(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *delta = ACTION_ARG(1); - const char *units = ACTION_ARG(2); - int type = PCB_TYPE_NONE; - void *ptr1, *ptr2, *ptr3; - - pcb_bool absolute; - Coord value; - - if (function && delta) { - int funcid = funchash_get(function, NULL); - - if (funcid == F_Object) { - gui->get_coords(_("Select an Object"), &x, &y); - type = SearchScreen(x, y, CHANGE2NDSIZE_TYPES, &ptr1, &ptr2, &ptr3); - } - - if (strcmp(argv[1], "style") == 0) { - if (get_style_size(funcid, &value, type, 1) != 0) - return 1; - absolute = 1; - } - else - value = GetValue(delta, units, &absolute, NULL); - - switch (funchash_get(function, NULL)) { - case F_Object: - { - - if (type != PCB_TYPE_NONE) - if (ChangeObject2ndSize(type, ptr1, ptr2, ptr3, value, absolute, pcb_true)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedVias: - if (ChangeSelected2ndSize(PCB_TYPE_VIA, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (ChangeSelected2ndSize(PCB_TYPE_PIN, value, absolute)) - SetChangedFlag(pcb_true); - break; - case F_Selected: - case F_SelectedObjects: - if (ChangeSelected2ndSize(PCB_TYPEMASK_PIN, value, absolute)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changepinname_syntax[] = "ChangePinName(ElementName,PinNumber,PinName)"; - -static const char changepinname_help[] = "Sets the name of a specific pin on a specific element."; - -/* %start-doc actions ChangePinName - -This can be especially useful for annotating pin names from a -schematic to the layout without requiring knowledge of the pcb file -format. - -@example -ChangePinName(U3, 7, VCC) -@end example - -%end-doc */ - -static int ActionChangePinName(int argc, const char **argv, Coord x, Coord y) -{ - int changed = 0; - const char *refdes, *pinnum, *pinname; - - if (argc != 3) { - AFAIL(changepinname); - } - - refdes = argv[0]; - pinnum = argv[1]; - pinname = argv[2]; - - ELEMENT_LOOP(PCB->Data); - { - if (NSTRCMP(refdes, NAMEONPCB_NAME(element)) == 0) { - PIN_LOOP(element); - { - if (NSTRCMP(pinnum, pin->Number) == 0) { - AddObjectToChangeNameUndoList(PCB_TYPE_PIN, NULL, NULL, pin, pin->Name); - /* - * Note: we can't free() pin->Name first because - * it is used in the undo list - */ - pin->Name = pcb_strdup(pinname); - SetChangedFlag(pcb_true); - changed = 1; - } - } - END_LOOP; - - PAD_LOOP(element); - { - if (NSTRCMP(pinnum, pad->Number) == 0) { - AddObjectToChangeNameUndoList(PCB_TYPE_PAD, NULL, NULL, pad, pad->Name); - /* - * Note: we can't free() pad->Name first because - * it is used in the undo list - */ - pad->Name = pcb_strdup(pinname); - SetChangedFlag(pcb_true); - changed = 1; - } - } - END_LOOP; - } - } - END_LOOP; - /* - * done with our action so increment the undo # if we actually - * changed anything - */ - if (changed) { - if (defer_updates) - defer_needs_update = 1; - else { - IncrementUndoSerialNumber(); - gui->invalidate_all(); - } - } - - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changename_syntax[] = "ChangeName(Object)\n" "ChangeName(Object|\"Number\")\n" "ChangeName(Layout|Layer)"; - -static const char changename_help[] = "Sets the name (or pin number) of objects."; - -/* %start-doc actions ChangeName - -@table @code - -@item Object -Changes the name of the element under the cursor. - -@item Layout -Changes the name of the layout. This is printed on the fab drawings. - -@item Layer -Changes the name of the currently active layer. - -@end table - -%end-doc */ - -int ActionChangeName(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *pinnums = ACTION_ARG(1); - char *name; - int pinnum; - - if (function) { - switch (funchash_get(function, NULL)) { - /* change the name of an object */ - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, CHANGENAME_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { - SaveUndoSerialNumber(); - if ((pinnums != NULL) && (strcasecmp(pinnums, "Number") == 0)) - pinnum = 1; - else - pinnum = 0; - if (QueryInputAndChangeObjectName(type, ptr1, ptr2, ptr3, pinnum)) { - SetChangedFlag(pcb_true); - if (type == PCB_TYPE_ELEMENT) { - RubberbandTypePtr ptr; - int i; - - RestoreUndoSerialNumber(); - Crosshair.AttachedObject.RubberbandN = 0; - LookupRatLines(type, ptr1, ptr2, ptr3); - ptr = Crosshair.AttachedObject.Rubberband; - for (i = 0; i < Crosshair.AttachedObject.RubberbandN; i++, ptr++) { - if (PCB->RatOn) - EraseRat((RatTypePtr) ptr->Line); - MoveObjectToRemoveUndoList(PCB_TYPE_RATLINE, ptr->Line, ptr->Line, ptr->Line); - } - IncrementUndoSerialNumber(); - Draw(); - } - } - } - break; - } - - /* change the layout's name */ - case F_Layout: - name = gui->prompt_for(_("Enter the layout name:"), EMPTY(PCB->Name)); - /* NB: ChangeLayoutName takes ownership of the passed memory */ - if (name && ChangeLayoutName(name)) - SetChangedFlag(pcb_true); - break; - - /* change the name of the active layer */ - case F_Layer: - name = gui->prompt_for(_("Enter the layer name:"), EMPTY(CURRENT->Name)); - /* NB: ChangeLayerName takes ownership of the passed memory */ - if (name && ChangeLayerName(CURRENT, name)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changejoin_syntax[] = "ChangeJoin(ToggleObject|SelectedLines|SelectedArcs|Selected)"; - -static const char changejoin_help[] = "Changes the join (clearance through polygons) of objects."; - -/* %start-doc actions ChangeJoin - -The join flag determines whether a line or arc, drawn to intersect a -polygon, electrically connects to the polygon or not. When joined, -the line/arc is simply drawn over the polygon, making an electrical -connection. When not joined, a gap is drawn between the line and the -polygon, insulating them from each other. - -%end-doc */ - -static int ActionChangeJoin(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, CHANGEJOIN_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (ChangeObjectJoin(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedLines: - if (ChangeSelectedJoin(PCB_TYPE_LINE)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedArcs: - if (ChangeSelectedJoin(PCB_TYPE_ARC)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedJoin(CHANGEJOIN_TYPES)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changenonetlist_syntax[] = - "ChangeNonetlist(ToggleObject)\n" "ChangeNonetlist(SelectedElements)\n" "ChangeNonetlist(Selected|SelectedObjects)"; - -static const char changenonetlist_help[] = "Changes the nonetlist flag of elements."; - -/* %start-doc actions ChangeNonetlist - -Note that @code{Pins} means both pins and pads. - -@pinshapes - -%end-doc */ - -static int ActionChangeNonetlist(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - case F_Element: - { - int type; - void *ptr1, *ptr2, *ptr3; - gui->get_coords(_("Select an Element"), &x, &y); - - ptr3 = NULL; - type = SearchScreen(x, y, CHANGENONETLIST_TYPES, &ptr1, &ptr2, &ptr3); - if (ChangeObjectNonetlist(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - case F_SelectedElements: - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedNonetlist(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - - -/* --------------------------------------------------------------------------- */ - -static const char changesquare_syntax[] = - "ChangeSquare(ToggleObject)\n" "ChangeSquare(SelectedElements|SelectedPins)\n" "ChangeSquare(Selected|SelectedObjects)"; - -static const char changesquare_help[] = "Changes the square flag of pins and pads."; - -/* %start-doc actions ChangeSquare - -Note that @code{Pins} means both pins and pads. - -@pinshapes - -%end-doc */ - -static int ActionChangeSquare(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - - ptr3 = NULL; - type = SearchScreen(x, y, CHANGESQUARE_TYPES, &ptr1, &ptr2, &ptr3); - - if (ptr3 != NULL) { - int qstyle = GET_SQUARE((PinTypePtr) ptr3); - qstyle++; - if (qstyle > 17) - qstyle = 0; - if (type != PCB_TYPE_NONE) - if (ChangeObjectSquare(type, ptr1, ptr2, ptr3, qstyle)) - SetChangedFlag(pcb_true); - } - break; - } - - case F_SelectedElements: - if (ChangeSelectedSquare(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (ChangeSelectedSquare(PCB_TYPE_PIN | PCB_TYPE_PAD)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedSquare(PCB_TYPE_PIN | PCB_TYPE_PAD)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char setsquare_syntax[] = "SetSquare(ToggleObject|SelectedElements|SelectedPins)"; - -static const char setsquare_help[] = "sets the square-flag of objects."; - -/* %start-doc actions SetSquare - -Note that @code{Pins} means pins and pads. - -@pinshapes - -%end-doc */ - -static int ActionSetSquare(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function && *function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, CHANGESQUARE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (SetObjectSquare(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedElements: - if (SetSelectedSquare(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (SetSelectedSquare(PCB_TYPE_PIN | PCB_TYPE_PAD)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (SetSelectedSquare(PCB_TYPE_PIN | PCB_TYPE_PAD)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char clearsquare_syntax[] = "ClearSquare(ToggleObject|SelectedElements|SelectedPins)"; - -static const char clearsquare_help[] = "Clears the square-flag of pins and pads."; - -/* %start-doc actions ClearSquare - -Note that @code{Pins} means pins and pads. - -@pinshapes - -%end-doc */ - -static int ActionClearSquare(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function && *function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, CHANGESQUARE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (ClrObjectSquare(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedElements: - if (ClrSelectedSquare(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (ClrSelectedSquare(PCB_TYPE_PIN | PCB_TYPE_PAD)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ClrSelectedSquare(PCB_TYPE_PIN | PCB_TYPE_PAD)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changeoctagon_syntax[] = - "ChangeOctagon(Object|ToggleObject|SelectedObjects|Selected)\n" "ChangeOctagon(SelectedElements|SelectedPins|SelectedVias)"; - -static const char changeoctagon_help[] = "Changes the octagon-flag of pins and vias."; - -/* %start-doc actions ChangeOctagon - -@pinshapes - -%end-doc */ - -static int ActionChangeOctagon(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (ChangeObjectOctagon(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedElements: - if (ChangeSelectedOctagon(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (ChangeSelectedOctagon(PCB_TYPE_PIN)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedVias: - if (ChangeSelectedOctagon(PCB_TYPE_VIA)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedOctagon(PCB_TYPEMASK_PIN)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char setoctagon_syntax[] = "SetOctagon(Object|ToggleObject|SelectedElements|Selected)"; - -static const char setoctagon_help[] = "Sets the octagon-flag of objects."; - -/* %start-doc actions SetOctagon - -@pinshapes - -%end-doc */ - -static int ActionSetOctagon(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(x, y, CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (SetObjectOctagon(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedElements: - if (SetSelectedOctagon(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (SetSelectedOctagon(PCB_TYPE_PIN)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedVias: - if (SetSelectedOctagon(PCB_TYPE_VIA)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (SetSelectedOctagon(PCB_TYPEMASK_PIN)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char clearoctagon_syntax[] = - "ClearOctagon(ToggleObject|Object|SelectedObjects|Selected)\n" "ClearOctagon(SelectedElements|SelectedPins|SelectedVias)"; - -static const char clearoctagon_help[] = "Clears the octagon-flag of pins and vias."; - -/* %start-doc actions ClearOctagon - -@pinshapes - -%end-doc */ - -static int ActionClearOctagon(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_ToggleObject: - case F_Object: - { - int type; - void *ptr1, *ptr2, *ptr3; - - gui->get_coords(_("Select an Object"), &x, &y); - if ((type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - if (ClrObjectOctagon(type, ptr1, ptr2, ptr3)) - SetChangedFlag(pcb_true); - break; - } - - case F_SelectedElements: - if (ClrSelectedOctagon(PCB_TYPE_ELEMENT)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedPins: - if (ClrSelectedOctagon(PCB_TYPE_PIN)) - SetChangedFlag(pcb_true); - break; - - case F_SelectedVias: - if (ClrSelectedOctagon(PCB_TYPE_VIA)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ClrSelectedOctagon(PCB_TYPEMASK_PIN)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* -------------------------------------------------------------------------- */ - -static const char setthermal_syntax[] = "SetThermal(Object|SelectedPins|SelectedVias|Selected, Style)"; - -static const char setthermal_help[] = - "Set the thermal (on the current layer) of pins or vias to the given style.\n" - "Style = 0 means no thermal.\n" - "Style = 1 has diagonal fingers with sharp edges.\n" - "Style = 2 has horizontal and vertical fingers with sharp edges.\n" - "Style = 3 is a solid connection to the plane." - "Style = 4 has diagonal fingers with rounded edges.\n" "Style = 5 has horizontal and vertical fingers with rounded edges.\n"; - -/* %start-doc actions SetThermal - -This changes how/whether pins or vias connect to any rectangle or polygon -on the current layer. The first argument can specify one object, or all -selected pins, or all selected vias, or all selected pins and vias. -The second argument specifies the style of connection. -There are 5 possibilities: -0 - no connection, -1 - 45 degree fingers with sharp edges, -2 - horizontal & vertical fingers with sharp edges, -3 - solid connection, -4 - 45 degree fingers with rounded corners, -5 - horizontal & vertical fingers with rounded corners. - -Pins and Vias may have thermals whether or not there is a polygon available -to connect with. However, they will have no effect without the polygon. -%end-doc */ - -static int ActionSetThermal(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *style = ACTION_ARG(1); - void *ptr1, *ptr2, *ptr3; - int type, kind; - int err = 0; - - if (function && *function && style && *style) { - pcb_bool absolute; - - kind = GetValue(style, NULL, &absolute, NULL); - if (absolute) - switch (funchash_get(function, NULL)) { - case F_Object: - if ((type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGETHERMAL_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { - ChangeObjectThermal(type, ptr1, ptr2, ptr3, kind); - IncrementUndoSerialNumber(); - Draw(); - } - break; - case F_SelectedPins: - ChangeSelectedThermals(PCB_TYPE_PIN, kind); - break; - case F_SelectedVias: - ChangeSelectedThermals(PCB_TYPE_VIA, kind); - break; - case F_Selected: - case F_SelectedElements: - ChangeSelectedThermals(CHANGETHERMAL_TYPES, kind); - break; - default: - err = 1; - break; - } - else - err = 1; - if (!err) - return 0; - } - - AFAIL(setthermal); -} - - -/* --------------------------------------------------------------------------- */ - -static const char setflag_syntax[] = - "SetFlag(Object|Selected|SelectedObjects, flag)\n" - "SetFlag(SelectedLines|SelectedPins|SelectedVias, flag)\n" - "SetFlag(SelectedPads|SelectedTexts|SelectedNames, flag)\n" - "SetFlag(SelectedElements, flag)\n" "flag = square | octagon | thermal | join"; - -static const char setflag_help[] = "Sets flags on objects."; - -/* %start-doc actions SetFlag - -Turns the given flag on, regardless of its previous setting. See -@code{ChangeFlag}. - -@example -SetFlag(SelectedPins,thermal) -@end example - -%end-doc */ - -static int ActionSetFlag(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *flag = ACTION_ARG(1); - ChangeFlag(function, flag, 1, "SetFlag"); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char clrflag_syntax[] = - "ClrFlag(Object|Selected|SelectedObjects, flag)\n" - "ClrFlag(SelectedLines|SelectedPins|SelectedVias, flag)\n" - "ClrFlag(SelectedPads|SelectedTexts|SelectedNames, flag)\n" - "ClrFlag(SelectedElements, flag)\n" "flag = square | octagon | thermal | join"; - -static const char clrflag_help[] = "Clears flags on objects."; - -/* %start-doc actions ClrFlag - -Turns the given flag off, regardless of its previous setting. See -@code{ChangeFlag}. - -@example -ClrFlag(SelectedLines,join) -@end example - -%end-doc */ - -static int ActionClrFlag(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *flag = ACTION_ARG(1); - ChangeFlag(function, flag, 0, "ClrFlag"); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char setvalue_syntax[] = "SetValue(Grid|Line|LineSize|Text|TextScale|ViaDrillingHole|Via|ViaSize, delta)"; - -static const char setvalue_help[] = "Change various board-wide values and sizes."; - -/* %start-doc actions SetValue - -@table @code - -@item ViaDrillingHole -Changes the diameter of the drill for new vias. - -@item Grid -Sets the grid spacing. - -@item Line -@item LineSize -Changes the thickness of new lines. - -@item Via -@item ViaSize -Changes the diameter of new vias. - -@item Text -@item TextScale -Changes the size of new text. - -@end table - -%end-doc */ - -static int ActionSetValue(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *val = ACTION_ARG(1); - const char *units = ACTION_ARG(2); - pcb_bool absolute; /* flag for 'absolute' value */ - double value; - int err = 0; - - if (function && val) { - value = GetValue(val, units, &absolute, NULL); - switch (funchash_get(function, NULL)) { - case F_ViaDrillingHole: - SetViaDrillingHole(absolute ? value : value + conf_core.design.via_drilling_hole, pcb_false); - hid_action("RouteStylesChanged"); - break; - - case F_Grid: - if (absolute) - SetGrid(value, pcb_false); - else { - /* On the way down, short against the minimum - * PCB drawing unit */ - if ((value + PCB->Grid) < 1) - SetGrid(1, pcb_false); - else if (PCB->Grid == 1) - SetGrid(value, pcb_false); - else - SetGrid(value + PCB->Grid, pcb_false); - } - break; - - case F_LineSize: - case F_Line: - SetLineSize(absolute ? value : value + conf_core.design.line_thickness); - hid_action("RouteStylesChanged"); - break; - - case F_Via: - case F_ViaSize: - SetViaSize(absolute ? value : value + conf_core.design.via_thickness, pcb_false); - hid_action("RouteStylesChanged"); - break; - - case F_Text: - case F_TextScale: - value /= 45; - SetTextScale(absolute ? value : value + conf_core.design.text_scale); - break; - default: - err = 1; - break; - } - if (!err) - return 0; - } - - AFAIL(setvalue); -} - -/* --------------------------------------------------------------------------- */ - -static const char changeangle_syntax[] = - "ChangeAngle(Object, start|delta|both, delta)\n" - "ChangeAngle(SelectedObjects|Selected, start|delta|both, delta)\n" - "ChangeAngle(SelectedArcs, start|delta|both, delta)\n"; -static const char changeangle_help[] = "Changes the start angle, delta angle or both angles of an arc."; -static int ActionChangeAngle(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *prim = ACTION_ARG(1); - const char *delta = ACTION_ARG(2); - pcb_bool absolute; /* indicates if absolute size is given */ - double value; - int type = PCB_TYPE_NONE, which; - void *ptr1, *ptr2, *ptr3; - - if (strcasecmp(prim, "start") == 0) which = 0; - else if (strcasecmp(prim, "delta") == 0) which = 1; - else if (strcasecmp(prim, "both") == 0) which = 2; - else { - Message(PCB_MSG_ERROR, "Second argument of ChangeAngle must be start, delta or both\n"); - return -1; - } - - if (function && delta) { - int funcid = funchash_get(function, NULL); - - if (funcid == F_Object) - type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); - - { /* convert angle from string */ - char *end; - while(isspace(*delta)) delta++; - value = strtod(delta, &end); - if (*end != '\0') { - Message(PCB_MSG_ERROR, "Invalid numeric (in angle)\n"); - return -1; - } - absolute = ((*delta != '-') && (*delta != '+')); - } - - switch (funcid) { - case F_Object: - { - if (type != PCB_TYPE_NONE) { - if (TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - else { - if (ChangeObjectAngle(type, ptr1, ptr2, ptr3, which, value, absolute)) - SetChangedFlag(pcb_true); - } - } - break; - } - - case F_SelectedArcs: - if (ChangeSelectedAngle(PCB_TYPE_ARC, which, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedAngle(CHANGESIZE_TYPES, which, value, absolute)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char changeradius_syntax[] = - "ChangeRadius(Object, width|x|height|y|both, delta)\n" - "ChangeRadius(SelectedObjects|Selected, width|x|height|y|both, delta)\n" - "ChangeRadius(SelectedArcs, width|x|height|y|both, delta)\n"; -static const char changeradius_help[] = "Changes the width or height (radius) of an arc."; -static int ActionChangeRadius(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - const char *prim = ACTION_ARG(1); - const char *delta = ACTION_ARG(2); - const char *units = ACTION_ARG(3); - pcb_bool absolute; /* indicates if absolute size is given */ - double value; - int type = PCB_TYPE_NONE, which; - void *ptr1, *ptr2, *ptr3; - - if ((strcasecmp(prim, "width") == 0) || (strcasecmp(prim, "x") == 0)) which = 0; - else if ((strcasecmp(prim, "height") == 0) || (strcasecmp(prim, "y") == 0)) which = 1; - else if (strcasecmp(prim, "both") == 0) which = 2; - else { - Message(PCB_MSG_ERROR, "Second argument of ChangeRadius must be width, x, height, y or both\n"); - return -1; - } - - if (function && delta) { - int funcid = funchash_get(function, NULL); - - if (funcid == F_Object) - type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); - - value = GetValue(delta, units, &absolute, NULL); - - switch (funcid) { - case F_Object: - { - if (type != PCB_TYPE_NONE) { - if (TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - else { - if (ChangeObjectRadius(type, ptr1, ptr2, ptr3, which, value, absolute)) - SetChangedFlag(pcb_true); - } - } - break; - } - - case F_SelectedArcs: - if (ChangeSelectedRadius(PCB_TYPE_ARC, which, value, absolute)) - SetChangedFlag(pcb_true); - break; - - case F_Selected: - case F_SelectedObjects: - if (ChangeSelectedRadius(CHANGESIZE_TYPES, which, value, absolute)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - - -/* --------------------------------------------------------------------------- */ - -HID_Action change_action_list[] = { - {"ChangeAngle", 0, ActionChangeAngle, - changeangle_help, changeangle_syntax} - , - {"ChangeClearSize", 0, ActionChangeClearSize, - changeclearsize_help, changeclearsize_syntax} - , - {"ChangeDrillSize", 0, ActionChange2ndSize, - changedrillsize_help, changedrillsize_syntax} - , - {"ChangeHole", 0, ActionChangeHole, - changehold_help, changehold_syntax} - , - {"ChangeJoin", 0, ActionChangeJoin, - changejoin_help, changejoin_syntax} - , - {"ChangeName", 0, ActionChangeName, - changename_help, changename_syntax} - , - {"ChangePaste", 0, ActionChangePaste, - changepaste_help, changepaste_syntax} - , - {"ChangePinName", 0, ActionChangePinName, - changepinname_help, changepinname_syntax} - , - {"ChangeRadius", 0, ActionChangeRadius, - changeradius_help, changeradius_syntax} - , - {"ChangeSize", 0, ActionChangeSize, - changesize_help, changesize_syntax} - , - {"ChangeSizes", 0, ActionChangeSizes, - changesizes_help, changesizes_syntax} - , - {"ChangeNonetlist", 0, ActionChangeNonetlist, - changenonetlist_help, changenonetlist_syntax} - , - {"ChangeSquare", 0, ActionChangeSquare, - changesquare_help, changesquare_syntax} - , - {"ChangeOctagon", 0, ActionChangeOctagon, - changeoctagon_help, changeoctagon_syntax} - , - {"ChangeFlag", 0, ActionChangeFlag, - changeflag_help, changeflag_syntax} - , - {"ClearSquare", 0, ActionClearSquare, - clearsquare_help, clearsquare_syntax} - , - {"ClearOctagon", 0, ActionClearOctagon, - clearoctagon_help, clearoctagon_syntax} - , - {"SetSquare", 0, ActionSetSquare, - setsquare_help, setsquare_syntax} - , - {"SetOctagon", 0, ActionSetOctagon, - setoctagon_help, setoctagon_syntax} - , - {"SetThermal", 0, ActionSetThermal, - setthermal_help, setthermal_syntax} - , - {"SetValue", 0, ActionSetValue, - setvalue_help, setvalue_syntax} - , - {"SetFlag", 0, ActionSetFlag, - setflag_help, setflag_syntax} - , - {"ClrFlag", 0, ActionClrFlag, - clrflag_help, clrflag_syntax} -}; - -REGISTER_ACTIONS(change_action_list, NULL) Index: 1.1.4/src/buffer.h =================================================================== --- 1.1.4/src/buffer.h (revision 10776) +++ 1.1.4/src/buffer.h (nonexistent) @@ -1,56 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for buffer handling routines */ - -#ifndef PCB_BUFFER_H -#define PCB_BUFFER_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * prototypes - */ -void SetBufferBoundingBox(BufferTypePtr); -void ClearBuffer(BufferTypePtr); -void AddSelectedToBuffer(BufferTypePtr, Coord, Coord, pcb_bool); -pcb_bool LoadElementToBuffer(BufferTypePtr, const char *); -pcb_bool ConvertBufferToElement(BufferTypePtr); -pcb_bool SmashBufferElement(BufferTypePtr); -pcb_bool LoadLayoutToBuffer(BufferTypePtr Buffer, const char *Filename, const char *fmt); -void RotateBuffer(BufferTypePtr, pcb_uint8_t); -void SelectPasteBuffer(int); -void pcb_swap_buffers(void); -void MirrorBuffer(BufferTypePtr); -void InitBuffers(void); -void UninitBuffers(void); -void *MoveObjectToBuffer(DataTypePtr, DataTypePtr, int, void *, void *, void *); -void *CopyObjectToBuffer(DataTypePtr, DataTypePtr, int, void *, void *, void *); - -/* This action is called from ActionElementAddIf() */ -int LoadFootprint(int argc, const char **argv, Coord x, Coord y); - -#endif Index: 1.1.4/src/hid_attrib.h =================================================================== --- 1.1.4/src/hid_attrib.h (revision 10776) +++ 1.1.4/src/hid_attrib.h (nonexistent) @@ -1,63 +0,0 @@ -#ifndef PCB_HID_ATTRIB_H -#define PCB_HID_ATTRIB_H - -#include "hid.h" - -/* Used for HID attributes (exporting and printing, mostly). - HA_boolean uses int_value, HA_enum sets int_value to the index and - str_value to the enumeration string. HID_Label just shows the - default str_value. HID_Mixed is a real_value followed by an enum, - like 0.5in or 100mm. */ -struct HID_Attr_Val_s { - int int_value; - const char *str_value; - double real_value; - Coord coord_value; -}; - -enum hids { HID_Label, HID_Integer, HID_Real, HID_String, - HID_Boolean, HID_Enum, HID_Mixed, HID_Path, - HID_Unit, HID_Coord -}; - -struct HID_Attribute_s { - const char *name; - /* If the help_text is this, usage() won't show this option */ -#define ATTR_UNDOCUMENTED ((char *)(1)) - const char *help_text; - enum hids type; - int min_val, max_val; /* for integer and real */ - HID_Attr_Val default_val; /* Also actual value for global attributes. */ - const char **enumerations; - /* If set, this is used for global attributes (i.e. those set - statically with REGISTER_ATTRIBUTES below) instead of changing - the default_val. Note that a HID_Mixed attribute must specify a - pointer to HID_Attr_Val here, and HID_Boolean assumes this is - "char *" so the value should be initialized to zero, and may be - set to non-zero (not always one). */ - void *value; - int hash; /* for detecting changes. */ -}; - -extern void hid_register_attributes(HID_Attribute *, int, const char *cookie, int copy); -#define REGISTER_ATTRIBUTES(a, cookie) HIDCONCAT(void register_,a) ()\ -{ hid_register_attributes(a, sizeof(a)/sizeof(a[0]), cookie, 0); } - -/* Remove all attributes registered with the given cookie */ -void hid_remove_attributes_by_cookie(const char *cookie); - -/* remove all attributes and free the list */ -void hid_attributes_uninit(void); - -typedef struct HID_AttrNode { - struct HID_AttrNode *next; - HID_Attribute *attributes; - int n; - const char *cookie; -} HID_AttrNode; - -extern HID_AttrNode *hid_attr_nodes; - -void hid_usage(HID_Attribute * a, int numa); -void hid_usage_option(const char *name, const char *help); -#endif Index: 1.1.4/src/conf_hid.h =================================================================== --- 1.1.4/src/conf_hid.h (revision 10776) +++ 1.1.4/src/conf_hid.h (nonexistent) @@ -1,73 +0,0 @@ -#ifndef PCB_CONF_HID_H -#define PCB_CONF_HID_H - -#include "conf.h" - -typedef struct conf_hid_callbacks_s { - /* Called before/after a value of a config item is updated - this doesn't necessarily mean the value actually changes */ - void (*val_change_pre)(conf_native_t *cfg); - void (*val_change_post)(conf_native_t *cfg); - - /* Called when a new config item is added to the database; global-only */ - void (*new_item_post)(conf_native_t *cfg); - - /* Called during conf_hid_unreg to get hid-data cleaned up */ - void (*unreg_item)(conf_native_t *cfg); -} conf_hid_callbacks_t; - -typedef int conf_hid_id_t; - -/* Set local hid data in a native item; returns the previous value set or NULL */ -void *conf_hid_set_data(conf_native_t *cfg, conf_hid_id_t id, void *data); - -/* Returns local hid data in a native item */ -void *conf_hid_get_data(conf_native_t *cfg, conf_hid_id_t id); - -/* Set local callbacks in a native item; returns the previous callbacks set or NULL */ -const conf_hid_callbacks_t *conf_hid_set_cb(conf_native_t *cfg, conf_hid_id_t id, const conf_hid_callbacks_t *cbs); - - -/* register a hid with a cookie; this is necessary only if: - - the HID wants to store per-config-item hid_data with the above calls - - the HID wants to get notified about changes in the config tree using callback functions - NOTE: cookie is taken by pointer, the string value does not matter. One pointer - can be registered only once. - cb holds the global notification callbacks - called when anything changed; it can be NULL. - Returns a new HID id that can be used to access hid data, or -1 on error. -*/ -conf_hid_id_t conf_hid_reg(const char *cookie, const conf_hid_callbacks_t *cb); - -/* Unregister a hid; if unreg_item cb is specified, call it on each config item */ -void conf_hid_unreg(const char *cookie); - -void conf_hid_uninit(void); - - -/* Call the local callback of a native item */ -#define conf_hid_local_cb(native, cb) \ -do { \ - int __n__; \ - for(__n__ = 0; __n__ < vtp0_len(&((native)->hid_callbacks)); __n__++) { \ - const conf_hid_callbacks_t *cbs = (native)->hid_callbacks.array[__n__]; \ - if ((cbs != NULL) && (cbs->cb != NULL)) \ - cbs->cb(native); \ - } \ -} while(0) - -/* Call the local callback of a native item */ -#define conf_hid_global_cb(native, cb) \ -do { \ - conf_hid_callbacks_t __cbs__; \ - int __offs__ = ((char *)&(__cbs__.cb)) - ((char *)&(__cbs__)); \ - conf_hid_global_cb_(native, __offs__); \ -} while(0) - -/****** Utility/helper functions ******/ -/* Looking at the log level, return a log format tag and whether the window - should pop up. */ -void conf_loglevel_props(enum pcb_message_level level, const char **tag, int *popup); - -/****** Internal ******/ -void conf_hid_global_cb_(conf_native_t *item, int offs); - -#endif Index: 1.1.4/src/mirror.h =================================================================== --- 1.1.4/src/mirror.h (revision 10776) +++ 1.1.4/src/mirror.h (nonexistent) @@ -1,44 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes to change objects mirror flag */ - -#ifndef PCB_MIRROR_H -#define PCB_MIRROR_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * some useful macros and defines - */ -#define MIRROR(object) TOGGLE_FLAG(MIRRORFLAG, (object)) - -#define MIRROR_TYPES (PCB_TYPE_TEXT | PCB_TYPE_ELEMENT_NAME) - - -void MirrorElementCoordinates(DataTypePtr, ElementTypePtr, Coord); - -#endif Index: 1.1.4/src/plug_footprint.h =================================================================== --- 1.1.4/src/plug_footprint.h (revision 10776) +++ 1.1.4/src/plug_footprint.h (nonexistent) @@ -1,90 +0,0 @@ -#ifndef PCB_PLUG_FOOTPRINT_H -#define PCB_PLUG_FOOTPRINT_H - -#include -#include "vtlibrary.h" - -typedef struct plug_fp_s plug_fp_t; - -typedef struct { - plug_fp_t *backend; - union { - int i; - void *p; - } field[4]; -} fp_fopen_ctx_t; - -/* hook bindings, see below */ -FILE *fp_fopen(const char *path, const char *name, fp_fopen_ctx_t *fctx); -void fp_fclose(FILE * f, fp_fopen_ctx_t *fctx); - -/* duplicates the name and splits it into a basename and params; - params is NULL if the name is not parametric (and "" if parameter list is empty) - returns 1 if name is parametric, 0 if file element. - The caller shall free only *basename at the end. - */ -int fp_dupname(const char *name, char **basename, char **params); - -/**** tag management ****/ -/* Resolve a tag name to an unique void * ID; create unknown tag if alloc != 0 */ -const void *fp_tag(const char *tag, int alloc); - -/* Resolve a tag ID to a tag name */ -const char *fp_tagname(const void *tagid); - -/* init/uninit the footprint lib, free tag key memory */ -void fp_init(); -void fp_uninit(); - -/**************************** API definition *********************************/ -struct plug_fp_s { - plug_fp_t *next; - void *plugin_data; - - /* returns the number of footprints loaded into the library or -1 on - error; next in chain is run only on error. */ - int (*load_dir)(plug_fp_t *ctx, const char *path); - -/* Open a footprint for reading; if the footprint is parametric, it's run - prefixed with libshell (or executed directly, if libshell is NULL). - If name is not an absolute path, search_path is searched for the first match. - The user has to supply a state integer that will be used by pcb_fp_fclose(). - Must fill in fctx->backend, may use any other field of fctx as well. - */ - FILE *(*fopen)(plug_fp_t *ctx, const char *path, const char *name, fp_fopen_ctx_t *fctx); - -/* Close the footprint file opened by pcb_fp_fopen(). */ - void (*fclose)(plug_fp_t *ctx, FILE * f, fp_fopen_ctx_t *fctx); -}; - -extern plug_fp_t *plug_fp_chain; - - -/* Optional pcb-rnd-side glue for some implementations */ - -extern library_t library; /* the footprint library */ - -#define get_library_memory(parent) vtlib_alloc_append(((parent) == NULL ? &library.data.dir.children : &(parent)->data.dir.children), 1); - -void fp_free_children(library_t *parent); -void fp_sort_children(library_t *parent); -void fp_rmdir(library_t *dir); -library_t *fp_mkdir_p(const char *path); -library_t *fp_mkdir_len(library_t *parent, const char *name, int name_len); -library_t *fp_lib_search(library_t *dir, const char *name); - -/* Append a menu entry in the tree */ -library_t *fp_append_entry(library_t *parent, const char *name, fp_type_t type, void *tags[]); - -/* walk through all lib paths and build the library menu */ -int fp_read_lib_all(void); - - -const char *fp_default_search_path(void); - -int fp_host_uninit(void); - -/* rescan/reload all footprints in the library cache */ -int fp_rehash(void); - -#endif Index: 1.1.4/src/find.c =================================================================== --- 1.1.4/src/find.c (revision 10776) +++ 1.1.4/src/find.c (nonexistent) @@ -1,183 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - - -/* - * short description: - * - lists for pins and vias, lines, arcs, pads and for polygons are created. - * Every object that has to be checked is added to its list. - * Coarse searching is accomplished with the data rtrees. - * - there's no 'speed-up' mechanism for polygons because they are not used - * as often as other objects - * - the maximum distance between line and pin ... would depend on the angle - * between them. To speed up computation the limit is set to one half - * of the thickness of the objects (cause of square pins). - * - * PV: means pin or via (objects that connect layers) - * LO: all non PV objects (layer objects like lines, arcs, polygons, pads) - * - * 1. first, the LO or PV at the given coordinates is looked up - * 2. all LO connections to that PV are looked up next - * 3. lookup of all LOs connected to LOs from (2). - * This step is repeated until no more new connections are found. - * 4. lookup all PVs connected to the LOs from (2) and (3) - * 5. start again with (1) for all new PVs from (4) - * - */ - -/* routines to find connections between pins, vias, lines... - */ -#include "config.h" - -#include -#include -#include -#include -#include - -#include "conf_core.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "find.h" -#include "misc.h" -#include "rtree.h" -#include "polygon.h" -#include "search.h" -#include "set.h" -#include "undo.h" -#include "rats.h" -#include "plug_io.h" -#include "hid_actions.h" -#include "misc_util.h" -#include "compat_misc.h" -#include "layer.h" - -#undef DEBUG - -/* --------------------------------------------------------------------------- - * some local macros - */ - -#define SEPARATE(FP) \ - { \ - int i; \ - fputc('#', (FP)); \ - for (i = conf_core.appearance.messages.char_per_line; i; i--) \ - fputc('=', (FP)); \ - fputc('\n', (FP)); \ - } - -#define PADLIST_ENTRY(L,I) \ - (((PadTypePtr *)PadList[(L)].Data)[(I)]) - -#define LINELIST_ENTRY(L,I) \ - (((LineTypePtr *)LineList[(L)].Data)[(I)]) - -#define ARCLIST_ENTRY(L,I) \ - (((ArcTypePtr *)ArcList[(L)].Data)[(I)]) - -#define RATLIST_ENTRY(I) \ - (((RatTypePtr *)RatList.Data)[(I)]) - -#define POLYGONLIST_ENTRY(L,I) \ - (((PolygonTypePtr *)PolygonList[(L)].Data)[(I)]) - -#define PVLIST_ENTRY(I) \ - (((PinTypePtr *)PVList.Data)[(I)]) - -/* --------------------------------------------------------------------------- - * some local types - * - * the two 'dummy' structs for PVs and Pads are necessary for creating - * connection lists which include the element's name - */ -typedef struct { - void **Data; /* pointer to index data */ - pcb_cardinal_t Location, /* currently used position */ - DrawLocation, Number, /* number of objects in list */ - Size; -} ListType, *ListTypePtr; - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static Coord Bloat = 0; -static int TheFlag = PCB_FLAG_FOUND; -static int OldFlag = PCB_FLAG_FOUND; -static void *thing_ptr1, *thing_ptr2, *thing_ptr3; -static int thing_type; -find_callback_t find_callback = NULL; -#define make_callback(current_type, current_ptr, from_type, from_ptr, type) \ - do { \ - if (find_callback != NULL) \ - find_callback(current_type, current_ptr, from_type, from_ptr, type); \ - } while(0) - -static pcb_bool User = pcb_false; /* user action causing this */ -static pcb_bool drc = pcb_false; /* whether to stop if finding something not found */ -static pcb_bool IsBad = pcb_false; -static pcb_cardinal_t drcerr_count; /* count of drc errors */ -static pcb_cardinal_t TotalP, TotalV, NumberOfPads[2]; -static ListType LineList[MAX_LAYER], /* list of objects to */ - PolygonList[MAX_LAYER], ArcList[MAX_LAYER], PadList[2], RatList, PVList; - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static pcb_bool LookupLOConnectionsToPVList(pcb_bool); -static pcb_bool LookupLOConnectionsToLOList(pcb_bool); -static pcb_bool LookupPVConnectionsToLOList(pcb_bool); -static pcb_bool LookupPVConnectionsToPVList(void); -static pcb_bool LookupLOConnectionsToLine(LineTypePtr, pcb_cardinal_t, pcb_bool); -static pcb_bool LookupLOConnectionsToPad(PadTypePtr, pcb_cardinal_t); -static pcb_bool LookupLOConnectionsToPolygon(PolygonTypePtr, pcb_cardinal_t); -static pcb_bool LookupLOConnectionsToArc(ArcTypePtr, pcb_cardinal_t); -static pcb_bool LookupLOConnectionsToRatEnd(PointTypePtr, pcb_cardinal_t); -static pcb_bool IsRatPointOnLineEnd(PointTypePtr, LineTypePtr); -static pcb_bool ArcArcIntersect(ArcTypePtr, ArcTypePtr); -static pcb_bool PrintElementConnections(ElementTypePtr, FILE *, pcb_bool); -static pcb_bool ListsEmpty(pcb_bool); -static pcb_bool DoIt(pcb_bool, pcb_bool); -static void PrintElementNameList(ElementTypePtr, FILE *); -static void PrintConnectionElementName(ElementTypePtr, FILE *); -static void PrintConnectionListEntry(char *, ElementTypePtr, pcb_bool, FILE *); -static void PrintPadConnections(pcb_cardinal_t, FILE *, pcb_bool); -static void PrintPinConnections(FILE *, pcb_bool); -static void DumpList(void); -static pcb_bool ListStart(int, void *, void *, void *); -static pcb_bool SetThing(int, void *, void *, void *); - - -#include "find_geo.c" -#include "find_lookup.c" -#include "find_drc.c" -#include "find_misc.c" -#include "find_clear.c" - -#include "find_debug.c" -#include "find_print.c" Index: 1.1.4/src/compat_fs.h =================================================================== --- 1.1.4/src/compat_fs.h (revision 10776) +++ 1.1.4/src/compat_fs.h (nonexistent) @@ -1,14 +0,0 @@ -char *GetWorkingDirectory(char *); - -int pcb_mkdir(const char *path, int mode); -int pcb_spawnvp(const char **argv); - -/* Return 1 if path is a file that can be opened for read */ -int pcb_file_readable(const char *path); - -char *tempfile_name_new(const char *name); - -/* remove temporary file and _also_ free the memory for name - * (this fact is a little confusing) - */ -int tempfile_unlink(char *name); Index: 1.1.4/src/hid_cfg_action.c =================================================================== --- 1.1.4/src/hid_cfg_action.c (revision 10776) +++ 1.1.4/src/hid_cfg_action.c (nonexistent) @@ -1,48 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "config.h" -#include "global.h" -#include "hid_cfg_action.h" -#include "hid_actions.h" - -int hid_cfg_action(const lht_node_t *node) -{ - if (node == NULL) - return -1; - switch(node->type) { - case LHT_TEXT: - return hid_parse_actions(node->data.text.value); - case LHT_LIST: - for(node = node->data.list.first; node != NULL; node = node->next) { - if (node->type == LHT_TEXT) { - if (hid_parse_actions(node->data.text.value) != 0) - return -1; - } - else - return -1; - } - return 0; - default: ; /* suppress compiler warning: can't handle any other type */ - } - return -1; -} Index: 1.1.4/src/plugins.c =================================================================== --- 1.1.4/src/plugins.c (revision 10776) +++ 1.1.4/src/plugins.c (nonexistent) @@ -1,141 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2015 Tibor 'Igor2' Palinkas - * - * This module, rats.c, was written and is Copyright (C) 1997 by harry eaton - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include "plugins.h" - -/* for the action */ -#include "global.h" -#include "config.h" -#include "genvector/gds_char.h" -#include "compat_misc.h" - -plugin_info_t *plugins = NULL; - -plugin_info_t *plugin_find(const char *name) -{ - plugin_info_t *i; - for(i = plugins; i != NULL; i = i->next) - if (strcmp(i->name, name) == 0) - return i; - return NULL; -} - -void plugin_register(const char *name, const char *path, void *handle, int dynamic_loaded, void (*uninit)(void)) -{ - plugin_info_t *i = malloc(sizeof(plugin_info_t)); - - i->name = pcb_strdup(name); - i->path = pcb_strdup(path); - i->handle = handle; - i->dynamic_loaded = dynamic_loaded; - i->uninit = uninit; - - i->next = plugins; - plugins = i; -} - -void plugins_init(void) -{ -} - - -void plugins_uninit(void) -{ - plugin_info_t *i, *next; - for(i = plugins; i != NULL; i = next) { - next = i->next; - free(i->name); - free(i->path); - if (i->uninit != NULL) - i->uninit(); - free(i); - } - plugins = NULL; -} - - - -/* ---------------------------------------------------------------- */ -static const char manageplugins_syntax[] = "ManagePlugins()\n"; - -static const char manageplugins_help[] = "Manage plugins dialog."; - -static int ActionManagePlugins(int argc, const char **argv, Coord x, Coord y) -{ - plugin_info_t *i; - int nump = 0, numb = 0; - gds_t str; - - gds_init(&str); - - for (i = plugins; i != NULL; i = i->next) - if (i->dynamic_loaded) - nump++; - else - numb++; - - gds_append_str(&str, "Plugins loaded:\n"); - if (nump > 0) { - for (i = plugins; i != NULL; i = i->next) { - if (i->dynamic_loaded) { - gds_append(&str, ' '); - gds_append_str(&str, i->name); - gds_append(&str, ' '); - gds_append_str(&str, i->path); - gds_append(&str, '\n'); - } - } - } - else - gds_append_str(&str, " (none)\n"); - - gds_append_str(&str, "\n\nBuildins:\n"); - if (numb > 0) { - for (i = plugins; i != NULL; i = i->next) { - if (!i->dynamic_loaded) { - gds_append(&str, ' '); - gds_append_str(&str, i->name); - gds_append(&str, '\n'); - } - } - } - else - gds_append_str(&str, " (none)\n"); - - gds_append_str(&str, "\n\nNOTE: this is the alpha version, can only list plugins/buildins\n"); - gui->report_dialog("Manage plugins", str.array); - gds_uninit(&str); - return 0; -} - - -HID_Action plugins_action_list[] = { - {"ManagePlugins", 0, ActionManagePlugins, - manageplugins_help, manageplugins_syntax} -}; - -REGISTER_ACTIONS(plugins_action_list, NULL) Index: 1.1.4/src/list_line.c =================================================================== --- 1.1.4/src/list_line.c (revision 10776) +++ 1.1.4/src/list_line.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define TDL_DONT_UNDEF -#include "global_objs.h" -#include "list_line.h" -#include Index: 1.1.4/src/global_objs.h =================================================================== --- 1.1.4/src/global_objs.h (revision 10776) +++ 1.1.4/src/global_objs.h (nonexistent) @@ -1,210 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2004 Thomas Nau - * - * 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 - * - */ - -#ifndef GLOBAL_OBJS_H -#define GLOBAL_OBJS_H -#include -#include "config.h" -#include "globalconst.h" -#include "global_typedefs.h" -#include "polyarea.h" - -typedef struct { - char *name; - char *value; -} AttributeType, *AttributeTypePtr; - -struct AttributeListType { - int Number, Max; - AttributeType *List; -}; - -/* --------------------------------------------------------------------------- - * Do not change the following definitions even if they're not very - * nice. It allows us to have functions act on these "base types" and - * not need to know what kind of actual object they're working on. - */ - -/* Any object that uses the "object flags" defined in const.h, or - exists as an object on the pcb, MUST be defined using this as the - first fields, either directly or through ANYLINEFIELDS. */ -#define ANYOBJECTFIELDS \ - BoxType BoundingBox; \ - long int ID; \ - FlagType Flags; \ - AttributeListType Attributes - - /* struct LibraryEntryType *net */ - -/* Lines, pads, and rats all use this so they can be cross-cast. */ -#define ANYLINEFIELDS \ - ANYOBJECTFIELDS; \ - Coord Thickness, \ - Clearance; \ - PointType Point1, \ - Point2 - -struct BoxType { /* a bounding box */ - Coord X1, Y1; /* upper left */ - Coord X2, Y2; /* and lower right corner */ -}; - -/* Nobody should know about the internals of this except the macros in - macros.h that access it. This structure must be simple-assignable - for now. */ -typedef struct unknown_flag_s unknown_flag_t; -struct unknown_flag_s { - char *str; - unknown_flag_t *next; -}; - -typedef struct { - unsigned long f; /* generic flags */ - unsigned char t[(MAX_LAYER + 1) / 2]; /* thermals */ - unsigned char q; /* square geometry flag */ - unsigned char int_conn_grp; - unknown_flag_t *unknowns; -} FlagType, *FlagTypePtr; - - -/* All on-pcb objects (elements, lines, pads, vias, rats, etc) are - based on this. */ -typedef struct { - ANYOBJECTFIELDS; -} AnyObjectType, *AnyObjectTypePtr; - -typedef struct { /* a line/polygon point */ - Coord X, Y, X2, Y2; /* so Point type can be cast as BoxType */ - long int ID; -} PointType, *PointTypePtr; - -/* Lines, rats, pads, etc. */ -typedef struct { - ANYLINEFIELDS; -} AnyLineObjectType, *AnyLineObjectTypePtr; - -typedef struct line_st { /* holds information about one line */ - ANYLINEFIELDS; - char *Number; - gdl_elem_t link; /* a line is in a list: either on a layer or in an element */ -} LineType, *LineTypePtr; - -typedef struct text_st { - ANYOBJECTFIELDS; - int Scale; /* text scaling in percent */ - Coord X, Y; /* origin */ - pcb_uint8_t Direction; - char *TextString; /* string */ - void *Element; - gdl_elem_t link; /* a text is in a list of a layer or an element */ -} TextType, *TextTypePtr; - -struct polygon_st { /* holds information about a polygon */ - ANYOBJECTFIELDS; - pcb_cardinal_t PointN, /* number of points in polygon */ - PointMax; /* max number from malloc() */ - POLYAREA *Clipped; /* the clipped region of this polygon */ - PLINE *NoHoles; /* the polygon broken into hole-less regions */ - int NoHolesValid; /* Is the NoHoles polygon up to date? */ - PointTypePtr Points; /* data */ - pcb_cardinal_t *HoleIndex; /* Index of hole data within the Points array */ - pcb_cardinal_t HoleIndexN; /* number of holes in polygon */ - pcb_cardinal_t HoleIndexMax; /* max number from malloc() */ - gdl_elem_t link; /* a text is in a list of a layer */ -}; - -typedef struct arc_st { /* holds information about arcs */ - ANYOBJECTFIELDS; - Coord Thickness, Clearance; - Coord Width, Height, /* length of axis */ - X, Y; /* center coordinates */ - Angle StartAngle, Delta; /* the two limiting angles in degrees */ - gdl_elem_t link; /* an arc is in a list: either on a layer or in an element */ -} ArcType, *ArcTypePtr; - -typedef struct rat_st { /* a rat-line */ - ANYLINEFIELDS; - pcb_cardinal_t group1, group2; /* the layer group each point is on */ - gdl_elem_t link; /* an arc is in a list on a design */ -} RatType, *RatTypePtr; - -struct pad_st { /* a SMD pad */ - ANYLINEFIELDS; - Coord Mask; - char *Name, *Number; /* 'Line' */ - void *Element; - void *Spare; - gdl_elem_t link; /* a pad is in a list (element) */ -}; - -struct pin_st { - ANYOBJECTFIELDS; - Coord Thickness, Clearance, Mask, DrillingHole; - Coord X, Y; /* center and diameter */ - char *Name, *Number; - void *Element; - void *Spare; - gdl_elem_t link; /* a pin is in a list (element) */ -}; - -/* This is the extents of a Pin or Via, depending on whether it's a - hole or not. */ -#define PIN_SIZE(pinptr) (TEST_FLAG(PCB_FLAG_HOLE, (pinptr)) \ - ? (pinptr)->DrillingHole \ - : (pinptr)->Thickness) - -/* --------------------------------------------------------------------------- - * symbol and font related stuff - */ -typedef struct symbol_st { /* a single symbol */ - LineTypePtr Line; - pcb_bool Valid; - pcb_cardinal_t LineN, /* number of lines */ - LineMax; - Coord Width, Height, /* size of cell */ - Delta; /* distance to next symbol */ -} SymbolType, *SymbolTypePtr; - -typedef struct font_st { /* complete set of symbols */ - Coord MaxHeight, /* maximum cell width and height */ - MaxWidth; - BoxType DefaultSymbol; /* the default symbol is a filled box */ - SymbolType Symbol[MAX_FONTPOSITION + 1]; - pcb_bool Valid; -} FontType, *FontTypePtr; - - -/* TODO: this could be replaced with pcb_obj_t */ -typedef struct onpoint_st { - int type; - union { - void *any; - LineType *line; - ArcType *arc; - } obj; -} OnpointType; - -#endif Index: 1.1.4/src/mymem.c =================================================================== --- 1.1.4/src/mymem.c (revision 10776) +++ 1.1.4/src/mymem.c (nonexistent) @@ -1,765 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* memory management functions - */ - -#include "config.h" - -#include - -#include "data.h" -#include "mymem.h" -#include "rtree.h" -#include "rats_patch.h" - -/* --------------------------------------------------------------------------- - * local prototypes - */ -/* memset object to 0, but keep the link field */ -#define reset_obj_mem(type, obj) \ -do { \ - gdl_elem_t __lnk__ = obj->link; \ - memset(obj, 0, sizeof(type)); \ - obj->link = __lnk__; \ -} while(0) \ - -/* --------------------------------------------------------------------------- - * get next slot for a rubberband connection, allocates memory if necessary - */ -RubberbandTypePtr GetRubberbandMemory(void) -{ - RubberbandTypePtr ptr = Crosshair.AttachedObject.Rubberband; - - /* realloc new memory if necessary and clear it */ - if (Crosshair.AttachedObject.RubberbandN >= Crosshair.AttachedObject.RubberbandMax) { - Crosshair.AttachedObject.RubberbandMax += STEP_RUBBERBAND; - ptr = (RubberbandTypePtr) realloc(ptr, Crosshair.AttachedObject.RubberbandMax * sizeof(RubberbandType)); - Crosshair.AttachedObject.Rubberband = ptr; - memset(ptr + Crosshair.AttachedObject.RubberbandN, 0, STEP_RUBBERBAND * sizeof(RubberbandType)); - } - return (ptr + Crosshair.AttachedObject.RubberbandN++); -} - -void **GetPointerMemory(PointerListTypePtr list) -{ - void **ptr = list->Ptr; - - /* realloc new memory if necessary and clear it */ - if (list->PtrN >= list->PtrMax) { - list->PtrMax = STEP_POINT + (2 * list->PtrMax); - ptr = (void **) realloc(ptr, list->PtrMax * sizeof(void *)); - list->Ptr = ptr; - memset(ptr + list->PtrN, 0, (list->PtrMax - list->PtrN) * sizeof(void *)); - } - return (ptr + list->PtrN++); -} - -void FreePointerListMemory(PointerListTypePtr list) -{ - free(list->Ptr); - memset(list, 0, sizeof(PointerListType)); -} - -/* --------------------------------------------------------------------------- - * get next slot for a box, allocates memory if necessary - */ -BoxTypePtr GetBoxMemory(BoxListTypePtr Boxes) -{ - BoxTypePtr box = Boxes->Box; - - /* realloc new memory if necessary and clear it */ - if (Boxes->BoxN >= Boxes->BoxMax) { - Boxes->BoxMax = STEP_POINT + (2 * Boxes->BoxMax); - box = (BoxTypePtr) realloc(box, Boxes->BoxMax * sizeof(BoxType)); - Boxes->Box = box; - memset(box + Boxes->BoxN, 0, (Boxes->BoxMax - Boxes->BoxN) * sizeof(BoxType)); - } - return (box + Boxes->BoxN++); -} - - -/* --------------------------------------------------------------------------- - * get next slot for a connection, allocates memory if necessary - */ -ConnectionTypePtr GetConnectionMemory(NetTypePtr Net) -{ - ConnectionTypePtr con = Net->Connection; - - /* realloc new memory if necessary and clear it */ - if (Net->ConnectionN >= Net->ConnectionMax) { - Net->ConnectionMax += STEP_POINT; - con = (ConnectionTypePtr) realloc(con, Net->ConnectionMax * sizeof(ConnectionType)); - Net->Connection = con; - memset(con + Net->ConnectionN, 0, STEP_POINT * sizeof(ConnectionType)); - } - return (con + Net->ConnectionN++); -} - -/* --------------------------------------------------------------------------- - * get next slot for a subnet, allocates memory if necessary - */ -NetTypePtr GetNetMemory(NetListTypePtr Netlist) -{ - NetTypePtr net = Netlist->Net; - - /* realloc new memory if necessary and clear it */ - if (Netlist->NetN >= Netlist->NetMax) { - Netlist->NetMax += STEP_POINT; - net = (NetTypePtr) realloc(net, Netlist->NetMax * sizeof(NetType)); - Netlist->Net = net; - memset(net + Netlist->NetN, 0, STEP_POINT * sizeof(NetType)); - } - return (net + Netlist->NetN++); -} - -/* --------------------------------------------------------------------------- - * get next slot for a net list, allocates memory if necessary - */ -NetListTypePtr GetNetListMemory(NetListListTypePtr Netlistlist) -{ - NetListTypePtr netlist = Netlistlist->NetList; - - /* realloc new memory if necessary and clear it */ - if (Netlistlist->NetListN >= Netlistlist->NetListMax) { - Netlistlist->NetListMax += STEP_POINT; - netlist = (NetListTypePtr) realloc(netlist, Netlistlist->NetListMax * sizeof(NetListType)); - Netlistlist->NetList = netlist; - memset(netlist + Netlistlist->NetListN, 0, STEP_POINT * sizeof(NetListType)); - } - return (netlist + Netlistlist->NetListN++); -} - -/* --------------------------------------------------------------------------- - * get next slot for a pin, allocates memory if necessary - */ -PinType *GetPinMemory(ElementType * element) -{ - PinType *new_obj; - - new_obj = calloc(sizeof(PinType), 1); - pinlist_append(&element->Pin, new_obj); - - return new_obj; -} - -void RemoveFreePin(PinType * data) -{ - pinlist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for a pad, allocates memory if necessary - */ -PadType *GetPadMemory(ElementType * element) -{ - PadType *new_obj; - - new_obj = calloc(sizeof(PadType), 1); - padlist_append(&element->Pad, new_obj); - - return new_obj; -} - -void RemoveFreePad(PadType * data) -{ - padlist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for a via, allocates memory if necessary - */ -PinType *GetViaMemory(DataType * data) -{ - PinType *new_obj; - - new_obj = calloc(sizeof(PinType), 1); - pinlist_append(&data->Via, new_obj); - - return new_obj; -} - -void RemoveFreeVia(PinType * data) -{ - pinlist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for a Rat, allocates memory if necessary - */ -RatType *GetRatMemory(DataType * data) -{ - RatType *new_obj; - - new_obj = calloc(sizeof(RatType), 1); - ratlist_append(&data->Rat, new_obj); - - return new_obj; -} - -void RemoveFreeRat(RatType * data) -{ - ratlist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for a line, allocates memory if necessary - */ -LineType *GetLineMemory(LayerType * layer) -{ - LineType *new_obj; - - new_obj = calloc(sizeof(LineType), 1); - linelist_append(&layer->Line, new_obj); - - return new_obj; -} - -void RemoveFreeLine(LineType * data) -{ - linelist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for an arc, allocates memory if necessary - */ -ArcTypePtr GetArcMemory(LayerType * layer) -{ - ArcType *new_obj; - - new_obj = calloc(sizeof(ArcType), 1); - arclist_append(&layer->Arc, new_obj); - - return new_obj; -} - -void RemoveFreeArc(ArcType * data) -{ - arclist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for a text object, allocates memory if necessary - */ -TextTypePtr GetTextMemory(LayerType * layer) -{ - TextType *new_obj; - - new_obj = calloc(sizeof(TextType), 1); - textlist_append(&layer->Text, new_obj); - - return new_obj; -} - -void RemoveFreeText(TextType * data) -{ - textlist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for a polygon object, allocates memory if necessary - */ -PolygonType *GetPolygonMemory(LayerType * layer) -{ - PolygonType *new_obj; - - new_obj = calloc(sizeof(PolygonType), 1); - polylist_append(&layer->Polygon, new_obj); - - return new_obj; -} - -void RemoveFreePolygon(PolygonType * data) -{ - polylist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * gets the next slot for a point in a polygon struct, allocates memory - * if necessary - */ -PointTypePtr GetPointMemoryInPolygon(PolygonTypePtr Polygon) -{ - PointTypePtr points = Polygon->Points; - - /* realloc new memory if necessary and clear it */ - if (Polygon->PointN >= Polygon->PointMax) { - Polygon->PointMax += STEP_POLYGONPOINT; - points = (PointTypePtr) realloc(points, Polygon->PointMax * sizeof(PointType)); - Polygon->Points = points; - memset(points + Polygon->PointN, 0, STEP_POLYGONPOINT * sizeof(PointType)); - } - return (points + Polygon->PointN++); -} - -/* --------------------------------------------------------------------------- - * gets the next slot for a point in a polygon struct, allocates memory - * if necessary - */ -pcb_cardinal_t *GetHoleIndexMemoryInPolygon(PolygonTypePtr Polygon) -{ - pcb_cardinal_t *holeindex = Polygon->HoleIndex; - - /* realloc new memory if necessary and clear it */ - if (Polygon->HoleIndexN >= Polygon->HoleIndexMax) { - Polygon->HoleIndexMax += STEP_POLYGONHOLEINDEX; - holeindex = (pcb_cardinal_t *) realloc(holeindex, Polygon->HoleIndexMax * sizeof(int)); - Polygon->HoleIndex = holeindex; - memset(holeindex + Polygon->HoleIndexN, 0, STEP_POLYGONHOLEINDEX * sizeof(int)); - } - return (holeindex + Polygon->HoleIndexN++); -} - -/* --------------------------------------------------------------------------- - * get next slot for an element, allocates memory if necessary - */ -ElementType *GetElementMemory(DataType * data) -{ - ElementType *new_obj; - - new_obj = calloc(sizeof(ElementType), 1); - elementlist_append(&data->Element, new_obj); - - return new_obj; -} - -void RemoveFreeElement(ElementType * data) -{ - elementlist_remove(data); - free(data); -} - -/* --------------------------------------------------------------------------- - * get next slot for a library menu, allocates memory if necessary - */ -LibraryMenuTypePtr GetLibraryMenuMemory(LibraryTypePtr lib, int *idx) -{ - LibraryMenuTypePtr menu = lib->Menu; - - /* realloc new memory if necessary and clear it */ - if (lib->MenuN >= lib->MenuMax) { - lib->MenuMax += STEP_LIBRARYMENU; - menu = (LibraryMenuTypePtr) realloc(menu, lib->MenuMax * sizeof(LibraryMenuType)); - lib->Menu = menu; - memset(menu + lib->MenuN, 0, STEP_LIBRARYMENU * sizeof(LibraryMenuType)); - } - if (idx != NULL) - *idx = lib->MenuN; - return (menu + lib->MenuN++); -} - -void DeleteLibraryMenuMemory(LibraryTypePtr lib, int menuidx) -{ - LibraryMenuTypePtr menu = lib->Menu; - - if (menu[menuidx].Name != NULL) - free(menu[menuidx].Name); - if (menu[menuidx].directory != NULL) - free(menu[menuidx].directory); - - lib->MenuN--; - memmove(menu + menuidx, menu + menuidx + 1, sizeof(LibraryMenuType) * (lib->MenuN - menuidx)); -} - -/* --------------------------------------------------------------------------- - * get next slot for a library entry, allocates memory if necessary - */ -LibraryEntryTypePtr GetLibraryEntryMemory(LibraryMenuTypePtr Menu) -{ - LibraryEntryTypePtr entry = Menu->Entry; - - /* realloc new memory if necessary and clear it */ - if (Menu->EntryN >= Menu->EntryMax) { - Menu->EntryMax += STEP_LIBRARYENTRY; - entry = (LibraryEntryTypePtr) realloc(entry, Menu->EntryMax * sizeof(LibraryEntryType)); - Menu->Entry = entry; - memset(entry + Menu->EntryN, 0, STEP_LIBRARYENTRY * sizeof(LibraryEntryType)); - } - return (entry + Menu->EntryN++); -} - -/* --------------------------------------------------------------------------- - * get next slot for a DrillElement, allocates memory if necessary - */ -ElementTypeHandle GetDrillElementMemory(DrillTypePtr Drill) -{ - ElementTypePtr *element; - - element = Drill->Element; - - /* realloc new memory if necessary and clear it */ - if (Drill->ElementN >= Drill->ElementMax) { - Drill->ElementMax += STEP_ELEMENT; - element = (ElementTypePtr *) realloc(element, Drill->ElementMax * sizeof(ElementTypeHandle)); - Drill->Element = element; - memset(element + Drill->ElementN, 0, STEP_ELEMENT * sizeof(ElementTypeHandle)); - } - return (element + Drill->ElementN++); -} - -/* --------------------------------------------------------------------------- - * get next slot for a DrillPoint, allocates memory if necessary - */ -PinTypeHandle GetDrillPinMemory(DrillTypePtr Drill) -{ - PinTypePtr *pin; - - pin = Drill->Pin; - - /* realloc new memory if necessary and clear it */ - if (Drill->PinN >= Drill->PinMax) { - Drill->PinMax += STEP_POINT; - pin = (PinTypePtr *) realloc(pin, Drill->PinMax * sizeof(PinTypeHandle)); - Drill->Pin = pin; - memset(pin + Drill->PinN, 0, STEP_POINT * sizeof(PinTypeHandle)); - } - return (pin + Drill->PinN++); -} - -/* --------------------------------------------------------------------------- - * get next slot for a Drill, allocates memory if necessary - */ -DrillTypePtr GetDrillInfoDrillMemory(DrillInfoTypePtr DrillInfo) -{ - DrillTypePtr drill = DrillInfo->Drill; - - /* realloc new memory if necessary and clear it */ - if (DrillInfo->DrillN >= DrillInfo->DrillMax) { - DrillInfo->DrillMax += STEP_DRILL; - drill = (DrillTypePtr) realloc(drill, DrillInfo->DrillMax * sizeof(DrillType)); - DrillInfo->Drill = drill; - memset(drill + DrillInfo->DrillN, 0, STEP_DRILL * sizeof(DrillType)); - } - return (drill + DrillInfo->DrillN++); -} - -/* --------------------------------------------------------------------------- - * frees memory used by a polygon - */ -void FreePolygonMemory(PolygonType * polygon) -{ - if (polygon == NULL) - return; - - free(polygon->Points); - free(polygon->HoleIndex); - - if (polygon->Clipped) - poly_Free(&polygon->Clipped); - poly_FreeContours(&polygon->NoHoles); - - reset_obj_mem(PolygonType, polygon); -} - -/* --------------------------------------------------------------------------- - * frees memory used by a box list - */ -void FreeBoxListMemory(BoxListTypePtr Boxlist) -{ - if (Boxlist) { - free(Boxlist->Box); - memset(Boxlist, 0, sizeof(BoxListType)); - } -} - -/* --------------------------------------------------------------------------- - * frees memory used by a net - */ -void FreeNetListMemory(NetListTypePtr Netlist) -{ - if (Netlist) { - NET_LOOP(Netlist); - { - FreeNetMemory(net); - } - END_LOOP; - free(Netlist->Net); - memset(Netlist, 0, sizeof(NetListType)); - } -} - -/* --------------------------------------------------------------------------- - * frees memory used by a net list - */ -void FreeNetListListMemory(NetListListTypePtr Netlistlist) -{ - if (Netlistlist) { - NETLIST_LOOP(Netlistlist); - { - FreeNetListMemory(netlist); - } - END_LOOP; - free(Netlistlist->NetList); - memset(Netlistlist, 0, sizeof(NetListListType)); - } -} - -/* --------------------------------------------------------------------------- - * frees memory used by a subnet - */ -void FreeNetMemory(NetTypePtr Net) -{ - if (Net) { - free(Net->Connection); - memset(Net, 0, sizeof(NetType)); - } -} - -/* --------------------------------------------------------------------------- - * frees memory used by an attribute list - */ -static void FreeAttributeListMemory(AttributeListTypePtr list) -{ - int i; - - for (i = 0; i < list->Number; i++) { - free(list->List[i].name); - free(list->List[i].value); - } - free(list->List); - list->List = NULL; - list->Max = 0; -} - -/* --------------------------------------------------------------------------- - * frees memory used by an element - */ -void FreeElementMemory(ElementType * element) -{ - if (element == NULL) - return; - - ELEMENTNAME_LOOP(element); - { - free(textstring); - } - END_LOOP; - PIN_LOOP(element); - { - free(pin->Name); - free(pin->Number); - } - END_LOOP; - PAD_LOOP(element); - { - free(pad->Name); - free(pad->Number); - } - END_LOOP; - - list_map0(&element->Pin, PinType, RemoveFreePin); - list_map0(&element->Pad, PadType, RemoveFreePad); - list_map0(&element->Line, LineType, RemoveFreeLine); - list_map0(&element->Arc, ArcType, RemoveFreeArc); - - FreeAttributeListMemory(&element->Attributes); - reset_obj_mem(ElementType, element); -} - -/* --------------------------------------------------------------------------- - * free memory used by PCB - */ -void FreePCBMemory(PCBType * pcb) -{ - int i; - - if (pcb == NULL) - return; - - free(pcb->Name); - free(pcb->Filename); - free(pcb->PrintFilename); - rats_patch_destroy(pcb); - FreeDataMemory(pcb->Data); - free(pcb->Data); - /* release font symbols */ - for (i = 0; i <= MAX_FONTPOSITION; i++) - free(pcb->Font.Symbol[i].Line); - for (i = 0; i < NUM_NETLISTS; i++) - FreeLibraryMemory(&(pcb->NetlistLib[i])); - vtroutestyle_uninit(&pcb->RouteStyle); - FreeAttributeListMemory(&pcb->Attributes); - /* clear struct */ - memset(pcb, 0, sizeof(PCBType)); -} - -/* --------------------------------------------------------------------------- - * free memory used by data struct - */ -void FreeDataMemory(DataType * data) -{ - LayerTypePtr layer; - int i; - - if (data == NULL) - return; - - VIA_LOOP(data); - { - free(via->Name); - } - END_LOOP; - list_map0(&data->Via, PinType, RemoveFreeVia); - ELEMENT_LOOP(data); - { - FreeElementMemory(element); - } - END_LOOP; - list_map0(&data->Element, ElementType, RemoveFreeElement); - list_map0(&data->Rat, RatType, RemoveFreeRat); - - for (layer = data->Layer, i = 0; i < MAX_LAYER + 2; layer++, i++) { - FreeAttributeListMemory(&layer->Attributes); - TEXT_LOOP(layer); - { - free(text->TextString); - } - END_LOOP; - if (layer->Name) - free((char*)layer->Name); - LINE_LOOP(layer); - { - if (line->Number) - free(line->Number); - } - END_LOOP; - - list_map0(&layer->Line, LineType, RemoveFreeLine); - list_map0(&layer->Arc, ArcType, RemoveFreeArc); - list_map0(&layer->Text, TextType, RemoveFreeText); - POLYGON_LOOP(layer); - { - FreePolygonMemory(polygon); - } - END_LOOP; - list_map0(&layer->Polygon, PolygonType, RemoveFreePolygon); - if (layer->line_tree) - r_destroy_tree(&layer->line_tree); - if (layer->arc_tree) - r_destroy_tree(&layer->arc_tree); - if (layer->text_tree) - r_destroy_tree(&layer->text_tree); - if (layer->polygon_tree) - r_destroy_tree(&layer->polygon_tree); - } - - if (data->element_tree) - r_destroy_tree(&data->element_tree); - for (i = 0; i < MAX_ELEMENTNAMES; i++) - if (data->name_tree[i]) - r_destroy_tree(&data->name_tree[i]); - if (data->via_tree) - r_destroy_tree(&data->via_tree); - if (data->pin_tree) - r_destroy_tree(&data->pin_tree); - if (data->pad_tree) - r_destroy_tree(&data->pad_tree); - if (data->rat_tree) - r_destroy_tree(&data->rat_tree); - /* clear struct */ - memset(data, 0, sizeof(DataType)); -} - -/* --------------------------------------------------------------------------- - * releases the memory that's allocated by the library - */ -void FreeLibraryMemory(LibraryTypePtr lib) -{ - MENU_LOOP(lib); - { - ENTRY_LOOP(menu); - { - if (!entry->ListEntry_dontfree) - free((char*)entry->ListEntry); - } - END_LOOP; - free(menu->Entry); - free(menu->Name); - free(menu->directory); - } - END_LOOP; - free(lib->Menu); - - /* clear struct */ - memset(lib, 0, sizeof(LibraryType)); -} - -/* --------------------------------------------------------------------------- - * strips leading and trailing blanks from the passed string and - * returns a pointer to the new 'duped' one or NULL if the old one - * holds only white space characters - */ -char *StripWhiteSpaceAndDup(const char *S) -{ - const char *p1, *p2; - char *copy; - size_t length; - - if (!S || !*S) - return (NULL); - - /* strip leading blanks */ - for (p1 = S; *p1 && isspace((int) *p1); p1++); - - /* strip trailing blanks and get string length */ - length = strlen(p1); - for (p2 = p1 + length - 1; length && isspace((int) *p2); p2--, length--); - - /* string is not empty -> allocate memory */ - if (length) { - copy = (char *) realloc(NULL, length + 1); - strncpy(copy, p1, length); - copy[length] = '\0'; - return (copy); - } - else - return (NULL); -} - -LineType *GetElementLineMemory(ElementType *Element) -{ - LineType *line = calloc(sizeof(LineType), 1); - linelist_append(&Element->Line, line); - - return line; -} - -ArcType *GetElementArcMemory(ElementType *Element) -{ - ArcType *arc = calloc(sizeof(ArcType), 1); - - arclist_append(&Element->Arc, arc); - return arc; -} Index: 1.1.4/src/ht_element.c =================================================================== --- 1.1.4/src/ht_element.c (revision 10776) +++ 1.1.4/src/ht_element.c (nonexistent) @@ -1,216 +0,0 @@ -#include "global.h" -#include "list_element.h" - -#define HT(x) htep_ ## x -#include -#undef HT - - -#warning TODO: move these in the big split - -/* compare two strings and return 0 if they are equal. NULL == NULL means equal. */ -static int neqs(const char *s1, const char *s2) -{ - if ((s1 == NULL) && (s2 == NULL)) return 0; - if ((s1 == NULL) || (s2 == NULL)) return 1; - return strcmp(s1, s2) != 0; -} - -/* compare two fields and return 0 if they are equal */ -#define neq(s1, s2, f) ((s1)->f != (s2)->f) - -#define eoffs(e,ef, s,sf) ((e == NULL) ? (s)->sf : ((s)->sf) - ((e)->ef)) -#define neqox(e1, x1, e2, x2, f) (eoffs(e1, MarkX, x1, f) != eoffs(e2, MarkX, x2, f)) -#define neqoy(e1, y1, e2, y2, f) (eoffs(e1, MarkY, y1, f) != eoffs(e2, MarkY, y2, f)) - -static inline unsigned h_coord(Coord c) -{ - return murmurhash(&(c), sizeof(Coord)); -} - -#define h_coordox(e, c) ((e) == NULL ? h_coord(c) : h_coord(c - e->MarkX)) -#define h_coordoy(e, c) ((e) == NULL ? h_coord(c) : h_coord(c - e->MarkY)) - -#define h_str(s) ((s) == NULL ? 0 : strhash(s)) - -int pcb_pin_eq(const ElementType *e1, const PinType *p1, const ElementType *e2, const PinType *p2) -{ - if (neq(p1, p2, Thickness) || neq(p1, p2, Clearance)) return 0; - if (neq(p1, p2, Mask) || neq(p1, p2, DrillingHole)) return 0; - if (neqox(e1, p1, e2, p2, X) || neqoy(e1, p1, e2, p2, Y)) return 0; - if (neqs(p1->Name, p2->Name)) return 0; - if (neqs(p1->Number, p2->Number)) return 0; - return 1; -} - -unsigned int pcb_pin_hash(const ElementType *e, const PinType *p) -{ - return - h_coord(p->Thickness) ^ h_coord(p->Clearance) ^ - h_coord(p->Mask) ^ h_coord(p->DrillingHole) ^ - h_coordox(e, p->X) ^ h_coordoy(e, p->Y) ^ - h_str(p->Name) ^ h_str(p->Number); -} - -int pcb_pad_eq(const ElementType *e1, const PadType *p1, const ElementType *e2, const PadType *p2) -{ - if (neq(p1, p2, Thickness) || neq(p1, p2, Clearance)) return 0; - if (neqox(e1, p1, e2, p2, Point1.X) || neqoy(e1, p1, e2, p2, Point1.Y)) return 0; - if (neqox(e1, p1, e2, p2, Point2.X) || neqoy(e1, p1, e2, p2, Point2.Y)) return 0; - if (neq(p1, p2, Mask)) return 0; - if (neqs(p1->Name, p2->Name)) return 0; - if (neqs(p1->Number, p2->Number)) return 0; - return 1; -} - -unsigned int pcb_pad_hash(const ElementType *e, const PadType *p) -{ - return - h_coord(p->Thickness) ^ h_coord(p->Clearance) ^ - h_coordox(e, p->Point1.X) ^ h_coordoy(e, p->Point1.Y) ^ - h_coordox(e, p->Point2.X) ^ h_coordoy(e, p->Point2.Y) ^ - h_coord(p->Mask) ^ - h_str(p->Name) ^ h_str(p->Number); -} - - -int pcb_line_eq(const ElementType *e1, const LineType *l1, const ElementType *e2, const LineType *l2) -{ - if (neq(l1, l2, Thickness) || neq(l1, l2, Clearance)) return 0; - if (neqox(e1, l1, e2, l2, Point1.X) || neqoy(e1, l1, e2, l2, Point1.Y)) return 0; - if (neqox(e1, l1, e2, l2, Point2.X) || neqoy(e1, l1, e2, l2, Point2.Y)) return 0; - if (neqs(l1->Number, l2->Number)) return 0; - return 1; -} - - -unsigned int pcb_line_hash(const ElementType *e, const LineType *l) -{ - return - h_coord(l->Thickness) ^ h_coord(l->Clearance) ^ - h_coordox(e, l->Point1.X) ^ h_coordoy(e, l->Point1.Y) ^ - h_coordox(e, l->Point2.X) ^ h_coordoy(e, l->Point2.Y) ^ - h_str(l->Number); -} - -int pcb_arc_eq(const ElementType *e1, const ArcType *a1, const ElementType *e2, const ArcType *a2) -{ - if (neq(a1, a2, Thickness) || neq(a1, a2, Clearance)) return 0; - if (neq(a1, a2, Width) || neq(a1, a2, Height)) return 0; - if (neqox(e1, a1, e2, a2, X) || neqoy(e1, a1, e2, a2, Y)) return 0; - if (neq(a1, a2, StartAngle) || neq(a1, a2, Delta)) return 0; - - return 1; -} - -unsigned int pcb_arc_hash(const ElementType *e, const ArcType *a) -{ - return - h_coord(a->Thickness) ^ h_coord(a->Clearance) ^ - h_coord(a->Width) ^ h_coord(a->Height) ^ - h_coordox(e, a->X) ^ h_coordoy(e, a->Y) ^ - h_coord(a->StartAngle) ^ h_coord(a->Delta); -} - -#undef h_coord -#undef neq - -unsigned int pcb_element_hash(const ElementType *e) -{ - unsigned int val = 0; - gdl_iterator_t it; - - { - PinType *p; - pinlist_foreach(&e->Pin, &it, p) { - val ^= pcb_pin_hash(e, p); - } - } - - { - PadType *p; - padlist_foreach(&e->Pad, &it, p) { - val ^= pcb_pad_hash(e, p); - } - } - - { - LineType *l; - linelist_foreach(&e->Line, &it, l) { - val ^= pcb_line_hash(e, l); - } - } - - { - ArcType *a; - linelist_foreach(&e->Arc, &it, a) { - val ^= pcb_arc_hash(e, a); - } - } - - return val; -} - -int pcb_element_eq(const ElementType *e1, const ElementType *e2) -{ - /* Require the same objects in the same order - bail out at the first mismatch */ - - { - PinType *p1, *p2; - p1 = pinlist_first((pinlist_t *)&e1->Pin); - p2 = pinlist_first((pinlist_t *)&e2->Pin); - for(;;) { - if ((p1 == NULL) && (p2 == NULL)) - break; - if (!pcb_pin_eq(e1, p1, e2, p2)) - return 0; - p1 = pinlist_next(p1); - p2 = pinlist_next(p2); - } - } - - { - PadType *p1, *p2; - p1 = padlist_first((padlist_t *)&e1->Pad); - p2 = padlist_first((padlist_t *)&e2->Pad); - for(;;) { - if ((p1 == NULL) && (p2 == NULL)) - break; - if (!pcb_pad_eq(e1, p1, e2, p2)) - return 0; - p1 = padlist_next(p1); - p2 = padlist_next(p2); - } - } - - { - LineType *l1, *l2; - l1 = linelist_first((linelist_t *)&e1->Line); - l2 = linelist_first((linelist_t *)&e2->Line); - for(;;) { - if ((l1 == NULL) && (l2 == NULL)) - break; - if (!pcb_line_eq(e1, l1, e2, l2)) - return 0; - l1 = linelist_next(l1); - l2 = linelist_next(l2); - } - } - - { - ArcType *a1, *a2; - a1 = arclist_first((arclist_t *)&e1->Arc); - a2 = arclist_first((arclist_t *)&e2->Arc); - for(;;) { - if ((a1 == NULL) && (a2 == NULL)) - break; - if (!pcb_arc_eq(e1, a1, e2, a2)) - return 0; - a1 = arclist_next(a1); - a2 = arclist_next(a2); - } - } - - return 1; -} - Index: 1.1.4/src/main.c =================================================================== --- 1.1.4/src/main.c (revision 10776) +++ 1.1.4/src/main.c (nonexistent) @@ -1,522 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2004 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* main program, initializes some stuff and handles user input - */ -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include -#include /* Seed for srand() */ -#include - -#include "data.h" -#include "buffer.h" -#include "create.h" -#include "crosshair.h" -#include "error.h" -#include "plug_io.h" -#include "set.h" -#include "layer.h" -#include "misc.h" -#include "compat_lrealpath.h" -#include "free_atexit.h" -#include "polygon.h" -#include "buildin.h" -#include "paths.h" -#include "strflags.h" -#include "plugins.h" -#include "plug_footprint.h" -#include "event.h" -#include "funchash.h" -#include "conf.h" -#include "conf_core.h" - -#include "hid_actions.h" -#include "hid_attrib.h" -#include "hid_init.h" -#include "compat_misc.h" - -#if ENABLE_NLS -#include -#endif - -/* ---------------------------------------------------------------------- - * initialize signal and error handlers - */ -static void InitHandler(void) -{ -#ifdef PCB_HAVE_SIGHUP - signal(SIGHUP, CatchSignal); -#endif -#ifdef PCB_HAVE_SIGQUIT - signal(SIGQUIT, CatchSignal); -#endif -#ifdef PCB_HAVE_SIGTERM - signal(SIGTERM, CatchSignal); -#endif -#ifdef PCB_HAVE_SIGINT - signal(SIGINT, CatchSignal); -#endif - -#ifdef NDEBUG -/* so that we get a core dump on segfault in debug mode */ -# ifdef PCB_HAVE_SIGABRT - signal(SIGABRT, CatchSignal); -# endif -# ifdef PCB_HAVE_SIGSEGV - signal(SIGSEGV, CatchSignal); -# endif -#endif - - /* calling external program by popen() may cause a PIPE signal, - * so we ignore it - */ -#ifdef SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif -} - -/* ---------------------------------------------------------------------- - * Figure out the canonical name of the executed program - * and fix up the defaults for various paths - */ - -static void InitPaths(char *argv0) -{ - size_t l; - int haspath; - char *t1, *t2; - int found_bindir = 0; - char *exec_prefix = NULL; - char *bindir = NULL; - - - /* see if argv0 has enough of a path to let lrealpath give the - * real path. This should be the case if you invoke pcb with - * something like /usr/local/bin/pcb or ./pcb or ./foo/pcb - * but if you just use pcb and it exists in your path, you'll - * just get back pcb again. - */ - -#ifndef NO_BINDIR_HEURISTICS - { - int i; - haspath = 0; - for (i = 0; i < strlen(argv0); i++) { - if (argv0[i] == PCB_DIR_SEPARATOR_C) - haspath = 1; - } - } -#endif - -#ifdef DEBUG - printf("InitPaths (%s): haspath = %d\n", argv0, haspath); -#endif - - if (haspath) { -#ifndef NO_BINDIR_HEURISTICS - bindir = pcb_strdup(lrealpath(argv0)); -#endif - found_bindir = 1; - } - else { - char *path, *p, *tmps; - struct stat sb; - int r; - - tmps = getenv("PATH"); - - if (tmps != NULL) { - path = pcb_strdup(tmps); - - /* search through the font path for a font file */ - for (p = strtok(path, PCB_PATH_DELIMETER); p && *p; p = strtok(NULL, PCB_PATH_DELIMETER)) { -#ifdef DEBUG - printf("Looking for %s in %s\n", argv0, p); -#endif - if ((tmps = (char *) malloc((strlen(argv0) + strlen(p) + 2) * sizeof(char))) == NULL) { - fprintf(stderr, "InitPaths(): malloc failed\n"); - exit(1); - } - sprintf(tmps, "%s%s%s", p, PCB_DIR_SEPARATOR_S, argv0); - r = stat(tmps, &sb); - if (r == 0) { -#ifdef DEBUG - printf("Found it: \"%s\"\n", tmps); -#endif - bindir = lrealpath(tmps); - found_bindir = 1; - free(tmps); - break; - } - free(tmps); - } - free(path); - } - } - - if (found_bindir) { - /* strip off the executable name leaving only the path */ - t2 = NULL; - t1 = strchr(bindir, PCB_DIR_SEPARATOR_C); - while (t1 != NULL && *t1 != '\0') { - t2 = t1; - t1 = strchr(t2 + 1, PCB_DIR_SEPARATOR_C); - } - if (t2 != NULL) - *t2 = '\0'; - } - else { - /* we have failed to find out anything from argv[0] so fall back to the original - * install prefix - */ - bindir = pcb_strdup(BINDIR); - } - - /* now find the path to exec_prefix */ - l = strlen(bindir) + 1 + strlen(BINDIR_TO_EXECPREFIX) + 1; - if ((exec_prefix = (char *) malloc(l * sizeof(char))) == NULL) { - fprintf(stderr, "InitPaths(): malloc failed\n"); - exit(1); - } - sprintf(exec_prefix, "%s%s%s", bindir, PCB_DIR_SEPARATOR_S, BINDIR_TO_EXECPREFIX); - conf_set(CFR_INTERNAL, "rc/path/exec_prefix", -1, exec_prefix, POL_OVERWRITE); - free(exec_prefix); - free(bindir); -} - -/* ---------------------------------------------------------------------- - * main program - */ - -#include "dolists.h" - -static char **hid_argv_orig; - -void pcb_main_uninit(void) -{ - if (conf_isdirty(CFR_USER)) - conf_save_file(NULL, NULL, CFR_USER, NULL); - - UninitBuffers(); - - /* Free up memory allocated to the PCB. Why bother when we're about to exit ? - * Because it removes some false positives from heap bug detectors such as - * lib dmalloc. - */ - FreePCBMemory(PCB); - free(PCB); - PCB = NULL; - - plugins_uninit(); - hid_uninit(); - events_uninit(); - - uninit_strflags_buf(); - uninit_strflags_layerlist(); - - fp_uninit(); - fp_host_uninit(); - funchash_uninit(); - free(hid_argv_orig); - conf_uninit(); -} - -static int arg_match(const char *in, const char *shrt, const char *lng) -{ - return ((shrt != NULL) && (strcmp(in, shrt) == 0)) || ((lng != NULL) && (strcmp(in, lng) == 0)); -} - -const char *pcb_action_args[] = { -/*short, -long, action, help */ - NULL, "-show-actions", "PrintActions()", "Print all available actions (human readable) and exit", - NULL, "-dump-actions", "DumpActions()", "Print all available actions (script readable) and exit", - NULL, "-show-paths", "PrintPaths()", "Print all configured paths and exit", - NULL, "-dump-config", "dumpconf(native,1)", "Print the config tree and exit", - "V", "-version", "PrintVersion()", "Print version info and exit", - NULL, "-copyright", "PrintCopyright()", "Print copyright and exit", - NULL, NULL, NULL /* terminator */ -}; - -int main(int argc, char *argv[]) -{ - enum { - DO_SOMETHING, - DO_PRINT, - DO_EXPORT, - DO_GUI - } do_what = DO_SOMETHING; - int n, hid_argc = 0; - char *cmd, *arg, *hid_name = NULL, **hid_argv; - const char **cs; - const char *main_action = NULL; - char *command_line_pcb = NULL; - - hid_argv_orig = hid_argv = calloc(sizeof(char *), argc); - /* init application: - * - make program name available for error handlers - * - initialize infrastructure (e.g. the conf system) - * - evaluate options - * - create an empty PCB with default symbols - * - register 'call on exit()' function - */ - - /* Minimal conf setup before we do anything else */ - conf_init(); - conf_core_init(); - conf_core_postproc(); /* to get all the paths initialized */ - - /* process arguments */ - for(n = 1; n < argc; n++) { - cmd = argv[n]; - arg = argv[n+1]; - if (*cmd == '-') { - cmd++; - if ((strcmp(cmd, "?") == 0) || (strcmp(cmd, "h") == 0) || (strcmp(cmd, "-help") == 0)) { - if (arg != NULL) { - /* memory leak, but who cares for --help? */ - main_action = pcb_strdup_printf("PrintUsage(%s)", arg); - n++; - } - else - main_action = "PrintUsage()"; - goto next_arg; - } - if ((strcmp(cmd, "g") == 0) || (strcmp(cmd, "-gui") == 0)) { - do_what = DO_GUI; - hid_name = arg; - n++; - goto next_arg; - } - if ((strcmp(cmd, "x") == 0) || (strcmp(cmd, "-export") == 0)) { - do_what = DO_EXPORT; - hid_name = arg; - n++; - goto next_arg; - } - if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "-print") == 0)) { - do_what = DO_PRINT; - goto next_arg; - } - - for(cs = pcb_action_args; cs[2] != NULL; cs += 4) { - if (arg_match(cmd, cs[0], cs[1])) { - if (main_action == NULL) - main_action = cs[2]; - else - fprintf(stderr, "Warning: can't execute multiple command line actions, ignoring %s\n", argv[n]); - goto next_arg; - } - } - if (arg_match(cmd, "c", "-conf")) { - const char *why; - n++; /* eat up arg */ - if (conf_set_from_cli(NULL, arg, NULL, &why) != 0) { - fprintf(stderr, "Error: failed to set config %s: %s\n", arg, why); - exit(1); - } - goto next_arg; - } - } - - /* didn't handle argument, save it for the HID */ - hid_argv[hid_argc++] = argv[n]; - - next_arg:; - } - conf_load_all(NULL, NULL); - - setbuf(stdout, 0); - InitPaths(argv[0]); - - fp_init(); - -#ifdef LOCALEDIR - bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); - textdomain(GETTEXT_PACKAGE); - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); - setlocale(LC_ALL, ""); -#endif - - srand(time(NULL)); /* Set seed for rand() */ - - funchash_init(); - initialize_units(); - polygon_init(); - - /* This must be called before any other atexit functions - * are registered, as it configures an atexit function to - * clean up and free various items of allocated memory, - * and must be the last last atexit function to run. - */ - leaky_init(); - - /* Register a function to be called when the program terminates. - * This makes sure that data is saved even if LEX/YACC routines - * abort the program. - * If the OS doesn't have at least one of them, - * the critical sections will be handled by parse_l.l - */ - atexit(EmergencySave); - - events_init(); - - buildin_init(); - hid_init(); - plugins_init(); - - - /* Export pcb from command line if requested. */ - switch(do_what) { - case DO_PRINT: exporter = gui = hid_find_printer(); break; - case DO_EXPORT: exporter = gui = hid_find_exporter(hid_name); break; - case DO_GUI: - gui = hid_find_gui(argv[2]); - if (gui == NULL) { - Message(PCB_MSG_DEFAULT, "Can't find the gui requested.\n"); - exit(1); - } - break; - default: { - conf_listitem_t *i; - int n; - const char *g; - - gui = NULL; - conf_loop_list_str(&conf_core.rc.preferred_gui, i, g, n) { - gui = hid_find_gui(g); - if (gui != NULL) - break; - } - - /* try anything */ - if (gui == NULL) { - Message(PCB_MSG_DEFAULT, "Warning: can't find any of the preferred GUIs, falling back to anything available...\n"); - gui = hid_find_gui(NULL); - } - } - } - - /* Exit with error if GUI failed to start. */ - if (!gui) - exit(1); - -/* Initialize actions only when the gui is already known so only the right - one is registered (there can be only one GUI). */ -#include "generated_lists.h" - - /* plugins may have installed their new fields, reinterpret the config - (memory lht -> memory bin) to get the new fields */ - conf_update(NULL); - - if (main_action != NULL) { - hid_parse_command(main_action); - exit(0); - } - - gui->parse_arguments(&hid_argc, &hid_argv); - - /* Create a new PCB object in memory */ - PCB = CreateNewPCB(); - - if (PCB == NULL) { - Message(PCB_MSG_ERROR, "Can't load the default pcb for creating an empty layout\n"); - exit(1); - } - - /* Add silk layers to newly created PCB */ - CreateNewPCBPost(PCB, 1); - if (hid_argc > 0) - command_line_pcb = hid_argv[0]; - - ResetStackAndVisibility(); - - if (gui->gui) - InitCrosshair(); - InitHandler(); - InitBuffers(); - - SetMode(PCB_MODE_ARROW); - - if (command_line_pcb) { - /* keep filename even if initial load command failed; - * file might not exist - */ - if (LoadPCB(command_line_pcb, NULL, pcb_true, 0)) - PCB->Filename = pcb_strdup(command_line_pcb); - } - - if (conf_core.design.initial_layer_stack && conf_core.design.initial_layer_stack[0]) { - LayerStringToLayerStack(conf_core.design.initial_layer_stack); - } - - /* read the library file and display it if it's not empty - */ - if (!fp_read_lib_all() && library.data.dir.children.used) - hid_action("LibraryChanged"); - - if (conf_core.rc.script_filename) { - Message(PCB_MSG_DEFAULT, _("Executing startup script file %s\n"), conf_core.rc.script_filename); - hid_actionl("ExecuteFile", conf_core.rc.script_filename, NULL); - } - if (conf_core.rc.action_string) { - Message(PCB_MSG_DEFAULT, _("Executing startup action %s\n"), conf_core.rc.action_string); - hid_parse_actions(conf_core.rc.action_string); - } - - if (gui->printer || gui->exporter) { - /* Workaround to fix batch output for non-C locales */ - setlocale(LC_NUMERIC, "C"); - gui->do_export(0); - exit(0); - } - - EnableAutosave(); - - /* main loop */ - do { - gui->do_export(0); - gui = next_gui; - next_gui = NULL; - if (gui != NULL) { - /* init the next GUI */ - gui->parse_arguments(&hid_argc, &hid_argv); - if (gui->gui) - InitCrosshair(); - SetMode(PCB_MODE_ARROW); - hid_action("LibraryChanged"); - } - } while(gui != NULL); - - pcb_main_uninit(); - - return (0); -} Index: 1.1.4/src/list_element.c =================================================================== --- 1.1.4/src/list_element.c (revision 10776) +++ 1.1.4/src/list_element.c (nonexistent) @@ -1,30 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - - -#include "global.h" -#undef LIST_ELEMENT_H -#define LIST_ELEMENT_NOINSTANT -#define TDL_DONT_UNDEF -#include "list_element.h" -#include Index: 1.1.4/src/hid_cfg_action.h =================================================================== --- 1.1.4/src/hid_cfg_action.h (revision 10776) +++ 1.1.4/src/hid_cfg_action.h (nonexistent) @@ -1,27 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - -#include "hid_cfg.h" -/* Run an action node. The node is either a list of text nodes or a text node; - returns non-zero on error, the first action that fails in a chain breaks the chain */ -int hid_cfg_action(const lht_node_t *node); Index: 1.1.4/src/find.h =================================================================== --- 1.1.4/src/find.h (revision 10776) +++ 1.1.4/src/find.h (nonexistent) @@ -1,96 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes connection search routines */ - -#ifndef PCB_FIND_H -#define PCB_FIND_H - -#include /* needed to define 'FILE *' */ -#include "global.h" - -typedef enum { - FCT_COPPER = 1, /* copper connection */ - FCT_INTERNAL = 2, /* element-internal connection */ - FCT_RAT = 4, /* connected by a rat line */ - FCT_ELEMENT = 8, /* pin/pad is part of an element whose pins/pads are being listed */ - FCT_START = 16 /* starting object of a query */ -} found_conn_type_t; - -typedef void (*find_callback_t) (int current_type, void *current_ptr, int from_type, void *from_ptr, - found_conn_type_t conn_type); - - -/* if not NULL, this function is called whenever something is found - (in LookupConnections for example). The caller should save the original - value and set that back around the call, if the callback needs to be changed. - */ -extern find_callback_t find_callback; - -/* --------------------------------------------------------------------------- - * some local defines - */ -#define LOOKUP_FIRST \ - (PCB_TYPE_PIN | PCB_TYPE_PAD) -#define LOOKUP_MORE \ - (PCB_TYPE_VIA | PCB_TYPE_LINE | PCB_TYPE_RATLINE | PCB_TYPE_POLYGON | PCB_TYPE_ARC) -#define SILK_TYPE \ - (PCB_TYPE_LINE | PCB_TYPE_ARC | PCB_TYPE_POLYGON) - -pcb_bool LineLineIntersect(LineTypePtr, LineTypePtr); -pcb_bool LineArcIntersect(LineTypePtr, ArcTypePtr); -pcb_bool PinLineIntersect(PinTypePtr, LineTypePtr); -pcb_bool LinePadIntersect(LineTypePtr, PadTypePtr); -pcb_bool ArcPadIntersect(ArcTypePtr, PadTypePtr); -pcb_bool IsPolygonInPolygon(PolygonTypePtr, PolygonTypePtr); -void LookupElementConnections(ElementTypePtr, FILE *); -void LookupConnectionsToAllElements(FILE *); -void LookupConnection(Coord, Coord, pcb_bool, Coord, int); -void LookupConnectionByPin(int type, void *ptr1); -void LookupUnusedPins(FILE *); -pcb_bool ResetFoundLinesAndPolygons(pcb_bool); -pcb_bool ResetFoundPinsViasAndPads(pcb_bool); -pcb_bool ResetConnections(pcb_bool); -void InitConnectionLookup(void); -void InitComponentLookup(void); -void InitLayoutLookup(void); -void FreeConnectionLookupMemory(void); -void FreeComponentLookupMemory(void); -void FreeLayoutLookupMemory(void); -void RatFindHook(int, void *, void *, void *, pcb_bool, pcb_bool); -void SaveFindFlag(int); -void RestoreFindFlag(void); -int DRCAll(void); -pcb_bool IsLineInPolygon(LineTypePtr, PolygonTypePtr); -pcb_bool IsArcInPolygon(ArcTypePtr, PolygonTypePtr); -pcb_bool IsPadInPolygon(PadTypePtr, PolygonTypePtr); - -/* find_clear.c */ -pcb_bool ClearFlagOnPinsViasAndPads(pcb_bool AndDraw, int flag); -pcb_bool ClearFlagOnLinesAndPolygons(pcb_bool AndDraw, int flag); -pcb_bool ClearFlagOnAllObjects(pcb_bool AndDraw, int flag); - -#endif Index: 1.1.4/src/compat_inc.h.in =================================================================== --- 1.1.4/src/compat_inc.h.in (revision 10776) +++ 1.1.4/src/compat_inc.h.in (nonexistent) @@ -1,36 +0,0 @@ -put /local/pcb/compat_inc [@ - -@?libs/ldl/includes@ -@?libs/LoadLibrary/includes@ -@?libs/fs/getcwd/includes@ -@?libs/fs/_getcwd/includes@ -@?libs/fs/getwd/includes@ -@?/target/libs/proc/wait/includes@ -@?/target/libs/proc/fork/includes@ -@?/target/libs/proc/_spawnvp/includes@ -@?/target/libs/fs/mkdir/includes@ -@?/target/libs/fs/_mkdir/includes@ -@?/target/libs/fs/mkdtemp/includes@ -@?/target/libs/fs/readdir/includes@ -@?/target/libs/userpass/getpwuid/includes@ -@?/target/libs/math/round/includes@ -@] - -put /tmpasm/IFS {\n} -uniq /local/pcb/compat_inc -gsub /local/pcb/compat_inc {\\\\n *} {\n} - - -print [@ -/*** DO NOT EDIT - automatically generated by scconfig ***/ - -/* system-dependent includes, as detected in ./configure */ - -@/local/pcb/compat_inc@ - -/* These are required for stat() but are C89. Keeping them here, just in case. */ -#include -#include - -@] - Index: 1.1.4/src/plugins.h =================================================================== --- 1.1.4/src/plugins.h (revision 10776) +++ 1.1.4/src/plugins.h (nonexistent) @@ -1,108 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2015 Tibor 'Igor2' Palinkas - * - * This module, rats.c, was written and is Copyright (C) 1997 by harry eaton - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_RND_PLUGINS_H -#define PCB_RND_PLUGINS_H - -typedef struct plugin_info_s plugin_info_t; - -typedef void (*pcb_uninit_t)(void); - -struct plugin_info_s { - char *name; - char *path; - void *handle; - int dynamic_loaded; - pcb_uninit_t uninit; - plugin_info_t *next; -}; - -extern plugin_info_t *plugins; - -/* Init the plugin system */ -void plugins_init(void); - -/* Uninit each plugin then uninit the plugin system */ -void plugins_uninit(void); - -/* Register a new plugin (or buildin) */ -void plugin_register(const char *name, const char *path, void *handle, int dynamic, pcb_uninit_t uninit); - -/* Find a plugin by name */ -plugin_info_t *plugin_find(const char *name); - -/* Hook based plugin generics; plugins that implement a common API should use - HOOK_REGISTER with an api struct. The core should run the plugins using - HOOK_CALL */ - -#define HOOK_CALL_DO(chain_type, chain, func, res, accept, funcargs, do_on_success) \ -do { \ - chain_type *self; \ - for(self = (chain); self != NULL; self = self->next) { \ - if (self->func == NULL) \ - continue; \ - res = self->func funcargs; \ - if (res accept) {\ - do_on_success; \ - break; \ - } \ - } \ -} while(0) - -#define HOOK_CALL(chain_type, chain, func, res, accept, funcargs) \ - HOOK_CALL_DO(chain_type, chain, func, res, accept, funcargs, (void)0) - -#define HOOK_CALL_ALL(chain_type, chain, func, cb, funcargs) \ -do { \ - chain_type *self; \ - for(self = (chain); self != NULL; self = self->next) { \ - int res; \ - if (self->func == NULL) \ - continue; \ - res = self->func funcargs; \ - cb(self, res); \ - } \ -} while(0) - -#define HOOK_REGISTER(chain_type, chain, hstruct) \ -do { \ - (hstruct)->next = chain; \ - chain = (hstruct); \ -} while(0) - - -#define HOOK_UNREGISTER(chain_type, chain, hstruct) \ -do { \ - chain_type *__n__, *__prev__ = NULL, *__h__ = (hstruct); \ - for(__n__ = chain; __n__ != NULL; __n__ = __n__->next) { \ - if ((__n__ == __h__) && (__prev__ != NULL)) \ - __prev__->next = __n__->next; \ - __prev__ = __n__; \ - } \ - if (chain == __n__) \ - chain = chain->next; \ -} while(0) - -#endif Index: 1.1.4/src/find_debug.c =================================================================== --- 1.1.4/src/find_debug.c (revision 10776) +++ 1.1.4/src/find_debug.c (nonexistent) @@ -1,135 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - -/* find-related debug functions */ - -/* --------------------------------------------------------------------------- - * writes the several names of an element to a file - */ -static void PrintElementNameList(ElementTypePtr Element, FILE * FP) -{ - fputc('(', FP); - PrintQuotedString(FP, (char *) EMPTY(DESCRIPTION_NAME(Element))); - fputc(' ', FP); - PrintQuotedString(FP, (char *) EMPTY(NAMEONPCB_NAME(Element))); - fputc(' ', FP); - PrintQuotedString(FP, (char *) EMPTY(VALUE_NAME(Element))); - fputc(')', FP); - fputc('\n', FP); -} - -/* --------------------------------------------------------------------------- - * writes the several names of an element to a file - */ -static void PrintConnectionElementName(ElementTypePtr Element, FILE * FP) -{ - fputs("Element", FP); - PrintElementNameList(Element, FP); - fputs("{\n", FP); -} - -/* --------------------------------------------------------------------------- - * prints one {pin,pad,via}/element entry of connection lists - */ -static void PrintConnectionListEntry(char *ObjName, ElementTypePtr Element, pcb_bool FirstOne, FILE * FP) -{ - if (FirstOne) { - fputc('\t', FP); - PrintQuotedString(FP, ObjName); - fprintf(FP, "\n\t{\n"); - } - else { - fprintf(FP, "\t\t"); - PrintQuotedString(FP, ObjName); - fputc(' ', FP); - if (Element) - PrintElementNameList(Element, FP); - else - fputs("(__VIA__)\n", FP); - } -} - -/* --------------------------------------------------------------------------- - * prints all found connections of a pads to file FP - * the connections are stacked in 'PadList' - */ -static void PrintPadConnections(pcb_cardinal_t Layer, FILE * FP, pcb_bool IsFirst) -{ - pcb_cardinal_t i; - PadTypePtr ptr; - - if (!PadList[Layer].Number) - return; - - /* the starting pad */ - if (IsFirst) { - ptr = PADLIST_ENTRY(Layer, 0); - if (ptr != NULL) - PrintConnectionListEntry((char *) UNKNOWN(ptr->Name), NULL, pcb_true, FP); - else - printf("Skipping NULL ptr in 1st part of PrintPadConnections\n"); - } - - /* we maybe have to start with i=1 if we are handling the - * starting-pad itself - */ - for (i = IsFirst ? 1 : 0; i < PadList[Layer].Number; i++) { - ptr = PADLIST_ENTRY(Layer, i); - if (ptr != NULL) - PrintConnectionListEntry((char *) EMPTY(ptr->Name), (ElementTypePtr) ptr->Element, pcb_false, FP); - else - printf("Skipping NULL ptr in 2nd part of PrintPadConnections\n"); - } -} - -/* --------------------------------------------------------------------------- - * prints all found connections of a pin to file FP - * the connections are stacked in 'PVList' - */ -static void PrintPinConnections(FILE * FP, pcb_bool IsFirst) -{ - pcb_cardinal_t i; - PinTypePtr pv; - - if (!PVList.Number) - return; - - if (IsFirst) { - /* the starting pin */ - pv = PVLIST_ENTRY(0); - PrintConnectionListEntry((char *) EMPTY(pv->Name), NULL, pcb_true, FP); - } - - /* we maybe have to start with i=1 if we are handling the - * starting-pin itself - */ - for (i = IsFirst ? 1 : 0; i < PVList.Number; i++) { - /* get the elements name or assume that its a via */ - pv = PVLIST_ENTRY(i); - PrintConnectionListEntry((char *) EMPTY(pv->Name), (ElementTypePtr) pv->Element, pcb_false, FP); - } -} Index: 1.1.4/src/line.c =================================================================== --- 1.1.4/src/line.c (revision 10776) +++ 1.1.4/src/line.c (nonexistent) @@ -1,534 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 2004 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include - -#include "data.h" -#include "crosshair.h" -#include "find.h" -#include "line.h" -#include "misc.h" -#include "rtree.h" -#include "layer.h" - -static double drc_lines(PointTypePtr end, pcb_bool way); - -/* --------------------------------------------------------------------------- - * Adjust the attached line to 45 degrees if necessary - */ -void AdjustAttachedLine(void) -{ - AttachedLineTypePtr line = &Crosshair.AttachedLine; - - /* I need at least one point */ - if (line->State == STATE_FIRST) - return; - /* don't draw outline when ctrl key is pressed */ - if (conf_core.editor.mode == PCB_MODE_LINE && gui->control_is_pressed()) { - line->draw = pcb_false; - return; - } - else - line->draw = pcb_true; - /* no 45 degree lines required */ - if (PCB->RatDraw || conf_core.editor.all_direction_lines) { - line->Point2.X = Crosshair.X; - line->Point2.Y = Crosshair.Y; - return; - } - FortyFiveLine(line); -} - -/* --------------------------------------------------------------------------- - * makes the attached line fit into a 45 degree direction - * - * directions: - * - * 0 - * 7 1 - * 6 2 - * 5 3 - * 4 - */ -void FortyFiveLine(AttachedLineTypePtr Line) -{ - Coord dx, dy, min; - unsigned direction = 0; - double m; - - /* first calculate direction of line */ - dx = Crosshair.X - Line->Point1.X; - dy = Crosshair.Y - Line->Point1.Y; - - if (!dx) { - if (!dy) - /* zero length line, don't draw anything */ - return; - else - direction = dy > 0 ? 0 : 4; - } - else { - m = (double) dy / dx; - direction = 2; - if (m > PCB_TAN_30_DEGREE) - direction = m > PCB_TAN_60_DEGREE ? 0 : 1; - else if (m < -PCB_TAN_30_DEGREE) - direction = m < -PCB_TAN_60_DEGREE ? 0 : 3; - } - if (dx < 0) - direction += 4; - - dx = coord_abs(dx); - dy = coord_abs(dy); - min = MIN(dx, dy); - - /* now set up the second pair of coordinates */ - switch (direction) { - case 0: - case 4: - Line->Point2.X = Line->Point1.X; - Line->Point2.Y = Crosshair.Y; - break; - - case 2: - case 6: - Line->Point2.X = Crosshair.X; - Line->Point2.Y = Line->Point1.Y; - break; - - case 1: - Line->Point2.X = Line->Point1.X + min; - Line->Point2.Y = Line->Point1.Y + min; - break; - - case 3: - Line->Point2.X = Line->Point1.X + min; - Line->Point2.Y = Line->Point1.Y - min; - break; - - case 5: - Line->Point2.X = Line->Point1.X - min; - Line->Point2.Y = Line->Point1.Y - min; - break; - - case 7: - Line->Point2.X = Line->Point1.X - min; - Line->Point2.Y = Line->Point1.Y + min; - break; - } -} - -/* --------------------------------------------------------------------------- - * adjusts the insert lines to make them 45 degrees as necessary - */ -void AdjustTwoLine(pcb_bool way) -{ - Coord dx, dy; - AttachedLineTypePtr line = &Crosshair.AttachedLine; - - if (Crosshair.AttachedLine.State == STATE_FIRST) - return; - /* don't draw outline when ctrl key is pressed */ - if (gui->control_is_pressed()) { - line->draw = pcb_false; - return; - } - else - line->draw = pcb_true; - if (conf_core.editor.all_direction_lines) { - line->Point2.X = Crosshair.X; - line->Point2.Y = Crosshair.Y; - return; - } - /* swap the modes if shift is held down */ - if (gui->shift_is_pressed()) - way = !way; - dx = Crosshair.X - line->Point1.X; - dy = Crosshair.Y - line->Point1.Y; - if (!way) { - if (coord_abs(dx) > coord_abs(dy)) { - line->Point2.X = Crosshair.X - SGN(dx) * coord_abs(dy); - line->Point2.Y = line->Point1.Y; - } - else { - line->Point2.X = line->Point1.X; - line->Point2.Y = Crosshair.Y - SGN(dy) * coord_abs(dx); - } - } - else { - if (coord_abs(dx) > coord_abs(dy)) { - line->Point2.X = line->Point1.X + SGN(dx) * coord_abs(dy); - line->Point2.Y = Crosshair.Y; - } - else { - line->Point2.X = Crosshair.X; - line->Point2.Y = line->Point1.Y + SGN(dy) * coord_abs(dx);; - } - } -} - -struct drc_info { - LineTypePtr line; - pcb_bool solder; - jmp_buf env; -}; - -static r_dir_t drcVia_callback(const BoxType * b, void *cl) -{ - PinTypePtr via = (PinTypePtr) b; - struct drc_info *i = (struct drc_info *) cl; - - if (!TEST_FLAG(PCB_FLAG_FOUND, via) && PinLineIntersect(via, i->line)) - longjmp(i->env, 1); - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t drcPad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct drc_info *i = (struct drc_info *) cl; - - if (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) == i->solder && !TEST_FLAG(PCB_FLAG_FOUND, pad) && LinePadIntersect(i->line, pad)) - longjmp(i->env, 1); - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t drcLine_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct drc_info *i = (struct drc_info *) cl; - - if (!TEST_FLAG(PCB_FLAG_FOUND, line) && LineLineIntersect(line, i->line)) - longjmp(i->env, 1); - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t drcArc_callback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct drc_info *i = (struct drc_info *) cl; - - if (!TEST_FLAG(PCB_FLAG_FOUND, arc) && LineArcIntersect(i->line, arc)) - longjmp(i->env, 1); - return R_DIR_FOUND_CONTINUE; -} - -/* drc_lines() checks for intersectors against two lines and - * adjusts the end point until there is no intersection or - * it winds up back at the start. If way is pcb_false it checks - * an ortho start line with one 45 refraction to reach the endpoint, - * otherwise it checks a 45 start, with a ortho refraction to reach endpoint - * - * It returns the straight-line length of the best answer, and - * changes the position of the input end point to the best answer. - */ -static double drc_lines(PointTypePtr end, pcb_bool way) -{ - double f, s, f2, s2, len, best; - Coord dx, dy, temp, last, length; - Coord temp2, last2, length2; - LineType line1, line2; - pcb_cardinal_t group, comp; - struct drc_info info; - pcb_bool two_lines, x_is_long, blocker; - PointType ans; - - f = 1.0; - s = 0.5; - last = -1; - line1.Flags = line2.Flags = NoFlags(); - line1.Thickness = conf_core.design.line_thickness + 2 * (PCB->Bloat + 1); - line2.Thickness = line1.Thickness; - line1.Clearance = line2.Clearance = 0; - line1.Point1.X = Crosshair.AttachedLine.Point1.X; - line1.Point1.Y = Crosshair.AttachedLine.Point1.Y; - dy = end->Y - line1.Point1.Y; - dx = end->X - line1.Point1.X; - if (coord_abs(dx) > coord_abs(dy)) { - x_is_long = pcb_true; - length = coord_abs(dx); - } - else { - x_is_long = pcb_false; - length = coord_abs(dy); - } - group = GetGroupOfLayer(INDEXOFCURRENT); - comp = max_group + 10; /* this out-of-range group might save a call */ - if (GetLayerGroupNumberByNumber(solder_silk_layer) == group) - info.solder = pcb_true; - else { - info.solder = pcb_false; - comp = GetLayerGroupNumberByNumber(component_silk_layer); - } - temp = length; - /* assume the worst */ - best = 0.0; - ans.X = line1.Point1.X; - ans.Y = line1.Point1.Y; - while (length != last) { - last = length; - if (x_is_long) { - dx = SGN(dx) * length; - dy = end->Y - line1.Point1.Y; - length2 = coord_abs(dy); - } - else { - dy = SGN(dy) * length; - dx = end->X - line1.Point1.X; - length2 = coord_abs(dx); - } - temp2 = length2; - f2 = 1.0; - s2 = 0.5; - last2 = -1; - blocker = pcb_true; - while (length2 != last2) { - if (x_is_long) - dy = SGN(dy) * length2; - else - dx = SGN(dx) * length2; - two_lines = pcb_true; - if (coord_abs(dx) > coord_abs(dy) && x_is_long) { - line1.Point2.X = line1.Point1.X + (way ? SGN(dx) * coord_abs(dy) : dx - SGN(dx) * coord_abs(dy)); - line1.Point2.Y = line1.Point1.Y + (way ? dy : 0); - } - else if (coord_abs(dy) >= coord_abs(dx) && !x_is_long) { - line1.Point2.X = line1.Point1.X + (way ? dx : 0); - line1.Point2.Y = line1.Point1.Y + (way ? SGN(dy) * coord_abs(dx) : dy - SGN(dy) * coord_abs(dx)); - } - else if (x_is_long) { - /* we've changed which axis is long, so only do one line */ - line1.Point2.X = line1.Point1.X + dx; - line1.Point2.Y = line1.Point1.Y + (way ? SGN(dy) * coord_abs(dx) : 0); - two_lines = pcb_false; - } - else { - /* we've changed which axis is long, so only do one line */ - line1.Point2.Y = line1.Point1.Y + dy; - line1.Point2.X = line1.Point1.X + (way ? SGN(dx) * coord_abs(dy) : 0); - two_lines = pcb_false; - } - line2.Point1.X = line1.Point2.X; - line2.Point1.Y = line1.Point2.Y; - if (!two_lines) { - line2.Point2.Y = line1.Point2.Y; - line2.Point2.X = line1.Point2.X; - } - else { - line2.Point2.X = line1.Point1.X + dx; - line2.Point2.Y = line1.Point1.Y + dy; - } - SetLineBoundingBox(&line1); - SetLineBoundingBox(&line2); - last2 = length2; - if (setjmp(info.env) == 0) { - info.line = &line1; - r_search(PCB->Data->via_tree, &line1.BoundingBox, NULL, drcVia_callback, &info, NULL); - r_search(PCB->Data->pin_tree, &line1.BoundingBox, NULL, drcVia_callback, &info, NULL); - if (info.solder || comp == group) - r_search(PCB->Data->pad_tree, &line1.BoundingBox, NULL, drcPad_callback, &info, NULL); - if (two_lines) { - info.line = &line2; - r_search(PCB->Data->via_tree, &line2.BoundingBox, NULL, drcVia_callback, &info, NULL); - r_search(PCB->Data->pin_tree, &line2.BoundingBox, NULL, drcVia_callback, &info, NULL); - if (info.solder || comp == group) - r_search(PCB->Data->pad_tree, &line2.BoundingBox, NULL, drcPad_callback, &info, NULL); - } - GROUP_LOOP(PCB->Data, group); - { - info.line = &line1; - r_search(layer->line_tree, &line1.BoundingBox, NULL, drcLine_callback, &info, NULL); - r_search(layer->arc_tree, &line1.BoundingBox, NULL, drcArc_callback, &info, NULL); - if (two_lines) { - info.line = &line2; - r_search(layer->line_tree, &line2.BoundingBox, NULL, drcLine_callback, &info, NULL); - r_search(layer->arc_tree, &line2.BoundingBox, NULL, drcArc_callback, &info, NULL); - } - } - END_LOOP; - /* no intersector! */ - blocker = pcb_false; - f2 += s2; - len = (line2.Point2.X - line1.Point1.X); - len *= len; - len += (double) (line2.Point2.Y - line1.Point1.Y) * (line2.Point2.Y - line1.Point1.Y); - if (len > best) { - best = len; - ans.X = line2.Point2.X; - ans.Y = line2.Point2.Y; - } -#if 0 - if (f2 > 1.0) - f2 = 0.5; -#endif - } - else { - /* bumped into something, back off */ - f2 -= s2; - } - s2 *= 0.5; - length2 = MIN(f2 * temp2, temp2); - } - if (!blocker && ((x_is_long && line2.Point2.X - line1.Point1.X == dx) - || (!x_is_long && line2.Point2.Y - line1.Point1.Y == dy))) - f += s; - else - f -= s; - s *= 0.5; - length = MIN(f * temp, temp); - } - - end->X = ans.X; - end->Y = ans.Y; - return best; -} - -static void drc_line(PointTypePtr end) -{ - struct drc_info info; - pcb_cardinal_t group, comp; - LineType line; - AttachedLineType aline; - static PointType last_good; /* internal state of last good endpoint - we cna do thsi cheat, because... */ - - /* ... we hardwire the assumption on how a line is drawn: it starts out as a 0 long segment, which is valid: */ - if ((Crosshair.AttachedLine.Point1.X == Crosshair.X) && (Crosshair.AttachedLine.Point1.Y == Crosshair.Y)) { - line.Point1 = line.Point2 = Crosshair.AttachedLine.Point1; - goto auto_good; - } - - memset(&line, 0, sizeof(line)); - - /* check where the line wants to end */ - aline.Point1.X = Crosshair.AttachedLine.Point1.X; - aline.Point1.Y = Crosshair.AttachedLine.Point1.Y; - FortyFiveLine(&aline); - line.Point1 = aline.Point1; - line.Point2 = aline.Point2; - - /* prepare for the intersection search */ - group = GetGroupOfLayer(INDEXOFCURRENT); - comp = max_group + 10; /* this out-of-range group might save a call */ - if (GetLayerGroupNumberByNumber(solder_silk_layer) == group) - info.solder = pcb_true; - else { - info.solder = pcb_false; - comp = GetLayerGroupNumberByNumber(component_silk_layer); - } - - /* search for intersection */ - SetLineBoundingBox(&line); - if (setjmp(info.env) == 0) { - info.line = &line; - r_search(PCB->Data->via_tree, &line.BoundingBox, NULL, drcVia_callback, &info, NULL); - r_search(PCB->Data->pin_tree, &line.BoundingBox, NULL, drcVia_callback, &info, NULL); - if (info.solder || comp == group) - r_search(PCB->Data->pad_tree, &line.BoundingBox, NULL, drcPad_callback, &info, NULL); - GROUP_LOOP(PCB->Data, group); - { - info.line = &line; - r_search(layer->line_tree, &line.BoundingBox, NULL, drcLine_callback, &info, NULL); - r_search(layer->arc_tree, &line.BoundingBox, NULL, drcArc_callback, &info, NULL); - } - END_LOOP; - /* no intersector! */ - auto_good:; - last_good.X = end->X = line.Point2.X; - last_good.Y = end->Y = line.Point2.Y; - return; - } - - /* bumped into ans */ - end->X = last_good.X; - end->Y = last_good.Y; -} - -void EnforceLineDRC(void) -{ - PointType r45, rs; - pcb_bool shift; - double r1, r2; - - /* Silence a bogus compiler warning by storing this in a variable */ - int layer_idx = INDEXOFCURRENT; - - if (gui->mod1_is_pressed() || gui->control_is_pressed() || PCB->RatDraw || layer_idx >= max_copper_layer) - return; - - rs.X = r45.X = Crosshair.X; - rs.Y = r45.Y = Crosshair.Y; - - if (conf_core.editor.line_refraction != 0) { - /* first try starting straight */ - r1 = drc_lines(&rs, pcb_false); - /* then try starting at 45 */ - r2 = drc_lines(&r45, pcb_true); - } - else { - drc_line(&rs); - r45 = rs; -#define sqr(a) ((a) * (a)) - r1 = r2 = sqrt(sqr(rs.X - Crosshair.AttachedLine.Point1.X) + sqr(rs.Y - Crosshair.AttachedLine.Point1.Y)); -#undef sqr - } - /* shift forces the line lookahead path to refract the alternate way */ - shift = gui->shift_is_pressed(); - - if (XOR(r1 > r2, shift)) { - if (conf_core.editor.line_refraction != 0) { - if (shift) { - if (conf_core.editor.line_refraction !=2) - conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 2); - } - else{ - if (conf_core.editor.line_refraction != 1) - conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 1); - } - } - Crosshair.X = rs.X; - Crosshair.Y = rs.Y; - } - else { - if (conf_core.editor.line_refraction !=0) { - if (shift) { - if (conf_core.editor.line_refraction != 1) - conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 1); - } - else { - if (conf_core.editor.line_refraction != 2) - conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 2); - } - } - Crosshair.X = r45.X; - Crosshair.Y = r45.Y; - } -} Index: 1.1.4/src/list_line.h =================================================================== --- 1.1.4/src/list_line.h (revision 10776) +++ 1.1.4/src/list_line.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_LINE_H -#define LIST_LINE_H - -/* List of Lines */ -#define TDL(x) linelist_ ## x -#define TDL_LIST_T linelist_t -#define TDL_ITEM_T LineType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define linelist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/mymem.h =================================================================== --- 1.1.4/src/mymem.h (revision 10776) +++ 1.1.4/src/mymem.h (nonexistent) @@ -1,111 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for memory routines - */ - -#ifndef PCB_MYMEM_H -#define PCB_MYMEM_H - -#include "config.h" - -#include -#include "global.h" - -/* --------------------------------------------------------------------------- - * number of additional objects that are allocated with one system call - */ -#define STEP_ELEMENT 50 -#define STEP_DRILL 30 -#define STEP_POINT 100 -#define STEP_SYMBOLLINE 10 -#define STEP_SELECTORENTRY 128 -#define STEP_REMOVELIST 500 -#define STEP_UNDOLIST 500 -#define STEP_POLYGONPOINT 10 -#define STEP_POLYGONHOLEINDEX 10 -#define STEP_LIBRARYMENU 10 -#define STEP_LIBRARYENTRY 20 -#define STEP_RUBBERBAND 100 - -/* --------------------------------------------------------------------------- - * some memory types - */ - -RubberbandTypePtr GetRubberbandMemory(void); -PinTypePtr GetPinMemory(ElementTypePtr); -PadTypePtr GetPadMemory(ElementTypePtr); -PinTypePtr GetViaMemory(DataTypePtr); -LineTypePtr GetLineMemory(LayerTypePtr); -ArcTypePtr GetArcMemory(LayerTypePtr); -RatTypePtr GetRatMemory(DataTypePtr); -TextTypePtr GetTextMemory(LayerTypePtr); -PolygonTypePtr GetPolygonMemory(LayerTypePtr); -PointTypePtr GetPointMemoryInPolygon(PolygonTypePtr); -pcb_cardinal_t *GetHoleIndexMemoryInPolygon(PolygonTypePtr); -ElementTypePtr GetElementMemory(DataTypePtr); -BoxTypePtr GetBoxMemory(BoxListTypePtr); -ConnectionTypePtr GetConnectionMemory(NetTypePtr); -NetTypePtr GetNetMemory(NetListTypePtr); -NetListTypePtr GetNetListMemory(NetListListTypePtr); -LibraryMenuTypePtr GetLibraryMenuMemory(LibraryTypePtr, int *idx); -LibraryEntryTypePtr GetLibraryEntryMemory(LibraryMenuTypePtr); -ElementTypeHandle GetDrillElementMemory(DrillTypePtr); -PinTypeHandle GetDrillPinMemory(DrillTypePtr); -DrillTypePtr GetDrillInfoDrillMemory(DrillInfoTypePtr); -void **GetPointerMemory(PointerListTypePtr); -void FreePolygonMemory(PolygonTypePtr); -void FreeElementMemory(ElementTypePtr); -void FreePCBMemory(PCBTypePtr); -void FreeBoxListMemory(BoxListTypePtr); -void FreeNetListListMemory(NetListListTypePtr); -void FreeNetListMemory(NetListTypePtr); -void FreeNetMemory(NetTypePtr); -void FreeDataMemory(DataTypePtr); -void FreeLibraryMemory(LibraryTypePtr); -void FreePointerListMemory(PointerListTypePtr); -void DeleteLibraryMenuMemory(LibraryTypePtr lib, int menuidx); -char *StripWhiteSpaceAndDup(const char *); - -void RemoveFreeArc(ArcType * data); -void RemoveFreeLine(LineType * data); -void RemoveFreeText(TextType * data); -void RemoveFreePolygon(PolygonType * data); -void RemoveFreePin(PinType * data); -void RemoveFreePad(PadType * data); -void RemoveFreeVia(PinType * data); -void RemoveFreeElement(ElementType * data); -void RemoveFreeRat(RatType * data); - -/* Allocate element-objects */ -LineType *GetElementLineMemory(ElementType *Element); -ArcType *GetElementArcMemory(ElementType *Element); - -#ifndef HAVE_LIBDMALLOC -#define malloc(x) calloc(1,(x)) -#endif - -#endif Index: 1.1.4/src/list_element.h =================================================================== --- 1.1.4/src/list_element.h (revision 10776) +++ 1.1.4/src/list_element.h (nonexistent) @@ -1,79 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_ELEMENT_H -#define LIST_ELEMENT_H - -/* List of Elements */ -#define TDL(x) elementlist_ ## x -#define TDL_LIST_T elementlist_t -#define TDL_ITEM_T ElementType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define elementlist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - -#include "ht_element.h" -#include - -/* Calculate a hash value using the content of the element. The hash value - represents the actual content of an element */ -unsigned int pcb_element_hash(const ElementType *e); - -/* Compare two elements and return 1 if they contain the same objects. */ -int pcb_element_eq(const ElementType *e1, const ElementType *e2); - -/* Create a new local variable to be used for deduplication */ -#define elementlist_dedup_initializer(state) htep_t *state = NULL; - -/* Do a "continue" if an element matching loop_elem has been seen already; - Typically this is invoked as the first statement of an elementlist_foreach() - loop. */ -#define elementlist_dedup_skip(state, loop_elem) \ -switch(1) { \ - case 1: { \ - if (state == NULL) \ - state = htep_alloc(pcb_element_hash, pcb_element_eq); \ - if (htep_has(state, loop_elem)) \ - continue; \ - htep_set(state, loop_elem, 1); \ - } \ -} - -/* use this after the loop to free all memory used by state */ -#define elementlist_dedup_free(state) \ - do { \ - if (state != NULL) { \ - htep_free(state); \ - state = NULL; \ - } \ - } while(0) - - -#ifndef LIST_ELEMENT_NOINSTANT -#include -#include -#endif - -#endif Index: 1.1.4/src/ht_element.h =================================================================== --- 1.1.4/src/ht_element.h (revision 10776) +++ 1.1.4/src/ht_element.h (nonexistent) @@ -1,11 +0,0 @@ -#ifndef PCB_HT_ELEMENT_H -#define PCB_HT_ELEMENT_H - -/* hash instance */ -typedef const ElementType *htep_key_t; -typedef int htep_value_t; -#define HT(x) htep_ ## x -#include -#undef HT - -#endif Index: 1.1.4/src/misc.c =================================================================== --- 1.1.4/src/misc.c (revision 10776) +++ 1.1.4/src/misc.c (nonexistent) @@ -1,1310 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2004,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* misc functions used by several modules */ - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "box.h" -#include "crosshair.h" -#include "data.h" -#include "plug_io.h" -#include "error.h" -#include "misc.h" -#include "move.h" -#include "polygon.h" -#include "rtree.h" -#include "rotate.h" -#include "rubberband.h" -#include "set.h" -#include "undo.h" -#include "compat_misc.h" -#include "hid_actions.h" -#include "hid_init.h" - -/* forward declarations */ -static char *BumpName(char *); -static void GetGridLockCoordinates(int, void *, void *, void *, Coord *, Coord *); - -/* Local variables */ - -/* Bring an angle into [0, 360) range */ -Angle NormalizeAngle(Angle a) -{ - while (a < 0) - a += 360.0; - while (a >= 360.0) - a -= 360.0; - return a; -} - -/* --------------------------------------------------------------------------- - * sets the bounding box of a point (which is silly) - */ -void SetPointBoundingBox(PointTypePtr Pnt) -{ - Pnt->X2 = Pnt->X + 1; - Pnt->Y2 = Pnt->Y + 1; -} - -/* --------------------------------------------------------------------------- - * sets the bounding box of a pin or via - */ -void SetPinBoundingBox(PinTypePtr Pin) -{ - Coord width; - - if ((GET_SQUARE(Pin) > 1) && (TEST_FLAG(PCB_FLAG_SQUARE, Pin))) { - POLYAREA *p = PinPoly(Pin, PIN_SIZE(Pin), Pin->Clearance); - poly_bbox(p, &Pin->BoundingBox); - poly_Free(&p); - } - - /* the bounding box covers the extent of influence - * so it must include the clearance values too - */ - width = MAX(Pin->Clearance + PIN_SIZE(Pin), Pin->Mask) / 2; - - /* Adjust for our discrete polygon approximation */ - width = (double) width *POLY_CIRC_RADIUS_ADJ + 0.5; - - Pin->BoundingBox.X1 = Pin->X - width; - Pin->BoundingBox.Y1 = Pin->Y - width; - Pin->BoundingBox.X2 = Pin->X + width; - Pin->BoundingBox.Y2 = Pin->Y + width; - close_box(&Pin->BoundingBox); -} - -/* --------------------------------------------------------------------------- - * sets the bounding box of a pad - */ -void SetPadBoundingBox(PadTypePtr Pad) -{ - Coord width; - Coord deltax; - Coord deltay; - - /* the bounding box covers the extent of influence - * so it must include the clearance values too - */ - width = (Pad->Thickness + Pad->Clearance + 1) / 2; - width = MAX(width, (Pad->Mask + 1) / 2); - deltax = Pad->Point2.X - Pad->Point1.X; - deltay = Pad->Point2.Y - Pad->Point1.Y; - - if (TEST_FLAG(PCB_FLAG_SQUARE, Pad) && deltax != 0 && deltay != 0) { - /* slanted square pad */ - double theta; - Coord btx, bty; - - /* T is a vector half a thickness long, in the direction of - one of the corners. */ - theta = atan2(deltay, deltax); - btx = width * cos(theta + M_PI / 4) * sqrt(2.0); - bty = width * sin(theta + M_PI / 4) * sqrt(2.0); - - - Pad->BoundingBox.X1 = MIN(MIN(Pad->Point1.X - btx, Pad->Point1.X - bty), MIN(Pad->Point2.X + btx, Pad->Point2.X + bty)); - Pad->BoundingBox.X2 = MAX(MAX(Pad->Point1.X - btx, Pad->Point1.X - bty), MAX(Pad->Point2.X + btx, Pad->Point2.X + bty)); - Pad->BoundingBox.Y1 = MIN(MIN(Pad->Point1.Y + btx, Pad->Point1.Y - bty), MIN(Pad->Point2.Y - btx, Pad->Point2.Y + bty)); - Pad->BoundingBox.Y2 = MAX(MAX(Pad->Point1.Y + btx, Pad->Point1.Y - bty), MAX(Pad->Point2.Y - btx, Pad->Point2.Y + bty)); - } - else { - /* Adjust for our discrete polygon approximation */ - width = (double) width *POLY_CIRC_RADIUS_ADJ + 0.5; - - Pad->BoundingBox.X1 = MIN(Pad->Point1.X, Pad->Point2.X) - width; - Pad->BoundingBox.X2 = MAX(Pad->Point1.X, Pad->Point2.X) + width; - Pad->BoundingBox.Y1 = MIN(Pad->Point1.Y, Pad->Point2.Y) - width; - Pad->BoundingBox.Y2 = MAX(Pad->Point1.Y, Pad->Point2.Y) + width; - } - close_box(&Pad->BoundingBox); -} - -/* --------------------------------------------------------------------------- - * sets the bounding box of a line - */ -void SetLineBoundingBox(LineTypePtr Line) -{ - Coord width = (Line->Thickness + Line->Clearance + 1) / 2; - - /* Adjust for our discrete polygon approximation */ - width = (double) width *POLY_CIRC_RADIUS_ADJ + 0.5; - - Line->BoundingBox.X1 = MIN(Line->Point1.X, Line->Point2.X) - width; - Line->BoundingBox.X2 = MAX(Line->Point1.X, Line->Point2.X) + width; - Line->BoundingBox.Y1 = MIN(Line->Point1.Y, Line->Point2.Y) - width; - Line->BoundingBox.Y2 = MAX(Line->Point1.Y, Line->Point2.Y) + width; - close_box(&Line->BoundingBox); - SetPointBoundingBox(&Line->Point1); - SetPointBoundingBox(&Line->Point2); -} - -/* --------------------------------------------------------------------------- - * sets the bounding box of a polygons - */ -void SetPolygonBoundingBox(PolygonTypePtr Polygon) -{ - Polygon->BoundingBox.X1 = Polygon->BoundingBox.Y1 = MAX_COORD; - Polygon->BoundingBox.X2 = Polygon->BoundingBox.Y2 = 0; - POLYGONPOINT_LOOP(Polygon); - { - MAKEMIN(Polygon->BoundingBox.X1, point->X); - MAKEMIN(Polygon->BoundingBox.Y1, point->Y); - MAKEMAX(Polygon->BoundingBox.X2, point->X); - MAKEMAX(Polygon->BoundingBox.Y2, point->Y); - } - /* boxes don't include the lower right corner */ - close_box(&Polygon->BoundingBox); - END_LOOP; -} - -/* --------------------------------------------------------------------------- - * sets the bounding box of an elements - */ -void SetElementBoundingBox(DataTypePtr Data, ElementTypePtr Element, FontTypePtr Font) -{ - BoxTypePtr box, vbox; - - if (Data && Data->element_tree) - r_delete_entry(Data->element_tree, (BoxType *) Element); - /* first update the text objects */ - ELEMENTTEXT_LOOP(Element); - { - if (Data && Data->name_tree[n]) - r_delete_entry(Data->name_tree[n], (BoxType *) text); - SetTextBoundingBox(Font, text); - if (Data && !Data->name_tree[n]) - Data->name_tree[n] = r_create_tree(NULL, 0, 0); - if (Data) - r_insert_entry(Data->name_tree[n], (BoxType *) text, 0); - } - END_LOOP; - - /* do not include the elementnames bounding box which - * is handled separately - */ - box = &Element->BoundingBox; - vbox = &Element->VBox; - box->X1 = box->Y1 = MAX_COORD; - box->X2 = box->Y2 = 0; - ELEMENTLINE_LOOP(Element); - { - SetLineBoundingBox(line); - MAKEMIN(box->X1, line->Point1.X - (line->Thickness + 1) / 2); - MAKEMIN(box->Y1, line->Point1.Y - (line->Thickness + 1) / 2); - MAKEMIN(box->X1, line->Point2.X - (line->Thickness + 1) / 2); - MAKEMIN(box->Y1, line->Point2.Y - (line->Thickness + 1) / 2); - MAKEMAX(box->X2, line->Point1.X + (line->Thickness + 1) / 2); - MAKEMAX(box->Y2, line->Point1.Y + (line->Thickness + 1) / 2); - MAKEMAX(box->X2, line->Point2.X + (line->Thickness + 1) / 2); - MAKEMAX(box->Y2, line->Point2.Y + (line->Thickness + 1) / 2); - } - END_LOOP; - ARC_LOOP(Element); - { - SetArcBoundingBox(arc); - MAKEMIN(box->X1, arc->BoundingBox.X1); - MAKEMIN(box->Y1, arc->BoundingBox.Y1); - MAKEMAX(box->X2, arc->BoundingBox.X2); - MAKEMAX(box->Y2, arc->BoundingBox.Y2); - } - END_LOOP; - *vbox = *box; - PIN_LOOP(Element); - { - if (Data && Data->pin_tree) - r_delete_entry(Data->pin_tree, (BoxType *) pin); - SetPinBoundingBox(pin); - if (Data) { - if (!Data->pin_tree) - Data->pin_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Data->pin_tree, (BoxType *) pin, 0); - } - MAKEMIN(box->X1, pin->BoundingBox.X1); - MAKEMIN(box->Y1, pin->BoundingBox.Y1); - MAKEMAX(box->X2, pin->BoundingBox.X2); - MAKEMAX(box->Y2, pin->BoundingBox.Y2); - MAKEMIN(vbox->X1, pin->X - pin->Thickness / 2); - MAKEMIN(vbox->Y1, pin->Y - pin->Thickness / 2); - MAKEMAX(vbox->X2, pin->X + pin->Thickness / 2); - MAKEMAX(vbox->Y2, pin->Y + pin->Thickness / 2); - } - END_LOOP; - PAD_LOOP(Element); - { - if (Data && Data->pad_tree) - r_delete_entry(Data->pad_tree, (BoxType *) pad); - SetPadBoundingBox(pad); - if (Data) { - if (!Data->pad_tree) - Data->pad_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Data->pad_tree, (BoxType *) pad, 0); - } - MAKEMIN(box->X1, pad->BoundingBox.X1); - MAKEMIN(box->Y1, pad->BoundingBox.Y1); - MAKEMAX(box->X2, pad->BoundingBox.X2); - MAKEMAX(box->Y2, pad->BoundingBox.Y2); - MAKEMIN(vbox->X1, MIN(pad->Point1.X, pad->Point2.X) - pad->Thickness / 2); - MAKEMIN(vbox->Y1, MIN(pad->Point1.Y, pad->Point2.Y) - pad->Thickness / 2); - MAKEMAX(vbox->X2, MAX(pad->Point1.X, pad->Point2.X) + pad->Thickness / 2); - MAKEMAX(vbox->Y2, MAX(pad->Point1.Y, pad->Point2.Y) + pad->Thickness / 2); - } - END_LOOP; - /* now we set the PCB_FLAG_EDGE2 of the pad if Point2 - * is closer to the outside edge than Point1 - */ - PAD_LOOP(Element); - { - if (pad->Point1.Y == pad->Point2.Y) { - /* horizontal pad */ - if (box->X2 - pad->Point2.X < pad->Point1.X - box->X1) - SET_FLAG(PCB_FLAG_EDGE2, pad); - else - CLEAR_FLAG(PCB_FLAG_EDGE2, pad); - } - else { - /* vertical pad */ - if (box->Y2 - pad->Point2.Y < pad->Point1.Y - box->Y1) - SET_FLAG(PCB_FLAG_EDGE2, pad); - else - CLEAR_FLAG(PCB_FLAG_EDGE2, pad); - } - } - END_LOOP; - - /* mark pins with component orientation */ - if ((box->X2 - box->X1) > (box->Y2 - box->Y1)) { - PIN_LOOP(Element); - { - SET_FLAG(PCB_FLAG_EDGE2, pin); - } - END_LOOP; - } - else { - PIN_LOOP(Element); - { - CLEAR_FLAG(PCB_FLAG_EDGE2, pin); - } - END_LOOP; - } - close_box(box); - close_box(vbox); - if (Data && !Data->element_tree) - Data->element_tree = r_create_tree(NULL, 0, 0); - if (Data) - r_insert_entry(Data->element_tree, box, 0); -} - -/* --------------------------------------------------------------------------- - * creates the bounding box of a text object - */ -void SetTextBoundingBox(FontTypePtr FontPtr, TextTypePtr Text) -{ - SymbolTypePtr symbol = FontPtr->Symbol; - unsigned char *s = (unsigned char *) Text->TextString; - int i; - int space; - - Coord minx, miny, maxx, maxy, tx; - Coord min_final_radius; - Coord min_unscaled_radius; - pcb_bool first_time = pcb_true; - - minx = miny = maxx = maxy = tx = 0; - - /* Calculate the bounding box based on the larger of the thicknesses - * the text might clamped at on silk or copper layers. - */ - min_final_radius = MAX(PCB->minWid, PCB->minSlk) / 2; - - /* Pre-adjust the line radius for the fact we are initially computing the - * bounds of the un-scaled text, and the thickness clamping applies to - * scaled text. - */ - min_unscaled_radius = PCB_UNPCB_SCALE_TEXT(min_final_radius, Text->Scale); - - /* calculate size of the bounding box */ - for (; s && *s; s++) { - if (*s <= MAX_FONTPOSITION && symbol[*s].Valid) { - LineTypePtr line = symbol[*s].Line; - for (i = 0; i < symbol[*s].LineN; line++, i++) { - /* Clamp the width of text lines at the minimum thickness. - * NB: Divide 4 in thickness calculation is comprised of a factor - * of 1/2 to get a radius from the center-line, and a factor - * of 1/2 because some stupid reason we render our glyphs - * at half their defined stroke-width. - */ - Coord unscaled_radius = MAX(min_unscaled_radius, line->Thickness / 4); - - if (first_time) { - minx = maxx = line->Point1.X; - miny = maxy = line->Point1.Y; - first_time = pcb_false; - } - - minx = MIN(minx, line->Point1.X - unscaled_radius + tx); - miny = MIN(miny, line->Point1.Y - unscaled_radius); - minx = MIN(minx, line->Point2.X - unscaled_radius + tx); - miny = MIN(miny, line->Point2.Y - unscaled_radius); - maxx = MAX(maxx, line->Point1.X + unscaled_radius + tx); - maxy = MAX(maxy, line->Point1.Y + unscaled_radius); - maxx = MAX(maxx, line->Point2.X + unscaled_radius + tx); - maxy = MAX(maxy, line->Point2.Y + unscaled_radius); - } - space = symbol[*s].Delta; - } - else { - BoxType *ds = &FontPtr->DefaultSymbol; - Coord w = ds->X2 - ds->X1; - - minx = MIN(minx, ds->X1 + tx); - miny = MIN(miny, ds->Y1); - minx = MIN(minx, ds->X2 + tx); - miny = MIN(miny, ds->Y2); - maxx = MAX(maxx, ds->X1 + tx); - maxy = MAX(maxy, ds->Y1); - maxx = MAX(maxx, ds->X2 + tx); - maxy = MAX(maxy, ds->Y2); - - space = w / 5; - } - tx += symbol[*s].Width + space; - } - - /* scale values */ - minx = PCB_SCALE_TEXT(minx, Text->Scale); - miny = PCB_SCALE_TEXT(miny, Text->Scale); - maxx = PCB_SCALE_TEXT(maxx, Text->Scale); - maxy = PCB_SCALE_TEXT(maxy, Text->Scale); - - /* set upper-left and lower-right corner; - * swap coordinates if necessary (origin is already in 'swapped') - * and rotate box - */ - - if (TEST_FLAG(PCB_FLAG_ONSOLDER, Text)) { - Text->BoundingBox.X1 = Text->X + minx; - Text->BoundingBox.Y1 = Text->Y - miny; - Text->BoundingBox.X2 = Text->X + maxx; - Text->BoundingBox.Y2 = Text->Y - maxy; - RotateBoxLowLevel(&Text->BoundingBox, Text->X, Text->Y, (4 - Text->Direction) & 0x03); - } - else { - Text->BoundingBox.X1 = Text->X + minx; - Text->BoundingBox.Y1 = Text->Y + miny; - Text->BoundingBox.X2 = Text->X + maxx; - Text->BoundingBox.Y2 = Text->Y + maxy; - RotateBoxLowLevel(&Text->BoundingBox, Text->X, Text->Y, Text->Direction); - } - - /* the bounding box covers the extent of influence - * so it must include the clearance values too - */ - Text->BoundingBox.X1 -= PCB->Bloat; - Text->BoundingBox.Y1 -= PCB->Bloat; - Text->BoundingBox.X2 += PCB->Bloat; - Text->BoundingBox.Y2 += PCB->Bloat; - close_box(&Text->BoundingBox); -} - -/* --------------------------------------------------------------------------- - * returns pcb_true if data area is empty - */ -pcb_bool IsDataEmpty(DataTypePtr Data) -{ - pcb_bool hasNoObjects; - pcb_cardinal_t i; - - hasNoObjects = (pinlist_length(&Data->Via) == 0); - hasNoObjects &= (elementlist_length(&Data->Element) == 0); - for (i = 0; i < max_copper_layer + 2; i++) - hasNoObjects = hasNoObjects && LAYER_IS_EMPTY(&(Data->Layer[i])); - return (hasNoObjects); -} - -int FlagIsDataEmpty(int parm) -{ - int i = IsDataEmpty(PCB->Data); - return parm ? !i : i; -} - -/* FLAG(DataEmpty,FlagIsDataEmpty,0) */ -/* FLAG(DataNonEmpty,FlagIsDataEmpty,1) */ - -pcb_bool IsPasteEmpty(int side) -{ - pcb_bool paste_empty = pcb_true; - ALLPAD_LOOP(PCB->Data); - { - if (ON_SIDE(pad, side) && !TEST_FLAG(PCB_FLAG_NOPASTE, pad) && pad->Mask > 0) { - paste_empty = pcb_false; - break; - } - } - ENDALL_LOOP; - return paste_empty; -} - - -typedef struct { - int nplated; - int nunplated; -} HoleCountStruct; - -static r_dir_t hole_counting_callback(const BoxType * b, void *cl) -{ - PinTypePtr pin = (PinTypePtr) b; - HoleCountStruct *hcs = (HoleCountStruct *) cl; - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) - hcs->nunplated++; - else - hcs->nplated++; - return R_DIR_FOUND_CONTINUE; -} - -/* --------------------------------------------------------------------------- - * counts the number of plated and unplated holes in the design within - * a given area of the board. To count for the whole board, pass NULL - * within_area. - */ -void CountHoles(int *plated, int *unplated, const BoxType * within_area) -{ - HoleCountStruct hcs = { 0, 0 }; - - r_search(PCB->Data->pin_tree, within_area, NULL, hole_counting_callback, &hcs, NULL); - r_search(PCB->Data->via_tree, within_area, NULL, hole_counting_callback, &hcs, NULL); - - if (plated != NULL) - *plated = hcs.nplated; - if (unplated != NULL) - *unplated = hcs.nunplated; -} - - -/* --------------------------------------------------------------------------- - * gets minimum and maximum coordinates - * returns NULL if layout is empty - */ -BoxTypePtr GetDataBoundingBox(DataTypePtr Data) -{ - static BoxType box; - /* FIX ME: use r_search to do this much faster */ - - /* preset identifiers with highest and lowest possible values */ - box.X1 = box.Y1 = MAX_COORD; - box.X2 = box.Y2 = -MAX_COORD; - - /* now scan for the lowest/highest X and Y coordinate */ - VIA_LOOP(Data); - { - box.X1 = MIN(box.X1, via->X - via->Thickness / 2); - box.Y1 = MIN(box.Y1, via->Y - via->Thickness / 2); - box.X2 = MAX(box.X2, via->X + via->Thickness / 2); - box.Y2 = MAX(box.Y2, via->Y + via->Thickness / 2); - } - END_LOOP; - ELEMENT_LOOP(Data); - { - box.X1 = MIN(box.X1, element->BoundingBox.X1); - box.Y1 = MIN(box.Y1, element->BoundingBox.Y1); - box.X2 = MAX(box.X2, element->BoundingBox.X2); - box.Y2 = MAX(box.Y2, element->BoundingBox.Y2); - { - TextTypePtr text = &NAMEONPCB_TEXT(element); - box.X1 = MIN(box.X1, text->BoundingBox.X1); - box.Y1 = MIN(box.Y1, text->BoundingBox.Y1); - box.X2 = MAX(box.X2, text->BoundingBox.X2); - box.Y2 = MAX(box.Y2, text->BoundingBox.Y2); - }; - } - END_LOOP; - ALLLINE_LOOP(Data); - { - box.X1 = MIN(box.X1, line->Point1.X - line->Thickness / 2); - box.Y1 = MIN(box.Y1, line->Point1.Y - line->Thickness / 2); - box.X1 = MIN(box.X1, line->Point2.X - line->Thickness / 2); - box.Y1 = MIN(box.Y1, line->Point2.Y - line->Thickness / 2); - box.X2 = MAX(box.X2, line->Point1.X + line->Thickness / 2); - box.Y2 = MAX(box.Y2, line->Point1.Y + line->Thickness / 2); - box.X2 = MAX(box.X2, line->Point2.X + line->Thickness / 2); - box.Y2 = MAX(box.Y2, line->Point2.Y + line->Thickness / 2); - } - ENDALL_LOOP; - ALLARC_LOOP(Data); - { - box.X1 = MIN(box.X1, arc->BoundingBox.X1); - box.Y1 = MIN(box.Y1, arc->BoundingBox.Y1); - box.X2 = MAX(box.X2, arc->BoundingBox.X2); - box.Y2 = MAX(box.Y2, arc->BoundingBox.Y2); - } - ENDALL_LOOP; - ALLTEXT_LOOP(Data); - { - box.X1 = MIN(box.X1, text->BoundingBox.X1); - box.Y1 = MIN(box.Y1, text->BoundingBox.Y1); - box.X2 = MAX(box.X2, text->BoundingBox.X2); - box.Y2 = MAX(box.Y2, text->BoundingBox.Y2); - } - ENDALL_LOOP; - ALLPOLYGON_LOOP(Data); - { - box.X1 = MIN(box.X1, polygon->BoundingBox.X1); - box.Y1 = MIN(box.Y1, polygon->BoundingBox.Y1); - box.X2 = MAX(box.X2, polygon->BoundingBox.X2); - box.Y2 = MAX(box.Y2, polygon->BoundingBox.Y2); - } - ENDALL_LOOP; - return (IsDataEmpty(Data) ? NULL : &box); -} - -/* --------------------------------------------------------------------------- - * centers the displayed PCB around the specified point (X,Y) - */ -void CenterDisplay(Coord X, Coord Y) -{ - Coord save_grid = PCB->Grid; - PCB->Grid = 1; - if (MoveCrosshairAbsolute(X, Y)) - notify_crosshair_change(pcb_true); - gui->set_crosshair(Crosshair.X, Crosshair.Y, HID_SC_WARP_POINTER); - PCB->Grid = save_grid; -} - -/* --------------------------------------------------------------------------- - * transforms symbol coordinates so that the left edge of each symbol - * is at the zero position. The y coordinates are moved so that min(y) = 0 - * - */ -void SetFontInfo(FontTypePtr Ptr) -{ - pcb_cardinal_t i, j; - SymbolTypePtr symbol; - LineTypePtr line; - Coord totalminy = MAX_COORD; - - /* calculate cell with and height (is at least DEFAULT_CELLSIZE) - * maximum cell width and height - * minimum x and y position of all lines - */ - Ptr->MaxWidth = DEFAULT_CELLSIZE; - Ptr->MaxHeight = DEFAULT_CELLSIZE; - for (i = 0, symbol = Ptr->Symbol; i <= MAX_FONTPOSITION; i++, symbol++) { - Coord minx, miny, maxx, maxy; - - /* next one if the index isn't used or symbol is empty (SPACE) */ - if (!symbol->Valid || !symbol->LineN) - continue; - - minx = miny = MAX_COORD; - maxx = maxy = 0; - for (line = symbol->Line, j = symbol->LineN; j; j--, line++) { - minx = MIN(minx, line->Point1.X); - miny = MIN(miny, line->Point1.Y); - minx = MIN(minx, line->Point2.X); - miny = MIN(miny, line->Point2.Y); - maxx = MAX(maxx, line->Point1.X); - maxy = MAX(maxy, line->Point1.Y); - maxx = MAX(maxx, line->Point2.X); - maxy = MAX(maxy, line->Point2.Y); - } - - /* move symbol to left edge */ - for (line = symbol->Line, j = symbol->LineN; j; j--, line++) - MOVE_LINE_LOWLEVEL(line, -minx, 0); - - /* set symbol bounding box with a minimum cell size of (1,1) */ - symbol->Width = maxx - minx + 1; - symbol->Height = maxy + 1; - - /* check total min/max */ - Ptr->MaxWidth = MAX(Ptr->MaxWidth, symbol->Width); - Ptr->MaxHeight = MAX(Ptr->MaxHeight, symbol->Height); - totalminy = MIN(totalminy, miny); - } - - /* move coordinate system to the upper edge (lowest y on screen) */ - for (i = 0, symbol = Ptr->Symbol; i <= MAX_FONTPOSITION; i++, symbol++) - if (symbol->Valid) { - symbol->Height -= totalminy; - for (line = symbol->Line, j = symbol->LineN; j; j--, line++) - MOVE_LINE_LOWLEVEL(line, 0, -totalminy); - } - - /* setup the box for the default symbol */ - Ptr->DefaultSymbol.X1 = Ptr->DefaultSymbol.Y1 = 0; - Ptr->DefaultSymbol.X2 = Ptr->DefaultSymbol.X1 + Ptr->MaxWidth; - Ptr->DefaultSymbol.Y2 = Ptr->DefaultSymbol.Y1 + Ptr->MaxHeight; -} - -Coord GetNum(char **s, const char *default_unit) -{ - /* Read value */ - Coord ret_val = GetValueEx(*s, NULL, NULL, NULL, default_unit, NULL); - /* Advance pointer */ - while (isalnum(**s) || **s == '.') - (*s)++; - return ret_val; -} - -/* --------------------------------------------------------------------------- - * quits application - */ -extern void pcb_main_uninit(void); -void QuitApplication(void) -{ - /* - * save data if necessary. It not needed, then don't trigger EmergencySave - * via our atexit() registering of EmergencySave(). We presumably wanted to - * exit here and thus it is not an emergency. - */ - if (PCB->Changed && conf_core.editor.save_in_tmp) - EmergencySave(); - else - DisableEmergencySave(); - - if (gui->do_exit == NULL) { - pcb_main_uninit(); - exit(0); - } - else - gui->do_exit(gui); -} - -/* --------------------------------------------------------------------------- - * creates a filename from a template - * %f is replaced by the filename - * %p by the searchpath - */ -char *EvaluateFilename(const char *Template, const char *Path, const char *Filename, const char *Parameter) -{ - gds_t command; - const char *p; - - if (conf_core.rc.verbose) { - printf("EvaluateFilename:\n"); - printf("\tTemplate: \033[33m%s\033[0m\n", Template); - printf("\tPath: \033[33m%s\033[0m\n", Path); - printf("\tFilename: \033[33m%s\033[0m\n", Filename); - printf("\tParameter: \033[33m%s\033[0m\n", Parameter); - } - - gds_init(&command); - - for (p = Template; p && *p; p++) { - /* copy character or add string to command */ - if (*p == '%' && (*(p + 1) == 'f' || *(p + 1) == 'p' || *(p + 1) == 'a')) - switch (*(++p)) { - case 'a': - gds_append_str(&command, Parameter); - break; - case 'f': - gds_append_str(&command, Filename); - break; - case 'p': - gds_append_str(&command, Path); - break; - } - else - gds_append(&command, *p); - } - - if (conf_core.rc.verbose) - printf("EvaluateFilename: \033[32m%s\033[0m\n", command.array); - - return command.array; -} - -/* --------------------------------------------------------------------------- - * returns a pointer to an objects bounding box; - * data is valid until the routine is called again - */ -BoxTypePtr GetObjectBoundingBox(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - switch (Type) { - case PCB_TYPE_LINE: - case PCB_TYPE_ARC: - case PCB_TYPE_TEXT: - case PCB_TYPE_POLYGON: - case PCB_TYPE_PAD: - case PCB_TYPE_PIN: - case PCB_TYPE_ELEMENT_NAME: - return (BoxType *) Ptr2; - case PCB_TYPE_VIA: - case PCB_TYPE_ELEMENT: - return (BoxType *) Ptr1; - case PCB_TYPE_POLYGON_POINT: - case PCB_TYPE_LINE_POINT: - return (BoxType *) Ptr3; - default: - Message(PCB_MSG_DEFAULT, "Request for bounding box of unsupported type %d\n", Type); - return (BoxType *) Ptr2; - } -} - -/* --------------------------------------------------------------------------- - * computes the bounding box of an arc - */ -void SetArcBoundingBox(ArcTypePtr Arc) -{ - double ca1, ca2, sa1, sa2; - double minx, maxx, miny, maxy; - Angle ang1, ang2; - Coord width; - - /* first put angles into standard form: - * ang1 < ang2, both angles between 0 and 720 */ - Arc->Delta = PCB_CLAMP(Arc->Delta, -360, 360); - - if (Arc->Delta > 0) { - ang1 = NormalizeAngle(Arc->StartAngle); - ang2 = NormalizeAngle(Arc->StartAngle + Arc->Delta); - } - else { - ang1 = NormalizeAngle(Arc->StartAngle + Arc->Delta); - ang2 = NormalizeAngle(Arc->StartAngle); - } - if (ang1 > ang2) - ang2 += 360; - /* Make sure full circles aren't treated as zero-length arcs */ - if (Arc->Delta == 360 || Arc->Delta == -360) - ang2 = ang1 + 360; - - /* calculate sines, cosines */ - sa1 = sin(PCB_M180 * ang1); - ca1 = cos(PCB_M180 * ang1); - sa2 = sin(PCB_M180 * ang2); - ca2 = cos(PCB_M180 * ang2); - - minx = MIN(ca1, ca2); - maxx = MAX(ca1, ca2); - miny = MIN(sa1, sa2); - maxy = MAX(sa1, sa2); - - /* Check for extreme angles */ - if ((ang1 <= 0 && ang2 >= 0) || (ang1 <= 360 && ang2 >= 360)) - maxx = 1; - if ((ang1 <= 90 && ang2 >= 90) || (ang1 <= 450 && ang2 >= 450)) - maxy = 1; - if ((ang1 <= 180 && ang2 >= 180) || (ang1 <= 540 && ang2 >= 540)) - minx = -1; - if ((ang1 <= 270 && ang2 >= 270) || (ang1 <= 630 && ang2 >= 630)) - miny = -1; - - /* Finally, calculate bounds, converting sane geometry into pcb geometry */ - Arc->BoundingBox.X1 = Arc->X - Arc->Width * maxx; - Arc->BoundingBox.X2 = Arc->X - Arc->Width * minx; - Arc->BoundingBox.Y1 = Arc->Y + Arc->Height * miny; - Arc->BoundingBox.Y2 = Arc->Y + Arc->Height * maxy; - - width = (Arc->Thickness + Arc->Clearance) / 2; - - /* Adjust for our discrete polygon approximation */ - width = (double) width *MAX(POLY_CIRC_RADIUS_ADJ, (1.0 + POLY_ARC_MAX_DEVIATION)) + 0.5; - - Arc->BoundingBox.X1 -= width; - Arc->BoundingBox.X2 += width; - Arc->BoundingBox.Y1 -= width; - Arc->BoundingBox.Y2 += width; - close_box(&Arc->BoundingBox); -} - -BoxTypePtr GetArcEnds(ArcTypePtr Arc) -{ - static BoxType box; - box.X1 = Arc->X - Arc->Width * cos(Arc->StartAngle * PCB_M180); - box.Y1 = Arc->Y + Arc->Height * sin(Arc->StartAngle * PCB_M180); - box.X2 = Arc->X - Arc->Width * cos((Arc->StartAngle + Arc->Delta) * PCB_M180); - box.Y2 = Arc->Y + Arc->Height * sin((Arc->StartAngle + Arc->Delta) * PCB_M180); - return &box; -} - -/* doesn't these belong in change.c ?? */ -void ChangeArcAngles(LayerTypePtr Layer, ArcTypePtr a, Angle new_sa, Angle new_da) -{ - if (new_da >= 360) { - new_da = 360; - new_sa = 0; - } - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, a); - r_delete_entry(Layer->arc_tree, (BoxTypePtr) a); - AddObjectToChangeAnglesUndoList(PCB_TYPE_ARC, a, a, a); - a->StartAngle = new_sa; - a->Delta = new_da; - SetArcBoundingBox(a); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) a, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, a); -} - - -void ChangeArcRadii(LayerTypePtr Layer, ArcTypePtr a, Coord new_width, Coord new_height) -{ - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, a); - r_delete_entry(Layer->arc_tree, (BoxTypePtr) a); - AddObjectToChangeRadiiUndoList(PCB_TYPE_ARC, a, a, a); - a->Width = new_width; - a->Height = new_height; - SetArcBoundingBox(a); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) a, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, a); -} - -static char *BumpName(char *Name) -{ - int num; - char c, *start; - static char temp[256]; - - start = Name; - /* seek end of string */ - while (*Name != 0) - Name++; - /* back up to potential number */ - for (Name--; isdigit((int) *Name); Name--); - Name++; - if (*Name) - num = atoi(Name) + 1; - else - num = 1; - c = *Name; - *Name = 0; - sprintf(temp, "%s%d", start, num); - /* if this is not our string, put back the blown character */ - if (start != temp) - *Name = c; - return (temp); -} - -/* - * make a unique name for the name on board - * this can alter the contents of the input string - */ -char *UniqueElementName(DataTypePtr Data, char *Name) -{ - pcb_bool unique = pcb_true; - /* null strings are ok */ - if (!Name || !*Name) - return (Name); - - for (;;) { - ELEMENT_LOOP(Data); - { - if (NAMEONPCB_NAME(element) && NSTRCMP(NAMEONPCB_NAME(element), Name) == 0) { - Name = BumpName(Name); - unique = pcb_false; - break; - } - } - END_LOOP; - if (unique) - return (Name); - unique = pcb_true; - } -} - -static void GetGridLockCoordinates(int type, void *ptr1, void *ptr2, void *ptr3, Coord * x, Coord * y) -{ - switch (type) { - case PCB_TYPE_VIA: - *x = ((PinTypePtr) ptr2)->X; - *y = ((PinTypePtr) ptr2)->Y; - break; - case PCB_TYPE_LINE: - *x = ((LineTypePtr) ptr2)->Point1.X; - *y = ((LineTypePtr) ptr2)->Point1.Y; - break; - case PCB_TYPE_TEXT: - case PCB_TYPE_ELEMENT_NAME: - *x = ((TextTypePtr) ptr2)->X; - *y = ((TextTypePtr) ptr2)->Y; - break; - case PCB_TYPE_ELEMENT: - *x = ((ElementTypePtr) ptr2)->MarkX; - *y = ((ElementTypePtr) ptr2)->MarkY; - break; - case PCB_TYPE_POLYGON: - *x = ((PolygonTypePtr) ptr2)->Points[0].X; - *y = ((PolygonTypePtr) ptr2)->Points[0].Y; - break; - - case PCB_TYPE_LINE_POINT: - case PCB_TYPE_POLYGON_POINT: - *x = ((PointTypePtr) ptr3)->X; - *y = ((PointTypePtr) ptr3)->Y; - break; - case PCB_TYPE_ARC: - { - BoxTypePtr box; - - box = GetArcEnds((ArcTypePtr) ptr2); - *x = box->X1; - *y = box->Y1; - break; - } - } -} - -void AttachForCopy(Coord PlaceX, Coord PlaceY) -{ - BoxTypePtr box; - Coord mx = 0, my = 0; - - Crosshair.AttachedObject.RubberbandN = 0; - if (!conf_core.editor.snap_pin) { - /* dither the grab point so that the mark, center, etc - * will end up on a grid coordinate - */ - GetGridLockCoordinates(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3, &mx, &my); - mx = GridFit(mx, PCB->Grid, PCB->GridOffsetX) - mx; - my = GridFit(my, PCB->Grid, PCB->GridOffsetY) - my; - } - Crosshair.AttachedObject.X = PlaceX - mx; - Crosshair.AttachedObject.Y = PlaceY - my; - if (!Marked.status || conf_core.editor.local_ref) - SetLocalRef(PlaceX - mx, PlaceY - my, pcb_true); - Crosshair.AttachedObject.State = STATE_SECOND; - - /* get boundingbox of object and set cursor range */ - box = GetObjectBoundingBox(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); - SetCrosshairRange(Crosshair.AttachedObject.X - box->X1, - Crosshair.AttachedObject.Y - box->Y1, - PCB->MaxWidth - (box->X2 - Crosshair.AttachedObject.X), - PCB->MaxHeight - (box->Y2 - Crosshair.AttachedObject.Y)); - - /* get all attached objects if necessary */ - if ((conf_core.editor.mode != PCB_MODE_COPY) && conf_core.editor.rubber_band_mode) - LookupRubberbandLines(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); - if (conf_core.editor.mode != PCB_MODE_COPY && - (Crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT || - Crosshair.AttachedObject.Type == PCB_TYPE_VIA || - Crosshair.AttachedObject.Type == PCB_TYPE_LINE || Crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT)) - LookupRatLines(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); -} - -/* This just fills in a FlagType with current flags. */ -FlagType MakeFlags(unsigned int flags) -{ - FlagType rv; - memset(&rv, 0, sizeof(rv)); - rv.f = flags; - return rv; -} - -/* This converts old flag bits (from saved PCB files) to new format. */ -FlagType OldFlags(unsigned int flags) -{ - FlagType rv; - int i, f; - memset(&rv, 0, sizeof(rv)); - /* If we move flag bits around, this is where we map old bits to them. */ - rv.f = flags & 0xffff; - f = 0x10000; - for (i = 0; i < 8; i++) { - /* use the closest thing to the old thermal style */ - if (flags & f) - rv.t[i / 2] |= (1 << (4 * (i % 2))); - f <<= 1; - } - return rv; -} - -FlagType AddFlags(FlagType flag, unsigned int flags) -{ - flag.f |= flags; - return flag; -} - -FlagType MaskFlags(FlagType flag, unsigned int flags) -{ - flag.f &= ~flags; - return flag; -} - -char *AttributeGetFromList(AttributeListType * list, const char *name) -{ - int i; - for (i = 0; i < list->Number; i++) - if (strcmp(name, list->List[i].name) == 0) - return list->List[i].value; - return NULL; -} - -int AttributePutToList(AttributeListType * list, const char *name, const char *value, int replace) -{ - int i; - - /* If we're allowed to replace an existing attribute, see if we - can. */ - if (replace) { - for (i = 0; i < list->Number; i++) - if (strcmp(name, list->List[i].name) == 0) { - free(list->List[i].value); - list->List[i].value = pcb_strdup_null(value); - return 1; - } - } - - /* At this point, we're going to need to add a new attribute to the - list. See if there's room. */ - if (list->Number >= list->Max) { - list->Max += 10; - list->List = (AttributeType *) realloc(list->List, list->Max * sizeof(AttributeType)); - } - - /* Now add the new attribute. */ - i = list->Number; - list->List[i].name = pcb_strdup_null(name); - list->List[i].value = pcb_strdup_null(value); - list->Number++; - return 0; -} - -int AttributeRemoveFromList(AttributeListType * list, const char *name) -{ - int i, j, found = 0; - for (i = 0; i < list->Number; i++) - if (strcmp(name, list->List[i].name) == 0) { - free(list->List[i].name); - free(list->List[i].value); - found++; - for (j = i; j < list->Number - i; j++) - list->List[j] = list->List[j + 1]; - list->Number--; - } - return found; -} - -void r_delete_element(DataType * data, ElementType * element) -{ - r_delete_entry(data->element_tree, (BoxType *) element); - PIN_LOOP(element); - { - r_delete_entry(data->pin_tree, (BoxType *) pin); - } - END_LOOP; - PAD_LOOP(element); - { - r_delete_entry(data->pad_tree, (BoxType *) pad); - } - END_LOOP; - ELEMENTTEXT_LOOP(element); - { - r_delete_entry(data->name_tree[n], (BoxType *) text); - } - END_LOOP; -} - - -/* --------------------------------------------------------------------------- - * Returns a string that has a bunch of information about the program. - * Can be used for things like "about" dialog boxes. - */ - -char *GetInfoString(void) -{ - HID **hids; - int i; - static gds_t info; - static int first_time = 1; - -#define TAB " " - - if (first_time) { - first_time = 0; - gds_append_str(&info, "This is PCB-rnd " VERSION " (" REVISION ")" "\n an interactive\n"); - gds_append_str(&info, "printed circuit board editor\n"); - gds_append_str(&info, "PCB-rnd forked from PCB version."); - gds_append_str(&info, "\n\n" "PCB is by harry eaton and others\n\n"); - gds_append_str(&info, "\nPCB-rnd adds a collection of\n"); - gds_append_str(&info, "useful-looking random patches.\n"); - gds_append_str(&info, "\n"); - gds_append_str(&info, "Copyright (C) Thomas Nau 1994, 1995, 1996, 1997\n"); - gds_append_str(&info, "Copyright (C) harry eaton 1998-2007\n"); - gds_append_str(&info, "Copyright (C) C. Scott Ananian 2001\n"); - gds_append_str(&info, "Copyright (C) DJ Delorie 2003, 2004, 2005, 2006, 2007, 2008\n"); - gds_append_str(&info, "Copyright (C) Dan McMahill 2003, 2004, 2005, 2006, 2007, 2008\n\n"); - gds_append_str(&info, "Copyright (C) Tibor Palinkas 2013-2016 (pcb-rnd patches)\n\n"); - gds_append_str(&info, "It is licensed under the terms of the GNU\n"); - gds_append_str(&info, "General Public License version 2\n"); - gds_append_str(&info, "See the LICENSE file for more information\n\n"); - gds_append_str(&info, "For more information see:\n\n"); - gds_append_str(&info, "PCB-rnd homepage: http://repo.hu/projects/pcb-rnd\n"); - gds_append_str(&info, "PCB homepage: http://pcb.geda-project.org\n"); - gds_append_str(&info, "gEDA homepage: http://www.geda-project.org\n"); - gds_append_str(&info, "gEDA Wiki: http://wiki.geda-project.org\n\n"); - - gds_append_str(&info, "----- Compile Time Options -----\n"); - hids = hid_enumerate(); - gds_append_str(&info, "GUI:\n"); - for (i = 0; hids[i]; i++) { - if (hids[i]->gui) { - gds_append_str(&info, TAB); - gds_append_str(&info, hids[i]->name); - gds_append_str(&info, " : "); - gds_append_str(&info, hids[i]->description); - gds_append_str(&info, "\n"); - } - } - - gds_append_str(&info, "Exporters:\n"); - for (i = 0; hids[i]; i++) { - if (hids[i]->exporter) { - gds_append_str(&info, TAB); - gds_append_str(&info, hids[i]->name); - gds_append_str(&info, " : "); - gds_append_str(&info, hids[i]->description); - gds_append_str(&info, "\n"); - } - } - - gds_append_str(&info, "Printers:\n"); - for (i = 0; hids[i]; i++) { - if (hids[i]->printer) { - gds_append_str(&info, TAB); - gds_append_str(&info, hids[i]->name); - gds_append_str(&info, " : "); - gds_append_str(&info, hids[i]->description); - gds_append_str(&info, "\n"); - } - } - } -#undef TAB - - return info.array; -} - -const char *pcb_author(void) -{ - if (conf_core.design.fab_author && conf_core.design.fab_author[0]) - return conf_core.design.fab_author; - else - return get_user_name(); -} - - -/* --------------------------------------------------------------------------- - * Returns a best guess about the orientation of an element. The - * value corresponds to the rotation; a difference is the right value - * to pass to RotateElementLowLevel. However, the actual value is no - * indication of absolute rotation; only relative rotation is - * meaningful. - */ - -int ElementOrientation(ElementType * e) -{ - Coord pin1x, pin1y, pin2x, pin2y, dx, dy; - pcb_bool found_pin1 = 0; - pcb_bool found_pin2 = 0; - - /* in case we don't find pin 1 or 2, make sure we have initialized these variables */ - pin1x = 0; - pin1y = 0; - pin2x = 0; - pin2y = 0; - - PIN_LOOP(e); - { - if (NSTRCMP(pin->Number, "1") == 0) { - pin1x = pin->X; - pin1y = pin->Y; - found_pin1 = 1; - } - else if (NSTRCMP(pin->Number, "2") == 0) { - pin2x = pin->X; - pin2y = pin->Y; - found_pin2 = 1; - } - } - END_LOOP; - - PAD_LOOP(e); - { - if (NSTRCMP(pad->Number, "1") == 0) { - pin1x = (pad->Point1.X + pad->Point2.X) / 2; - pin1y = (pad->Point1.Y + pad->Point2.Y) / 2; - found_pin1 = 1; - } - else if (NSTRCMP(pad->Number, "2") == 0) { - pin2x = (pad->Point1.X + pad->Point2.X) / 2; - pin2y = (pad->Point1.Y + pad->Point2.Y) / 2; - found_pin2 = 1; - } - } - END_LOOP; - - if (found_pin1 && found_pin2) { - dx = pin2x - pin1x; - dy = pin2y - pin1y; - } - else if (found_pin1 && (pin1x || pin1y)) { - dx = pin1x; - dy = pin1y; - } - else if (found_pin2 && (pin2x || pin2y)) { - dx = pin2x; - dy = pin2y; - } - else - return 0; - - if (coord_abs(dx) > coord_abs(dy)) - return dx > 0 ? 0 : 2; - return dy > 0 ? 3 : 1; -} - -int ActionListRotations(int argc, const char **argv, Coord x, Coord y) -{ - ELEMENT_LOOP(PCB->Data); - { - printf("%d %s\n", ElementOrientation(element), NAMEONPCB_NAME(element)); - } - END_LOOP; - - return 0; -} - -HID_Action misc_action_list[] = { - {"ListRotations", 0, ActionListRotations, - 0, 0} - , -}; - -REGISTER_ACTIONS(misc_action_list, NULL) Index: 1.1.4/src/line.h =================================================================== --- 1.1.4/src/line.h (revision 10776) +++ 1.1.4/src/line.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 2004 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for inserting points into objects */ - -#ifndef PCB_LINE_H -#define PCB_LINE_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * prototypes - */ -void AdjustAttachedLine(void); -void AdjustTwoLine(pcb_bool); -void FortyFiveLine(AttachedLineTypePtr); -void EnforceLineDRC(void); -#endif Index: 1.1.4/src/conf_core.c =================================================================== --- 1.1.4/src/conf_core.c (revision 10776) +++ 1.1.4/src/conf_core.c (nonexistent) @@ -1,58 +0,0 @@ -#include "conf.h" -#include "conf_core.h" -conf_core_t conf_core; - -void conf_core_init() -{ -#define conf_reg(field,isarray,type_name,cpath,cname,desc,flags) \ - conf_reg_field(conf_core, field,isarray,type_name,cpath,cname,desc,flags); -#include "conf_core_fields.h" -} - -#define conf_clamp_to(type, var, min, max, safe_val) \ -do { \ - if ((var < min) || (var > max)) \ - *((type *)(&var)) = safe_val; \ -} while(0) - -#define conf_clamp(type, var, min, max) \ -do { \ - if (var < min) \ - *((type *)(&var)) = min; \ - else if (var > max) \ - *((type *)(&var)) = max; \ -} while(0) - -static char *get_homedir(void) -{ - char *homedir = getenv("HOME"); - if (homedir == NULL) - homedir = getenv("USERPROFILE"); - return homedir; -} - -static void conf_ro(const char *path) -{ - conf_native_t *n = conf_get_field(path); - if (n != NULL) { - n->used = 1; - n->random_flags.read_only = 1; - } -} - -void conf_core_postproc() -{ - conf_clamp_to(CFT_COORD, conf_core.design.line_thickness, MIN_LINESIZE, MAX_LINESIZE, PCB_MIL_TO_COORD(10)); - conf_clamp_to(CFT_COORD, conf_core.design.via_thickness, MIN_PINORVIASIZE, MAX_PINORVIASIZE, PCB_MIL_TO_COORD(40)); - conf_clamp_to(CFT_COORD, conf_core.design.via_drilling_hole, 0, MAX_COORD, DEFAULT_DRILLINGHOLE * conf_core.design.via_thickness / 100); - conf_clamp(CFT_COORD, conf_core.design.max_width, MIN_SIZE, MAX_COORD); - conf_clamp(CFT_COORD, conf_core.design.max_height, MIN_SIZE, MAX_COORD); - conf_force_set_bool(conf_core.rc.have_regex, 1); - conf_ro("rc/have_regex"); - - conf_force_set_str(conf_core.rc.path.prefix, PCB_PREFIX); conf_ro("rc/path/prefix"); - conf_force_set_str(conf_core.rc.path.lib, PCBLIBDIR); conf_ro("rc/path/lib"); - conf_force_set_str(conf_core.rc.path.bin, BINDIR); conf_ro("rc/path/bin"); - conf_force_set_str(conf_core.rc.path.share, PCBSHAREDIR); conf_ro("rc/path/share"); - conf_force_set_str(conf_core.rc.path.home, get_homedir()); conf_ro("rc/path/home"); -} Index: 1.1.4/src/remove.c =================================================================== --- 1.1.4/src/remove.c (revision 10776) +++ 1.1.4/src/remove.c (nonexistent) @@ -1,561 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* functions used to remove vias, pins ... */ - -#include "config.h" -#include "conf_core.h" - -#include -#include - -#include "data.h" -#include "draw.h" -#include "misc.h" -#include "move.h" -#include "polygon.h" -#include "remove.h" -#include "rtree.h" -#include "select.h" -#include "undo.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void *DestroyVia(PinTypePtr); -static void *DestroyRat(RatTypePtr); -static void *DestroyLine(LayerTypePtr, LineTypePtr); -static void *DestroyArc(LayerTypePtr, ArcTypePtr); -static void *DestroyText(LayerTypePtr, TextTypePtr); -static void *DestroyPolygon(LayerTypePtr, PolygonTypePtr); -static void *DestroyElement(ElementTypePtr); -static void *RemoveVia(PinTypePtr); -static void *RemoveRat(RatTypePtr); -static void *DestroyPolygonPoint(LayerTypePtr, PolygonTypePtr, PointTypePtr); -static void *RemovePolygonContour(LayerTypePtr, PolygonTypePtr, pcb_cardinal_t); -static void *RemovePolygonPoint(LayerTypePtr, PolygonTypePtr, PointTypePtr); -static void *RemoveLinePoint(LayerTypePtr, LineTypePtr, PointTypePtr); - -/* --------------------------------------------------------------------------- - * some local types - */ -static ObjectFunctionType RemoveFunctions = { - RemoveLine, - RemoveText, - RemovePolygon, - RemoveVia, - RemoveElement, - NULL, - NULL, - NULL, - RemoveLinePoint, - RemovePolygonPoint, - RemoveArc, - RemoveRat -}; - -static ObjectFunctionType DestroyFunctions = { - DestroyLine, - DestroyText, - DestroyPolygon, - DestroyVia, - DestroyElement, - NULL, - NULL, - NULL, - NULL, - DestroyPolygonPoint, - DestroyArc, - DestroyRat -}; - -static DataTypePtr DestroyTarget; -static pcb_bool Bulk = pcb_false; - -/* --------------------------------------------------------------------------- - * remove PCB - */ -void RemovePCB(PCBTypePtr Ptr) -{ - ClearUndoList(pcb_true); - FreePCBMemory(Ptr); - free(Ptr); -} - -/* --------------------------------------------------------------------------- - * destroys a via - */ -static void *DestroyVia(PinTypePtr Via) -{ - r_delete_entry(DestroyTarget->via_tree, (BoxTypePtr) Via); - free(Via->Name); - - RemoveFreeVia(Via); - return NULL; -} - -/* --------------------------------------------------------------------------- - * destroys a line from a layer - */ -static void *DestroyLine(LayerTypePtr Layer, LineTypePtr Line) -{ - r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); - free(Line->Number); - - RemoveFreeLine(Line); - return NULL; -} - -/* --------------------------------------------------------------------------- - * destroys an arc from a layer - */ -static void *DestroyArc(LayerTypePtr Layer, ArcTypePtr Arc) -{ - r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); - - RemoveFreeArc(Arc); - - return NULL; -} - -/* --------------------------------------------------------------------------- - * destroys a polygon from a layer - */ -static void *DestroyPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - r_delete_entry(Layer->polygon_tree, (BoxTypePtr) Polygon); - FreePolygonMemory(Polygon); - - RemoveFreePolygon(Polygon); - - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes a polygon-point from a polygon and destroys the data - */ -static void *DestroyPolygonPoint(LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) -{ - pcb_cardinal_t point_idx; - pcb_cardinal_t i; - pcb_cardinal_t contour; - pcb_cardinal_t contour_start, contour_end, contour_points; - - point_idx = polygon_point_idx(Polygon, Point); - contour = polygon_point_contour(Polygon, point_idx); - contour_start = (contour == 0) ? 0 : Polygon->HoleIndex[contour - 1]; - contour_end = (contour == Polygon->HoleIndexN) ? Polygon->PointN : Polygon->HoleIndex[contour]; - contour_points = contour_end - contour_start; - - if (contour_points <= 3) - return RemovePolygonContour(Layer, Polygon, contour); - - r_delete_entry(Layer->polygon_tree, (BoxType *) Polygon); - - /* remove point from list, keep point order */ - for (i = point_idx; i < Polygon->PointN - 1; i++) - Polygon->Points[i] = Polygon->Points[i + 1]; - Polygon->PointN--; - - /* Shift down indices of any holes */ - for (i = 0; i < Polygon->HoleIndexN; i++) - if (Polygon->HoleIndex[i] > point_idx) - Polygon->HoleIndex[i]--; - - SetPolygonBoundingBox(Polygon); - r_insert_entry(Layer->polygon_tree, (BoxType *) Polygon, 0); - InitClip(PCB->Data, Layer, Polygon); - return (Polygon); -} - -/* --------------------------------------------------------------------------- - * destroys a text from a layer - */ -static void *DestroyText(LayerTypePtr Layer, TextTypePtr Text) -{ - free(Text->TextString); - r_delete_entry(Layer->text_tree, (BoxTypePtr) Text); - - RemoveFreeText(Text); - - return NULL; -} - -/* --------------------------------------------------------------------------- - * destroys a element - */ -static void *DestroyElement(ElementTypePtr Element) -{ - if (DestroyTarget->element_tree) - r_delete_entry(DestroyTarget->element_tree, (BoxType *) Element); - if (DestroyTarget->pin_tree) { - PIN_LOOP(Element); - { - r_delete_entry(DestroyTarget->pin_tree, (BoxType *) pin); - } - END_LOOP; - } - if (DestroyTarget->pad_tree) { - PAD_LOOP(Element); - { - r_delete_entry(DestroyTarget->pad_tree, (BoxType *) pad); - } - END_LOOP; - } - ELEMENTTEXT_LOOP(Element); - { - if (DestroyTarget->name_tree[n]) - r_delete_entry(DestroyTarget->name_tree[n], (BoxType *) text); - } - END_LOOP; - FreeElementMemory(Element); - - RemoveFreeElement(Element); - - return NULL; -} - -/* --------------------------------------------------------------------------- - * destroys a rat - */ -static void *DestroyRat(RatTypePtr Rat) -{ - if (DestroyTarget->rat_tree) - r_delete_entry(DestroyTarget->rat_tree, &Rat->BoundingBox); - - RemoveFreeRat(Rat); - return NULL; -} - - -/* --------------------------------------------------------------------------- - * removes a via - */ -static void *RemoveVia(PinTypePtr Via) -{ - /* erase from screen and memory */ - if (PCB->ViaOn) { - EraseVia(Via); - if (!Bulk) - Draw(); - } - MoveObjectToRemoveUndoList(PCB_TYPE_VIA, Via, Via, Via); - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes a rat - */ -static void *RemoveRat(RatTypePtr Rat) -{ - /* erase from screen and memory */ - if (PCB->RatOn) { - EraseRat(Rat); - if (!Bulk) - Draw(); - } - MoveObjectToRemoveUndoList(PCB_TYPE_RATLINE, Rat, Rat, Rat); - return NULL; -} - -struct rlp_info { - jmp_buf env; - LineTypePtr line; - PointTypePtr point; -}; -static r_dir_t remove_point(const BoxType * b, void *cl) -{ - LineType *line = (LineType *) b; - struct rlp_info *info = (struct rlp_info *) cl; - if (line == info->line) - return R_DIR_NOT_FOUND; - if ((line->Point1.X == info->point->X) - && (line->Point1.Y == info->point->Y)) { - info->line = line; - info->point = &line->Point1; - longjmp(info->env, 1); - } - else if ((line->Point2.X == info->point->X) - && (line->Point2.Y == info->point->Y)) { - info->line = line; - info->point = &line->Point2; - longjmp(info->env, 1); - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * removes a line point, or a line if the selected point is the end - */ -static void *RemoveLinePoint(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) -{ - PointType other; - struct rlp_info info; - if (&Line->Point1 == Point) - other = Line->Point2; - else - other = Line->Point1; - info.line = Line; - info.point = Point; - if (setjmp(info.env) == 0) { - r_search(Layer->line_tree, (const BoxType *) Point, NULL, remove_point, &info, NULL); - return RemoveLine(Layer, Line); - } - MoveObject(PCB_TYPE_LINE_POINT, Layer, info.line, info.point, other.X - Point->X, other.Y - Point->Y); - return (RemoveLine(Layer, Line)); -} - -/* --------------------------------------------------------------------------- - * removes a line from a layer - */ -void *RemoveLine(LayerTypePtr Layer, LineTypePtr Line) -{ - /* erase from screen */ - if (Layer->On) { - EraseLine(Line); - if (!Bulk) - Draw(); - } - MoveObjectToRemoveUndoList(PCB_TYPE_LINE, Layer, Line, Line); - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes an arc from a layer - */ -void *RemoveArc(LayerTypePtr Layer, ArcTypePtr Arc) -{ - /* erase from screen */ - if (Layer->On) { - EraseArc(Arc); - if (!Bulk) - Draw(); - } - MoveObjectToRemoveUndoList(PCB_TYPE_ARC, Layer, Arc, Arc); - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes a text from a layer - */ -void *RemoveText(LayerTypePtr Layer, TextTypePtr Text) -{ - /* erase from screen */ - if (Layer->On) { - EraseText(Layer, Text); - if (!Bulk) - Draw(); - } - MoveObjectToRemoveUndoList(PCB_TYPE_TEXT, Layer, Text, Text); - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes a polygon from a layer - */ -void *RemovePolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - /* erase from screen */ - if (Layer->On) { - ErasePolygon(Polygon); - if (!Bulk) - Draw(); - } - MoveObjectToRemoveUndoList(PCB_TYPE_POLYGON, Layer, Polygon, Polygon); - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes a contour from a polygon. - * If removing the outer contour, it removes the whole polygon. - */ -static void *RemovePolygonContour(LayerTypePtr Layer, PolygonTypePtr Polygon, pcb_cardinal_t contour) -{ - pcb_cardinal_t contour_start, contour_end, contour_points; - pcb_cardinal_t i; - - if (contour == 0) - return RemovePolygon(Layer, Polygon); - - if (Layer->On) { - ErasePolygon(Polygon); - if (!Bulk) - Draw(); - } - - /* Copy the polygon to the undo list */ - AddObjectToRemoveContourUndoList(PCB_TYPE_POLYGON, Layer, Polygon); - - contour_start = (contour == 0) ? 0 : Polygon->HoleIndex[contour - 1]; - contour_end = (contour == Polygon->HoleIndexN) ? Polygon->PointN : Polygon->HoleIndex[contour]; - contour_points = contour_end - contour_start; - - /* remove points from list, keep point order */ - for (i = contour_start; i < Polygon->PointN - contour_points; i++) - Polygon->Points[i] = Polygon->Points[i + contour_points]; - Polygon->PointN -= contour_points; - - /* remove hole from list and shift down remaining indices */ - for (i = contour; i < Polygon->HoleIndexN; i++) - Polygon->HoleIndex[i - 1] = Polygon->HoleIndex[i] - contour_points; - Polygon->HoleIndexN--; - - InitClip(PCB->Data, Layer, Polygon); - /* redraw polygon if necessary */ - if (Layer->On) { - DrawPolygon(Layer, Polygon); - if (!Bulk) - Draw(); - } - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes a polygon-point from a polygon - */ -static void *RemovePolygonPoint(LayerTypePtr Layer, PolygonTypePtr Polygon, PointTypePtr Point) -{ - pcb_cardinal_t point_idx; - pcb_cardinal_t i; - pcb_cardinal_t contour; - pcb_cardinal_t contour_start, contour_end, contour_points; - - point_idx = polygon_point_idx(Polygon, Point); - contour = polygon_point_contour(Polygon, point_idx); - contour_start = (contour == 0) ? 0 : Polygon->HoleIndex[contour - 1]; - contour_end = (contour == Polygon->HoleIndexN) ? Polygon->PointN : Polygon->HoleIndex[contour]; - contour_points = contour_end - contour_start; - - if (contour_points <= 3) - return RemovePolygonContour(Layer, Polygon, contour); - - if (Layer->On) - ErasePolygon(Polygon); - - /* insert the polygon-point into the undo list */ - AddObjectToRemovePointUndoList(PCB_TYPE_POLYGON_POINT, Layer, Polygon, point_idx); - r_delete_entry(Layer->polygon_tree, (BoxType *) Polygon); - - /* remove point from list, keep point order */ - for (i = point_idx; i < Polygon->PointN - 1; i++) - Polygon->Points[i] = Polygon->Points[i + 1]; - Polygon->PointN--; - - /* Shift down indices of any holes */ - for (i = 0; i < Polygon->HoleIndexN; i++) - if (Polygon->HoleIndex[i] > point_idx) - Polygon->HoleIndex[i]--; - - SetPolygonBoundingBox(Polygon); - r_insert_entry(Layer->polygon_tree, (BoxType *) Polygon, 0); - RemoveExcessPolygonPoints(Layer, Polygon); - InitClip(PCB->Data, Layer, Polygon); - - /* redraw polygon if necessary */ - if (Layer->On) { - DrawPolygon(Layer, Polygon); - if (!Bulk) - Draw(); - } - return NULL; -} - -/* --------------------------------------------------------------------------- - * removes an element - */ -void *RemoveElement(ElementTypePtr Element) -{ - /* erase from screen */ - if ((PCB->ElementOn || PCB->PinOn) && (FRONT(Element) || PCB->InvisibleObjectsOn)) { - EraseElement(Element); - if (!Bulk) - Draw(); - } - MoveObjectToRemoveUndoList(PCB_TYPE_ELEMENT, Element, Element, Element); - return NULL; -} - -/* ---------------------------------------------------------------------- - * removes all selected and visible objects - * returns pcb_true if any objects have been removed - */ -pcb_bool RemoveSelected(void) -{ - Bulk = pcb_true; - if (SelectedOperation(&RemoveFunctions, pcb_false, PCB_TYPEMASK_ALL)) { - IncrementUndoSerialNumber(); - Draw(); - Bulk = pcb_false; - return (pcb_true); - } - Bulk = pcb_false; - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * remove object as referred by pointers and type, - * allocated memory is passed to the 'remove undo' list - */ -void *RemoveObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - void *ptr = ObjectOperation(&RemoveFunctions, Type, Ptr1, Ptr2, Ptr3); - return (ptr); -} - -/* --------------------------------------------------------------------------- - * DeleteRats - deletes rat lines only - * can delete all rat lines, or only selected one - */ - -pcb_bool DeleteRats(pcb_bool selected) -{ - pcb_bool changed = pcb_false; - Bulk = pcb_true; - RAT_LOOP(PCB->Data); - { - if ((!selected) || TEST_FLAG(PCB_FLAG_SELECTED, line)) { - changed = pcb_true; - RemoveRat(line); - } - } - END_LOOP; - Bulk = pcb_false; - if (changed) { - Draw(); - IncrementUndoSerialNumber(); - } - return (changed); -} - -/* --------------------------------------------------------------------------- - * remove object as referred by pointers and type - * allocated memory is destroyed assumed to already be erased - */ -void *DestroyObject(DataTypePtr Target, int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - DestroyTarget = Target; - return (ObjectOperation(&DestroyFunctions, Type, Ptr1, Ptr2, Ptr3)); -} Index: 1.1.4/src/compat_misc.c =================================================================== --- 1.1.4/src/compat_misc.c (revision 10776) +++ 1.1.4/src/compat_misc.c (nonexistent) @@ -1,134 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2004, 2006 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "config.h" - -#include -#include -#include "compat_misc.h" -#include "compat_inc.h" -#include "global.h" -#ifdef HAVE_UNISTD_H -#include -#endif - -/* On some old systems random() works better than rand(). Unfortunately -random() is less portable than rand(), which is C89. By default, just -use rand(). Later on: scconfig should detect and enable random() if -we find a system where it really breaks. */ -#ifdef HAVE_RANDOM -long pcb_rand(void) -{ - return (long) random(); -} -#else -long pcb_rand(void) -{ - return (long) rand(); -} -#endif - -const char *get_user_name(void) -{ -#ifdef HAVE_GETPWUID - static struct passwd *pwentry; - - int len; - char *comma, *gecos, *fab_author; - - /* ID the user. */ - pwentry = getpwuid(getuid()); - gecos = pwentry->pw_gecos; - comma = strchr(gecos, ','); - if (comma) - len = comma - gecos; - else - len = strlen(gecos); - fab_author = (char *) malloc(len + 1); - if (!fab_author) { - perror("pcb: out of memory.\n"); - exit(-1); - } - memcpy(fab_author, gecos, len); - fab_author[len] = 0; - return fab_author; -#else - return "Unknown"; -#endif -} - -int pcb_getpid(void) -{ - return getpid(); -} - -char *pcb_strndup(const char *s, int len) -{ - int a, l = strlen(s); - char *o; - - a = (len < l) ? len : l; - o = malloc(a+1); - memcpy(o, s, a); - o[a] = '\0'; - return o; -} - -char *pcb_strdup(const char *s) -{ - int l = strlen(s); - char *o; - o = malloc(l+1); - memcpy(o, s, l+1); - return o; -} - -#ifdef HAVE_ROUND -#undef round -extern double round(double x); -double pcb_round(double x) -{ - return round(x); -} -#else - -/* Implementation idea borrowed from an old gcc (GPL'd) */ -double pcb_round(double x) -{ - double t; - -/* We should check for inf here, but inf is not in C89; if we'd have isinf(), - we'd have round() as well and we wouldn't be here at all. */ - - if (x >= 0.0) { - t = ceil(x); - if (t - x > 0.5) - t -= 1.0; - return t; - } - - t = ceil(-x); - if ((t + x) > 0.5) - t -= 1.0; - return -t; -} -#endif Index: 1.1.4/src/plug_io.c =================================================================== --- 1.1.4/src/plug_io.c (revision 10776) +++ 1.1.4/src/plug_io.c (nonexistent) @@ -1,935 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,1997,1998,2005,2006 Thomas Nau - * Copyright (C) 2015,2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* This used to be file.c; some of the code landed in the io_pcb plugin, - the format-independent parts ended up here. */ - -/* file save, load, merge ... routines */ - -#warning TODO: do not hardwire this, make a function to decide -#define DEFAULT_FMT "pcb" - -/* for popen() */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - -#include "config.h" -#include "conf_core.h" - -#include -#include "global.h" - -#include -#include - -#include -#include -#include - -#include "buffer.h" -#include "change.h" -#include "create.h" -#include "data.h" -#include "error.h" -#include "plug_io.h" -#include "misc.h" -#include "remove.h" -#include "set.h" -#include "paths.h" -#include "rats_patch.h" -#include "hid_actions.h" -#include "hid_flags.h" -#include "pcb-printf.h" -#include "plugins.h" -#include "event.h" -#include "compat_misc.h" -#include "route_style.h" -#include "compat_fs.h" - -/* for opendir */ -#include "compat_inc.h" - -plug_io_t *plug_io_chain = NULL; -int pcb_io_err_inhibit = 0; - -static void plug_io_err(int res, const char *what, const char *filename) -{ - if (pcb_io_err_inhibit) - return; - if (res != 0) { - const char *reason = "", *comment = ""; - if (plug_io_chain != NULL) { - if (filename == NULL) { - reason = "none of io plugins could successfully write the file"; - filename = ""; - } - else { - FILE *f; - reason = "none of io plugins could successfully read file"; - f = fopen(filename, "r"); - if (f != NULL) { - fclose(f); - comment = "(unknown/invalid file format?)"; - } - else - comment = "(can not open the file for reading)"; - } - } - else { - reason = "no io plugin loaded, I don't know any file format"; - if (filename == NULL) - filename = ""; - } - Message(PCB_MSG_DEFAULT, "IO error during %s: %s %s %s\n", what, reason, filename, comment); - } -} - -int ParsePCB(PCBTypePtr Ptr, const char *Filename, const char *fmt, int load_settings) -{ - int res = -1; - - if (load_settings) - event(EVENT_LOAD_PRE, "s", Filename); - - Ptr->Data->loader = NULL; - - if (fmt != NULL) { - pcb_find_io_t available[PCB_IO_MAX_FORMATS]; - int len, n; - len = pcb_find_io(available, sizeof(available)/sizeof(available[0]), PCB_IOT_PCB, 0, fmt); - if (len <= 0) { - Message(PCB_MSG_DEFAULT, "Error: can't find a IO_ plugin to load a PCB using format %s\n", fmt); - return -1; - } - for(n = 0; n < len; n++) { - if (available[0].plug->parse_pcb == NULL) - continue; - res = available[0].plug->parse_pcb(available[0].plug, Ptr, Filename, load_settings); - if (res == 0) { - Ptr->Data->loader = available[0].plug; - break; - } - } - } - else /* try all parsers until we find one that works */ - HOOK_CALL_DO(plug_io_t, plug_io_chain, parse_pcb, res, == 0, (self, Ptr, Filename, load_settings), if (Ptr->Data->loader == NULL) Ptr->Data->loader = self); - - if ((res == 0) && (load_settings)) - conf_load_project(NULL, Filename); - - if (load_settings) - event(EVENT_LOAD_POST, "si", Filename, res); - - plug_io_err(res, "load pcb", Filename); - return res; -} - -int ParseElement(DataTypePtr Ptr, const char *name) -{ - int res = -1; - - Ptr->loader = NULL; - HOOK_CALL_DO(plug_io_t, plug_io_chain, parse_element, res, == 0, (self, Ptr, name), Ptr->loader = self); - - plug_io_err(res, "load element", name); - return res; -} - -int ParseFont(FontTypePtr Ptr, char *Filename) -{ - int res = -1; - HOOK_CALL(plug_io_t, plug_io_chain, parse_font, res, == 0, (self, Ptr, Filename)); - - plug_io_err(res, "load font", Filename); - return res; -} - -static int find_prio_cmp(const void *p1, const void *p2) -{ - const pcb_find_io_t *f1 = p1, *f2 = p2; - if (f1->prio < f2->prio) - return 1; - return -1; -} - -int pcb_find_io(pcb_find_io_t *available, int avail_len, plug_iot_t typ, int is_wr, const char *fmt) -{ - int len = 0; - -#define cb_append(pl, pr) \ - do { \ - if (pr > 0) { \ - assert(len < avail_len ); \ - available[len].plug = pl; \ - if (fmt == NULL) \ - available[len].prio = pl->save_preference_prio; \ - else \ - available[len].prio = pr; \ - len++; \ - } \ - } while(0) - - HOOK_CALL_ALL(plug_io_t, plug_io_chain, fmt_support_prio, cb_append, (self, typ, is_wr, (fmt == NULL ? self->default_fmt : fmt))); - - if (len > 0) - qsort(available, len, sizeof(available[0]), find_prio_cmp); -#undef cb_append - - return len; -} - -/* Find the plugin that offers the highest write prio for the format */ -static plug_io_t *find_writer(plug_iot_t typ, const char *fmt) -{ - pcb_find_io_t available[PCB_IO_MAX_FORMATS]; - int len; - - if (fmt == NULL) { -#warning TODO: make this configurable, default to lihata - fmt = "pcb"; - } - - len = pcb_find_io(available, sizeof(available)/sizeof(available[0]), typ, 1, fmt); - - if (len == 0) - return NULL; - - return available[0].plug; -} - - -int WriteBuffer(FILE *f, BufferType *buff, const char *fmt) -{ - int res, newfmt = 0; - plug_io_t *p = find_writer(PCB_IOT_BUFFER, fmt); - - if (p != NULL) { - res = p->write_buffer(p, f, buff); - newfmt = 1; - } - -/* if ((res == 0) && (newfmt)) - PCB->Data->loader = p;*/ - - plug_io_err(res, "write buffer", NULL); - return res; -} - -int WriteElementData(FILE *f, DataTypePtr e, const char *fmt) -{ - int res, newfmt = 0; - plug_io_t *p = e->loader; - - if ((p == NULL) || ((fmt != NULL) && (*fmt != '\0'))) { - p = find_writer(PCB_IOT_FOOTPRINT, fmt); - newfmt = 1; - } - - if (p != NULL) - res = p->write_element(p, f, e); - - if ((res == 0) && (newfmt)) - e->loader = p; - - plug_io_err(res, "write element", NULL); - return res; -} - -static int pcb_write_pcb(FILE *f, const char *old_filename, const char *new_filename, const char *fmt, pcb_bool emergency) -{ - int res, newfmt = 0; - plug_io_t *p = PCB->Data->loader; - - if ((p == NULL) || ((fmt != NULL) && (*fmt != '\0'))) { - p = find_writer(PCB_IOT_PCB, fmt); - newfmt = 1; - } - - if (p != NULL) { - event(EVENT_SAVE_PRE, "s", fmt); - res = p->write_pcb(p, f, old_filename, new_filename, emergency); - event(EVENT_SAVE_POST, "si", fmt, res); - } - - if ((res == 0) && (newfmt)) - PCB->Data->loader = p; - - plug_io_err(res, "write pcb", NULL); - return res; -} - -/* --------------------------------------------------------------------------- - * load PCB - * parse the file with enabled 'PCB mode' (see parser) - * if successful, update some other stuff - * - * If revert is pcb_true, we pass "revert" as a parameter - * to the HID's PCBChanged action. - */ -static int real_load_pcb(const char *Filename, const char *fmt, pcb_bool revert, pcb_bool require_font, int how) -{ - const char *unit_suffix; - char *new_filename; - PCBTypePtr newPCB = CreateNewPCB_(pcb_false); - PCBTypePtr oldPCB; - conf_role_t settings_dest; -#ifdef DEBUG - double elapsed; - clock_t start, end; - - start = clock(); -#endif - - resolve_path(Filename, &new_filename, 0); - - oldPCB = PCB; - PCB = newPCB; - - /* mark the default font invalid to know if the file has one */ - newPCB->Font.Valid = pcb_false; - - switch(how) { - case 0: settings_dest = CFR_DESIGN; break; - case 1: settings_dest = CFR_DEFAULTPCB; break; - case 2: settings_dest = CFR_invalid; break; - default: abort(); - } - - /* new data isn't added to the undo list */ - if (!ParsePCB(PCB, new_filename, fmt, settings_dest)) { - RemovePCB(oldPCB); - - CreateNewPCBPost(PCB, 0); - ResetStackAndVisibility(); - - if (how == 0) { - /* update cursor location */ - Crosshair.X = PCB_CLAMP(PCB->CursorX, 0, PCB->MaxWidth); - Crosshair.Y = PCB_CLAMP(PCB->CursorY, 0, PCB->MaxHeight); - - /* update cursor confinement and output area (scrollbars) */ - ChangePCBSize(PCB->MaxWidth, PCB->MaxHeight); - } - - /* enable default font if necessary */ - if (!PCB->Font.Valid) { - if (require_font) - Message(PCB_MSG_DEFAULT, _("File '%s' has no font information, using default font\n"), new_filename); - PCB->Font.Valid = pcb_true; - } - - /* clear 'changed flag' */ - SetChangedFlag(pcb_false); - PCB->Filename = new_filename; - /* just in case a bad file saved file is loaded */ - - /* Use attribute PCB::grid::unit as unit, if we can */ - unit_suffix = AttributeGet(PCB, "PCB::grid::unit"); - if (unit_suffix && *unit_suffix) { - const Unit *new_unit = get_unit_struct(unit_suffix); - if (new_unit) - conf_set(settings_dest, "editor/grid_unit", -1, unit_suffix, POL_OVERWRITE); - } - AttributePut(PCB, "PCB::grid::unit", conf_core.editor.grid_unit->suffix); - - pcb_sort_netlist(); - rats_patch_make_edited(PCB); - -/* set route style to the first one, if the current one doesn't - happen to match any. This way, "revert" won't change the route style. */ - if (hid_get_flag("GetStyle()") < 0) - pcb_use_route_style_idx(&PCB->RouteStyle, 0); - - if (((how == 0) || (revert)) && (gui != NULL)) { - if (revert) - hid_actionl("PCBChanged", "revert", NULL); - else - hid_action("PCBChanged"); - } - -#ifdef DEBUG - end = clock(); - elapsed = ((double) (end - start)) / CLOCKS_PER_SEC; - gui->log("Loading file %s took %f seconds of CPU time\n", new_filename, elapsed); -#endif - - return (0); - } - - PCB = oldPCB; - if (PCB == NULL) { - /* bozo: we are trying to revert back to a non-existing pcb... create one to avoid a segfault */ - PCB = CreateNewPCB_(pcb_false); - if (PCB == NULL) { - Message(PCB_MSG_DEFAULT, "FATAL: can't create a new empty pcb!"); - exit(1); - } - } - - if (gui != NULL) - hid_action("PCBChanged"); - - /* release unused memory */ - RemovePCB(newPCB); - - return (1); -} - - -#if !defined(HAS_ATEXIT) -/* --------------------------------------------------------------------------- - * some local identifiers for OS without an atexit() call - */ -static char *TMPFilename = NULL; -#endif - -/* --------------------------------------------------------------------------- - * Flag helper functions - */ - -#define F2S(OBJ, TYPE) flags_to_string ((OBJ)->Flags, TYPE) - -/* --------------------------------------------------------------------------- */ - -static int string_cmp(const char *a, const char *b) -{ - while (*a && *b) { - if (isdigit((int) *a) && isdigit((int) *b)) { - int ia = atoi(a); - int ib = atoi(b); - if (ia != ib) - return ia - ib; - while (isdigit((int) *a) && *(a + 1)) - a++; - while (isdigit((int) *b) && *(b + 1)) - b++; - } - else if (tolower((int) *a) != tolower((int) *b)) - return tolower((int) *a) - tolower((int) *b); - a++; - b++; - } - if (*a) - return 1; - if (*b) - return -1; - return 0; -} - -static int netlist_sort_offset = 0; - -static int netlist_sort(const void *va, const void *vb) -{ - const LibraryMenuType *am = (const LibraryMenuType *) va; - const LibraryMenuType *bm = (const LibraryMenuType *) vb; - const char *a = am->Name; - const char *b = bm->Name; - if (*a == '~') - a++; - if (*b == '~') - b++; - return string_cmp(a, b); -} - -static int netnode_sort(const void *va, const void *vb) -{ - const LibraryEntryType *am = (const LibraryEntryType *) va; - const LibraryEntryType *bm = (const LibraryEntryType *) vb; - const char *a = am->ListEntry; - const char *b = bm->ListEntry; - return string_cmp(a, b); -} - -void sort_library(LibraryTypePtr lib) -{ - int i; - qsort(lib->Menu, lib->MenuN, sizeof(lib->Menu[0]), netlist_sort); - for (i = 0; i < lib->MenuN; i++) - qsort(lib->Menu[i].Entry, lib->Menu[i].EntryN, sizeof(lib->Menu[i].Entry[0]), netnode_sort); -} - -void pcb_sort_netlist() -{ - netlist_sort_offset = 2; - sort_library(&(PCB->NetlistLib[NETLIST_INPUT])); - netlist_sort_offset = 0; -} - -/* --------------------------------------------------------------------------- - * opens a file and check if it exists - */ -FILE *CheckAndOpenFile(const char *Filename, pcb_bool Confirm, pcb_bool AllButton, pcb_bool * WasAllButton, pcb_bool * WasCancelButton) -{ - FILE *fp = NULL; - struct stat buffer; - char message[MAXPATHLEN + 80]; - int response; - - if (Filename && *Filename) { - if (!stat(Filename, &buffer) && Confirm) { - sprintf(message, _("File '%s' exists, use anyway?"), Filename); - if (WasAllButton) - *WasAllButton = pcb_false; - if (WasCancelButton) - *WasCancelButton = pcb_false; - if (AllButton) - response = gui->confirm_dialog(message, "Cancel", "Ok", AllButton ? "Sequence OK" : 0); - else - response = gui->confirm_dialog(message, "Cancel", "Ok", "Sequence OK"); - - switch (response) { - case 2: - if (WasAllButton) - *WasAllButton = pcb_true; - break; - case 0: - if (WasCancelButton) - *WasCancelButton = pcb_true; - } - } - if ((fp = fopen(Filename, "w")) == NULL) - OpenErrorMessage(Filename); - } - return (fp); -} - -/* --------------------------------------------------------------------------- - * opens a file for saving connection data - */ -FILE *OpenConnectionDataFile(void) -{ - char *fname; - FILE *fp; - static char *default_file = NULL; - pcb_bool result; /* not used */ - - /* CheckAndOpenFile deals with the case where fname already exists */ - fname = gui->fileselect(_("Save Connection Data As ..."), - _("Choose a file to save all connection data to."), default_file, ".net", "connection_data", 0); - if (fname == NULL) - return NULL; - - if (default_file != NULL) { - free(default_file); - default_file = NULL; - } - - if (fname && *fname) - default_file = pcb_strdup(fname); - - fp = CheckAndOpenFile(fname, pcb_true, pcb_false, &result, NULL); - free(fname); - - return fp; -} - -/* --------------------------------------------------------------------------- - * save elements in the current buffer - */ -int SaveBufferElements(const char *Filename, const char *fmt) -{ - int result; - - if (SWAP_IDENT) - pcb_swap_buffers(); - result = WritePipe(Filename, pcb_false, fmt); - if (SWAP_IDENT) - pcb_swap_buffers(); - return (result); -} - -/* --------------------------------------------------------------------------- - * save PCB - */ -int SavePCB(const char *file, const char *fmt) -{ - int retcode; - - if (gui->notify_save_pcb == NULL) - return WritePipe(file, pcb_true, fmt); - - gui->notify_save_pcb(file, pcb_false); - retcode = WritePipe(file, pcb_true, fmt); - gui->notify_save_pcb(file, pcb_true); - - return retcode; -} - - -/* --------------------------------------------------------------------------- - * Load PCB - */ -int LoadPCB(const char *file, const char *fmt, pcb_bool require_font, int how) -{ - return real_load_pcb(file, fmt, pcb_false, require_font, how); -} - -/* --------------------------------------------------------------------------- - * Revert PCB - */ -int RevertPCB(void) -{ - return real_load_pcb(PCB->Filename, NULL, pcb_true, pcb_true, pcb_true); -} - -/* --------------------------------------------------------------------------- - * writes the quoted string created by another subroutine - */ -void PrintQuotedString(FILE * FP, const char *S) -{ - const char *start; - - fputc('"', FP); - for(start = S; *S != '\0'; S++) { - if (*S == '"' || *S == '\\') { - if (start != S) - fwrite(start, S-start, 1, FP); - fputc('\\', FP); - fputc(*S, FP); - start = S+1; - } - } - - if (start != S) - fwrite(start, S-start, 1, FP); - - fputc('"', FP); -} - -/* --------------------------------------------------------------------------- - * saves the layout in a temporary file - * this is used for fatal errors and does not call the program specified - * in 'saveCommand' for safety reasons - */ -void SaveInTMP(void) -{ - char filename[256]; - - /* memory might have been released before this function is called */ - if (PCB && PCB->Changed && (conf_core.rc.emergency_name != NULL) && (*conf_core.rc.emergency_name != '\0')) { - sprintf(filename, conf_core.rc.emergency_name, (long int)pcb_getpid()); - Message(PCB_MSG_DEFAULT, _("Trying to save your layout in '%s'\n"), filename); - WritePCBFile(filename, pcb_true, DEFAULT_FMT, pcb_true); - } -} - -/* --------------------------------------------------------------------------- - * front-end for 'SaveInTMP()' - * just makes sure that the routine is only called once - */ -static pcb_bool dont_save_any_more = pcb_false; -void EmergencySave(void) -{ - - if (!dont_save_any_more) { - dont_save_any_more = pcb_true; - SaveInTMP(); - } -} - -void DisableEmergencySave(void) -{ - dont_save_any_more = pcb_true; -} - -/* ---------------------------------------------------------------------- - * Callback for the autosave - */ - -static hidval backup_timer; - -/* - * If the backup interval is > 0 then set another timer. Otherwise - * we do nothing and it is up to the GUI to call EnableAutosave() - * after setting conf_core.rc.backup_interval > 0 again. - */ -static void backup_cb(hidval data) -{ - backup_timer.ptr = NULL; - Backup(); - if (conf_core.rc.backup_interval > 0 && gui->add_timer) - backup_timer = gui->add_timer(backup_cb, 1000 * conf_core.rc.backup_interval, data); -} - -void EnableAutosave(void) -{ - hidval x; - - x.ptr = NULL; - - /* If we already have a timer going, then cancel it out */ - if (backup_timer.ptr != NULL && gui->stop_timer) - gui->stop_timer(backup_timer); - - backup_timer.ptr = NULL; - /* Start up a new timer */ - if (conf_core.rc.backup_interval > 0 && gui->add_timer) - backup_timer = gui->add_timer(backup_cb, 1000 * conf_core.rc.backup_interval, x); -} - -int pcb_build_fn_cb(gds_t *s, const char **input) -{ - char buff[20]; - - switch(**input) { - case 'P': - sprintf(buff, "%.8i", pcb_getpid()); - gds_append_str(s, buff); - (*input)++; - return 0; - case 'F': - gds_append_str(s, (PCB->Filename != NULL) ? PCB->Filename : "no_file_name"); - (*input)++; - return 0; - case 'B': - if (PCB->Filename != NULL) { - char *bn = strrchr(PCB->Filename, '/'); - if (bn != NULL) - bn++; - else - bn = PCB->Filename; - gds_append_str(s, bn); - } - else - gds_append_str(s, "no_file_name"); - (*input)++; - return 0; - case 'D': - if (PCB->Filename != NULL) { - char *bn = strrchr(PCB->Filename, '/'); - if (bn != NULL) - gds_append_len(s, PCB->Filename, bn-PCB->Filename+1); - else - gds_append_str(s, "./"); - } - else - gds_append_str(s, "./"); - (*input)++; - return 0; - case 'N': - gds_append_str(s, (PCB->Name != NULL) ? PCB->Name : "no_name"); - (*input)++; - return 0; - case 'T': - sprintf(buff, "%lu", (unsigned long int)time(NULL)); - gds_append_str(s, buff); - (*input)++; - return 0; - } - return -1; -} - -static char *build_fn(const char *template) -{ - return pcb_strdup_subst(template, pcb_build_fn_cb); -} - -/* --------------------------------------------------------------------------- - * creates backup file. The default is to use the pcb file name with - * a "-" appended (like "foo.pcb-") and if we don't have a pcb file name - * then use the template in conf_core.rc.backup_name - */ -void Backup(void) -{ - char *filename = NULL; - - if (PCB && PCB->Filename) { - filename = (char *) malloc(sizeof(char) * (strlen(PCB->Filename) + 2)); - if (filename == NULL) { - fprintf(stderr, "Backup(): malloc failed\n"); - exit(1); - } - sprintf(filename, "%s-", PCB->Filename); - } - else { - /* conf_core.rc.backup_name has %.8i which will be replaced by the process ID */ - filename = build_fn(conf_core.rc.backup_name); - if (filename == NULL) { - fprintf(stderr, "Backup(): can't build file name for a backup\n"); - exit(1); - } - } - - WritePCBFile(filename, pcb_true, DEFAULT_FMT, pcb_true); - free(filename); -} - -#if !defined(HAS_ATEXIT) -/* --------------------------------------------------------------------------- - * makes a temporary copy of the data. This is useful for systems which - * doesn't support calling functions on exit. We use this to save the data - * before LEX and YACC functions are called because they are able to abort - * the program. - */ -void SaveTMPData(void) -{ - char *fn = build_fn(conf_core.rc.emergency_name); - WritePCBFile(fn, pcb_true, DEFAULT_FMT, pcb_true); - if (TMPFilename != NULL) - free(TMPFilename); - TMPFilename = fn; -} - -/* --------------------------------------------------------------------------- - * removes the temporary copy of the data file - */ -void RemoveTMPData(void) -{ - if (TMPFilename != NULL) - unlink(TMPFilename); -} -#endif - -/* Write the pcb file, a footprint or a buffer */ -static int pcb_write_file(FILE *fp, pcb_bool thePcb, const char *old_path, const char *new_path, const char *fmt, pcb_bool emergency) -{ - if (thePcb) { - if (PCB->is_footprint) - return WriteElementData(fp, PCB->Data, fmt); - return pcb_write_pcb(fp, old_path, new_path, fmt, emergency); - } - return WriteBuffer(fp, PASTEBUFFER, fmt); -} - -/* --------------------------------------------------------------------------- - * writes PCB to file - */ -int WritePCBFile(const char *Filename, pcb_bool thePcb, const char *fmt, pcb_bool emergency) -{ - FILE *fp; - int result, overwrite; - char *fn_tmp = NULL; - - overwrite = pcb_file_readable(Filename); - if (overwrite) { - int len = strlen(Filename); - fn_tmp = malloc(len+8); - memcpy(fn_tmp, Filename, len); - strcpy(fn_tmp+len, ".old"); - if (rename(Filename, fn_tmp) != 0) { - if (emergency) { - /* Try an alternative emergency file */ - strcpy(fn_tmp+len, ".emr"); - Filename = fn_tmp; - } - else { - Message(PCB_MSG_ERROR, "Can't rename %s to %s before save\n", Filename, fn_tmp); - return -1; - } - } - } - - if ((fp = fopen(Filename, "w")) == NULL) { - OpenErrorMessage(Filename); - return (STATUS_ERROR); - } - - result = pcb_write_file(fp, thePcb, fn_tmp, Filename, fmt, emergency); - - fclose(fp); - if (fn_tmp != NULL) { - if ((result == 0) && (!conf_core.rc.keep_save_backups)) - unlink(fn_tmp); - free(fn_tmp); - } - return (result); -} - - -/* --------------------------------------------------------------------------- - * writes to pipe using the command defined by conf_core.rc.save_command - * %f are replaced by the passed filename - */ -int WritePipe(const char *Filename, pcb_bool thePcb, const char *fmt) -{ - FILE *fp; - int result; - const char *p; - static gds_t command; - - if (EMPTY_STRING_P(conf_core.rc.save_command)) - return WritePCBFile(Filename, thePcb, fmt, pcb_false); - - /* setup commandline */ - gds_truncate(&command,0); - for (p = conf_core.rc.save_command; *p; p++) { - /* copy character if not special or add string to command */ - if (!(p[0] == '%' && p[1] == 'f')) - gds_append(&command, *p); - else { - gds_append_str(&command, Filename); - - /* skip the character */ - p++; - } - } - printf("write to pipe \"%s\"\n", command.array); - if ((fp = popen(command.array, "w")) == NULL) { - PopenErrorMessage(command.array); - return (STATUS_ERROR); - } - - result = pcb_write_file(fp, thePcb, NULL, NULL, fmt, pcb_false); - - return (pclose(fp) ? STATUS_ERROR : result); -} - - -int pcb_io_list(pcb_io_formats_t *out, plug_iot_t typ, int wr, int do_digest) -{ - pcb_find_io_t available[PCB_IO_MAX_FORMATS]; - int n; - - memset(out, 0, sizeof(pcb_io_formats_t)); - out->len = pcb_find_io(available, sizeof(available)/sizeof(available[0]), typ, 1, NULL); - - if (out->len == 0) - return 0; - - for(n = 0; n < out->len; n++) - out->plug[n] = available[n].plug; - - if (do_digest) { - for(n = 0; n < out->len; n++) - out->digest[n] = pcb_strdup_printf("%s (%s)", out->plug[n]->default_fmt, out->plug[n]->description); - out->digest[n] = NULL; - } - return out->len; -} - -void pcb_io_list_free(pcb_io_formats_t *out) -{ - int n; - - for(n = 0; n < out->len; n++) { - if (out->digest[n] != NULL) { - free(out->digest[n]); - out->digest[n] = NULL; - } - } -} Index: 1.1.4/src/funchash.c =================================================================== --- 1.1.4/src/funchash.c (revision 10776) +++ 1.1.4/src/funchash.c (nonexistent) @@ -1,136 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include "funchash_core.h" -#include "macro.h" - -#define action_entry(x) { #x, F_ ## x}, -static funchash_table_t Functions[] = { -#include "funchash_core_list.h" - {"F_END", F_END} -}; - -typedef struct { - const char *cookie; - const char *key; - char key_buff[1]; -} fh_key_t; - -static htpi_t *funchash; - -static int keyeq(const void *a_, const void *b_) -{ - const fh_key_t *a = a_, *b = b_; - if (a->cookie != b->cookie) - return 1; - return !strcasecmp(a->key, b->key); -} - -static unsigned fh_hash(const void *key) -{ - const fh_key_t *k = key; - return strhash_case((char *)k->key) ^ ptrhash((void *)k->cookie); -} - -void funchash_init(void) -{ - funchash = htpi_alloc(fh_hash, keyeq); - funchash_set_table(Functions, ENTRIES(Functions), NULL); -} - -void funchash_uninit(void) -{ - htpi_entry_t *e; - - for (e = htpi_first(funchash); e; e = htpi_next(funchash, e)) { - fh_key_t *k = e->key; - if (k->cookie != NULL) - fprintf(stderr, "WARNING: function not removed: %s::%s\n", k->cookie, k->key); - htpi_pop(funchash, e->key); - free(e->key); - } - htpi_free(funchash); - funchash = NULL; -} - -void funchash_remove_cookie(const char *cookie) -{ - htpi_entry_t *e; - - /* Slow linear search - probably OK, this will run only on uninit */ - for (e = htpi_first(funchash); e; e = htpi_next(funchash, e)) { - fh_key_t *k = e->key; - if (k->cookie == cookie) { - htpi_pop(funchash, e->key); - free(e->key); - } - } -} - -int funchash_get(const char *key, const char *cookie) -{ - fh_key_t new_key; - htpi_entry_t *e; - - if (key == NULL) - return -1; - - new_key.cookie = cookie; - new_key.key = key; - - e = htpi_getentry(funchash, &new_key); - if (e == NULL) - return -1; - return e->value; -} - -int funchash_set(const char *key, int val, const char *cookie) -{ - fh_key_t *new_key; - int kl; - - if (funchash_get(key, cookie) >= 0) - return -1; - - kl = strlen(key); - new_key = malloc(sizeof(fh_key_t) + kl); - new_key->cookie = cookie; - new_key->key = new_key->key_buff; - strcpy(new_key->key_buff, key); - htpi_set(funchash, new_key, val); - return 0; -} - -int funchash_set_table(funchash_table_t *table, int numelem, const char *cookie) -{ - int i, rv = 0; - - for (i = 0; i < numelem; i++) - rv |= funchash_set(table[i].key, table[i].val, cookie); - - return rv; -} Index: 1.1.4/src/list_pad.c =================================================================== --- 1.1.4/src/list_pad.c (revision 10776) +++ 1.1.4/src/list_pad.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define TDL_DONT_UNDEF -#include "global_objs.h" -#include "list_pad.h" -#include Index: 1.1.4/src/intersect.c =================================================================== --- 1.1.4/src/intersect.c (revision 10776) +++ 1.1.4/src/intersect.c (nonexistent) @@ -1,267 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, intersect.c, was written and is - * Copyright (c) 2001 C. Scott Ananian - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* rectangle intersection/union routines. */ - -#include "config.h" - -#include - -#include "intersect.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static int compareleft(const void *ptr1, const void *ptr2); -static int compareright(const void *ptr1, const void *ptr2); -static int comparepos(const void *ptr1, const void *ptr2); -static int nextpwrof2(int i); - -/* --------------------------------------------------------------------------- - * some local types - */ -typedef struct { - Coord left, right; - int covered; - Coord area; -} SegmentTreeNode; - -typedef struct { - SegmentTreeNode *nodes; - int size; -} SegmentTree; - -typedef struct { - Coord *p; - int size; -} LocationList; - -/* --------------------------------------------------------------------------- - * Create a sorted list of unique y coords from a BoxList. - */ -static LocationList createSortedYList(BoxListTypePtr boxlist) -{ - LocationList yCoords; - Coord last; - int i, n; - /* create sorted list of Y coordinates */ - yCoords.size = 2 * boxlist->BoxN; - yCoords.p = (Coord *) calloc(yCoords.size, sizeof(*yCoords.p)); - for (i = 0; i < boxlist->BoxN; i++) { - yCoords.p[2 * i] = boxlist->Box[i].Y1; - yCoords.p[2 * i + 1] = boxlist->Box[i].Y2; - } - qsort(yCoords.p, yCoords.size, sizeof(*yCoords.p), comparepos); - /* count uniq y coords */ - last = 0; - for (n = 0, i = 0; i < yCoords.size; i++) - if (i == 0 || yCoords.p[i] != last) - yCoords.p[n++] = last = yCoords.p[i]; - yCoords.size = n; - return yCoords; -} - -/* --------------------------------------------------------------------------- - * Create an empty segment tree from the given sorted list of uniq y coords. - */ -static SegmentTree createSegmentTree(Coord * yCoords, int N) -{ - SegmentTree st; - int i; - /* size is twice the nearest larger power of 2 */ - st.size = 2 * nextpwrof2(N); - st.nodes = (SegmentTreeNode *) calloc(st.size, sizeof(*st.nodes)); - /* initialize the rightmost leaf node */ - st.nodes[st.size - 1].left = (N > 0) ? yCoords[--N] : 10; - st.nodes[st.size - 1].right = st.nodes[st.size - 1].left + 1; - /* initialize the rest of the leaf nodes */ - for (i = st.size - 2; i >= st.size / 2; i--) { - st.nodes[i].right = st.nodes[i + 1].left; - st.nodes[i].left = (N > 0) ? yCoords[--N] : st.nodes[i].right - 1; - } - /* initialize the internal nodes */ - for (; i > 0; i--) { /* node 0 is not used */ - st.nodes[i].right = st.nodes[2 * i + 1].right; - st.nodes[i].left = st.nodes[2 * i].left; - } - /* done! */ - return st; -} - -void insertSegment(SegmentTree * st, int n, Coord Y1, Coord Y2) -{ - Coord discriminant; - if (st->nodes[n].left >= Y1 && st->nodes[n].right <= Y2) { - st->nodes[n].covered++; - } - else { - assert(n < st->size / 2); - discriminant = st->nodes[n * 2 + 1 /*right */ ].left; - if (Y1 < discriminant) - insertSegment(st, n * 2, Y1, Y2); - if (discriminant < Y2) - insertSegment(st, n * 2 + 1, Y1, Y2); - } - /* fixup area */ - st->nodes[n].area = (st->nodes[n].covered > 0) ? - (st->nodes[n].right - st->nodes[n].left) : (n >= st->size / 2) ? 0 : st->nodes[n * 2].area + st->nodes[n * 2 + 1].area; -} - -void deleteSegment(SegmentTree * st, int n, Coord Y1, Coord Y2) -{ - Coord discriminant; - if (st->nodes[n].left >= Y1 && st->nodes[n].right <= Y2) { - assert(st->nodes[n].covered); - --st->nodes[n].covered; - } - else { - assert(n < st->size / 2); - discriminant = st->nodes[n * 2 + 1 /*right */ ].left; - if (Y1 < discriminant) - deleteSegment(st, n * 2, Y1, Y2); - if (discriminant < Y2) - deleteSegment(st, n * 2 + 1, Y1, Y2); - } - /* fixup area */ - st->nodes[n].area = (st->nodes[n].covered > 0) ? - (st->nodes[n].right - st->nodes[n].left) : (n >= st->size / 2) ? 0 : st->nodes[n * 2].area + st->nodes[n * 2 + 1].area; -} - -/* --------------------------------------------------------------------------- - * Compute the area of the intersection of the given rectangles; that is, - * the area covered by more than one rectangle (counted twice if the area is - * covered by three rectangles, three times if covered by four rectangles, - * etc.). - * Runs in O(N ln N) time. - */ -double ComputeIntersectionArea(BoxListTypePtr boxlist) -{ - pcb_cardinal_t i; - double area = 0.0; - /* first get the aggregate area. */ - for (i = 0; i < boxlist->BoxN; i++) - area += (double) (boxlist->Box[i].X2 - boxlist->Box[i].X1) * (double) (boxlist->Box[i].Y2 - boxlist->Box[i].Y1); - /* intersection area is aggregate - union. */ - return area * 0.0001 - ComputeUnionArea(boxlist); -} - -/* --------------------------------------------------------------------------- - * Compute the area of the union of the given rectangles. - * O(N ln N) time. - */ -double ComputeUnionArea(BoxListTypePtr boxlist) -{ - BoxTypePtr *rectLeft, *rectRight; - pcb_cardinal_t i, j; - LocationList yCoords; - SegmentTree segtree; - Coord lastX; - double area = 0.0; - - if (boxlist->BoxN == 0) - return 0.0; - /* create sorted list of Y coordinates */ - yCoords = createSortedYList(boxlist); - /* now create empty segment tree */ - segtree = createSegmentTree(yCoords.p, yCoords.size); - free(yCoords.p); - /* create sorted list of left and right X coordinates of rectangles */ - rectLeft = (BoxTypePtr *) calloc(boxlist->BoxN, sizeof(*rectLeft)); - rectRight = (BoxTypePtr *) calloc(boxlist->BoxN, sizeof(*rectRight)); - for (i = 0; i < boxlist->BoxN; i++) { - assert(boxlist->Box[i].X1 <= boxlist->Box[i].X2); - assert(boxlist->Box[i].Y1 <= boxlist->Box[i].Y2); - rectLeft[i] = rectRight[i] = &boxlist->Box[i]; - } - qsort(rectLeft, boxlist->BoxN, sizeof(*rectLeft), compareleft); - qsort(rectRight, boxlist->BoxN, sizeof(*rectRight), compareright); - /* sweep through x segments from left to right */ - i = j = 0; - lastX = rectLeft[0]->X1; - while (j < boxlist->BoxN) { - assert(i <= boxlist->BoxN); - /* i will step through rectLeft, j will through rectRight */ - if (i == boxlist->BoxN || rectRight[j]->X2 < rectLeft[i]->X1) { - /* right edge of rectangle */ - BoxTypePtr b = rectRight[j++]; - /* check lastX */ - if (b->X2 != lastX) { - assert(lastX < b->X2); - area += (double) (b->X2 - lastX) * segtree.nodes[1].area; - lastX = b->X2; - } - /* remove a segment from the segment tree. */ - deleteSegment(&segtree, 1, b->Y1, b->Y2); - } - else { - /* left edge of rectangle */ - BoxTypePtr b = rectLeft[i++]; - /* check lastX */ - if (b->X1 != lastX) { - assert(lastX < b->X1); - area += (double) (b->X1 - lastX) * segtree.nodes[1].area; - lastX = b->X1; - } - /* add a segment from the segment tree. */ - insertSegment(&segtree, 1, b->Y1, b->Y2); - } - } - free(rectLeft); - free(rectRight); - free(segtree.nodes); - return area * 0.0001; -} - -static int compareleft(const void *ptr1, const void *ptr2) -{ - BoxTypePtr *b1 = (BoxTypePtr *) ptr1, *b2 = (BoxTypePtr *) ptr2; - return (*b1)->X1 - (*b2)->X1; -} - -static int compareright(const void *ptr1, const void *ptr2) -{ - BoxTypePtr *b1 = (BoxTypePtr *) ptr1, *b2 = (BoxTypePtr *) ptr2; - return (*b1)->X2 - (*b2)->X2; -} - -static int comparepos(const void *ptr1, const void *ptr2) -{ - return *((Coord *) ptr1) - *((Coord *) ptr2); -} - -static int nextpwrof2(int n) -{ - int r = 1; - while (n != 0) { - n /= 2; - r *= 2; - } - return r; -} Index: 1.1.4/src/misc.h =================================================================== --- 1.1.4/src/misc.h (revision 10776) +++ 1.1.4/src/misc.h (nonexistent) @@ -1,103 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for misc routines - PCB data type dependent ones */ - -#ifndef PCB_MISC_H -#define PCB_MISC_H - -#include -#include "global.h" -#include -#include "mymem.h" - -const char *pcb_author(void); - -Angle NormalizeAngle(Angle a); - -void r_delete_element(DataTypePtr, ElementTypePtr); -void SetLineBoundingBox(LineTypePtr); -void SetArcBoundingBox(ArcTypePtr); -void SetPointBoundingBox(PointTypePtr); -void SetPinBoundingBox(PinTypePtr); -void SetPadBoundingBox(PadTypePtr); -void SetPolygonBoundingBox(PolygonTypePtr); -void SetElementBoundingBox(DataTypePtr, ElementTypePtr, FontTypePtr); -pcb_bool IsDataEmpty(DataTypePtr); -pcb_bool IsPasteEmpty(int); -void CountHoles(int *, int *, const BoxType *); -BoxTypePtr GetDataBoundingBox(DataTypePtr); -void CenterDisplay(Coord, Coord); -void SetFontInfo(FontTypePtr); -Coord GetNum(char **s, const char *default_unit); - -void QuitApplication(void); -char *EvaluateFilename(const char *, const char *, const char *, const char *); -void SetTextBoundingBox(FontTypePtr, TextTypePtr); - -void SaveOutputWindow(void); - -BoxTypePtr GetObjectBoundingBox(int, void *, void *, void *); -void ResetStackAndVisibility(void); -void SaveStackAndVisibility(void); -void RestoreStackAndVisibility(void); -BoxTypePtr GetArcEnds(ArcTypePtr); -void ChangeArcAngles(LayerTypePtr, ArcTypePtr, Angle, Angle); -void ChangeArcRadii(LayerTypePtr, ArcTypePtr, Coord, Coord); -char *UniqueElementName(DataTypePtr, char *); -void AttachForCopy(Coord, Coord); - -/* Returns NULL if the name isn't found, else the value for that named - attribute. */ -char *AttributeGetFromList(AttributeListType * list, const char *name); -/* Adds an attribute to the list. If the attribute already exists, - whether it's replaced or a second copy added depends on - REPLACE. Returns non-zero if an existing attribute was replaced. */ -int AttributePutToList(AttributeListType * list, const char *name, const char *value, int replace); -/* Simplistic version: Takes a pointer to an object, looks up attributes in it. */ -#define AttributeGet(OBJ,name) AttributeGetFromList (&(OBJ->Attributes), name) -/* Simplistic version: Takes a pointer to an object, sets attributes in it. */ -#define AttributePut(OBJ,name,value) AttributePutToList (&(OBJ->Attributes), name, value, 1) -/* Remove an attribute by name; returns number of items removed */ -int AttributeRemoveFromList(AttributeListType * list, const char *name); -/* Simplistic version of Remove. */ -#define AttributeRemove(OBJ, name) AttributeRemoveFromList (&(OBJ->Attributes), name) - -/* For passing modified flags to other functions. */ -FlagType MakeFlags(unsigned int); -FlagType OldFlags(unsigned int); -FlagType AddFlags(FlagType, unsigned int); -FlagType MaskFlags(FlagType, unsigned int); -#define NoFlags() MakeFlags(0) - -/* Returns a string with info about this copy of pcb. */ -char *GetInfoString(void); - -/* Return a relative rotation for an element, useful only for - comparing two similar footprints. */ -int ElementOrientation(ElementType * e); - -#endif /* PCB_MISC_H */ Index: 1.1.4/src/plug_import.c =================================================================== --- 1.1.4/src/plug_import.c (revision 10776) +++ 1.1.4/src/plug_import.c (nonexistent) @@ -1,121 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,1997,1998,2005,2006 Thomas Nau - * Copyright (C) 2015,2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* This used to be file.c; it's a hook based plugin API now */ - -#include "config.h" -#include "conf_core.h" - -#include - -#include "global.h" - -#include - -#include -#include -#include - -#include "plugins.h" -#include "plug_import.h" -#include "error.h" - - -plug_import_t *plug_import_chain = NULL; - -typedef struct { - plug_import_t *plug; - int prio; -} find_t; - -/* Find the plugin that offers the highest write prio for the format */ -static plug_import_t *find_importer(unsigned int aspects, FILE *f, const char *filename) -{ - find_t available[32]; /* wish we had more than 32 import plugins... */ - int n, len = 0, best = 0, bestidx = -1; - -#define cb_append(pl, pr) \ - do { \ - rewind(f); \ - if (pr > 0) { \ - assert(len < sizeof(available)/sizeof(available[0])); \ - available[len].plug = pl; \ - available[len++].prio = pr; \ - } \ - } while(0) - - HOOK_CALL_ALL(plug_import_t, plug_import_chain, fmt_support_prio, cb_append, (self, aspects, f, filename)); - if (len == 0) - return NULL; - - for(n = 0; n < len; n++) { - if (available[n].prio > best) { - bestidx = n; - best = available[n].prio; - } - } - - if (best == 0) - return NULL; - - return available[bestidx].plug; -#undef cb_append -} - - -int pcb_import(char *filename, unsigned int aspect) -{ - plug_import_t *plug; - FILE *fp; - - if (!filename) { - Message(PCB_MSG_DEFAULT, "Error: need a file name for ImportNetlist()\n"); - return (1); /* nothing to do */ - } - fp = fopen(filename, "r"); - - plug = find_importer(aspect, fp, filename); - if (plug == NULL) { - if (fp != NULL) { - Message(PCB_MSG_DEFAULT, "Error: can't find a suitable netlist parser for %s\n", filename); - fclose(fp); - } - else - Message(PCB_MSG_DEFAULT, "Error: can't find a suitable netlist parser for %s - might be related: can't open %s for reading\n", filename, filename); - return 1; - } - - if (fp != NULL) - fclose(fp); - - return plug->import(plug, aspect, filename); -} - -int ImportNetlist(char *filename) -{ - return pcb_import(filename, IMPORT_ASPECT_NETLIST); -} Index: 1.1.4/src/Makefile.in =================================================================== --- 1.1.4/src/Makefile.in (revision 10776) +++ 1.1.4/src/Makefile.in (nonexistent) @@ -1,336 +0,0 @@ -# TODO default compiler flags -put /local/pcb/CFLAGS cc/cflags -append /local/pcb/CFLAGS cc/fpic -append /local/pcb/CFLAGS {-I. -I.. -I../src_3rd -I../src_3rd/liblihata -Iicons -DHAVE_CONFIG_H} -append /local/pcb/LDFLAGS cc/ldflags -append /local/pcb/LDFLAGS cc/rdynamic -put /local/pcb/DEPCFLAGS {} - -include {../scconfig/template/debug.tmpasm} - -# main: objects -# These have constructs that are not c89 strictly speaking but are -# effectively c89; typical example is casting a function pointer to a -# data pointer for dlsym(). -put /local/pcb/OBJS_C99 [@ - fptr_cast.o -@] - -put /local/pcb/OBJS [@ - action_helper.o - action_act.o - buffer.o - change.o - change_act.o - conf.o - conf_act.o - conf_core.o - conf_hid.o - conf_internal.o - clip.o - compat_dl.o - compat_fs.o - compat_lrealpath.o - compat_misc.o - copy.o - create.o - crosshair.o - data.o - draw.o - draw_fab.o - drill.o - error.o - event.o - file_act.o - find.o - find_act.o - free_atexit.o - funchash.o - gui_act.o - heap.o - hid_actions.o - hid_attrib.o - hid_cfg.o - hid_cfg_action.o - hid_cfg_input.o - hid_color.o - hid_draw_helpers.o - hid_extents.o - hid_flags.o - hid_helper.o - hid_init.o - hid_nogui.o - ht_element.o - insert.o - intersect.o - layer.o - line.o - list_arc.o - list_conf.o - list_element.o - list_line.o - list_text.o - list_pad.o - list_pin.o - list_poly.o - list_rat.o - main.o - main_act.o - mirror.o - misc.o - misc_util.o - move.o - mymem.o - netlist.o - netlist_act.o - object_act.o - obj_any.o - paths.o - pcb-printf.o - plugins.o - plug_import.o - plug_io.o - plug_footprint.o - plug_footprint_act.o - polygon.o - polygon1.o - polygon_act.o - rats.o - rats_act.o - rats_patch.o - remove.o - remove_act.o - rotate.o - route_style.o - rtree.o - rubberband.o - search.o - select.o - select_act.o - set.o - strflags.o - stub_mincut.o - stub_stroke.o - stub_vendor.o - thermal.o - undo.o - undo_act.o - unit.o - vtlibrary.o - vtonpoint.o - vtptr.o - vtroutestyle.o - buildin.o - ../src_3rd/liblihata/parser.o - ../src_3rd/liblihata/dom.o - ../src_3rd/liblihata/dom_list.o - ../src_3rd/liblihata/dom_hash.o - ../src_3rd/liblihata/dom_table.o - ../src_3rd/liblihata/lihata.o - ../src_3rd/liblihata/hash_str.o - ../src_3rd/liblihata/tree.o - ../src_3rd/liblihata/tree_list.o - ../src_3rd/liblihata/tree_hash.o - ../src_3rd/liblihata/tree_table.o - ../src_3rd/liblihata/tree_symlink.o - ../src_3rd/liblihata/tree_path.o - ../src_3rd/liblihata/genht/hash.o - ../src_3rd/liblihata/genht/htsp.o - ../src_3rd/liblihata/genht/htsi.o - ../src_3rd/liblihata/genht/htpi.o - ../src_3rd/liblihata/genht/htip.o - ../src_3rd/liblihata/genht/htpp.o - ../src_3rd/liblhtpers/lhtpers.o - ../src_3rd/genvector/gds_char.o - ../src_3rd/genvector/vtp0.o - ../src_3rd/genregex/regex_sei.o - ../src_3rd/genregex/regex_se.o - ../src_3rd/genregex/regex.o -@] - -# main: action registrations -put /local/pcb/ACTION_REG_SRC { - action_act.c buffer.c change_act.c conf_act.c file_act.c find_act.c - gui_act.c main_act.c misc.c move.c netlist_act.c - object_act.c plugins.c polygon_act.c plug_footprint_act.c rats_act.c - rats_patch.c remove_act.c select_act.c undo_act.c -} - -#---- modules ----# -# extra rules for modules -put /local/pcb/RULES {} -put /local/pcb/CLEANFILES {} -put /local/pcb/CLEANRULES {} -put /local/pcb/EXEDEPS {} -put /local/pcb/all {} -put /local/pcb/buildin_init {} -put /local/pcb/rules/install_ {} -put /local/pcb/rules/install {} -put /local/pcb/rules/linstall {} -put /local/pcb/rules/uninstall {} -put /local/pcb/mod/OBJS {} -put /local/pcb/mod/OBJS_C99 {} -put /local/pcb/mod/CONF {} -put /local/pcb/mod/LDFLAGS {} -put /local/pcb/mod/CFLAGS {} -put /local/pcb/mod/YACC {} -put /local/pcb/mod/LEX {} - -put /local/pcb/tmpasm/buildin {../src_plugins/Buildin.tmpasm} -put /local/pcb/tmpasm/plugin {../src_plugins/Plugin.tmpasm} -put /local/pcb/tmpasm/disable {../src_plugins/Disable.tmpasm} -put /local/pcb/tmpasm/common_enabled {../src_plugins/Common_enabled.tmpasm} - -include {../src_plugins/plugins_ALL.tmpasm} - -append /local/pcb/CFLAGS /target/libs/sul/glib/cflags -append /local/pcb/CFLAGS /target/libs/sul/dmalloc/cflags -append /local/pcb/LIBS /target/libs/sul/glib/ldflags -append /local/pcb/LIBS /target/libs/sul/dmalloc/ldflags - -# ---- logic ---- - -# Clean up variables -put /tmpasm/OFS { } -uniq /local/pcb/OBJS -uniq /local/pcb/OBJS_C99 -uniq /local/pcb/CFLAGS -uniq /local/pcb/LDFLAGS -uniq /local/pcb/LIBS -uniq /local/pcb/ACTION_REG_SRC -uniq /local/pcb/EXEDEPS -uniq /local/pcb/CLEANFILES -uniq /local/pcb/CLEANRULES -put /local/pcb/SRCS /local/pcb/OBJS -append /local/pcb/SRCS ?/local/pcb/OBJS_C99 -gsub /local/pcb/SRCS {.o } {.c } - -# Makefile, static -print [@ -# *** DO NOT EDIT THIS FILE *** -# This file has been generated from Makefile.in by configure -# *** DO NOT EDIT THIS FILE *** - -# plugin source -PLUGDIR=../src_plugins - -# plugin source install - so that pcb-rnd runs from source properly -PLUGIDIR=plugins - -# src_3rd dir for the lib_ wrapper plugins -SRC_3RD_DIR=../src_3rd - -@/local/pcb/TOPVARS@ -OBJS=@/local/pcb/OBJS@ -OBJS_C99=@/local/pcb/OBJS_C99@ -SRCS=@/local/pcb/SRCS@ -CFLAGS=@/local/pcb/CFLAGS@ -C89FLAGS=@/local/pcb/c89flags@ @/local/pcb/CFLAGS@ -LDFLAGS=@/local/pcb/LDFLAGS@ -LIBS=@/local/pcb/LIBS@ -lm @?/target/libs/ldl@ -EXEDEPS=@/local/pcb/EXEDEPS@ -CLEANFILES=@/local/pcb/CLEANFILES@ -CLEANRULES=@/local/pcb/CLEANRULES@ -CC=@cc/cc@ -CQUOTE=../scconfig/cquote -SPHASH_PATH=../src_3rd/sphash -SPHASH=$(SPHASH_PATH)/sphash - -all: - make revcheck - make all_exe - -include ../Makefile.conf - -revcheck: - cd ../scconfig && ./revtest Rev.stamp < Rev.tab - -all_exe: pcb-rnd$(EXE) @/local/pcb/all@ - -pcb-rnd$(EXE): $(OBJS) $(OBJS_C99) $(EXEDEPS) - $(CC) $(OBJS) $(OBJS_C99) -o pcb-rnd$(EXE) $(LDFLAGS) $(LIBS) - - -$(SPHASH_PATH)/sphash: $(SPHASH_PATH)/sphash.c - $(CC) -o pcb-rnd$(EXE) $(SPHASH_PATH)/sphash.c -o $(SPHASH_PATH)/sphash -@] - -print [@ -##### module rules begin ##### - -@/local/pcb/RULES@ - -##### module rules end ##### - -pcblib_DATA= \ - default_font \ - default.pcb \ - pcb-menu-lesstif.lht \ - pcb-menu-gtk.lht \ - pcb-menu-mkey.lht - - -EXTRA_DIST= \ - check_icon.data \ - default_font \ - default.pcb \ - pcbtest.sh.in - -all-local: pcbtest.sh - -generated_lists.h: @/local/pcb/ACTION_REG_SRC@ Makefile - AWK=@/host/fstools/awk@ ../scconfig/gen_core_lists.sh @/local/pcb/ACTION_REG_SRC@ > generated_lists.h - -conf_core_fields.h: conf_core.h - AWK=@/host/fstools/awk@ ../scconfig/gen_conf.sh ../doc-rnd/conf/tree < conf_core.h > conf_core_fields.h - -conf_internal.c: pcb-conf.lht - $(CQUOTE) -n conf_internal < pcb-conf.lht > conf_internal.c - -FORCE: - - -DISTCLEANFILES= core_lists.h - -clean: $(CLEANRULES) - -rm pcb-rnd $(OBJS) $(OBJS_C99) $(CLEANFILES) - - -install_: - $(MKDIR) $(BINDIR) $(DATADIR) $(LIBDIR) $(LIBDIR)/plugins - $(CPC) "`pwd`/pcb-rnd" "$(BINDIR)/pcb-rnd" - $(CPC) "`pwd`/default.pcb" "$(DATADIR)/default.pcb" - $(CPC) "`pwd`/pcb-conf.lht" "$(DATADIR)/pcb-conf.lht" - $(CPC) "`pwd`/pcb-menu-lesstif.lht" "$(DATADIR)/pcb-menu-lesstif.lht" - $(CPC) "`pwd`/pcb-menu-gtk.lht" "$(DATADIR)/pcb-menu-gtk.lht" - $(CPC) "`pwd`/default_font" "$(DATADIR)/default_font"@/local/pcb/rules/install_@ - - -install: - make install_ CPC="$(CP)"@/local/pcb/rules/install@ - -linstall: - make install_ CPC="$(LN)"@/local/pcb/rules/linstall@ - - -uninstall: - $(RM) $(BINDIR)/pcb-rnd - $(RM) $(DATADIR)/default.pcb - $(RM) $(DATADIR)/pcb-menu-lesstif.lht - $(RM) $(DATADIR)/pcb-conf.lht - $(RM) $(DATADIR)/pcb-menu-gtk.lht - $(RM) $(DATADIR)/default_font@/local/pcb/rules/uninstall@ -@] - -# generate explicit rules for .c -> .o -put /local/comp/OBJS /local/pcb/OBJS -put /local/comp/OBJS_C99 ?/local/pcb/OBJS_C99 -include {../scconfig/Makefile.comp.inc} - -# generate deps -put /local/dep/CFLAGS /local/pcb/CFLAGS -put /local/dep/SRCS /local/pcb/SRCS - -gsub /local/pcb/DEPSRCS {.o } {.c } -append /local/dep/SRCS /local/pcb/DEPSRCS -include {../scconfig/Makefile.dep.inc} Property changes on: 1.1.4/src/Makefile.in ___________________________________________________________________ Deleted: svn:mergeinfo ## -0,1 +0,0 ## Reverse-merged /trunk/src/Makefile.in:r5769,5771 Index: 1.1.4/src/conf_core.h =================================================================== --- 1.1.4/src/conf_core.h (revision 10776) +++ 1.1.4/src/conf_core.h (nonexistent) @@ -1,200 +0,0 @@ -#ifndef PCB_CONF_CORE_H -#define PCB_CONF_CORE_H - -#include "conf.h" - -/* NOTE: this struct has a strict format because a code generator needs to - read it. Please always keep the format (preferably even whitespace style). - Use only the CFT_* prefixed types declared in conf.h. - */ - -typedef struct { - - struct temp { - CFT_BOOLEAN rat_warn; /* rats nest has set warnings */ - } temp; - - const struct editor { - CFT_UNIT grid_unit; /* select whether you draw in mm or mil */ - CFT_COORD grid; /* grid in pcb-units */ - CFT_INCREMENTS increments_mm; /* increments (size deltas) when drawing in mil */ - CFT_INCREMENTS increments_mil; /* increments (size deltas) when drawing in mil */ - CFT_REAL zoom; /* default zoom */ - CFT_INTEGER mode; /* currently active mode */ - CFT_INTEGER buffer_number; /* number of the current buffer */ - CFT_BOOLEAN clear_line; /* new lines/arc clear polygons. */ - CFT_BOOLEAN full_poly; /* new polygons are full polygons. */ - CFT_BOOLEAN unique_names; /* force unique names */ - CFT_BOOLEAN snap_pin; /* snap to pins and pads */ - CFT_BOOLEAN snap_offgrid_line; /* Snap to certain off-grid points along a line. */ - CFT_BOOLEAN highlight_on_point; /* Highlight if crosshair is on endpoints. */ - CFT_BOOLEAN show_solder_side; /* mirror output */ - CFT_BOOLEAN save_last_command; /* the command entry editline always starts with the last command entered by user in the current session */ - CFT_INTEGER line_refraction; /* value for line lookahead setting */ - CFT_BOOLEAN save_in_tmp; /* emergency save unsaved PCB data (despite the user clicks don't save) when: user starts a new PCB; user quits pcb-rnd. Does not affect the on-crash emergency save. */ - CFT_BOOLEAN draw_grid; /* draw grid points */ - CFT_BOOLEAN all_direction_lines; /* enable lines to all directions */ - CFT_BOOLEAN rubber_band_mode; /* move, rotate use rubberband connections */ - CFT_BOOLEAN swap_start_direction; /* change starting direction after each click */ - CFT_BOOLEAN show_drc; /* show drc region on crosshair */ - CFT_BOOLEAN auto_drc; /* when set, PCB doesn't let you place copper that violates DRC. */ - CFT_BOOLEAN show_number; /* pinout shows number */ - CFT_BOOLEAN orthogonal_moves; /* move items orthogonally. */ - CFT_BOOLEAN reset_after_element; /* reset connections after each element while saving all connections */ - CFT_BOOLEAN auto_place; /* flag which says we should force placement of the windows on startup */ - CFT_BOOLEAN lock_names; /* lock down text so they can not be moved or selected */ - CFT_BOOLEAN only_names; /* lock down everything else but text so only text objects can be moved or selected */ - CFT_BOOLEAN thin_draw; /* if set, objects on the screen are drawn as outlines (lines are drawn as center-lines). This lets you see line endpoints hidden under pins, for example. */ - CFT_BOOLEAN thin_draw_poly; /* if set, polygons on the screen are drawn as outlines. */ - CFT_BOOLEAN local_ref; /* use local reference for moves, by setting the mark at the beginning of each move. */ - CFT_BOOLEAN check_planes; /* when set, only polygons and their clearances are drawn, to see if polygons have isolated regions. */ - CFT_BOOLEAN show_mask; /* show the solder mask layer */ - CFT_BOOLEAN hide_names; /* when set, element names are not drawn. */ - CFT_BOOLEAN description; /* display element description as element name, instead of value */ - CFT_BOOLEAN name_on_pcb; /* display Reference Designator as element name, instead of value */ - CFT_BOOLEAN fullscreen; /* hide widgets to make more room for the drawing */ - - CFT_INTEGER click_time; /* default time for click expiration, in ms */ - - struct view { - CFT_BOOLEAN flip_x; /* view: flip the board along the X (horizontal) axis */ - CFT_BOOLEAN flip_y; /* view: flip the board along the Y (vertical) axis */ - } view; - - /* these two would need to be moved in the router plugin.... There are two - reasons to keep them here: - - the original pcb and pcb-rnd file formats already have named/numbered flags for these, so io_pcb needs these - - more than one router plugin may share these */ - CFT_BOOLEAN enable_stroke; /* Enable libstroke gestures on middle mouse button when non-zero */ - CFT_BOOLEAN live_routing; /* autorouter shows tracks in progress */ - - /* Keep it here instead of the router plugin: more than one router plugin may share these */ - CFT_BOOLEAN beep_when_finished; /* flag if a signal should be produced when searching of connections is done */ - - CFT_INTEGER undo_warning_size; /* warn the user when undo list exceeds this amount of kilobytes in memory */ - } editor; - - const struct rc { - CFT_INTEGER verbose; - CFT_INTEGER backup_interval; /* time between two backups in seconds */ - CFT_STRING font_command; /* commands for file loading... */ - CFT_STRING file_command; - CFT_STRING file_path; - CFT_STRING library_shell; - CFT_LIST library_search_paths; - - CFT_STRING emergency_name; /* file name template for emergency save anonymous .pcb files (when pcb-rnd crashes); optional field: %ld --> pid; must be shorter than 240 characters. Don't do emergency save if this item is empty. */ - CFT_STRING backup_name; /* file name template for periodic backup anonymous .pcb files; optional fields: %P --> pid */ - - CFT_STRING save_command; /* command to pipe the pcb, footprint or buffer file into, when saving (makes lihata persist impossible) */ - CFT_BOOLEAN keep_save_backups; /* a copy is made before a save operation overwrites an existing file; if this setting is true, keep the copy even after a successful save */ - CFT_LIST default_font_file; /* name of default font file (list of names to search) */ - CFT_LIST default_pcb_file; - - CFT_STRING script_filename; /* PCB Actions script to execute on startup */ - CFT_STRING action_string; /* PCB Actions string to execute on startup */ - CFT_STRING rat_path; - CFT_STRING rat_command; - - CFT_LIST preferred_gui; /* if set, try GUI HIDs in this order when no GUI is explicitly selected */ - - /***** automatically set (in postproc) *****/ - CFT_BOOLEAN have_regex; /* whether we have regex compiled in */ - struct path { - CFT_STRING prefix; /* e.g. /usr/local */ - CFT_STRING lib; /* e.g. /usr/lib/pcb-rnd */ - CFT_STRING bin; /* e.g. /usr/bin */ - CFT_STRING share; /* e.g. /usr/share/pcb-rnd */ - CFT_STRING home; /* user's home dir, determined run-time */ - - CFT_STRING exec_prefix; /* exec prefix path (extracted from argv[0]) */ - } path; - } rc; - - const struct design { /* defaults of a new layout */ - CFT_COORD via_thickness; - CFT_COORD via_drilling_hole; - CFT_COORD line_thickness; - CFT_COORD clearance; - - CFT_COORD max_width; - CFT_COORD max_height; - CFT_COORD alignment_distance;/* default drc size */ - CFT_COORD bloat; /* default drc size */ - CFT_COORD shrink; - CFT_COORD min_wid; - CFT_COORD min_slk; - CFT_COORD min_drill; - CFT_COORD min_ring; - CFT_INTEGER text_scale; /* text scaling in % */ - CFT_REAL poly_isle_area; /* polygon min area */ - CFT_STRING default_layer_name[MAX_LAYER]; - CFT_STRING fab_author; /* Full name of author for FAB drawings */ - CFT_STRING initial_layer_stack; /* If set, the initial layer stack is set to this */ - - CFT_STRING groups; /* string with layergroups */ - CFT_STRING routes; /* string with route styles */ - } design; - -/* @path appearance/color */ - const struct appearance { - CFT_COORD rat_thickness; - CFT_COORD mark_size; /* relative marker size */ - struct loglevels { - CFT_STRING debug_tag; /* log style tag of debug messages */ - CFT_BOOLEAN debug_popup; /* whether a debug line should pop up the log window */ - CFT_STRING info_tag; /* log style tag of info messages */ - CFT_BOOLEAN info_popup; /* whether an info line should pop up the log window */ - CFT_STRING warning_tag; /* log style tag of warnings */ - CFT_BOOLEAN warning_popup; /* whether a warning should pop up the log window */ - CFT_STRING error_tag; /* log style tag of errors */ - CFT_BOOLEAN error_popup; /* whether an error should pop up the log window */ - } loglevels; - struct color { - CFT_COLOR black; - CFT_COLOR white; - CFT_COLOR background; /* background and cursor color ... */ - CFT_COLOR crosshair; /* different object colors */ - CFT_COLOR cross; - CFT_COLOR via; - CFT_COLOR via_selected; - CFT_COLOR pin; - CFT_COLOR pin_selected; - CFT_COLOR pin_name; - CFT_COLOR element; - CFT_COLOR element_nonetlist; - CFT_COLOR rat; - CFT_COLOR invisible_objects; - CFT_COLOR invisible_mark; - CFT_COLOR element_selected; - CFT_COLOR rat_selected; - CFT_COLOR connected; - CFT_COLOR off_limit; - CFT_COLOR grid; - CFT_COLOR layer[MAX_LAYER]; - CFT_COLOR layer_selected[MAX_LAYER]; - CFT_COLOR warn; - CFT_COLOR mask; - } color; - struct pinout { - CFT_INTEGER name_length; - CFT_REAL zoom; - CFT_COORD offset_x; /* X offset of origin */ - CFT_COORD offset_y; /* Y offset of origin */ - CFT_COORD text_offset_x; /* X offset of text from pin center */ - CFT_COORD text_offset_y; /* Y offset of text from pin center */ - } pinout; - struct messages { - CFT_INTEGER char_per_line; /* width of an output line in characters (used by separator drawing in find.c) */ - } messages; - struct misc { - CFT_INTEGER volume; /* the speakers volume -100..100 */ - } misc; - } appearance; - -} conf_core_t; - -extern conf_core_t conf_core; -void conf_core_init(); -void conf_core_postproc(); -#endif Index: 1.1.4/src/remove.h =================================================================== --- 1.1.4/src/remove.h (revision 10776) +++ 1.1.4/src/remove.h (nonexistent) @@ -1,53 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for remove routines */ - -#ifndef PCB_REMOVE_H -#define PCB_REMOVE_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * some constants - */ -#define REMOVE_TYPES \ - (PCB_TYPE_VIA | PCB_TYPE_LINE_POINT | PCB_TYPE_LINE | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT | \ - PCB_TYPE_POLYGON_POINT | PCB_TYPE_POLYGON | PCB_TYPE_RATLINE | PCB_TYPE_ARC) - -void *RemoveLine(LayerTypePtr, LineTypePtr); -void *RemoveArc(LayerTypePtr, ArcTypePtr); -void *RemovePolygon(LayerTypePtr, PolygonTypePtr); -void *RemoveText(LayerTypePtr, TextTypePtr); -void *RemoveElement(ElementTypePtr); -void ClearRemoveList(void); -void RemovePCB(PCBTypePtr); -pcb_bool RemoveSelected(void); -pcb_bool DeleteRats(pcb_bool); -void *RemoveObject(int, void *, void *, void *); -void *DestroyObject(DataTypePtr, int, void *, void *, void *); - -#endif Index: 1.1.4/src/compat_misc.h =================================================================== --- 1.1.4/src/compat_misc.h (revision 10776) +++ 1.1.4/src/compat_misc.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_COMPAT_MISC_H -#define PCB_COMPAT_MISC_H - -#include "config.h" - -#include - -long pcb_rand(void); - -const char *get_user_name(void); -int pcb_getpid(void); - -char *pcb_strndup(const char *s, int len); -char *pcb_strdup(const char *s); - -#define pcb_strdup_null(x) (((x) != NULL) ? pcb_strdup (x) : NULL) - -double pcb_round(double x); - -#endif /* PCB_COMPAT_MISC_H */ Index: 1.1.4/src/plug_io.h =================================================================== --- 1.1.4/src/plug_io.h (revision 10776) +++ 1.1.4/src/plug_io.h (nonexistent) @@ -1,170 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,1997,1998,2005,2006 Thomas Nau - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -#ifndef PCB_PLUG_IO_H -#define PCB_PLUG_IO_H - -#include "global.h" -#include "conf.h" - -typedef enum { /* I/O type bitmask; each bit is one thing to save or load, not all formats support all things */ - PCB_IOT_PCB = 1, - PCB_IOT_FOOTPRINT = 2, - PCB_IOT_FONT = 4, - PCB_IOT_BUFFER = 8 -} plug_iot_t; - -/**************************** API definition *********************************/ -struct plug_io_s { - plug_io_t *next; - void *plugin_data; - - /* Check if the plugin supports format fmt, for writing (if wr != 0) or for - reading (if wr == 0) for I/O type typ. Return 0 if not supported or an - integer priority if supported. The higher the prio is the more likely - the plugin gets the next operation on the file. Base prio should be - 100 for native formats. - NOTE: if any format can be chosen for output, the user will have to pick - one; for ordering plugins in that case, the format-neutral - save_preference_prio field is used. - */ - int (*fmt_support_prio)(plug_io_t *ctx, plug_iot_t typ, int wr, const char *fmt); - - /* Attempt to load a pcb design from Filename to Ptr. - Conf subtree at settings_dest is replaced by settings loaded from the - file unless it's CFR_invalid. - Return 0 on success. */ - int (*parse_pcb)(plug_io_t *ctx, PCBTypePtr Ptr, const char *Filename, conf_role_t settings_dest); - - /* Attempt to load an element from Filename to Ptr. Return 0 on success. */ - int (*parse_element)(plug_io_t *ctx, DataTypePtr Ptr, const char *name); - - /* Attempt to load fonts from a file. Return 0 on success. */ - int (*parse_font)(plug_io_t *ctx, FontTypePtr Ptr, const char *Filename); - - - /* Write the buffer to a file. Return 0 on success. */ - int (*write_buffer)(plug_io_t *ctx, FILE *f, BufferType *buff); - - /* Write element data to a file. Return 0 on success. */ - int (*write_element)(plug_io_t *ctx, FILE *f, DataTypePtr e); - - /* Write PCB to f; there's a copy of the file we are going to - "overwrite", named in old_filename and the new file name we are - using is new_filename. The file names are NULL if we are saving - into a pipe. If emergency is true, do the safest save possible, - don't mind formatting and extras. - Return 0 on success. */ - int (*write_pcb)(plug_io_t *ctx, FILE *f, const char *old_filename, const char *new_filename, pcb_bool emergency); - - const char *default_fmt; - const char *description; - - int save_preference_prio; /* all available save plugins are sorted by this before presenting them to the user to choose one */ -}; -extern plug_io_t *plug_io_chain; - - -/********** hook wrappers **********/ -int ParsePCB(PCBTypePtr Ptr, const char *Filename, const char *fmt, int load_settings); -int ParseElement(DataTypePtr Ptr, const char *name); -int ParseFont(FontTypePtr Ptr, char *Filename); -int WriteBuffer(FILE *f, BufferType *buff, const char *fmt); -int WriteElementData(FILE *f, DataTypePtr e, const char *fmt); - -/********** common function used to be part of file.[ch] and friends **********/ -FILE *CheckAndOpenFile(const char *, pcb_bool, pcb_bool, pcb_bool *, pcb_bool *); -FILE *OpenConnectionDataFile(void); -int SavePCB(const char *, const char *fmt); -int LoadPCB(const char *name, const char *fmt, pcb_bool, int how); /* how: 0=normal pcb; 1=default.pcb, 2=misc (do not load settings) */ -void EnableAutosave(void); -void Backup(void); -void SaveInTMP(void); -void EmergencySave(void); -void DisableEmergencySave(void); -int RevertPCB(void); -int SaveBufferElements(const char *, const char *fmt); -void pcb_sort_netlist(void); -void PrintQuotedString(FILE *, const char *); -void sort_library(LibraryTypePtr lib); -void set_some_route_style(); -int WritePCBFile(const char *Filename, pcb_bool thePcb, const char *fmt, pcb_bool emergency); -int WritePipe(const char *, pcb_bool, const char *fmt); - -#ifndef HAS_ATEXIT -void SaveTMPData(void); -void RemoveTMPData(void); -#endif - -/********** helpers **********/ - -/* wish we had more than 32 IO plugins... */ -#define PCB_IO_MAX_FORMATS 32 - -/* A list of format plugins available for a given purpose */ -typedef struct { - int len; - const plug_io_t *plug[PCB_IO_MAX_FORMATS+1]; - char *digest[PCB_IO_MAX_FORMATS+1]; /* string that contains the format identifier and the description */ -} pcb_io_formats_t; - -/* Search all io plugins to see if typ/wr is supported. Return an ordered - list in out. If do_digest is non-zero, fill in the digest field. Returns - number of suitable io plugins. Call pcb_io_list_free() on out when it is not - needed anymore. */ -int pcb_io_list(pcb_io_formats_t *out, plug_iot_t typ, int wr, int do_digest); -void pcb_io_list_free(pcb_io_formats_t *out); - -extern int pcb_io_err_inhibit; -#define pcb_io_err_inhibit_inc() pcb_io_err_inhibit++ -#define pcb_io_err_inhibit_dec() \ -do { \ - if (pcb_io_err_inhibit > 0) \ - pcb_io_err_inhibit--; \ -} while(0) - -/* Find all plugins that can handle typ/is_wr and build an ordered list in available[], - highest prio first. If fmt is NULL, use the default fmt for each plugin. - Return the length of the array. */ -typedef struct { - plug_io_t *plug; - int prio; -} pcb_find_io_t; -int pcb_find_io(pcb_find_io_t *available, int avail_len, plug_iot_t typ, int is_wr, const char *fmt); - - -/* generic file name template substitution callbacks for pcb_strdup_subst: - %P pid - %F load-time file name of the current pcb - %B basename (load-time file name of the current pcb without path) - %D dirname (load-time file path of the current pcb, without file name, with trailing slash, might be ./) - %N name of the current pcb - %T wall time (Epoch) -*/ -int pcb_build_fn_cb(gds_t *s, const char **input); - -#endif Index: 1.1.4/src/hid_draw_helpers.c =================================================================== --- 1.1.4/src/hid_draw_helpers.c (revision 10776) +++ 1.1.4/src/hid_draw_helpers.c (nonexistent) @@ -1,436 +0,0 @@ -#include "global.h" -#include "hid.h" -#include "polygon.h" - -static void fill_contour(hidGC gc, PLINE * pl) -{ - Coord *x, *y, n, i = 0; - VNODE *v; - - n = pl->Count; - x = (Coord *) malloc(n * sizeof(*x)); - y = (Coord *) malloc(n * sizeof(*y)); - - for (v = &pl->head; i < n; v = v->next) { - x[i] = v->point[0]; - y[i++] = v->point[1]; - } - - gui->fill_polygon(gc, n, x, y); - - free(x); - free(y); -} - -static void thindraw_contour(hidGC gc, PLINE * pl) -{ - VNODE *v; - Coord last_x, last_y; - Coord this_x, this_y; - - gui->set_line_width(gc, 0); - gui->set_line_cap(gc, Round_Cap); - - /* If the contour is round, use an arc drawing routine. */ - if (pl->is_round) { - gui->draw_arc(gc, pl->cx, pl->cy, pl->radius, pl->radius, 0, 360); - return; - } - - /* Need at least two points in the contour */ - if (pl->head.next == NULL) - return; - - last_x = pl->head.point[0]; - last_y = pl->head.point[1]; - v = pl->head.next; - - do { - this_x = v->point[0]; - this_y = v->point[1]; - - gui->draw_line(gc, last_x, last_y, this_x, this_y); - /* gui->fill_circle (gc, this_x, this_y, 30); */ - - last_x = this_x; - last_y = this_y; - } - while ((v = v->next) != pl->head.next); -} - -static void fill_contour_cb(PLINE * pl, void *user_data) -{ - hidGC gc = (hidGC) user_data; - PLINE *local_pl = pl; - - fill_contour(gc, pl); - poly_FreeContours(&local_pl); -} - -static void fill_clipped_contour(hidGC gc, PLINE * pl, const BoxType * clip_box) -{ - PLINE *pl_copy; - POLYAREA *clip_poly; - POLYAREA *piece_poly; - POLYAREA *clipped_pieces; - POLYAREA *draw_piece; - int x; - - clip_poly = RectPoly(clip_box->X1, clip_box->X2, clip_box->Y1, clip_box->Y2); - poly_CopyContour(&pl_copy, pl); - piece_poly = poly_Create(); - poly_InclContour(piece_poly, pl_copy); - x = poly_Boolean_free(piece_poly, clip_poly, &clipped_pieces, PBO_ISECT); - if (x != err_ok || clipped_pieces == NULL) - return; - - draw_piece = clipped_pieces; - do { - /* NB: The polygon won't have any holes in it */ - fill_contour(gc, draw_piece->contours); - } - while ((draw_piece = draw_piece->f) != clipped_pieces); - poly_Free(&clipped_pieces); -} - -/* If at least 50% of the bounding box of the polygon is on the screen, - * lets compute the complete no-holes polygon. - */ -#define BOUNDS_INSIDE_CLIP_THRESHOLD 0.5 -static int should_compute_no_holes(PolygonType * poly, const BoxType * clip_box) -{ - Coord x1, x2, y1, y2; - double poly_bounding_area; - double clipped_poly_area; - - /* If there is no passed clip box, compute the whole thing */ - if (clip_box == NULL) - return 1; - - x1 = MAX(poly->BoundingBox.X1, clip_box->X1); - x2 = MIN(poly->BoundingBox.X2, clip_box->X2); - y1 = MAX(poly->BoundingBox.Y1, clip_box->Y1); - y2 = MIN(poly->BoundingBox.Y2, clip_box->Y2); - - /* Check if the polygon is outside the clip box */ - if ((x2 <= x1) || (y2 <= y1)) - return 0; - - poly_bounding_area = (double) (poly->BoundingBox.X2 - poly->BoundingBox.X1) * - (double) (poly->BoundingBox.Y2 - poly->BoundingBox.Y1); - - clipped_poly_area = (double) (x2 - x1) * (double) (y2 - y1); - - if (clipped_poly_area / poly_bounding_area >= BOUNDS_INSIDE_CLIP_THRESHOLD) - return 1; - - return 0; -} - -#undef BOUNDS_INSIDE_CLIP_THRESHOLD - -void common_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) -{ - if (!poly->NoHolesValid) { - /* If enough of the polygon is on-screen, compute the entire - * NoHoles version and cache it for later rendering, otherwise - * just compute what we need to render now. - */ - if (should_compute_no_holes(poly, clip_box)) - ComputeNoHoles(poly); - else - NoHolesPolygonDicer(poly, clip_box, fill_contour_cb, gc); - } - if (poly->NoHolesValid && poly->NoHoles) { - PLINE *pl; - - for (pl = poly->NoHoles; pl != NULL; pl = pl->next) { - if (clip_box == NULL) - fill_contour(gc, pl); - else - fill_clipped_contour(gc, pl, clip_box); - } - } - - /* Draw other parts of the polygon if fullpoly flag is set */ - /* NB: No "NoHoles" cache for these */ - if (TEST_FLAG(PCB_FLAG_FULLPOLY, poly)) { - PolygonType p = *poly; - - for (p.Clipped = poly->Clipped->f; p.Clipped != poly->Clipped; p.Clipped = p.Clipped->f) - NoHolesPolygonDicer(&p, clip_box, fill_contour_cb, gc); - } -} - -static int thindraw_hole_cb(PLINE * pl, void *user_data) -{ - hidGC gc = (hidGC) user_data; - thindraw_contour(gc, pl); - return 0; -} - -void common_thindraw_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) -{ - thindraw_contour(gc, poly->Clipped->contours); - PolygonHoles(poly, clip_box, thindraw_hole_cb, gc); -} - -void common_thindraw_pcb_pad(hidGC gc, PadType * pad, pcb_bool clear, pcb_bool mask) -{ - Coord w = clear ? (mask ? pad->Mask : pad->Thickness + pad->Clearance) - : pad->Thickness; - Coord x1, y1, x2, y2; - Coord t = w / 2; - x1 = pad->Point1.X; - y1 = pad->Point1.Y; - x2 = pad->Point2.X; - y2 = pad->Point2.Y; - if (x1 > x2 || y1 > y2) { - Coord temp_x = x1; - Coord temp_y = y1; - x1 = x2; - x2 = temp_x; - y1 = y2; - y2 = temp_y; - } - gui->set_line_cap(gc, Round_Cap); - gui->set_line_width(gc, 0); - if (TEST_FLAG(PCB_FLAG_SQUARE, pad)) { - /* slanted square pad */ - double tx, ty, theta; - - if (x1 == x2 && y1 == y2) - theta = 0; - else - theta = atan2(y2 - y1, x2 - x1); - - /* T is a vector half a thickness long, in the direction of - one of the corners. */ - tx = t * cos(theta + M_PI / 4) * sqrt(2.0); - ty = t * sin(theta + M_PI / 4) * sqrt(2.0); - - gui->draw_line(gc, x1 - tx, y1 - ty, x2 + ty, y2 - tx); - gui->draw_line(gc, x2 + ty, y2 - tx, x2 + tx, y2 + ty); - gui->draw_line(gc, x2 + tx, y2 + ty, x1 - ty, y1 + tx); - gui->draw_line(gc, x1 - ty, y1 + tx, x1 - tx, y1 - ty); - } - else if (x1 == x2 && y1 == y2) { - gui->draw_arc(gc, x1, y1, t, t, 0, 360); - } - else { - /* Slanted round-end pads. */ - Coord dx, dy, ox, oy; - double h; - - dx = x2 - x1; - dy = y2 - y1; - h = t / sqrt(SQUARE(dx) + SQUARE(dy)); - ox = dy * h + 0.5 * SGN(dy); - oy = -(dx * h + 0.5 * SGN(dx)); - - gui->draw_line(gc, x1 + ox, y1 + oy, x2 + ox, y2 + oy); - - if (labs(ox) >= pixel_slop || coord_abs(oy) >= pixel_slop) { - Angle angle = atan2(dx, dy) * 57.295779; - gui->draw_line(gc, x1 - ox, y1 - oy, x2 - ox, y2 - oy); - gui->draw_arc(gc, x1, y1, t, t, angle - 180, 180); - gui->draw_arc(gc, x2, y2, t, t, angle, 180); - } - } -} - -void common_fill_pcb_pad(hidGC gc, PadType * pad, pcb_bool clear, pcb_bool mask) -{ - Coord w = clear ? (mask ? pad->Mask : pad->Thickness + pad->Clearance) - : pad->Thickness; - - if (pad->Point1.X == pad->Point2.X && pad->Point1.Y == pad->Point2.Y) { - if (TEST_FLAG(PCB_FLAG_SQUARE, pad)) { - Coord l, r, t, b; - l = pad->Point1.X - w / 2; - b = pad->Point1.Y - w / 2; - r = l + w; - t = b + w; - gui->fill_rect(gc, l, b, r, t); - } - else { - gui->fill_circle(gc, pad->Point1.X, pad->Point1.Y, w / 2); - } - } - else { - gui->set_line_cap(gc, TEST_FLAG(PCB_FLAG_SQUARE, pad) ? Square_Cap : Round_Cap); - gui->set_line_width(gc, w); - - gui->draw_line(gc, pad->Point1.X, pad->Point1.Y, pad->Point2.X, pad->Point2.Y); - } -} - -/* --------------------------------------------------------------------------- - * draws one polygon - * x and y are already in display coordinates - * the points are numbered: - * - * 5 --- 6 - * / \ - * 4 7 - * | | - * 3 0 - * \ / - * 2 --- 1 - */ - -typedef struct { - double X, Y; -} FloatPolyType; - -static void draw_square_pin_poly(hidGC gc, Coord X, Coord Y, Coord Thickness, Coord thin_draw, int style) -{ - static FloatPolyType p[8] = { - {0.5, -PCB_TAN_22_5_DEGREE_2}, - {PCB_TAN_22_5_DEGREE_2, -0.5}, - {-PCB_TAN_22_5_DEGREE_2, -0.5}, - {-0.5, -PCB_TAN_22_5_DEGREE_2}, - {-0.5, PCB_TAN_22_5_DEGREE_2}, - {-PCB_TAN_22_5_DEGREE_2, 0.5}, - {PCB_TAN_22_5_DEGREE_2, 0.5}, - {0.5, PCB_TAN_22_5_DEGREE_2} - }; - static int special_size = 0; - static int scaled_x[8]; - static int scaled_y[8]; - Coord polygon_x[9]; - Coord polygon_y[9]; - double xm[8], ym[8]; - int i; - - square_pin_factors(style, xm, ym); - - if (Thickness != special_size) { - special_size = Thickness; - for (i = 0; i < 8; i++) { - scaled_x[i] = p[i].X * special_size; - scaled_y[i] = p[i].Y * special_size; - } - } - /* add line offset */ - for (i = 0; i < 8; i++) { - polygon_x[i] = X + scaled_x[i] * xm[i]; - polygon_y[i] = Y + scaled_y[i] * ym[i]; - } - - if (thin_draw) { - int i; - gui->set_line_cap(gc, Round_Cap); - gui->set_line_width(gc, 0); - polygon_x[8] = X + scaled_x[0] * xm[0]; - polygon_y[8] = Y + scaled_y[0] * ym[0]; - for (i = 0; i < 8; i++) - gui->draw_line(gc, polygon_x[i], polygon_y[i], polygon_x[i + 1], polygon_y[i + 1]); - } - else - gui->fill_polygon(gc, 8, polygon_x, polygon_y); -} - -static void draw_octagon_poly(hidGC gc, Coord X, Coord Y, Coord Thickness, Coord thin_draw) -{ - draw_square_pin_poly(gc, X, Y, Thickness, thin_draw, 17); -} - - -void common_fill_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pv, pcb_bool drawHole, pcb_bool mask) -{ - Coord w = mask ? pv->Mask : pv->Thickness; - Coord r = w / 2; - - if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { - if (mask) - gui->fill_circle(bg_gc, pv->X, pv->Y, r); - if (drawHole) { - gui->fill_circle(bg_gc, pv->X, pv->Y, r); - gui->set_line_cap(fg_gc, Round_Cap); - gui->set_line_width(fg_gc, 0); - gui->draw_arc(fg_gc, pv->X, pv->Y, r, r, 0, 360); - } - return; - } - - if (TEST_FLAG(PCB_FLAG_SQUARE, pv)) { - /* use the original code for now */ - if ((GET_SQUARE(pv) == 0) || (GET_SQUARE(pv) == 1)) { - Coord l = pv->X - r; - Coord b = pv->Y - r; - Coord r = l + w; - Coord t = b + w; - gui->fill_rect(fg_gc, l, b, r, t); - } - else - draw_square_pin_poly(fg_gc, pv->X, pv->Y, w, pcb_false, GET_SQUARE(pv)); - } - else if (TEST_FLAG(PCB_FLAG_OCTAGON, pv)) - draw_octagon_poly(fg_gc, pv->X, pv->Y, w, pcb_false); - else /* draw a round pin or via */ - gui->fill_circle(fg_gc, pv->X, pv->Y, r); - - /* and the drilling hole (which is always round) */ - if (drawHole) - gui->fill_circle(bg_gc, pv->X, pv->Y, pv->DrillingHole / 2); -} - -void common_thindraw_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pv, pcb_bool drawHole, pcb_bool mask) -{ - Coord w = mask ? pv->Mask : pv->Thickness; - Coord r = w / 2; - - if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { - if (mask) - gui->draw_arc(fg_gc, pv->X, pv->Y, r, r, 0, 360); - if (drawHole) { - r = pv->DrillingHole / 2; - gui->set_line_cap(bg_gc, Round_Cap); - gui->set_line_width(bg_gc, 0); - gui->draw_arc(bg_gc, pv->X, pv->Y, r, r, 0, 360); - } - return; - } - - if (TEST_FLAG(PCB_FLAG_SQUARE, pv)) { - Coord l = pv->X - r; - Coord b = pv->Y - r; - Coord r = l + w; - Coord t = b + w; - - gui->set_line_cap(fg_gc, Round_Cap); - gui->set_line_width(fg_gc, 0); - gui->draw_line(fg_gc, r, t, r, b); - gui->draw_line(fg_gc, l, t, l, b); - gui->draw_line(fg_gc, r, t, l, t); - gui->draw_line(fg_gc, r, b, l, b); - - } - else if (TEST_FLAG(PCB_FLAG_OCTAGON, pv)) { - draw_octagon_poly(fg_gc, pv->X, pv->Y, w, pcb_true); - } - else { /* draw a round pin or via */ - - gui->set_line_cap(fg_gc, Round_Cap); - gui->set_line_width(fg_gc, 0); - gui->draw_arc(fg_gc, pv->X, pv->Y, r, r, 0, 360); - } - - /* and the drilling hole (which is always round */ - if (drawHole) { - gui->set_line_cap(bg_gc, Round_Cap); - gui->set_line_width(bg_gc, 0); - gui->draw_arc(bg_gc, pv->X, pv->Y, pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360); - } -} - -void common_draw_helpers_init(HID * hid) -{ - hid->fill_pcb_polygon = common_fill_pcb_polygon; - hid->thindraw_pcb_polygon = common_thindraw_pcb_polygon; - hid->fill_pcb_pad = common_fill_pcb_pad; - hid->thindraw_pcb_pad = common_thindraw_pcb_pad; - hid->fill_pcb_pv = common_fill_pcb_pv; - hid->thindraw_pcb_pv = common_thindraw_pcb_pv; -} Index: 1.1.4/src/funchash.h =================================================================== --- 1.1.4/src/funchash.h (revision 10776) +++ 1.1.4/src/funchash.h (nonexistent) @@ -1,47 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Table entry format for funchash_set_table() */ -typedef struct { - const char *key; - int val; -} funchash_table_t; - -/* Cookie is the namespace so that different modules can use the same - function names with different integer IDs without interference. Core - should use cookie==NULL. */ - -/* Resolve a key string into an integer ID */ -int funchash_get(const char *key, const char *cookie); - -/* Store key string - integer ID pair */ -int funchash_set(const char *key, int val, const char *cookie); - -/* Store multiple key strings - integer ID pairs using a table */ -int funchash_set_table(funchash_table_t *table, int numelem, const char *cookie); - -/* Remove all keys inserted for a cookie */ -void funchash_remove_cookie(const char *cookie); - -/* Init-uninit the hash */ -void funchash_init(void); -void funchash_uninit(void); Index: 1.1.4/src/list_pad.h =================================================================== --- 1.1.4/src/list_pad.h (revision 10776) +++ 1.1.4/src/list_pad.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_PAD_H -#define LIST_PAD_H - -/* List of Pads */ -#define TDL(x) padlist_ ## x -#define TDL_LIST_T padlist_t -#define TDL_ITEM_T PadType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define padlist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/intersect.h =================================================================== --- 1.1.4/src/intersect.h (revision 10776) +++ 1.1.4/src/intersect.h (nonexistent) @@ -1,43 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, intersect.h, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* prototypes for rectangle intersection/union routines. - */ - -#ifndef PCB_INTERSECT_H -#define PCB_INTERSECT_H - -#include "global.h" - -double ComputeIntersectionArea(BoxListTypePtr boxlist); /* will sort boxlist */ -double ComputeUnionArea(BoxListTypePtr boxlist); - -#endif Index: 1.1.4/src/plug_import.h =================================================================== --- 1.1.4/src/plug_import.h (revision 10776) +++ 1.1.4/src/plug_import.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,1997,1998,2005,2006 Thomas Nau - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -#ifndef PCB_PLUG_IMPORT_H -#define PCB_PLUG_IMPORT_H - -#include "global.h" -#include "conf.h" - -/**************************** API definition *********************************/ - -typedef enum plug_import_aspect_e { /* bitfield of aspects that can be imported */ - IMPORT_ASPECT_NETLIST = 1 -} plug_import_aspect_t; - -typedef struct plug_import_s plug_import_t; -struct plug_import_s { - plug_import_t *next; - void *plugin_data; - - /* Check if the plugin supports format fmt. Return 0 if not supported or - an integer priority if supported. The higher the prio is the more likely - the plugin gets the next operation on the file. Base prio should be 100 - for native formats. Return non-0 only if all aspects are supported. */ - int (*fmt_support_prio)(plug_import_t *ctx, unsigned int aspects, FILE *f, const char *filename); - - /* Perform the import; return 0 on success */ - int (*import)(plug_import_t *ctx, unsigned int aspects, const char *fn); -}; - -extern plug_import_t *plug_import_chain; - -/********** hook wrappers **********/ -int pcb_import(char *filename, unsigned int aspect); -int ImportNetlist(char *); - - -#endif Index: 1.1.4/src/rubberband.c =================================================================== --- 1.1.4/src/rubberband.c (revision 10776) +++ 1.1.4/src/rubberband.c (nonexistent) @@ -1,492 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* functions used by 'rubberband moves' */ - -#include "config.h" - -#include -#include -#include -#include - -#include "create.h" -#include "data.h" -#include "error.h" -#include "misc.h" -#include "layer.h" -#include "polygon.h" -#include "rtree.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void CheckPadForRubberbandConnection(PadTypePtr); -static void CheckPinForRubberbandConnection(PinTypePtr); -static void CheckLinePointForRubberbandConnection(LayerTypePtr, LineTypePtr, PointTypePtr, pcb_bool); -static void CheckPolygonForRubberbandConnection(LayerTypePtr, PolygonTypePtr); -static void CheckLinePointForRat(LayerTypePtr, PointTypePtr); -static r_dir_t rubber_callback(const BoxType * b, void *cl); - -struct rubber_info { - Coord radius; - Coord X, Y; - LineTypePtr line; - BoxType box; - LayerTypePtr layer; -}; - -static r_dir_t rubber_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct rubber_info *i = (struct rubber_info *) cl; - double x, y, rad, dist1, dist2; - Coord t; - int touches = 0; - - t = line->Thickness / 2; - - if (TEST_FLAG(PCB_FLAG_LOCK, line)) - return R_DIR_NOT_FOUND; - if (line == i->line) - return R_DIR_NOT_FOUND; - /* - * Check to see if the line touches a rectangular region. - * To do this we need to look for the intersection of a circular - * region and a rectangular region. - */ - if (i->radius == 0) { - int found = 0; - - if (line->Point1.X + t >= i->box.X1 && line->Point1.X - t <= i->box.X2 - && line->Point1.Y + t >= i->box.Y1 && line->Point1.Y - t <= i->box.Y2) { - if (((i->box.X1 <= line->Point1.X) && - (line->Point1.X <= i->box.X2)) || ((i->box.Y1 <= line->Point1.Y) && (line->Point1.Y <= i->box.Y2))) { - /* - * The circle is positioned such that the closest point - * on the rectangular region boundary is not at a corner - * of the rectangle. i.e. the shortest line from circle - * center to rectangle intersects the rectangle at 90 - * degrees. In this case our first test is sufficient - */ - touches = 1; - } - else { - /* - * Now we must check the distance from the center of the - * circle to the corners of the rectangle since the - * closest part of the rectangular region is the corner. - */ - x = MIN(coord_abs(i->box.X1 - line->Point1.X), coord_abs(i->box.X2 - line->Point1.X)); - x *= x; - y = MIN(coord_abs(i->box.Y1 - line->Point1.Y), coord_abs(i->box.Y2 - line->Point1.Y)); - y *= y; - x = x + y - (t * t); - - if (x <= 0) - touches = 1; - } - if (touches) { - CreateNewRubberbandEntry(i->layer, line, &line->Point1); - found++; - } - } - if (line->Point2.X + t >= i->box.X1 && line->Point2.X - t <= i->box.X2 - && line->Point2.Y + t >= i->box.Y1 && line->Point2.Y - t <= i->box.Y2) { - if (((i->box.X1 <= line->Point2.X) && - (line->Point2.X <= i->box.X2)) || ((i->box.Y1 <= line->Point2.Y) && (line->Point2.Y <= i->box.Y2))) { - touches = 1; - } - else { - x = MIN(coord_abs(i->box.X1 - line->Point2.X), coord_abs(i->box.X2 - line->Point2.X)); - x *= x; - y = MIN(coord_abs(i->box.Y1 - line->Point2.Y), coord_abs(i->box.Y2 - line->Point2.Y)); - y *= y; - x = x + y - (t * t); - - if (x <= 0) - touches = 1; - } - if (touches) { - CreateNewRubberbandEntry(i->layer, line, &line->Point2); - found++; - } - } - return found ? R_DIR_FOUND_CONTINUE : R_DIR_NOT_FOUND; - } - /* circular search region */ - if (i->radius < 0) - rad = 0; /* require exact match */ - else - rad = SQUARE(i->radius + t); - - x = (i->X - line->Point1.X); - x *= x; - y = (i->Y - line->Point1.Y); - y *= y; - dist1 = x + y - rad; - - x = (i->X - line->Point2.X); - x *= x; - y = (i->Y - line->Point2.Y); - y *= y; - dist2 = x + y - rad; - - if (dist1 > 0 && dist2 > 0) - return R_DIR_NOT_FOUND; - -#ifdef CLOSEST_ONLY /* keep this to remind me */ - if (dist1 < dist2) - CreateNewRubberbandEntry(i->layer, line, &line->Point1); - else - CreateNewRubberbandEntry(i->layer, line, &line->Point2); -#else - if (dist1 <= 0) - CreateNewRubberbandEntry(i->layer, line, &line->Point1); - if (dist2 <= 0) - CreateNewRubberbandEntry(i->layer, line, &line->Point2); -#endif - return R_DIR_FOUND_CONTINUE; -} - -/* --------------------------------------------------------------------------- - * checks all visible lines which belong to the same layergroup as the - * passed pad. If one of the endpoints of the line lays inside the pad, - * the line is added to the 'rubberband' list - */ -static void CheckPadForRubberbandConnection(PadTypePtr Pad) -{ - Coord half = Pad->Thickness / 2; - pcb_cardinal_t i, group; - struct rubber_info info; - - info.box.X1 = MIN(Pad->Point1.X, Pad->Point2.X) - half; - info.box.Y1 = MIN(Pad->Point1.Y, Pad->Point2.Y) - half; - info.box.X2 = MAX(Pad->Point1.X, Pad->Point2.X) + half; - info.box.Y2 = MAX(Pad->Point1.Y, Pad->Point2.Y) + half; - info.radius = 0; - info.line = NULL; - i = TEST_FLAG(PCB_FLAG_ONSOLDER, Pad) ? solder_silk_layer : component_silk_layer; - group = GetLayerGroupNumberByNumber(i); - - /* check all visible layers in the same group */ - GROUP_LOOP(PCB->Data, group); - { - /* check all visible lines of the group member */ - info.layer = layer; - if (info.layer->On) { - r_search(info.layer->line_tree, &info.box, NULL, rubber_callback, &info, NULL); - } - } - END_LOOP; -} - -struct rinfo { - int type; - pcb_cardinal_t group; - PinTypePtr pin; - PadTypePtr pad; - PointTypePtr point; -}; - -static r_dir_t rat_callback(const BoxType * box, void *cl) -{ - RatTypePtr rat = (RatTypePtr) box; - struct rinfo *i = (struct rinfo *) cl; - - switch (i->type) { - case PCB_TYPE_PIN: - if (rat->Point1.X == i->pin->X && rat->Point1.Y == i->pin->Y) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point1); - else if (rat->Point2.X == i->pin->X && rat->Point2.Y == i->pin->Y) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point2); - break; - case PCB_TYPE_PAD: - if (rat->Point1.X == i->pad->Point1.X && rat->Point1.Y == i->pad->Point1.Y && rat->group1 == i->group) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point1); - else if (rat->Point2.X == i->pad->Point1.X && rat->Point2.Y == i->pad->Point1.Y && rat->group2 == i->group) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point2); - else if (rat->Point1.X == i->pad->Point2.X && rat->Point1.Y == i->pad->Point2.Y && rat->group1 == i->group) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point1); - else if (rat->Point2.X == i->pad->Point2.X && rat->Point2.Y == i->pad->Point2.Y && rat->group2 == i->group) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point2); - else - if (rat->Point1.X == (i->pad->Point1.X + i->pad->Point2.X) / 2 && - rat->Point1.Y == (i->pad->Point1.Y + i->pad->Point2.Y) / 2 && rat->group1 == i->group) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point1); - else - if (rat->Point2.X == (i->pad->Point1.X + i->pad->Point2.X) / 2 && - rat->Point2.Y == (i->pad->Point1.Y + i->pad->Point2.Y) / 2 && rat->group2 == i->group) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point2); - break; - case PCB_TYPE_LINE_POINT: - if (rat->group1 == i->group && rat->Point1.X == i->point->X && rat->Point1.Y == i->point->Y) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point1); - else if (rat->group2 == i->group && rat->Point2.X == i->point->X && rat->Point2.Y == i->point->Y) - CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point2); - break; - default: - Message(PCB_MSG_DEFAULT, "hace: bad rubber-rat lookup callback\n"); - } - return R_DIR_NOT_FOUND; -} - -static void CheckPadForRat(PadTypePtr Pad) -{ - struct rinfo info; - pcb_cardinal_t i; - - i = TEST_FLAG(PCB_FLAG_ONSOLDER, Pad) ? solder_silk_layer : component_silk_layer; - info.group = GetLayerGroupNumberByNumber(i); - info.pad = Pad; - info.type = PCB_TYPE_PAD; - - r_search(PCB->Data->rat_tree, &Pad->BoundingBox, NULL, rat_callback, &info, NULL); -} - -static void CheckPinForRat(PinTypePtr Pin) -{ - struct rinfo info; - - info.type = PCB_TYPE_PIN; - info.pin = Pin; - r_search(PCB->Data->rat_tree, &Pin->BoundingBox, NULL, rat_callback, &info, NULL); -} - -static void CheckLinePointForRat(LayerTypePtr Layer, PointTypePtr Point) -{ - struct rinfo info; - info.group = GetLayerGroupNumberByPointer(Layer); - info.point = Point; - info.type = PCB_TYPE_LINE_POINT; - - r_search(PCB->Data->rat_tree, (BoxType *) Point, NULL, rat_callback, &info, NULL); -} - -/* --------------------------------------------------------------------------- - * checks all visible lines. If one of the endpoints of the line lays - * inside the pin, the line is added to the 'rubberband' list - * - * Square pins are handled as if they were round. Speed - * and readability is more important then the few % - * of failures that are immediately recognized - */ -static void CheckPinForRubberbandConnection(PinTypePtr Pin) -{ - struct rubber_info info; - pcb_cardinal_t n; - Coord t = Pin->Thickness / 2; - - info.box.X1 = Pin->X - t; - info.box.X2 = Pin->X + t; - info.box.Y1 = Pin->Y - t; - info.box.Y2 = Pin->Y + t; - info.line = NULL; - if (TEST_FLAG(PCB_FLAG_SQUARE, Pin)) - info.radius = 0; - else { - info.radius = t; - info.X = Pin->X; - info.Y = Pin->Y; - } - - for (n = 0; n < max_copper_layer; n++) { - info.layer = LAYER_PTR(n); - r_search(info.layer->line_tree, &info.box, NULL, rubber_callback, &info, NULL); - } -} - -/* --------------------------------------------------------------------------- - * checks all visible lines which belong to the same group as the passed line. - * If one of the endpoints of the line lays * inside the passed line, - * the scanned line is added to the 'rubberband' list - */ -static void CheckLinePointForRubberbandConnection(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr LinePoint, pcb_bool Exact) -{ - pcb_cardinal_t group; - struct rubber_info info; - Coord t = Line->Thickness / 2; - - /* lookup layergroup and check all visible lines in this group */ - info.radius = Exact ? -1 : MAX(Line->Thickness / 2, 1); - info.box.X1 = LinePoint->X - t; - info.box.X2 = LinePoint->X + t; - info.box.Y1 = LinePoint->Y - t; - info.box.Y2 = LinePoint->Y + t; - info.line = Line; - info.X = LinePoint->X; - info.Y = LinePoint->Y; - group = GetLayerGroupNumberByPointer(Layer); - GROUP_LOOP(PCB->Data, group); - { - /* check all visible lines of the group member */ - if (layer->On) { - info.layer = layer; - r_search(layer->line_tree, &info.box, NULL, rubber_callback, &info, NULL); - } - } - END_LOOP; -} - -/* --------------------------------------------------------------------------- - * checks all visible lines which belong to the same group as the passed polygon. - * If one of the endpoints of the line lays inside the passed polygon, - * the scanned line is added to the 'rubberband' list - */ -static void CheckPolygonForRubberbandConnection(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - pcb_cardinal_t group; - - /* lookup layergroup and check all visible lines in this group */ - group = GetLayerGroupNumberByPointer(Layer); - GROUP_LOOP(PCB->Data, group); - { - if (layer->On) { - Coord thick; - - /* the following code just stupidly compares the endpoints - * of the lines - */ - LINE_LOOP(layer); - { - if (TEST_FLAG(PCB_FLAG_LOCK, line)) - continue; - if (TEST_FLAG(PCB_FLAG_CLEARLINE, line)) - continue; - thick = (line->Thickness + 1) / 2; - if (IsPointInPolygon(line->Point1.X, line->Point1.Y, thick, Polygon)) - CreateNewRubberbandEntry(layer, line, &line->Point1); - if (IsPointInPolygon(line->Point2.X, line->Point2.Y, thick, Polygon)) - CreateNewRubberbandEntry(layer, line, &line->Point2); - } - END_LOOP; - } - } - END_LOOP; -} - -/* --------------------------------------------------------------------------- - * lookup all lines that are connected to an object and save the - * data to 'Crosshair.AttachedObject.Rubberband' - * lookup is only done for visible layers - */ -void LookupRubberbandLines(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - - /* the function is only supported for some types - * check all visible lines; - * it is only necessary to check if one of the endpoints - * is connected - */ - switch (Type) { - case PCB_TYPE_ELEMENT: - { - ElementTypePtr element = (ElementTypePtr) Ptr1; - - /* square pins are handled as if they are round. Speed - * and readability is more important then the few % - * of failures that are immediately recognized - */ - PIN_LOOP(element); - { - CheckPinForRubberbandConnection(pin); - } - END_LOOP; - PAD_LOOP(element); - { - CheckPadForRubberbandConnection(pad); - } - END_LOOP; - break; - } - - case PCB_TYPE_LINE: - { - LayerTypePtr layer = (LayerTypePtr) Ptr1; - LineTypePtr line = (LineTypePtr) Ptr2; - if (GetLayerNumber(PCB->Data, layer) < max_copper_layer) { - CheckLinePointForRubberbandConnection(layer, line, &line->Point1, pcb_false); - CheckLinePointForRubberbandConnection(layer, line, &line->Point2, pcb_false); - } - break; - } - - case PCB_TYPE_LINE_POINT: - if (GetLayerNumber(PCB->Data, (LayerTypePtr) Ptr1) < max_copper_layer) - CheckLinePointForRubberbandConnection((LayerTypePtr) Ptr1, (LineTypePtr) Ptr2, (PointTypePtr) Ptr3, pcb_true); - break; - - case PCB_TYPE_VIA: - CheckPinForRubberbandConnection((PinTypePtr) Ptr1); - break; - - case PCB_TYPE_POLYGON: - if (GetLayerNumber(PCB->Data, (LayerTypePtr) Ptr1) < max_copper_layer) - CheckPolygonForRubberbandConnection((LayerTypePtr) Ptr1, (PolygonTypePtr) Ptr2); - break; - } -} - -void LookupRatLines(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - switch (Type) { - case PCB_TYPE_ELEMENT: - { - ElementTypePtr element = (ElementTypePtr) Ptr1; - - PIN_LOOP(element); - { - CheckPinForRat(pin); - } - END_LOOP; - PAD_LOOP(element); - { - CheckPadForRat(pad); - } - END_LOOP; - break; - } - - case PCB_TYPE_LINE: - { - LayerTypePtr layer = (LayerTypePtr) Ptr1; - LineTypePtr line = (LineTypePtr) Ptr2; - - CheckLinePointForRat(layer, &line->Point1); - CheckLinePointForRat(layer, &line->Point2); - break; - } - - case PCB_TYPE_LINE_POINT: - CheckLinePointForRat((LayerTypePtr) Ptr1, (PointTypePtr) Ptr3); - break; - - case PCB_TYPE_VIA: - CheckPinForRat((PinTypePtr) Ptr1); - break; - } -} Index: 1.1.4/src/file_act.c =================================================================== --- 1.1.4/src/file_act.c (revision 10776) +++ 1.1.4/src/file_act.c (nonexistent) @@ -1,372 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" -#include "data.h" -#include "action_helper.h" -#include "error.h" - -#include "crosshair.h" -#include "set.h" -#include "plug_io.h" -#include "plug_import.h" -#include "buffer.h" -#include "misc.h" -#include "remove.h" -#include "create.h" -#include "draw.h" -#include "find.h" -#include "search.h" -#include "hid_actions.h" -#include "hid_attrib.h" -#include "compat_misc.h" - -/* ---------------------------------------------------------------- */ -static const char execcommand_syntax[] = "ExecCommand(command)"; - -static const char execcommand_help[] = "Runs a command."; - -/* %start-doc actions execcommand - -Runs the given command, which is a system executable. - -%end-doc */ - -static int ActionExecCommand(int argc, const char **argv, Coord x, Coord y) -{ - const char *command; - - if (argc < 1) { - AFAIL(execcommand); - } - - command = ACTION_ARG(0); - - if (system(command)) - return 1; - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char loadfrom_syntax[] = "LoadFrom(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert,filename[,format])"; - -static const char loadfrom_help[] = "Load layout data from a file."; - -/* %start-doc actions LoadFrom - -This action assumes you know what the filename is. The various GUIs -should have a similar @code{Load} action where the filename is -optional, and will provide their own file selection mechanism to let -you choose the file name. - -@table @code - -@item Layout -Loads an entire PCB layout, replacing the current one. - -@item LayoutToBuffer -Loads an entire PCB layout to the paste buffer. - -@item ElementToBuffer -Loads the given element file into the paste buffer. Element files -contain only a single @code{Element} definition, such as the -``newlib'' library uses. - -@item Netlist -Loads a new netlist, replacing any current netlist. - -@item Revert -Re-loads the current layout from its disk file, reverting any changes -you may have made. - -@end table - -%end-doc */ - -static int ActionLoadFrom(int argc, const char **argv, Coord x, Coord y) -{ - const char *function, *name, *format = NULL; - - if (argc < 2) - AFAIL(loadfrom); - - function = argv[0]; - name = argv[1]; - if (argc > 2) - format = argv[2]; - - if (strcasecmp(function, "ElementToBuffer") == 0) { - notify_crosshair_change(pcb_false); - if (LoadElementToBuffer(PASTEBUFFER, name)) - SetMode(PCB_MODE_PASTE_BUFFER); - notify_crosshair_change(pcb_true); - } - - else if (strcasecmp(function, "LayoutToBuffer") == 0) { - notify_crosshair_change(pcb_false); - if (LoadLayoutToBuffer(PASTEBUFFER, name, format)) - SetMode(PCB_MODE_PASTE_BUFFER); - notify_crosshair_change(pcb_true); - } - - else if (strcasecmp(function, "Layout") == 0) { - if (!PCB->Changed || gui->confirm_dialog(_("OK to override layout data?"), 0)) - LoadPCB(name, format, pcb_true, 0); - } - - else if (strcasecmp(function, "Netlist") == 0) { - if (PCB->Netlistname) - free(PCB->Netlistname); - PCB->Netlistname = StripWhiteSpaceAndDup(name); - { - int i; - for (i = 0; i < NUM_NETLISTS; i++) - FreeLibraryMemory(&(PCB->NetlistLib[i])); - } - if (!ImportNetlist(PCB->Netlistname)) - pcb_netlist_changed(1); - } - else if (strcasecmp(function, "Revert") == 0 && PCB->Filename - && (!PCB->Changed || gui->confirm_dialog(_("OK to override changes?"), 0))) { - RevertPCB(); - } - - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char new_syntax[] = "New([name])"; - -static const char new_help[] = "Starts a new layout."; - -/* %start-doc actions New - -If a name is not given, one is prompted for. - -%end-doc */ - -static int ActionNew(int argc, const char **argv, Coord x, Coord y) -{ - const char *argument_name = ACTION_ARG(0); - char *name = NULL; - - if (!PCB->Changed || gui->confirm_dialog(_("OK to clear layout data?"), 0)) { - if (argument_name) - name = pcb_strdup(argument_name); - else - name = gui->prompt_for(_("Enter the layout name:"), ""); - - if (!name) - return 1; - - notify_crosshair_change(pcb_false); - /* do emergency saving - * clear the old struct and allocate memory for the new one - */ - if (PCB->Changed && conf_core.editor.save_in_tmp) - SaveInTMP(); - RemovePCB(PCB); - PCB = CreateNewPCB(); - CreateNewPCBPost(PCB, 1); - - /* setup the new name and reset some values to default */ - free(PCB->Name); - PCB->Name = name; - - ResetStackAndVisibility(); - SetCrosshairRange(0, 0, PCB->MaxWidth, PCB->MaxHeight); - CenterDisplay(PCB->MaxWidth / 2, PCB->MaxHeight / 2); - Redraw(); - - if (gui != NULL) - hid_action("PCBChanged"); - notify_crosshair_change(pcb_true); - return 0; - } - return 1; -} - -/* --------------------------------------------------------------------------- */ - -static const char saveto_syntax[] = - "SaveTo(Layout|LayoutAs,filename)\n" - "SaveTo(AllConnections|AllUnusedPins|ElementConnections,filename)\n" "SaveTo(PasteBuffer,filename)"; - -static const char saveto_help[] = "Saves data to a file."; - -/* %start-doc actions SaveTo - -@table @code - -@item Layout -Saves the current layout. - -@item LayoutAs -Saves the current layout, and remembers the filename used. - -@item AllConnections -Save all connections to a file. - -@item AllUnusedPins -List all unused pins to a file. - -@item ElementConnections -Save connections to the element at the cursor to a file. - -@item PasteBuffer -Save the content of the active Buffer to a file. This is the graphical way to create a footprint. - -@end table - -%end-doc */ - -static int ActionSaveTo(int argc, const char **argv, Coord x, Coord y) -{ - const char *function; - const char *name; - const char *fmt = NULL; - - function = argv[0]; - name = argv[1]; - - if (strcasecmp(function, "Layout") == 0) { - if (SavePCB(PCB->Filename, NULL) == 0) - SetChangedFlag(pcb_false); - if (gui->notify_filename_changed != NULL) - gui->notify_filename_changed(); - return 0; - } - - if ((argc != 2) && (argc != 3)) - AFAIL(saveto); - - if (argc >= 3) - fmt = argv[2]; - - if (strcasecmp(function, "LayoutAs") == 0) { - if (SavePCB(name, fmt) == 0) { - SetChangedFlag(pcb_false); - free(PCB->Filename); - PCB->Filename = pcb_strdup(name); - if (gui->notify_filename_changed != NULL) - gui->notify_filename_changed(); - } - return 0; - } - - if (strcasecmp(function, "AllConnections") == 0) { - FILE *fp; - pcb_bool result; - if ((fp = CheckAndOpenFile(name, pcb_true, pcb_false, &result, NULL)) != NULL) { - LookupConnectionsToAllElements(fp); - fclose(fp); - SetChangedFlag(pcb_true); - } - return 0; - } - - if (strcasecmp(function, "AllUnusedPins") == 0) { - FILE *fp; - pcb_bool result; - if ((fp = CheckAndOpenFile(name, pcb_true, pcb_false, &result, NULL)) != NULL) { - LookupUnusedPins(fp); - fclose(fp); - SetChangedFlag(pcb_true); - } - return 0; - } - - if (strcasecmp(function, "ElementConnections") == 0) { - ElementTypePtr element; - void *ptrtmp; - FILE *fp; - pcb_bool result; - - if ((SearchScreen(Crosshair.X, Crosshair.Y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) { - element = (ElementTypePtr) ptrtmp; - if ((fp = CheckAndOpenFile(name, pcb_true, pcb_false, &result, NULL)) != NULL) { - LookupElementConnections(element, fp); - fclose(fp); - SetChangedFlag(pcb_true); - } - } - return 0; - } - - if (strcasecmp(function, "PasteBuffer") == 0) { - return SaveBufferElements(name, fmt); - } - - AFAIL(saveto); -} - -/* --------------------------------------------------------------------------- */ - -static const char quit_syntax[] = "Quit()"; - -static const char quit_help[] = "Quits the application after confirming."; - -/* %start-doc actions Quit - -If you have unsaved changes, you will be prompted to confirm (or -save) before quitting. - -%end-doc */ - -static int ActionQuit(int argc, const char **argv, Coord x, Coord y) -{ - const char *force = ACTION_ARG(0); - if (force && strcasecmp(force, "force") == 0) { - PCB->Changed = 0; - exit(0); - } - if (!PCB->Changed || gui->close_confirm_dialog() == HID_CLOSE_CONFIRM_OK) - QuitApplication(); - return 1; -} - - -HID_Action file_action_list[] = { - {"ExecCommand", 0, ActionExecCommand, - execcommand_help, execcommand_syntax} - , - {"LoadFrom", 0, ActionLoadFrom, - loadfrom_help, loadfrom_syntax} - , - {"New", 0, ActionNew, - new_help, new_syntax} - , - {"SaveTo", 0, ActionSaveTo, - saveto_help, saveto_syntax} - , - {"Quit", 0, ActionQuit, - quit_help, quit_syntax} -}; - -REGISTER_ACTIONS(file_action_list, NULL) Index: 1.1.4/src/find_act.c =================================================================== --- 1.1.4/src/find_act.c (revision 10776) +++ 1.1.4/src/find_act.c (nonexistent) @@ -1,73 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" -#include "data.h" -#include "error.h" -#include "find.h" - -/* -------------------------------------------------------------------------- */ - -static const char drc_syntax[] = "DRC()"; - -static const char drc_help[] = "Invoke the DRC check."; - -/* %start-doc actions DRC - -Note that the design rule check uses the current board rule settings, -not the current style settings. - -%end-doc */ - -static int ActionDRCheck(int argc, const char **argv, Coord x, Coord y) -{ - int count; - - if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview) { - Message(PCB_MSG_DEFAULT, _("%m+Rules are minspace %$mS, minoverlap %$mS " - "minwidth %$mS, minsilk %$mS\n" - "min drill %$mS, min annular ring %$mS\n"), - conf_core.editor.grid_unit->allow, PCB->Bloat, PCB->Shrink, PCB->minWid, PCB->minSlk, PCB->minDrill, PCB->minRing); - } - count = DRCAll(); - if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview) { - if (count == 0) - Message(PCB_MSG_DEFAULT, _("No DRC problems found.\n")); - else if (count > 0) - Message(PCB_MSG_DEFAULT, _("Found %d design rule errors.\n"), count); - else - Message(PCB_MSG_DEFAULT, _("Aborted DRC after %d design rule errors.\n"), -count); - } - return 0; -} - -HID_Action find_action_list[] = { - {"DRC", 0, ActionDRCheck, - drc_help, drc_syntax} -}; - -REGISTER_ACTIONS(find_action_list, NULL) Index: 1.1.4/src/global_typedefs.h =================================================================== --- 1.1.4/src/global_typedefs.h (revision 10776) +++ 1.1.4/src/global_typedefs.h (nonexistent) @@ -1,49 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef GLOBAL_TYPEDEFS_H -#define GLOBAL_TYPEDEFS_H -#include "config.h" - -typedef struct BoxType BoxType, *BoxTypePtr; -typedef struct polygon_st PolygonType, *PolygonTypePtr; -typedef struct pad_st PadType, *PadTypePtr; -typedef struct pin_st PinType, *PinTypePtr, **PinTypeHandle; -typedef struct drc_violation_st DrcViolationType, *DrcViolationTypePtr; -typedef struct rtree rtree_t; -typedef struct AttributeListType AttributeListType, *AttributeListTypePtr; -typedef struct rats_patch_line_s rats_patch_line_t; -typedef struct element_st ElementType, *ElementTypePtr, **ElementTypeHandle; -typedef struct net_st NetType, *NetTypePtr; -typedef struct layer_st LayerType, *LayerTypePtr; -typedef struct data_st DataType, *DataTypePtr; -typedef struct plug_io_s plug_io_t; - - -typedef unsigned int pcb_cardinal_t; -typedef unsigned char pcb_uint8_t; /* Don't use in new code. */ - -#include "pcb_bool.h" - -#include "unit.h" - -#endif Index: 1.1.4/src/hid_draw_helpers.h =================================================================== --- 1.1.4/src/hid_draw_helpers.h (revision 10776) +++ 1.1.4/src/hid_draw_helpers.h (nonexistent) @@ -1,10 +0,0 @@ -#ifndef PCB_HID_DRAW_HELPERS_H -#define PCB_HID_DRAW_HELPERS_H -void common_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box); -void common_thindraw_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box); -void common_fill_pcb_pad(hidGC gc, PadType * pad, pcb_bool clear, pcb_bool mask); -void common_thindraw_pcb_pad(hidGC gc, PadType * pad, pcb_bool clear, pcb_bool mask); -void common_fill_pcb_pv(hidGC gc, PinType * pv, pcb_bool drawHole, pcb_bool mask); -void common_thindraw_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pv, pcb_bool drawHole, pcb_bool mask); -void common_draw_helpers_init(HID * hid); -#endif Index: 1.1.4/src/main_act.c =================================================================== --- 1.1.4/src/main_act.c (revision 10776) +++ 1.1.4/src/main_act.c (nonexistent) @@ -1,271 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -#define Progname "pcb-rnd" - -#include "config.h" - -#include "action_helper.h" -#include "hid_actions.h" -#include "hid_attrib.h" -#include "hid_init.h" -#include "hid.h" -#include "data.h" -#include "conf_core.h" - - -/* --------------------------------------------------------------------------- */ - -static const char printactions_syntax[] = "PrintActions()"; - -static const char printactions_help[] = "Print all actions available."; - -int ActionPrintActions(int argc, const char **argv, Coord x, Coord y) -{ - print_actions(); - return 0; -} -/* --------------------------------------------------------------------------- */ - -static const char dumpactions_syntax[] = "DumpActions()"; - -static const char dumpactions_help[] = "Dump all actions available."; - -int ActionDumpActions(int argc, const char **argv, Coord x, Coord y) -{ - dump_actions(); - return 0; -} - -/* print usage lines */ -static inline void u(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - fputc('\n', stderr); - va_end(ap); -} - -static const char printusage_syntax[] = - "PrintUsage()\n" - "PrintUsage(plugin)"; - -static const char printusage_help[] = "Print command line arguments of pcb-rnd or a plugin loaded."; - -static int help0(void) -{ - HID **hl = hid_enumerate(); - int i; - - u("pcb-rnd Printed Circuit Board editing program, http://repo.hu/projects/pcb-rnd"); - u("For more information, please read the topic help pages:", Progname); - u(" %s --help topic"); - u("Topics are:"); - u(" invocation how to run pcb-rnd"); - u(" main main/misc flags (affecting none or all plugins)"); - for (i = 0; hl[i]; i++) - if (hl[i]->usage != NULL) - u(" %-20s %s", hl[i]->name, hl[i]->description); - return 0; -} - -extern const char *pcb_action_args[]; -static int help_main(void) { - const char **cs; - for(cs = pcb_action_args; cs[2] != NULL; cs += 4) { - fprintf(stderr, "%s [", Progname); - if (cs[0] != NULL) - fprintf(stderr, "-%s", cs[0]); - if ((cs[0] != NULL) && (cs[1] != NULL)) - fprintf(stderr, "|"); - if (cs[1] != NULL) - fprintf(stderr, "-%s", cs[1]); - fprintf(stderr, "] %s\n", cs[3]); - } - return 0; -} - -static int help_invoc(void) -{ - HID **hl = hid_enumerate(); - int i; - int n_printer = 0, n_gui = 0, n_exporter = 0; - - u("pcb-rnd invocation:"); - u(""); - u("%s [main options] See --help main", Progname); - u(""); - u("%s [generics] [--gui GUI] [gui options] interactive GUI", Progname); - - u("Available GUI hid%s:", n_gui == 1 ? "" : "s"); - for (i = 0; hl[i]; i++) - if (hl[i]->gui) - fprintf(stderr, "\t%-8s %s\n", hl[i]->name, hl[i]->description); - - u("\n%s [generics] -p [printing options] \tto print", Progname); - u("Available printing hid%s:", n_printer == 1 ? "" : "s"); - for (i = 0; hl[i]; i++) - if (hl[i]->printer) - fprintf(stderr, "\t%-8s %s\n", hl[i]->name, hl[i]->description); - - u("\n%s [generics] -x hid [export options] \tto export", Progname); - u("Available export hid%s:", n_exporter == 1 ? "" : "s"); - for (i = 0; hl[i]; i++) - if (hl[i]->exporter) - fprintf(stderr, "\t%-8s %s\n", hl[i]->name, hl[i]->description); - - - u("\nGenerics:"); - u("-c conf/path=value set the value of a configuration item (in CFR_CLI)"); - - return 0; -} - -int ActionPrintUsage(int argc, const char **argv, Coord x, Coord y) -{ - u(""); - if (argc > 0) { - HID **hl = hid_enumerate(); - int i; - - if (strcmp(argv[0], "invocation") == 0) return help_invoc(); - if (strcmp(argv[0], "main") == 0) return help_main(); - - for (i = 0; hl[i]; i++) { - if ((hl[i]->usage != NULL) && (strcmp(argv[0], hl[i]->name) == 0)) { - if (argc > 1) - return hl[i]->usage(argv[1]); - else - return hl[i]->usage(NULL); - } - } - fprintf(stderr, "No help available for %s\n", argv[0]); - return -1; - } - else - help0(); - return 0; -} - - -/* --------------------------------------------------------------------------- */ -static const char printversion_syntax[] = "PrintVersion()"; - -static const char printversion_help[] = "Print version."; - -int ActionPrintVersion(int argc, const char **argv, Coord x, Coord y) -{ - printf("PCB version %s\n", VERSION); - return 0; -} - -/* --------------------------------------------------------------------------- */ -static const char printcopyright_syntax[] = "PrintCopyright()"; - -static const char printcopyright_help[] = "Print copyright notice."; - -int ActionPrintCopyright(int argc, const char **argv, Coord x, Coord y) -{ - printf("\n" - " COPYRIGHT for the original pcb program:\n\n" - " PCB, interactive printed circuit board design\n" - " Copyright (C) 1994,1995,1996,1997 Thomas Nau\n" - " Copyright (C) 1998, 1999, 2000 Harry Eaton\n\n"); - printf(" COPYRIGHT for %s (pcb-rnd) version %s:\n" - " pcb-rnd, a fork of PCB with random improvements\n" - " Copyright (C) 2013, 2014, 2015, 2016 Tibor 'Igor2' Palinkas\n\n", Progname, VERSION); - printf(" This program is free software; you can redistribute it and/or modify\n" - " it under the terms of the GNU General Public License as published by\n" - " the Free Software Foundation; either version 2 of the License, or\n" - " (at your option) any later version.\n\n"); - printf(" This program is distributed in the hope that it will be useful,\n" - " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - " GNU General Public License for more details.\n\n"); - printf(" You should have received a copy of the GNU General Public License\n" - " along with this program; if not, write to the Free Software\n" - " Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n"); - return 0; -} - -/* --------------------------------------------------------------------------- */ -static const char printpaths_syntax[] = "PrintPaths()"; - -static const char printpaths_help[] = "Print full paths and search paths."; - -static void print_list(const conflist_t *cl) -{ - int n; - conf_listitem_t *ci; - const char *p; - - printf(" "); - conf_loop_list_str(cl, ci, p, n) { - printf("%c%s", (n == 0) ? '"' : ':', p); - } - printf("\"\n"); -} - -int ActionPrintPaths(int argc, const char **argv, Coord x, Coord y) -{ - htsp_entry_t *e; - conf_fields_foreach(e) { - conf_native_t *n = e->value; - if ((strncmp(n->hash_path, "rc/path/", 8) == 0) && (n->type == CFN_STRING) && (n->used == 1)) - printf("%-32s = %s\n", n->hash_path, n->val.string[0]); - } - printf("rc/default_font_file ="); print_list(&conf_core.rc.default_font_file); - printf("rc/library_search_paths ="); print_list(&conf_core.rc.library_search_paths); - printf("rc/library_shell = \"%s\"\n", conf_core.rc.library_shell); - return 0; -} - - -/* --------------------------------------------------------------------------- */ - -HID_Action main_action_list[] = { - {"PrintActions", 0, ActionPrintActions, - printactions_help, printactions_syntax} - , - {"DumpActions", 0, ActionDumpActions, - dumpactions_help, dumpactions_syntax} - , - {"PrintUsage", 0, ActionPrintUsage, - printusage_help, printusage_syntax} - , - {"PrintVersion", 0, ActionPrintVersion, - printversion_help, printversion_syntax} - , - {"PrintCopyright", 0, ActionPrintCopyright, - printcopyright_help, printcopyright_syntax} - , - {"PrintPaths", 0, ActionPrintPaths, - printpaths_help, printpaths_syntax} -}; - -REGISTER_ACTIONS(main_action_list, NULL) Index: 1.1.4/src/rubberband.h =================================================================== --- 1.1.4/src/rubberband.h (revision 10776) +++ 1.1.4/src/rubberband.h (nonexistent) @@ -1,38 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for rubberband routines - */ - -#ifndef PCB_RUBBERBAND_H -#define PCB_RUBBERBAND_H - -#include "global.h" - -void LookupRubberbandLines(int, void *, void *, void *); -void LookupRatLines(int, void *, void *, void *); - -#endif Index: 1.1.4/src/hid_extents.c =================================================================== --- 1.1.4/src/hid_extents.c (revision 10776) +++ 1.1.4/src/hid_extents.c (nonexistent) @@ -1,188 +0,0 @@ -#include "config.h" - -#include -#include -#include -#include - -#include "global.h" -#include "data.h" -#include "layer.h" - -#include "hid.h" -#include "hid_draw_helpers.h" -#include "hid_helper.h" - -#ifndef MAXINT -#define MAXINT (((unsigned int)(~0))>>1) -#endif - -static BoxType box; - -typedef struct hid_gc_struct { - int width; -} hid_gc_struct; - -static int extents_set_layer(const char *name, int group, int empty) -{ - int idx = group; - if (idx >= 0 && idx < max_group) { - idx = PCB->LayerGroups.Entries[idx][0]; - } - if (idx >= 0 && idx < max_copper_layer + 2) - return 1; - if (idx < 0) { - switch (SL_TYPE(idx)) { - case SL_INVISIBLE: - case SL_MASK: - case SL_ASSY: - return 0; - case SL_SILK: - case SL_PDRILL: - case SL_UDRILL: - return 1; - } - } - return 0; -} - -static hidGC extents_make_gc(void) -{ - hidGC rv = (hidGC) malloc(sizeof(hid_gc_struct)); - memset(rv, 0, sizeof(hid_gc_struct)); - return rv; -} - -static void extents_destroy_gc(hidGC gc) -{ - free(gc); -} - -static void extents_use_mask(int use_it) -{ -} - -static void extents_set_color(hidGC gc, const char *name) -{ -} - -static void extents_set_line_cap(hidGC gc, EndCapStyle style) -{ -} - -static void extents_set_line_width(hidGC gc, Coord width) -{ - gc->width = width; -} - -static void extents_set_draw_xor(hidGC gc, int xor_) -{ -} - -#define PEX(x,w) if (box.X1 > (x)-(w)) box.X1 = (x)-(w); \ - if (box.X2 < (x)+(w)) box.X2 = (x)+(w) -#define PEY(y,w) if (box.Y1 > (y)-(w)) box.Y1 = (y)-(w); \ - if (box.Y2 < (y)+(w)) box.Y2 = (y)+(w) - -static void extents_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - PEX(x1, gc->width); - PEY(y1, gc->width); - PEX(x2, gc->width); - PEY(y2, gc->width); -} - -static void extents_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle end_angle) -{ - /* Naive but good enough. */ - PEX(cx, width + gc->width); - PEY(cy, height + gc->width); -} - -static void extents_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - PEX(x1, gc->width); - PEY(y1, gc->width); - PEX(x2, gc->width); - PEY(y2, gc->width); -} - -static void extents_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) -{ - PEX(cx, radius); - PEY(cy, radius); -} - -static void extents_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) -{ - int i; - for (i = 0; i < n_coords; i++) { - PEX(x[i], 0); - PEY(y[i], 0); - } -} - -static void extents_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - PEX(x1, 0); - PEY(y1, 0); - PEX(x2, 0); - PEY(y2, 0); -} - -static HID extents_hid; - -void hid_extents_init(void) -{ - static pcb_bool initialised = pcb_false; - - if (initialised) - return; - - memset(&extents_hid, 0, sizeof(HID)); - - common_draw_helpers_init(&extents_hid); - - extents_hid.struct_size = sizeof(HID); - extents_hid.name = "extents-extents"; - extents_hid.description = "used to calculate extents"; - extents_hid.poly_before = 1; - - extents_hid.set_layer = extents_set_layer; - extents_hid.make_gc = extents_make_gc; - extents_hid.destroy_gc = extents_destroy_gc; - extents_hid.use_mask = extents_use_mask; - extents_hid.set_color = extents_set_color; - extents_hid.set_line_cap = extents_set_line_cap; - extents_hid.set_line_width = extents_set_line_width; - extents_hid.set_draw_xor = extents_set_draw_xor; - extents_hid.draw_line = extents_draw_line; - extents_hid.draw_arc = extents_draw_arc; - extents_hid.draw_rect = extents_draw_rect; - extents_hid.fill_circle = extents_fill_circle; - extents_hid.fill_polygon = extents_fill_polygon; - extents_hid.fill_rect = extents_fill_rect; - - initialised = pcb_true; -} - -BoxType *hid_get_extents(void *item) -{ - BoxType region; - - /* As this isn't a real "HID", we need to ensure we are initialised. */ - hid_extents_init(); - - box.X1 = MAXINT; - box.Y1 = MAXINT; - box.X2 = -MAXINT; - box.Y2 = -MAXINT; - - region.X1 = -MAXINT; - region.Y1 = -MAXINT; - region.X2 = MAXINT; - region.Y2 = MAXINT; - hid_expose_callback(&extents_hid, ®ion, item); - - return &box; -} Index: 1.1.4/src/route_style.c =================================================================== --- 1.1.4/src/route_style.c (revision 10776) +++ 1.1.4/src/route_style.c (nonexistent) @@ -1,183 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2004,2006 Thomas Nau - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ -#include "config.h" -#include "global.h" -#include "pcb-printf.h" -#include "genvector/gds_char.h" -#include "route_style.h" -#include "misc.h" -#include "error.h" -#include "conf.h" - -RouteStyleType pcb_custom_route_style; - -/*! \brief Serializes the route style list - * \par Function Description - * Right now n_styles should always be set to NUM_STYLES, - * since that is the number of route styles ParseRouteString() - * expects to parse. - */ -char *make_route_string(vtroutestyle_t *styles) -{ - gds_t str; - int i; - - gds_init(&str); - for (i = 0; i < vtroutestyle_len(styles); ++i) { - pcb_append_printf(&str, "%s,%mc,%mc,%mc,%mc", styles->array[i].name, - styles->array[i].Thick, styles->array[i].Diameter, - styles->array[i].Hole, styles->array[i].Clearance); - if (i > 0) - gds_append(&str, ':'); - } - return str.array; /* this is the only allocation made, return this and don't uninit */ -} - -/* ---------------------------------------------------------------------- - * parses the routes definition string which is a colon separated list of - * comma separated Name, Dimension, Dimension, Dimension, Dimension - * e.g. Signal,20,40,20,10:Power,40,60,28,10:... - */ -int ParseRoutingString1(char **str, RouteStyleTypePtr routeStyle, const char *default_unit) -{ - char *s = *str; - char Name[256]; - int i, len; - - while (*s && isspace((int) *s)) - s++; - for (i = 0; *s && *s != ','; i++) - Name[i] = *s++; - Name[i] = '\0'; - len = strlen(Name); - if (len > sizeof(routeStyle->name)-1) { - memcpy(routeStyle->name, Name, sizeof(routeStyle->name)-1); - routeStyle->name[sizeof(routeStyle->name)-1] = '\0'; - Message(PCB_MSG_DEFAULT, "Route style name '%s' too long, truncated to '%s'\n", Name, routeStyle->name); - } - else - strcpy(routeStyle->name, Name); - if (!isdigit((int) *++s)) - goto error; - routeStyle->Thick = GetNum(&s, default_unit); - while (*s && isspace((int) *s)) - s++; - if (*s++ != ',') - goto error; - while (*s && isspace((int) *s)) - s++; - if (!isdigit((int) *s)) - goto error; - routeStyle->Diameter = GetNum(&s, default_unit); - while (*s && isspace((int) *s)) - s++; - if (*s++ != ',') - goto error; - while (*s && isspace((int) *s)) - s++; - if (!isdigit((int) *s)) - goto error; - routeStyle->Hole = GetNum(&s, default_unit); - /* for backwards-compatibility, we use a 10-mil default - * for styles which omit the clearance specification. */ - if (*s != ',') - routeStyle->Clearance = PCB_MIL_TO_COORD(10); - else { - s++; - while (*s && isspace((int) *s)) - s++; - if (!isdigit((int) *s)) - goto error; - routeStyle->Clearance = GetNum(&s, default_unit); - while (*s && isspace((int) *s)) - s++; - } - - *str = s; - return 0; - error:; - *str = s; - return -1; -} - -int ParseRouteString(char *s, vtroutestyle_t *styles, const char *default_unit) -{ - int n; - - vtroutestyle_truncate(styles, 0); - for(n = 0;;n++) { - vtroutestyle_enlarge(styles, n+1); - if (ParseRoutingString1(&s, &styles->array[n], default_unit) != 0) { - n--; - break; - } - while (*s && isspace((int) *s)) - s++; - if (*s == '\0') - break; - if (*s++ != ':') { - vtroutestyle_truncate(styles, 0); - return -1; - } - } - vtroutestyle_truncate(styles, n+1); - return 0; -} - -void pcb_use_route_style(RouteStyleType * rst) -{ - conf_set_design("design/line_thickness", "%$mS", rst->Thick); - conf_set_design("design/via_thickness", "%$mS", rst->Diameter); - conf_set_design("design/via_drilling_hole", "%$mS", rst->Hole); - conf_set_design("design/clearance", "%$mS", rst->Clearance); -} - -int pcb_use_route_style_idx(vtroutestyle_t *styles, int idx) -{ - if ((idx < 0) || (idx >= vtroutestyle_len(styles))) - return -1; - pcb_use_route_style(styles->array+idx); - return 0; -} - -#define cmp(a,b) (((a) != 0) && (coord_abs((a)-(b)) > 32)) -#define cmps(a,b) (((a) != NULL) && (strcmp((a), (b)) != 0)) -int pcb_route_style_lookup(vtroutestyle_t *styles, Coord Thick, Coord Diameter, Coord Hole, Coord Clearance, char *Name) -{ - int n; - for (n = 0; n < vtroutestyle_len(styles); n++) { - if (cmp(Thick, styles->array[n].Thick)) continue; - if (cmp(Diameter, styles->array[n].Diameter)) continue; - if (cmp(Hole, styles->array[n].Hole)) continue; - if (cmp(Clearance, styles->array[n].Clearance)) continue; - if (cmps(Name, styles->array[n].name)) continue; - return n; - } - return -1; -} -#undef cmp - Index: 1.1.4/src/unit.c =================================================================== --- 1.1.4/src/unit.c (revision 10776) +++ 1.1.4/src/unit.c (nonexistent) @@ -1,281 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2011 Andrew Poelstra - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Andrew Poelstra, 16966 60A Ave, V3S 8X5 Surrey, BC, Canada - * asp11@sfu.ca - * - */ -#include "config.h" -#include -#include -#include "global.h" -#include "compat_misc.h" -#include "unit.h" - -/* Helper macros for tables */ -#define PCB_MM_TO_COORD3(a,b,c) PCB_MM_TO_COORD (a), PCB_MM_TO_COORD (b), PCB_MM_TO_COORD (c) -#define PCB_MIL_TO_COORD3(a,b,c) PCB_MIL_TO_COORD (a), PCB_MIL_TO_COORD (b), PCB_MIL_TO_COORD (c) -#define PCB_MM_TO_COORD5(a,b,c,d,e) PCB_MM_TO_COORD (a), PCB_MM_TO_COORD (b), PCB_MM_TO_COORD (c), \ - PCB_MM_TO_COORD (d), PCB_MM_TO_COORD (e) -#define PCB_MIL_TO_COORD5(a,b,c,d,e) PCB_MIL_TO_COORD (a), PCB_MIL_TO_COORD (b), PCB_MIL_TO_COORD (c), \ - PCB_MIL_TO_COORD (d), PCB_MIL_TO_COORD (e) - -/* These should be kept in order of smallest scale_factor - * to largest -- the code uses this ordering when finding - * the best scale to use for a group of measures */ -Unit Units[] = { - {0, "km", NULL, 'k', 0.000001, METRIC, ALLOW_KM, 5, - 0.00005, 0.0005, 0.0025, 0.05, 0.25, - {""}}, - {0, "m", NULL, 'f', 0.001, METRIC, ALLOW_M, 5, - 0.0005, 0.005, 0.025, 0.5, 2.5, - {""}}, - {0, "cm", NULL, 'e', 0.1, METRIC, ALLOW_CM, 5, - 0.005, 0.05, 0.25, 5, 25, - {""}}, - {0, "mm", NULL, 'm', 1, METRIC, ALLOW_MM, 4, - 0.005, 0.05, 0.25, 5, 25, - {""}}, - {0, "um", NULL, 'u', 1000, METRIC, ALLOW_UM, 2, - 0.005, 0.05, 0.25, 5, 25, - {""}}, - {0, "nm", NULL, 'n', 1000000, METRIC, ALLOW_NM, 0, - 5, 50, 2500, 5000, 25000, - {""}}, - - {0, "in", NULL, 'i', 0.001, IMPERIAL, ALLOW_IN, 5, - 0.1, 1.0, 5.0, 25, 100, - {"inch"}}, - {0, "mil", NULL, 'l', 1, IMPERIAL, ALLOW_MIL, 2, - 0.1, 1.0, 10, 100, 1000, - {""}}, - {0, "dmil", NULL, 'k', 10, IMPERIAL, ALLOW_DMIL, 1, /* kicad legacy decimil unit */ - 0.1, 1.0, 10, 100, 1000, /* wild guess at factors */ - {""}}, - {0, "cmil", NULL, 'c', 100, IMPERIAL, ALLOW_CMIL, 0, - 1, 10, 100, 1000, 10000, - {"pcb"}} -}; - -#define N_UNITS ((int) (sizeof Units / sizeof Units[0])) -/* \brief Initialize non-static data for pcb-printf - * \par Function Description - * Assigns each unit its index for quick access through the - * main units array, and internationalize the units for GUI - * display. - */ -void initialize_units() -{ - int i; - for (i = 0; i < N_UNITS; ++i) { - Units[i].index = i; - Units[i].in_suffix = _(Units[i].suffix); - } -} - -/* This list -must- contain all printable units from the above list */ -/* For now I have just copy/pasted the same values for all metric - * units and the same values for all imperial ones */ -Increments increments[] = { - /* TABLE FORMAT | default | min | max - * grid | | | - * size | | | - * line | | | - * clear | | | - */ - {"km", PCB_MM_TO_COORD3(0.1, 0.01, 1.0), - PCB_MM_TO_COORD3(0.2, 0.01, 0.5), - PCB_MM_TO_COORD3(0.1, 0.005, 0.5), - PCB_MM_TO_COORD3(0.05, 0.005, 0.5)}, - {"m", PCB_MM_TO_COORD3(0.1, 0.01, 1.0), - PCB_MM_TO_COORD3(0.2, 0.01, 0.5), - PCB_MM_TO_COORD3(0.1, 0.005, 0.5), - PCB_MM_TO_COORD3(0.05, 0.005, 0.5)}, - {"cm", PCB_MM_TO_COORD3(0.1, 0.01, 1.0), - PCB_MM_TO_COORD3(0.2, 0.01, 0.5), - PCB_MM_TO_COORD3(0.1, 0.005, 0.5), - PCB_MM_TO_COORD3(0.05, 0.005, 0.5)}, - {"mm", PCB_MM_TO_COORD3(0.1, 0.01, 1.0), - PCB_MM_TO_COORD3(0.2, 0.01, 0.5), - PCB_MM_TO_COORD3(0.1, 0.005, 0.5), - PCB_MM_TO_COORD3(0.05, 0.005, 0.5)}, - {"um", PCB_MM_TO_COORD3(0.1, 0.01, 1.0), - PCB_MM_TO_COORD3(0.2, 0.01, 0.5), - PCB_MM_TO_COORD3(0.1, 0.005, 0.5), - PCB_MM_TO_COORD3(0.05, 0.005, 0.5)}, - {"nm", PCB_MM_TO_COORD3(0.1, 0.01, 1.0), - PCB_MM_TO_COORD3(0.2, 0.01, 0.5), - PCB_MM_TO_COORD3(0.1, 0.005, 0.5), - PCB_MM_TO_COORD3(0.05, 0.005, 0.5)}, - - {"cmil", PCB_MIL_TO_COORD3(5, 1, 25), - PCB_MIL_TO_COORD3(10, 1, 10), - PCB_MIL_TO_COORD3(5, 0.5, 10), - PCB_MIL_TO_COORD3(2, 0.5, 10)}, - {"dmil", PCB_MIL_TO_COORD3(5, 1, 25), /* kicad legacy decimil unit */ - PCB_MIL_TO_COORD3(10, 1, 10), - PCB_MIL_TO_COORD3(5, 0.5, 10), - PCB_MIL_TO_COORD3(2, 0.5, 10)}, - {"mil", PCB_MIL_TO_COORD3(5, 1, 25), - PCB_MIL_TO_COORD3(10, 1, 10), - PCB_MIL_TO_COORD3(5, 0.5, 10), - PCB_MIL_TO_COORD3(2, 0.5, 10)}, - {"in", PCB_MIL_TO_COORD3(5, 1, 25), - PCB_MIL_TO_COORD3(10, 1, 10), - PCB_MIL_TO_COORD3(5, 0.5, 10), - PCB_MIL_TO_COORD3(2, 0.5, 10)}, -}; - -#define N_INCREMENTS (sizeof increments / sizeof increments[0]) - -/* \brief Obtain a unit object from its suffix - * \par Function Description - * Looks up a given suffix in the main units array. Internationalized - * unit suffixes are not supported, though pluralized units are, for - * backward-compatibility. - * - * \param [in] const_suffix The suffix to look up - * - * \return A const pointer to the Unit struct, or NULL if none was found - */ -const Unit *get_unit_struct(const char *suffix) -{ - int i; - int s_len = 0; - - /* Determine bounds */ - while (isspace(*suffix)) - suffix++; - while (isalnum(suffix[s_len])) - s_len++; - - /* Also understand plural suffixes: "inches", "mils" */ - if (s_len > 2) { - if (suffix[s_len - 2] == 'e' && suffix[s_len - 1] == 's') - s_len -= 2; - else if (suffix[s_len - 1] == 's') - s_len -= 1; - } - - /* Do lookup */ - if (s_len > 0) - for (i = 0; i < N_UNITS; ++i) - if (strncmp(suffix, Units[i].suffix, s_len) == 0 || strncmp(suffix, Units[i].alias[0], s_len) == 0) - return &Units[i]; - - return NULL; -} - -const Unit *get_unit_struct_by_allow(enum e_allow allow) -{ - int i; - for (i = 0; i < N_UNITS; ++i) - if (Units[i].allow == allow) - return &Units[i]; - - return NULL; -} - -/* ACCESSORS */ -/* \brief Returns the master unit list. This may not be modified. */ -const Unit *get_unit_list(void) -{ - return Units; -} - -/* \brief Returns the unit by its index */ -const Unit *get_unit_by_idx(int idx) -{ - if ((idx < 0) || (idx >= N_UNITS)) - return NULL; - return Units + idx; -} - -/* \brief Returns the length of the master unit list. */ -int get_n_units(void) -{ - return N_UNITS; -} - -/* \brief Convert a pcb coord to the given unit - * - * \param [in] unit The unit to convert to - * \param [in] x The quantity to convert - * - * \return The converted measure - */ -double coord_to_unit(const Unit * unit, Coord x) -{ - double base; - if (unit == NULL) - return -1; - base = unit->family == METRIC ? PCB_COORD_TO_MM(1) - : PCB_COORD_TO_MIL(1); - return x * unit->scale_factor * base; -} - -/* \brief Convert a given unit to pcb coords - * - * \param [in] unit The unit to convert from - * \param [in] x The quantity to convert - * - * \return The converted measure - */ -Coord unit_to_coord(const Unit * unit, double x) -{ - double base; - if (unit == NULL) - return -1; - base = unit->family == METRIC ? PCB_MM_TO_COORD(x) - : PCB_MIL_TO_COORD(x); - return pcb_round(base/unit->scale_factor); -} - -/* \brief Return how many PCB-internal-Coord-unit a unit translates to - * - * \param [in] unit The unit to convert - * - * \return The converted measure - */ -double unit_to_factor(const Unit * unit) -{ - return 1.0 / coord_to_unit(unit, 1); -} - -/* \brief Obtain an increment object from its suffix - * \par Function Description - * Looks up a given suffix in the main increments array. Internationalized - * unit suffixes are not supported, nor are pluralized units. - * - * \param [in] suffix The suffix to look up - * - * \return A const pointer to the Increments struct, or NULL if none was found - */ -Increments *get_increments_struct(const char *suffix) -{ - int i; - /* Do lookup */ - for (i = 0; i < N_INCREMENTS; ++i) - if (strcmp(suffix, increments[i].suffix) == 0) - return &increments[i]; - return NULL; -} Index: 1.1.4/src/vtptr.c =================================================================== --- 1.1.4/src/vtptr.c (revision 10776) +++ 1.1.4/src/vtptr.c (nonexistent) @@ -1,3 +0,0 @@ -#define GVT_DONT_UNDEF -#include "vtptr.h" -#include Index: 1.1.4/src/rtree.c =================================================================== --- 1.1.4/src/rtree.c (revision 10776) +++ 1.1.4/src/rtree.c (nonexistent) @@ -1,999 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001,2002,2003,2004 harry eaton - * - * this file, rtree.c, was written and is - * Copyright (c) 2004, harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* implements r-tree structures. - * these should be much faster for the auto-router - * because the recursive search is much more efficient - * and that's where the auto-router spends all its time. - */ -#include "config.h" - -#include -#include - -#include "rtree.h" - -#define SLOW_ASSERTS -/* All rectangles are closed on the bottom left and open on the - * top right. i.e. they contain one corner point, but not the other. - * This requires that the corner points not be equal! - */ - -/* the number of entries in each rtree node - * 4 - 7 seem to be pretty good settings - */ -#define M_SIZE 6 - -/* it seems that sorting the leaf order slows us down - * but sometimes gives better routes - */ -#undef SORT -#define SORT_NONLEAF - -#define DELETE_BY_POINTER - -typedef struct { - const BoxType *bptr; /* pointer to the box */ - BoxType bounds; /* copy of the box for locality of reference */ -} Rentry; - -struct rtree_node { - BoxType box; /* bounds rectangle of this node */ - struct rtree_node *parent; /* parent of this node, NULL = root */ - struct { - unsigned is_leaf:1; /* this is a leaf node */ - unsigned manage:31; /* pcb_true==should free 'rect.bptr' if node is destroyed */ - } flags; - union { - struct rtree_node *kids[M_SIZE + 1]; /* when not leaf */ - Rentry rects[M_SIZE + 1]; /* when leaf */ - } u; -}; - -#ifndef NDEBUG -#ifdef SLOW_ASSERTS -static int __r_node_is_good(struct rtree_node *node) -{ - int i, flag = 1; - int kind = -1; - pcb_bool last = pcb_false; - - if (node == NULL) - return 1; - for (i = 0; i < M_SIZE; i++) { - if (node->flags.is_leaf) { - if (!node->u.rects[i].bptr) { - last = pcb_true; - continue; - } - /* check that once one entry is empty, all the rest are too */ - if (node->u.rects[i].bptr && last) - assert(0); - /* check that the box makes sense */ - if (node->box.X1 > node->box.X2) - assert(0); - if (node->box.Y1 > node->box.Y2) - assert(0); - /* check that bounds is the same as the pointer */ - if (node->u.rects[i].bounds.X1 != node->u.rects[i].bptr->X1) - assert(0); - if (node->u.rects[i].bounds.Y1 != node->u.rects[i].bptr->Y1) - assert(0); - if (node->u.rects[i].bounds.X2 != node->u.rects[i].bptr->X2) - assert(0); - if (node->u.rects[i].bounds.Y2 != node->u.rects[i].bptr->Y2) - assert(0); - /* check that entries are within node bounds */ - if (node->u.rects[i].bounds.X1 < node->box.X1) - assert(0); - if (node->u.rects[i].bounds.X2 > node->box.X2) - assert(0); - if (node->u.rects[i].bounds.Y1 < node->box.Y1) - assert(0); - if (node->u.rects[i].bounds.Y2 > node->box.Y2) - assert(0); - } - else { - if (!node->u.kids[i]) { - last = pcb_true; - continue; - } - /* make sure all children are the same type */ - if (kind == -1) - kind = node->u.kids[i]->flags.is_leaf; - else if (kind != node->u.kids[i]->flags.is_leaf) - assert(0); - /* check that once one entry is empty, all the rest are too */ - if (node->u.kids[i] && last) - assert(0); - /* check that entries are within node bounds */ - if (node->u.kids[i]->box.X1 < node->box.X1) - assert(0); - if (node->u.kids[i]->box.X2 > node->box.X2) - assert(0); - if (node->u.kids[i]->box.Y1 < node->box.Y1) - assert(0); - if (node->u.kids[i]->box.Y2 > node->box.Y2) - assert(0); - } - flag <<= 1; - } - /* check that we're completely in the parent's bounds */ - if (node->parent) { - if (node->parent->box.X1 > node->box.X1) - assert(0); - if (node->parent->box.X2 < node->box.X2) - assert(0); - if (node->parent->box.Y1 > node->box.Y1) - assert(0); - if (node->parent->box.Y2 < node->box.Y2) - assert(0); - } - /* make sure overflow is empty */ - if (!node->flags.is_leaf && node->u.kids[i]) - assert(0); - if (node->flags.is_leaf && node->u.rects[i].bptr) - assert(0); - return 1; -} - -/* check the whole tree from this node down for consistency */ -static pcb_bool __r_tree_is_good(struct rtree_node *node) -{ - int i; - - if (!node) - return 1; - if (!__r_node_is_good(node)) - assert(0); - if (node->flags.is_leaf) - return 1; - for (i = 0; i < M_SIZE; i++) { - if (!__r_tree_is_good(node->u.kids[i])) - return 0; - } - return 1; -} -#endif -#endif - -#ifndef NDEBUG -/* print out the tree */ -void __r_dump_tree(struct rtree_node *node, int depth) -{ - int i, j; - static int count; - static double area; - - if (depth == 0) { - area = 0; - count = 0; - } - area += (node->box.X2 - node->box.X1) * (double) (node->box.Y2 - node->box.Y1); - count++; - for (i = 0; i < depth; i++) - printf(" "); - if (!node->flags.is_leaf) { - printf("p=0x%p node X(%d, %d) Y(%d, %d)\n", (void *) node, node->box.X1, node->box.X2, node->box.Y1, node->box.Y2); - } - else { - printf("p=0x%p leaf manage(%02x) X(%d, %d) Y(%d, %d)\n", (void *) node, - node->flags.manage, node->box.X1, node->box.X2, node->box.Y1, node->box.Y2); - for (j = 0; j < M_SIZE; j++) { - if (!node->u.rects[j].bptr) - break; - area += - (node->u.rects[j].bounds.X2 - - node->u.rects[j].bounds.X1) * (double) (node->u.rects[j].bounds.Y2 - node->u.rects[j].bounds.Y1); - count++; - for (i = 0; i < depth + 1; i++) - printf(" "); - printf("entry 0x%p X(%d, %d) Y(%d, %d)\n", - (void *) (node->u.rects[j].bptr), - node->u.rects[j].bounds.X1, node->u.rects[j].bounds.X2, node->u.rects[j].bounds.Y1, node->u.rects[j].bounds.Y2); - } - return; - } - for (i = 0; i < M_SIZE; i++) - if (node->u.kids[i]) - __r_dump_tree(node->u.kids[i], depth + 1); - if (depth == 0) - printf("average box area is %g\n", area / count); -} -#endif - -/* Sort the children or entries of a node - * according to the largest side. - */ -#ifdef SORT -static int cmp_box(const BoxType * a, const BoxType * b) -{ - /* compare two box coordinates so that the __r_search - * will fail at the earliest comparison possible. - * It needs to see the biggest X1 first, then the - * smallest X2, the biggest Y1 and smallest Y2 - */ - if (a->X1 < b->X1) - return 0; - if (a->X1 > b->X1) - return 1; - if (a->X2 > b->X2) - return 0; - if (a->X2 < b->X2) - return 1; - if (a->Y1 < b->Y1) - return 0; - if (a->Y1 > b->Y1) - return 1; - if (a->Y2 > b->Y2) - return 0; - return 1; -} - -static void sort_node(struct rtree_node *node) -{ - if (node->flags.is_leaf) { - register Rentry *r, *i, temp; - - for (r = &node->u.rects[1]; r->bptr; r++) { - temp = *r; - i = r - 1; - while (i >= &node->u.rects[0]) { - if (cmp_box(&i->bounds, &r->bounds)) - break; - *(i + 1) = *i; - i--; - } - *(i + 1) = temp; - } - } -#ifdef SORT_NONLEAF - else { - register struct rtree_node **r, **i, *temp; - - for (r = &node->u.kids[1]; *r; r++) { - temp = *r; - i = r - 1; - while (i >= &node->u.kids[0]) { - if (cmp_box(&(*i)->box, &(*r)->box)) - break; - *(i + 1) = *i; - i--; - } - *(i + 1) = temp; - } - } -#endif -} -#else -#define sort_node(x) -#endif - -/* set the node bounds large enough to encompass all - * of the children's rectangles - */ -static void adjust_bounds(struct rtree_node *node) -{ - int i; - - assert(node); - assert(node->u.kids[0]); - if (node->flags.is_leaf) { - node->box = node->u.rects[0].bounds; - for (i = 1; i < M_SIZE + 1; i++) { - if (!node->u.rects[i].bptr) - return; - MAKEMIN(node->box.X1, node->u.rects[i].bounds.X1); - MAKEMAX(node->box.X2, node->u.rects[i].bounds.X2); - MAKEMIN(node->box.Y1, node->u.rects[i].bounds.Y1); - MAKEMAX(node->box.Y2, node->u.rects[i].bounds.Y2); - } - } - else { - node->box = node->u.kids[0]->box; - for (i = 1; i < M_SIZE + 1; i++) { - if (!node->u.kids[i]) - return; - MAKEMIN(node->box.X1, node->u.kids[i]->box.X1); - MAKEMAX(node->box.X2, node->u.kids[i]->box.X2); - MAKEMIN(node->box.Y1, node->u.kids[i]->box.Y1); - MAKEMAX(node->box.Y2, node->u.kids[i]->box.Y2); - } - } -} - -/* create an r-tree from an unsorted list of boxes. - * the r-tree will keep pointers into - * it, so don't free the box list until you've called r_destroy_tree. - * if you set 'manage' to pcb_true, r_destroy_tree will free your boxlist. - */ -rtree_t *r_create_tree(const BoxType * boxlist[], int N, int manage) -{ - rtree_t *rtree; - struct rtree_node *node; - int i; - - assert(N >= 0); - rtree = (rtree_t *) calloc(1, sizeof(*rtree)); - /* start with a single empty leaf node */ - node = (struct rtree_node *) calloc(1, sizeof(*node)); - node->flags.is_leaf = 1; - node->parent = NULL; - rtree->root = node; - /* simple, just insert all of the boxes! */ - for (i = 0; i < N; i++) { - assert(boxlist[i]); - r_insert_entry(rtree, boxlist[i], manage); - } -#ifdef SLOW_ASSERTS - assert(__r_tree_is_good(rtree->root)); -#endif - return rtree; -} - -static void __r_destroy_tree(struct rtree_node *node) -{ - int i, flag = 1; - - if (node->flags.is_leaf) - for (i = 0; i < M_SIZE; i++) { - if (!node->u.rects[i].bptr) - break; - if (node->flags.manage & flag) - free((void *) node->u.rects[i].bptr); - flag = flag << 1; - } - else - for (i = 0; i < M_SIZE; i++) { - if (!node->u.kids[i]) - break; - __r_destroy_tree(node->u.kids[i]); - } - free(node); -} - -/* free the memory associated with an rtree. */ -void r_destroy_tree(rtree_t ** rtree) -{ - - __r_destroy_tree((*rtree)->root); - free(*rtree); - *rtree = NULL; -} - -typedef struct { - r_dir_t (*check_it) (const BoxType * region, void *cl); - r_dir_t (*found_it) (const BoxType * box, void *cl); - void *closure; - int cancel; -} r_arg; - -/* most of the auto-routing time is spent in this routine - * so some careful thought has been given to maximizing the speed - * - */ -int __r_search(struct rtree_node *node, const BoxType * query, r_arg * arg) -{ - r_dir_t res; - - assert(node); - /** assert that starting_region is well formed */ - assert(query->X1 < query->X2 && query->Y1 < query->Y2); - assert(node->box.X1 < query->X2 && node->box.X2 > query->X1 && node->box.Y1 < query->Y2 && node->box.Y2 > query->Y1); -#ifdef SLOW_ASSERTS - /** assert that node is well formed */ - assert(__r_node_is_good(node)); -#endif - /* the check for bounds is done before entry. This saves the overhead - * of building/destroying the stack frame for each bounds that fails - * to intersect, which is the most common condition. - */ - if (node->flags.is_leaf) { - register int i; - if (arg->found_it) { /* test this once outside of loop */ - register int seen = 0; - for (i = 0; node->u.rects[i].bptr; i++) { - if ((node->u.rects[i].bounds.X1 < query->X2) && - (node->u.rects[i].bounds.X2 > query->X1) && - (node->u.rects[i].bounds.Y1 < query->Y2) && - (node->u.rects[i].bounds.Y2 > query->Y1)) { - res = arg->found_it(node->u.rects[i].bptr, arg->closure); - if (res == R_DIR_CANCEL) { - arg->cancel = 1; - return seen; - } - if (res != R_DIR_NOT_FOUND) - seen++; - } - } - return seen; - } - else { - register int seen = 0; - for (i = 0; node->u.rects[i].bptr; i++) { - if ((node->u.rects[i].bounds.X1 < query->X2) && - (node->u.rects[i].bounds.X2 > query->X1) && - (node->u.rects[i].bounds.Y1 < query->Y2) && (node->u.rects[i].bounds.Y2 > query->Y1)) - seen++; - } - return seen; - } - } - - /* not a leaf, recurse on lower nodes */ - if (arg->check_it != NULL) { - int seen = 0; - struct rtree_node **n; - for (n = &node->u.kids[0]; *n; n++) { - if ((*n)->box.X1 >= query->X2 || - (*n)->box.X2 <= query->X1 || - (*n)->box.Y1 >= query->Y2 || (*n)->box.Y2 <= query->Y1) - continue; - res = arg->check_it(&(*n)->box, arg->closure); - if (res == R_DIR_CANCEL) { - arg->cancel = 1; - return seen; - } - if (!res) - continue; - seen += __r_search(*n, query, arg); - if (arg->cancel) - break; - } - return seen; - } - else { - int seen = 0; - struct rtree_node **n; - for (n = &node->u.kids[0]; *n; n++) { - if ((*n)->box.X1 >= query->X2 || (*n)->box.X2 <= query->X1 || (*n)->box.Y1 >= query->Y2 || (*n)->box.Y2 <= query->Y1) - continue; - seen += __r_search(*n, query, arg); - if (arg->cancel) - break; - } - return seen; - } -} - -/* Parameterized search in the rtree. - * Sets num_found to the number of rectangles found. - * calls found_rectangle for each intersection seen - * and calls check_region with the current sub-region - * to see whether deeper searching is desired - * Returns how the search ended. - */ -r_dir_t -r_search(rtree_t * rtree, const BoxType * query, - r_dir_t (*check_region) (const BoxType * region, void *cl), - r_dir_t (*found_rectangle) (const BoxType * box, void *cl), void *cl, - int *num_found) -{ - r_arg arg; - int res = 0; - - arg.cancel = 0; - - if (!rtree || rtree->size < 1) - goto ret; - if (query) { -#ifdef SLOW_ASSERTS - assert(__r_tree_is_good(rtree->root)); -#endif -#ifdef DEBUG - if (query->X2 <= query->X1 || query->Y2 <= query->Y1) - goto ret; -#endif - /* check this box. If it's not touched we're done here */ - if (rtree->root->box.X1 >= query->X2 || - rtree->root->box.X2 <= query->X1 || rtree->root->box.Y1 >= query->Y2 || rtree->root->box.Y2 <= query->Y1) - goto ret; - arg.check_it = check_region; - arg.found_it = found_rectangle; - arg.closure = cl; - - res = __r_search(rtree->root, query, &arg); - } - else { - arg.check_it = check_region; - arg.found_it = found_rectangle; - arg.closure = cl; - res = __r_search(rtree->root, &rtree->root->box, &arg); - } - -ret:; - if (num_found != NULL) - *num_found = res; - if (arg.cancel) - return R_DIR_CANCEL; - if (res == 0) - return R_DIR_NOT_FOUND; - return R_DIR_FOUND_CONTINUE; -} - -/*------ r_region_is_empty ------*/ -static r_dir_t __r_region_is_empty_rect_in_reg(const BoxType * box, void *cl) -{ - jmp_buf *envp = (jmp_buf *) cl; - longjmp(*envp, 1); /* found one! */ -} - -/* return 0 if there are any rectangles in the given region. */ -int r_region_is_empty(rtree_t * rtree, const BoxType * region) -{ - jmp_buf env; - int r; - - if (setjmp(env)) - return 0; - r_search(rtree, region, NULL, __r_region_is_empty_rect_in_reg, &env, &r); - assert(r == 0); /* otherwise longjmp would have been called */ - return 1; /* no rectangles found */ -} - -struct centroid { - float x, y, area; -}; - -/* split the node into two nodes putting clusters in each - * use the k-means clustering algorithm - */ -struct rtree_node *find_clusters(struct rtree_node *node) -{ - float total_a, total_b; - float a_X, a_Y, b_X, b_Y; - pcb_bool belong[M_SIZE + 1]; - struct centroid center[M_SIZE + 1]; - int clust_a, clust_b, tries; - int a_manage = 0, b_manage = 0; - int i, old_ax, old_ay, old_bx, old_by; - struct rtree_node *new_node; - BoxType *b; - - for (i = 0; i < M_SIZE + 1; i++) { - if (node->flags.is_leaf) - b = &(node->u.rects[i].bounds); - else - b = &(node->u.kids[i]->box); - center[i].x = 0.5 * (b->X1 + b->X2); - center[i].y = 0.5 * (b->Y1 + b->Y2); - /* adding 1 prevents zero area */ - center[i].area = 1. + (float) (b->X2 - b->X1) * (float) (b->Y2 - b->Y1); - } - /* starting 'A' cluster center */ - a_X = center[0].x; - a_Y = center[0].y; - /* starting 'B' cluster center */ - b_X = center[M_SIZE].x; - b_Y = center[M_SIZE].y; - /* don't allow the same cluster centers */ - if (b_X == a_X && b_Y == a_Y) { - b_X += 10000; - a_Y -= 10000; - } - for (tries = 0; tries < M_SIZE; tries++) { - old_ax = (int) a_X; - old_ay = (int) a_Y; - old_bx = (int) b_X; - old_by = (int) b_Y; - clust_a = clust_b = 0; - for (i = 0; i < M_SIZE + 1; i++) { - float dist1, dist2; - - dist1 = SQUARE(a_X - center[i].x) + SQUARE(a_Y - center[i].y); - dist2 = SQUARE(b_X - center[i].x) + SQUARE(b_Y - center[i].y); - if (dist1 * (clust_a + M_SIZE / 2) < dist2 * (clust_b + M_SIZE / 2)) { - belong[i] = pcb_true; - clust_a++; - } - else { - belong[i] = pcb_false; - clust_b++; - } - } - /* kludge to fix degenerate cases */ - if (clust_a == M_SIZE + 1) - belong[M_SIZE / 2] = pcb_false; - else if (clust_b == M_SIZE + 1) - belong[M_SIZE / 2] = pcb_true; - /* compute new center of gravity of clusters */ - total_a = total_b = 0; - a_X = a_Y = b_X = b_Y = 0; - for (i = 0; i < M_SIZE + 1; i++) { - if (belong[i]) { - a_X += center[i].x * center[i].area; - a_Y += center[i].y * center[i].area; - total_a += center[i].area; - } - else { - b_X += center[i].x * center[i].area; - b_Y += center[i].y * center[i].area; - total_b += center[i].area; - } - } - a_X /= total_a; - a_Y /= total_a; - b_X /= total_b; - b_Y /= total_b; - if (old_ax == (int) a_X && old_ay == (int) a_Y && old_bx == (int) b_X && old_by == (int) b_Y) - break; - } - /* Now 'belong' has the partition map */ - new_node = (struct rtree_node *) calloc(1, sizeof(*new_node)); - new_node->parent = node->parent; - new_node->flags.is_leaf = node->flags.is_leaf; - clust_a = clust_b = 0; - if (node->flags.is_leaf) { - int flag, a_flag, b_flag; - flag = a_flag = b_flag = 1; - for (i = 0; i < M_SIZE + 1; i++) { - if (belong[i]) { - node->u.rects[clust_a++] = node->u.rects[i]; - if (node->flags.manage & flag) - a_manage |= a_flag; - a_flag <<= 1; - } - else { - new_node->u.rects[clust_b++] = node->u.rects[i]; - if (node->flags.manage & flag) - b_manage |= b_flag; - b_flag <<= 1; - } - flag <<= 1; - } - } - else { - for (i = 0; i < M_SIZE + 1; i++) { - if (belong[i]) - node->u.kids[clust_a++] = node->u.kids[i]; - else { - node->u.kids[i]->parent = new_node; - new_node->u.kids[clust_b++] = node->u.kids[i]; - } - } - } - node->flags.manage = a_manage; - new_node->flags.manage = b_manage; - assert(clust_a != 0); - assert(clust_b != 0); - if (node->flags.is_leaf) - for (; clust_a < M_SIZE + 1; clust_a++) - node->u.rects[clust_a].bptr = NULL; - else - for (; clust_a < M_SIZE + 1; clust_a++) - node->u.kids[clust_a] = NULL; - adjust_bounds(node); - sort_node(node); - adjust_bounds(new_node); - sort_node(new_node); - return (new_node); -} - -/* split a node according to clusters - */ -static void split_node(struct rtree_node *node) -{ - int i; - struct rtree_node *new_node; - - assert(node); - assert(node->flags.is_leaf ? (void *) node->u.rects[M_SIZE].bptr : (void *) node->u.kids[M_SIZE]); - new_node = find_clusters(node); - if (node->parent == NULL) { /* split root node */ - struct rtree_node *second; - - second = (struct rtree_node *) calloc(1, sizeof(*second)); - *second = *node; - if (!second->flags.is_leaf) - for (i = 0; i < M_SIZE; i++) - if (second->u.kids[i]) - second->u.kids[i]->parent = second; - node->flags.is_leaf = 0; - node->flags.manage = 0; - second->parent = new_node->parent = node; - node->u.kids[0] = new_node; - node->u.kids[1] = second; - for (i = 2; i < M_SIZE + 1; i++) - node->u.kids[i] = NULL; - adjust_bounds(node); - sort_node(node); -#ifdef SLOW_ASSERTS - assert(__r_tree_is_good(node)); -#endif - return; - } - for (i = 0; i < M_SIZE; i++) - if (!node->parent->u.kids[i]) - break; - node->parent->u.kids[i] = new_node; -#ifdef SLOW_ASSERTS - assert(__r_node_is_good(node)); - assert(__r_node_is_good(new_node)); -#endif - if (i < M_SIZE) { -#ifdef SLOW_ASSERTS - assert(__r_node_is_good(node->parent)); -#endif - sort_node(node->parent); - return; - } - split_node(node->parent); -} - -static inline int contained(struct rtree_node *node, const BoxType * query) -{ - if (node->box.X1 > query->X1 || node->box.X2 < query->X2 || node->box.Y1 > query->Y1 || node->box.Y2 < query->Y2) - return 0; - return 1; -} - - -static inline double penalty(struct rtree_node *node, const BoxType * query) -{ - double score; - - /* Compute the area penalty for inserting here and return. - * The penalty is the increase in area necessary - * to include the query-> - */ - score = (MAX(node->box.X2, query->X2) - MIN(node->box.X1, query->X1)); - score *= (MAX(node->box.Y2, query->Y2) - MIN(node->box.Y1, query->Y1)); - score -= (double) (node->box.X2 - node->box.X1) * (double) (node->box.Y2 - node->box.Y1); - return score; -} - -static void __r_insert_node(struct rtree_node *node, const BoxType * query, int manage, pcb_bool force) -{ - -#ifdef SLOW_ASSERTS - assert(__r_node_is_good(node)); -#endif - /* Ok, at this point we must already enclose the query or we're forcing - * this node to expand to enclose it, so if we're a leaf, simply store - * the query here - */ - - if (node->flags.is_leaf) { - register int i; - - if (UNLIKELY(manage)) { - register int flag = 1; - - for (i = 0; i < M_SIZE; i++) { - if (!node->u.rects[i].bptr) - break; - flag <<= 1; - } - node->flags.manage |= flag; - } - else { - for (i = 0; i < M_SIZE; i++) - if (!node->u.rects[i].bptr) - break; - } - /* the node always has an extra space available */ - node->u.rects[i].bptr = query; - node->u.rects[i].bounds = *query; - /* first entry in node determines initial bounding box */ - if (i == 0) - node->box = *query; - else if (force) { - MAKEMIN(node->box.X1, query->X1); - MAKEMAX(node->box.X2, query->X2); - MAKEMIN(node->box.Y1, query->Y1); - MAKEMAX(node->box.Y2, query->Y2); - } - if (i < M_SIZE) { - sort_node(node); - return; - } - /* we must split the node */ - split_node(node); - return; - } - else { - int i; - struct rtree_node *best_node; - double score, best_score; - - if (force) { - MAKEMIN(node->box.X1, query->X1); - MAKEMAX(node->box.X2, query->X2); - MAKEMIN(node->box.Y1, query->Y1); - MAKEMAX(node->box.Y2, query->Y2); - } - - /* this node encloses it, but it's not a leaf, so descend the tree */ - - /* First check if any children actually encloses it */ - assert(node->u.kids[0]); - for (i = 0; i < M_SIZE; i++) { - if (!node->u.kids[i]) - break; - if (contained(node->u.kids[i], query)) { - __r_insert_node(node->u.kids[i], query, manage, pcb_false); - sort_node(node); - return; - } - } - - /* see if there is room for a new leaf node */ - if (node->u.kids[0]->flags.is_leaf && i < M_SIZE) { - struct rtree_node *new_node; - new_node = (struct rtree_node *) calloc(1, sizeof(*new_node)); - new_node->parent = node; - new_node->flags.is_leaf = pcb_true; - node->u.kids[i] = new_node; - new_node->u.rects[0].bptr = query; - new_node->u.rects[0].bounds = *query; - new_node->box = *query; - if (UNLIKELY(manage)) - new_node->flags.manage = 1; - sort_node(node); - return; - } - - /* Ok, so we're still here - look for the best child to push it into */ - best_score = penalty(node->u.kids[0], query); - best_node = node->u.kids[0]; - for (i = 1; i < M_SIZE; i++) { - if (!node->u.kids[i]) - break; - score = penalty(node->u.kids[i], query); - if (score < best_score) { - best_score = score; - best_node = node->u.kids[i]; - } - } - __r_insert_node(best_node, query, manage, pcb_true); - sort_node(node); - return; - } -} - -void r_insert_entry(rtree_t * rtree, const BoxType * which, int man) -{ - assert(which); - assert(which->X1 <= which->X2); - assert(which->Y1 <= which->Y2); - /* recursively search the tree for the best leaf node */ - assert(rtree->root); - __r_insert_node(rtree->root, which, man, - rtree->root->box.X1 > which->X1 - || rtree->root->box.X2 < which->X2 || rtree->root->box.Y1 > which->Y1 || rtree->root->box.Y2 < which->Y2); - rtree->size++; -} - -pcb_bool __r_delete(struct rtree_node *node, const BoxType * query) -{ - int i, flag, mask, a; - - /* the tree might be inconsistent during delete */ - if (query->X1 < node->box.X1 || query->Y1 < node->box.Y1 || query->X2 > node->box.X2 || query->Y2 > node->box.Y2) - return pcb_false; - if (!node->flags.is_leaf) { - for (i = 0; i < M_SIZE; i++) { - /* if this is us being removed, free and copy over */ - if (node->u.kids[i] == (struct rtree_node *) query) { - free((void *) query); - for (; i < M_SIZE; i++) { - node->u.kids[i] = node->u.kids[i + 1]; - if (!node->u.kids[i]) - break; - } - /* nobody home here now ? */ - if (!node->u.kids[0]) { - if (!node->parent) { - /* wow, the root is empty! */ - node->flags.is_leaf = 1; - /* changing type of node, be sure it's all zero */ - for (i = 1; i < M_SIZE + 1; i++) - node->u.rects[i].bptr = NULL; - return pcb_true; - } - return (__r_delete(node->parent, &node->box)); - } - else - /* propagate boundary adjust upward */ - while (node) { - adjust_bounds(node); - node = node->parent; - } - return pcb_true; - } - if (node->u.kids[i]) { - if (__r_delete(node->u.kids[i], query)) - return pcb_true; - } - else - break; - } - return pcb_false; - } - /* leaf node here */ - mask = 0; - a = 1; - for (i = 0; i < M_SIZE; i++) { -#ifdef DELETE_BY_POINTER - if (!node->u.rects[i].bptr || node->u.rects[i].bptr == query) -#else - if (node->u.rects[i].bounds.X1 == query->X1 && - node->u.rects[i].bounds.X2 == query->X2 && - node->u.rects[i].bounds.Y1 == query->Y1 && node->u.rects[i].bounds.Y2 == query->Y2) -#endif - break; - mask |= a; - a <<= 1; - } - if (!node->u.rects[i].bptr) - return pcb_false; /* not at this leaf */ - if (node->flags.manage & a) { - free((void *) node->u.rects[i].bptr); - node->u.rects[i].bptr = NULL; - } - /* squeeze the manage flags together */ - flag = node->flags.manage & mask; - mask = (~mask) << 1; - node->flags.manage = flag | ((node->flags.manage & mask) >> 1); - /* remove the entry */ - for (; i < M_SIZE; i++) { - node->u.rects[i] = node->u.rects[i + 1]; - if (!node->u.rects[i].bptr) - break; - } - if (!node->u.rects[0].bptr) { - if (node->parent) - __r_delete(node->parent, &node->box); - return pcb_true; - } - else - /* propagate boundary adjustment upward */ - while (node) { - adjust_bounds(node); - node = node->parent; - } - return pcb_true; -} - -pcb_bool r_delete_entry(rtree_t * rtree, const BoxType * box) -{ - pcb_bool r; - - assert(box); - assert(rtree); - r = __r_delete(rtree->root, box); - if (r) - rtree->size--; -#ifdef SLOW_ASSERTS - assert(__r_tree_is_good(rtree->root)); -#endif - return r; -} Index: 1.1.4/src/list_rat.c =================================================================== --- 1.1.4/src/list_rat.c (revision 10776) +++ 1.1.4/src/list_rat.c (nonexistent) @@ -1,26 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define TDL_DONT_UNDEF -#include "global_objs.h" -#include "list_rat.h" -#include Index: 1.1.4/src/hid_extents.h =================================================================== --- 1.1.4/src/hid_extents.h (revision 10776) +++ 1.1.4/src/hid_extents.h (nonexistent) @@ -1,12 +0,0 @@ -#ifndef PCB_HID_EXTENTS_H -#define PCB_HID_EXTENTS_H - -/* HID internal interfaces. These may ONLY be called from the HID - modules, not from the common PCB code. */ - -/* Convenience function that calls the expose callback for the item, - and returns the extents of what was drawn. */ -BoxType *hid_get_extents(void *item); - - -#endif Index: 1.1.4/src/route_style.h =================================================================== --- 1.1.4/src/route_style.h (revision 10776) +++ 1.1.4/src/route_style.h (nonexistent) @@ -1,50 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2004 Thomas Nau - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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 - * - */ - -/* Parse a single route string into one RouteStyleTypePtr slot. Returns 0 on success. */ -int ParseRoutingString1(char **str, RouteStyleTypePtr routeStyle, const char *default_unit); - -/* Parse a ':' separated list of route strings into a styles vector - The vector is initialized before the call. On error the vector is left empty - (but still initialized). Returns 0 on success. */ -int ParseRouteString(char *s, vtroutestyle_t *styles, const char *default_unit); - -char *make_route_string(vtroutestyle_t *styles); - -/* Set design configuration (the pen we draw with) to a given route style */ -void pcb_use_route_style(RouteStyleType *rst); - -/* Same as pcb_use_route_style() but uses one of the styles in a vector; - returns -1 if idx is out of bounds, 0 on success. */ -int pcb_use_route_style_idx(vtroutestyle_t *styles, int idx); - -/* Compare supplied parameters to each style in the vector and return the index - of the first matching style. All non-0 parameters need to match to accept - a style. Return -1 on no match. */ -int pcb_route_style_lookup(vtroutestyle_t *styles, Coord Thick, Coord Diameter, Coord Hole, Coord Clearance, char *Name); - -extern RouteStyleType pcb_custom_route_style; Index: 1.1.4/src/unit.h =================================================================== --- 1.1.4/src/unit.h (revision 10776) +++ 1.1.4/src/unit.h (nonexistent) @@ -1,124 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2011 Andrew Poelstra - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Andrew Poelstra, 16966 60A Ave, V3S 8X5 Surrey, BC, Canada - * asp11@sfu.ca - * - */ - -#ifndef PCB_UNIT_H -#define PCB_UNIT_H - -#include "config.h" - -/* typedef ... Coord; pcb base unit, typedef'd in config.h */ -typedef double Angle; /* degrees */ - -enum e_allow { - NO_PRINT = 0, /* suffixes we can read but not print (i.e., "inch") */ - ALLOW_NM = 1, - ALLOW_UM = 2, - ALLOW_MM = 4, - ALLOW_CM = 8, - ALLOW_M = 16, - ALLOW_KM = 32, - - ALLOW_CMIL = 1024, - ALLOW_MIL = 2048, - ALLOW_IN = 4096, - - ALLOW_DMIL = 8192, /* for kicad legacy decimil units */ - - ALLOW_METRIC = ALLOW_NM | ALLOW_UM | ALLOW_MM | ALLOW_CM | ALLOW_M | ALLOW_KM, - ALLOW_IMPERIAL = ALLOW_DMIL | ALLOW_CMIL | ALLOW_MIL | ALLOW_IN, - /* This is all units allowed in parse_l.l */ -#if 0 - ALLOW_READABLE = ALLOW_NM | ALLOW_UM | ALLOW_MM | ALLOW_M | ALLOW_KM | ALLOW_CMIL | ALLOW_MIL | ALLOW_IN, -#else - ALLOW_READABLE = ALLOW_CMIL, -#endif - - /* Used for pcb-printf %mS - should not include unusual units like km, cmil and dmil */ - ALLOW_NATURAL = ALLOW_NM | ALLOW_UM | ALLOW_MM | ALLOW_M | ALLOW_MIL | ALLOW_IN, - - ALLOW_ALL = ~0 -}; - -enum e_family { METRIC, IMPERIAL }; -enum e_suffix { NO_SUFFIX, SUFFIX, FILE_MODE }; - -struct unit { - int index; /* Index into Unit[] list */ - const char *suffix; - const char *in_suffix; /* internationalized suffix */ - char printf_code; - double scale_factor; - enum e_family family; - enum e_allow allow; - int default_prec; - /* used for gui spinboxes */ - double step_tiny; - double step_small; - double step_medium; - double step_large; - double step_huge; - /* aliases -- right now we only need 1 ("inch"->"in"), add as needed */ - const char *alias[1]; -}; - -struct increments { - const char *suffix; - /* key g and g value */ - Coord grid; - Coord grid_min; - Coord grid_max; - /* key s and s value */ - Coord size; - Coord size_min; - Coord size_max; - /* key l and l value */ - Coord line; - Coord line_min; - Coord line_max; - /* key k and k value */ - Coord clear; - Coord clear_min; - Coord clear_max; -}; - -typedef struct unit Unit; -typedef struct increments Increments; -extern Unit Units[]; -extern Increments increments[]; - -const Unit *get_unit_struct(const char *suffix); -const Unit *get_unit_struct_by_allow(enum e_allow allow); -const Unit *get_unit_list(void); -const Unit *get_unit_by_idx(int idx); -int get_n_units(void); -double coord_to_unit(const Unit *, Coord); -double unit_to_factor(const Unit * unit); -Coord unit_to_coord(const Unit *, double); -Increments *get_increments_struct(const char *suffix); - - -#endif Index: 1.1.4/src/vtptr.h =================================================================== --- 1.1.4/src/vtptr.h (revision 10776) +++ 1.1.4/src/vtptr.h (nonexistent) @@ -1,36 +0,0 @@ -#include -#include -#include "global_objs.h" - -typedef void *ptr_t; - -/* Elem=void *; init=none */ - -/* all public symbols are wrapped in GVT() - see vt_t(7) */ -#define GVT(x) vtptr_ ## x - -/* Array elem type - see vt_t(7) */ -#define GVT_ELEM_TYPE ptr_t - -/* Type that represents array lengths - see vt_t(7) */ -#define GVT_SIZE_TYPE size_t - -/* Below this length, always double allocation size when the array grows */ -#define GVT_DOUBLING_THRS 256 - -/* Initial array size when the first element is written */ -#define GVT_START_SIZE 32 - -/* Optional prefix for function definitions (e.g. static inline) */ -#define GVT_FUNC - - -/* Include the actual header implementation */ -#include - -/* Memory allocator - see vt_allocation(7) */ -#define GVT_REALLOC(vect, ptr, size) realloc(ptr, size) -#define GVT_FREE(vect, ptr) free(ptr) - -/* clean up #defines */ -#include Index: 1.1.4/src/rtree.h =================================================================== --- 1.1.4/src/rtree.h (revision 10776) +++ 1.1.4/src/rtree.h (nonexistent) @@ -1,83 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, rtree.h, was written and is - * Copyright (c) 2004 harry eaton, it's based on C. Scott's kdtree.h template - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - - -/* prototypes for r-tree routines. - */ - -#ifndef PCB_RTREE_H -#define PCB_RTREE_H - -#include "global.h" - -/* callback direction to the search engine */ -typedef enum r_dir_e { - R_DIR_NOT_FOUND = 0, /* object not found or not accepted */ - R_DIR_FOUND_CONTINUE = 1, /* object found or accepted, go on searching */ - R_DIR_CANCEL /* cancel the search and return immediately */ -} r_dir_t; - -/* create an rtree from the list of boxes. if 'manage' is pcb_true, then - * the tree will take ownership of 'boxlist' and free it when the tree - * is destroyed. */ -rtree_t *r_create_tree(const BoxType * boxlist[], int N, int manage); -/* destroy an rtree */ -void r_destroy_tree(rtree_t ** rtree); - -pcb_bool r_delete_entry(rtree_t * rtree, const BoxType * which); -void r_insert_entry(rtree_t * rtree, const BoxType * which, int manage); - -/* generic search routine */ -/* region_in_search should return pcb_true if "what you're looking for" is - * within the specified region; regions, like rectangles, are closed on - * top and left and open on bottom and right. - * rectangle_in_region should return pcb_true if the given rectangle is - * "what you're looking for". - * The search will find all rectangles matching the criteria given - * by region_in_search and rectangle_in_region and return a count of - * how many things rectangle_in_region returned pcb_true for. closure is - * used to abort the search if desired from within rectangel_in_region - * Look at the implementation of r_region_is_empty for how to - * abort the search if that is the desired behavior. - */ - -r_dir_t r_search(rtree_t * rtree, const BoxType * starting_region, - r_dir_t (*region_in_search) (const BoxType * region, void *cl), - r_dir_t (*rectangle_in_region) (const BoxType * box, void *cl), void *closure, - int *num_found); - -/* -- special-purpose searches build upon r_search -- */ -/* return 0 if there are any rectangles in the given region. */ -int r_region_is_empty(rtree_t * rtree, const BoxType * region); - -void __r_dump_tree(struct rtree_node *, int); - -#endif Index: 1.1.4/src/list_rat.h =================================================================== --- 1.1.4/src/list_rat.h (revision 10776) +++ 1.1.4/src/list_rat.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef LIST_RAT_H -#define LIST_RAT_H - -/* List of Rats */ -#define TDL(x) ratlist_ ## x -#define TDL_LIST_T ratlist_t -#define TDL_ITEM_T RatType -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define ratlist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - - -#include -#include - -#endif Index: 1.1.4/src/default_font =================================================================== --- 1.1.4/src/default_font (revision 10776) +++ 1.1.4/src/default_font (nonexistent) @@ -1,773 +0,0 @@ -Symbol(' ' 18) -( -) -Symbol('!' 12) -( - SymbolLine(0 35 0 40 8) - SymbolLine(0 0 0 25 8) -) -Symbol('"' 12) -( - SymbolLine(0 0 0 10 8) - SymbolLine(10 0 10 10 8) -) -Symbol('#' 12) -( - SymbolLine(0 25 20 25 8) - SymbolLine(0 15 20 15 8) - SymbolLine(15 10 15 30 8) - SymbolLine(5 10 5 30 8) -) -Symbol('$' 12) -( - SymbolLine(15 5 20 10 8) - SymbolLine(5 5 15 5 8) - SymbolLine(0 10 5 5 8) - SymbolLine(0 10 0 15 8) - SymbolLine(0 15 5 20 8) - SymbolLine(5 20 15 20 8) - SymbolLine(15 20 20 25 8) - SymbolLine(20 25 20 30 8) - SymbolLine(15 35 20 30 8) - SymbolLine(5 35 15 35 8) - SymbolLine(0 30 5 35 8) - SymbolLine(10 0 10 40 8) -) -Symbol('%' 12) -( - SymbolLine(0 5 0 10 8) - SymbolLine(0 5 5 0 8) - SymbolLine(5 0 10 0 8) - SymbolLine(10 0 15 5 8) - SymbolLine(15 5 15 10 8) - SymbolLine(10 15 15 10 8) - SymbolLine(5 15 10 15 8) - SymbolLine(0 10 5 15 8) - SymbolLine(0 40 40 0 8) - SymbolLine(35 40 40 35 8) - SymbolLine(40 30 40 35 8) - SymbolLine(35 25 40 30 8) - SymbolLine(30 25 35 25 8) - SymbolLine(25 30 30 25 8) - SymbolLine(25 30 25 35 8) - SymbolLine(25 35 30 40 8) - SymbolLine(30 40 35 40 8) -) -Symbol('&' 12) -( - SymbolLine(0 35 5 40 8) - SymbolLine(0 5 0 15 8) - SymbolLine(0 5 5 0 8) - SymbolLine(0 25 15 10 8) - SymbolLine(5 40 10 40 8) - SymbolLine(10 40 20 30 8) - SymbolLine(0 15 25 40 8) - SymbolLine(5 0 10 0 8) - SymbolLine(10 0 15 5 8) - SymbolLine(15 5 15 10 8) - SymbolLine(0 25 0 35 8) -) -Symbol(''' 12) -( - SymbolLine(0 10 10 0 8) -) -Symbol('(' 12) -( - SymbolLine(0 35 5 40 8) - SymbolLine(0 5 5 0 8) - SymbolLine(0 5 0 35 8) -) -Symbol(')' 12) -( - SymbolLine(0 0 5 5 8) - SymbolLine(5 5 5 35 8) - SymbolLine(0 40 5 35 8) -) -Symbol('*' 12) -( - SymbolLine(0 10 20 30 8) - SymbolLine(0 30 20 10 8) - SymbolLine(0 20 20 20 8) - SymbolLine(10 10 10 30 8) -) -Symbol('+' 12) -( - SymbolLine(0 20 20 20 8) - SymbolLine(10 10 10 30 8) -) -Symbol(',' 12) -( - SymbolLine(0 50 10 40 8) -) -Symbol('-' 12) -( - SymbolLine(0 20 20 20 8) -) -Symbol('.' 12) -( - SymbolLine(0 40 5 40 8) -) -Symbol('/' 12) -( - SymbolLine(0 35 30 5 8) -) -Symbol('0' 12) -( - SymbolLine(0 35 5 40 8) - SymbolLine(0 5 0 35 8) - SymbolLine(0 5 5 0 8) - SymbolLine(5 0 15 0 8) - SymbolLine(15 0 20 5 8) - SymbolLine(20 5 20 35 8) - SymbolLine(15 40 20 35 8) - SymbolLine(5 40 15 40 8) - SymbolLine(0 30 20 10 8) -) -Symbol('1' 12) -( - SymbolLine( 0 8 8 0 8) - SymbolLine( 8 0 8 40 8) - SymbolLine( 0 40 15 40 8) -) -Symbol('2' 12) -( - SymbolLine(0 5 5 0 8) - SymbolLine(5 0 20 0 8) - SymbolLine(20 0 25 5 8) - SymbolLine(25 5 25 15 8) - SymbolLine(0 40 25 15 8) - SymbolLine(0 40 25 40 8) -) -Symbol('3' 12) -( - SymbolLine( 0 5 5 0 8) - SymbolLine( 5 0 15 0 8) - SymbolLine(15 0 20 5 8) - SymbolLine(15 40 20 35 8) - SymbolLine( 5 40 15 40 8) - SymbolLine( 0 35 5 40 8) - - SymbolLine( 5 18 15 18 8) - SymbolLine(20 5 20 13 8) - SymbolLine(20 23 20 35 8) - SymbolLine(20 23 15 18 8) - SymbolLine(20 13 15 18 8) -) -Symbol('4' 12) -( - SymbolLine(0 25 20 0 8) - SymbolLine(0 25 25 25 8) - SymbolLine(20 0 20 40 8) -) -Symbol('5' 12) -( - SymbolLine(0 0 20 0 8) - SymbolLine(0 0 0 20 8) - SymbolLine(0 20 5 15 8) - SymbolLine(5 15 15 15 8) - SymbolLine(15 15 20 20 8) - SymbolLine(20 20 20 35 8) - SymbolLine(15 40 20 35 8) - SymbolLine(5 40 15 40 8) - SymbolLine(0 35 5 40 8) -) -Symbol('6' 12) -( - SymbolLine(15 0 20 5 8) - SymbolLine( 5 0 15 0 8) - SymbolLine( 0 5 5 0 8) - SymbolLine( 0 5 0 35 8) - SymbolLine( 0 35 5 40 8) - SymbolLine(15 18 20 23 8) - SymbolLine( 0 18 15 18 8) - SymbolLine( 5 40 15 40 8) - SymbolLine(15 40 20 35 8) - SymbolLine(20 23 20 35 8) -) -Symbol('7' 12) -( - SymbolLine( 5 40 25 0 8) - SymbolLine( 0 0 25 0 8) -) -Symbol('8' 12) -( - SymbolLine( 0 35 5 40 8) - SymbolLine( 0 27 0 35 8) - SymbolLine( 0 27 7 20 8) - SymbolLine( 7 20 13 20 8) - SymbolLine(13 20 20 27 8) - SymbolLine(20 27 20 35 8) - SymbolLine(15 40 20 35 8) - SymbolLine( 5 40 15 40 8) - SymbolLine( 0 13 7 20 8) - SymbolLine( 0 5 0 13 8) - SymbolLine( 0 5 5 0 8) - SymbolLine( 5 0 15 0 8) - SymbolLine(15 0 20 5 8) - SymbolLine(20 5 20 13 8) - SymbolLine(13 20 20 13 8) -) -Symbol('9' 12) -( - SymbolLine(5 40 20 20 8) - SymbolLine(20 5 20 20 8) - SymbolLine(15 0 20 5 8) - SymbolLine(5 0 15 0 8) - SymbolLine(0 5 5 0 8) - SymbolLine(0 5 0 15 8) - SymbolLine(0 15 5 20 8) - SymbolLine(5 20 20 20 8) -) -Symbol(':' 12) -( - SymbolLine(0 15 5 15 8) - SymbolLine(0 25 5 25 8) -) -Symbol(';' 12) -( - SymbolLine(0 40 10 30 8) - SymbolLine(10 15 10 20 8) -) -Symbol('<' 12) -( - SymbolLine(0 20 10 10 8) - SymbolLine(0 20 10 30 8) -) -Symbol('=' 12) -( - SymbolLine(0 15 20 15 8) - SymbolLine(0 25 20 25 8) -) -Symbol('>' 12) -( - SymbolLine(0 10 10 20 8) - SymbolLine(0 30 10 20 8) -) -Symbol('?' 12) -( - SymbolLine(10 20 10 25 8) - SymbolLine(10 35 10 40 8) - SymbolLine(0 5 0 10 8) - SymbolLine(0 5 5 0 8) - SymbolLine(5 0 15 0 8) - SymbolLine(15 0 20 5 8) - SymbolLine(20 5 20 10 8) - SymbolLine(10 20 20 10 8) -) -Symbol('A' 12) -( - SymbolLine( 0 10 0 40 8) - SymbolLine( 0 10 7 0 8) - SymbolLine( 7 0 18 0 8) - SymbolLine(18 0 25 10 8) - SymbolLine(25 10 25 40 8) - SymbolLine( 0 20 25 20 8) -) -Symbol('B' 12) -( - SymbolLine( 0 40 20 40 8) - SymbolLine(20 40 25 35 8) - SymbolLine(25 23 25 35 8) - SymbolLine(20 18 25 23 8) - SymbolLine( 5 18 20 18 8) - SymbolLine( 5 0 5 40 8) - SymbolLine( 0 0 20 0 8) - SymbolLine(20 0 25 5 8) - SymbolLine(25 5 25 13 8) - SymbolLine(20 18 25 13 8) -) -Symbol('C' 12) -( - SymbolLine(7 40 20 40 8) - SymbolLine(0 33 7 40 8) - SymbolLine(0 7 0 33 8) - SymbolLine(0 7 7 0 8) - SymbolLine(7 0 20 0 8) -) -Symbol('D' 12) -( - SymbolLine( 5 0 5 40 8) - SymbolLine(18 0 25 7 8) - SymbolLine(25 7 25 33 8) - SymbolLine(18 40 25 33 8) - SymbolLine( 0 40 18 40 8) - SymbolLine( 0 0 18 0 8) -) -Symbol('E' 12) -( - SymbolLine(0 18 15 18 8) - SymbolLine(0 40 20 40 8) - SymbolLine(0 0 0 40 8) - SymbolLine(0 0 20 0 8) -) -Symbol('F' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 0 20 0 8) - SymbolLine(0 18 15 18 8) -) -Symbol('G' 12) -( - SymbolLine(20 0 25 5 8) - SymbolLine(5 0 20 0 8) - SymbolLine(0 5 5 0 8) - SymbolLine(0 5 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 20 40 8) - SymbolLine(20 40 25 35 8) - SymbolLine(25 25 25 35 8) - SymbolLine(20 20 25 25 8) - SymbolLine(10 20 20 20 8) -) -Symbol('H' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(25 0 25 40 8) - SymbolLine(0 20 25 20 8) -) -Symbol('I' 12) -( - SymbolLine(0 0 10 0 8) - SymbolLine(5 0 5 40 8) - SymbolLine(0 40 10 40 8) -) -Symbol('J' 12) -( - SymbolLine( 7 0 15 0 8) - SymbolLine(15 0 15 35 8) - SymbolLine(10 40 15 35 8) - SymbolLine( 5 40 10 40 8) - SymbolLine( 0 35 5 40 8) - SymbolLine( 0 35 0 30 8) -) -Symbol('K' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 20 20 0 8) - SymbolLine(0 20 20 40 8) -) -Symbol('L' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 40 20 40 8) -) -Symbol('M' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 0 15 20 8) - SymbolLine(15 20 30 0 8) - SymbolLine(30 0 30 40 8) -) -Symbol('N' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 0 25 40 8) - SymbolLine(25 0 25 40 8) -) -Symbol('O' 12) -( - SymbolLine(0 5 0 35 8) - SymbolLine(0 5 5 0 8) - SymbolLine(5 0 15 0 8) - SymbolLine(15 0 20 5 8) - SymbolLine(20 5 20 35 8) - SymbolLine(15 40 20 35 8) - SymbolLine(5 40 15 40 8) - SymbolLine(0 35 5 40 8) -) -Symbol('P' 12) -( - SymbolLine(5 0 5 40 8) - SymbolLine(0 0 20 0 8) - SymbolLine(20 0 25 5 8) - SymbolLine(25 5 25 15 8) - SymbolLine(20 20 25 15 8) - SymbolLine(5 20 20 20 8) -) -Symbol('Q' 12) -( - SymbolLine( 0 5 0 35 8) - SymbolLine( 0 5 5 0 8) - SymbolLine( 5 0 15 0 8) - SymbolLine(15 0 20 5 8) - SymbolLine(20 5 20 30 8) - SymbolLine(10 40 20 30 8) - SymbolLine( 5 40 10 40 8) - SymbolLine( 0 35 5 40 8) - SymbolLine(10 25 20 40 8) -) -Symbol('R' 12) -( - SymbolLine( 0 0 20 0 8) - SymbolLine(20 0 25 5 8) - SymbolLine(25 5 25 15 8) - SymbolLine(20 20 25 15 8) - SymbolLine( 5 20 20 20 8) - SymbolLine( 5 0 5 40 8) - SymbolLine(13 20 25 40 8) -) -Symbol('S' 12) -( - SymbolLine(20 0 25 5 8) - SymbolLine(5 0 20 0 8) - SymbolLine(0 5 5 0 8) - SymbolLine(0 5 0 15 8) - SymbolLine(0 15 5 20 8) - SymbolLine(5 20 20 20 8) - SymbolLine(20 20 25 25 8) - SymbolLine(25 25 25 35 8) - SymbolLine(20 40 25 35 8) - SymbolLine(5 40 20 40 8) - SymbolLine(0 35 5 40 8) -) -Symbol('T' 12) -( - SymbolLine(0 0 20 0 8) - SymbolLine(10 0 10 40 8) -) -Symbol('U' 12) -( - SymbolLine(0 0 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 15 40 8) - SymbolLine(15 40 20 35 8) - SymbolLine(20 0 20 35 8) -) -Symbol('V' 12) -( - SymbolLine( 0 0 10 40 8) - SymbolLine(10 40 20 0 8) -) -Symbol('W' 12) -( - SymbolLine( 0 0 0 20 8) - SymbolLine( 0 20 5 40 8) - SymbolLine( 5 40 15 20 8) - SymbolLine(15 20 25 40 8) - SymbolLine(25 40 30 20 8) - SymbolLine(30 20 30 0 8) -) -Symbol('X' 12) -( - SymbolLine( 0 40 25 0 8) - SymbolLine( 0 0 25 40 8) -) -Symbol('Y' 12) -( - SymbolLine( 0 0 10 20 8) - SymbolLine(10 20 20 0 8) - SymbolLine(10 20 10 40 8) -) -Symbol('Z' 12) -( - SymbolLine( 0 0 25 0 8) - SymbolLine( 0 40 25 0 8) - SymbolLine( 0 40 25 40 8) -) -Symbol('[' 12) -( - SymbolLine(0 0 5 0 8) - SymbolLine(0 0 0 40 8) - SymbolLine(0 40 5 40 8) -) -Symbol('\' 12) -( - SymbolLine(0 5 30 35 8) -) -Symbol(']' 12) -( - SymbolLine(0 0 5 0 8) - SymbolLine(5 0 5 40 8) - SymbolLine(0 40 5 40 8) -) -Symbol('^' 12) -( - SymbolLine(0 5 5 0 8) - SymbolLine(5 0 10 5 8) -) -Symbol('_' 12) -( - SymbolLine(0 40 20 40 8) -) -Symbol('a' 12) -( - SymbolLine(15 20 20 25 8) - SymbolLine(5 20 15 20 8) - SymbolLine(0 25 5 20 8) - SymbolLine(0 25 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(20 20 20 35 8) - SymbolLine(20 35 25 40 8) - SymbolLine(5 40 15 40 8) - SymbolLine(15 40 20 35 8) -) -Symbol('b' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 15 40 8) - SymbolLine(15 40 20 35 8) - SymbolLine(20 25 20 35 8) - SymbolLine(15 20 20 25 8) - SymbolLine(5 20 15 20 8) - SymbolLine(0 25 5 20 8) -) -Symbol('c' 12) -( - SymbolLine(5 20 20 20 8) - SymbolLine(0 25 5 20 8) - SymbolLine(0 25 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 20 40 8) -) -Symbol('d' 12) -( - SymbolLine(20 0 20 40 8) - SymbolLine(15 40 20 35 8) - SymbolLine(5 40 15 40 8) - SymbolLine(0 35 5 40 8) - SymbolLine(0 25 0 35 8) - SymbolLine(0 25 5 20 8) - SymbolLine(5 20 15 20 8) - SymbolLine(15 20 20 25 8) -) -Symbol('e' 12) -( - SymbolLine(5 40 20 40 8) - SymbolLine(0 35 5 40 8) - SymbolLine(0 25 0 35 8) - SymbolLine(0 25 5 20 8) - SymbolLine(5 20 15 20 8) - SymbolLine(15 20 20 25 8) - SymbolLine(0 30 20 30 8) - SymbolLine(20 30 20 25 8) -) -Symbol('f' 10) -( - SymbolLine(5 5 5 40 8) - SymbolLine(5 5 10 0 8) - SymbolLine(10 0 15 0 8) - SymbolLine(0 20 10 20 8) -) -Symbol('g' 12) -( - SymbolLine(15 20 20 25 8) - SymbolLine(5 20 15 20 8) - SymbolLine(0 25 5 20 8) - SymbolLine(0 25 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 15 40 8) - SymbolLine(15 40 20 35 8) - SymbolLine(0 50 5 55 8) - SymbolLine(5 55 15 55 8) - SymbolLine(15 55 20 50 8) - SymbolLine(20 20 20 50 8) -) -Symbol('h' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 25 5 20 8) - SymbolLine(5 20 15 20 8) - SymbolLine(15 20 20 25 8) - SymbolLine(20 25 20 40 8) -) -Symbol('i' 10) -( - SymbolLine(0 10 0 11 10) - SymbolLine(0 25 0 40 8) -) -Symbol('j' 10) -( - SymbolLine(5 10 5 11 10) - SymbolLine(5 25 5 50 8) - SymbolLine(0 55 5 50 8) -) -Symbol('k' 12) -( - SymbolLine(0 0 0 40 8) - SymbolLine(0 25 15 40 8) - SymbolLine(0 25 10 15 8) -) -Symbol('l' 10) -( - SymbolLine(0 0 0 35 8) - SymbolLine(0 35 5 40 8) -) -Symbol('m' 12) -( - SymbolLine(5 25 5 40 8) - SymbolLine(5 25 10 20 8) - SymbolLine(10 20 15 20 8) - SymbolLine(15 20 20 25 8) - SymbolLine(20 25 20 40 8) - SymbolLine(20 25 25 20 8) - SymbolLine(25 20 30 20 8) - SymbolLine(30 20 35 25 8) - SymbolLine(35 25 35 40 8) - SymbolLine(0 20 5 25 8) -) -Symbol('n' 12) -( - SymbolLine(5 25 5 40 8) - SymbolLine(5 25 10 20 8) - SymbolLine(10 20 15 20 8) - SymbolLine(15 20 20 25 8) - SymbolLine(20 25 20 40 8) - SymbolLine(0 20 5 25 8) -) -Symbol('o' 12) -( - SymbolLine(0 25 0 35 8) - SymbolLine(0 25 5 20 8) - SymbolLine(5 20 15 20 8) - SymbolLine(15 20 20 25 8) - SymbolLine(20 25 20 35 8) - SymbolLine(15 40 20 35 8) - SymbolLine(5 40 15 40 8) - SymbolLine(0 35 5 40 8) -) -Symbol('p' 12) -( - SymbolLine(5 25 5 55 8) - SymbolLine(0 20 5 25 8) - SymbolLine(5 25 10 20 8) - SymbolLine(10 20 20 20 8) - SymbolLine(20 20 25 25 8) - SymbolLine(25 25 25 35 8) - SymbolLine(20 40 25 35 8) - SymbolLine(10 40 20 40 8) - SymbolLine(5 35 10 40 8) -) -Symbol('q' 12) -( - SymbolLine(20 25 20 55 8) - SymbolLine(15 20 20 25 8) - SymbolLine(5 20 15 20 8) - SymbolLine(0 25 5 20 8) - SymbolLine(0 25 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 15 40 8) - SymbolLine(15 40 20 35 8) -) -Symbol('r' 12) -( - SymbolLine(5 25 5 40 8) - SymbolLine(5 25 10 20 8) - SymbolLine(10 20 20 20 8) - SymbolLine(0 20 5 25 8) -) -Symbol('s' 12) -( - SymbolLine(5 40 20 40 8) - SymbolLine(20 40 25 35 8) - SymbolLine(20 30 25 35 8) - SymbolLine(5 30 20 30 8) - SymbolLine(0 25 5 30 8) - SymbolLine(0 25 5 20 8) - SymbolLine(5 20 20 20 8) - SymbolLine(20 20 25 25 8) - SymbolLine(0 35 5 40 8) -) -Symbol('t' 10) -( - SymbolLine(5 0 5 35 8) - SymbolLine(5 35 10 40 8) - SymbolLine(0 15 10 15 8) -) -Symbol('u' 12) -( - SymbolLine(0 20 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 15 40 8) - SymbolLine(15 40 20 35 8) - SymbolLine(20 20 20 35 8) -) -Symbol('v' 12) -( - SymbolLine( 0 20 10 40 8) - SymbolLine(20 20 10 40 8) -) -Symbol('w' 12) -( - SymbolLine(0 20 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(5 40 10 40 8) - SymbolLine(10 40 15 35 8) - SymbolLine(15 20 15 35 8) - SymbolLine(15 35 20 40 8) - SymbolLine(20 40 25 40 8) - SymbolLine(25 40 30 35 8) - SymbolLine(30 20 30 35 8) -) -Symbol('x' 12) -( - SymbolLine(0 20 20 40 8) - SymbolLine(0 40 20 20 8) -) -Symbol('y' 12) -( - SymbolLine(0 20 0 35 8) - SymbolLine(0 35 5 40 8) - SymbolLine(20 20 20 50 8) - SymbolLine(15 55 20 50 8) - SymbolLine(5 55 15 55 8) - SymbolLine(0 50 5 55 8) - SymbolLine(5 40 15 40 8) - SymbolLine(15 40 20 35 8) -) -Symbol('z' 12) -( - SymbolLine(0 20 20 20 8) - SymbolLine(0 40 20 20 8) - SymbolLine(0 40 20 40 8) -) -Symbol('{' 12) -( - SymbolLine(5 5 10 0 8) - SymbolLine(5 5 5 15 8) - SymbolLine(0 20 5 15 8) - SymbolLine(0 20 5 25 8) - SymbolLine(5 25 5 35 8) - SymbolLine(5 35 10 40 8) -) -Symbol('|' 12) -( - SymbolLine(0 0 0 40 8) -) -Symbol('}' 12) -( - SymbolLine(0 0 5 5 8) - SymbolLine(5 5 5 15 8) - SymbolLine(5 15 10 20 8) - SymbolLine(5 25 10 20 8) - SymbolLine(5 25 5 35 8) - SymbolLine(0 40 5 35 8) -) -Symbol('~' 12) -( - SymbolLine(0 25 5 20 8) - SymbolLine(5 20 10 20 8) - SymbolLine(10 20 15 25 8) - SymbolLine(15 25 20 25 8) - SymbolLine(20 25 25 20 8) -) -Symbol('@' 12) -( - SymbolLine(0 0 0 30 8) - SymbolLine(0 30 10 40 8) - SymbolLine(10 40 40 40 8) - SymbolLine(50 25 50 0 8) - SymbolLine(50 0 40 -10 8) - SymbolLine(40 -10 10 -10 8) - SymbolLine(10 -10 0 0 8) - SymbolLine(15 10 15 20 8) - SymbolLine(15 20 20 25 8) - SymbolLine(20 25 30 25 8) - SymbolLine(30 25 35 20 8) - SymbolLine(35 20 40 25 8) - SymbolLine(35 20 35 5 8) - SymbolLine(35 10 30 5 8) - SymbolLine(20 5 30 5 8) - SymbolLine(20 5 15 10 8) - SymbolLine(40 25 50 25 8) -) Index: 1.1.4/src/error.c =================================================================== --- 1.1.4/src/error.c (revision 10776) +++ 1.1.4/src/error.c (nonexistent) @@ -1,195 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* error and debug functions */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "global.h" - -#include "data.h" -#include "error.h" -#include "plug_io.h" -#include "compat_misc.h" -#include "pcb-printf.h" - -#define utf8_dup_string(a,b) *(a) = pcb_strdup(b) - -/* ---------------------------------------------------------------------- - * some external identifiers - */ - -/* the list is already defined for some OS */ -#if !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__linux__) && !defined(__DragonFly__) -#ifdef USE_SYS_ERRLIST -extern char *sys_errlist[]; /* array of error messages */ -#endif -#endif - - -/* --------------------------------------------------------------------------- - * output of message in a dialog window or log window - */ -void Message(enum pcb_message_level level, const char *Format, ...) -{ - va_list args; - - /* TODO(hzeller): do something useful with the level, e.g. color coding. */ - - if (gui != NULL) { - va_start(args, Format); - gui->logv(level, Format, args); - va_end(args); - } - - va_start(args, Format); - pcb_vfprintf(stderr, Format, args); - va_end(args); -} - -void pcb_trace(const char *Format, ...) -{ -#ifndef NDEBUG - va_list args; - va_start(args, Format); - vfprintf(stderr, Format, args); - va_end(args); -#endif -} - - -/* --------------------------------------------------------------------------- - * print standard 'open error' - */ -void OpenErrorMessage(const char *Filename) -{ - char *utf8 = NULL; - - utf8_dup_string(&utf8, Filename); - Message(PCB_MSG_DEFAULT, _("Can't open file\n" " '%s'\nfopen() returned: '%s'\n"), utf8, strerror(errno)); - free(utf8); -} - -/* --------------------------------------------------------------------------- - * print standard 'popen error' - */ -void PopenErrorMessage(const char *Filename) -{ - char *utf8 = NULL; - - utf8_dup_string(&utf8, Filename); - Message(PCB_MSG_DEFAULT, _("Can't execute command\n" " '%s'\npopen() returned: '%s'\n"), utf8, strerror(errno)); - free(utf8); -} - -/* --------------------------------------------------------------------------- - * print standard 'opendir' - */ -void OpendirErrorMessage(const char *DirName) -{ - char *utf8 = NULL; - - utf8_dup_string(&utf8, DirName); - Message(PCB_MSG_DEFAULT, _("Can't scan directory\n" " '%s'\nopendir() returned: '%s'\n"), utf8, strerror(errno)); - free(utf8); -} - -/* --------------------------------------------------------------------------- - * print standard 'chdir error' - */ -void ChdirErrorMessage(const char *DirName) -{ - char *utf8 = NULL; - - utf8_dup_string(&utf8, DirName); - Message(PCB_MSG_DEFAULT, _("Can't change working directory to\n" " '%s'\nchdir() returned: '%s'\n"), utf8, strerror(errno)); - free(utf8); -} - -/* --------------------------------------------------------------------------- - * output of fatal error message - */ -void MyFatal(const char *Format, ...) -{ - va_list args; - - va_start(args, Format); - - /* try to save the layout and do some cleanup */ - EmergencySave(); - fprintf(stderr, "pcb-rnd (%i): fatal, ", pcb_getpid()); - vfprintf(stderr, Format, args); - fflush(stderr); - va_end(args); - exit(1); -} - -/* --------------------------------------------------------------------------- - * catches signals which abort the program - */ -void CatchSignal(int Signal) -{ - const char *s; - - switch (Signal) { -#ifdef SIGHUP - case SIGHUP: - s = "SIGHUP"; - break; -#endif - case SIGINT: - s = "SIGINT"; - break; -#ifdef SIGQUIT - case SIGQUIT: - s = "SIGQUIT"; - break; -#endif - case SIGABRT: - s = "SIGABRT"; - break; - case SIGTERM: - s = "SIGTERM"; - break; - case SIGSEGV: - s = "SIGSEGV"; - break; - default: - s = "unknown"; - break; - } - MyFatal("aborted by %s signal\n", s); -} Index: 1.1.4/src/draw.c =================================================================== --- 1.1.4/src/draw.c (revision 10776) +++ 1.1.4/src/draw.c (nonexistent) @@ -1,1713 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2003, 2004 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* drawing routines - */ - -#include "config.h" - -#include "conf_core.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "misc.h" -#include "rotate.h" -#include "rtree.h" -#include "draw_fab.h" -#include "hid_helper.h" -#include "layer.h" - -#undef NDEBUG -#include - -#ifndef MAXINT -#define MAXINT (((unsigned int)(~0))>>1) -#endif - -#define SMALL_SMALL_TEXT_SIZE 0 -#define SMALL_TEXT_SIZE 1 -#define NORMAL_TEXT_SIZE 2 -#define LARGE_TEXT_SIZE 3 -#define N_TEXT_SIZES 4 - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static BoxType Block = { MAXINT, MAXINT, -MAXINT, -MAXINT }; - -static int doing_pinout = 0; -static pcb_bool doing_assy = pcb_false; - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void DrawEverything(const BoxType *); -static void DrawPPV(int group, const BoxType *); -static void DrawLayerGroup(int, const BoxType *); -static void AddPart(void *); -static void SetPVColor(PinTypePtr, int); -static void DrawEMark(ElementTypePtr, Coord, Coord, pcb_bool); -static void DrawMask(int side, const BoxType *); -static void DrawPaste(int side, const BoxType *); -static void DrawRats(const BoxType *); -static void DrawSilk(int side, const BoxType *); - -static void LightenColor(const char *orig, char buf[8], double factor) -{ - unsigned int r, g, b; - - if (orig[0] == '#') { - sscanf(&orig[1], "%2x%2x%2x", &r, &g, &b); - r = MIN(255, r * factor); - g = MIN(255, g * factor); - b = MIN(255, b * factor); - } - else { - r = 0xff; - g = 0xff; - b = 0xff; - } - pcb_snprintf(buf, sizeof("#XXXXXX"), "#%02x%02x%02x", r, g, b); -} - - -/*-------------------------------------------------------------------------------------- - * setup color for pin or via - */ -static void SetPVColor(PinTypePtr Pin, int Type) -{ - char *color; - char buf[sizeof("#XXXXXX")]; - - if (Type == PCB_TYPE_VIA) { - if (!doing_pinout && TEST_FLAG(PCB_FLAG_WARN | PCB_FLAG_SELECTED | PCB_FLAG_FOUND, Pin)) { - if (TEST_FLAG(PCB_FLAG_WARN, Pin)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED, Pin)) - color = PCB->ViaSelectedColor; - else - color = PCB->ConnectedColor; - - if (TEST_FLAG(PCB_FLAG_ONPOINT, Pin)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - } - else - color = PCB->ViaColor; - } - else { - if (!doing_pinout && TEST_FLAG(PCB_FLAG_WARN | PCB_FLAG_SELECTED | PCB_FLAG_FOUND, Pin)) { - if (TEST_FLAG(PCB_FLAG_WARN, Pin)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED, Pin)) - color = PCB->PinSelectedColor; - else - color = PCB->ConnectedColor; - - if (TEST_FLAG(PCB_FLAG_ONPOINT, Pin)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - } - else - color = PCB->PinColor; - } - - gui->set_color(Output.fgGC, color); -} - -/*--------------------------------------------------------------------------- - * Adds the update rect to the update region - */ -static void AddPart(void *b) -{ - BoxType *box = (BoxType *) b; - - Block.X1 = MIN(Block.X1, box->X1); - Block.X2 = MAX(Block.X2, box->X2); - Block.Y1 = MIN(Block.Y1, box->Y1); - Block.Y2 = MAX(Block.Y2, box->Y2); -} - -/* - * initiate the actual redrawing of the updated area - */ -pcb_cardinal_t pcb_draw_inhibit = 0; -void Draw(void) -{ - if (pcb_draw_inhibit) - return; - if (Block.X1 <= Block.X2 && Block.Y1 <= Block.Y2) - gui->invalidate_lr(Block.X1, Block.X2, Block.Y1, Block.Y2); - - /* shrink the update block */ - Block.X1 = Block.Y1 = MAXINT; - Block.X2 = Block.Y2 = -MAXINT; -} - -/* ---------------------------------------------------------------------- - * redraws all the data by the event handlers - */ -void Redraw(void) -{ - gui->invalidate_all(); -} - -static void _draw_pv_name(PinType * pv) -{ - BoxType box; - pcb_bool vert; - TextType text; - char buff[128]; - const char *pn; - - if (!pv->Name || !pv->Name[0]) - pn = EMPTY(pv->Number); - else - pn = EMPTY(conf_core.editor.show_number ? pv->Number : pv->Name); - - if (GET_INTCONN(pv) > 0) - pcb_snprintf(buff, sizeof(buff), "%s[%d]", pn, GET_INTCONN(pv)); - else - strcpy(buff, pn); - text.TextString = buff; - - vert = TEST_FLAG(PCB_FLAG_EDGE2, pv); - - if (vert) { - box.X1 = pv->X - pv->Thickness / 2 + conf_core.appearance.pinout.text_offset_y; - box.Y1 = pv->Y - pv->DrillingHole / 2 - conf_core.appearance.pinout.text_offset_x; - } - else { - box.X1 = pv->X + pv->DrillingHole / 2 + conf_core.appearance.pinout.text_offset_x; - box.Y1 = pv->Y - pv->Thickness / 2 + conf_core.appearance.pinout.text_offset_y; - } - - gui->set_color(Output.fgGC, PCB->PinNameColor); - - text.Flags = NoFlags(); - /* Set font height to approx 56% of pin thickness */ - text.Scale = 56 * pv->Thickness / FONT_CAPHEIGHT; - text.X = box.X1; - text.Y = box.Y1; - text.Direction = vert ? 1 : 0; - - if (gui->gui) - doing_pinout++; - DrawTextLowLevel(&text, 0); - if (gui->gui) - doing_pinout--; -} - -static void _draw_pv(PinTypePtr pv, pcb_bool draw_hole) -{ - if (conf_core.editor.thin_draw) - gui->thindraw_pcb_pv(Output.fgGC, Output.fgGC, pv, draw_hole, pcb_false); - else - gui->fill_pcb_pv(Output.fgGC, Output.bgGC, pv, draw_hole, pcb_false); - - if (!TEST_FLAG(PCB_FLAG_HOLE, pv) && TEST_FLAG(PCB_FLAG_DISPLAYNAME, pv)) - _draw_pv_name(pv); -} - -static void draw_pin(PinTypePtr pin, pcb_bool draw_hole) -{ - SetPVColor(pin, PCB_TYPE_PIN); - _draw_pv(pin, draw_hole); -} - -static r_dir_t pin_callback(const BoxType * b, void *cl) -{ - draw_pin((PinType *) b, pcb_false); - return R_DIR_FOUND_CONTINUE; -} - -static void draw_via(PinTypePtr via, pcb_bool draw_hole) -{ - SetPVColor(via, PCB_TYPE_VIA); - _draw_pv(via, draw_hole); -} - -static r_dir_t via_callback(const BoxType * b, void *cl) -{ - draw_via((PinType *) b, pcb_false); - return R_DIR_FOUND_CONTINUE; -} - -static void draw_pad_name(PadType * pad) -{ - BoxType box; - pcb_bool vert; - TextType text; - char buff[128]; - const char *pn; - - if (!pad->Name || !pad->Name[0]) - pn = EMPTY(pad->Number); - else - pn = conf_core.editor.show_number ? pad->Number : pad->Name; - - if (GET_INTCONN(pad) > 0) - pcb_snprintf(buff, sizeof(buff), "%s[%d]", pn, GET_INTCONN(pad)); - else - strcpy(buff, pn); - text.TextString = buff; - - /* should text be vertical ? */ - vert = (pad->Point1.X == pad->Point2.X); - - if (vert) { - box.X1 = pad->Point1.X - pad->Thickness / 2; - box.Y1 = MAX(pad->Point1.Y, pad->Point2.Y) + pad->Thickness / 2; - box.X1 += conf_core.appearance.pinout.text_offset_y; - box.Y1 -= conf_core.appearance.pinout.text_offset_x; - } - else { - box.X1 = MIN(pad->Point1.X, pad->Point2.X) - pad->Thickness / 2; - box.Y1 = pad->Point1.Y - pad->Thickness / 2; - box.X1 += conf_core.appearance.pinout.text_offset_x; - box.Y1 += conf_core.appearance.pinout.text_offset_y; - } - - gui->set_color(Output.fgGC, PCB->PinNameColor); - - text.Flags = NoFlags(); - /* Set font height to approx 90% of pin thickness */ - text.Scale = 90 * pad->Thickness / FONT_CAPHEIGHT; - text.X = box.X1; - text.Y = box.Y1; - text.Direction = vert ? 1 : 0; - - DrawTextLowLevel(&text, 0); -} - -static void _draw_pad(hidGC gc, PadType * pad, pcb_bool clear, pcb_bool mask) -{ - if (clear && !mask && pad->Clearance <= 0) - return; - - if (conf_core.editor.thin_draw || (clear && conf_core.editor.thin_draw_poly)) - gui->thindraw_pcb_pad(gc, pad, clear, mask); - else - gui->fill_pcb_pad(gc, pad, clear, mask); -} - -static void draw_pad(PadType * pad) -{ - const char *color = NULL; - char buf[sizeof("#XXXXXX")]; - - if (doing_pinout) - gui->set_color(Output.fgGC, PCB->PinColor); - else if (TEST_FLAG(PCB_FLAG_WARN | PCB_FLAG_SELECTED | PCB_FLAG_FOUND, pad)) { - if (TEST_FLAG(PCB_FLAG_WARN, pad)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED, pad)) - color = PCB->PinSelectedColor; - else - color = PCB->ConnectedColor; - } - else if (FRONT(pad)) - color = PCB->PinColor; - else - color = PCB->InvisibleObjectsColor; - - if (TEST_FLAG(PCB_FLAG_ONPOINT, pad)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - - if (color != NULL) - gui->set_color(Output.fgGC, color); - - _draw_pad(Output.fgGC, pad, pcb_false, pcb_false); - - if (doing_pinout || TEST_FLAG(PCB_FLAG_DISPLAYNAME, pad)) - draw_pad_name(pad); -} - -static r_dir_t pad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - int *side = cl; - - if (ON_SIDE(pad, *side)) - draw_pad(pad); - return R_DIR_FOUND_CONTINUE; -} - -static void draw_element_name(ElementType * element) -{ - if ((conf_core.editor.hide_names && gui->gui) || TEST_FLAG(PCB_FLAG_HIDENAME, element)) - return; - if (doing_pinout || doing_assy) - gui->set_color(Output.fgGC, PCB->ElementColor); - else if (TEST_FLAG(PCB_FLAG_SELECTED, &ELEMENT_TEXT(PCB, element))) - gui->set_color(Output.fgGC, PCB->ElementSelectedColor); - else if (FRONT(element)) { -/* TODO: why do we test for Name's flag here? */ - if (TEST_FLAG(PCB_FLAG_NONETLIST, element)) - gui->set_color(Output.fgGC, PCB->ElementColor_nonetlist); - else - gui->set_color(Output.fgGC, PCB->ElementColor); - } - else - gui->set_color(Output.fgGC, PCB->InvisibleObjectsColor); - - DrawTextLowLevel(&ELEMENT_TEXT(PCB, element), PCB->minSlk); - -} - -static r_dir_t name_callback(const BoxType * b, void *cl) -{ - TextTypePtr text = (TextTypePtr) b; - ElementTypePtr element = (ElementTypePtr) text->Element; - int *side = cl; - - if (TEST_FLAG(PCB_FLAG_HIDENAME, element)) - return R_DIR_NOT_FOUND; - - if (ON_SIDE(element, *side)) - draw_element_name(element); - return R_DIR_NOT_FOUND; -} - -static void draw_element_pins_and_pads(ElementType * element) -{ - PAD_LOOP(element); - { - if (doing_pinout || doing_assy || FRONT(pad) || PCB->InvisibleObjectsOn) - draw_pad(pad); - } - END_LOOP; - PIN_LOOP(element); - { - draw_pin(pin, pcb_true); - } - END_LOOP; -} - -static r_dir_t EMark_callback(const BoxType * b, void *cl) -{ - ElementTypePtr element = (ElementTypePtr) b; - - DrawEMark(element, element->MarkX, element->MarkY, !FRONT(element)); - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t hole_callback(const BoxType * b, void *cl) -{ - PinTypePtr pv = (PinTypePtr) b; - int plated = cl ? *(int *) cl : -1; - const char *color; - char buf[sizeof("#XXXXXX")]; - - if ((plated == 0 && !TEST_FLAG(PCB_FLAG_HOLE, pv)) || (plated == 1 && TEST_FLAG(PCB_FLAG_HOLE, pv))) - return R_DIR_FOUND_CONTINUE; - - if (conf_core.editor.thin_draw) { - if (!TEST_FLAG(PCB_FLAG_HOLE, pv)) { - gui->set_line_cap(Output.fgGC, Round_Cap); - gui->set_line_width(Output.fgGC, 0); - gui->draw_arc(Output.fgGC, pv->X, pv->Y, pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360); - } - } - else - gui->fill_circle(Output.bgGC, pv->X, pv->Y, pv->DrillingHole / 2); - - if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { - if (TEST_FLAG(PCB_FLAG_WARN, pv)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED, pv)) - color = PCB->ViaSelectedColor; - else - color = conf_core.appearance.color.black; - - if (TEST_FLAG(PCB_FLAG_ONPOINT, pv)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - gui->set_color(Output.fgGC, color); - - gui->set_line_cap(Output.fgGC, Round_Cap); - gui->set_line_width(Output.fgGC, 0); - gui->draw_arc(Output.fgGC, pv->X, pv->Y, pv->DrillingHole / 2, pv->DrillingHole / 2, 0, 360); - } - return R_DIR_FOUND_CONTINUE; -} - -static void DrawHoles(pcb_bool draw_plated, pcb_bool draw_unplated, const BoxType * drawn_area) -{ - int plated = -1; - - if (draw_plated && !draw_unplated) - plated = 1; - if (!draw_plated && draw_unplated) - plated = 0; - - r_search(PCB->Data->pin_tree, drawn_area, NULL, hole_callback, &plated, NULL); - r_search(PCB->Data->via_tree, drawn_area, NULL, hole_callback, &plated, NULL); -} - -static void _draw_line(LineType * line) -{ - gui->set_line_cap(Output.fgGC, Trace_Cap); - if (conf_core.editor.thin_draw) - gui->set_line_width(Output.fgGC, 0); - else - gui->set_line_width(Output.fgGC, line->Thickness); - - gui->draw_line(Output.fgGC, line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y); -} - -static void draw_line(LayerType * layer, LineType * line) -{ - const char *color; - char buf[sizeof("#XXXXXX")]; - - if (TEST_FLAG(PCB_FLAG_WARN, line)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED | PCB_FLAG_FOUND, line)) { - if (TEST_FLAG(PCB_FLAG_SELECTED, line)) - color = layer->SelectedColor; - else - color = PCB->ConnectedColor; - } - else - color = layer->Color; - - if (TEST_FLAG(PCB_FLAG_ONPOINT, line)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - - gui->set_color(Output.fgGC, color); - _draw_line(line); -} - -static r_dir_t line_callback(const BoxType * b, void *cl) -{ - draw_line((LayerType *) cl, (LineType *) b); - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t rat_callback(const BoxType * b, void *cl) -{ - RatType *rat = (RatType *) b; - - if (TEST_FLAG(PCB_FLAG_SELECTED | PCB_FLAG_FOUND, rat)) { - if (TEST_FLAG(PCB_FLAG_SELECTED, rat)) - gui->set_color(Output.fgGC, PCB->RatSelectedColor); - else - gui->set_color(Output.fgGC, PCB->ConnectedColor); - } - else - gui->set_color(Output.fgGC, PCB->RatColor); - - if (conf_core.appearance.rat_thickness < 20) - rat->Thickness = pixel_slop * conf_core.appearance.rat_thickness; - /* rats.c set PCB_FLAG_VIA if this rat goes to a containing poly: draw a donut */ - if (TEST_FLAG(PCB_FLAG_VIA, rat)) { - int w = rat->Thickness; - - if (conf_core.editor.thin_draw) - gui->set_line_width(Output.fgGC, 0); - else - gui->set_line_width(Output.fgGC, w); - gui->draw_arc(Output.fgGC, rat->Point1.X, rat->Point1.Y, w * 2, w * 2, 0, 360); - } - else - _draw_line((LineType *) rat); - return R_DIR_FOUND_CONTINUE; -} - -static void _draw_arc(ArcType * arc) -{ - if (!arc->Thickness) - return; - - if (conf_core.editor.thin_draw) - gui->set_line_width(Output.fgGC, 0); - else - gui->set_line_width(Output.fgGC, arc->Thickness); - gui->set_line_cap(Output.fgGC, Trace_Cap); - - gui->draw_arc(Output.fgGC, arc->X, arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); -} - -static void draw_arc(LayerType * layer, ArcType * arc) -{ - const char *color; - char buf[sizeof("#XXXXXX")]; - - if (TEST_FLAG(PCB_FLAG_WARN, arc)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED | PCB_FLAG_FOUND, arc)) { - if (TEST_FLAG(PCB_FLAG_SELECTED, arc)) - color = layer->SelectedColor; - else - color = PCB->ConnectedColor; - } - else - color = layer->Color; - - if (TEST_FLAG(PCB_FLAG_ONPOINT, arc)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - gui->set_color(Output.fgGC, color); - _draw_arc(arc); -} - -static r_dir_t arc_callback(const BoxType * b, void *cl) -{ - draw_arc((LayerTypePtr) cl, (ArcTypePtr) b); - return R_DIR_FOUND_CONTINUE; -} - -static void draw_element_package(ElementType * element) -{ - /* set color and draw lines, arcs, text and pins */ - if (doing_pinout || doing_assy) - gui->set_color(Output.fgGC, PCB->ElementColor); - else if (TEST_FLAG(PCB_FLAG_SELECTED, element)) - gui->set_color(Output.fgGC, PCB->ElementSelectedColor); - else if (FRONT(element)) - gui->set_color(Output.fgGC, PCB->ElementColor); - else - gui->set_color(Output.fgGC, PCB->InvisibleObjectsColor); - - /* draw lines, arcs, text and pins */ - ELEMENTLINE_LOOP(element); - { - _draw_line(line); - } - END_LOOP; - ARC_LOOP(element); - { - _draw_arc(arc); - } - END_LOOP; -} - -static r_dir_t element_callback(const BoxType * b, void *cl) -{ - ElementTypePtr element = (ElementTypePtr) b; - int *side = cl; - - if (ON_SIDE(element, *side)) - draw_element_package(element); - return R_DIR_FOUND_CONTINUE; -} - -/* --------------------------------------------------------------------------- - * prints assembly drawing. - */ - -static void PrintAssembly(int side, const BoxType * drawn_area) -{ - int side_group = GetLayerGroupNumberByNumber(max_copper_layer + side); - - doing_assy = pcb_true; - gui->set_draw_faded(Output.fgGC, 1); - DrawLayerGroup(side_group, drawn_area); - gui->set_draw_faded(Output.fgGC, 0); - - /* draw package */ - DrawSilk(side, drawn_area); - doing_assy = pcb_false; -} - -static void DrawEverything_holes(const BoxType * drawn_area) -{ - int plated, unplated; - CountHoles(&plated, &unplated, drawn_area); - - if (plated && gui->set_layer("plated-drill", SL(PDRILL, 0), 0)) { - DrawHoles(pcb_true, pcb_false, drawn_area); - gui->end_layer(); - } - - if (unplated && gui->set_layer("unplated-drill", SL(UDRILL, 0), 0)) { - DrawHoles(pcb_false, pcb_true, drawn_area); - gui->end_layer(); - } -} - -/* --------------------------------------------------------------------------- - * initializes some identifiers for a new zoom factor and redraws whole screen - */ -static void DrawEverything(const BoxType * drawn_area) -{ - int i, ngroups, side; - int component, solder; - /* This is the list of layer groups we will draw. */ - int do_group[MAX_LAYER]; - /* This is the reverse of the order in which we draw them. */ - int drawn_groups[MAX_LAYER]; - - pcb_bool paste_empty; - - PCB->Data->SILKLAYER.Color = PCB->ElementColor; - PCB->Data->BACKSILKLAYER.Color = PCB->InvisibleObjectsColor; - - memset(do_group, 0, sizeof(do_group)); - for (ngroups = 0, i = 0; i < max_copper_layer; i++) { - LayerType *l = LAYER_ON_STACK(i); - int group = GetLayerGroupNumberByNumber(LayerStack[i]); - if (l->On && !do_group[group]) { - do_group[group] = 1; - drawn_groups[ngroups++] = group; - } - } - - component = GetLayerGroupNumberByNumber(component_silk_layer); - solder = GetLayerGroupNumberByNumber(solder_silk_layer); - - /* - * first draw all 'invisible' stuff - */ - if (!conf_core.editor.check_planes - && gui->set_layer("invisible", SL(INVISIBLE, 0), 0)) { - side = SWAP_IDENT ? COMPONENT_LAYER : SOLDER_LAYER; - if (PCB->ElementOn) { - r_search(PCB->Data->element_tree, drawn_area, NULL, element_callback, &side, NULL); - r_search(PCB->Data->name_tree[NAME_INDEX()], drawn_area, NULL, name_callback, &side, NULL); - DrawLayer(&(PCB->Data->Layer[max_copper_layer + side]), drawn_area); - } - r_search(PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side, NULL); - gui->end_layer(); - } - - /* draw all layers in layerstack order */ - for (i = ngroups - 1; i >= 0; i--) { - int group = drawn_groups[i]; - - if (gui->set_layer(0, group, 0)) { - DrawLayerGroup(group, drawn_area); - gui->end_layer(); - } - } - - if (conf_core.editor.check_planes && gui->gui) - return; - - /* Draw pins, pads, vias below silk */ - if (gui->gui) - DrawPPV(SWAP_IDENT ? solder : component, drawn_area); - else if (!gui->holes_after) - DrawEverything_holes(drawn_area); - - /* Draw the solder mask if turned on */ - if (gui->set_layer("componentmask", SL(MASK, TOP), 0)) { - DrawMask(COMPONENT_LAYER, drawn_area); - gui->end_layer(); - } - - if (gui->set_layer("soldermask", SL(MASK, BOTTOM), 0)) { - DrawMask(SOLDER_LAYER, drawn_area); - gui->end_layer(); - } - - if (gui->set_layer("topsilk", SL(SILK, TOP), 0)) { - DrawSilk(COMPONENT_LAYER, drawn_area); - gui->end_layer(); - } - - if (gui->set_layer("bottomsilk", SL(SILK, BOTTOM), 0)) { - DrawSilk(SOLDER_LAYER, drawn_area); - gui->end_layer(); - } - - if (gui->holes_after) - DrawEverything_holes(drawn_area); - - if (gui->gui) { - /* Draw element Marks */ - if (PCB->PinOn) - r_search(PCB->Data->element_tree, drawn_area, NULL, EMark_callback, NULL, NULL); - /* Draw rat lines on top */ - if (gui->set_layer("rats", SL(RATS, 0), 0)) { - DrawRats(drawn_area); - gui->end_layer(); - } - } - - paste_empty = IsPasteEmpty(COMPONENT_LAYER); - if (gui->set_layer("toppaste", SL(PASTE, TOP), paste_empty)) { - DrawPaste(COMPONENT_LAYER, drawn_area); - gui->end_layer(); - } - - paste_empty = IsPasteEmpty(SOLDER_LAYER); - if (gui->set_layer("bottompaste", SL(PASTE, BOTTOM), paste_empty)) { - DrawPaste(SOLDER_LAYER, drawn_area); - gui->end_layer(); - } - - if (gui->set_layer("topassembly", SL(ASSY, TOP), 0)) { - PrintAssembly(COMPONENT_LAYER, drawn_area); - gui->end_layer(); - } - - if (gui->set_layer("bottomassembly", SL(ASSY, BOTTOM), 0)) { - PrintAssembly(SOLDER_LAYER, drawn_area); - gui->end_layer(); - } - - if (gui->set_layer("fab", SL(FAB, 0), 0)) { - DrawFab(Output.fgGC); - gui->end_layer(); - } -} - -static void DrawEMark(ElementTypePtr e, Coord X, Coord Y, pcb_bool invisible) -{ - Coord mark_size = EMARK_SIZE; - if (!PCB->InvisibleObjectsOn && invisible) - return; - - if (pinlist_length(&e->Pin) != 0) { - PinType *pin0 = pinlist_first(&e->Pin); - if (TEST_FLAG(PCB_FLAG_HOLE, pin0)) - mark_size = MIN(mark_size, pin0->DrillingHole / 2); - else - mark_size = MIN(mark_size, pin0->Thickness / 2); - } - - if (padlist_length(&e->Pad) != 0) { - PadType *pad0 = padlist_first(&e->Pad); - mark_size = MIN(mark_size, pad0->Thickness / 2); - } - - gui->set_color(Output.fgGC, invisible ? PCB->InvisibleMarkColor : PCB->ElementColor); - gui->set_line_cap(Output.fgGC, Trace_Cap); - gui->set_line_width(Output.fgGC, 0); - gui->draw_line(Output.fgGC, X - mark_size, Y, X, Y - mark_size); - gui->draw_line(Output.fgGC, X + mark_size, Y, X, Y - mark_size); - gui->draw_line(Output.fgGC, X - mark_size, Y, X, Y + mark_size); - gui->draw_line(Output.fgGC, X + mark_size, Y, X, Y + mark_size); - - /* - * If an element is locked, place a "L" on top of the "diamond". - * This provides a nice visual indication that it is locked that - * works even for color blind users. - */ - if (TEST_FLAG(PCB_FLAG_LOCK, e)) { - gui->draw_line(Output.fgGC, X, Y, X + 2 * mark_size, Y); - gui->draw_line(Output.fgGC, X, Y, X, Y - 4 * mark_size); - } -} - -/* --------------------------------------------------------------------------- - * Draws pins pads and vias - Always draws for non-gui HIDs, - * otherwise drawing depends on PCB->PinOn and PCB->ViaOn - */ -static void DrawPPV(int group, const BoxType * drawn_area) -{ - int component_group = GetLayerGroupNumberByNumber(component_silk_layer); - int solder_group = GetLayerGroupNumberByNumber(solder_silk_layer); - int side; - - if (PCB->PinOn || !gui->gui) { - /* draw element pins */ - r_search(PCB->Data->pin_tree, drawn_area, NULL, pin_callback, NULL, NULL); - - /* draw element pads */ - if (group == component_group) { - side = COMPONENT_LAYER; - r_search(PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side, NULL); - } - - if (group == solder_group) { - side = SOLDER_LAYER; - r_search(PCB->Data->pad_tree, drawn_area, NULL, pad_callback, &side, NULL); - } - } - - /* draw vias */ - if (PCB->ViaOn || !gui->gui) { - r_search(PCB->Data->via_tree, drawn_area, NULL, via_callback, NULL, NULL); - r_search(PCB->Data->via_tree, drawn_area, NULL, hole_callback, NULL, NULL); - } - if (PCB->PinOn || doing_assy) - r_search(PCB->Data->pin_tree, drawn_area, NULL, hole_callback, NULL, NULL); -} - -static r_dir_t clearPin_callback(const BoxType * b, void *cl) -{ - PinType *pin = (PinTypePtr) b; - if (conf_core.editor.thin_draw || conf_core.editor.thin_draw_poly) - gui->thindraw_pcb_pv(Output.pmGC, Output.pmGC, pin, pcb_false, pcb_true); - else - gui->fill_pcb_pv(Output.pmGC, Output.pmGC, pin, pcb_false, pcb_true); - return R_DIR_FOUND_CONTINUE; -} - -struct poly_info { - const BoxType *drawn_area; - LayerType *layer; -}; - -static r_dir_t poly_callback(const BoxType * b, void *cl) -{ - struct poly_info *i = cl; - PolygonType *polygon = (PolygonType *) b; - static const char *color; - char buf[sizeof("#XXXXXX")]; - - if (!polygon->Clipped) - return R_DIR_NOT_FOUND; - - if (TEST_FLAG(PCB_FLAG_WARN, polygon)) - color = PCB->WarnColor; - else if (TEST_FLAG(PCB_FLAG_SELECTED, polygon)) - color = i->layer->SelectedColor; - else if (TEST_FLAG(PCB_FLAG_FOUND, polygon)) - color = PCB->ConnectedColor; - else if (TEST_FLAG(PCB_FLAG_ONPOINT, polygon)) { - assert(color != NULL); - LightenColor(color, buf, 1.75); - color = buf; - } - else - color = i->layer->Color; - gui->set_color(Output.fgGC, color); - - if ((gui->thindraw_pcb_polygon != NULL) && (conf_core.editor.thin_draw || conf_core.editor.thin_draw_poly)) - gui->thindraw_pcb_polygon(Output.fgGC, polygon, i->drawn_area); - else - gui->fill_pcb_polygon(Output.fgGC, polygon, i->drawn_area); - - /* If checking planes, thin-draw any pieces which have been clipped away */ - if (gui->thindraw_pcb_polygon != NULL && conf_core.editor.check_planes && !TEST_FLAG(PCB_FLAG_FULLPOLY, polygon)) { - PolygonType poly = *polygon; - - for (poly.Clipped = polygon->Clipped->f; poly.Clipped != polygon->Clipped; poly.Clipped = poly.Clipped->f) - gui->thindraw_pcb_polygon(Output.fgGC, &poly, i->drawn_area); - } - - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t clearPad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - int *side = cl; - if (ON_SIDE(pad, *side) && pad->Mask) - _draw_pad(Output.pmGC, pad, pcb_true, pcb_true); - return R_DIR_FOUND_CONTINUE; -} - -/* --------------------------------------------------------------------------- - * Draws silk layer. - */ - -static void DrawSilk(int side, const BoxType * drawn_area) -{ -#if 0 - /* This code is used when you want to mask silk to avoid exposed - pins and pads. We decided it was a bad idea to do this - unconditionally, but the code remains. */ -#endif - -#if 0 - if (gui->poly_before) { - gui->use_mask(HID_MASK_BEFORE); -#endif - DrawLayer(LAYER_PTR(max_copper_layer + side), drawn_area); - /* draw package */ - r_search(PCB->Data->element_tree, drawn_area, NULL, element_callback, &side, NULL); - r_search(PCB->Data->name_tree[NAME_INDEX()], drawn_area, NULL, name_callback, &side, NULL); -#if 0 - } - - gui->use_mask(HID_MASK_CLEAR); - r_search(PCB->Data->pin_tree, drawn_area, NULL, clearPin_callback, NULL, NULL); - r_search(PCB->Data->via_tree, drawn_area, NULL, clearPin_callback, NULL, NULL); - r_search(PCB->Data->pad_tree, drawn_area, NULL, clearPad_callback, &side, NULL); - - if (gui->poly_after) { - gui->use_mask(HID_MASK_AFTER); - DrawLayer(LAYER_PTR(max_copper_layer + layer), drawn_area); - /* draw package */ - r_search(PCB->Data->element_tree, drawn_area, NULL, element_callback, &side, NULL); - r_search(PCB->Data->name_tree[NAME_INDEX()], drawn_area, NULL, name_callback, &side, NULL); - } - gui->use_mask(HID_MASK_OFF); -#endif -} - - -static void DrawMaskBoardArea(int mask_type, const BoxType * drawn_area) -{ - /* Skip the mask drawing if the GUI doesn't want this type */ - if ((mask_type == HID_MASK_BEFORE && !gui->poly_before) || (mask_type == HID_MASK_AFTER && !gui->poly_after)) - return; - - gui->use_mask(mask_type); - gui->set_color(Output.fgGC, PCB->MaskColor); - if (drawn_area == NULL) - gui->fill_rect(Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight); - else - gui->fill_rect(Output.fgGC, drawn_area->X1, drawn_area->Y1, drawn_area->X2, drawn_area->Y2); -} - -/* --------------------------------------------------------------------------- - * draws solder mask layer - this will cover nearly everything - */ -static void DrawMask(int side, const BoxType * screen) -{ - int thin = conf_core.editor.thin_draw || conf_core.editor.thin_draw_poly; - - if (thin) - gui->set_color(Output.pmGC, PCB->MaskColor); - else { - DrawMaskBoardArea(HID_MASK_BEFORE, screen); - gui->use_mask(HID_MASK_CLEAR); - } - - r_search(PCB->Data->pin_tree, screen, NULL, clearPin_callback, NULL, NULL); - r_search(PCB->Data->via_tree, screen, NULL, clearPin_callback, NULL, NULL); - r_search(PCB->Data->pad_tree, screen, NULL, clearPad_callback, &side, NULL); - - if (thin) - gui->set_color(Output.pmGC, "erase"); - else { - DrawMaskBoardArea(HID_MASK_AFTER, screen); - gui->use_mask(HID_MASK_OFF); - } -} - -/* --------------------------------------------------------------------------- - * draws solder paste layer for a given side of the board - */ -static void DrawPaste(int side, const BoxType * drawn_area) -{ - gui->set_color(Output.fgGC, PCB->ElementColor); - ALLPAD_LOOP(PCB->Data); - { - if (ON_SIDE(pad, side) && !TEST_FLAG(PCB_FLAG_NOPASTE, pad) && pad->Mask > 0) { - if (pad->Mask < pad->Thickness) - _draw_pad(Output.fgGC, pad, pcb_true, pcb_true); - else - _draw_pad(Output.fgGC, pad, pcb_false, pcb_false); - } - } - ENDALL_LOOP; -} - -static void DrawRats(const BoxType * drawn_area) -{ - /* - * XXX lesstif allows positive AND negative drawing in HID_MASK_CLEAR. - * XXX gtk only allows negative drawing. - * XXX using the mask here is to get rat transparency - */ - int can_mask = strcmp(gui->name, "lesstif") == 0; - - if (can_mask) - gui->use_mask(HID_MASK_CLEAR); - r_search(PCB->Data->rat_tree, drawn_area, NULL, rat_callback, NULL, NULL); - if (can_mask) - gui->use_mask(HID_MASK_OFF); -} - -static r_dir_t text_callback(const BoxType * b, void *cl) -{ - LayerType *layer = cl; - TextType *text = (TextType *) b; - int min_silk_line; - - if (TEST_FLAG(PCB_FLAG_SELECTED, text)) - gui->set_color(Output.fgGC, layer->SelectedColor); - else - gui->set_color(Output.fgGC, layer->Color); - if (layer == &PCB->Data->SILKLAYER || layer == &PCB->Data->BACKSILKLAYER) - min_silk_line = PCB->minSlk; - else - min_silk_line = PCB->minWid; - DrawTextLowLevel(text, min_silk_line); - return R_DIR_FOUND_CONTINUE; -} - -void DrawLayer(LayerTypePtr Layer, const BoxType * screen) -{ - struct poly_info info; - - info.drawn_area = screen; - info.layer = Layer; - - /* print the non-clearing polys */ - r_search(Layer->polygon_tree, screen, NULL, poly_callback, &info, NULL); - - if (conf_core.editor.check_planes) - return; - - /* draw all visible lines this layer */ - r_search(Layer->line_tree, screen, NULL, line_callback, Layer, NULL); - - /* draw the layer arcs on screen */ - r_search(Layer->arc_tree, screen, NULL, arc_callback, Layer, NULL); - - /* draw the layer text on screen */ - r_search(Layer->text_tree, screen, NULL, text_callback, Layer, NULL); - - /* We should check for gui->gui here, but it's kinda cool seeing the - auto-outline magically disappear when you first add something to - the "outline" layer. */ - if (IsLayerEmpty(Layer) - && (strcmp(Layer->Name, "outline") == 0 || strcmp(Layer->Name, "route") == 0)) { - gui->set_color(Output.fgGC, Layer->Color); - gui->set_line_width(Output.fgGC, PCB->minWid); - gui->draw_rect(Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight); - } -} - -/* --------------------------------------------------------------------------- - * draws one layer group. If the exporter is not a GUI, - * also draws the pins / pads / vias in this layer group. - */ -static void DrawLayerGroup(int group, const BoxType * drawn_area) -{ - int i, rv = 1; - int layernum; - LayerTypePtr Layer; - int n_entries = PCB->LayerGroups.Number[group]; - pcb_cardinal_t *layers = PCB->LayerGroups.Entries[group]; - - for (i = n_entries - 1; i >= 0; i--) { - layernum = layers[i]; - Layer = PCB->Data->Layer + layers[i]; - if (strcmp(Layer->Name, "outline") == 0 || strcmp(Layer->Name, "route") == 0) - rv = 0; - if (layernum < max_copper_layer && Layer->On) - DrawLayer(Layer, drawn_area); - } - if (n_entries > 1) - rv = 1; - - if (rv && !gui->gui) - DrawPPV(group, drawn_area); -} - -static void GatherPVName(PinTypePtr Ptr) -{ - BoxType box; - pcb_bool vert = TEST_FLAG(PCB_FLAG_EDGE2, Ptr); - - if (vert) { - box.X1 = Ptr->X - Ptr->Thickness / 2 + conf_core.appearance.pinout.text_offset_y; - box.Y1 = Ptr->Y - Ptr->DrillingHole / 2 - conf_core.appearance.pinout.text_offset_x; - } - else { - box.X1 = Ptr->X + Ptr->DrillingHole / 2 + conf_core.appearance.pinout.text_offset_x; - box.Y1 = Ptr->Y - Ptr->Thickness / 2 + conf_core.appearance.pinout.text_offset_y; - } - - if (vert) { - box.X2 = box.X1; - box.Y2 = box.Y1; - } - else { - box.X2 = box.X1; - box.Y2 = box.Y1; - } - AddPart(&box); -} - -static void GatherPadName(PadTypePtr Pad) -{ - BoxType box; - pcb_bool vert; - - /* should text be vertical ? */ - vert = (Pad->Point1.X == Pad->Point2.X); - - if (vert) { - box.X1 = Pad->Point1.X - Pad->Thickness / 2; - box.Y1 = MAX(Pad->Point1.Y, Pad->Point2.Y) + Pad->Thickness / 2; - box.X1 += conf_core.appearance.pinout.text_offset_y; - box.Y1 -= conf_core.appearance.pinout.text_offset_x; - box.X2 = box.X1; - box.Y2 = box.Y1; - } - else { - box.X1 = MIN(Pad->Point1.X, Pad->Point2.X) - Pad->Thickness / 2; - box.Y1 = Pad->Point1.Y - Pad->Thickness / 2; - box.X1 += conf_core.appearance.pinout.text_offset_x; - box.Y1 += conf_core.appearance.pinout.text_offset_y; - box.X2 = box.X1; - box.Y2 = box.Y1; - } - - AddPart(&box); - return; -} - -/* --------------------------------------------------------------------------- - * lowlevel drawing routine for text objects - */ -void DrawTextLowLevel(TextTypePtr Text, Coord min_line_width) -{ - Coord x = 0; - unsigned char *string = (unsigned char *) Text->TextString; - pcb_cardinal_t n; - FontTypePtr font = &PCB->Font; - - while (string && *string) { - /* draw lines if symbol is valid and data is present */ - if (*string <= MAX_FONTPOSITION && font->Symbol[*string].Valid) { - LineTypePtr line = font->Symbol[*string].Line; - LineType newline; - - for (n = font->Symbol[*string].LineN; n; n--, line++) { - /* create one line, scale, move, rotate and swap it */ - newline = *line; - newline.Point1.X = PCB_SCALE_TEXT(newline.Point1.X + x, Text->Scale); - newline.Point1.Y = PCB_SCALE_TEXT(newline.Point1.Y, Text->Scale); - newline.Point2.X = PCB_SCALE_TEXT(newline.Point2.X + x, Text->Scale); - newline.Point2.Y = PCB_SCALE_TEXT(newline.Point2.Y, Text->Scale); - newline.Thickness = PCB_SCALE_TEXT(newline.Thickness, Text->Scale / 2); - if (newline.Thickness < min_line_width) - newline.Thickness = min_line_width; - - RotateLineLowLevel(&newline, 0, 0, Text->Direction); - - /* the labels of SMD objects on the bottom - * side haven't been swapped yet, only their offset - */ - if (TEST_FLAG(PCB_FLAG_ONSOLDER, Text)) { - newline.Point1.X = SWAP_SIGN_X(newline.Point1.X); - newline.Point1.Y = SWAP_SIGN_Y(newline.Point1.Y); - newline.Point2.X = SWAP_SIGN_X(newline.Point2.X); - newline.Point2.Y = SWAP_SIGN_Y(newline.Point2.Y); - } - /* add offset and draw line */ - newline.Point1.X += Text->X; - newline.Point1.Y += Text->Y; - newline.Point2.X += Text->X; - newline.Point2.Y += Text->Y; - _draw_line(&newline); - } - - /* move on to next cursor position */ - x += (font->Symbol[*string].Width + font->Symbol[*string].Delta); - } - else { - /* the default symbol is a filled box */ - BoxType defaultsymbol = PCB->Font.DefaultSymbol; - Coord size = (defaultsymbol.X2 - defaultsymbol.X1) * 6 / 5; - - defaultsymbol.X1 = PCB_SCALE_TEXT(defaultsymbol.X1 + x, Text->Scale); - defaultsymbol.Y1 = PCB_SCALE_TEXT(defaultsymbol.Y1, Text->Scale); - defaultsymbol.X2 = PCB_SCALE_TEXT(defaultsymbol.X2 + x, Text->Scale); - defaultsymbol.Y2 = PCB_SCALE_TEXT(defaultsymbol.Y2, Text->Scale); - - RotateBoxLowLevel(&defaultsymbol, 0, 0, Text->Direction); - - /* add offset and draw box */ - defaultsymbol.X1 += Text->X; - defaultsymbol.Y1 += Text->Y; - defaultsymbol.X2 += Text->X; - defaultsymbol.Y2 += Text->Y; - gui->fill_rect(Output.fgGC, defaultsymbol.X1, defaultsymbol.Y1, defaultsymbol.X2, defaultsymbol.Y2); - - /* move on to next cursor position */ - x += size; - } - string++; - } -} - -/* --------------------------------------------------------------------------- - * draw a via object - */ -void DrawVia(PinTypePtr Via) -{ - AddPart(Via); - if (!TEST_FLAG(PCB_FLAG_HOLE, Via) && TEST_FLAG(PCB_FLAG_DISPLAYNAME, Via)) - DrawViaName(Via); -} - -/* --------------------------------------------------------------------------- - * draws the name of a via - */ -void DrawViaName(PinTypePtr Via) -{ - GatherPVName(Via); -} - -/* --------------------------------------------------------------------------- - * draw a pin object - */ -void DrawPin(PinTypePtr Pin) -{ - AddPart(Pin); - if ((!TEST_FLAG(PCB_FLAG_HOLE, Pin) && TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pin)) - || doing_pinout) - DrawPinName(Pin); -} - -/* --------------------------------------------------------------------------- - * draws the name of a pin - */ -void DrawPinName(PinTypePtr Pin) -{ - GatherPVName(Pin); -} - -/* --------------------------------------------------------------------------- - * draw a pad object - */ -void DrawPad(PadTypePtr Pad) -{ - AddPart(Pad); - if (doing_pinout || TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pad)) - DrawPadName(Pad); -} - -/* --------------------------------------------------------------------------- - * draws the name of a pad - */ -void DrawPadName(PadTypePtr Pad) -{ - GatherPadName(Pad); -} - -/* --------------------------------------------------------------------------- - * draws a line on a layer - */ -void DrawLine(LayerTypePtr Layer, LineTypePtr Line) -{ - AddPart(Line); -} - -/* --------------------------------------------------------------------------- - * draws a ratline - */ -void DrawRat(RatTypePtr Rat) -{ - if (conf_core.appearance.rat_thickness < 20) - Rat->Thickness = pixel_slop * conf_core.appearance.rat_thickness; - /* rats.c set PCB_FLAG_VIA if this rat goes to a containing poly: draw a donut */ - if (TEST_FLAG(PCB_FLAG_VIA, Rat)) { - Coord w = Rat->Thickness; - - BoxType b; - - b.X1 = Rat->Point1.X - w * 2 - w / 2; - b.X2 = Rat->Point1.X + w * 2 + w / 2; - b.Y1 = Rat->Point1.Y - w * 2 - w / 2; - b.Y2 = Rat->Point1.Y + w * 2 + w / 2; - AddPart(&b); - } - else - DrawLine(NULL, (LineType *) Rat); -} - -/* --------------------------------------------------------------------------- - * draws an arc on a layer - */ -void DrawArc(LayerTypePtr Layer, ArcTypePtr Arc) -{ - AddPart(Arc); -} - -/* --------------------------------------------------------------------------- - * draws a text on a layer - */ -void DrawText(LayerTypePtr Layer, TextTypePtr Text) -{ - AddPart(Text); -} - - -/* --------------------------------------------------------------------------- - * draws a polygon on a layer - */ -void DrawPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - AddPart(Polygon); -} - -/* --------------------------------------------------------------------------- - * draws an element - */ -void DrawElement(ElementTypePtr Element) -{ - DrawElementPackage(Element); - DrawElementName(Element); - DrawElementPinsAndPads(Element); -} - -/* --------------------------------------------------------------------------- - * draws the name of an element - */ -void DrawElementName(ElementTypePtr Element) -{ - if (TEST_FLAG(PCB_FLAG_HIDENAME, Element)) - return; - DrawText(NULL, &ELEMENT_TEXT(PCB, Element)); -} - -/* --------------------------------------------------------------------------- - * draws the package of an element - */ -void DrawElementPackage(ElementTypePtr Element) -{ - ELEMENTLINE_LOOP(Element); - { - DrawLine(NULL, line); - } - END_LOOP; - ARC_LOOP(Element); - { - DrawArc(NULL, arc); - } - END_LOOP; -} - -/* --------------------------------------------------------------------------- - * draw pins of an element - */ -void DrawElementPinsAndPads(ElementTypePtr Element) -{ - PAD_LOOP(Element); - { - if (doing_pinout || doing_assy || FRONT(pad) || PCB->InvisibleObjectsOn) - DrawPad(pad); - } - END_LOOP; - PIN_LOOP(Element); - { - DrawPin(pin); - } - END_LOOP; -} - -void EraseFlags(FlagType * f) -{ - unknown_flag_t *u, *next; - for (u = f->unknowns; u != NULL; u = next) { - free(u->str); - next = u->next; - free(u); - } - f->unknowns = NULL; -} - -/* --------------------------------------------------------------------------- - * erase a via - */ -void EraseVia(PinTypePtr Via) -{ - AddPart(Via); - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Via)) - EraseViaName(Via); - EraseFlags(&Via->Flags); -} - -/* --------------------------------------------------------------------------- - * erase a ratline - */ -void EraseRat(RatTypePtr Rat) -{ - if (TEST_FLAG(PCB_FLAG_VIA, Rat)) { - Coord w = Rat->Thickness; - - BoxType b; - - b.X1 = Rat->Point1.X - w * 2 - w / 2; - b.X2 = Rat->Point1.X + w * 2 + w / 2; - b.Y1 = Rat->Point1.Y - w * 2 - w / 2; - b.Y2 = Rat->Point1.Y + w * 2 + w / 2; - AddPart(&b); - } - else - EraseLine((LineType *) Rat); - EraseFlags(&Rat->Flags); -} - - -/* --------------------------------------------------------------------------- - * erase a via name - */ -void EraseViaName(PinTypePtr Via) -{ - GatherPVName(Via); -} - -/* --------------------------------------------------------------------------- - * erase a pad object - */ -void ErasePad(PadTypePtr Pad) -{ - AddPart(Pad); - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pad)) - ErasePadName(Pad); - EraseFlags(&Pad->Flags); -} - -/* --------------------------------------------------------------------------- - * erase a pad name - */ -void ErasePadName(PadTypePtr Pad) -{ - GatherPadName(Pad); -} - -/* --------------------------------------------------------------------------- - * erase a pin object - */ -void ErasePin(PinTypePtr Pin) -{ - AddPart(Pin); - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pin)) - ErasePinName(Pin); - EraseFlags(&Pin->Flags); -} - -/* --------------------------------------------------------------------------- - * erase a pin name - */ -void ErasePinName(PinTypePtr Pin) -{ - GatherPVName(Pin); -} - -/* --------------------------------------------------------------------------- - * erases a line on a layer - */ -void EraseLine(LineTypePtr Line) -{ - AddPart(Line); - EraseFlags(&Line->Flags); -} - -/* --------------------------------------------------------------------------- - * erases an arc on a layer - */ -void EraseArc(ArcTypePtr Arc) -{ - if (!Arc->Thickness) - return; - AddPart(Arc); - EraseFlags(&Arc->Flags); -} - -/* --------------------------------------------------------------------------- - * erases a text on a layer - */ -void EraseText(LayerTypePtr Layer, TextTypePtr Text) -{ - r_delete_entry(Layer->text_tree, (BoxTypePtr)Text); - AddPart(Text); -} - -/* --------------------------------------------------------------------------- - * erases a polygon on a layer - */ -void ErasePolygon(PolygonTypePtr Polygon) -{ - AddPart(Polygon); - EraseFlags(&Polygon->Flags); -} - -/* --------------------------------------------------------------------------- - * erases an element - */ -void EraseElement(ElementTypePtr Element) -{ - ELEMENTLINE_LOOP(Element); - { - EraseLine(line); - } - END_LOOP; - ARC_LOOP(Element); - { - EraseArc(arc); - } - END_LOOP; - EraseElementName(Element); - EraseElementPinsAndPads(Element); - EraseFlags(&Element->Flags); -} - -/* --------------------------------------------------------------------------- - * erases all pins and pads of an element - */ -void EraseElementPinsAndPads(ElementTypePtr Element) -{ - PIN_LOOP(Element); - { - ErasePin(pin); - } - END_LOOP; - PAD_LOOP(Element); - { - ErasePad(pad); - } - END_LOOP; -} - -/* --------------------------------------------------------------------------- - * erases the name of an element - */ -void EraseElementName(ElementTypePtr Element) -{ - if (TEST_FLAG(PCB_FLAG_HIDENAME, Element)) { - return; - } - DrawText(NULL, &ELEMENT_TEXT(PCB, Element)); -} - - -void EraseObject(int type, void *lptr, void *ptr) -{ - switch (type) { - case PCB_TYPE_VIA: - case PCB_TYPE_PIN: - ErasePin((PinTypePtr) ptr); - break; - case PCB_TYPE_TEXT: - case PCB_TYPE_ELEMENT_NAME: - EraseText((LayerTypePtr) lptr, (TextTypePtr) ptr); - break; - case PCB_TYPE_POLYGON: - ErasePolygon((PolygonTypePtr) ptr); - break; - case PCB_TYPE_ELEMENT: - EraseElement((ElementTypePtr) ptr); - break; - case PCB_TYPE_LINE: - case PCB_TYPE_ELEMENT_LINE: - case PCB_TYPE_RATLINE: - EraseLine((LineTypePtr) ptr); - break; - case PCB_TYPE_PAD: - ErasePad((PadTypePtr) ptr); - break; - case PCB_TYPE_ARC: - case PCB_TYPE_ELEMENT_ARC: - EraseArc((ArcTypePtr) ptr); - break; - default: - Message(PCB_MSG_DEFAULT, "hace: Internal ERROR, trying to erase an unknown type\n"); - } -} - - -void DrawObject(int type, void *ptr1, void *ptr2) -{ - switch (type) { - case PCB_TYPE_VIA: - if (PCB->ViaOn) - DrawVia((PinTypePtr) ptr2); - break; - case PCB_TYPE_LINE: - if (((LayerTypePtr) ptr1)->On) - DrawLine((LayerTypePtr) ptr1, (LineTypePtr) ptr2); - break; - case PCB_TYPE_ARC: - if (((LayerTypePtr) ptr1)->On) - DrawArc((LayerTypePtr) ptr1, (ArcTypePtr) ptr2); - break; - case PCB_TYPE_TEXT: - if (((LayerTypePtr) ptr1)->On) - DrawText((LayerTypePtr) ptr1, (TextTypePtr) ptr2); - break; - case PCB_TYPE_POLYGON: - if (((LayerTypePtr) ptr1)->On) - DrawPolygon((LayerTypePtr) ptr1, (PolygonTypePtr) ptr2); - break; - case PCB_TYPE_ELEMENT: - if (PCB->ElementOn && (FRONT((ElementTypePtr) ptr2) || PCB->InvisibleObjectsOn)) - DrawElement((ElementTypePtr) ptr2); - break; - case PCB_TYPE_RATLINE: - if (PCB->RatOn) - DrawRat((RatTypePtr) ptr2); - break; - case PCB_TYPE_PIN: - if (PCB->PinOn) - DrawPin((PinTypePtr) ptr2); - break; - case PCB_TYPE_PAD: - if (PCB->PinOn) - DrawPad((PadTypePtr) ptr2); - break; - case PCB_TYPE_ELEMENT_NAME: - if (PCB->ElementOn && (FRONT((ElementTypePtr) ptr2) || PCB->InvisibleObjectsOn)) - DrawElementName((ElementTypePtr) ptr1); - break; - } -} - -static void draw_element(ElementTypePtr element) -{ - draw_element_package(element); - draw_element_name(element); - draw_element_pins_and_pads(element); -} - -/* --------------------------------------------------------------------------- - * HID drawing callback. - */ - -void hid_expose_callback(HID * hid, BoxType * region, void *item) -{ - HID *old_gui = gui; - - gui = hid; - Output.fgGC = gui->make_gc(); - Output.bgGC = gui->make_gc(); - Output.pmGC = gui->make_gc(); - - hid->set_color(Output.pmGC, "erase"); - hid->set_color(Output.bgGC, "drill"); - - if (item) { - doing_pinout = pcb_true; - draw_element((ElementType *) item); - doing_pinout = pcb_false; - } - else - DrawEverything(region); - - gui->destroy_gc(Output.fgGC); - gui->destroy_gc(Output.bgGC); - gui->destroy_gc(Output.pmGC); - gui = old_gui; -} Index: 1.1.4/src/rotate.c =================================================================== --- 1.1.4/src/rotate.c (revision 10776) +++ 1.1.4/src/rotate.c (nonexistent) @@ -1,389 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* functions used to rotate pins, elements ... - */ - -#include "config.h" - -#include - -#include "data.h" -#include "draw.h" -#include "error.h" -#include "misc.h" -#include "polygon.h" -#include "rotate.h" -#include "rtree.h" -#include "rubberband.h" -#include "search.h" -#include "select.h" -#include "set.h" -#include "undo.h" -#include "conf_core.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void *RotateText(LayerTypePtr, TextTypePtr); -static void *RotateArc(LayerTypePtr, ArcTypePtr); -static void *RotateElement(ElementTypePtr); -static void *RotateElementName(ElementTypePtr); -static void *RotateLinePoint(LayerTypePtr, LineTypePtr, PointTypePtr); - -/* ---------------------------------------------------------------------- - * some local identifiers - */ -static Coord CenterX, CenterY; /* center of rotation */ -static unsigned Number; /* number of rotations */ -static ObjectFunctionType RotateFunctions = { - NULL, - RotateText, - NULL, - NULL, - RotateElement, - RotateElementName, - NULL, - NULL, - RotateLinePoint, - NULL, - RotateArc, - NULL -}; - -/* --------------------------------------------------------------------------- - * rotates a point in 90 degree steps - */ -void RotatePointLowLevel(PointTypePtr Point, Coord X, Coord Y, unsigned Number) -{ - ROTATE(Point->X, Point->Y, X, Y, Number); -} - -/* --------------------------------------------------------------------------- - * rotates a line in 90 degree steps - */ -void RotateLineLowLevel(LineTypePtr Line, Coord X, Coord Y, unsigned Number) -{ - ROTATE(Line->Point1.X, Line->Point1.Y, X, Y, Number); - ROTATE(Line->Point2.X, Line->Point2.Y, X, Y, Number); - /* keep horizontal, vertical Point2 > Point1 */ - if (Line->Point1.X == Line->Point2.X) { - if (Line->Point1.Y > Line->Point2.Y) { - Coord t; - t = Line->Point1.Y; - Line->Point1.Y = Line->Point2.Y; - Line->Point2.Y = t; - } - } - else if (Line->Point1.Y == Line->Point2.Y) { - if (Line->Point1.X > Line->Point2.X) { - Coord t; - t = Line->Point1.X; - Line->Point1.X = Line->Point2.X; - Line->Point2.X = t; - } - } - /* instead of rotating the bounding box, the call updates both end points too */ - SetLineBoundingBox(Line); -} - -/* --------------------------------------------------------------------------- - * rotates a text in 90 degree steps - * only the bounding box is rotated, text rotation itself - * is done by the drawing routines - */ -void RotateTextLowLevel(TextTypePtr Text, Coord X, Coord Y, unsigned Number) -{ - pcb_uint8_t number; - - number = TEST_FLAG(PCB_FLAG_ONSOLDER, Text) ? (4 - Number) & 3 : Number; - RotateBoxLowLevel(&Text->BoundingBox, X, Y, Number); - ROTATE(Text->X, Text->Y, X, Y, Number); - - /* set new direction, 0..3, - * 0-> to the right, 1-> straight up, - * 2-> to the left, 3-> straight down - */ - Text->Direction = ((Text->Direction + number) & 0x03); -} - -/* --------------------------------------------------------------------------- - * rotates a polygon in 90 degree steps - */ -void RotatePolygonLowLevel(PolygonTypePtr Polygon, Coord X, Coord Y, unsigned Number) -{ - POLYGONPOINT_LOOP(Polygon); - { - ROTATE(point->X, point->Y, X, Y, Number); - } - END_LOOP; - RotateBoxLowLevel(&Polygon->BoundingBox, X, Y, Number); -} - -/* --------------------------------------------------------------------------- - * rotates a text object and redraws it - */ -static void *RotateText(LayerTypePtr Layer, TextTypePtr Text) -{ - EraseText(Layer, Text); - RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - r_delete_entry(Layer->text_tree, (BoxTypePtr) Text); - RotateTextLowLevel(Text, CenterX, CenterY, Number); - r_insert_entry(Layer->text_tree, (BoxTypePtr) Text, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - DrawText(Layer, Text); - Draw(); - return (Text); -} - -/* --------------------------------------------------------------------------- - * rotates an arc - */ -void RotateArcLowLevel(ArcTypePtr Arc, Coord X, Coord Y, unsigned Number) -{ - Coord save; - - /* add Number*90 degrees (i.e., Number quarter-turns) */ - Arc->StartAngle = NormalizeAngle(Arc->StartAngle + Number * 90); - ROTATE(Arc->X, Arc->Y, X, Y, Number); - - /* now change width and height */ - if (Number == 1 || Number == 3) { - save = Arc->Width; - Arc->Width = Arc->Height; - Arc->Height = save; - } - RotateBoxLowLevel(&Arc->BoundingBox, X, Y, Number); -} - -/* --------------------------------------------------------------------------- - * rotate an element in 90 degree steps - */ -void RotateElementLowLevel(DataTypePtr Data, ElementTypePtr Element, Coord X, Coord Y, unsigned Number) -{ - /* solder side objects need a different orientation */ - - /* the text subroutine decides by itself if the direction - * is to be corrected - */ - ELEMENTTEXT_LOOP(Element); - { - if (Data && Data->name_tree[n]) - r_delete_entry(Data->name_tree[n], (BoxType *) text); - RotateTextLowLevel(text, X, Y, Number); - } - END_LOOP; - ELEMENTLINE_LOOP(Element); - { - RotateLineLowLevel(line, X, Y, Number); - } - END_LOOP; - PIN_LOOP(Element); - { - /* pre-delete the pins from the pin-tree before their coordinates change */ - if (Data) - r_delete_entry(Data->pin_tree, (BoxType *) pin); - RestoreToPolygon(Data, PCB_TYPE_PIN, Element, pin); - ROTATE_PIN_LOWLEVEL(pin, X, Y, Number); - } - END_LOOP; - PAD_LOOP(Element); - { - /* pre-delete the pads before their coordinates change */ - if (Data) - r_delete_entry(Data->pad_tree, (BoxType *) pad); - RestoreToPolygon(Data, PCB_TYPE_PAD, Element, pad); - ROTATE_PAD_LOWLEVEL(pad, X, Y, Number); - } - END_LOOP; - ARC_LOOP(Element); - { - RotateArcLowLevel(arc, X, Y, Number); - } - END_LOOP; - ROTATE(Element->MarkX, Element->MarkY, X, Y, Number); - /* SetElementBoundingBox reenters the rtree data */ - SetElementBoundingBox(Data, Element, &PCB->Font); - ClearFromPolygon(Data, PCB_TYPE_ELEMENT, Element, Element); -} - -/* --------------------------------------------------------------------------- - * rotates a line's point - */ -static void *RotateLinePoint(LayerTypePtr Layer, LineTypePtr Line, PointTypePtr Point) -{ - EraseLine(Line); - if (Layer) { - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); - } - else - r_delete_entry(PCB->Data->rat_tree, (BoxTypePtr) Line); - RotatePointLowLevel(Point, CenterX, CenterY, Number); - SetLineBoundingBox(Line); - if (Layer) { - r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - DrawLine(Layer, Line); - } - else { - r_insert_entry(PCB->Data->rat_tree, (BoxTypePtr) Line, 0); - DrawRat((RatTypePtr) Line); - } - Draw(); - return (Line); -} - -/* --------------------------------------------------------------------------- - * rotates an arc - */ -static void *RotateArc(LayerTypePtr Layer, ArcTypePtr Arc) -{ - EraseArc(Arc); - r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); - RotateArcLowLevel(Arc, CenterX, CenterY, Number); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); - DrawArc(Layer, Arc); - Draw(); - return (Arc); -} - -/* --------------------------------------------------------------------------- - * rotates an element - */ -static void *RotateElement(ElementTypePtr Element) -{ - EraseElement(Element); - RotateElementLowLevel(PCB->Data, Element, CenterX, CenterY, Number); - DrawElement(Element); - Draw(); - return (Element); -} - -/* ---------------------------------------------------------------------- - * rotates the name of an element - */ -static void *RotateElementName(ElementTypePtr Element) -{ - EraseElementName(Element); - ELEMENTTEXT_LOOP(Element); - { - r_delete_entry(PCB->Data->name_tree[n], (BoxType *) text); - RotateTextLowLevel(text, CenterX, CenterY, Number); - r_insert_entry(PCB->Data->name_tree[n], (BoxType *) text, 0); - } - END_LOOP; - DrawElementName(Element); - Draw(); - return (Element); -} - -/* --------------------------------------------------------------------------- - * rotates a box in 90 degree steps - */ -void RotateBoxLowLevel(BoxTypePtr Box, Coord X, Coord Y, unsigned Number) -{ - Coord x1 = Box->X1, y1 = Box->Y1, x2 = Box->X2, y2 = Box->Y2; - - ROTATE(x1, y1, X, Y, Number); - ROTATE(x2, y2, X, Y, Number); - Box->X1 = MIN(x1, x2); - Box->Y1 = MIN(y1, y2); - Box->X2 = MAX(x1, x2); - Box->Y2 = MAX(y1, y2); -} - -/* ---------------------------------------------------------------------- - * rotates an objects at the cursor position as identified by its ID - * the center of rotation is determined by the current cursor location - */ -void *RotateObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord X, Coord Y, unsigned Steps) -{ - RubberbandTypePtr ptr; - void *ptr2; - pcb_bool changed = pcb_false; - - /* setup default global identifiers */ - Number = Steps; - CenterX = X; - CenterY = Y; - - /* move all the rubberband lines... and reset the counter */ - ptr = Crosshair.AttachedObject.Rubberband; - while (Crosshair.AttachedObject.RubberbandN) { - changed = pcb_true; - CLEAR_FLAG(PCB_FLAG_RUBBEREND, ptr->Line); - AddObjectToRotateUndoList(PCB_TYPE_LINE_POINT, ptr->Layer, ptr->Line, ptr->MovedPoint, CenterX, CenterY, Steps); - EraseLine(ptr->Line); - if (ptr->Layer) { - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, ptr->Layer, ptr->Line); - r_delete_entry(ptr->Layer->line_tree, (BoxType *) ptr->Line); - } - else - r_delete_entry(PCB->Data->rat_tree, (BoxType *) ptr->Line); - RotatePointLowLevel(ptr->MovedPoint, CenterX, CenterY, Steps); - SetLineBoundingBox(ptr->Line); - if (ptr->Layer) { - r_insert_entry(ptr->Layer->line_tree, (BoxType *) ptr->Line, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, ptr->Layer, ptr->Line); - DrawLine(ptr->Layer, ptr->Line); - } - else { - r_insert_entry(PCB->Data->rat_tree, (BoxType *) ptr->Line, 0); - DrawRat((RatTypePtr) ptr->Line); - } - Crosshair.AttachedObject.RubberbandN--; - ptr++; - } - AddObjectToRotateUndoList(Type, Ptr1, Ptr2, Ptr3, CenterX, CenterY, Number); - ptr2 = ObjectOperation(&RotateFunctions, Type, Ptr1, Ptr2, Ptr3); - changed |= (ptr2 != NULL); - if (changed) { - Draw(); - IncrementUndoSerialNumber(); - } - return (ptr2); -} - -void RotateScreenObject(Coord X, Coord Y, unsigned Steps) -{ - int type; - void *ptr1, *ptr2, *ptr3; - if ((type = SearchScreen(X, Y, ROTATE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { - if (TEST_FLAG(PCB_FLAG_LOCK, (ArcTypePtr) ptr2)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - return; - } - Crosshair.AttachedObject.RubberbandN = 0; - if (conf_core.editor.rubber_band_mode) - LookupRubberbandLines(type, ptr1, ptr2, ptr3); - if (type == PCB_TYPE_ELEMENT) - LookupRatLines(type, ptr1, ptr2, ptr3); - RotateObject(type, ptr1, ptr2, ptr3, X, Y, Steps); - SetChangedFlag(pcb_true); - } -} Index: 1.1.4/src/error.h =================================================================== --- 1.1.4/src/error.h (revision 10776) +++ 1.1.4/src/error.h (nonexistent) @@ -1,59 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for error and debug functions */ - -#ifndef PCB_ERROR_H -#define PCB_ERROR_H - -/* Common return codes. */ -#define STATUS_OK 0 -#define STATUS_BREAK 1 -#define STATUS_ERROR -1 - -typedef enum pcb_message_level { - /* MSG_DEFAULT is the default level when a message is not converted yet - to any of the levels below. This level will go away once all messages - are converted. Please grep for this and convert the message to the - more specific. */ - PCB_MSG_DEFAULT = 1, - - PCB_MSG_DEBUG = 0, /* Debug message. Should probably not be shown in regular operation. */ - PCB_MSG_INFO, /* Info message. FYI for the user, no action needed. */ - PCB_MSG_WARNING, /* Something the user should probably take note */ - PCB_MSG_ERROR /* Couldn't finish an action, needs user attention. */ -} pcb_message_level_t; - -void Message(enum pcb_message_level level, const char *Format, ...); -void MyFatal(const char *Format, ...); -void OpenErrorMessage(const char *); -void PopenErrorMessage(const char *); -void OpendirErrorMessage(const char *); -void ChdirErrorMessage(const char *); -void CatchSignal(int); -void pcb_trace(const char *Format, ...); - -#endif Index: 1.1.4/src/rats_act.c =================================================================== --- 1.1.4/src/rats_act.c (revision 10776) +++ 1.1.4/src/rats_act.c (nonexistent) @@ -1,225 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" - -#include "data.h" -#include "action_helper.h" -#include "error.h" -#include "undo.h" -#include "set.h" -#include "misc.h" -#include "find.h" -#include "remove.h" -#include "funchash_core.h" - -#include "rats.h" -#include "draw.h" - -/* --------------------------------------------------------------------------- */ - -static const char addrats_syntax[] = "AddRats(AllRats|SelectedRats|Close)"; - -static const char addrats_help[] = "Add one or more rat lines to the board."; - -/* %start-doc actions AddRats - -@table @code - -@item AllRats -Create rat lines for all loaded nets that aren't already connected on -with copper. - -@item SelectedRats -Similarly, but only add rat lines for nets connected to selected pins -and pads. - -@item Close -Selects the shortest unselected rat on the board. - -@end table - -%end-doc */ - -static int ActionAddRats(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - RatTypePtr shorty; - float len, small; - - if (function) { - if (conf_core.temp.rat_warn) - ClearWarnings(); - switch (funchash_get(function, NULL)) { - case F_AllRats: - if (AddAllRats(pcb_false, NULL)) - SetChangedFlag(pcb_true); - break; - case F_SelectedRats: - case F_Selected: - if (AddAllRats(pcb_true, NULL)) - SetChangedFlag(pcb_true); - break; - case F_Close: - small = SQUARE(MAX_COORD); - shorty = NULL; - RAT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, line)) - continue; - len = SQUARE(line->Point1.X - line->Point2.X) + SQUARE(line->Point1.Y - line->Point2.Y); - if (len < small) { - small = len; - shorty = line; - } - } - END_LOOP; - if (shorty) { - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, shorty, shorty, shorty); - SET_FLAG(PCB_FLAG_SELECTED, shorty); - DrawRat(shorty); - Draw(); - CenterDisplay((shorty->Point2.X + shorty->Point1.X) / 2, (shorty->Point2.Y + shorty->Point1.Y) / 2); - } - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char connection_syntax[] = "Connection(Find|ResetLinesAndPolygons|ResetPinsAndVias|Reset)"; - -static const char connection_help[] = "Searches connections of the object at the cursor position."; - -/* %start-doc actions Connection - -Connections found with this action will be highlighted in the -``connected-color'' color and will have the ``found'' flag set. - -@table @code - -@item Find -The net under the cursor is ``found''. - -@item ResetLinesAndPolygons -Any ``found'' lines and polygons are marked ``not found''. - -@item ResetPinsAndVias -Any ``found'' pins and vias are marked ``not found''. - -@item Reset -All ``found'' objects are marked ``not found''. - -@end table - -%end-doc */ - -static int ActionConnection(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - switch (funchash_get(function, NULL)) { - case F_Find: - { - gui->get_coords(_("Click on a connection"), &x, &y); - LookupConnection(x, y, pcb_true, 1, PCB_FLAG_FOUND); - break; - } - - case F_ResetLinesAndPolygons: - if (ResetFoundLinesAndPolygons(pcb_true)) { - IncrementUndoSerialNumber(); - Draw(); - } - break; - - case F_ResetPinsViasAndPads: - if (ResetFoundPinsViasAndPads(pcb_true)) { - IncrementUndoSerialNumber(); - Draw(); - } - break; - - case F_Reset: - if (ResetConnections(pcb_true)) { - IncrementUndoSerialNumber(); - Draw(); - } - break; - } - return 0; - } - - AFAIL(connection); -} - -/* --------------------------------------------------------------------------- */ - -static const char deleterats_syntax[] = "DeleteRats(AllRats|Selected|SelectedRats)"; - -static const char deleterats_help[] = "Delete rat lines."; - -/* %start-doc actions DeleteRats - -%end-doc */ - -static int ActionDeleteRats(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - if (conf_core.temp.rat_warn) - ClearWarnings(); - switch (funchash_get(function, NULL)) { - case F_AllRats: - if (DeleteRats(pcb_false)) - SetChangedFlag(pcb_true); - break; - case F_SelectedRats: - case F_Selected: - if (DeleteRats(pcb_true)) - SetChangedFlag(pcb_true); - break; - } - } - return 0; -} - - -HID_Action rats_action_list[] = { - {"AddRats", 0, ActionAddRats, - addrats_help, addrats_syntax} - , - {"Connection", 0, ActionConnection, - connection_help, connection_syntax} - , - {"DeleteRats", 0, ActionDeleteRats, - deleterats_help, deleterats_syntax} -}; - -REGISTER_ACTIONS(rats_action_list, NULL) Index: 1.1.4/src/vtonpoint.c =================================================================== --- 1.1.4/src/vtonpoint.c (revision 10776) +++ 1.1.4/src/vtonpoint.c (nonexistent) @@ -1,3 +0,0 @@ -#define GVT_DONT_UNDEF -#include "vtonpoint.h" -#include Index: 1.1.4/src/draw.h =================================================================== --- 1.1.4/src/draw.h (revision 10776) +++ 1.1.4/src/draw.h (nonexistent) @@ -1,83 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2004 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for drawing routines */ - -#ifndef PCB_DRAW_H -#define PCB_DRAW_H - -#include "global.h" - -/* Temporarily inhibid drawing if this is non-zero. A function that calls a - lot of other functions that would call Draw() a lot in turn may increase - this value before the calls, then decrease it at the end and call Draw(). - This makes sure the whole block is redrawn only once at the end. */ -extern pcb_cardinal_t pcb_draw_inhibit; - -#define pcb_draw_inhibit_inc() pcb_draw_inhibit++ -#define pcb_draw_inhibit_dec() \ -do { \ - if (pcb_draw_inhibit > 0) \ - pcb_draw_inhibit--; \ -} while(0) \ - -void Draw(void); -void Redraw(void); -void DrawVia(PinTypePtr); -void DrawRat(RatTypePtr); -void DrawViaName(PinTypePtr); -void DrawPin(PinTypePtr); -void DrawPinName(PinTypePtr); -void DrawPad(PadTypePtr); -void DrawPadName(PadTypePtr); -void DrawLine(LayerTypePtr, LineTypePtr); -void DrawArc(LayerTypePtr, ArcTypePtr); -void DrawText(LayerTypePtr, TextTypePtr); -void DrawTextLowLevel(TextTypePtr, Coord); -void DrawPolygon(LayerTypePtr, PolygonTypePtr); -void DrawElement(ElementTypePtr); -void DrawElementName(ElementTypePtr); -void DrawElementPackage(ElementTypePtr); -void DrawElementPinsAndPads(ElementTypePtr); -void DrawObject(int, void *, void *); -void DrawLayer(LayerTypePtr, const BoxType *); -void EraseVia(PinTypePtr); -void EraseRat(RatTypePtr); -void EraseViaName(PinTypePtr); -void ErasePad(PadTypePtr); -void ErasePadName(PadTypePtr); -void ErasePin(PinTypePtr); -void ErasePinName(PinTypePtr); -void EraseLine(LineTypePtr); -void EraseArc(ArcTypePtr); -void EraseText(LayerTypePtr, TextTypePtr); -void ErasePolygon(PolygonTypePtr); -void EraseElement(ElementTypePtr); -void EraseElementPinsAndPads(ElementTypePtr); -void EraseElementName(ElementTypePtr); -void EraseObject(int, void *, void *); - -#endif Index: 1.1.4/src/rotate.h =================================================================== --- 1.1.4/src/rotate.h (revision 10776) +++ 1.1.4/src/rotate.h (nonexistent) @@ -1,103 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for transform routines */ - -#ifndef PCB_ROTATE_H -#define PCB_ROTATE_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * some useful transformation macros and constants - */ -#define ROTATE(x,y,x0,y0,n) \ - { \ - Coord dx = (x)-(x0), \ - dy = (y)-(y0); \ - \ - switch(n & 0x03) \ - { \ - case 1: (x)=(x0)+dy; (y)=(y0)-dx; \ - break; \ - case 2: (x)=(x0)-dx; (y)=(y0)-dy; \ - break; \ - case 3: (x)=(x0)-dy; (y)=(y0)+dx; \ - break; \ - default: break; \ - } \ - } - -/* Rotate pin shape style by n_in * 90 degrees */ -#define PIN_ROTATE(p,n_in) \ -do { \ - int _n_; \ - for(_n_ = n_in;_n_>0;_n_--) { \ - int _old_, _nw_ = 0; \ - _old_ = GET_SQUARE(p); \ - if ((_old_ > 1) && (_old_ < 17)) { \ - _old_--; \ - if (_old_ & 1) \ - _nw_ |= 8; \ - if (_old_ & 8) \ - _nw_ |= 2; \ - if (_old_ & 2) \ - _nw_ |= 4; \ - if (_old_ & 4) \ - _nw_ |= 1; \ - GET_SQUARE(p) = _nw_+1; \ - } \ - } \ -} while(0) - -#define ROTATE_VIA_LOWLEVEL(v,x0,y0,n) \ -do { \ - ROTATE((v)->X,(v)->Y,(x0),(y0),(n)); \ - PIN_ROTATE(v, (n)); \ -} while(0) - -#define ROTATE_PIN_LOWLEVEL(p,x0,y0,n) \ -do { \ - ROTATE((p)->X,(p)->Y,(x0),(y0),(n)); \ - PIN_ROTATE((p), (n)); \ -} while(0) - -#define ROTATE_PAD_LOWLEVEL(p,x0,y0,n) \ - RotateLineLowLevel(((LineTypePtr) (p)),(x0),(y0),(n)) - -#define ROTATE_TYPES (PCB_TYPE_ELEMENT | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT_NAME | PCB_TYPE_ARC) - - -void RotateLineLowLevel(LineTypePtr, Coord, Coord, unsigned); -void RotateArcLowLevel(ArcTypePtr, Coord, Coord, unsigned); -void RotateBoxLowLevel(BoxTypePtr, Coord, Coord, unsigned); -void RotateTextLowLevel(TextTypePtr, Coord, Coord, unsigned); -void RotatePolygonLowLevel(PolygonTypePtr, Coord, Coord, unsigned); -void RotateElementLowLevel(DataTypePtr, ElementTypePtr, Coord, Coord, unsigned); -void *RotateObject(int, void *, void *, void *, Coord, Coord, unsigned); -void RotateScreenObject(Coord, Coord, unsigned); - -#endif Index: 1.1.4/src/action_act.c =================================================================== --- 1.1.4/src/action_act.c (revision 10776) +++ 1.1.4/src/action_act.c (nonexistent) @@ -1,110 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -#include "config.h" - -#include "error.h" -#include "action_helper.h" -#include "hid_actions.h" -#include "undo.h" - -/* actions about actions - */ -/* --------------------------------------------------------------------------- */ - -static const char executefile_syntax[] = "ExecuteFile(filename)"; - -static const char executefile_help[] = "Run actions from the given file."; - -/* %start-doc actions ExecuteFile - -Lines starting with @code{#} are ignored. - -%end-doc */ - -int ActionExecuteFile(int argc, const char **argv, Coord x, Coord y) -{ - FILE *fp; - const char *fname; - char line[256]; - int n = 0; - char *sp; - - if (argc != 1) - AFAIL(executefile); - - fname = argv[0]; - - if ((fp = fopen(fname, "r")) == NULL) { - fprintf(stderr, _("Could not open actions file \"%s\".\n"), fname); - return 1; - } - - defer_updates = 1; - defer_needs_update = 0; - while (fgets(line, sizeof(line), fp) != NULL) { - n++; - sp = line; - - /* eat the trailing newline */ - while (*sp && *sp != '\r' && *sp != '\n') - sp++; - *sp = '\0'; - - /* eat leading spaces and tabs */ - sp = line; - while (*sp && (*sp == ' ' || *sp == '\t')) - sp++; - - /* - * if we have anything left and its not a comment line - * then execute it - */ - - if (*sp && *sp != '#') { - /*Message ("%s : line %-3d : \"%s\"\n", fname, n, sp); */ - hid_parse_actions(sp); - } - } - - defer_updates = 0; - if (defer_needs_update) { - IncrementUndoSerialNumber(); - gui->invalidate_all(); - } - fclose(fp); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -HID_Action action_action_list[] = { - {"ExecuteFile", 0, ActionExecuteFile, - executefile_help, executefile_syntax} -}; - -REGISTER_ACTIONS(action_action_list, NULL) Index: 1.1.4/src/global.h =================================================================== --- 1.1.4/src/global.h (revision 10776) +++ 1.1.4/src/global.h (nonexistent) @@ -1,554 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2004 Thomas Nau - * 15 Oct 2008 Ineiev: add different crosshair shapes - * - * 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 of types */ - -/* Change History: - * 10/11/96 11:37 AJF Added support for a Text() driver function. - * This was done out of a pressing need to force text to be printed on the - * silkscreen layer. Perhaps the design is not the best. - */ - -#ifndef PCB_GLOBAL_H -#define PCB_GLOBAL_H - -#include "config.h" - -#include "const.h" -#include "macro.h" -#include -#include -#include -#include -#include -#include -#include - -#include "global_typedefs.h" -#include "global_objs.h" -#include "list_common.h" -#include "list_line.h" -#include "list_arc.h" -#include "list_text.h" -#include "list_poly.h" -#include "list_pad.h" -#include "list_pin.h" -#include "list_rat.h" -#include "vtonpoint.h" -#include "hid.h" -#include "polyarea.h" -#include "vtroutestyle.h" - - -/* Internationalization support. */ -#ifdef ENABLE_NLS -# include -# define _(S) gettext(S) -# if defined(gettext_noop) -# define N_(S) gettext_noop(S) -# else -# define N_(S) (S) -# endif -#else -# define _(S) (S) -# define N_(S) (S) -# define textdomain(S) (S) -# define gettext(S) (S) -# define dgettext(D, S) (S) -# define dcgettext(D, S, T) (S) -# define bindtextdomain(D, Dir) (D) -#endif /* ENABLE_NLS */ - -/* This is used by the lexer/parser */ -typedef struct { - int ival; - Coord bval; - double dval; - char has_units; -} PLMeasure; - -/* --------------------------------------------------------------------------- - * Macros to annotate branch-prediction information. - * Taken from GLib 2.16.3 (LGPL 2).G_ / g_ prefixes have - * been removed to avoid namespace clashes. - */ - -/* The LIKELY and UNLIKELY macros let the programmer give hints to - * the compiler about the expected result of an expression. Some compilers - * can use this information for optimizations. - * - * The PCB_BOOLEAN_EXPR macro is intended to trigger a gcc warning when - * putting assignments inside the test. - */ -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -# define PCB_BOOLEAN_EXPR(expr) \ - __extension__ ({ \ - int _boolean_var_; \ - if (expr) \ - _boolean_var_ = 1; \ - else \ - _boolean_var_ = 0; \ - _boolean_var_; \ -}) -# define LIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 1)) -# define UNLIKELY(expr) (__builtin_expect (PCB_BOOLEAN_EXPR(expr), 0)) -#else -# define LIKELY(expr) (expr) -# define UNLIKELY(expr) (expr) -#endif - -/* --------------------------------------------------------------------------- - * Macros to annotate branch-prediction information. - * Taken from GLib 2.42.1 (LGPL 2). PCB_ prefixes have - * been added to avoid namespace clashes. - */ -#define PCB_CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) -#define PCB_ABS(a) (((a) < 0) ? -(a) : (a)) - -/* --------------------------------------------------------------------------- - * some useful values of our widgets - */ -typedef struct { /* holds information about output window */ - hidGC bgGC, /* background and foreground; */ - fgGC, /* changed from some routines */ - pmGC; /* depth 1 pixmap GC to store clip */ -} OutputType, *OutputTypePtr; - - -/* ---------------------------------------------------------------------- - * layer group. A layer group identifies layers which are always switched - * on/off together. - */ -typedef struct { - pcb_cardinal_t Number[MAX_LAYER], /* number of entries per groups */ - Entries[MAX_LAYER][MAX_LAYER + 2]; -} LayerGroupType, *LayerGroupTypePtr; - -typedef struct { - Coord x, y; - Coord width, height; -} RectangleType, *RectangleTypePtr; - -/* --------------------------------------------------------------------------- - * the basic object types supported by PCB - */ - -#include "global_element.h" - -struct rtree { - struct rtree_node *root; - int size; /* number of entries in tree */ -}; - -struct layer_st { /* holds information about one layer */ - const char *Name; /* layer name */ - linelist_t Line; - textlist_t Text; - polylist_t Polygon; - arclist_t Arc; - rtree_t *line_tree, *text_tree, *polygon_tree, *arc_tree; - pcb_bool On; /* visible flag */ - const char *Color; /* color */ - const char *SelectedColor; - AttributeListType Attributes; - int no_drc; /* whether to ignore the layer when checking the design rules */ -}; - -struct data_st { /* holds all objects */ - int LayerN; /* number of layers in this board */ - pinlist_t Via; - elementlist_t Element; - ratlist_t Rat; - rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */ - *rat_tree; - struct PCBType *pcb; - LayerType Layer[MAX_LAYER + 2]; /* add 2 silkscreen layers */ - plug_io_t *loader; -}; - -typedef struct { /* holds drill information */ - Coord DrillSize; /* this drill's diameter */ - pcb_cardinal_t ElementN, /* the number of elements using this drill size */ - ElementMax, /* max number of elements from malloc() */ - PinCount, /* number of pins drilled this size */ - ViaCount, /* number of vias drilled this size */ - UnplatedCount, /* number of these holes that are unplated */ - PinN, /* number of drill coordinates in the list */ - PinMax; /* max number of coordinates from malloc() */ - PinTypePtr *Pin; /* coordinates to drill */ - ElementTypePtr *Element; /* a pointer to an array of element pointers */ -} DrillType, *DrillTypePtr; - -typedef struct { /* holds a range of Drill Infos */ - pcb_cardinal_t DrillN, /* number of drill sizes */ - DrillMax; /* max number from malloc() */ - DrillTypePtr Drill; /* plated holes */ -} DrillInfoType, *DrillInfoTypePtr; - -typedef struct LibraryEntryTpye_s LibraryEntryType, *LibraryEntryTypePtr; -typedef struct LibraryMenuType_s LibraryMenuType, *LibraryMenuTypePtr; - -/* --------------------------------------------------------------------------- - * structure used by library routines - */ -struct LibraryEntryTpye_s { - const char *ListEntry; /* the string for the selection box */ - int ListEntry_dontfree; /* do not free(ListEntry) if non-zero */ - /* This used to contain some char *AllocatedMemory, possibly with - * the intention of the following fields pointing into it. - * It was never used that way, so removing for now. - * TODO: re-introduce and actually use it for the following fields? - */ - const char *Package; /* package */ - const char *Value; /* the value field */ - const char *Description; /* some descriptive text */ -#if 0 - fp_type_t Type; - void **Tags; /* an array of void * tag IDs; last tag ID is NULL */ -#endif -}; - -/* If the internal flag is set, the only field that is valid is Name, - and the struct is allocated with malloc instead of - CreateLibraryEntry. These "internal" entries are used for - electrical paths that aren't yet assigned to a real net. */ - -struct LibraryMenuType_s { - char *Name, /* name of the menu entry */ - *directory, /* Directory name library elements are from */ - *Style; /* routing style */ - pcb_cardinal_t EntryN, /* number of objects */ - EntryMax; /* number of reserved memory locations */ - LibraryEntryTypePtr Entry; /* the entries */ - char flag; /* used by the netlist window to enable/disable nets */ - char internal; /* if set, this is an internal-only entry, not - part of the global netlist. */ -}; - -typedef struct { - pcb_cardinal_t MenuN; /* number of objects */ - pcb_cardinal_t MenuMax; /* number of reserved memory locations */ - LibraryMenuTypePtr Menu; /* the entries */ -} LibraryType, *LibraryTypePtr; - -enum { - NETLIST_INPUT = 0, /* index of the original netlist as imported */ - NETLIST_EDITED = 1, /* index of the netlist produced by applying netlist patches on [NETLIST_INPUT] */ - NUM_NETLISTS /* so that we know how many netlists we are dealing with */ -}; - - - /* The PCBType struct holds information about board layout most of which is - | saved with the layout. A new PCB layout struct is first initialized - | with values from the user configurable Settings struct and then reset - | to the saved layout values when a layout is loaded. - | This struct is also used for the remove list and for buffer handling - */ -typedef struct PCBType { - long ID; /* see macro.h */ - char *Name, /* name of board */ - *Filename, /* name of file (from load) */ - *PrintFilename, /* from print dialog */ - *Netlistname, /* name of netlist file */ - ThermStyle; /* type of thermal to place with thermal tool */ - pcb_bool Changed, /* layout has been changed */ - ViaOn, /* visibility flags */ - ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */ - RatDraw; /* we're drawing rats */ - char *ViaColor, /* some colors */ - *ViaSelectedColor, - *PinColor, - *PinSelectedColor, - *PinNameColor, - *ElementColor, - *ElementColor_nonetlist, - *RatColor, - *InvisibleObjectsColor, - *InvisibleMarkColor, *ElementSelectedColor, *RatSelectedColor, *ConnectedColor, *WarnColor, *MaskColor; - Coord CursorX, /* cursor position as saved with layout */ - CursorY; - Coord Bloat, /* drc sizes saved with layout */ - Shrink, minWid, minSlk, minDrill, minRing; - Coord GridOffsetX, /* as saved with layout */ - GridOffsetY, MaxWidth, /* allowed size */ - MaxHeight; - - Coord Grid; /* used grid with offsets */ - double Zoom, /* zoom factor */ - IsleArea, /* minimum poly island to retain */ - ThermScale; /* scale factor used with thermals */ - FontType Font; - LayerGroupType LayerGroups; - vtroutestyle_t RouteStyle; - LibraryType NetlistLib[NUM_NETLISTS]; - rats_patch_line_t *NetlistPatches, *NetlistPatchLast; - AttributeListType Attributes; - DataTypePtr Data; /* entire database */ - - pcb_bool is_footprint; /* If set, the user has loaded a footprint, not a pcb. */ - -/* netlist states */ - int netlist_frozen; /* counter */ - unsigned netlist_needs_update:1; - -} PCBType, *PCBTypePtr; - -typedef struct { /* information about the paste buffer */ - Coord X, Y; /* offset */ - BoxType BoundingBox; - DataTypePtr Data; /* data; not all members of PCBType */ - /* are used */ -} BufferType, *BufferTypePtr; - -/* --------------------------------------------------------------------------- - * some types for cursor drawing, setting of block and lines - * as well as for merging of elements - */ -typedef struct { /* rubberband lines for element moves */ - LayerTypePtr Layer; /* layer that holds the line */ - LineTypePtr Line; /* the line itself */ - PointTypePtr MovedPoint; /* and finally the point */ -} RubberbandType, *RubberbandTypePtr; - -typedef struct { /* current marked line */ - PointType Point1, /* start- and end-position */ - Point2; - long int State; - pcb_bool draw; -} AttachedLineType, *AttachedLineTypePtr; - -typedef struct { /* currently marked block */ - PointType Point1, /* start- and end-position */ - Point2; - long int State; - pcb_bool otherway; -} AttachedBoxType, *AttachedBoxTypePtr; - -typedef struct { /* currently attached object */ - Coord X, Y; /* saved position when PCB_MODE_MOVE */ - BoxType BoundingBox; - long int Type, /* object type */ - State; - void *Ptr1, /* three pointers to data, see */ - *Ptr2, /* search.c */ - *Ptr3; - pcb_cardinal_t RubberbandN, /* number of lines in array */ - RubberbandMax; - RubberbandTypePtr Rubberband; -} AttachedObjectType, *AttachedObjectTypePtr; - -enum crosshair_shape { - Basic_Crosshair_Shape = 0, /* 4-ray */ - Union_Jack_Crosshair_Shape, /* 8-ray */ - Dozen_Crosshair_Shape, /* 12-ray */ - Crosshair_Shapes_Number -}; - -typedef struct { /* holds cursor information */ - hidGC GC, /* GC for cursor drawing */ - AttachGC; /* and for displaying buffer contents */ - Coord X, Y, /* position in PCB coordinates */ - MinX, MinY, /* lowest and highest coordinates */ - MaxX, MaxY; - AttachedLineType AttachedLine; /* data of new lines... */ - AttachedBoxType AttachedBox; - PolygonType AttachedPolygon; - AttachedObjectType AttachedObject; /* data of attached objects */ - enum crosshair_shape shape; /* shape of crosshair */ - vtop_t onpoint_objs; - vtop_t old_onpoint_objs; - - /* list of object IDs that could have been dragged so that they can be cycled */ - long int *drags; - int drags_len, drags_current; - Coord dragx, dragy; /* the point where drag started */ -} CrosshairType, *CrosshairTypePtr; - -typedef struct { - pcb_bool status; - Coord X, Y; -} MarkType, *MarkTypePtr; - -/* ---------------------------------------------------------------------- - * pointer to low-level copy, move and rotate functions - */ -typedef struct { - void *(*Line) (LayerTypePtr, LineTypePtr); - void *(*Text) (LayerTypePtr, TextTypePtr); - void *(*Polygon) (LayerTypePtr, PolygonTypePtr); - void *(*Via) (PinTypePtr); - void *(*Element) (ElementTypePtr); - void *(*ElementName) (ElementTypePtr); - void *(*Pin) (ElementTypePtr, PinTypePtr); - void *(*Pad) (ElementTypePtr, PadTypePtr); - void *(*LinePoint) (LayerTypePtr, LineTypePtr, PointTypePtr); - void *(*Point) (LayerTypePtr, PolygonTypePtr, PointTypePtr); - void *(*Arc) (LayerTypePtr, ArcTypePtr); - void *(*Rat) (RatTypePtr); -} ObjectFunctionType, *ObjectFunctionTypePtr; - -/* --------------------------------------------------------------------------- - * structure used by device drivers - */ - -typedef struct { /* holds a connection */ - Coord X, Y; /* coordinate of connection */ - long int type; /* type of object in ptr1 - 3 */ - void *ptr1, *ptr2; /* the object of the connection */ - pcb_cardinal_t group; /* the layer group of the connection */ - LibraryMenuType *menu; /* the netmenu this *SHOULD* belong too */ -} ConnectionType, *ConnectionTypePtr; - -struct net_st { /* holds a net of connections */ - pcb_cardinal_t ConnectionN, /* the number of connections contained */ - ConnectionMax; /* max connections from malloc */ - ConnectionTypePtr Connection; - RouteStyleTypePtr Style; -}; - -typedef struct { /* holds a list of nets */ - pcb_cardinal_t NetN, /* the number of subnets contained */ - NetMax; /* max subnets from malloc */ - NetTypePtr Net; -} NetListType, *NetListTypePtr; - -typedef struct { /* holds a list of net lists */ - pcb_cardinal_t NetListN, /* the number of net lists contained */ - NetListMax; /* max net lists from malloc */ - NetListTypePtr NetList; -} NetListListType, *NetListListTypePtr; - -typedef struct { /* holds a generic list of pointers */ - pcb_cardinal_t PtrN, /* the number of pointers contained */ - PtrMax; /* max subnets from malloc */ - void **Ptr; -} PointerListType, *PointerListTypePtr; - -typedef struct { - pcb_cardinal_t BoxN, /* the number of boxes contained */ - BoxMax; /* max boxes from malloc */ - BoxTypePtr Box; - -} BoxListType, *BoxListTypePtr; - -struct drc_violation_st { - char *title; - char *explanation; - Coord x, y; - Angle angle; - int have_measured; - Coord measured_value; - Coord required_value; - int object_count; - long int *object_id_list; - int *object_type_list; -}; - -typedef enum { - RATP_ADD_CONN, - RATP_DEL_CONN, - RATP_CHANGE_ATTRIB -} rats_patch_op_t; - -struct rats_patch_line_s { - rats_patch_op_t op; - char *id; - union { - char *net_name; - char *attrib_name; - } arg1; - union { - char *attrib_val; - } arg2; - - rats_patch_line_t *prev, *next; -}; - -/* --------------------------------------------------------------------------- - * define supported types of undo operations - * note these must be separate bits now - */ -#define UNDO_CHANGENAME 0x0001 /* change of names */ -#define UNDO_MOVE 0x0002 /* moving objects */ -#define UNDO_REMOVE 0x0004 /* removing objects */ -#define UNDO_REMOVE_POINT 0x0008 /* removing polygon/... points */ -#define UNDO_INSERT_POINT 0x0010 /* inserting polygon/... points */ -#define UNDO_REMOVE_CONTOUR 0x0020 /* removing a contour from a polygon */ -#define UNDO_INSERT_CONTOUR 0x0040 /* inserting a contour from a polygon */ -#define UNDO_ROTATE 0x0080 /* rotations */ -#define UNDO_CREATE 0x0100 /* creation of objects */ -#define UNDO_MOVETOLAYER 0x0200 /* moving objects to */ -#define UNDO_FLAG 0x0400 /* toggling SELECTED flag */ -#define UNDO_CHANGESIZE 0x0800 /* change size of object */ -#define UNDO_CHANGE2NDSIZE 0x1000 /* change 2ndSize of object */ -#define UNDO_MIRROR 0x2000 /* change side of board */ -#define UNDO_CHANGECLEARSIZE 0x4000 /* change clearance size */ -#define UNDO_CHANGEMASKSIZE 0x8000 /* change mask size */ -#define UNDO_CHANGEANGLES 0x10000 /* change arc angles */ -#define UNDO_LAYERCHANGE 0x20000 /* layer new/delete/move */ -#define UNDO_CLEAR 0x40000 /* clear/restore to polygons */ -#define UNDO_NETLISTCHANGE 0x80000 /* netlist change */ -#define UNDO_CHANGEPINNUM 0x100000 /* change of pin number */ -#define UNDO_CHANGERADII 0x200000 /* change arc radii */ - - - -/* --------------------------------------------------------------------------- - * add a macro for wrapping RCS ID's in so that ident will still work - * but we won't get as many compiler warnings - */ - -#ifndef GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#endif /* GCC_VERSION */ - -#if GCC_VERSION > 2007 -# define ATTRIBUTE_UNUSED __attribute__((unused)) -#else -# define ATTRIBUTE_UNUSED -#endif - -/* --------------------------------------------------------------------------- - * Macros called by various action routines to show usage or to report - * a syntax error and fail - */ -#define AUSAGE(x) Message (PCB_MSG_INFO, "Usage:\n%s\n", (x##_syntax)) -#define AFAIL(x) { Message (PCB_MSG_ERROR, "Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; } - -/* Make sure to catch usage of non-portable functions in debug mode */ -#ifndef NDEBUG -# undef strdup -# undef strndup -# undef snprintf -# undef round -# define strdup never_use_strdup__use_pcb_strdup -# define strndup never_use_strndup__use_pcb_strndup -# define snprintf never_use_snprintf__use_pcb_snprintf -# define round never_use_round__use_pcb_round -#endif - -#endif /* PCB_GLOBAL_H */ Index: 1.1.4/src/vtonpoint.h =================================================================== --- 1.1.4/src/vtonpoint.h (revision 10776) +++ 1.1.4/src/vtonpoint.h (nonexistent) @@ -1,64 +0,0 @@ -#include -#include -#include "global_objs.h" - -/* Elem=OnpointType; init=none */ - -/* all public symbols are wrapped in GVT() - see vt_t(7) */ -#define GVT(x) vtop_ ## x - -/* Array elem type - see vt_t(7) */ -#define GVT_ELEM_TYPE OnpointType - -/* Type that represents array lengths - see vt_t(7) */ -#define GVT_SIZE_TYPE size_t - -/* Below this length, always double allocation size when the array grows */ -#define GVT_DOUBLING_THRS 64 - -/* Initial array size when the first element is written */ -#define GVT_START_SIZE 8 - -/* Optional terminator; when present, it is always appended at the end - see - vt_term(7)*/ -/* #define GVT_TERM '\0' */ - -/* Optional prefix for function definitions (e.g. static inline) */ -#define GVT_FUNC - -/* Enable this to set all new bytes ever allocated to this value - see - vt_set_new_bytes_to(7) */ -/* #define GVT_SET_NEW_BYTES_TO 0 */ - -/* Enable GVT_INIT_ELEM_FUNC and an user configured function is called - for each new element allocated (even between used and alloced). - See vt_init_elem(7) */ -/*#define GVT_INIT_ELEM_FUNC*/ - -/* Enable GVT_ELEM_CONSTRUCTOR and an user configured function is called - for each element that is getting within the range of ->used. - See vt_construction(7) */ -/*#define GVT_ELEM_CONSTRUCTOR */ - -/* Enable GVT_ELEM_DESTRUCTOR and an user configured function is called - for each element that was once constructed and now getting beyond ->used. - See vt_construction(7) */ -/*#define GVT_ELEM_DESTRUCTOR */ - -/* Enable GVT_ELEM_COPY and an user configured function is called - for copying elements into the array. - See vt_construction(7) */ -/*#define GVT_ELEM_COPY */ - -/* Optional extra fields in the vector struct - see vt_user_fields(7) */ -/* #define GVT_USER_FIELDS int foo; char bar[12]; */ - -/* Include the actual header implementation */ -#include - -/* Memory allocator - see vt_allocation(7) */ -#define GVT_REALLOC(vect, ptr, size) realloc(ptr, size) -#define GVT_FREE(vect, ptr) free(ptr) - -/* clean up #defines */ -#include Index: 1.1.4/src/drill.c =================================================================== --- 1.1.4/src/drill.c (revision 10776) +++ 1.1.4/src/drill.c (nonexistent) @@ -1,243 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * This module, drill.c, was written and is Copyright (C) 1997 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ -#include "config.h" - -#include "mymem.h" - -/* - * some local prototypes - */ -static void FillDrill(DrillTypePtr, ElementTypePtr, PinTypePtr); -static void InitializeDrill(DrillTypePtr, PinTypePtr, ElementTypePtr); - - -static void FillDrill(DrillTypePtr Drill, ElementTypePtr Element, PinTypePtr Pin) -{ - pcb_cardinal_t n; - ElementTypeHandle ptr; - PinTypeHandle pin; - - pin = GetDrillPinMemory(Drill); - *pin = Pin; - if (Element) { - Drill->PinCount++; - for (n = Drill->ElementN - 1; n != -1; n--) - if (Drill->Element[n] == Element) - break; - if (n == -1) { - ptr = GetDrillElementMemory(Drill); - *ptr = Element; - } - } - else - Drill->ViaCount++; - if (TEST_FLAG(PCB_FLAG_HOLE, Pin)) - Drill->UnplatedCount++; -} - -static void InitializeDrill(DrillTypePtr drill, PinTypePtr pin, ElementTypePtr element) -{ - void *ptr; - - drill->DrillSize = pin->DrillingHole; - drill->ElementN = 0; - drill->ViaCount = 0; - drill->PinCount = 0; - drill->UnplatedCount = 0; - drill->ElementMax = 0; - drill->Element = NULL; - drill->PinN = 0; - drill->Pin = NULL; - drill->PinMax = 0; - ptr = (void *) GetDrillPinMemory(drill); - *((PinTypeHandle) ptr) = pin; - if (element) { - ptr = (void *) GetDrillElementMemory(drill); - *((ElementTypeHandle) ptr) = element; - drill->PinCount = 1; - } - else - drill->ViaCount = 1; - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) - drill->UnplatedCount = 1; -} - -static int DrillQSort(const void *va, const void *vb) -{ - DrillType *a = (DrillType *) va; - DrillType *b = (DrillType *) vb; - return a->DrillSize - b->DrillSize; -} - -DrillInfoTypePtr GetDrillInfo(DataTypePtr top) -{ - DrillInfoTypePtr AllDrills; - DrillTypePtr Drill = NULL; - DrillType savedrill, swapdrill; - pcb_bool DrillFound = pcb_false; - pcb_bool NewDrill; - - AllDrills = (DrillInfoTypePtr) calloc(1, sizeof(DrillInfoType)); - ALLPIN_LOOP(top); - { - if (!DrillFound) { - DrillFound = pcb_true; - Drill = GetDrillInfoDrillMemory(AllDrills); - InitializeDrill(Drill, pin, element); - } - else { - if (Drill->DrillSize == pin->DrillingHole) - FillDrill(Drill, element, pin); - else { - NewDrill = pcb_false; - DRILL_LOOP(AllDrills); - { - if (drill->DrillSize == pin->DrillingHole) { - Drill = drill; - FillDrill(Drill, element, pin); - break; - } - else if (drill->DrillSize > pin->DrillingHole) { - if (!NewDrill) { - NewDrill = pcb_true; - InitializeDrill(&swapdrill, pin, element); - Drill = GetDrillInfoDrillMemory(AllDrills); - Drill->DrillSize = pin->DrillingHole + 1; - Drill = drill; - } - savedrill = *drill; - *drill = swapdrill; - swapdrill = savedrill; - } - } - END_LOOP; - if (AllDrills->Drill[AllDrills->DrillN - 1].DrillSize < pin->DrillingHole) { - Drill = GetDrillInfoDrillMemory(AllDrills); - InitializeDrill(Drill, pin, element); - } - } - } - } - ENDALL_LOOP; - VIA_LOOP(top); - { - if (!DrillFound) { - DrillFound = pcb_true; - Drill = GetDrillInfoDrillMemory(AllDrills); - Drill->DrillSize = via->DrillingHole; - FillDrill(Drill, NULL, via); - } - else { - if (Drill->DrillSize != via->DrillingHole) { - DRILL_LOOP(AllDrills); - { - if (drill->DrillSize == via->DrillingHole) { - Drill = drill; - FillDrill(Drill, NULL, via); - break; - } - } - END_LOOP; - if (Drill->DrillSize != via->DrillingHole) { - Drill = GetDrillInfoDrillMemory(AllDrills); - Drill->DrillSize = via->DrillingHole; - FillDrill(Drill, NULL, via); - } - } - else - FillDrill(Drill, NULL, via); - } - } - END_LOOP; - qsort(AllDrills->Drill, AllDrills->DrillN, sizeof(DrillType), DrillQSort); - return (AllDrills); -} - -#define ROUND(x,n) ((int)(((x)+(n)/2)/(n))*(n)) - -void RoundDrillInfo(DrillInfoTypePtr d, int roundto) -{ - unsigned int i = 0; - - while ((d->DrillN > 0) && (i < d->DrillN - 1)) { - int diam1 = ROUND(d->Drill[i].DrillSize, roundto); - int diam2 = ROUND(d->Drill[i + 1].DrillSize, roundto); - - if (diam1 == diam2) { - int ei, ej; - - d->Drill[i].ElementMax = d->Drill[i].ElementN + d->Drill[i + 1].ElementN; - if (d->Drill[i].ElementMax) { - d->Drill[i].Element = (ElementTypePtr *) realloc(d->Drill[i].Element, d->Drill[i].ElementMax * sizeof(ElementTypePtr)); - - for (ei = 0; ei < d->Drill[i + 1].ElementN; ei++) { - for (ej = 0; ej < d->Drill[i].ElementN; ej++) - if (d->Drill[i].Element[ej] == d->Drill[i + 1].Element[ei]) - break; - if (ej == d->Drill[i].ElementN) - d->Drill[i].Element[d->Drill[i].ElementN++] - = d->Drill[i + 1].Element[ei]; - } - } - free(d->Drill[i + 1].Element); - d->Drill[i + 1].Element = NULL; - - d->Drill[i].PinMax = d->Drill[i].PinN + d->Drill[i + 1].PinN; - d->Drill[i].Pin = (PinTypePtr *) realloc(d->Drill[i].Pin, d->Drill[i].PinMax * sizeof(PinTypePtr)); - memcpy(d->Drill[i].Pin + d->Drill[i].PinN, d->Drill[i + 1].Pin, d->Drill[i + 1].PinN * sizeof(PinTypePtr)); - d->Drill[i].PinN += d->Drill[i + 1].PinN; - free(d->Drill[i + 1].Pin); - d->Drill[i + 1].Pin = NULL; - - d->Drill[i].PinCount += d->Drill[i + 1].PinCount; - d->Drill[i].ViaCount += d->Drill[i + 1].ViaCount; - d->Drill[i].UnplatedCount += d->Drill[i + 1].UnplatedCount; - - d->Drill[i].DrillSize = diam1; - - memmove(d->Drill + i + 1, d->Drill + i + 2, (d->DrillN - i - 2) * sizeof(DrillType)); - d->DrillN--; - } - else { - d->Drill[i].DrillSize = diam1; - i++; - } - } -} - -void FreeDrillInfo(DrillInfoTypePtr Drills) -{ - DRILL_LOOP(Drills); - { - free(drill->Element); - free(drill->Pin); - } - END_LOOP; - free(Drills->Drill); - free(Drills); -} Index: 1.1.4/src/default.pcb =================================================================== --- 1.1.4/src/default.pcb (revision 10776) +++ 1.1.4/src/default.pcb (nonexistent) @@ -1,47 +0,0 @@ -# release: pcb 20110918 - -# To read pcb files, the pcb version (or the git source date) must be >= the file version -FileVersion[20070407] - -PCB["" 600000 500000] - -Grid[2500.0 0 0 1] -Cursor[2500 62500 0.000000] -PolyArea[3100.006200] -Thermal[0.500000] -DRC[1200 900 1000 700 1500 1000] -Flags("nameonpcb,clearnew,snappin") -Groups("1,3,4,c:2,5,6,s:7:8") -Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] - -Attribute("PCB::grid::unit" "mil") -Layer(1 "component") -( -) -Layer(2 "solder") -( -) -Layer(3 "comp-GND") -( -) -Layer(4 "comp-power") -( -) -Layer(5 "sold-GND") -( -) -Layer(6 "sold-power") -( -) -Layer(7 "signal3") -( -) -Layer(8 "outline") -( -) -Layer(9 "silk") -( -) -Layer(10 "silk") -( -) Index: 1.1.4/src/funchash_core_list.h =================================================================== --- 1.1.4/src/funchash_core_list.h (revision 10776) +++ 1.1.4/src/funchash_core_list.h (nonexistent) @@ -1,126 +0,0 @@ -/* - Central list of function IDs - The core and core plugins use these from a single, central hash - This list is used to cpp-generate the F_* constants in enum FunctionID -*/ -action_entry(AddSelected) -action_entry(All) -action_entry(AllConnections) -action_entry(AllRats) -action_entry(AllUnusedPins) -action_entry(Arc) -action_entry(Arrow) -action_entry(Block) -action_entry(Description) -action_entry(Cancel) -action_entry(Center) -action_entry(Clear) -action_entry(ClearAndRedraw) -action_entry(ClearList) -action_entry(Close) -action_entry(Connection) -action_entry(Convert) -action_entry(Copy) -action_entry(CycleClip) -action_entry(CycleCrosshair) -action_entry(DeleteRats) -action_entry(Drag) -action_entry(DrillReport) -action_entry(Element) -action_entry(ElementByName) -action_entry(ElementConnections) -action_entry(ElementToBuffer) -action_entry(Escape) -action_entry(Find) -action_entry(FlipElement) -action_entry(FoundPins) -action_entry(Grid) -action_entry(InsertPoint) -action_entry(Layer) -action_entry(Layout) -action_entry(LayoutAs) -action_entry(LayoutToBuffer) -action_entry(Line) -action_entry(LineSize) -action_entry(Lock) -action_entry(Mirror) -action_entry(Move) -action_entry(NameOnPCB) -action_entry(Netlist) -action_entry(NetByName) -action_entry(None) -action_entry(Notify) -action_entry(Object) -action_entry(ObjectByName) -action_entry(PasteBuffer) -action_entry(PadByName) -action_entry(PinByName) -action_entry(PinOrPadName) -action_entry(Pinout) -action_entry(Polygon) -action_entry(PolygonHole) -action_entry(PreviousPoint) -action_entry(RatsNest) -action_entry(Rectangle) -action_entry(Redraw) -action_entry(Release) -action_entry(Revert) -action_entry(Remove) -action_entry(RemoveSelected) -action_entry(Report) -action_entry(Reset) -action_entry(ResetLinesAndPolygons) -action_entry(ResetPinsViasAndPads) -action_entry(Restore) -action_entry(Rotate) -action_entry(Save) -action_entry(Selected) -action_entry(SelectedArcs) -action_entry(SelectedElements) -action_entry(SelectedLines) -action_entry(SelectedNames) -action_entry(SelectedObjects) -action_entry(SelectedPads) -action_entry(SelectedPins) -action_entry(SelectedTexts) -action_entry(SelectedVias) -action_entry(SelectedRats) -action_entry(Stroke) -action_entry(Text) -action_entry(TextByName) -action_entry(TextScale) -action_entry(Thermal) -action_entry(ToLayout) -action_entry(ToggleAllDirections) -action_entry(ToggleAutoDRC) -action_entry(ToggleClearLine) -action_entry(ToggleFullPoly) -action_entry(ToggleGrid) -action_entry(ToggleHideNames) -action_entry(ToggleMinCut) -action_entry(ToggleMask) -action_entry(ToggleName) -action_entry(ToggleObject) -action_entry(ToggleShowDRC) -action_entry(ToggleLiveRoute) -action_entry(ToggleRubberBandMode) -action_entry(ToggleStartDirection) -action_entry(ToggleSnapPin) -action_entry(ToggleSnapOffGridLine) -action_entry(ToggleHighlightOnPoint) -action_entry(ToggleThindraw) -action_entry(ToggleLockNames) -action_entry(ToggleOnlyNames) -action_entry(ToggleThindrawPoly) -action_entry(ToggleOrthoMove) -action_entry(ToggleLocalRef) -action_entry(ToggleCheckPlanes) -action_entry(ToggleUniqueNames) -action_entry(ToggleStroke) -action_entry(Via) -action_entry(ViaByName) -action_entry(Value) -action_entry(ViaDrillingHole) -action_entry(ViaSize) -action_entry(Zoom) - Index: 1.1.4/src/data.c =================================================================== --- 1.1.4/src/data.c (revision 10776) +++ 1.1.4/src/data.c (nonexistent) @@ -1,174 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* just defines common identifiers - */ -#include "config.h" - -#include "data.h" - -/* --------------------------------------------------------------------------- - * some shared identifiers - */ - -CrosshairType Crosshair; /* information about cursor settings */ -MarkType Marked; /* a cross-hair mark */ -OutputType Output; /* some widgets ... used for drawing */ -PCBTypePtr PCB; /* pointer to layout struct */ - -int LayerStack[MAX_LAYER]; /* determines the layer draw order */ - -BufferType Buffers[MAX_BUFFER]; /* my buffers */ -pcb_bool Bumped; /* if the undo serial number has changed */ - -int addedLines; - - -/* callback based loops */ -void pcb_loop_layers(void *ctx, pcb_layer_cb_t lacb, pcb_line_cb_t lcb, pcb_arc_cb_t acb, pcb_text_cb_t tcb, pcb_poly_cb_t pocb) -{ - if ((lacb != NULL) || (lcb != NULL) || (acb != NULL) || (tcb != NULL) || (pocb != NULL)) { - LAYER_LOOP(PCB->Data, max_copper_layer + 2); - { - if (lacb != NULL) - if (lacb(ctx, PCB, layer, 1)) - continue; - if (lcb != NULL) { - LINE_LOOP(layer); - { - lcb(ctx, PCB, layer, line); - } - END_LOOP; - } - - if (acb != NULL) { - ARC_LOOP(layer); - { - acb(ctx, PCB, layer, arc); - } - END_LOOP; - } - - if (tcb != NULL) { - TEXT_LOOP(layer); - { - tcb(ctx, PCB, layer, text); - } - END_LOOP; - } - - if (pocb != NULL) { - POLYGON_LOOP(layer); - { - pocb(ctx, PCB, layer, polygon); - } - END_LOOP; - } - if (lacb != NULL) - lacb(ctx, PCB, layer, 0); - } - END_LOOP; - } -} - -void pcb_loop_elements(void *ctx, pcb_element_cb_t ecb, pcb_eline_cb_t elcb, pcb_earc_cb_t eacb, pcb_etext_cb_t etcb, pcb_epin_cb_t epicb, pcb_epad_cb_t epacb) -{ - if ((ecb != NULL) || (elcb != NULL) || (eacb != NULL) || (etcb != NULL) || (epicb != NULL) || (epacb != NULL)) { - ELEMENT_LOOP(PCB->Data); - { - if (ecb != NULL) - if (ecb(ctx, PCB, element, 1)) - continue; - - if (elcb != NULL) { - ELEMENTLINE_LOOP(element); - { - elcb(ctx, PCB, element, line); - } - END_LOOP; - } - - if (eacb != NULL) { - ELEMENTARC_LOOP(element); - { - eacb(ctx, PCB, element, arc); - } - END_LOOP; - } - - if (etcb != NULL) { - ELEMENTTEXT_LOOP(element); - { - etcb(ctx, PCB, element, text); - } - END_LOOP; - } - - if (epicb != NULL) { - PIN_LOOP(element); - { - epicb(ctx, PCB, element, pin); - } - END_LOOP; - } - - - if (epacb != NULL) { - PAD_LOOP(element); - { - epacb(ctx, PCB, element, pad); - } - END_LOOP; - } - - if (ecb != NULL) - ecb(ctx, PCB, element, 0); - } - END_LOOP; - } -} - -void pcb_loop_vias(void *ctx, pcb_via_cb_t vcb) -{ - if (vcb != NULL) { - VIA_LOOP(PCB->Data); - { - vcb(ctx, PCB, via); - } - END_LOOP; - } -} - -void pcb_loop_all(void *ctx, - pcb_layer_cb_t lacb, pcb_line_cb_t lcb, pcb_arc_cb_t acb, pcb_text_cb_t tcb, pcb_poly_cb_t pocb, - pcb_element_cb_t ecb, pcb_eline_cb_t elcb, pcb_earc_cb_t eacb, pcb_etext_cb_t etcb, pcb_epin_cb_t epicb, pcb_epad_cb_t epacb, - pcb_via_cb_t vcb - ) -{ - pcb_loop_layers(ctx, lacb, lcb, acb, tcb, pocb); - pcb_loop_elements(ctx, ecb, elcb, eacb, etcb, epicb, epacb); - pcb_loop_vias(ctx, vcb); -} Index: 1.1.4/src/copy.c =================================================================== --- 1.1.4/src/copy.c (revision 10776) +++ 1.1.4/src/copy.c (nonexistent) @@ -1,376 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* functions used to copy pins, elements ... - * it's necessary to copy data by calling create... since the base pointer - * may change cause of dynamic memory allocation - */ - -#include "config.h" -#include "conf_core.h" - -#include - - -#include "create.h" -#include "data.h" -#include "draw.h" -#include "misc.h" -#include "layer.h" -#include "move.h" -#include "polygon.h" -#include "rtree.h" -#include "select.h" -#include "undo.h" -#include "compat_misc.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void *CopyVia(PinTypePtr); -static void *CopyLine(LayerTypePtr, LineTypePtr); -static void *CopyArc(LayerTypePtr, ArcTypePtr); -static void *CopyText(LayerTypePtr, TextTypePtr); -static void *CopyPolygon(LayerTypePtr, PolygonTypePtr); -static void *CopyElement(ElementTypePtr); - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static Coord DeltaX, DeltaY; /* movement vector */ -static ObjectFunctionType CopyFunctions = { - CopyLine, - CopyText, - CopyPolygon, - CopyVia, - CopyElement, - NULL, - NULL, - NULL, - NULL, - NULL, - CopyArc, - NULL -}; - -/* --------------------------------------------------------------------------- - * copies data from one polygon to another - * 'Dest' has to exist - */ -PolygonTypePtr CopyPolygonLowLevel(PolygonTypePtr Dest, PolygonTypePtr Src) -{ - pcb_cardinal_t hole = 0; - pcb_cardinal_t n; - - for (n = 0; n < Src->PointN; n++) { - if (hole < Src->HoleIndexN && n == Src->HoleIndex[hole]) { - CreateNewHoleInPolygon(Dest); - hole++; - } - CreateNewPointInPolygon(Dest, Src->Points[n].X, Src->Points[n].Y); - } - SetPolygonBoundingBox(Dest); - Dest->Flags = Src->Flags; - CLEAR_FLAG(PCB_FLAG_FOUND, Dest); - return (Dest); -} - -/* --------------------------------------------------------------------------- - * copies data from one element to another and creates the destination - * if necessary - */ -ElementTypePtr -CopyElementLowLevel(DataTypePtr Data, ElementTypePtr Dest, ElementTypePtr Src, pcb_bool uniqueName, Coord dx, Coord dy) -{ - int i; - /* release old memory if necessary */ - if (Dest) - FreeElementMemory(Dest); - - /* both coordinates and flags are the same */ - Dest = CreateNewElement(Data, Dest, &PCB->Font, - MaskFlags(Src->Flags, PCB_FLAG_FOUND), - DESCRIPTION_NAME(Src), NAMEONPCB_NAME(Src), - VALUE_NAME(Src), DESCRIPTION_TEXT(Src).X + dx, - DESCRIPTION_TEXT(Src).Y + dy, - DESCRIPTION_TEXT(Src).Direction, - DESCRIPTION_TEXT(Src).Scale, MaskFlags(DESCRIPTION_TEXT(Src).Flags, PCB_FLAG_FOUND), uniqueName); - - /* abort on error */ - if (!Dest) - return (Dest); - - ELEMENTLINE_LOOP(Src); - { - CreateNewLineInElement(Dest, line->Point1.X + dx, - line->Point1.Y + dy, line->Point2.X + dx, line->Point2.Y + dy, line->Thickness); - } - END_LOOP; - PIN_LOOP(Src); - { - CreateNewPin(Dest, pin->X + dx, pin->Y + dy, pin->Thickness, - pin->Clearance, pin->Mask, pin->DrillingHole, pin->Name, pin->Number, MaskFlags(pin->Flags, PCB_FLAG_FOUND)); - } - END_LOOP; - PAD_LOOP(Src); - { - CreateNewPad(Dest, pad->Point1.X + dx, pad->Point1.Y + dy, - pad->Point2.X + dx, pad->Point2.Y + dy, pad->Thickness, - pad->Clearance, pad->Mask, pad->Name, pad->Number, MaskFlags(pad->Flags, PCB_FLAG_FOUND)); - } - END_LOOP; - ARC_LOOP(Src); - { - CreateNewArcInElement(Dest, arc->X + dx, arc->Y + dy, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness); - } - END_LOOP; - - for (i = 0; i < Src->Attributes.Number; i++) - CreateNewAttribute(&Dest->Attributes, Src->Attributes.List[i].name, Src->Attributes.List[i].value); - - Dest->MarkX = Src->MarkX + dx; - Dest->MarkY = Src->MarkY + dy; - - SetElementBoundingBox(Data, Dest, &PCB->Font); - return (Dest); -} - -/* --------------------------------------------------------------------------- - * copies a via - */ -static void *CopyVia(PinTypePtr Via) -{ - PinTypePtr via; - - via = CreateNewVia(PCB->Data, Via->X + DeltaX, Via->Y + DeltaY, - Via->Thickness, Via->Clearance, Via->Mask, Via->DrillingHole, Via->Name, MaskFlags(Via->Flags, PCB_FLAG_FOUND)); - if (!via) - return (via); - DrawVia(via); - AddObjectToCreateUndoList(PCB_TYPE_VIA, via, via, via); - return (via); -} - -/* --------------------------------------------------------------------------- - * copies a line - */ -static void *CopyLine(LayerTypePtr Layer, LineTypePtr Line) -{ - LineTypePtr line; - - line = CreateDrawnLineOnLayer(Layer, Line->Point1.X + DeltaX, - Line->Point1.Y + DeltaY, - Line->Point2.X + DeltaX, - Line->Point2.Y + DeltaY, Line->Thickness, Line->Clearance, MaskFlags(Line->Flags, PCB_FLAG_FOUND)); - if (!line) - return (line); - if (Line->Number) - line->Number = pcb_strdup(Line->Number); - DrawLine(Layer, line); - AddObjectToCreateUndoList(PCB_TYPE_LINE, Layer, line, line); - return (line); -} - -/* --------------------------------------------------------------------------- - * copies an arc - */ -static void *CopyArc(LayerTypePtr Layer, ArcTypePtr Arc) -{ - ArcTypePtr arc; - - arc = CreateNewArcOnLayer(Layer, Arc->X + DeltaX, - Arc->Y + DeltaY, Arc->Width, Arc->Height, Arc->StartAngle, - Arc->Delta, Arc->Thickness, Arc->Clearance, MaskFlags(Arc->Flags, PCB_FLAG_FOUND)); - if (!arc) - return (arc); - DrawArc(Layer, arc); - AddObjectToCreateUndoList(PCB_TYPE_ARC, Layer, arc, arc); - return (arc); -} - -/* --------------------------------------------------------------------------- - * copies a text - */ -static void *CopyText(LayerTypePtr Layer, TextTypePtr Text) -{ - TextTypePtr text; - - text = CreateNewText(Layer, &PCB->Font, Text->X + DeltaX, - Text->Y + DeltaY, Text->Direction, Text->Scale, Text->TextString, MaskFlags(Text->Flags, PCB_FLAG_FOUND)); - DrawText(Layer, text); - AddObjectToCreateUndoList(PCB_TYPE_TEXT, Layer, text, text); - return (text); -} - -/* --------------------------------------------------------------------------- - * copies a polygon - */ -static void *CopyPolygon(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - PolygonTypePtr polygon; - - polygon = CreateNewPolygon(Layer, NoFlags()); - CopyPolygonLowLevel(polygon, Polygon); - MovePolygonLowLevel(polygon, DeltaX, DeltaY); - if (!Layer->polygon_tree) - Layer->polygon_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Layer->polygon_tree, (BoxTypePtr) polygon, 0); - InitClip(PCB->Data, Layer, polygon); - DrawPolygon(Layer, polygon); - AddObjectToCreateUndoList(PCB_TYPE_POLYGON, Layer, polygon, polygon); - return (polygon); -} - -/* --------------------------------------------------------------------------- - * copies an element onto the PCB. Then does a draw. - */ -static void *CopyElement(ElementTypePtr Element) -{ - -#ifdef DEBUG - printf("Entered CopyElement, trying to copy element %s\n", Element->Name[1].TextString); -#endif - - ElementTypePtr element = CopyElementLowLevel(PCB->Data, - NULL, Element, - conf_core.editor.unique_names, DeltaX, - DeltaY); - - /* this call clears the polygons */ - AddObjectToCreateUndoList(PCB_TYPE_ELEMENT, element, element, element); - if (PCB->ElementOn && (FRONT(element) || PCB->InvisibleObjectsOn)) { - DrawElementName(element); - DrawElementPackage(element); - } - if (PCB->PinOn) { - DrawElementPinsAndPads(element); - } -#ifdef DEBUG - printf(" ... Leaving CopyElement.\n"); -#endif - return (element); -} - -/* --------------------------------------------------------------------------- - * pastes the contents of the buffer to the layout. Only visible objects - * are handled by the routine. - */ -pcb_bool CopyPastebufferToLayout(Coord X, Coord Y) -{ - pcb_cardinal_t i; - pcb_bool changed = pcb_false; - -#ifdef DEBUG - printf("Entering CopyPastebufferToLayout.....\n"); -#endif - - /* set movement vector */ - DeltaX = X - PASTEBUFFER->X, DeltaY = Y - PASTEBUFFER->Y; - - /* paste all layers */ - for (i = 0; i < max_copper_layer + 2; i++) { - LayerTypePtr sourcelayer = &PASTEBUFFER->Data->Layer[i], destlayer = LAYER_PTR(i); - - if (destlayer->On) { - changed = changed || (!LAYER_IS_EMPTY(sourcelayer)); - LINE_LOOP(sourcelayer); - { - CopyLine(destlayer, line); - } - END_LOOP; - ARC_LOOP(sourcelayer); - { - CopyArc(destlayer, arc); - } - END_LOOP; - TEXT_LOOP(sourcelayer); - { - CopyText(destlayer, text); - } - END_LOOP; - POLYGON_LOOP(sourcelayer); - { - CopyPolygon(destlayer, polygon); - } - END_LOOP; - } - } - - /* paste elements */ - if (PCB->PinOn && PCB->ElementOn) { - ELEMENT_LOOP(PASTEBUFFER->Data); - { -#ifdef DEBUG - printf("In CopyPastebufferToLayout, pasting element %s\n", element->Name[1].TextString); -#endif - if (FRONT(element) || PCB->InvisibleObjectsOn) { - CopyElement(element); - changed = pcb_true; - } - } - END_LOOP; - } - - /* finally the vias */ - if (PCB->ViaOn) { - changed |= (pinlist_length(&(PASTEBUFFER->Data->Via)) != 0); - VIA_LOOP(PASTEBUFFER->Data); - { - CopyVia(via); - } - END_LOOP; - } - - if (changed) { - Draw(); - IncrementUndoSerialNumber(); - } - -#ifdef DEBUG - printf(" .... Leaving CopyPastebufferToLayout.\n"); -#endif - - return (changed); -} - -/* --------------------------------------------------------------------------- - * copies the object identified by its data pointers and the type - * the new objects is moved by DX,DY - * I assume that the appropriate layer ... is switched on - */ -void *CopyObject(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord DX, Coord DY) -{ - void *ptr; - - /* setup movement vector */ - DeltaX = DX; - DeltaY = DY; - - /* the subroutines add the objects to the undo-list */ - ptr = ObjectOperation(&CopyFunctions, Type, Ptr1, Ptr2, Ptr3); - IncrementUndoSerialNumber(); - return (ptr); -} Index: 1.1.4/src/drill.h =================================================================== --- 1.1.4/src/drill.h (revision 10776) +++ 1.1.4/src/drill.h (nonexistent) @@ -1,31 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * This module, drill.h, was written and is Copyright (C) 1997 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -DrillInfoTypePtr GetDrillInfo(DataTypePtr); -void FreeDrillInfo(DrillInfoTypePtr); -void RoundDrillInfo(DrillInfoTypePtr, int); Index: 1.1.4/src/conf_act.c =================================================================== --- 1.1.4/src/conf_act.c (revision 10776) +++ 1.1.4/src/conf_act.c (nonexistent) @@ -1,310 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * This module, debug, was written and is Copyright (C) 2016 by Tibor Palinkas - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "global.h" -#include "data.h" -#include "config.h" -#include "conf.h" -#include "conf_core.h" -#include "error.h" -#include "misc.h" -#include "misc_util.h" -#include "route_style.h" - -static const char conf_syntax[] = - "conf(set, path, value, [role], [policy]) - change a config setting\n" - "conf(toggle, path, [role]) - invert boolean value of a flag; if no role given, overwrite the highest prio config\n" - "conf(reset, role) - reset the in-memory lihata of a role\n" - "conf(iseq, path, value) - returns whether the value of a conf item matches value (for menu checked's)\n" - ; -static const char conf_help[] = "Perform various operations on the configuration tree."; - -extern lht_doc_t *conf_root[]; -static inline int conf_iseq_pf(void *ctx, const char *fmt, ...) -{ - int res; - va_list ap; - va_start(ap, fmt); - res = pcb_append_vprintf((gds_t *)ctx, fmt, ap); - va_end(ap); - return res; -} - -static int ActionConf(int argc, const char **argv, Coord x, Coord y) -{ - const char *cmd = argc > 0 ? argv[0] : 0; - - if (NSTRCMP(cmd, "set") == 0) { - const char *path, *val; - conf_policy_t pol = POL_OVERWRITE; - conf_role_t role = CFR_invalid; - int res; - - if (argc < 3) { - Message(PCB_MSG_DEFAULT, "conf(set) needs at least two arguments"); - return 1; - } - if (argc > 3) { - role = conf_role_parse(argv[3]); - if (role == CFR_invalid) { - Message(PCB_MSG_DEFAULT, "Invalid role: '%s'", argv[3]); - return 1; - } - } - if (argc > 4) { - pol = conf_policy_parse(argv[4]); - if (pol == POL_invalid) { - Message(PCB_MSG_DEFAULT, "Invalid policy: '%s'", argv[4]); - return 1; - } - } - path = argv[1]; - val = argv[2]; - - if (role == CFR_invalid) { - conf_native_t *n = conf_get_field(argv[1]); - if (n == NULL) { - Message(PCB_MSG_DEFAULT, "Invalid conf field '%s': no such path\n", argv[1]); - return 1; - } - res = conf_set_native(n, 0, val); - } - else - res = conf_set(role, path, -1, val, pol); - if (res != 0) { - Message(PCB_MSG_DEFAULT, "conf(set) failed.\n"); - return 1; - } - } - - else if (NSTRCMP(cmd, "iseq") == 0) { - const char *path, *val; - int res; - gds_t nval; - conf_native_t *n; - - if (argc != 3) { - Message(PCB_MSG_ERROR, "conf(iseq) needs two arguments"); - return -1; - } - path = argv[1]; - val = argv[2]; - - n = conf_get_field(argv[1]); - if (n == NULL) { - Message(PCB_MSG_ERROR, "Invalid conf field '%s' in iseq: no such path\n", path); - return -1; - } - - gds_init(&nval); - conf_print_native_field(conf_iseq_pf, &nval, 0, &n->val, n->type, NULL, 0); - res = !strcmp(nval.array, val); -/* printf("iseq: %s %s==%s %d\n", path, nval.array, val, res);*/ - gds_uninit(&nval); - - return res; - } - - else if (NSTRCMP(cmd, "toggle") == 0) { - conf_native_t *n = conf_get_field(argv[1]); - const char *new_value; - conf_role_t role = CFR_invalid; - int res; - - if (n == NULL) { - Message(PCB_MSG_DEFAULT, "Invalid conf field '%s': no such path\n", argv[1]); - return 1; - } - if (n->type != CFN_BOOLEAN) { - Message(PCB_MSG_DEFAULT, "Can not toggle '%s': not a boolean\n", argv[1]); - return 1; - } - if (n->used != 1) { - Message(PCB_MSG_DEFAULT, "Can not toggle '%s': array size should be 1, not %d\n", argv[1], n->used); - return 1; - } - if (argc > 2) { - role = conf_role_parse(argv[2]); - if (role == CFR_invalid) { - Message(PCB_MSG_DEFAULT, "Invalid role: '%s'", argv[2]); - return 1; - } - } - if (n->val.boolean[0]) - new_value = "false"; - else - new_value = "true"; - if (role == CFR_invalid) - res = conf_set_native(n, 0, new_value); - else - res = conf_set(role, argv[1], -1, new_value, POL_OVERWRITE); - - if (res != 0) { - Message(PCB_MSG_DEFAULT, "Can not toggle '%s': failed to set new value\n", argv[1]); - return 1; - } - conf_update(argv[1]); - } - - else if (NSTRCMP(cmd, "reset") == 0) { - conf_role_t role; - role = conf_role_parse(argv[1]); - if (role == CFR_invalid) { - Message(PCB_MSG_DEFAULT, "Invalid role: '%s'", argv[1]); - return 1; - } - conf_reset(role, ""); - conf_update(argv[1]); - } - - else { - Message(PCB_MSG_DEFAULT, "Invalid conf command '%s'\n", argv[0]); - return 1; - } - return 0; -} - -/*------------ get/chk (check flag actions for menus) ------------------*/ -static const char GetStyle_syntax[] = "GetStyle()" ; -static const char GetStyle_help[] = "Return integer index (>=0) of the currently active style or -1 if no style is selected (== custom style)"; -static int ActionGetStyle(int argc, const char **argv, Coord x, Coord y) -{ - return pcb_route_style_lookup(&PCB->RouteStyle, conf_core.design.line_thickness, conf_core.design.via_thickness, conf_core.design.via_drilling_hole, conf_core.design.clearance, NULL); -} - -static const char ChkMode_syntax[] = "ChkMode(expected_mode)" ; -static const char ChkMode_help[] = "Return 1 if the currently selected mode is the expected_mode"; -static int ActionChkMode(int argc, const char **argv, Coord x, Coord y) -{ -#warning TODO: convert this to a compile-time hash - struct { - const char *name; - int mode; - } *m, modes[] = { - {"none", PCB_MODE_NO}, - {"arc", PCB_MODE_ARC}, - {"arrow", PCB_MODE_ARROW}, - {"copy", PCB_MODE_COPY}, - {"insertpoint", PCB_MODE_INSERT_POINT}, - {"line", PCB_MODE_LINE}, - {"lock", PCB_MODE_LOCK}, - {"move", PCB_MODE_MOVE}, - {"pastebuffer", PCB_MODE_PASTE_BUFFER}, - {"polygon", PCB_MODE_POLYGON}, - {"polygonhole", PCB_MODE_POLYGON_HOLE}, - {"rectangle", PCB_MODE_RECTANGLE}, - {"remove", PCB_MODE_REMOVE}, - {"rotate", PCB_MODE_ROTATE}, - {"rubberbandmove", PCB_MODE_RUBBERBAND_MOVE}, - {"text", PCB_MODE_TEXT}, - {"thermal", PCB_MODE_THERMAL}, - {"via", PCB_MODE_VIA}, - {NULL, 0} - }; - assert(argc == 1); - for(m = modes; m->name != NULL; m++) { - if (strcmp(m->name, argv[0]) == 0) - return conf_core.editor.mode == m->mode; - } - Message(PCB_MSG_DEFAULT, "Unknown mode in ChkMode(): %s\n", argv[1]); - abort(); - return -1; -} - - -static const char ChkGridSize_syntax[] = - "ChkGridSize(expected_size)\n" - "ChkGridSize(none)\n" - ; -static const char ChkGridSize_help[] = "Return 1 if the currently selected grid matches the expected_size. If argument is \"none\" return 1 if there is no grid."; -static int ActionChkGridSize(int argc, const char **argv, Coord x, Coord y) -{ - assert(argc == 1); - if (strcmp(argv[0], "none") == 0) - return PCB->Grid <= 300; - - return (PCB->Grid == GetValueEx(argv[0], NULL, NULL, NULL, NULL, NULL)); -} - -static const char ChkElementName_syntax[] = - "ChkElementName(1) - expect description\n" - "ChkElementName(2) - expect refdes\n" - "ChkElementName(3) - expect value\n" - ; -static const char ChkElementName_help[] = "Return 1 if currently shown element label (name) type matches the expected"; -static int ActionChkElementName(int argc, const char **argv, Coord x, Coord y) -{ - int have, expected = argv[0][0] - '0'; - - assert(argc == 1); - if (conf_core.editor.description) have = 1; - else if (conf_core.editor.name_on_pcb) have = 2; - else have = 3; - - return expected == have; -} - -static const char ChkGridUnits_syntax[] = "ChkGridUnits(expected)"; -static const char ChkGridUnits_help[] = "Return 1 if currently selected grid unit matches the expected (normally mm or mil)"; -static int ActionChkGridUnits(int argc, const char **argv, Coord x, Coord y) -{ - assert(argc == 1); - return strcmp(conf_core.editor.grid_unit->suffix, argv[0]) == 0; -} - -static const char ChkBuffer_syntax[] = "ChkBuffer(idx)"; -static const char ChkBuffer_help[] = "Return 1 if currently selected buffer's index matches idx"; -static int ActionChkBuffer(int argc, const char **argv, Coord x, Coord y) -{ - int expected = argv[0][0] - '0'; - assert(argc == 1); - - return (conf_core.editor.buffer_number + 1) == expected; -} - -HID_Action conf_action_list[] = { - {"conf", 0, ActionConf, - conf_help, conf_syntax} - , - {"GetStyle", 0, ActionGetStyle, - GetStyle_help, GetStyle_syntax} - , - {"ChkMode", 0, ActionChkMode, - ChkMode_help, ChkMode_syntax} - , - {"ChkGridSize", 0, ActionChkGridSize, - ChkGridSize_help, ChkGridSize_syntax} - , - {"ChkElementName", 0, ActionChkElementName, - ChkElementName_help, ChkElementName_syntax} - , - {"ChkGridUnits", 0, ActionChkGridUnits, - ChkGridUnits_help, ChkGridUnits_syntax} - , - {"ChkBuffer", 0, ActionChkBuffer, - ChkBuffer_help, ChkBuffer_syntax} -}; - -REGISTER_ACTIONS(conf_action_list, NULL) Index: 1.1.4/src/pcb-menu-mkey.lht =================================================================== --- 1.1.4/src/pcb-menu-mkey.lht (revision 10776) +++ 1.1.4/src/pcb-menu-mkey.lht (nonexistent) @@ -1,604 +0,0 @@ -ha:{ - li:mouse { - li:left { - li:press = { Mode(Notify) } - li:press-shift = { Mode(Notify) } - li:press-ctrl = { Mode(Save); Mode(None); Mode(Restore); Mode(Notify) } - li:press-shift-ctrl = { Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore) } - li:release = { Mode(Release) } - li:release-shift = { Mode(Release) } - li:release-ctrl = { Mode(Release) } - li:release-shift-ctrl = { Mode(Release) } - } - li:right { - li:press = { Pan(1) } - li:release = { Pan(0) } - li:press-shift = { Popup(popup1) } - li:press-ctrl = { Display(CycleCrosshair) } - } - li:middle { - li:press = { Mode(Stroke) } - li:release = { Mode(Release) } - li:press-ctrl = { Mode(Save); Mode(Copy); Mode(Notify) } - li:release-ctrl = { Mode(Notify); Mode(Restore); } - li:press-shift-ctrl = { Display(ToggleRubberbandMode); Mode(Save); Mode(Move); Mode(Notify) } - li:release-shift-ctrl = { Mode(Notify); Mode(Restore); Display(ToggleRubberbandMode) } - } - li:scroll-up { - li:press = { Zoom(0.8) } - li:press-shift = { Scroll(up) } - li:press-ctrl = { Scroll(left) } - } - li:scroll-down { - li:press = { Zoom(1.25) } - li:press-shift = { Scroll(down) } - li:press-ctrl = { Scroll(right) } - } -# If you want zoom to center, do this instead. - #ha:scroll-up = { li:{} = {Zoom(0.8); Center()} } - #ha:scroll-down = { li:{} = {Zoom(1.25); Center()} } - } - - li:main_menu { - ### File Menu - ha:File { - m=F - li:submenu { - ha:Save Layout = { m=S; li:a={{f;s}; {Ctrls};}; action=Save(Layout); tip=Saves current layout } - ha:Save Layout As... = { m=A; li:a={{f;a}; {Shift Ctrls};}; action=Save(LayoutAs); tip=Saves current layout into a new file } - - - ha:Revert = { a={f;r}; action=Load(Revert,none); tip=Revert to the layout stored on disk } - - - ha:Import Schematics = { action=Import() } - ha:Load layout = { a={f;o}; action=Load(Layout); tip=Load a layout from a file } - ha:Load element data to paste-buffer = { li:action={PasteBuffer(Clear); Load(ElementTobuffer)} } - ha:Load layout data to paste-buffer = { li:action={PasteBuffer(Clear); Load(LayoutTobuffer)} } - ha:Load netlist file = { action=Load(Netlist) } - ha:Load vendor resource file = { action=LoadVendorFrom() } - - - ha:Save connection data of { - li:submenu { - ha:a single element = { li:action={ GetXY(Click to set the element mark <>); Save(ElementConnections)}} - ha:all elements = { action=Save(AllConnections) } - ha:unused pins = { action=Save(AllUnusedPins) } - ha:netlist patch for back annotation = {a=Alt Ctrlb; action=SavePatch() } - } - } - - - ha:Print layout... = { a={f;p}; action=Print()} - ha:Export layout... = { a={f;i}; action=Export()} - ha:Maintenance { - li:submenu { - ha:Calibrate Printer... = { action=PrintCalibrate() } - ha:Re-scan the footprint library = { action=fp_rehash() } - } - } - - - ha:Start New Layout = { li:a={{f;n}; {Ctrln};}; action=New() } - - - ha:Preferences... = { action=DoWindows(Preferences)} - - - ha:Quit Program = { li:a={{f;c}; {Ctrlq};}; action=Quit() } - } - } - - ha:Edit { - m=E - li:submenu { - ha:Undo last operation = { li:a={{e; Shiftu}; {Ctrlz}; {u};}; action=Undo() } - ha:Redo last undone operation = { li:a={{e; Shiftr}; {Ctrly}; {Shiftr};}; action=Redo() } - ha:Clear undo-buffer = { a=Shift Ctrlu; action=Undo(ClearList) } - - - ha:Cut selection to buffer = { a=Ctrlx; li:action={ GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer) } } - ha:Copy selection to buffer = { li:a={{e; c}; {Ctrlc;};} li:action={ GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Unselect(All); Mode(PasteBuffer) } } - ha:Paste buffer to layout = { a=Ctrlv; action=Mode(PasteBuffer) } - - - ha:Unselect all = { a=Shift Alta; action=Unselect(All) } - ha:Select all visible = { a=Alta; action=Select(All) } - - - ha:Edit name of { - li:submenu { - ha:text on layout = { li:a={{e;x}; {n};}; action=ChangeName(Object) } - ha:pin on layout = { a=Shift Ctrln; action=ChangeName(Object, Number) } - ha:layout = { action=ChangeName(Layout) } - ha:active layer = { action=ChangeName(Layer) } - } - } - ha:Edit attributes of { - li:submenu { - ha:Layout = { action=Attributes(Layout) } - ha:CurrentLayer = { action=Attributes(Layer) } - ha:Element = { action=Attributes(Element) } - } - } - ha:Change flags { - li:submenu { - ha:Nonetlist = { a=Altn; action=ChangeNonetlist(Element) } - } - } - ha:Route Styles { - li:submenu { - @routestyles - - - ha:Edit... = { action=AdjustStyle(0) } - } - } - } - } # Edit - - ha:View { - m=V - li:submenu { - ha:Enable visible grid = { checked=editor/draw_grid; action=conf(toggle, editor/draw_grid, design) } - ha:Enable local grid = { checked=plugins/hid_gtk/local_grid/enable; action=conf(toggle, plugins/hid_gtk/local_grid/enable, design) } - ha:Grid units { - li:submenu { - ha:mil = { checked=ChkGridUnits(mil); action=SetUnits(mil); update_on={editor/grid_unit} } - ha:mm = { checked=ChkGridUnits(mm); action=SetUnits(mm); update_on={editor/grid_unit} } - } - } - ha:Grid size = { - li:submenu { - ha:No Grid = { checked=ChkGridSize(none); action=SetValue(Grid,1); update_on={editor/grid} } - - - ha:0.1 mil = { checked=ChkGridSize(0.1mil); li:action={SetUnits(mil); SetValue(Grid,0.1mil)}; update_on={editor/grid} } - ha:1 mil = { checked=ChkGridSize(1mil); li:action={SetUnits(mil); SetValue(Grid,1mil)}; update_on={editor/grid} } - ha:5 mil = { checked=ChkGridSize(5mil); li:action={SetUnits(mil); SetValue(Grid,5mil)}; update_on={editor/grid} } - ha:10 mil = { checked=ChkGridSize(10mil); li:action={SetUnits(mil); SetValue(Grid,10mil)}; update_on={editor/grid} } - ha:25 mil = { checked=ChkGridSize(25mil); li:action={SetUnits(mil); SetValue(Grid,25mil)}; update_on={editor/grid} } - ha:50 mil = { checked=ChkGridSize(50mil); li:action={SetUnits(mil); SetValue(Grid,50mil)}; update_on={editor/grid} } - ha:100 mil = { checked=ChkGridSize(100mil); li:action={SetUnits(mil); SetValue(Grid,100mil)}; update_on={editor/grid} } - - - ha:0.01 mm = { checked=ChkGridSize(0.01mm); li:action={SetUnits(mm); SetValue(Grid,0.01mm)}; update_on={editor/grid} } - ha:0.05 mm = { checked=ChkGridSize(0.05mm); li:action={SetUnits(mm); SetValue(Grid,0.05mm)}; update_on={editor/grid} } - ha:0.1 mm = { checked=ChkGridSize(0.10mm); li:action={SetUnits(mm); SetValue(Grid,0.1mm)}; update_on={editor/grid} } - ha:0.25 mm = { checked=ChkGridSize(0.25mm); li:action={SetUnits(mm); SetValue(Grid,0.25mm)}; update_on={editor/grid} } - ha:0.5 mm = { checked=ChkGridSize(0.50mm); li:action={SetUnits(mm); SetValue(Grid,0.5mm)}; update_on={editor/grid} } - ha:1 mm = { checked=ChkGridSize(1mm); li:action={SetUnits(mm); SetValue(Grid,1mm)}; update_on={editor/grid} } - - - ha:Grid -5mil = { li:a={{[};{Shiftg};}; action=SetValue(Grid,-5,mil) } - ha:Grid +5mil = { li:a={{]};{g};}; action=SetValue(Grid,+5,mil) } - ha:Grid -0.05mm = { a=Shift Ctrlg; action=SetValue(Grid,-0.05,mm) } - ha:Grid +0.05mm = { a=Ctrlg; action=SetValue(Grid,+0.05,mm) } - } - } - ha:Grid properties = { - li:submenu { - ha:Enable local grid = { checked=plugins/hid_gtk/local_grid/enable; action=conf(toggle, plugins/hid_gtk/local_grid/enable, design) } - - - ha:local grid radius 4 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 4)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 4, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) } } - ha:local grid radius 8 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 8)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 8, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) } } - ha:local grid radius 16 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 16)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 16, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) } } - ha:local grid radius 32 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 32)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 32, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) } } - - - ha:sparse global grid = { checked=plugins/hid_gtk/global_grid/sparse; action=conf(toggle, plugins/hid_gtk/global_grid/sparse, design) } - ha:global grid density 4 = { checked={conf(iseq, plugins/hid_gtk/global_grid/min_dist_px, 4)}; li:action={conf(set, plugins/hid_gtk/global_grid/min_dist_px, 4, design); conf(set, plugins/hid_gtk/local_grid/enable, 0, design) } } - ha:global grid density 8 = { checked={conf(iseq, plugins/hid_gtk/global_grid/min_dist_px, 8)}; li:action={conf(set, plugins/hid_gtk/global_grid/min_dist_px, 8, design); conf(set, plugins/hid_gtk/local_grid/enable, 0, design) } } - ha:global grid density 16 = { checked={conf(iseq, plugins/hid_gtk/global_grid/min_dist_px, 16)}; li:action={conf(set, plugins/hid_gtk/global_grid/min_dist_px, 16, design); conf(set, plugins/hid_gtk/local_grid/enable, 0, design) } } - } - } - ha:Realign grid = { li:action={GetXY(Click to set the grid origin); Display(ToggleGrid) } } - - - ha:Displayed element name { - li:submenu { - ha:Description = { checked=ChkElementName(1); action=Display(Description); update_on={editor/description} } - ha:Reference Designator = { checked=ChkElementName(2); action=Display(NameOnPCB); update_on={editor/name_on_pcb} } - ha:Value = { checked=ChkElementName(3); action=Display(Value); update_on={editor/name_on_pcb} } - } - } - ha:Enable Pinout shows number = { checked=editor/show_number; action=conf(toggle, editor/show_number, design) } - ha:Pins/Via show Name/Number = { a=d; action=Display(PinOrPadName) } - ha:Zoom In 20% = { m=Z; a=z; action=Zoom(-1.2) } - ha:Zoom Out 20% = { m=O; a=Shiftz; action=Zoom(+1.2) } - ha:More zooms and view changes { - li:submenu { - ha:Zoom Max = { li:a={{v;f}; {v;e};}; m=M; action=Zoom() } - ha:Zoom In 2X = { a={v;i}; action=Zoom(-2) } - ha:Zoom Out 2X = { a={v;o}; action=Zoom(+2) } - ha:Zoom to 0.1mil/px = { action={Zoom(=0.1mil)} } - ha:Zoom to 0.01mm/px = { action={Zoom(=0.01mm)} } - ha:Zoom to 1mil/px = { action={Zoom(=1mil)} } - ha:Zoom to 0.05mm/px = { action={Zoom(=0.05mm)} } - ha:Zoom to 2.5mil/px = { action={Zoom(=2.5mil)} } - ha:Zoom to 0.1mm/px = { action={Zoom(=0.1mm)} } - ha:Zoom to 10mil/px = { action={Zoom(=10mil)} } - ha:Zoom In 20% and center = { m=Z; li:action={Zoom(-1.2); Center()} } - ha:Zoom Out 20% and center= { m=O; li:action={Zoom(+1.2); Center()} } - ha:Flip up/down = { checked=editor/view/flip_y; a=Tab; action=SwapSides(V) } - ha:Flip left/right = { checked=editor/view/flip_x; a=ShiftTab; action=SwapSides(H) } - ha:Spin 180 degrees = { a=CtrlTab; action=SwapSides(R) } - ha:Swap Sides = { a=Ctrl ShiftTab; action=SwapSides() } - ha:Center cursor = { a=c; action=Center() } - } - } - - - ha:Shown Layers { - li:submenu { - @layerview - - - ha:Edit Layer Groups = { action=EditLayerGroups() } - } - } - ha:Current Layer { - li:submenu { - anon2=@layerpick - - - ha:Delete current layer = { action=MoveLayer(c,-1) } - ha:Add new layer = { action=MoveLayer(-1,c) } - ha:Move current layer up = { action=MoveLayer(c,up) } - ha:Move current layer down= { action=MoveLayer(c,down) } - } - } - ha:Full screen = { checked=editor/fullscreen; a=\\; action=fullscreen(toggle) } - } - } # View - - ha:Settings = { - m=S - li:submenu { - ha:'All-direction' lines = { checked=editor/alldirection_lines; a=.; action=conf(toggle, editor/all_direction_lines, design) } - ha:Auto swap line start angle = { checked=editor/swap_start_direction; action=conf(toggle, editor/swap_start_direction, design) } - ha:Orthogonal moves = { checked=editor/orthogonal_moves; action=conf(toggle, editor/orthogonal_moves, design) } - ha:Crosshair snaps to pins and pads = { checked=editor/snap_pin; action=conf(toggle, editor/snap_pin, design) } - ha:Crosshair snaps to off-grid points on lines = { checked=editor/snap_offgrid_line; action=conf(toggle, editor/snap_offgrid_line, design) } - ha:Crosshair shows DRC clearance = { checked=editor/show_drc; action=conf(toggle, editor/show_drc, design) } - ha:Auto enforce DRC clearance = { checked=editor/auto_drc; action=conf(toggle, editor/auto_drc, design) } - ha:Lock Names = { checked=editor/lock_names; action=conf(toggle, editor/lock_names, design) } - ha:Only Names = { checked=editor/only_names; action=conf(toggle, editor/only_names, design) } - ha:Hide Names = { checked=editor/hide_names; action=conf(toggle, editor/hide_names, design) } - ha:Mincut on shorts = { checked=enablemincut; action=Display(ToggleMinCut) } - ha:Libstroke gestures on middle button = { checked=editor/enable_stroke; action=conf(toggle, editor/enable_stroke, design) } - - - ha:Rubber band mode = { checked=editor/rubber_band_mode; action=conf(toggle, editor/rubber_band_mode, design) } - ha:Require unique element names = { checked=editor/unique_names; action=conf(toggle, editor/unique_names, design) } - ha:Auto-zero delta measurements = { checked=editor/local_ref; action=conf(toggle, editor/local_ref, design) } - ha:New lines, arcs clear polygons = { checked=editor/clear_line; action=conf(toggle, editor/clear_line, design) } - ha:New polygons are full ones = { checked=editor/full_poly; action=conf(toggle, editor/full_poly, design) } - ha:Show autorouter trials = { checked=editor/live_routing; action=conf(toggle, editor/live_routing, design) } - ha:Highlighting on line, arc points = { checked=editor/highlight_on_point; action=conf(toggle, editor/highlight_on_point, design) } - ha:Thin draw = { checked=editor/thin_draw; a=|; action=conf(toggle, editor/thin_draw, design) } - ha:Thin draw poly = { checked=editor/thin_drawpoly; a=Ctrl Shiftp; action=conf(toggle, editor/thin_draw_poly, design) } - ha:Check polygons = { checked=editor/check_planes; action=conf(toggle, editor/check_planes, design) } - - - ha:Vendor drill mapping = { checked=plugins/vendor/enable; action=conf(toggle, plugins/vendor/enable, design) } - ha:Import New Elements at = { - m=I - li:submenu { - ha:Center = { m=C; action=Import(setnewpoint,center) } - ha:Mark = { m=M; action=Import(setnewpoint,mark) } - ha:Crosshair = { m=h; action=Import(setnewpoint) } - - - ha:Set Dispersion = { m=D; action=Import(setdisperse) } - } - } - } - } #Settings - - ha:Select { - m=l - li:submenu { - ha:Select all visible objects = { action=Select(All) } - ha:Select all connected objects = { action=Select(Connection) } - - - ha:Unselect all objects = { action=Unselect(All) } - ha:unselect all connected objects = { action=Unselect(Connection) } - - - ha:Select by name { - li:submenu { - ha:All objects = { active=rc/have_regex; action=Select(ObjectByName) } - ha:Elements = { active=rc/have_regex; action=Select(ElementByName) } - ha:Pads = { active=rc/have_regex; action=Select(PadByName) } - ha:Pins = { active=rc/have_regex; action=Select(PinByName) } - ha:Text = { active=rc/have_regex; action=Select(TextByName) } - ha:Vias = { active=rc/have_regex; action=Select(ViaByName) } - } - } - - - ha:Auto-place selected elements = { a=Ctrlp; action=AutoPlaceSelected() } - ha:Disperse all elements = { action=DisperseElements(All) } - ha:Disperse selected elements = { action=DisperseElements(Selected) } - - - ha:Move selected elements to other side = { a=Shiftb; action=Flip(SelectedElements) } - ha:Move selected to current layer = { a=Shiftm; action=MoveToCurrentLayer(Selected) } - ha:Remove selected objects = { a=ShiftDelete; action=RemoveSelected() } - ha:Convert selection to element = { action=Select(Convert) } - - - ha:Optimize selected rats = { li:action={DeleteRats(SelectedRats); AddRats(SelectedRats) } } - ha:Auto-route selected rats = { a=Altr; action=AutoRoute(SelectedRats) } - ha:Rip up selected auto-routed tracks = { action=RipUp(Selected) } - - - ha:Change size of selected objects { - li:submenu { - ha:Lines -10 mil = { li:action={ChangeSize(SelectedLines,-10,mil); ChangeSize(SelectedArcs,-10,mil)} } - ha:Lines +10 mil = { li:action={ChangeSize(SelectedLines,+10,mil); ChangeSize(SelectedArcs,+10,mil)} } - ha:Pads -10 mil = { action=ChangeSize(SelectedPads,-10,mil) } - ha:Pads +10 mil = { action=ChangeSize(SelectedPads,+10,mil) } - ha:Pins -10 mil = { action=ChangeSize(SelectedPins,-10,mil) } - ha:Pins +10 mil = { action=ChangeSize(SelectedPins,+10,mil) } - ha:Texts -10 mil = { action=ChangeSize(SelectedTexts,-10,mil) } - ha:Texts +10 mil = { action=ChangeSize(SelectedTexts,+10,mil) } - ha:Vias -10 mil = { action=ChangeSize(SelectedVias,-10,mil) } - ha:Vias +10 mil = { action=ChangeSize(SelectedVias,+10,mil) } - } - } - - - ha:Change drilling hole of selected objects { - li:submenu { - ha:Vias -10 mil = { action=ChangeDrillSize(SelectedVias,-10,mil) } - ha:Vias +10 mil = { action=ChangeDrillSize(SelectedVias,+10,mil) } - ha:Pins -10 mil = { action=ChangeDrillSize(SelectedPins,-10,mil) } - ha:Pins +10 mil = { action=ChangeDrillSize(SelectedPins,+10,mil) } - } - } - - - ha:Change square-flag of selected objects { - li:submenu { - ha:Elements = { action=ChangeSquare(SelectedElements) } - ha:Pins = { action=ChangeSquare(SelectedPins) } - } - } - ha:Cycle object being dragged = { a=x; action=CycleDrag() } - } - } # Select - - ha:Buffer { - m=B - li:submenu { - ha:Cut selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer)} } - ha:Paste buffer to layout = { action=Mode(PasteBuffer) } - - - ha:Rotate buffer 90 deg CCW = { a={{e; r}; {ShiftF7};}; li:action={Mode(PasteBuffer); PasteBuffer(Rotate,1)} } - ha:Rotate buffer 90 deg CW = { li:action={Mode(PasteBuffer); PasteBuffer(Rotate,3)} } - ha:Arbitrarily Rotate Buffer = { li:action={Mode(PasteBuffer); FreeRotateBuffer()} } - ha:Mirror buffer (up/down) = { a={e; i}; li:action={Mode(PasteBuffer); PasteBuffer(Mirror)} } - ha:Mirror buffer (left/right) = { li:action={Mode(PasteBuffer); PasteBuffer(Rotate,1); PasteBuffer(Mirror); PasteBuffer(Rotate,3)} } - - - ha:Clear buffer = { action=PasteBuffer(Clear) } - ha:Convert buffer to element = { action=PasteBuffer(Convert) } - ha:Break buffer elements to pieces = { action=PasteBuffer(Restore) } - ha:Save buffer elements to file = { action=Save(PasteBuffer) } - - - ha:Select Buffer \#1 = { checked=ChkBuffer(1); m=1; a=Shift1; action=PasteBuffer(1); update_on={editor/buffer_number} } - ha:Select Buffer \#2 = { checked=ChkBuffer(2); m=2; a=Shift2; action=PasteBuffer(2); update_on={editor/buffer_number} } - ha:Select Buffer \#3 = { checked=ChkBuffer(3); m=3; a=Shift3; action=PasteBuffer(3); update_on={editor/buffer_number} } - ha:Select Buffer \#4 = { checked=ChkBuffer(4); m=4; a=Shift4; action=PasteBuffer(4); update_on={editor/buffer_number} } - ha:Select Buffer \#5 = { checked=ChkBuffer(5); m=5; a=Shift5; action=PasteBuffer(5); update_on={editor/buffer_number} } - } - } # Buffer - - ha:Connects = { - m=C - li:submenu { - ha:Lookup connection to object = { a=Ctrlf; li:action={GetXY(Click on the object); Connection(Find)} } - ha:Reset scanned pads/pins/vias = { li:action={Connection(ResetPinsViasAndPads); Display(Redraw)} } - ha:Reset scanned lines/polygons = { li:action={Connection(ResetLinesAndPolygons); Display(Redraw)} } - ha:Reset all connections = { a=Shiftf; li:action={Connection(Reset); Display(Redraw)} } - - - ha:Optimize rats nest = { a=o; li:action={Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block)} } - ha:Erase rats nest = { action=DeleteRats(AllRats) } - ha:Erase selected rats = { a=Shifte; action=DeleteRats(SelectedRats) } - - - ha:Auto-route selected rats = { action=AutoRoute(Selected) } - ha:Auto-route all rats = { action=AutoRoute(AllRats) } - ha:Rip up all auto-routed tracks = { action=RipUp(All) } - - - ha:Optimize routed tracks { - li:submenu { - ha:Auto-Optimize = { a={Shift=}; action=djopt(auto) } - ha:Debumpify = { action=djopt(debumpify) } - ha:Unjaggy = { action=djopt(unjaggy) } - ha:Vianudge = { action=djopt(vianudge) } - ha:Viatrim = { action=djopt(viatrim) } - ha:Ortho pull = { action=djopt(orthopull) } - ha:Simple optimization = { a={=}; action=djopt(simple) } - ha:Miter = { action=djopt(miter) } - ha:Puller = { a=y; action=Puller() } - ha:Global Puller { - li:submenu { - ha:Selected = { action=GlobalPuller(selected) } - ha:Found = { action=GlobalPuller(found) } - ha:All = { action=GlobalPuller() } - } - } - - - ha:Only autorouted nets = { checked=plugins/djopt/auto_only; action=conf(toggle, plugins/djopt/auto_only, design) } - } - } - - - ha:Design Rule Checker = { action=DRC() } - - - ha:Apply vendor drill mapping = { action=ApplyVendor() } - - - ha:Design changes (back annotation) { - li:submenu { - ha:Swap nets on two selected pins = { a=Shiftx; action=net(swap) } - ha:Replace footprint = { a=Alt Shiftf; action=ReplaceFootprint() } - } - } - } - } # Connects - - ha:Plugins { - m=P - li:submenu { - ha:Manage plugins... = { a=Altp; action=ManagePlugins() } - } - } # Plugins - - ha:Info = { - m=I - li:submenu { - ha:Generate object report = { a=Ctrlr; action=ReportObject() } - ha:Generate drill summary = { action=Report(DrillReport) } - ha:Report found pins\/pads = { action=Report(FoundPins) } - ha:Key Bindings { - li:submenu { - ha:Remove = { li:a={{e;d};{Delete};}; li:action={Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore)} } - ha:Remove Selected = { a=BackSpace; action=RemoveSelected() } - ha:Remove Connected = { a=ShiftBackSpace; li:action={Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block)} } - ha:Remove Connected = { li:action={Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block)} } - ha:Set Same = { action=SetSame() } - ha:Flip Object = { a=b; action=Flip(Object) } - ha:Find Connections = { li:action={Connection(Reset); Connection(Find)} } - ha:ToggleHideName Object = { action=ToggleHideName(Object) } - ha:ToggleHideName SelectedElement = { a=Shifth; action=ToggleHideName(SelectedElements) } - ha:ChangeHole Object = { a=Ctrlh; action=ChangeHole(Object) } - ha:ChangeJoin Object = { a=j; action=ChangeJoin(Object) } - ha:ChangeJoin SelectedObject = { a=Shiftj; action=ChangeJoin(SelectedObjects) } - ha:Clear Object +2 mil = { a=k; action=ChangeClearSize(Object,+2,mil) } - ha:Clear Object -2 mil = { a=Shiftk; action=ChangeClearSize(Object,-2,mil) } - ha:Clear Selected +2 mil = { a=Ctrlk; action=ChangeClearSize(SelectedObjects,+2,mil) } - ha:Clear Selected -2 mil = { a=Shift Ctrlk; action=ChangeClearSize(SelectedObjects,-2,mil) } - ha:Line Tool size +5 mil = { a=l; action=SetValue(LineSize,+5,mil) } - ha:Line Tool size -5 mil = { a=Shiftl; action=SetValue(LineSize,-5,mil) } - ha:Move Object to current layer = { a=m; action=MoveToCurrentLayer(Object) } - ha:MarkCrosshair = { a=Ctrlm; action=MarkCrosshair() } - ha:Select shortest rat = { a=Shiftn; action=AddRats(Close) } - ha:AddRats to selected pins = { a=Shifto; li:action={Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(SelectedRats); Atomic(Block)} } - ha:ChangeOctagon Object = { a=Ctrlo; action=ChangeOctagon(Object) } - ha:Polygon PreviousPoint = { a=p; action=Polygon(PreviousPoint) } - ha:Polygon Close = { a=Shiftp; action=Polygon(Close) } - ha:ChangeSquare Object = { a=q; action=ChangeSquare(ToggleObject) } - ha:ChangeSizes to Route style = { a=Shifty; action=ChangeSizes(Object,style,mil) } - ha:ChangeSize +5 mil = { a=s; action=ChangeSize(Object,+5,mil) } - ha:ChangeSize -5 mil = { a=Shifts; action=ChangeSize(Object,-5,mil) } - ha:ChangeDrill +5 mil = { a=Alts; action=ChangeDrillSize(Object,+5,mil) } - ha:ChangeDrill -5 mil = { a=Alt Shifts; action=ChangeDrillSize(Object,-5,mil) } - ha:Text Tool scale +10 mil = { a=t; action=SetValue(TextScale,+10,mil) } - ha:Text Tool scale -10 mil = { a=Shiftt; action=SetValue(TextScale,-10,mil) } - ha:Via Tool size +5 mil = { a=Shiftv; action=SetValue(ViaSize,+5,mil) } - ha:Via Tool size -5 mil = { a=Shift Ctrlv; action=SetValue(ViaSize,-5,mil) } - ha:Via Tool drill +5 mil = { a=Altv; action=SetValue(ViaDrillingHole,+5,mil) } - ha:Via Tool drill -5 mil = { a=Alt Shiftv; action=SetValue(ViaDrillingHole,-5,mil) } - ha:AddRats Selected = { a=Shiftw; action=AddRats(SelectedRats) } - ha:Add All Rats = { a=w; action=AddRats(AllRats) } - ha:Cycle Clip = { a=/; action=Display(CycleClip) } - ha:Arrow Mode = { a=space; checked=ChkMode(arrow); action=Mode(Arrow); update_on={editor/mode} } - ha:Temp Arrow ON = { li:action={Mode(Save); Mode(Arrow); Mode(Notify)} } - ha:Temp Arrow OFF = { li:action={Mode(Release); Mode(Restore)} } - - - ha:Step Up = { a=Up; action=Cursor(Warp,0,1,grid) } - ha:Step Down = { a=Down; action=Cursor(Warp,0,-1,grid) } - ha:Step Left = { a=Left; action=Cursor(Warp,-1,0,grid) } - ha:Step Right = { a=Right; action=Cursor(Warp,1,0,grid) } - ha:Step +Up = { a=ShiftUp; action=Cursor(Pan,0,50,view) } - ha:Step +Down = { a=ShiftDown; action=Cursor(Pan,0,-50,view) } - ha:Step +Left = { a=ShiftLeft; action=Cursor(Pan,-50,0,view) } - ha:Step +Right = { a=ShiftRight; action=Cursor(Pan,50,0,view) } - ha:Click = { a=Enter; li:action={Mode(Notify); Mode(Release)} } - - - ha:layer keys { - li:submenu { - ha:Select Layer 1 = { a=1; action=SelectLayer(1) } - ha:Select Layer 2 = { a=2; action=SelectLayer(2) } - ha:Select Layer 3 = { a=3; action=SelectLayer(3) } - ha:Select Layer 4 = { a=4; action=SelectLayer(4) } - ha:Select Layer 5 = { a=5; action=SelectLayer(5) } - ha:Select Layer 6 = { a=6; action=SelectLayer(6) } - ha:Select Layer 7 = { a=7; action=SelectLayer(7) } - ha:Select Layer 8 = { a=8; action=SelectLayer(8) } - ha:Select Layer 9 = { a=9; action=SelectLayer(9) } - ha:Select Layer 10 = { a=0; action=SelectLayer(10) } - ha:Select Layer 11 = { a=Alt1; action=SelectLayer(11) } - ha:Select Layer 12 = { a=Alt2; action=SelectLayer(12) } - ha:Select Layer 13 = { a=Alt3; action=SelectLayer(13) } - ha:Select Layer 14 = { a=Alt4; action=SelectLayer(14) } - ha:Select Layer 15 = { a=Alt5; action=SelectLayer(15) } - ha:Select Layer 16 = { a=Alt6; action=SelectLayer(16) } - ha:Select Layer 17 = { a=Alt7; action=SelectLayer(17) } - ha:Select Layer 18 = { a=Alt8; action=SelectLayer(18) } - ha:Select Layer 19 = { a=Alt9; action=SelectLayer(19) } - ha:Select Layer 20 = { a=Alt0; action=SelectLayer(20) } - - - ha:Toggle Layer 1 = { a=Ctrl1; action=ToggleView(1) } - ha:Toggle Layer 2 = { a=Ctrl2; action=ToggleView(2) } - ha:Toggle Layer 3 = { a=Ctrl3; action=ToggleView(3) } - ha:Toggle Layer 4 = { a=Ctrl4; action=ToggleView(4) } - ha:Toggle Layer 5 = { a=Ctrl5; action=ToggleView(5) } - ha:Toggle Layer 6 = { a=Ctrl6; action=ToggleView(6) } - ha:Toggle Layer 7 = { a=Ctrl7; action=ToggleView(7) } - ha:Toggle Layer 8 = { a=Ctrl8; action=ToggleView(8) } - ha:Toggle Layer 9 = { a=Ctrl9; action=ToggleView(9) } - ha:Toggle Layer 10 = { a=Ctrl0; action=ToggleView(10) } - ha:Toggle Layer 11 = { a=Ctrl-Alt1; action=ToggleView(11) } - ha:Toggle Layer 12 = { a=Ctrl-Alt2; action=ToggleView(12) } - ha:Toggle Layer 13 = { a=Ctrl-Alt3; action=ToggleView(13) } - ha:Toggle Layer 14 = { a=Ctrl-Alt4; action=ToggleView(14) } - ha:Toggle Layer 15 = { a=Ctrl-Alt5; action=ToggleView(15) } - ha:Toggle Layer 16 = { a=Ctrl-Alt6; action=ToggleView(16) } - ha:Toggle Layer 17 = { a=Ctrl-Alt7; action=ToggleView(17) } - ha:Toggle Layer 18 = { a=Ctrl-Alt8; action=ToggleView(18) } - ha:Toggle Layer 19 = { a=Ctrl-Alt9; action=ToggleView(19) } - ha:Toggle Layer 20 = { a=Ctrl-Alt0; action=ToggleView(20) } - } - } # layer keys - } - } - } - } # Info - - ha:Window { - m=W - li:submenu { - ha:Library = { a={a;c} action=DoWindows(Library) } - ha:Message Log = { action=DoWindows(Log) } - ha:DRC Check = { action=DoWindows(DRC) } - ha:Netlist = { action=DoWindows(Netlist) } - ha:Command Entry = { a={:}; action=Command() } - ha:Pinout = { a=Shiftd; action=Display(Pinout) } - - - ha:About... = { a={h;a}; action=About() } - } - } # Window - } # main menu - - li:popups { - ha:popup1 { - li:submenu { - ha:Operations on selections { - li:submenu { - ha:Unselect all objects = { action=Unselect(All) } - ha:Remove selected objects = { action=RemoveSelected() } - ha:Copy selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Mode(PasteBuffer)} } - ha:Cut selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer)} } - ha:Convert selection to element = { action=Select(Convert) } - ha:Auto place selected elements = { action=AutoPlaceSelected() } - ha:Autoroute selected elements = { action=AutoRoute(SelectedRats) } - ha:Rip up selected auto-routed tracks = { action=RipUp(Selected) } - } - } - ha:Operations on this location { - li:submenu { - ha:Generate object report = { li:action={GetXY(Click on the object); Report(Object)} } - } - } - - - ha:Undo last operation = { action=Undo() } - ha:Redo last undone operation = { action=Redo() } - - - ha:Tools { - li:submenu { - ha:None = { checked=ChkMode(none); action=Mode(None); update_on={editor/mode} } - ha:Via = { checked=ChkMode(via); a=F1; action=Mode(Via); update_on={editor/mode} } - ha:Line = { checked=ChkMode(line); li:a={{a;n}; {a;l}; {F2};}; action=Mode(Line); update_on={editor/mode} } - ha:Arc = { checked=ChkMode(arc); li:a={{a;r}; {F3};}; action=Mode(Arc); update_on={editor/mode} } - ha:Text = { checked=ChkMode(text); li:a={{a;t}; {F4};}; action=Mode(Text); update_on={editor/mode} } - ha:Rectangle = { checked=ChkMode(rectangle); li:a={{a;p}; {a;v}; {F5};}; action=Mode(Rectangle); update_on={editor/mode} } - ha:Polygon = { checked=ChkMode(polygon); a=F6; action=Mode(Polygon); update_on={editor/mode} } - ha:Polygon Hole = { checked=ChkMode(polygonhole); action=Mode(PolygonHole); update_on={editor/mode} } - ha:Buffer = { checked=ChkMode(pastebuffer); a=F7; action=Mode(PasteBuffer); update_on={editor/mode} } - ha:Remove = { checked=ChkMode(remove); a=F8; action=Mode(Remove); update_on={editor/mode} } - ha:Rotate = { checked=ChkMode(rotate); a=F9; action=Mode(Rotate); update_on={editor/mode} } - ha:Thermal = { checked=ChkMode(thermal); a=F10; action=Mode(Thermal); update_on={editor/mode} } - ha:Arrow = { checked=ChkMode(arrow); a=F11; action=Mode(Arrow); update_on={editor/mode} } - ha:Insert Point = { checked=ChkMode(insertpoint); a=Insert; action=Mode(InsertPoint); update_on={editor/mode} } - ha:Move = { checked=ChkMode(move); action=Mode(Move); update_on={editor/mode} } - ha:Copy = { checked=ChkMode(copy); action=Mode(Copy); update_on={editor/mode} } - ha:Lock = { checked=ChkMode(lock); li:a={{e;l}; {e;Shiftl}; {F12};}; action=Mode(Lock); update_on={editor/mode} } - ha:Cancel = { a=Escape; action=Mode(Escape); } - } - } - } - } # popup1 - } # popups -} # root Index: 1.1.4/src/data.h =================================================================== --- 1.1.4/src/data.h (revision 10776) +++ 1.1.4/src/data.h (nonexistent) @@ -1,110 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* common identifiers */ - -#ifndef PCB_DATA_H -#define PCB_DATA_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * some shared identifiers - */ - - -extern CrosshairType Crosshair; - -extern MarkType Marked; - -extern OutputType Output; - -extern PCBTypePtr PCB; - -#define max_group (PCB->Data->LayerN) -#define max_copper_layer (PCB->Data->LayerN) -#define solder_silk_layer (max_copper_layer + SOLDER_LAYER) -#define component_silk_layer (max_copper_layer + COMPONENT_LAYER) - -extern BufferType Buffers[MAX_BUFFER]; - -/*extern DeviceInfoType PrintingDevice[];*/ - -extern char *InputTranslations; - -extern int addedLines; -extern int LayerStack[MAX_LAYER]; - -extern pcb_bool Bumped; - -extern FlagType no_flags; - -/****** callback based loops *****/ - -/* The functions returning int are called once when processing of a new layer - or element starts, with enter=1. If they return non-zero, the current layer - or element is skipped. If it is not skipped, the function is called once - at the end of processing the given layer or element, with enter=0 (and - return value ignored). - - Any of the callbacks for any loop function can be NULL. - */ - -/* layer object callbacks */ -typedef int (*pcb_layer_cb_t)(void *ctx, PCBType *pcb, LayerType *layer, int enter); -typedef void (*pcb_line_cb_t)(void *ctx, PCBType *pcb, LayerType *layer, LineType *line); -typedef void (*pcb_arc_cb_t)(void *ctx, PCBType *pcb, LayerType *layer, ArcType *arc); -typedef void (*pcb_text_cb_t)(void *ctx, PCBType *pcb, LayerType *layer, TextType *text); -typedef void (*pcb_poly_cb_t)(void *ctx, PCBType *pcb, LayerType *layer, PolygonType *poly); - -/* element callbacks */ -typedef int (*pcb_element_cb_t)(void *ctx, PCBType *pcb, ElementType *element, int enter); -typedef void (*pcb_eline_cb_t)(void *ctx, PCBType *pcb, ElementType *element, LineType *line); -typedef void (*pcb_earc_cb_t)(void *ctx, PCBType *pcb, ElementType *element, ArcType *arc); -typedef void (*pcb_etext_cb_t)(void *ctx, PCBType *pcb, ElementType *element, TextType *text); -typedef void (*pcb_epin_cb_t)(void *ctx, PCBType *pcb, ElementType *element, PinType *pin); -typedef void (*pcb_epad_cb_t)(void *ctx, PCBType *pcb, ElementType *element, PadType *pad); - -/* via callbacks */ -typedef void (*pcb_via_cb_t)(void *ctx, PCBType *pcb, PinType *via); - -/* Loop over all layer objects on each layer. Layer is the outer loop. */ -void pcb_loop_layers(void *ctx, pcb_layer_cb_t lacb, pcb_line_cb_t lcb, pcb_arc_cb_t acb, pcb_text_cb_t tcb, pcb_poly_cb_t pocb); - -/* Loop over all elements and element primitives. Element is the outer loop. */ -void pcb_loop_elements(void *ctx, pcb_element_cb_t ecb, pcb_eline_cb_t elcb, pcb_earc_cb_t eacb, pcb_etext_cb_t etcb, pcb_epin_cb_t epicb, pcb_epad_cb_t epacb); - -/* Loop over all vias. */ -void pcb_loop_vias(void *ctx, pcb_via_cb_t vcb); - -/* Loop over all design objects. (So all the above three in one call.) */ -void pcb_loop_all(void *ctx, - pcb_layer_cb_t lacb, pcb_line_cb_t lcb, pcb_arc_cb_t acb, pcb_text_cb_t tcb, pcb_poly_cb_t pocb, - pcb_element_cb_t ecb, pcb_eline_cb_t elcb, pcb_earc_cb_t eacb, pcb_etext_cb_t etcb, pcb_epin_cb_t epicb, pcb_epad_cb_t epacb, - pcb_via_cb_t vcb -); - -#endif Index: 1.1.4/src/copy.h =================================================================== --- 1.1.4/src/copy.h (revision 10776) +++ 1.1.4/src/copy.h (nonexistent) @@ -1,47 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for copy routines */ - -#ifndef PCB_COPY_H -#define PCB_COPY_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * some defines - */ -#define COPY_TYPES \ - (PCB_TYPE_VIA | PCB_TYPE_LINE | PCB_TYPE_TEXT | \ - PCB_TYPE_ELEMENT | PCB_TYPE_ELEMENT_NAME | PCB_TYPE_POLYGON | PCB_TYPE_ARC) - - -PolygonTypePtr CopyPolygonLowLevel(PolygonTypePtr, PolygonTypePtr); -ElementTypePtr CopyElementLowLevel(DataTypePtr, ElementTypePtr, ElementTypePtr, pcb_bool, Coord, Coord); -pcb_bool CopyPastebufferToLayout(Coord, Coord); -void *CopyObject(int, void *, void *, void *, Coord, Coord); - -#endif Index: 1.1.4/src/polyarea.h =================================================================== --- 1.1.4/src/polyarea.h (revision 10776) +++ 1.1.4/src/polyarea.h (nonexistent) @@ -1,180 +0,0 @@ -/* - poly_Boolean: a polygon clip library - Copyright (C) 1997 Alexey Nikitin, Michael Leonov - leonov@propro.iis.nsk.su - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - polyarea.h - (C) 1997 Alexey Nikitin, Michael Leonov - (C) 1997 Klamer Schutte (minor patches) -*/ - -#ifndef PCB_POLYAREA_H -#define PCB_POLYAREA_H - -typedef int BOOLp; - -#ifndef FALSE -enum { - FALSE = 0, - TRUE = 1 -}; -#endif - -#define PLF_DIR 1 -#define PLF_INV 0 -#define PLF_MARK 1 - -#ifndef min -#define min(x, y) ((x) < (y) ? (x) : (y)) -#endif - -#ifndef max -#define max(x, y) ((x) > (y) ? (x) : (y)) -#endif - - -typedef Coord vertex[2]; /* longing point representation of - coordinates */ -typedef vertex Vector; - -#define VertexEqu(a,b) (memcmp((a),(b),sizeof(Vector))==0) -#define VertexCpy(a,b) memcpy((a),(b),sizeof(Vector)) - - -extern Vector vect_zero; - -enum { - err_no_memory = 2, - err_bad_parm = 3, - err_ok = 0 -}; - - -typedef struct CVCList CVCList; -typedef struct VNODE VNODE; -struct CVCList { - double angle; - VNODE *parent; - CVCList *prev, *next, *head; - char poly, side; -}; -struct VNODE { - VNODE *next, *prev, *shared; - struct { - unsigned int status:3; - unsigned int mark:1; - } Flags; - CVCList *cvc_prev; - CVCList *cvc_next; - Vector point; -}; - -typedef struct PLINE PLINE; -struct PLINE { - Coord xmin, ymin, xmax, ymax; - PLINE *next; - VNODE head; - unsigned int Count; - double area; - rtree_t *tree; - pcb_bool is_round; - Coord cx, cy; - Coord radius; - struct { - unsigned int status:3; - unsigned int orient:1; - } Flags; -}; - -PLINE *poly_NewContour(Vector v); - -void poly_IniContour(PLINE * c); -void poly_ClrContour(PLINE * c); /* clears list of vertices */ -void poly_DelContour(PLINE ** c); - -BOOLp poly_CopyContour(PLINE ** dst, PLINE * src); - -void poly_PreContour(PLINE * c, BOOLp optimize); /* prepare contour */ -void poly_InvContour(PLINE * c); /* invert contour */ - -VNODE *poly_CreateNode(Vector v); - -void poly_InclVertex(VNODE * after, VNODE * node); -void poly_ExclVertex(VNODE * node); - -/**********************************************************************/ - -typedef struct POLYAREA POLYAREA; -struct POLYAREA { - POLYAREA *f, *b; - PLINE *contours; - rtree_t *contour_tree; -}; - -BOOLp poly_M_Copy0(POLYAREA ** dst, const POLYAREA * srcfst); -void poly_M_Incl(POLYAREA ** list, POLYAREA * a); - -BOOLp poly_Copy0(POLYAREA ** dst, const POLYAREA * src); -BOOLp poly_Copy1(POLYAREA * dst, const POLYAREA * src); - -BOOLp poly_InclContour(POLYAREA * p, PLINE * c); -BOOLp poly_ExclContour(POLYAREA * p, PLINE * c); - - -BOOLp poly_ChkContour(PLINE * a); - -BOOLp poly_CheckInside(POLYAREA * c, Vector v0); -BOOLp Touching(POLYAREA * p1, POLYAREA * p2); - -/**********************************************************************/ - -/* tools for clipping */ - -/* checks whether point lies within contour -independently of its orientation */ - -int poly_InsideContour(PLINE * c, Vector v); -int poly_ContourInContour(PLINE * poly, PLINE * inner); -POLYAREA *poly_Create(void); - -void poly_Free(POLYAREA ** p); -void poly_Init(POLYAREA * p); -void poly_FreeContours(PLINE ** pl); -BOOLp poly_Valid(POLYAREA * p); - -enum PolygonBooleanOperation { - PBO_UNITE, - PBO_ISECT, - PBO_SUB, - PBO_XOR -}; - -double vect_dist2(Vector v1, Vector v2); -double vect_det2(Vector v1, Vector v2); -double vect_len2(Vector v1); - -int vect_inters2(Vector A, Vector B, Vector C, Vector D, Vector S1, Vector S2); - -int poly_Boolean(const POLYAREA * a, const POLYAREA * b, POLYAREA ** res, int action); -int poly_Boolean_free(POLYAREA * a, POLYAREA * b, POLYAREA ** res, int action); -int poly_AndSubtract_free(POLYAREA * a, POLYAREA * b, POLYAREA ** aandb, POLYAREA ** aminusb); -int SavePOLYAREA(POLYAREA * PA, char *fname); - -/* calculate the bounding box of a POLYAREA and save result in b */ -void poly_bbox(POLYAREA * p, BoxType * b); - -#endif /* PCB_POLYAREA_H */ Index: 1.1.4/src/event.c =================================================================== --- 1.1.4/src/event.c (revision 10776) +++ 1.1.4/src/event.c (nonexistent) @@ -1,174 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include "event.h" -#include "error.h" -#include "fptr_cast.h" - -typedef struct event_s event_t; - -struct event_s { - event_handler_t *handler; - void *user_data; - const char *cookie; - event_t *next; -}; - -event_t *events[EVENT_last]; - -#define event_valid(ev) (((ev) >= 0) && ((ev) < EVENT_last)) - -void event_bind(event_id_t ev, event_handler_t * handler, void *user_data, const char *cookie) -{ - event_t *e; - - if (!(event_valid(ev))) - return; - - e = malloc(sizeof(event_t)); - e->handler = handler; - e->cookie = cookie; - e->user_data = user_data; - - /* insert the new event in front of the list */ - e->next = events[ev]; - events[ev] = e; -} - -static void event_destroy(event_t * ev) -{ - free(ev); -} - -void event_unbind(event_id_t ev, event_handler_t * handler) -{ - event_t *prev = NULL, *e, *next; - if (!(event_valid(ev))) - return; - for (e = events[ev]; e != NULL; e = next) { - next = e->next; - if (e->handler == handler) { - event_destroy(e); - if (prev == NULL) - events[ev] = next; - else - prev->next = next; - } - else - prev = e; - } -} - -void event_unbind_cookie(event_id_t ev, const char *cookie) -{ - event_t *prev = NULL, *e, *next; - if (!(event_valid(ev))) - return; - for (e = events[ev]; e != NULL; e = next) { - next = e->next; - if (e->cookie == cookie) { - event_destroy(e); - if (prev == NULL) - events[ev] = next; - else - prev->next = next; - } - else - prev = e; - } -} - - -void event_unbind_allcookie(const char *cookie) -{ - event_id_t n; - for (n = 0; n < EVENT_last; n++) - event_unbind_cookie(n, cookie); -} - -void event(event_id_t ev, const char *fmt, ...) -{ - va_list ap; - event_arg_t argv[EVENT_MAX_ARG], *a; - event_t *e; - int argc; - - a = argv; - a->type = ARG_INT; - a->d.i = ev; - argc = 1; - - if (fmt != NULL) { - va_start(ap, fmt); - for (a++; *fmt != '\0'; fmt++, a++, argc++) { - if (argc >= EVENT_MAX_ARG) { - Message(PCB_MSG_DEFAULT, "event(): too many arguments\n"); - break; - } - switch (*fmt) { - case 'i': - a->type = ARG_INT; - a->d.i = va_arg(ap, int); - break; - case 'd': - a->type = ARG_DOUBLE; - a->d.d = va_arg(ap, double); - break; - case 's': - a->type = ARG_STR; - a->d.s = va_arg(ap, const char *); - break; - default: - a->type = ARG_INT; - a->d.i = 0; - Message(PCB_MSG_DEFAULT, "event(): invalid argument type '%c'\n", *fmt); - break; - } - } - va_end(ap); - } - - for (e = events[ev]; e != NULL; e = e->next) - e->handler(e->user_data, argc, (event_arg_t **) & argv); -} - -void events_init(void) -{ - -} - -void events_uninit(void) -{ - int ev; - for(ev = 0; ev < EVENT_last; ev++) { - event_t *e, *next; - for(e = events[ev]; e != NULL; e = next) { - next = e->next; - fprintf(stderr, "WARNING: events_uninit: event %d still has %p registered for cookie %p\n", ev, pcb_cast_f2d(e->handler), (void *)e->cookie); - free(e); - } - } -} - Index: 1.1.4/src/strflags.c =================================================================== --- 1.1.4/src/strflags.c (revision 10776) +++ 1.1.4/src/strflags.c (nonexistent) @@ -1,540 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2005 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * DJ Delorie, 334 North Road, Deerfield NH 03037-1110, USA - * dj@delorie.com - * - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "global.h" -#include "strflags.h" -#include "compat_misc.h" - -/* Because all the macros expect it, that's why. */ -typedef struct { - FlagType Flags; -} FlagHolder; - -/* Be careful to list more specific flags first, followed by general - * flags, when two flags use the same bit. For example, "onsolder" is - * for elements only, while "auto" is for everything else. They use - * the same bit, but onsolder is listed first so that elements will - * use it and not auto. - * - * Thermals are handled separately, as they're layer-selective. - */ - -#define N(x) x, sizeof(x)-1 -FlagBitsType pcb_object_flagbits[] = { - {PCB_FLAG_PIN, N("pin"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_VIA, N("via"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_FOUND, N("found"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_HOLE, N("hole"), PCB_TYPEMASK_PIN}, - {PCB_FLAG_RAT, N("rat"), PCB_TYPE_RATLINE}, - {PCB_FLAG_PININPOLY, N("pininpoly"), PCB_TYPEMASK_PIN | PCB_TYPE_PAD}, - {PCB_FLAG_CLEARPOLY, N("clearpoly"), PCB_TYPE_POLYGON}, - {PCB_FLAG_HIDENAME, N("hidename"), PCB_TYPE_ELEMENT}, - {PCB_FLAG_DISPLAYNAME, N("showname"), PCB_TYPE_ELEMENT}, - {PCB_FLAG_CLEARLINE, N("clearline"), PCB_TYPE_LINE | PCB_TYPE_ARC | PCB_TYPE_TEXT}, - {PCB_FLAG_SELECTED, N("selected"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_ONSOLDER, N("onsolder"), PCB_TYPE_ELEMENT | PCB_TYPE_PAD | PCB_TYPE_TEXT}, - {PCB_FLAG_AUTO, N("auto"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_SQUARE, N("square"), PCB_TYPEMASK_PIN | PCB_TYPE_PAD}, - {PCB_FLAG_RUBBEREND, N("rubberend"), PCB_TYPE_LINE | PCB_TYPE_ARC}, - {PCB_FLAG_WARN, N("warn"), PCB_TYPEMASK_PIN | PCB_TYPE_PAD}, - {PCB_FLAG_USETHERMAL, N("usetherm"), PCB_TYPEMASK_PIN | PCB_TYPE_LINE | PCB_TYPE_ARC}, - {PCB_FLAG_OCTAGON, N("octagon"), PCB_TYPEMASK_PIN | PCB_TYPE_PAD}, - {PCB_FLAG_DRC, N("drc"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_LOCK, N("lock"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_EDGE2, N("edge2"), PCB_TYPEMASK_ALL}, - {PCB_FLAG_FULLPOLY, N("fullpoly"), PCB_TYPE_POLYGON}, - {PCB_FLAG_NOPASTE, N("nopaste"), PCB_TYPE_PAD}, - {PCB_FLAG_NONETLIST, N("nonetlist"), PCB_TYPEMASK_ALL} -}; -#undef N - -const int pcb_object_flagbits_len = ENTRIES(pcb_object_flagbits); - - -/* - * This helper function maintains a small list of buffers which are - * used by flags_to_string(). Each buffer is allocated from the heap, - * but the caller must not free them (they get realloced when they're - * reused, but never completely freed). - */ - -static struct { - char *ptr; - int len; -} buffers[10]; -static int bufptr = 0; -static char *alloc_buf(int len) -{ -#define B buffers[bufptr] - len++; - bufptr = (bufptr + 1) % 10; - if (B.len < len) { - if (B.ptr) - B.ptr = (char *) realloc(B.ptr, len); - else - B.ptr = (char *) malloc(len); - B.len = len; - } - return B.ptr; -#undef B -} - -void uninit_strflags_buf(void) -{ - int n; - for(n = 0; n < 10; n++) { - if (buffers[n].ptr != NULL) { - free(buffers[n].ptr); - buffers[n].ptr = NULL; - } - } -} - -/* - * This set of routines manages a list of layer-specific flags. - * Callers should call grow_layer_list(0) to reset the list, and - * set_layer_list(layer,1) to set bits in the layer list. The results - * are stored in layers[], which has num_layers valid entries. - */ - -static char *layers = 0; -static int max_layers = 0, num_layers = 0; - -static void grow_layer_list(int num) -{ - if (layers == 0) { - layers = (char *) calloc(num > 0 ? num : 1, 1); - max_layers = num; - } - else if (num > max_layers) { - max_layers = num; - layers = (char *) realloc(layers, max_layers); - } - if (num > num_layers) - memset(layers + num_layers, 0, num - num_layers - 1); - num_layers = num; - return; -} - -void uninit_strflags_layerlist(void) -{ - if (layers != NULL) { - free(layers); - layers = NULL; - num_layers = max_layers = 0; - } -} - -static inline void set_layer_list(int layer, int v) -{ - if (layer >= num_layers) - grow_layer_list(layer + 1); - layers[layer] = v; -} - -/* - * These next two convert between layer lists and strings. - * parse_layer_list() is passed a pointer to a string, and parses a - * list of integer which reflect layers to be flagged. It returns a - * pointer to the first character following the list. The syntax of - * the list is a paren-surrounded, comma-separated list of integers - * and/or pairs of integers separated by a dash (like "(1,2,3-7)"). - * Spaces and other punctuation are not allowed. The results are - * stored in layers[] defined above. - * - * print_layer_list() does the opposite - it uses the flags set in - * layers[] to build a string that represents them, using the syntax - * above. - * - */ - -/* Returns a pointer to the first character past the list. */ -static const char *parse_layer_list(const char *bp, int (*error) (const char *)) -{ - const char *orig_bp = bp; - int l = 0, range = -1; - int value = 1; - - grow_layer_list(0); - while (*bp) { - if (*bp == '+') - value = 2; - else if (*bp == 'S') - value = 3; - else if (*bp == 'X') - value = 4; - else if (*bp == 't') - value = 5; - else if (*bp == ')' || *bp == ',' || *bp == '-') { - if (range == -1) - range = l; - while (range <= l) - set_layer_list(range++, value); - if (*bp == '-') - range = l; - else - range = -1; - value = 1; - l = 0; - } - - else if (isdigit((int) *bp)) - l = l * 10 + (*bp - '0'); - - else if (error) { - const char *fmt = "Syntax error parsing layer list \"%.*s\" at %c"; - char *msg = alloc_buf(strlen(fmt) + strlen(orig_bp)); - sprintf(msg, fmt, bp - orig_bp + 5, orig_bp, *bp); - error(msg); - error = NULL; - } - - if (*bp == ')') - return bp + 1; - - bp++; - } - return bp; -} - -/* Number of character the value "i" requires when printed. */ -static int printed_int_length(int i, int j) -{ - int rv; - - if (i < 10) - return 1 + (j ? 1 : 0); - if (i < 100) - return 2 + (j ? 1 : 0); - - for (rv = 1; i >= 10; rv++) - i /= 10; - return rv + (j ? 1 : 0); -} - -/* Returns a pointer to an internal buffer which is overwritten with - each new call. */ -static char *print_layer_list() -{ - static char *buf = 0; - static int buflen = 0; - int len, i, j; - char *bp; - - len = 2; - for (i = 0; i < num_layers; i++) - if (layers[i]) - len += 1 + printed_int_length(i, layers[i]); - if (buflen < len) { - if (buf) - buf = (char *) realloc(buf, len); - else - buf = (char *) malloc(len); - buflen = len; - } - - bp = buf; - *bp++ = '('; - - for (i = 0; i < num_layers; i++) - if (layers[i]) { - /* 0 0 1 1 1 0 0 */ - /* i j */ - for (j = i + 1; j < num_layers && layers[j] == 1; j++); - if (j > i + 2) { - sprintf(bp, "%d-%d,", i, j - 1); - i = j - 1; - } - else - switch (layers[i]) { - case 1: - sprintf(bp, "%d,", i); - break; - case 2: - sprintf(bp, "%d+,", i); - break; - case 3: - sprintf(bp, "%dS,", i); - break; - case 4: - sprintf(bp, "%dX,", i); - break; - case 5: - default: - sprintf(bp, "%dt,", i); - break; - } - bp += strlen(bp); - } - bp[-1] = ')'; - *bp = 0; - return buf; -} - -/* - * Ok, now the two entry points to this file. The first, string_to_flags, - * is passed a string (usually from parse_y.y) and returns a "set of flags". - * In theory, this can be anything, but for now it's just an integer. Later - * it might be a structure, for example. - * - * Currently, there is no error handling :-P - */ - -static int error_ignore(const char *msg) -{ /* do nothing */ - return 0; -} - -static FlagType empty_flags; - -FlagType -common_string_to_flags(const char *flagstring, int (*error) (const char *msg), FlagBitsType * flagbits, int n_flagbits) -{ - const char *fp, *ep; - int flen; - FlagHolder rv; - int i; - - rv.Flags = empty_flags; - - if (error == 0) - error = error_ignore; - - if (flagstring == NULL) - return empty_flags; - - fp = ep = flagstring; - - if (*fp == '"') - ep = ++fp; - - while (*ep && *ep != '"') { - int found = 0; - - for (ep = fp; *ep && *ep != ',' && *ep != '"' && *ep != '('; ep++); - flen = ep - fp; - if (*ep == '(') - ep = parse_layer_list(ep + 1, error); - - if (flen == 7 && memcmp(fp, "thermal", 7) == 0) { - for (i = 0; i < MAX_LAYER && i < num_layers; i++) - if (layers[i]) - ASSIGN_THERM(i, layers[i], &rv); - } - else if (flen == 5 && memcmp(fp, "shape", 5) == 0) { - rv.Flags.q = atoi(fp + 6); - } - else if (flen == 7 && memcmp(fp, "intconn", 7) == 0) { - rv.Flags.int_conn_grp = atoi(fp + 8); - } - else { - for (i = 0; i < n_flagbits; i++) - if (flagbits[i].nlen == flen && memcmp(flagbits[i].name, fp, flen) == 0) { - found = 1; - SET_FLAG(flagbits[i].mask, &rv); - break; - } - if (!found) { - const char *fmt = "Unknown flag: \"%.*s\" ignored"; - unknown_flag_t *u; - char *msg; - const char *s; - - /* include () */ - s = fp + flen; - if (*s == '(') { - while (*s != ')') { - flen++; - s++; - } - } - if (*s == ')') - flen++; - - msg = alloc_buf(strlen(fmt) + flen); - sprintf(msg, fmt, flen, fp); - error(msg); - - u = malloc(sizeof(unknown_flag_t)); - u->str = pcb_strndup(fp, flen); - u->next = NULL; - /* need to append, to keep order of flags */ - if (rv.Flags.unknowns != NULL) { - unknown_flag_t *n; - for (n = rv.Flags.unknowns; n->next != NULL; n = n->next); - n->next = u; - } - else - rv.Flags.unknowns = u; - } - } - fp = ep + 1; - } - return rv.Flags; -} - -FlagType string_to_flags(const char *flagstring, int (*error) (const char *msg)) -{ - return common_string_to_flags(flagstring, error, pcb_object_flagbits, ENTRIES(pcb_object_flagbits)); -} - - -/* - * Given a set of flags for a given type of object, return a string - * which reflects those flags. The only requirement is that this - * string be parseable by string_to_flags. - * - * Note that this function knows a little about what kinds of flags - * will be automatically set by parsing, so it won't (for example) - * include the "via" flag for PCB_TYPE_VIAs because it knows those get - * forcibly set when vias are parsed. - */ - -char *common_flags_to_string(FlagType flags, int object_type, FlagBitsType * flagbits, int n_flagbits) -{ - int len; - int i; - FlagHolder fh, savef; - char *buf, *bp; - unknown_flag_t *u; - - fh.Flags = flags; - -#ifndef FLAG_TEST - switch (object_type) { - case PCB_TYPE_VIA: - CLEAR_FLAG(PCB_FLAG_VIA, &fh); - break; - case PCB_TYPE_RATLINE: - CLEAR_FLAG(PCB_FLAG_RAT, &fh); - break; - case PCB_TYPE_PIN: - CLEAR_FLAG(PCB_FLAG_PIN, &fh); - break; - } -#endif - - savef = fh; - - len = 3; /* for "()\0" */ - - for (i = 0; i < n_flagbits; i++) - - if ((flagbits[i].object_types & object_type) - && (TEST_FLAG(flagbits[i].mask, &fh))) { - - len += flagbits[i].nlen + 1; - CLEAR_FLAG(flagbits[i].mask, &fh); - } - - if (TEST_ANY_THERMS(&fh)) { - len += sizeof("thermal()"); - for (i = 0; i < MAX_LAYER; i++) - if (TEST_THERM(i, &fh)) - len += printed_int_length(i, GET_THERM(i, &fh)) + 1; - } - - if (flags.q > 0) { - len += sizeof("shape(.)"); - if (flags.q > 9) - len += 2; - } - - if (flags.int_conn_grp > 0) { - len += sizeof("intconn(.)"); - if (flags.q > 9) - len++; - if (flags.q > 99) - len++; - } - - for (u = flags.unknowns; u != NULL; u = u->next) - len += strlen(u->str) + 1; - - bp = buf = alloc_buf(len + 2); - - *bp++ = '"'; - - fh = savef; - for (i = 0; i < n_flagbits; i++) - if (flagbits[i].object_types & object_type && (TEST_FLAG(flagbits[i].mask, &fh))) { - if (bp != buf + 1) - *bp++ = ','; - strcpy(bp, flagbits[i].name); - bp += flagbits[i].nlen; - CLEAR_FLAG(flagbits[i].mask, &fh); - } - - if (TEST_ANY_THERMS(&fh)) { - if (bp != buf + 1) - *bp++ = ','; - strcpy(bp, "thermal"); - bp += strlen("thermal"); - grow_layer_list(0); - for (i = 0; i < MAX_LAYER; i++) - if (TEST_THERM(i, &fh)) - set_layer_list(i, GET_THERM(i, &fh)); - strcpy(bp, print_layer_list()); - bp += strlen(bp); - } - - if (flags.q > 0) { - if (bp != buf + 1) - *bp++ = ','; - bp += sprintf(bp, "shape(%d)", flags.q); - } - - if (flags.int_conn_grp > 0) { - if (bp != buf + 1) - *bp++ = ','; - bp += sprintf(bp, "intconn(%d)", flags.int_conn_grp); - } - - for (u = flags.unknowns; u != NULL; u = u->next) { - int len; - len = strlen(u->str); - if (bp != buf + 1) - *bp++ = ','; - memcpy(bp, u->str, len); - bp += len; - } - - *bp++ = '"'; - *bp = 0; - return buf; -} - -char *flags_to_string(FlagType flags, int object_type) -{ - return common_flags_to_string(flags, object_type, pcb_object_flagbits, ENTRIES(pcb_object_flagbits)); -} Index: 1.1.4/src/event.h =================================================================== --- 1.1.4/src/event.h (revision 10776) +++ 1.1.4/src/event.h (nonexistent) @@ -1,83 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_EVENT_H -#define PCB_EVENT_H -typedef enum { - EVENT_GUI_INIT, /* finished initializing the GUI called right before the main loop of the GUI; args: (void) */ - EVENT_CLI_ENTER, /* the user pressed enter on a CLI command - called before parsing the line for actions; args: (str commandline) */ - EVENT_SAVE_PRE, /* called before saving the design */ - EVENT_SAVE_POST, /* called after saving the design */ - EVENT_LOAD_PRE, /* called before loading a new design */ - EVENT_LOAD_POST, /* called after loading a new design, whether it was successful or not */ - EVENT_last /* not a real event */ -} event_id_t; - -/* Maximum number of arguments for an event handler, auto-set argv[0] included */ -#define EVENT_MAX_ARG 16 - -/* Argument types in event's argv[] */ -typedef enum { - ARG_INT, /* format char: i */ - ARG_DOUBLE, /* format char: d */ - ARG_STR /* format char: s */ -} event_argtype_t; - - -/* An argument is its type and value */ -typedef struct { - event_argtype_t type; - union { - int i; - double d; - const char *s; - } d; -} event_arg_t; - -/* Initialize the event system */ -void events_init(void); - -/* Uninitialize the event system and remove all events */ -void events_uninit(void); - - -/* Event callback prototype; user_data is the same as in event_bind(). - argv[0] is always an ARG_INT with the event id that triggered the event. */ -typedef void (event_handler_t) (void *user_data, int argc, event_arg_t * argv[]); - -/* Bind: add a handler to the call-list of an event; the cookie is also remembered - so that mass-unbind is easier later. user_data is passed to the handler. */ -void event_bind(event_id_t ev, event_handler_t * handler, void *user_data, const char *cookie); - -/* Unbind: remove a handler from an event */ -void event_unbind(event_id_t ev, event_handler_t * handler); - -/* Unbind by cookie: remove all handlers from an event matching the cookie */ -void event_unbind_cookie(event_id_t ev, const char *cookie); - -/* Unbind all by cookie: remove all handlers from all events matching the cookie */ -void event_unbind_allcookie(const char *cookie); - -/* Event trigger: call all handlers for an event. Fmt is a list of - format characters (e.g. i for ARG_INT). */ -void event(event_id_t ev, const char *fmt, ...); -#endif Index: 1.1.4/src/polygon.c =================================================================== --- 1.1.4/src/polygon.c (revision 10776) +++ 1.1.4/src/polygon.c (nonexistent) @@ -1,1846 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2010 Thomas Nau - * - * 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 - * - */ - - -/* - -Here's a brief tour of the data and life of a polygon, courtesy of Ben -Jackson: - -A PCB PolygonType contains an array of points outlining the polygon. -This is what is manipulated by the UI and stored in the saved PCB. - -A PolygonType also contains a POLYAREA called 'Clipped' which is -computed dynamically by InitClip every time a board is loaded. The -point array is converted to a POLYAREA by original_poly and then holes -are cut in it by clearPoly. After that it is maintained dynamically -as parts are added, moved or removed (this is why sometimes bugs can -be fixed by just re-loading the board). - -A POLYAREA consists of a linked list of PLINE structures. The head of -that list is POLYAREA.contours. The first contour is an outline of a -filled region. All of the subsequent PLINEs are holes cut out of that -first contour. POLYAREAs are in a doubly-linked list and each member -of the list is an independent (non-overlapping) area with its own -outline and holes. The function biggest() finds the largest POLYAREA -so that PolygonType.Clipped points to that shape. The rest of the -polygon still exists, it's just ignored when turning the polygon into -copper. - -The first POLYAREA in PolygonType.Clipped is what is used for the vast -majority of Polygon related tests. The basic logic for an -intersection is "is the target shape inside POLYAREA.contours and NOT -fully enclosed in any of POLYAREA.contours.next... (the holes)". - -The polygon dicer (NoHolesPolygonDicer and r_NoHolesPolygonDicer) -emits a series of "simple" PLINE shapes. That is, the PLINE isn't -linked to any other "holes" oulines). That's the meaning of the first -test in r_NoHolesPolygonDicer. It is testing to see if the PLINE -contour (the first, making it a solid outline) has a valid next -pointer (which would point to one or more holes). The dicer works by -recursively chopping the polygon in half through the first hole it -sees (which is guaranteed to eliminate at least that one hole). The -dicer output is used for HIDs which cannot render things with holes -(which would require erasure). - -*/ - -/* special polygon editing routines - */ - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include - -#include "box.h" -#include "create.h" -#include "crosshair.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "polygon.h" -#include "remove.h" -#include "rtree.h" -#include "search.h" -#include "set.h" -#include "thermal.h" -#include "undo.h" -#include "misc.h" -#include "layer.h" - -#define ROUND(x) ((long)(((x) >= 0 ? (x) + 0.5 : (x) - 0.5))) - -#define UNSUBTRACT_BLOAT 10 -#define SUBTRACT_PIN_VIA_BATCH_SIZE 100 -#define SUBTRACT_LINE_BATCH_SIZE 20 - -static double rotate_circle_seg[4]; - -void polygon_init(void) -{ - double cos_ang = cos(2.0 * M_PI / POLY_CIRC_SEGS_F); - double sin_ang = sin(2.0 * M_PI / POLY_CIRC_SEGS_F); - - rotate_circle_seg[0] = cos_ang; - rotate_circle_seg[1] = -sin_ang; - rotate_circle_seg[2] = sin_ang; - rotate_circle_seg[3] = cos_ang; -} - -pcb_cardinal_t polygon_point_idx(PolygonTypePtr polygon, PointTypePtr point) -{ - assert(point >= polygon->Points); - assert(point <= polygon->Points + polygon->PointN); - return ((char *) point - (char *) polygon->Points) / sizeof(PointType); -} - -/* Find contour number: 0 for outer, 1 for first hole etc.. */ -pcb_cardinal_t polygon_point_contour(PolygonTypePtr polygon, pcb_cardinal_t point) -{ - pcb_cardinal_t i; - pcb_cardinal_t contour = 0; - - for (i = 0; i < polygon->HoleIndexN; i++) - if (point >= polygon->HoleIndex[i]) - contour = i + 1; - return contour; -} - -pcb_cardinal_t next_contour_point(PolygonTypePtr polygon, pcb_cardinal_t point) -{ - pcb_cardinal_t contour; - pcb_cardinal_t this_contour_start; - pcb_cardinal_t next_contour_start; - - contour = polygon_point_contour(polygon, point); - - this_contour_start = (contour == 0) ? 0 : polygon->HoleIndex[contour - 1]; - next_contour_start = (contour == polygon->HoleIndexN) ? polygon->PointN : polygon->HoleIndex[contour]; - - /* Wrap back to the start of the contour we're in if we pass the end */ - if (++point == next_contour_start) - point = this_contour_start; - - return point; -} - -pcb_cardinal_t prev_contour_point(PolygonTypePtr polygon, pcb_cardinal_t point) -{ - pcb_cardinal_t contour; - pcb_cardinal_t prev_contour_end; - pcb_cardinal_t this_contour_end; - - contour = polygon_point_contour(polygon, point); - - prev_contour_end = (contour == 0) ? 0 : polygon->HoleIndex[contour - 1]; - this_contour_end = (contour == polygon->HoleIndexN) ? polygon->PointN - 1 : polygon->HoleIndex[contour] - 1; - - /* Wrap back to the start of the contour we're in if we pass the end */ - if (point == prev_contour_end) - point = this_contour_end; - else - point--; - - return point; -} - -static void add_noholes_polyarea(PLINE * pline, void *user_data) -{ - PolygonType *poly = (PolygonType *) user_data; - - /* Prepend the pline into the NoHoles linked list */ - pline->next = poly->NoHoles; - poly->NoHoles = pline; -} - -void ComputeNoHoles(PolygonType * poly) -{ - poly_FreeContours(&poly->NoHoles); - if (poly->Clipped) - NoHolesPolygonDicer(poly, NULL, add_noholes_polyarea, poly); - else - printf("Compute_noholes caught poly->Clipped = NULL\n"); - poly->NoHolesValid = 1; -} - -static POLYAREA *biggest(POLYAREA * p) -{ - POLYAREA *n, *top = NULL; - PLINE *pl; - rtree_t *tree; - double big = -1; - if (!p) - return NULL; - n = p; - do { -#if 0 - if (n->contours->area < PCB->IsleArea) { - n->b->f = n->f; - n->f->b = n->b; - poly_DelContour(&n->contours); - if (n == p) - p = n->f; - n = n->f; - if (!n->contours) { - free(n); - return NULL; - } - } -#endif - if (n->contours->area > big) { - top = n; - big = n->contours->area; - } - } - while ((n = n->f) != p); - assert(top); - if (top == p) - return p; - pl = top->contours; - tree = top->contour_tree; - top->contours = p->contours; - top->contour_tree = p->contour_tree; - p->contours = pl; - p->contour_tree = tree; - assert(pl); - assert(p->f); - assert(p->b); - return p; -} - -POLYAREA *ContourToPoly(PLINE * contour) -{ - POLYAREA *p; - poly_PreContour(contour, TRUE); - assert(contour->Flags.orient == PLF_DIR); - if (!(p = poly_Create())) - return NULL; - poly_InclContour(p, contour); - assert(poly_Valid(p)); - return p; -} - -static POLYAREA *original_poly(PolygonType * p) -{ - PLINE *contour = NULL; - POLYAREA *np = NULL; - pcb_cardinal_t n; - Vector v; - int hole = 0; - - if ((np = poly_Create()) == NULL) - return NULL; - - /* first make initial polygon contour */ - for (n = 0; n < p->PointN; n++) { - /* No current contour? Make a new one starting at point */ - /* (or) Add point to existing contour */ - - v[0] = p->Points[n].X; - v[1] = p->Points[n].Y; - if (contour == NULL) { - if ((contour = poly_NewContour(v)) == NULL) - return NULL; - } - else { - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - } - - /* Is current point last in contour? If so process it. */ - if (n == p->PointN - 1 || (hole < p->HoleIndexN && n == p->HoleIndex[hole] - 1)) { - poly_PreContour(contour, TRUE); - - /* make sure it is a positive contour (outer) or negative (hole) */ - if (contour->Flags.orient != (hole ? PLF_INV : PLF_DIR)) - poly_InvContour(contour); - assert(contour->Flags.orient == (hole ? PLF_INV : PLF_DIR)); - - poly_InclContour(np, contour); - contour = NULL; - assert(poly_Valid(np)); - - hole++; - } - } - return biggest(np); -} - -POLYAREA *PolygonToPoly(PolygonType * p) -{ - return original_poly(p); -} - -POLYAREA *RectPoly(Coord x1, Coord x2, Coord y1, Coord y2) -{ - PLINE *contour = NULL; - Vector v; - - /* Return NULL for zero or negatively sized rectangles */ - if (x2 <= x1 || y2 <= y1) - return NULL; - - v[0] = x1; - v[1] = y1; - if ((contour = poly_NewContour(v)) == NULL) - return NULL; - v[0] = x2; - v[1] = y1; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - v[0] = x2; - v[1] = y2; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - v[0] = x1; - v[1] = y2; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - return ContourToPoly(contour); -} - -/* set up x and y multiplier for an octa poly, depending on square pin style */ -void square_pin_factors(int style, double *xm, double *ym) -{ - int i; - const double factor = 2.0; - - /* reset multipliers */ - for (i = 0; i < 8; i++) { - xm[i] = 1; - ym[i] = 1; - } - - style--; - if (style & 1) - xm[0] = xm[1] = xm[6] = xm[7] = factor; - if (style & 2) - xm[2] = xm[3] = xm[4] = xm[5] = factor; - if (style & 4) - ym[4] = ym[5] = ym[6] = ym[7] = factor; - if (style & 8) - ym[0] = ym[1] = ym[2] = ym[3] = factor; -} - - -POLYAREA *OctagonPoly(Coord x, Coord y, Coord radius, int style) -{ - PLINE *contour = NULL; - Vector v; - double xm[8], ym[8]; - - square_pin_factors(style, xm, ym); - -#warning TODO: rewrite this to use the same table as the square/oct pin draw function - /* point 7 */ - v[0] = x + ROUND(radius * 0.5) * xm[7]; - v[1] = y + ROUND(radius * PCB_TAN_22_5_DEGREE_2) * ym[7]; - if ((contour = poly_NewContour(v)) == NULL) - return NULL; - /* point 6 */ - v[0] = x + ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[6]; - v[1] = y + ROUND(radius * 0.5) * ym[6]; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - /* point 5 */ - v[0] = x - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[5]; - v[1] = y + ROUND(radius * 0.5) * ym[5]; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - /* point 4 */ - v[0] = x - ROUND(radius * 0.5) * xm[4]; - v[1] = y + ROUND(radius * PCB_TAN_22_5_DEGREE_2) * ym[4]; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - /* point 3 */ - v[0] = x - ROUND(radius * 0.5) * xm[3]; - v[1] = y - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * ym[3]; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - /* point 2 */ - v[0] = x - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[2]; - v[1] = y - ROUND(radius * 0.5) * ym[2]; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - /* point 1 */ - v[0] = x + ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[1]; - v[1] = y - ROUND(radius * 0.5) * ym[1]; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - /* point 0 */ - v[0] = x + ROUND(radius * 0.5) * xm[0]; - v[1] = y - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * ym[0]; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - return ContourToPoly(contour); -} - -/* add vertices in a fractional-circle starting from v - * centered at X, Y and going counter-clockwise - * does not include the first point - * last argument is 1 for a full circle - * 2 for a half circle - * or 4 for a quarter circle - */ -void frac_circle(PLINE * c, Coord X, Coord Y, Vector v, int range) -{ - double e1, e2, t1; - int i; - - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - /* move vector to origin */ - e1 = (v[0] - X) * POLY_CIRC_RADIUS_ADJ; - e2 = (v[1] - Y) * POLY_CIRC_RADIUS_ADJ; - - /* NB: the caller adds the last vertex, hence the -1 */ - range = POLY_CIRC_SEGS / range - 1; - for (i = 0; i < range; i++) { - /* rotate the vector */ - t1 = rotate_circle_seg[0] * e1 + rotate_circle_seg[1] * e2; - e2 = rotate_circle_seg[2] * e1 + rotate_circle_seg[3] * e2; - e1 = t1; - v[0] = X + ROUND(e1); - v[1] = Y + ROUND(e2); - poly_InclVertex(c->head.prev, poly_CreateNode(v)); - } -} - -/* create a circle approximation from lines */ -POLYAREA *CirclePoly(Coord x, Coord y, Coord radius) -{ - PLINE *contour; - Vector v; - - if (radius <= 0) - return NULL; - v[0] = x + radius; - v[1] = y; - if ((contour = poly_NewContour(v)) == NULL) - return NULL; - frac_circle(contour, x, y, v, 1); - contour->is_round = TRUE; - contour->cx = x; - contour->cy = y; - contour->radius = radius; - return ContourToPoly(contour); -} - -/* make a rounded-corner rectangle with radius t beyond x1,x2,y1,y2 rectangle */ -POLYAREA *RoundRect(Coord x1, Coord x2, Coord y1, Coord y2, Coord t) -{ - PLINE *contour = NULL; - Vector v; - - assert(x2 > x1); - assert(y2 > y1); - v[0] = x1 - t; - v[1] = y1; - if ((contour = poly_NewContour(v)) == NULL) - return NULL; - frac_circle(contour, x1, y1, v, 4); - v[0] = x2; - v[1] = y1 - t; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - frac_circle(contour, x2, y1, v, 4); - v[0] = x2 + t; - v[1] = y2; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - frac_circle(contour, x2, y2, v, 4); - v[0] = x1; - v[1] = y2 + t; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - frac_circle(contour, x1, y2, v, 4); - return ContourToPoly(contour); -} - -#define ARC_ANGLE 5 -static POLYAREA *ArcPolyNoIntersect(ArcType * a, Coord thick) -{ - PLINE *contour = NULL; - POLYAREA *np = NULL; - Vector v; - BoxType *ends; - int i, segs; - double ang, da, rx, ry; - long half; - double radius_adj; - - if (thick <= 0) - return NULL; - if (a->Delta < 0) { - a->StartAngle += a->Delta; - a->Delta = -a->Delta; - } - half = (thick + 1) / 2; - ends = GetArcEnds(a); - /* start with inner radius */ - rx = MAX(a->Width - half, 0); - ry = MAX(a->Height - half, 0); - segs = 1; - if (thick > 0) - segs = MAX(segs, a->Delta * M_PI / 360 * - sqrt(sqrt((double) rx * rx + (double) ry * ry) / POLY_ARC_MAX_DEVIATION / 2 / thick)); - segs = MAX(segs, a->Delta / ARC_ANGLE); - - ang = a->StartAngle; - da = (1.0 * a->Delta) / segs; - radius_adj = (M_PI * da / 360) * (M_PI * da / 360) / 2; - v[0] = a->X - rx * cos(ang * PCB_M180); - v[1] = a->Y + ry * sin(ang * PCB_M180); - if ((contour = poly_NewContour(v)) == NULL) - return 0; - for (i = 0; i < segs - 1; i++) { - ang += da; - v[0] = a->X - rx * cos(ang * PCB_M180); - v[1] = a->Y + ry * sin(ang * PCB_M180); - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - } - /* find last point */ - ang = a->StartAngle + a->Delta; - v[0] = a->X - rx * cos(ang * PCB_M180) * (1 - radius_adj); - v[1] = a->Y + ry * sin(ang * PCB_M180) * (1 - radius_adj); - /* add the round cap at the end */ - frac_circle(contour, ends->X2, ends->Y2, v, 2); - /* and now do the outer arc (going backwards) */ - rx = (a->Width + half) * (1 + radius_adj); - ry = (a->Width + half) * (1 + radius_adj); - da = -da; - for (i = 0; i < segs; i++) { - v[0] = a->X - rx * cos(ang * PCB_M180); - v[1] = a->Y + ry * sin(ang * PCB_M180); - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - ang += da; - } - /* now add other round cap */ - ang = a->StartAngle; - v[0] = a->X - rx * cos(ang * PCB_M180) * (1 - radius_adj); - v[1] = a->Y + ry * sin(ang * PCB_M180) * (1 - radius_adj); - frac_circle(contour, ends->X1, ends->Y1, v, 2); - /* now we have the whole contour */ - if (!(np = ContourToPoly(contour))) - return NULL; - return np; -} - -#define MIN_CLEARANCE_BEFORE_BISECT 10. -POLYAREA *ArcPoly(ArcType * a, Coord thick) -{ - double delta; - ArcType seg1, seg2; - POLYAREA *tmp1, *tmp2, *res; - - delta = (a->Delta < 0) ? -a->Delta : a->Delta; - - /* If the arc segment would self-intersect, we need to construct it as the union of - two non-intersecting segments */ - - if (2 * M_PI * a->Width * (1. - (double) delta / 360.) - thick < MIN_CLEARANCE_BEFORE_BISECT) { - int half_delta = a->Delta / 2; - - seg1 = seg2 = *a; - seg1.Delta = half_delta; - seg2.Delta -= half_delta; - seg2.StartAngle += half_delta; - - tmp1 = ArcPolyNoIntersect(&seg1, thick); - tmp2 = ArcPolyNoIntersect(&seg2, thick); - poly_Boolean_free(tmp1, tmp2, &res, PBO_UNITE); - return res; - } - - return ArcPolyNoIntersect(a, thick); -} - -POLYAREA *LinePoly(LineType * L, Coord thick) -{ - PLINE *contour = NULL; - POLYAREA *np = NULL; - Vector v; - double d, dx, dy; - long half; - LineType _l = *L, *l = &_l; - - if (thick <= 0) - return NULL; - half = (thick + 1) / 2; - d = sqrt(SQUARE(l->Point1.X - l->Point2.X) + SQUARE(l->Point1.Y - l->Point2.Y)); - if (!TEST_FLAG(PCB_FLAG_SQUARE, l)) - if (d == 0) /* line is a point */ - return CirclePoly(l->Point1.X, l->Point1.Y, half); - if (d != 0) { - d = half / d; - dx = (l->Point1.Y - l->Point2.Y) * d; - dy = (l->Point2.X - l->Point1.X) * d; - } - else { - dx = half; - dy = 0; - } - if (TEST_FLAG(PCB_FLAG_SQUARE, l)) { /* take into account the ends */ - l->Point1.X -= dy; - l->Point1.Y += dx; - l->Point2.X += dy; - l->Point2.Y -= dx; - } - v[0] = l->Point1.X - dx; - v[1] = l->Point1.Y - dy; - if ((contour = poly_NewContour(v)) == NULL) - return 0; - v[0] = l->Point2.X - dx; - v[1] = l->Point2.Y - dy; - if (TEST_FLAG(PCB_FLAG_SQUARE, l)) - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - else - frac_circle(contour, l->Point2.X, l->Point2.Y, v, 2); - v[0] = l->Point2.X + dx; - v[1] = l->Point2.Y + dy; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - v[0] = l->Point1.X + dx; - v[1] = l->Point1.Y + dy; - if (TEST_FLAG(PCB_FLAG_SQUARE, l)) - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - else - frac_circle(contour, l->Point1.X, l->Point1.Y, v, 2); - /* now we have the line contour */ - if (!(np = ContourToPoly(contour))) - return NULL; - return np; -} - -/* make a rounded-corner rectangle */ -POLYAREA *SquarePadPoly(PadType * pad, Coord clear) -{ - PLINE *contour = NULL; - POLYAREA *np = NULL; - Vector v; - double d; - double tx, ty; - double cx, cy; - PadType _t = *pad, *t = &_t; - PadType _c = *pad, *c = &_c; - int halfthick = (pad->Thickness + 1) / 2; - int halfclear = (clear + 1) / 2; - - d = sqrt(SQUARE(pad->Point1.X - pad->Point2.X) + SQUARE(pad->Point1.Y - pad->Point2.Y)); - if (d != 0) { - double a = halfthick / d; - tx = (t->Point1.Y - t->Point2.Y) * a; - ty = (t->Point2.X - t->Point1.X) * a; - a = halfclear / d; - cx = (c->Point1.Y - c->Point2.Y) * a; - cy = (c->Point2.X - c->Point1.X) * a; - - t->Point1.X -= ty; - t->Point1.Y += tx; - t->Point2.X += ty; - t->Point2.Y -= tx; - c->Point1.X -= cy; - c->Point1.Y += cx; - c->Point2.X += cy; - c->Point2.Y -= cx; - } - else { - tx = halfthick; - ty = 0; - cx = halfclear; - cy = 0; - - t->Point1.Y += tx; - t->Point2.Y -= tx; - c->Point1.Y += cx; - c->Point2.Y -= cx; - } - - v[0] = c->Point1.X - tx; - v[1] = c->Point1.Y - ty; - if ((contour = poly_NewContour(v)) == NULL) - return 0; - frac_circle(contour, (t->Point1.X - tx), (t->Point1.Y - ty), v, 4); - - v[0] = t->Point2.X - cx; - v[1] = t->Point2.Y - cy; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - frac_circle(contour, (t->Point2.X - tx), (t->Point2.Y - ty), v, 4); - - v[0] = c->Point2.X + tx; - v[1] = c->Point2.Y + ty; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - frac_circle(contour, (t->Point2.X + tx), (t->Point2.Y + ty), v, 4); - - v[0] = t->Point1.X + cx; - v[1] = t->Point1.Y + cy; - poly_InclVertex(contour->head.prev, poly_CreateNode(v)); - frac_circle(contour, (t->Point1.X + tx), (t->Point1.Y + ty), v, 4); - - /* now we have the line contour */ - if (!(np = ContourToPoly(contour))) - return NULL; - return np; -} - -/* clear np1 from the polygon */ -static int Subtract(POLYAREA * np1, PolygonType * p, pcb_bool fnp) -{ - POLYAREA *merged = NULL, *np = np1; - int x; - assert(np); - assert(p); - if (!p->Clipped) { - if (fnp) - poly_Free(&np); - return 1; - } - assert(poly_Valid(p->Clipped)); - assert(poly_Valid(np)); - if (fnp) - x = poly_Boolean_free(p->Clipped, np, &merged, PBO_SUB); - else { - x = poly_Boolean(p->Clipped, np, &merged, PBO_SUB); - poly_Free(&p->Clipped); - } - assert(!merged || poly_Valid(merged)); - if (x != err_ok) { - fprintf(stderr, "Error while clipping PBO_SUB: %d\n", x); - poly_Free(&merged); - p->Clipped = NULL; - if (p->NoHoles) - printf("Just leaked in Subtract\n"); - p->NoHoles = NULL; - return -1; - } - p->Clipped = biggest(merged); - assert(!p->Clipped || poly_Valid(p->Clipped)); - if (!p->Clipped) - Message(PCB_MSG_DEFAULT, "Polygon cleared out of existence near (%d, %d)\n", - (p->BoundingBox.X1 + p->BoundingBox.X2) / 2, (p->BoundingBox.Y1 + p->BoundingBox.Y2) / 2); - return 1; -} - -/* create a polygon of the pin clearance */ -POLYAREA *PinPoly(PinType * pin, Coord thick, Coord clear) -{ - int size; - - if (TEST_FLAG(PCB_FLAG_SQUARE, pin)) { - if (GET_SQUARE(pin) <= 1) { - size = (thick + 1) / 2; - return RoundRect(pin->X - size, pin->X + size, pin->Y - size, pin->Y + size, (clear + 1) / 2); - } - else { - size = (thick + clear + 1) / 2; - return OctagonPoly(pin->X, pin->Y, size + size, GET_SQUARE(pin)); - } - - } - else { - size = (thick + clear + 1) / 2; - if (TEST_FLAG(PCB_FLAG_OCTAGON, pin)) { - return OctagonPoly(pin->X, pin->Y, size + size, GET_SQUARE(pin)); - } - } - return CirclePoly(pin->X, pin->Y, size); -} - -POLYAREA *BoxPolyBloated(BoxType * box, Coord bloat) -{ - return RectPoly(box->X1 - bloat, box->X2 + bloat, box->Y1 - bloat, box->Y2 + bloat); -} - -/* return the clearance polygon for a pin */ -static POLYAREA *pin_clearance_poly(pcb_cardinal_t layernum, PCBTypePtr pcb, PinType * pin) -{ - POLYAREA *np; - if (TEST_THERM(layernum, pin)) - np = ThermPoly(pcb, pin, layernum); - else - np = PinPoly(pin, PIN_SIZE(pin), pin->Clearance); - return np; -} - -/* remove the pin clearance from the polygon */ -static int SubtractPin(DataType * d, PinType * pin, LayerType * l, PolygonType * p) -{ - POLYAREA *np; - pcb_cardinal_t i; - - if (pin->Clearance == 0) - return 0; - i = GetLayerNumber(d, l); - np = pin_clearance_poly(i, d->pcb, pin); - - if (TEST_THERM(i, pin)) { - if (!np) - return 0; - } - else { - if (!np) - return -1; - } - - return Subtract(np, p, TRUE); -} - -static int SubtractLine(LineType * line, PolygonType * p) -{ - POLYAREA *np; - - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, line)) - return 0; - if (!(np = LinePoly(line, line->Thickness + line->Clearance))) - return -1; - return Subtract(np, p, pcb_true); -} - -static int SubtractArc(ArcType * arc, PolygonType * p) -{ - POLYAREA *np; - - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, arc)) - return 0; - if (!(np = ArcPoly(arc, arc->Thickness + arc->Clearance))) - return -1; - return Subtract(np, p, pcb_true); -} - -static int SubtractText(TextType * text, PolygonType * p) -{ - POLYAREA *np; - const BoxType *b = &text->BoundingBox; - - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, text)) - return 0; - if (!(np = RoundRect(b->X1 + PCB->Bloat, b->X2 - PCB->Bloat, b->Y1 + PCB->Bloat, b->Y2 - PCB->Bloat, PCB->Bloat))) - return -1; - return Subtract(np, p, pcb_true); -} - -static int SubtractPad(PadType * pad, PolygonType * p) -{ - POLYAREA *np = NULL; - - if (pad->Clearance == 0) - return 0; - if (TEST_FLAG(PCB_FLAG_SQUARE, pad)) { - if (!(np = SquarePadPoly(pad, pad->Thickness + pad->Clearance))) - return -1; - } - else { - if (!(np = LinePoly((LineType *) pad, pad->Thickness + pad->Clearance))) - return -1; - } - return Subtract(np, p, pcb_true); -} - -struct cpInfo { - const BoxType *other; - DataType *data; - LayerType *layer; - PolygonType *polygon; - pcb_bool solder; - POLYAREA *accumulate; - int batch_size; - jmp_buf env; -}; - -static void subtract_accumulated(struct cpInfo *info, PolygonTypePtr polygon) -{ - if (info->accumulate == NULL) - return; - Subtract(info->accumulate, polygon, pcb_true); - info->accumulate = NULL; - info->batch_size = 0; -} - -static r_dir_t pin_sub_callback(const BoxType * b, void *cl) -{ - PinTypePtr pin = (PinTypePtr) b; - struct cpInfo *info = (struct cpInfo *) cl; - PolygonTypePtr polygon; - POLYAREA *np; - POLYAREA *merged; - pcb_cardinal_t i; - - /* don't subtract the object that was put back! */ - if (b == info->other) - return R_DIR_NOT_FOUND; - polygon = info->polygon; - - if (pin->Clearance == 0) - return R_DIR_NOT_FOUND; - i = GetLayerNumber(info->data, info->layer); - if (TEST_THERM(i, pin)) { - np = ThermPoly((PCBTypePtr) (info->data->pcb), pin, i); - if (!np) - return R_DIR_FOUND_CONTINUE; - } - else { - np = PinPoly(pin, PIN_SIZE(pin), pin->Clearance); - if (!np) - longjmp(info->env, 1); - } - - poly_Boolean_free(info->accumulate, np, &merged, PBO_UNITE); - info->accumulate = merged; - - info->batch_size++; - - if (info->batch_size == SUBTRACT_PIN_VIA_BATCH_SIZE) - subtract_accumulated(info, polygon); - - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t arc_sub_callback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct cpInfo *info = (struct cpInfo *) cl; - PolygonTypePtr polygon; - - /* don't subtract the object that was put back! */ - if (b == info->other) - return R_DIR_NOT_FOUND; - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, arc)) - return R_DIR_NOT_FOUND; - polygon = info->polygon; - if (SubtractArc(arc, polygon) < 0) - longjmp(info->env, 1); - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t pad_sub_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct cpInfo *info = (struct cpInfo *) cl; - PolygonTypePtr polygon; - - /* don't subtract the object that was put back! */ - if (b == info->other) - return R_DIR_NOT_FOUND; - if (pad->Clearance == 0) - return R_DIR_NOT_FOUND; - polygon = info->polygon; - if (XOR(TEST_FLAG(PCB_FLAG_ONSOLDER, pad), !info->solder)) { - if (SubtractPad(pad, polygon) < 0) - longjmp(info->env, 1); - return R_DIR_FOUND_CONTINUE; - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t line_sub_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct cpInfo *info = (struct cpInfo *) cl; - PolygonTypePtr polygon; - POLYAREA *np; - POLYAREA *merged; - - /* don't subtract the object that was put back! */ - if (b == info->other) - return R_DIR_NOT_FOUND; - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, line)) - return R_DIR_NOT_FOUND; - polygon = info->polygon; - - if (!(np = LinePoly(line, line->Thickness + line->Clearance))) - longjmp(info->env, 1); - - poly_Boolean_free(info->accumulate, np, &merged, PBO_UNITE); - info->accumulate = merged; - info->batch_size++; - - if (info->batch_size == SUBTRACT_LINE_BATCH_SIZE) - subtract_accumulated(info, polygon); - - return R_DIR_FOUND_CONTINUE; -} - -static r_dir_t text_sub_callback(const BoxType * b, void *cl) -{ - TextTypePtr text = (TextTypePtr) b; - struct cpInfo *info = (struct cpInfo *) cl; - PolygonTypePtr polygon; - - /* don't subtract the object that was put back! */ - if (b == info->other) - return R_DIR_NOT_FOUND; - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, text)) - return R_DIR_NOT_FOUND; - polygon = info->polygon; - if (SubtractText(text, polygon) < 0) - longjmp(info->env, 1); - return R_DIR_FOUND_CONTINUE; -} - -static int Group(DataTypePtr Data, pcb_cardinal_t layer) -{ - pcb_cardinal_t i, j; - for (i = 0; i < max_group; i++) - for (j = 0; j < ((PCBType *) (Data->pcb))->LayerGroups.Number[i]; j++) - if (layer == ((PCBType *) (Data->pcb))->LayerGroups.Entries[i][j]) - return i; - return i; -} - -static int clearPoly(DataTypePtr Data, LayerTypePtr Layer, PolygonType * polygon, const BoxType * here, Coord expand) -{ - int r = 0, seen; - BoxType region; - struct cpInfo info; - pcb_cardinal_t group; - - if (!TEST_FLAG(PCB_FLAG_CLEARPOLY, polygon) - || GetLayerNumber(Data, Layer) >= max_copper_layer) - return 0; - group = Group(Data, GetLayerNumber(Data, Layer)); - info.solder = (group == Group(Data, solder_silk_layer)); - info.data = Data; - info.other = here; - info.layer = Layer; - info.polygon = polygon; - if (here) - region = clip_box(here, &polygon->BoundingBox); - else - region = polygon->BoundingBox; - region = bloat_box(®ion, expand); - - if (setjmp(info.env) == 0) { - r = 0; - info.accumulate = NULL; - info.batch_size = 0; - if (info.solder || group == Group(Data, component_silk_layer)) { - r_search(Data->pad_tree, ®ion, NULL, pad_sub_callback, &info, &seen); - r += seen; - } - GROUP_LOOP(Data, group); - { - r_search(layer->line_tree, ®ion, NULL, line_sub_callback, &info, &seen); - r += seen; - subtract_accumulated(&info, polygon); - r_search(layer->arc_tree, ®ion, NULL, arc_sub_callback, &info, &seen); - r += seen; - r_search(layer->text_tree, ®ion, NULL, text_sub_callback, &info, &seen); - r += seen; - } - END_LOOP; - r_search(Data->via_tree, ®ion, NULL, pin_sub_callback, &info, &seen); - r += seen; - r_search(Data->pin_tree, ®ion, NULL, pin_sub_callback, &info, &seen); - r += seen; - subtract_accumulated(&info, polygon); - } - polygon->NoHolesValid = 0; - return r; -} - -static int Unsubtract(POLYAREA * np1, PolygonType * p) -{ - POLYAREA *merged = NULL, *np = np1; - POLYAREA *orig_poly, *clipped_np; - int x; - assert(np); - assert(p && p->Clipped); - - orig_poly = original_poly(p); - - x = poly_Boolean_free(np, orig_poly, &clipped_np, PBO_ISECT); - if (x != err_ok) { - fprintf(stderr, "Error while clipping PBO_ISECT: %d\n", x); - poly_Free(&clipped_np); - goto fail; - } - - x = poly_Boolean_free(p->Clipped, clipped_np, &merged, PBO_UNITE); - if (x != err_ok) { - fprintf(stderr, "Error while clipping PBO_UNITE: %d\n", x); - poly_Free(&merged); - goto fail; - } - p->Clipped = biggest(merged); - assert(!p->Clipped || poly_Valid(p->Clipped)); - return 1; - -fail: - p->Clipped = NULL; - if (p->NoHoles) - printf("Just leaked in Unsubtract\n"); - p->NoHoles = NULL; - return 0; -} - -static int UnsubtractPin(PinType * pin, LayerType * l, PolygonType * p) -{ - POLYAREA *np; - - /* overlap a bit to prevent gaps from rounding errors */ - np = BoxPolyBloated(&pin->BoundingBox, UNSUBTRACT_BLOAT * 400000); - - if (!np) - return 0; - if (!Unsubtract(np, p)) - return 0; - - clearPoly(PCB->Data, l, p, (const BoxType *) pin, 2 * UNSUBTRACT_BLOAT * 400000); - return 1; -} - -static int UnsubtractArc(ArcType * arc, LayerType * l, PolygonType * p) -{ - POLYAREA *np; - - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, arc)) - return 0; - - /* overlap a bit to prevent gaps from rounding errors */ - np = BoxPolyBloated(&arc->BoundingBox, UNSUBTRACT_BLOAT); - - if (!np) - return 0; - if (!Unsubtract(np, p)) - return 0; - clearPoly(PCB->Data, l, p, (const BoxType *) arc, 2 * UNSUBTRACT_BLOAT); - return 1; -} - -static int UnsubtractLine(LineType * line, LayerType * l, PolygonType * p) -{ - POLYAREA *np; - - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, line)) - return 0; - - /* overlap a bit to prevent notches from rounding errors */ - np = BoxPolyBloated(&line->BoundingBox, UNSUBTRACT_BLOAT); - - if (!np) - return 0; - if (!Unsubtract(np, p)) - return 0; - clearPoly(PCB->Data, l, p, (const BoxType *) line, 2 * UNSUBTRACT_BLOAT); - return 1; -} - -static int UnsubtractText(TextType * text, LayerType * l, PolygonType * p) -{ - POLYAREA *np; - - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, text)) - return 0; - - /* overlap a bit to prevent notches from rounding errors */ - np = BoxPolyBloated(&text->BoundingBox, UNSUBTRACT_BLOAT); - - if (!np) - return -1; - if (!Unsubtract(np, p)) - return 0; - clearPoly(PCB->Data, l, p, (const BoxType *) text, 2 * UNSUBTRACT_BLOAT); - return 1; -} - -static int UnsubtractPad(PadType * pad, LayerType * l, PolygonType * p) -{ - POLYAREA *np; - - /* overlap a bit to prevent notches from rounding errors */ - np = BoxPolyBloated(&pad->BoundingBox, UNSUBTRACT_BLOAT); - - if (!np) - return 0; - if (!Unsubtract(np, p)) - return 0; - clearPoly(PCB->Data, l, p, (const BoxType *) pad, 2 * UNSUBTRACT_BLOAT); - return 1; -} - -static pcb_bool inhibit = pcb_false; - -int InitClip(DataTypePtr Data, LayerTypePtr layer, PolygonType * p) -{ - if (inhibit) - return 0; - if (p->Clipped) - poly_Free(&p->Clipped); - p->Clipped = original_poly(p); - poly_FreeContours(&p->NoHoles); - if (!p->Clipped) - return 0; - assert(poly_Valid(p->Clipped)); - if (TEST_FLAG(PCB_FLAG_CLEARPOLY, p)) - clearPoly(Data, layer, p, NULL, 0); - else - p->NoHolesValid = 0; - return 1; -} - -/* -------------------------------------------------------------------------- - * remove redundant polygon points. Any point that lies on the straight - * line between the points on either side of it is redundant. - * returns pcb_true if any points are removed - */ -pcb_bool RemoveExcessPolygonPoints(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - PointTypePtr p; - pcb_cardinal_t n, prev, next; - LineType line; - pcb_bool changed = pcb_false; - - if (Undoing()) - return (pcb_false); - - for (n = 0; n < Polygon->PointN; n++) { - prev = prev_contour_point(Polygon, n); - next = next_contour_point(Polygon, n); - p = &Polygon->Points[n]; - - line.Point1 = Polygon->Points[prev]; - line.Point2 = Polygon->Points[next]; - line.Thickness = 0; - if (IsPointOnLine(p->X, p->Y, 0.0, &line)) { - RemoveObject(PCB_TYPE_POLYGON_POINT, Layer, Polygon, p); - changed = pcb_true; - } - } - return (changed); -} - -/* --------------------------------------------------------------------------- - * returns the index of the polygon point which is the end - * point of the segment with the lowest distance to the passed - * coordinates - */ -pcb_cardinal_t GetLowestDistancePolygonPoint(PolygonTypePtr Polygon, Coord X, Coord Y) -{ - double mindistance = (double) MAX_COORD * MAX_COORD; - PointTypePtr ptr1, ptr2; - pcb_cardinal_t n, result = 0; - - /* we calculate the distance to each segment and choose the - * shortest distance. If the closest approach between the - * given point and the projected line (i.e. the segment extended) - * is not on the segment, then the distance is the distance - * to the segment end point. - */ - - for (n = 0; n < Polygon->PointN; n++) { - double u, dx, dy; - ptr1 = &Polygon->Points[prev_contour_point(Polygon, n)]; - ptr2 = &Polygon->Points[n]; - - dx = ptr2->X - ptr1->X; - dy = ptr2->Y - ptr1->Y; - if (dx != 0.0 || dy != 0.0) { - /* projected intersection is at P1 + u(P2 - P1) */ - u = ((X - ptr1->X) * dx + (Y - ptr1->Y) * dy) / (dx * dx + dy * dy); - - if (u < 0.0) { /* ptr1 is closest point */ - u = SQUARE(X - ptr1->X) + SQUARE(Y - ptr1->Y); - } - else if (u > 1.0) { /* ptr2 is closest point */ - u = SQUARE(X - ptr2->X) + SQUARE(Y - ptr2->Y); - } - else { /* projected intersection is closest point */ - u = SQUARE(X - ptr1->X * (1.0 - u) - u * ptr2->X) + SQUARE(Y - ptr1->Y * (1.0 - u) - u * ptr2->Y); - } - if (u < mindistance) { - mindistance = u; - result = n; - } - } - } - return (result); -} - -/* --------------------------------------------------------------------------- - * go back to the previous point of the polygon - */ -void GoToPreviousPoint(void) -{ - switch (Crosshair.AttachedPolygon.PointN) { - /* do nothing if mode has just been entered */ - case 0: - break; - - /* reset number of points and 'PCB_MODE_LINE' state */ - case 1: - Crosshair.AttachedPolygon.PointN = 0; - Crosshair.AttachedLine.State = STATE_FIRST; - addedLines = 0; - break; - - /* back-up one point */ - default: - { - PointTypePtr points = Crosshair.AttachedPolygon.Points; - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN - 2; - - Crosshair.AttachedPolygon.PointN--; - Crosshair.AttachedLine.Point1.X = points[n].X; - Crosshair.AttachedLine.Point1.Y = points[n].Y; - break; - } - } -} - -/* --------------------------------------------------------------------------- - * close polygon if possible - */ -void ClosePolygon(void) -{ - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN; - - /* check number of points */ - if (n >= 3) { - /* if 45 degree lines are what we want do a quick check - * if closing the polygon makes sense - */ - if (!conf_core.editor.all_direction_lines) { - Coord dx, dy; - - dx = coord_abs(Crosshair.AttachedPolygon.Points[n - 1].X - Crosshair.AttachedPolygon.Points[0].X); - dy = coord_abs(Crosshair.AttachedPolygon.Points[n - 1].Y - Crosshair.AttachedPolygon.Points[0].Y); - if (!(dx == 0 || dy == 0 || dx == dy)) { - Message(PCB_MSG_ERROR, _("Cannot close polygon because 45 degree lines are requested.\n")); - return; - } - } - CopyAttachedPolygonToLayer(); - Draw(); - } - else - Message(PCB_MSG_DEFAULT, _("A polygon has to have at least 3 points\n")); -} - -/* --------------------------------------------------------------------------- - * moves the data of the attached (new) polygon to the current layer - */ -void CopyAttachedPolygonToLayer(void) -{ - PolygonTypePtr polygon; - int saveID; - - /* move data to layer and clear attached struct */ - polygon = CreateNewPolygon(CURRENT, NoFlags()); - saveID = polygon->ID; - *polygon = Crosshair.AttachedPolygon; - polygon->ID = saveID; - SET_FLAG(PCB_FLAG_CLEARPOLY, polygon); - if (conf_core.editor.full_poly) - SET_FLAG(PCB_FLAG_FULLPOLY, polygon); - memset(&Crosshair.AttachedPolygon, 0, sizeof(PolygonType)); - SetPolygonBoundingBox(polygon); - if (!CURRENT->polygon_tree) - CURRENT->polygon_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(CURRENT->polygon_tree, (BoxType *) polygon, 0); - InitClip(PCB->Data, CURRENT, polygon); - DrawPolygon(CURRENT, polygon); - SetChangedFlag(pcb_true); - - /* reset state of attached line */ - Crosshair.AttachedLine.State = STATE_FIRST; - addedLines = 0; - - /* add to undo list */ - AddObjectToCreateUndoList(PCB_TYPE_POLYGON, CURRENT, polygon, polygon); - IncrementUndoSerialNumber(); -} - -/* find polygon holes in range, then call the callback function for - * each hole. If the callback returns non-zero, stop - * the search. - */ -int -PolygonHoles(PolygonType * polygon, const BoxType * range, int (*callback) (PLINE * contour, void *user_data), void *user_data) -{ - POLYAREA *pa = polygon->Clipped; - PLINE *pl; - /* If this hole is so big the polygon doesn't exist, then it's not - * really a hole. - */ - if (!pa) - return 0; - for (pl = pa->contours->next; pl; pl = pl->next) { - if (range != NULL && (pl->xmin > range->X2 || pl->xmax < range->X1 || pl->ymin > range->Y2 || pl->ymax < range->Y1)) - continue; - if (callback(pl, user_data)) { - return 1; - } - } - return 0; -} - -struct plow_info { - int type; - void *ptr1, *ptr2; - LayerTypePtr layer; - DataTypePtr data; - r_dir_t (*callback) (DataTypePtr, LayerTypePtr, PolygonTypePtr, int, void *, void *); -}; - -static r_dir_t subtract_plow(DataTypePtr Data, LayerTypePtr Layer, PolygonTypePtr Polygon, int type, void *ptr1, void *ptr2) -{ - if (!Polygon->Clipped) - return 0; - switch (type) { - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - SubtractPin(Data, (PinTypePtr) ptr2, Layer, Polygon); - Polygon->NoHolesValid = 0; - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_LINE: - SubtractLine((LineTypePtr) ptr2, Polygon); - Polygon->NoHolesValid = 0; - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_ARC: - SubtractArc((ArcTypePtr) ptr2, Polygon); - Polygon->NoHolesValid = 0; - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_PAD: - SubtractPad((PadTypePtr) ptr2, Polygon); - Polygon->NoHolesValid = 0; - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_TEXT: - SubtractText((TextTypePtr) ptr2, Polygon); - Polygon->NoHolesValid = 0; - return R_DIR_FOUND_CONTINUE; - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t add_plow(DataTypePtr Data, LayerTypePtr Layer, PolygonTypePtr Polygon, int type, void *ptr1, void *ptr2) -{ - switch (type) { - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - UnsubtractPin((PinTypePtr) ptr2, Layer, Polygon); - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_LINE: - UnsubtractLine((LineTypePtr) ptr2, Layer, Polygon); - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_ARC: - UnsubtractArc((ArcTypePtr) ptr2, Layer, Polygon); - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_PAD: - UnsubtractPad((PadTypePtr) ptr2, Layer, Polygon); - return R_DIR_FOUND_CONTINUE; - case PCB_TYPE_TEXT: - UnsubtractText((TextTypePtr) ptr2, Layer, Polygon); - return R_DIR_FOUND_CONTINUE; - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t plow_callback(const BoxType * b, void *cl) -{ - struct plow_info *plow = (struct plow_info *) cl; - PolygonTypePtr polygon = (PolygonTypePtr) b; - - if (TEST_FLAG(PCB_FLAG_CLEARPOLY, polygon)) - return plow->callback(plow->data, plow->layer, polygon, plow->type, plow->ptr1, plow->ptr2); - return R_DIR_NOT_FOUND; -} - -int -PlowsPolygon(DataType * Data, int type, void *ptr1, void *ptr2, - r_dir_t (*call_back) (DataTypePtr data, LayerTypePtr lay, PolygonTypePtr poly, int type, void *ptr1, void *ptr2)) -{ - BoxType sb = ((PinTypePtr) ptr2)->BoundingBox; - int r = 0, seen; - struct plow_info info; - - info.type = type; - info.ptr1 = ptr1; - info.ptr2 = ptr2; - info.data = Data; - info.callback = call_back; - switch (type) { - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - if (type == PCB_TYPE_PIN || ptr1 == ptr2 || ptr1 == NULL) { - LAYER_LOOP(Data, max_copper_layer); - { - info.layer = layer; - r_search(layer->polygon_tree, &sb, NULL, plow_callback, &info, &seen); - r += seen; - } - END_LOOP; - } - else { - GROUP_LOOP(Data, GetLayerGroupNumberByNumber(GetLayerNumber(Data, ((LayerTypePtr) ptr1)))); - { - info.layer = layer; - r_search(layer->polygon_tree, &sb, NULL, plow_callback, &info, &seen); - r += seen; - } - END_LOOP; - } - break; - case PCB_TYPE_LINE: - case PCB_TYPE_ARC: - case PCB_TYPE_TEXT: - /* the cast works equally well for lines and arcs */ - if (!TEST_FLAG(PCB_FLAG_CLEARLINE, (LineTypePtr) ptr2)) - return 0; - /* silk doesn't plow */ - if (GetLayerNumber(Data, (LayerTypePtr) ptr1) >= max_copper_layer) - return 0; - GROUP_LOOP(Data, GetLayerGroupNumberByNumber(GetLayerNumber(Data, ((LayerTypePtr) ptr1)))); - { - info.layer = layer; - r_search(layer->polygon_tree, &sb, NULL, plow_callback, &info, &seen); - r += seen; - } - END_LOOP; - break; - case PCB_TYPE_PAD: - { - pcb_cardinal_t group = GetLayerGroupNumberByNumber(TEST_FLAG(PCB_FLAG_ONSOLDER, (PadType *) ptr2) ? - solder_silk_layer : component_silk_layer); - GROUP_LOOP(Data, group); - { - info.layer = layer; - r_search(layer->polygon_tree, &sb, NULL, plow_callback, &info, &seen); - r += seen; - } - END_LOOP; - } - break; - - case PCB_TYPE_ELEMENT: - { - PIN_LOOP((ElementType *) ptr1); - { - PlowsPolygon(Data, PCB_TYPE_PIN, ptr1, pin, call_back); - } - END_LOOP; - PAD_LOOP((ElementType *) ptr1); - { - PlowsPolygon(Data, PCB_TYPE_PAD, ptr1, pad, call_back); - } - END_LOOP; - } - break; - } - return r; -} - -void RestoreToPolygon(DataType * Data, int type, void *ptr1, void *ptr2) -{ - if (type == PCB_TYPE_POLYGON) - InitClip(PCB->Data, (LayerTypePtr) ptr1, (PolygonTypePtr) ptr2); - else - PlowsPolygon(Data, type, ptr1, ptr2, add_plow); -} - -void ClearFromPolygon(DataType * Data, int type, void *ptr1, void *ptr2) -{ - if (type == PCB_TYPE_POLYGON) - InitClip(PCB->Data, (LayerTypePtr) ptr1, (PolygonTypePtr) ptr2); - else - PlowsPolygon(Data, type, ptr1, ptr2, subtract_plow); -} - -pcb_bool isects(POLYAREA * a, PolygonTypePtr p, pcb_bool fr) -{ - POLYAREA *x; - pcb_bool ans; - ans = Touching(a, p->Clipped); - /* argument may be register, so we must copy it */ - x = a; - if (fr) - poly_Free(&x); - return ans; -} - - -pcb_bool IsPointInPolygon(Coord X, Coord Y, Coord r, PolygonTypePtr p) -{ - POLYAREA *c; - Vector v; - v[0] = X; - v[1] = Y; - if (poly_CheckInside(p->Clipped, v)) - return pcb_true; - - if (TEST_FLAG(PCB_FLAG_FULLPOLY, p)) { - PolygonType tmp = *p; - - /* Check all clipped-away regions that are now drawn because of full-poly */ - for (tmp.Clipped = p->Clipped->f; tmp.Clipped != p->Clipped; tmp.Clipped = tmp.Clipped->f) - if (poly_CheckInside(tmp.Clipped, v)) - return pcb_true; - } - - if (r < 1) - return pcb_false; - if (!(c = CirclePoly(X, Y, r))) - return pcb_false; - return isects(c, p, pcb_true); -} - - -pcb_bool IsPointInPolygonIgnoreHoles(Coord X, Coord Y, PolygonTypePtr p) -{ - Vector v; - v[0] = X; - v[1] = Y; - return poly_InsideContour(p->Clipped->contours, v); -} - -pcb_bool IsRectangleInPolygon(Coord X1, Coord Y1, Coord X2, Coord Y2, PolygonTypePtr p) -{ - POLYAREA *s; - if (!(s = RectPoly(min(X1, X2), max(X1, X2), min(Y1, Y2), max(Y1, Y2)))) - return pcb_false; - return isects(s, p, pcb_true); -} - -/* NB: This function will free the passed POLYAREA. - * It must only be passed a single POLYAREA (pa->f == pa->b == pa) - */ -static void r_NoHolesPolygonDicer(POLYAREA * pa, void (*emit) (PLINE *, void *), void *user_data) -{ - PLINE *p = pa->contours; - - if (!pa->contours->next) { /* no holes */ - pa->contours = NULL; /* The callback now owns the contour */ - /* Don't bother removing it from the POLYAREA's rtree - since we're going to free the POLYAREA below anyway */ - emit(p, user_data); - poly_Free(&pa); - return; - } - else { - POLYAREA *poly2, *left, *right; - - /* make a rectangle of the left region slicing through the middle of the first hole */ - poly2 = RectPoly(p->xmin, (p->next->xmin + p->next->xmax) / 2, p->ymin, p->ymax); - poly_AndSubtract_free(pa, poly2, &left, &right); - if (left) { - POLYAREA *cur, *next; - cur = left; - do { - next = cur->f; - cur->f = cur->b = cur; /* Detach this polygon piece */ - r_NoHolesPolygonDicer(cur, emit, user_data); - /* NB: The POLYAREA was freed by its use in the recursive dicer */ - } - while ((cur = next) != left); - } - if (right) { - POLYAREA *cur, *next; - cur = right; - do { - next = cur->f; - cur->f = cur->b = cur; /* Detach this polygon piece */ - r_NoHolesPolygonDicer(cur, emit, user_data); - /* NB: The POLYAREA was freed by its use in the recursive dicer */ - } - while ((cur = next) != right); - } - } -} - -void NoHolesPolygonDicer(PolygonTypePtr p, const BoxType * clip, void (*emit) (PLINE *, void *), void *user_data) -{ - POLYAREA *main_contour, *cur, *next; - - main_contour = poly_Create(); - /* copy the main poly only */ - poly_Copy1(main_contour, p->Clipped); - /* clip to the bounding box */ - if (clip) { - POLYAREA *cbox = RectPoly(clip->X1, clip->X2, clip->Y1, clip->Y2); - poly_Boolean_free(main_contour, cbox, &main_contour, PBO_ISECT); - } - if (main_contour == NULL) - return; - /* Now dice it up. - * NB: Could be more than one piece (because of the clip above) - */ - cur = main_contour; - do { - next = cur->f; - cur->f = cur->b = cur; /* Detach this polygon piece */ - r_NoHolesPolygonDicer(cur, emit, user_data); - /* NB: The POLYAREA was freed by its use in the recursive dicer */ - } - while ((cur = next) != main_contour); -} - -/* make a polygon split into multiple parts into multiple polygons */ -pcb_bool MorphPolygon(LayerTypePtr layer, PolygonTypePtr poly) -{ - POLYAREA *p, *start; - pcb_bool many = pcb_false; - FlagType flags; - - if (!poly->Clipped || TEST_FLAG(PCB_FLAG_LOCK, poly)) - return pcb_false; - if (poly->Clipped->f == poly->Clipped) - return pcb_false; - ErasePolygon(poly); - start = p = poly->Clipped; - /* This is ugly. The creation of the new polygons can cause - * all of the polygon pointers (including the one we're called - * with to change if there is a realloc in GetPolygonMemory(). - * That will invalidate our original "poly" argument, potentially - * inside the loop. We need to steal the Clipped pointer and - * hide it from the Remove call so that it still exists while - * we do this dirty work. - */ - poly->Clipped = NULL; - if (poly->NoHoles) - printf("Just leaked in MorpyPolygon\n"); - poly->NoHoles = NULL; - flags = poly->Flags; - RemovePolygon(layer, poly); - inhibit = pcb_true; - do { - VNODE *v; - PolygonTypePtr newone; - - if (p->contours->area > PCB->IsleArea) { - newone = CreateNewPolygon(layer, flags); - if (!newone) - return pcb_false; - many = pcb_true; - v = &p->contours->head; - CreateNewPointInPolygon(newone, v->point[0], v->point[1]); - for (v = v->next; v != &p->contours->head; v = v->next) - CreateNewPointInPolygon(newone, v->point[0], v->point[1]); - newone->BoundingBox.X1 = p->contours->xmin; - newone->BoundingBox.X2 = p->contours->xmax + 1; - newone->BoundingBox.Y1 = p->contours->ymin; - newone->BoundingBox.Y2 = p->contours->ymax + 1; - AddObjectToCreateUndoList(PCB_TYPE_POLYGON, layer, newone, newone); - newone->Clipped = p; - p = p->f; /* go to next pline */ - newone->Clipped->b = newone->Clipped->f = newone->Clipped; /* unlink from others */ - r_insert_entry(layer->polygon_tree, (BoxType *) newone, 0); - DrawPolygon(layer, newone); - } - else { - POLYAREA *t = p; - - p = p->f; - poly_DelContour(&t->contours); - free(t); - } - } - while (p != start); - inhibit = pcb_false; - IncrementUndoSerialNumber(); - return many; -} - -void debug_pline(PLINE * pl) -{ - VNODE *v; - pcb_fprintf(stderr, "\txmin %#mS xmax %#mS ymin %#mS ymax %#mS\n", pl->xmin, pl->xmax, pl->ymin, pl->ymax); - v = &pl->head; - while (v) { - pcb_fprintf(stderr, "\t\tvnode: %#mD\n", v->point[0], v->point[1]); - v = v->next; - if (v == &pl->head) - break; - } -} - -void debug_polyarea(POLYAREA * p) -{ - PLINE *pl; - - fprintf(stderr, "POLYAREA %p\n", (void *)p); - for (pl = p->contours; pl; pl = pl->next) - debug_pline(pl); -} - -void debug_polygon(PolygonType * p) -{ - pcb_cardinal_t i; - POLYAREA *pa; - fprintf(stderr, "POLYGON %p %d pts\n", (void *)p, p->PointN); - for (i = 0; i < p->PointN; i++) - pcb_fprintf(stderr, "\t%d: %#mD\n", i, p->Points[i].X, p->Points[i].Y); - if (p->HoleIndexN) { - fprintf(stderr, "%d holes, starting at indices\n", p->HoleIndexN); - for (i = 0; i < p->HoleIndexN; i++) - fprintf(stderr, "\t%d: %d\n", i, p->HoleIndex[i]); - } - else - fprintf(stderr, "it has no holes\n"); - pa = p->Clipped; - while (pa) { - debug_polyarea(pa); - pa = pa->f; - if (pa == p->Clipped) - break; - } -} - -/* Convert a POLYAREA (and all linked POLYAREA) to - * raw PCB polygons on the given layer. - */ -void PolyToPolygonsOnLayer(DataType * Destination, LayerType * Layer, POLYAREA * Input, FlagType Flags) -{ - PolygonType *Polygon; - POLYAREA *pa; - PLINE *pline; - VNODE *node; - pcb_bool outer; - - if (Input == NULL) - return; - - pa = Input; - do { - Polygon = CreateNewPolygon(Layer, Flags); - - pline = pa->contours; - outer = pcb_true; - - do { - if (!outer) - CreateNewHoleInPolygon(Polygon); - outer = pcb_false; - - node = &pline->head; - do { - CreateNewPointInPolygon(Polygon, node->point[0], node->point[1]); - } - while ((node = node->next) != &pline->head); - - } - while ((pline = pline->next) != NULL); - - InitClip(Destination, Layer, Polygon); - SetPolygonBoundingBox(Polygon); - if (!Layer->polygon_tree) - Layer->polygon_tree = r_create_tree(NULL, 0, 0); - r_insert_entry(Layer->polygon_tree, (BoxType *) Polygon, 0); - - DrawPolygon(Layer, Polygon); - /* add to undo list */ - AddObjectToCreateUndoList(PCB_TYPE_POLYGON, Layer, Polygon, Polygon); - } - while ((pa = pa->f) != Input); - - SetChangedFlag(pcb_true); -} Index: 1.1.4/src/strflags.h =================================================================== --- 1.1.4/src/strflags.h (revision 10776) +++ 1.1.4/src/strflags.h (nonexistent) @@ -1,77 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2005 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * DJ Delorie, 334 North Road, Deerfield NH 03037-1110, USA - * dj@delorie.com - * - */ - -#ifndef PCB_STRFLAGS_H -#define PCB_STRFLAGS_H - -/* for flagtype */ -#include "global_objs.h" - -typedef struct { - - /* This is the bit that we're setting. */ - int mask; - - /* The name used in the output file. */ - const char *name; - int nlen; - - /* If set, this entry won't be output unless the object type is one - of these. */ - int object_types; - -} FlagBitsType; - -/* All flags natively known by the core */ -extern FlagBitsType pcb_object_flagbits[]; -extern const int pcb_object_flagbits_len; - -/* The purpose of this interface is to make the file format able to - handle more than 32 flags, and to hide the internal details of - flags from the file format. */ - -/* When passed a string, parse it and return an appropriate set of - flags. Errors cause error() to be called with a suitable message; - if error is NULL, errors are ignored. */ -FlagType string_to_flags(const char *flagstring, int (*error) (const char *msg)); - -/* Given a set of flags for a given object type, return a string which - can be output to a file. The returned pointer must not be - freed. */ -char *flags_to_string(FlagType flags, int object_type); - -/* Same as above, but for pcb flags. */ -FlagType string_to_pcbflags(const char *flagstring, int (*error) (const char *msg)); -char *pcbflags_to_string(FlagType flags); - -void uninit_strflags_buf(void); -void uninit_strflags_layerlist(void); - -/* io_pcb() needs this for historic reasons */ -FlagType common_string_to_flags(const char *flagstring, int (*error) (const char *msg), FlagBitsType * flagbits, int n_flagbits); -char *common_flags_to_string(FlagType flags, int object_type, FlagBitsType * flagbits, int n_flagbits); - -#endif Index: 1.1.4/src/buildin.h =================================================================== --- 1.1.4/src/buildin.h (revision 10776) +++ 1.1.4/src/buildin.h (nonexistent) @@ -1,2 +0,0 @@ -/* Run the init code of all buildins. */ -void buildin_init(void); Index: 1.1.4/src/stub_mincut.c =================================================================== --- 1.1.4/src/stub_mincut.c (revision 10776) +++ 1.1.4/src/stub_mincut.c (nonexistent) @@ -1,43 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "config.h" -#include "global.h" -#include "stub_mincut.h" - -static void stub_rat_proc_shorts_dummy(void) -{ -} - -static void stub_rat_found_short_dummy(PinType * pin, PadType * pad, const char *with_net) -{ - /* original behavior: just warn at random pins/pads */ - if (pin != NULL) - SET_FLAG(PCB_FLAG_WARN, pin); - if (pad != NULL) - SET_FLAG(PCB_FLAG_WARN, pad); - - stub_rat_proc_shorts_dummy(); -} - -void (*stub_rat_found_short)(PinType * pin, PadType * pad, const char *with_net) = stub_rat_found_short_dummy; -void (*stub_rat_proc_shorts)(void) = stub_rat_proc_shorts_dummy; Index: 1.1.4/src/polygon.h =================================================================== --- 1.1.4/src/polygon.h (revision 10776) +++ 1.1.4/src/polygon.h (nonexistent) @@ -1,90 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for polygon editing routines */ - -#ifndef PCB_POLYGON_H -#define PCB_POLYGON_H - -#include "global.h" -#include "rtree.h" - -/* Implementation constants */ - -#define POLY_CIRC_SEGS 40 -#define POLY_CIRC_SEGS_F ((float)POLY_CIRC_SEGS) - -/* adjustment to make the segments outline the circle rather than connect - * points on the circle: 1 - cos (\alpha / 2) < (\alpha / 2) ^ 2 / 2 - */ -#define POLY_CIRC_RADIUS_ADJ (1.0 + M_PI / POLY_CIRC_SEGS_F * \ - M_PI / POLY_CIRC_SEGS_F / 2.0) - -/* polygon diverges from modelled arc no more than MAX_ARC_DEVIATION * thick */ -#define POLY_ARC_MAX_DEVIATION 0.02 - -/* Prototypes */ - -void polygon_init(void); -pcb_cardinal_t polygon_point_idx(PolygonTypePtr polygon, PointTypePtr point); -pcb_cardinal_t polygon_point_contour(PolygonTypePtr polygon, pcb_cardinal_t point); -pcb_cardinal_t prev_contour_point(PolygonTypePtr polygon, pcb_cardinal_t point); -pcb_cardinal_t next_contour_point(PolygonTypePtr polygon, pcb_cardinal_t point); -pcb_cardinal_t GetLowestDistancePolygonPoint(PolygonTypePtr, Coord, Coord); -pcb_bool RemoveExcessPolygonPoints(LayerTypePtr, PolygonTypePtr); -void GoToPreviousPoint(void); -void ClosePolygon(void); -void CopyAttachedPolygonToLayer(void); -int PolygonHoles(PolygonType * ptr, const BoxType * range, int (*callback) (PLINE *, void *user_data), void *user_data); -int PlowsPolygon(DataType *, int, void *, void *, - r_dir_t (*callback) (DataTypePtr, LayerTypePtr, PolygonTypePtr, int, void *, void *)); -void ComputeNoHoles(PolygonType * poly); -POLYAREA *ContourToPoly(PLINE *); -POLYAREA *PolygonToPoly(PolygonType *); -POLYAREA *RectPoly(Coord x1, Coord x2, Coord y1, Coord y2); -POLYAREA *CirclePoly(Coord x, Coord y, Coord radius); -POLYAREA *OctagonPoly(Coord x, Coord y, Coord radius, int style); -POLYAREA *LinePoly(LineType * l, Coord thick); -POLYAREA *ArcPoly(ArcType * l, Coord thick); -POLYAREA *PinPoly(PinType * l, Coord thick, Coord clear); -POLYAREA *BoxPolyBloated(BoxType * box, Coord radius); -void frac_circle(PLINE *, Coord, Coord, Vector, int); -int InitClip(DataType * d, LayerType * l, PolygonType * p); -void RestoreToPolygon(DataType *, int, void *, void *); -void ClearFromPolygon(DataType *, int, void *, void *); - -pcb_bool IsPointInPolygon(Coord, Coord, Coord, PolygonTypePtr); -pcb_bool IsPointInPolygonIgnoreHoles(Coord, Coord, PolygonTypePtr); -pcb_bool IsRectangleInPolygon(Coord, Coord, Coord, Coord, PolygonTypePtr); -pcb_bool isects(POLYAREA *, PolygonTypePtr, pcb_bool); -pcb_bool MorphPolygon(LayerTypePtr, PolygonTypePtr); -void NoHolesPolygonDicer(PolygonType * p, const BoxType * clip, void (*emit) (PLINE *, void *), void *user_data); -void PolyToPolygonsOnLayer(DataType *, LayerType *, POLYAREA *, FlagType); - -void square_pin_factors(int style, double *xm, double *ym); - - -#endif Index: 1.1.4/src/pcb-menu-gtk.lht =================================================================== --- 1.1.4/src/pcb-menu-gtk.lht (revision 10776) +++ 1.1.4/src/pcb-menu-gtk.lht (nonexistent) @@ -1,607 +0,0 @@ -ha:{ - li:mouse { - li:left { - li:press = { Mode(Notify) } - li:press-shift = { Mode(Notify) } - li:press-ctrl = { Mode(Save); Mode(None); Mode(Restore); Mode(Notify) } - li:press-shift-ctrl = { Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore) } - li:release = { Mode(Release) } - li:release-shift = { Mode(Release) } - li:release-ctrl = { Mode(Release) } - li:release-shift-ctrl = { Mode(Release) } - } - li:right { - li:press = { Pan(1) } - li:release = { Pan(0) } - li:press-shift = { Popup(popup1) } - li:press-ctrl = { Display(CycleCrosshair) } - } - li:middle { - li:press = { Mode(Stroke) } - li:release = { Mode(Release) } - li:press-ctrl = { Mode(Save); Mode(Copy); Mode(Notify) } - li:release-ctrl = { Mode(Notify); Mode(Restore); } - li:press-shift-ctrl = { conf(toggle, editor/rubber_band_mode, design); Mode(Save); Mode(Move); Mode(Notify) } - li:release-shift-ctrl = { Mode(Notify); Mode(Restore); conf(toggle, editor/rubber_band_mode, design) } - } - li:scroll-up { - li:press = { Zoom(0.8) } - li:press-shift = { Scroll(up) } - li:press-ctrl = { Scroll(left) } - } - li:scroll-down { - li:press = { Zoom(1.25) } - li:press-shift = { Scroll(down) } - li:press-ctrl = { Scroll(right) } - } -# If you want zoom to center, do this instead. - #ha:scroll-up = { li:{} = {Zoom(0.8); Center()} } - #ha:scroll-down = { li:{} = {Zoom(1.25); Center()} } - } - - li:main_menu { - ### File Menu - ha:File { - m=F - li:submenu { - ha:Save Layout = { m=S; a={Ctrls}; action=Save(Layout); tip=Saves current layout } - ha:Save Layout As... = { m=A; a={Shift Ctrls}; action=Save(LayoutAs); tip=Saves current layout into a new file } - - - ha:Revert = { action=Load(Revert,none); tip=Revert to the layout stored on disk } - - - ha:Import Schematics = { action=Import() } - ha:Load layout = { action=Load(Layout); tip=Load a layout from a file } - ha:Load element data to paste-buffer = { li:action={PasteBuffer(Clear); Load(ElementTobuffer)} } - ha:Load layout data to paste-buffer = { li:action={PasteBuffer(Clear); Load(LayoutTobuffer)} } - ha:Load netlist file = { action=Load(Netlist) } - ha:Load vendor resource file = { action=LoadVendorFrom() } - - - ha:Save connection data of { - li:submenu { - ha:a single element = { li:action={ GetXY(Click to set the element mark <>); Save(ElementConnections)}} - ha:all elements = { action=Save(AllConnections) } - ha:unused pins = { action=Save(AllUnusedPins) } - ha:netlist patch for back annotation = {a=Alt Ctrlb; action=SavePatch() } - } - } - - - ha:Print layout... = { action=Print()} - ha:Export layout... = { action=Export()} - ha:Maintenance { - li:submenu { - ha:Calibrate Printer... = { action=PrintCalibrate() } - ha:Re-scan the footprint library = { action=fp_rehash() } - } - } - - - ha:Start New Layout = { a=Ctrln; action=New() } - - - ha:Preferences... = { action=DoWindows(Preferences)} - - - ha:Quit Program = { a=Ctrlq; action=Quit() } - } - } - - ha:Edit { - m=E - li:submenu { - ha:Undo last operation = { a=u; action=Undo() } - ha:Redo last undone operation = { a=Shiftr; action=Redo() } - ha:Clear undo-buffer = { a=Shift Ctrlu; action=Undo(ClearList) } - - - ha:Cut selection to buffer = { a=Ctrlx; li:action={ GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer) } } - ha:Copy selection to buffer = { a=Ctrlc; li:action={ GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Unselect(All); Mode(PasteBuffer) } } - ha:Paste buffer to layout = { a=Ctrlv; action=Mode(PasteBuffer) } - - - ha:Unselect all = { a=Shift Alta; action=Unselect(All) } - ha:Select all visible = { a=Alta; action=Select(All) } - - - ha:Edit name of { - li:submenu { - ha:text on layout = { a=n; action=ChangeName(Object) } - ha:pin on layout = { a=Shift Ctrln; action=ChangeName(Object, Number) } - ha:layout = { action=ChangeName(Layout) } - ha:active layer = { action=ChangeName(Layer) } - } - } - ha:Edit attributes of { - li:submenu { - ha:Layout = { action=Attributes(Layout) } - ha:CurrentLayer = { action=Attributes(Layer) } - ha:Element = { action=Attributes(Element) } - } - } - ha:Change flags { - li:submenu { - ha:Nonetlist = { a=Altn; action=ChangeNonetlist(Element) } - } - } - ha:Route Styles { - li:submenu { - @routestyles - - - ha:Edit... = { action=AdjustStyle(0) } - } - } - } - } # Edit - - ha:View { - m=V - li:submenu { - ha:Enable visible grid = { checked=editor/draw_grid; action=conf(toggle, editor/draw_grid, design) } - ha:Enable local grid = { checked=plugins/hid_gtk/local_grid/enable; action=conf(toggle, plugins/hid_gtk/local_grid/enable, design) } - ha:Grid units { - li:submenu { - ha:mil = { checked=ChkGridUnits(mil); action=SetUnits(mil); update_on={editor/grid_unit} } - ha:mm = { checked=ChkGridUnits(mm); action=SetUnits(mm); update_on={editor/grid_unit} } - } - } - ha:Grid size = { - li:submenu { - ha:No Grid = { checked=ChkGridSize(none); action=SetValue(Grid,1); update_on={editor/grid} } - - - ha:0.1 mil = { checked=ChkGridSize(0.1mil); li:action={SetUnits(mil); SetValue(Grid,0.1mil)}; update_on={editor/grid}} - ha:1 mil = { checked=ChkGridSize(1mil); li:action={SetUnits(mil); SetValue(Grid,1mil)}; update_on={editor/grid} } - ha:5 mil = { checked=ChkGridSize(5mil); li:action={SetUnits(mil); SetValue(Grid,5mil)}; update_on={editor/grid} } - ha:10 mil = { checked=ChkGridSize(10mil); li:action={SetUnits(mil); SetValue(Grid,10mil)}; update_on={editor/grid} } - ha:25 mil = { checked=ChkGridSize(25mil); li:action={SetUnits(mil); SetValue(Grid,25mil)}; update_on={editor/grid} } - ha:50 mil = { checked=ChkGridSize(50mil); li:action={SetUnits(mil); SetValue(Grid,50mil)}; update_on={editor/grid} } - ha:100 mil = { checked=ChkGridSize(100mil); li:action={SetUnits(mil); SetValue(Grid,100mil)}; update_on={editor/grid} } - - - ha:0.01 mm = { checked=ChkGridSize(0.01mm); li:action={SetUnits(mm); SetValue(Grid,0.01mm)}; update_on={editor/grid} } - ha:0.05 mm = { checked=ChkGridSize(0.05mm); li:action={SetUnits(mm); SetValue(Grid,0.05mm)}; update_on={editor/grid} } - ha:0.1 mm = { checked=ChkGridSize(0.10mm); li:action={SetUnits(mm); SetValue(Grid,0.1mm)}; update_on={editor/grid} } - ha:0.25 mm = { checked=ChkGridSize(0.25mm); li:action={SetUnits(mm); SetValue(Grid,0.25mm)}; update_on={editor/grid} } - ha:0.5 mm = { checked=ChkGridSize(0.50mm); li:action={SetUnits(mm); SetValue(Grid,0.5mm)}; update_on={editor/grid} } - ha:1 mm = { checked=ChkGridSize(1mm); li:action={SetUnits(mm); SetValue(Grid,1mm)}; update_on={editor/grid} } - - - ha:Grid -5mil = { a=Shiftg; action=SetValue(Grid,-5,mil) } - ha:Grid +5mil = { a=g; action=SetValue(Grid,+5,mil) } - ha:Grid -0.05mm = { a=Shift Ctrlg; action=SetValue(Grid,-0.05,mm) } - ha:Grid +0.05mm = { a=Ctrlg; action=SetValue(Grid,+0.05,mm) } - } - } - ha:Grid properties = { - li:submenu { - ha:Enable local grid = { checked=plugins/hid_gtk/local_grid/enable; action=conf(toggle, plugins/hid_gtk/local_grid/enable, design) } - - - ha:local grid radius 4 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 4)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 4, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) }; update_on={} } - ha:local grid radius 8 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 8)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 8, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) }; update_on={} } - ha:local grid radius 16 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 16)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 16, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) }; update_on={} } - ha:local grid radius 32 = { checked={conf(iseq, plugins/hid_gtk/local_grid/radius, 32)}; li:action={conf(set, plugins/hid_gtk/local_grid/radius, 32, design); conf(set, plugins/hid_gtk/local_grid/enable, 1, design) }; update_on={} } - - - ha:sparse global grid = { checked=plugins/hid_gtk/global_grid/sparse; action=conf(toggle, plugins/hid_gtk/global_grid/sparse, design); update_on={} } - ha:global grid density 4 = { checked={conf(iseq, plugins/hid_gtk/global_grid/min_dist_px, 4)}; li:action={conf(set, plugins/hid_gtk/global_grid/min_dist_px, 4, design); conf(set, plugins/hid_gtk/local_grid/enable, 0, design) }; update_on={} } - ha:global grid density 8 = { checked={conf(iseq, plugins/hid_gtk/global_grid/min_dist_px, 8)}; li:action={conf(set, plugins/hid_gtk/global_grid/min_dist_px, 8, design); conf(set, plugins/hid_gtk/local_grid/enable, 0, design) }; update_on={} } - ha:global grid density 16 = { checked={conf(iseq, plugins/hid_gtk/global_grid/min_dist_px, 16)}; li:action={conf(set, plugins/hid_gtk/global_grid/min_dist_px, 16, design); conf(set, plugins/hid_gtk/local_grid/enable, 0, design) }; update_on={} } - } - } - ha:Realign grid = { li:action={GetXY(Click to set the grid origin); Display(ToggleGrid) } } - - - ha:Displayed element name { - li:submenu { - ha:Description = { checked=ChkElementName(1); action=Display(Description); update_on={editor/description} } - ha:Reference Designator = { checked=ChkElementName(2); action=Display(NameOnPCB); update_on={editor/name_on_pcb} } - ha:Value = { checked=ChkElementName(3); action=Display(Value); update_on={editor/name_on_pcb} } - } - } - ha:Enable Pinout shows number = { checked=editor/show_number; action=conf(toggle, editor/show_number, design) } - ha:Pins/Via show Name/Number = { a=d; action=Display(PinOrPadName) } - ha:Zoom In 20% = { m=Z; a=z; action=Zoom(-1.2) } - ha:Zoom Out 20% = { m=O; a=Shiftz; action=Zoom(+1.2) } - ha:More zooms and view changes { - li:submenu { - ha:Zoom Max = { m=M; a=v; action=Zoom() } - ha:Zoom In 2X = { action=Zoom(-2) } - ha:Zoom Out 2X = { action=Zoom(+2) } - ha:Zoom to 0.1mil/px = { action={Zoom(=0.1mil)} } - ha:Zoom to 0.01mm/px = { action={Zoom(=0.01mm)} } - ha:Zoom to 1mil/px = { action={Zoom(=1mil)} } - ha:Zoom to 0.05mm/px = { action={Zoom(=0.05mm)} } - ha:Zoom to 2.5mil/px = { action={Zoom(=2.5mil)} } - ha:Zoom to 0.1mm/px = { action={Zoom(=0.1mm)} } - ha:Zoom to 10mil/px = { action={Zoom(=10mil)} } - ha:Zoom In 20% and center = { m=Z; li:action={Zoom(-1.2); Center()} } - ha:Zoom Out 20% and center= { m=O; li:action={Zoom(+1.2); Center()} } - ha:Flip up/down = { checked=editor/view/flip_y; a=Tab; action=SwapSides(V) } - ha:Flip left/right = { checked=editor/view/flip_x; a=ShiftTab; action=SwapSides(H) } - ha:Spin 180 degrees = { a=CtrlTab; action=SwapSides(R) } - ha:Swap Sides = { a=Ctrl ShiftTab; action=SwapSides() } - ha:Center cursor = { a=c; action=Center() } - } - } - - - ha:Shown Layers { - li:submenu { - @layerview - - - ha:Edit Layer Groups = { action=EditLayerGroups() } - } - } - ha:Current Layer { - li:submenu { - anon2=@layerpick - - - ha:Delete current layer = { action=MoveLayer(c,-1) } - ha:Add new layer = { action=MoveLayer(-1,c) } - ha:Move current layer up = { action=MoveLayer(c,up) } - ha:Move current layer down= { action=MoveLayer(c,down) } - } - } - ha:Full screen = { checked=editor/fullscreen; a=\\; action=fullscreen(toggle) } - } - } # View - - ha:Settings = { - m=S - li:submenu { - ha:'All-direction' lines = { checked=editor/all_direction_lines; a=.; action=conf(toggle, editor/all_direction_lines, design) } - ha:Auto swap line start angle = { checked=editor/swap_start_direction; action=conf(toggle, editor/swap_start_direction, design) } - ha:Orthogonal moves = { checked=editor/orthogonal_moves; action=conf(toggle, editor/orthogonal_moves, design) } - ha:Crosshair snaps to pins and pads = { checked=editor/snap_pin; action=conf(toggle, editor/snap_pin, design) } - ha:Crosshair snaps to off-grid points on lines = { checked=editor/snap_offgrid_line; action=conf(toggle, editor/snap_offgrid_line, design) } - ha:Crosshair shows DRC clearance = { checked=editor/show_drc; action=conf(toggle, editor/show_drc, design) } - ha:Auto enforce DRC clearance = { checked=editor/auto_drc; action=conf(toggle, editor/auto_drc, design) } - ha:Lock Names = { checked=editor/lock_names; action=conf(toggle, editor/lock_names, design) } - ha:Only Names = { checked=editor/only_names; action=conf(toggle, editor/only_names, design) } - ha:Hide Names = { checked=editor/hide_names; action=conf(toggle, editor/hide_names, design) } - ha:Mincut on shorts = { checked=plugins/mincut/enable; action=conf(toggle, plugins/mincut/enable, design) } - ha:Libstroke gestures on middle button = { checked=editor/enable_stroke; action=conf(toggle, editor/enable_stroke, design) } - - - ha:Rubber band mode = { checked=editor/rubber_band_mode; action=conf(toggle, editor/rubber_band_mode, design) } - ha:Require unique element names = { checked=editor/unique_names; action=conf(toggle, editor/unique_names, design) } - ha:Auto-zero delta measurements = { checked=editor/local_ref; action=conf(toggle, editor/local_ref, design) } - ha:New lines, arcs clear polygons = { checked=editor/clear_line; action=conf(toggle, editor/clear_line, design) } - ha:New polygons are full ones = { checked=editor/full_poly; action=conf(toggle, editor/full_poly, design) } - ha:Show autorouter trials = { checked=editor/live_routing; action=conf(toggle, editor/live_routing, design) } - ha:Highlighting on line, arc points = { checked=editor/highlight_on_point; action=conf(toggle, editor/highlight_on_point, design) } - ha:Thin draw = { checked=editor/thin_draw; a=|; action=conf(toggle, editor/thin_draw, design) } - ha:Thin draw poly = { checked=editor/thin_draw_poly; a=Ctrl Shiftp; action=conf(toggle, editor/thin_draw_poly, design) } - ha:Check polygons = { checked=editor/check_planes; action=conf(toggle, editor/check_planes, design) } - - - ha:Vendor drill mapping = { checked=plugins/vendor/enable; action=conf(toggle, plugins/vendor/enable, design) } - ha:Import New Elements at = { - m=I - li:submenu { - ha:Center = { m=C; action=Import(setnewpoint,center) } - ha:Mark = { m=M; action=Import(setnewpoint,mark) } - ha:Crosshair = { m=h; action=Import(setnewpoint) } - - - ha:Set Dispersion = { m=D; action=Import(setdisperse) } - } - } - } - } #Settings - - ha:Select { - m=l - li:submenu { - ha:Select all visible objects = { action=Select(All) } - ha:Select all connected objects = { action=Select(Connection) } - - - ha:Unselect all objects = { action=Unselect(All) } - ha:unselect all connected objects = { action=Unselect(Connection) } - - - ha:Select by name { - li:submenu { - ha:All objects = { active=rc/have_regex; action=Select(ObjectByName) } - ha:Elements = { active=rc/have_regex; action=Select(ElementByName) } - ha:Pads = { active=rc/have_regex; action=Select(PadByName) } - ha:Pins = { active=rc/have_regex; action=Select(PinByName) } - ha:Text = { active=rc/have_regex; action=Select(TextByName) } - ha:Vias = { active=rc/have_regex; action=Select(ViaByName) } - } - } -#TODO: this is gtk-specific - ha:Advanced search and select= { action=DoWindows(search) } - - - ha:Auto-place selected elements = { a=Ctrlp; action=AutoPlaceSelected() } - ha:Disperse all elements = { action=DisperseElements(All) } - ha:Disperse selected elements = { action=DisperseElements(Selected) } - - - ha:Move selected elements to other side = { a=Shiftb; action=Flip(SelectedElements) } - ha:Move selected to current layer = { a=Shiftm; action=MoveToCurrentLayer(Selected) } - ha:Remove selected objects = { a=ShiftDelete; action=RemoveSelected() } - ha:Convert selection to element = { action=Select(Convert) } - - - ha:Optimize selected rats = { li:action={DeleteRats(SelectedRats); AddRats(SelectedRats) } } - ha:Auto-route selected rats = { a=Altr; action=AutoRoute(SelectedRats) } - ha:Rip up selected auto-routed tracks = { action=RipUp(Selected) } - - - ha:Edit properties of selected... = { a=Ctrle; action=PropEdit(Selected) } - ha:Change size of selected objects { - li:submenu { - ha:Lines -10 mil = { li:action={ChangeSize(SelectedLines,-10,mil); ChangeSize(SelectedArcs,-10,mil)} } - ha:Lines +10 mil = { li:action={ChangeSize(SelectedLines,+10,mil); ChangeSize(SelectedArcs,+10,mil)} } - ha:Pads -10 mil = { action=ChangeSize(SelectedPads,-10,mil) } - ha:Pads +10 mil = { action=ChangeSize(SelectedPads,+10,mil) } - ha:Pins -10 mil = { action=ChangeSize(SelectedPins,-10,mil) } - ha:Pins +10 mil = { action=ChangeSize(SelectedPins,+10,mil) } - ha:Texts -10 mil = { action=ChangeSize(SelectedTexts,-10,mil) } - ha:Texts +10 mil = { action=ChangeSize(SelectedTexts,+10,mil) } - ha:Vias -10 mil = { action=ChangeSize(SelectedVias,-10,mil) } - ha:Vias +10 mil = { action=ChangeSize(SelectedVias,+10,mil) } - } - } - - - ha:Change drilling hole of selected objects { - li:submenu { - ha:Vias -10 mil = { action=ChangeDrillSize(SelectedVias,-10,mil) } - ha:Vias +10 mil = { action=ChangeDrillSize(SelectedVias,+10,mil) } - ha:Pins -10 mil = { action=ChangeDrillSize(SelectedPins,-10,mil) } - ha:Pins +10 mil = { action=ChangeDrillSize(SelectedPins,+10,mil) } - } - } - - - ha:Change square-flag of selected objects { - li:submenu { - ha:Elements = { action=ChangeSquare(SelectedElements) } - ha:Pins = { action=ChangeSquare(SelectedPins) } - } - } - ha:Cycle object being dragged = { a=x; action=CycleDrag() } - } - } # Select - - ha:Buffer { - m=B - li:submenu { - ha:Cut selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer)} } - ha:Paste buffer to layout = { action=Mode(PasteBuffer) } - - - ha:Rotate buffer 90 deg CCW = { a=ShiftF7; li:action={Mode(PasteBuffer); PasteBuffer(Rotate,1)} } - ha:Rotate buffer 90 deg CW = { li:action={Mode(PasteBuffer); PasteBuffer(Rotate,3)} } - ha:Arbitrarily Rotate Buffer = { li:action={Mode(PasteBuffer); FreeRotateBuffer()} } - ha:Mirror buffer (up/down) = { li:action={Mode(PasteBuffer); PasteBuffer(Mirror)} } - ha:Mirror buffer (left/right) = { li:action={Mode(PasteBuffer); PasteBuffer(Rotate,1); PasteBuffer(Mirror); PasteBuffer(Rotate,3)} } - - - ha:Clear buffer = { action=PasteBuffer(Clear) } - ha:Convert buffer to element = { action=PasteBuffer(Convert) } - ha:Break buffer elements to pieces = { action=PasteBuffer(Restore) } - ha:Save buffer elements to file = { action=Save(PasteBuffer) } - - - ha:Select Buffer \#1 = { checked=ChkBuffer(1); m=1; a=Shift1; action=PasteBuffer(1); update_on={editor/buffer_number} } - ha:Select Buffer \#2 = { checked=ChkBuffer(2); m=2; a=Shift2; action=PasteBuffer(2); update_on={editor/buffer_number} } - ha:Select Buffer \#3 = { checked=ChkBuffer(3); m=3; a=Shift3; action=PasteBuffer(3); update_on={editor/buffer_number} } - ha:Select Buffer \#4 = { checked=ChkBuffer(4); m=4; a=Shift4; action=PasteBuffer(4); update_on={editor/buffer_number} } - ha:Select Buffer \#5 = { checked=ChkBuffer(5); m=5; a=Shift5; action=PasteBuffer(5); update_on={editor/buffer_number} } - } - } # Buffer - - ha:Connects = { - m=C - li:submenu { - ha:Lookup connection to object = { a=Ctrlf; li:action={GetXY(Click on the object); Connection(Find)} } - ha:Reset scanned pads/pins/vias = { li:action={Connection(ResetPinsViasAndPads); Display(Redraw)} } - ha:Reset scanned lines/polygons = { li:action={Connection(ResetLinesAndPolygons); Display(Redraw)} } - ha:Reset all connections = { a=Shiftf; li:action={Connection(Reset); Display(Redraw)} } - - - ha:Optimize rats nest = { a=o; li:action={Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block)} } - ha:Erase rats nest = { a=e; action=DeleteRats(AllRats) } - ha:Erase selected rats = { a=Shifte; action=DeleteRats(SelectedRats) } - - - ha:Auto-route selected rats = { action=AutoRoute(Selected) } - ha:Auto-route all rats = { action=AutoRoute(AllRats) } - ha:Rip up all auto-routed tracks = { action=RipUp(All) } - - - ha:Optimize routed tracks { - li:submenu { - ha:Auto-Optimize = { a={Shift=}; action=djopt(auto) } - ha:Debumpify = { action=djopt(debumpify) } - ha:Unjaggy = { action=djopt(unjaggy) } - ha:Vianudge = { action=djopt(vianudge) } - ha:Viatrim = { action=djopt(viatrim) } - ha:Ortho pull = { action=djopt(orthopull) } - ha:Simple optimization = { a={=}; action=djopt(simple) } - ha:Miter = { action=djopt(miter) } - ha:Puller = { a=y; action=Puller() } - ha:Global Puller { - li:submenu { - ha:Selected = { action=GlobalPuller(selected) } - ha:Found = { action=GlobalPuller(found) } - ha:All = { action=GlobalPuller() } - } - } - - - ha:Only autorouted nets = { checked=plugins/djopt/auto_only; action=conf(toggle, plugins/djopt/auto_only, design) } - } - } - - - ha:Design Rule Checker = { action=DRC() } - - - ha:Apply vendor drill mapping = { action=ApplyVendor() } - - - ha:Design changes (back annotation) { - li:submenu { - ha:Swap nets on two selected pins = { a=Shiftx; action=net(swap) } - ha:Replace footprint = { a=Alt Shiftf; action=ReplaceFootprint() } - } - } - } - } # Connects - - ha:Plugins { - m=P - li:submenu { - ha:Manage plugins... = { a=Altp; action=ManagePlugins() } - } - } # Plugins - - ha:Info = { - m=I - li:submenu { - ha:Generate object report = { a=Ctrlr; action=ReportObject() } - ha:Generate drill summary = { action=Report(DrillReport) } - ha:Report found pins\/pads = { action=Report(FoundPins) } - ha:Key Bindings { - li:submenu { - ha:Remove = { a=Delete; li:action={Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore)} } - ha:Remove Selected = { a=BackSpace; action=RemoveSelected() } - ha:Remove Connected = { a=ShiftBackSpace; li:action={Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block)} } - ha:Remove Connected = { li:action={Atomic(Save); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Restore); Connection(Find); Atomic(Restore); Select(Connection); Atomic(Restore); RemoveSelected(); Atomic(Restore); Connection(Reset); Atomic(Restore); Unselect(All); Atomic(Block)} } - ha:Set Same = { a=a; action=SetSame() } - ha:Flip Object = { a=b; action=Flip(Object) } - ha:Find Connections = { a=f; li:action={Connection(Reset); Connection(Find)} } - ha:ToggleHideName Object = { a=h; action=ToggleHideName(Object) } - ha:ToggleHideName SelectedElement = { a=Shifth; action=ToggleHideName(SelectedElements) } - ha:ChangeHole Object = { a=Ctrlh; action=ChangeHole(Object) } - ha:ChangeJoin Object = { a=j; action=ChangeJoin(Object) } - ha:ChangeJoin SelectedObject = { a=Shiftj; action=ChangeJoin(SelectedObjects) } - ha:Clear Object +2 mil = { a=k; action=ChangeClearSize(Object,+2,mil) } - ha:Clear Object -2 mil = { a=Shiftk; action=ChangeClearSize(Object,-2,mil) } - ha:Clear Selected +2 mil = { a=Ctrlk; action=ChangeClearSize(SelectedObjects,+2,mil) } - ha:Clear Selected -2 mil = { a=Shift Ctrlk; action=ChangeClearSize(SelectedObjects,-2,mil) } - ha:Line Tool size +5 mil = { a=l; action=SetValue(LineSize,+5,mil) } - ha:Line Tool size -5 mil = { a=Shiftl; action=SetValue(LineSize,-5,mil) } - ha:Move Object to current layer = { a=m; action=MoveToCurrentLayer(Object) } - ha:MarkCrosshair = { a=Ctrlm; action=MarkCrosshair() } - ha:Select shortest rat = { a=Shiftn; action=AddRats(Close) } - ha:AddRats to selected pins = { a=Shifto; li:action={Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(SelectedRats); Atomic(Block)} } - ha:ChangeOctagon Object = { a=Ctrlo; action=ChangeOctagon(Object) } - ha:Polygon PreviousPoint = { a=p; action=Polygon(PreviousPoint) } - ha:Polygon Close = { a=Shiftp; action=Polygon(Close) } - ha:ChangeSquare Object = { a=q; action=ChangeSquare(ToggleObject) } - ha:ChangeSizes to Route style = { a=Shifty; action=ChangeSizes(Object,style,mil) } - ha:ChangeSize +5 mil = { a=s; action=ChangeSize(Object,+5,mil) } - ha:ChangeSize -5 mil = { a=Shifts; action=ChangeSize(Object,-5,mil) } - ha:ChangeDrill +5 mil = { a=Alts; action=ChangeDrillSize(Object,+5,mil) } - ha:ChangeDrill -5 mil = { a=Alt Shifts; action=ChangeDrillSize(Object,-5,mil) } - ha:Text Tool scale +10 mil = { a=t; action=SetValue(TextScale,+10,mil) } - ha:Text Tool scale -10 mil = { a=Shiftt; action=SetValue(TextScale,-10,mil) } - ha:Via Tool size +5 mil = { a=Shiftv; action=SetValue(ViaSize,+5,mil) } - ha:Via Tool size -5 mil = { a=Shift Ctrlv; action=SetValue(ViaSize,-5,mil) } - ha:Via Tool drill +5 mil = { a=Altv; action=SetValue(ViaDrillingHole,+5,mil) } - ha:Via Tool drill -5 mil = { a=Alt Shiftv; action=SetValue(ViaDrillingHole,-5,mil) } - ha:AddRats Selected = { a=Shiftw; action=AddRats(SelectedRats) } - ha:Add All Rats = { a=w; action=AddRats(AllRats) } - ha:Cycle Clip = { a=/; action=Display(CycleClip) } - ha:Arrow Mode = { a=space; checked=ChkMode(arrow); action=Mode(Arrow); update_on={editor/mode} } - ha:Temp Arrow ON = { a=[; li:action={Mode(Save); Mode(Arrow); Mode(Notify)} } - ha:Temp Arrow OFF = { a=]; li:action={Mode(Release); Mode(Restore)} } - - - ha:Step Up = { a=Up; action=Cursor(Warp,0,1,grid) } - ha:Step Down = { a=Down; action=Cursor(Warp,0,-1,grid) } - ha:Step Left = { a=Left; action=Cursor(Warp,-1,0,grid) } - ha:Step Right = { a=Right; action=Cursor(Warp,1,0,grid) } - ha:Step +Up = { a=ShiftUp; action=Cursor(Pan,0,50,view) } - ha:Step +Down = { a=ShiftDown; action=Cursor(Pan,0,-50,view) } - ha:Step +Left = { a=ShiftLeft; action=Cursor(Pan,-50,0,view) } - ha:Step +Right = { a=ShiftRight; action=Cursor(Pan,50,0,view) } - ha:Click = { a=Enter; li:action={Mode(Notify); Mode(Release)} } - - - ha:layer keys { - li:submenu { - ha:Select Layer 1 = { a=1; action=SelectLayer(1) } - ha:Select Layer 2 = { a=2; action=SelectLayer(2) } - ha:Select Layer 3 = { a=3; action=SelectLayer(3) } - ha:Select Layer 4 = { a=4; action=SelectLayer(4) } - ha:Select Layer 5 = { a=5; action=SelectLayer(5) } - ha:Select Layer 6 = { a=6; action=SelectLayer(6) } - ha:Select Layer 7 = { a=7; action=SelectLayer(7) } - ha:Select Layer 8 = { a=8; action=SelectLayer(8) } - ha:Select Layer 9 = { a=9; action=SelectLayer(9) } - ha:Select Layer 10 = { a=0; action=SelectLayer(10) } - ha:Select Layer 11 = { a=Alt1; action=SelectLayer(11) } - ha:Select Layer 12 = { a=Alt2; action=SelectLayer(12) } - ha:Select Layer 13 = { a=Alt3; action=SelectLayer(13) } - ha:Select Layer 14 = { a=Alt4; action=SelectLayer(14) } - ha:Select Layer 15 = { a=Alt5; action=SelectLayer(15) } - ha:Select Layer 16 = { a=Alt6; action=SelectLayer(16) } - ha:Select Layer 17 = { a=Alt7; action=SelectLayer(17) } - ha:Select Layer 18 = { a=Alt8; action=SelectLayer(18) } - ha:Select Layer 19 = { a=Alt9; action=SelectLayer(19) } - ha:Select Layer 20 = { a=Alt0; action=SelectLayer(20) } - - - ha:Toggle Layer 1 = { a=Ctrl1; action=ToggleView(1) } - ha:Toggle Layer 2 = { a=Ctrl2; action=ToggleView(2) } - ha:Toggle Layer 3 = { a=Ctrl3; action=ToggleView(3) } - ha:Toggle Layer 4 = { a=Ctrl4; action=ToggleView(4) } - ha:Toggle Layer 5 = { a=Ctrl5; action=ToggleView(5) } - ha:Toggle Layer 6 = { a=Ctrl6; action=ToggleView(6) } - ha:Toggle Layer 7 = { a=Ctrl7; action=ToggleView(7) } - ha:Toggle Layer 8 = { a=Ctrl8; action=ToggleView(8) } - ha:Toggle Layer 9 = { a=Ctrl9; action=ToggleView(9) } - ha:Toggle Layer 10 = { a=Ctrl0; action=ToggleView(10) } - ha:Toggle Layer 11 = { a=Ctrl-Alt1; action=ToggleView(11) } - ha:Toggle Layer 12 = { a=Ctrl-Alt2; action=ToggleView(12) } - ha:Toggle Layer 13 = { a=Ctrl-Alt3; action=ToggleView(13) } - ha:Toggle Layer 14 = { a=Ctrl-Alt4; action=ToggleView(14) } - ha:Toggle Layer 15 = { a=Ctrl-Alt5; action=ToggleView(15) } - ha:Toggle Layer 16 = { a=Ctrl-Alt6; action=ToggleView(16) } - ha:Toggle Layer 17 = { a=Ctrl-Alt7; action=ToggleView(17) } - ha:Toggle Layer 18 = { a=Ctrl-Alt8; action=ToggleView(18) } - ha:Toggle Layer 19 = { a=Ctrl-Alt9; action=ToggleView(19) } - ha:Toggle Layer 20 = { a=Ctrl-Alt0; action=ToggleView(20) } - } - } # layer keys - } - } - } - } # Info - - ha:Window { - m=W - li:submenu { - ha:Library = { a=i; action=DoWindows(Library) } - ha:Message Log = { action=DoWindows(Log) } - ha:DRC Check = { action=DoWindows(DRC) } - ha:Netlist = { action=DoWindows(Netlist) } - ha:Command Entry = { a={:}; action=Command() } - ha:Pinout = { a=Shiftd; action=Display(Pinout) } - - - ha:About... = { action=About() } - } - } # Window - } # main menu - - li:popups { - ha:popup1 { - li:submenu { - ha:Operations on selections { - li:submenu { - ha:Unselect all objects = { action=Unselect(All) } - ha:Remove selected objects = { action=RemoveSelected() } - ha:Copy selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Mode(PasteBuffer)} } - ha:Cut selection to buffer = { li:action={GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer)} } - ha:Convert selection to element = { action=Select(Convert) } - ha:Auto place selected elements = { action=AutoPlaceSelected() } - ha:Autoroute selected elements = { action=AutoRoute(SelectedRats) } - ha:Rip up selected auto-routed tracks = { action=RipUp(Selected) } - } - } - ha:Operations on this location { - li:submenu { - ha:Generate object report = { li:action={GetXY(Click on the object); Report(Object)} } - } - } - - - ha:Undo last operation = { action=Undo() } - ha:Redo last undone operation = { action=Redo() } - - - ha:Tools { - li:submenu { - ha:None = { checked=ChkMode(none); action=Mode(None); update_on={editor/mode} } - ha:Via = { checked=ChkMode(via); a=F1; action=Mode(Via); update_on={editor/mode} } - ha:Line = { checked=ChkMode(line); a=F2; action=Mode(Line); update_on={editor/mode} } - ha:Arc = { checked=ChkMode(arc); a=F3; action=Mode(Arc); update_on={editor/mode} } - ha:Text = { checked=ChkMode(text); a=F4; action=Mode(Text); update_on={editor/mode} } - ha:Rectangle = { checked=ChkMode(rectangle); a=F5; action=Mode(Rectangle); update_on={editor/mode} } - ha:Polygon = { checked=ChkMode(polygon); a=F6; action=Mode(Polygon); update_on={editor/mode} } - ha:Polygon Hole = { checked=ChkMode(polygonhole); action=Mode(PolygonHole); update_on={editor/mode} } - ha:Buffer = { checked=ChkMode(pastebuffer); a=F7; action=Mode(PasteBuffer); update_on={editor/mode} } - ha:Remove = { checked=ChkMode(remove); a=F8; action=Mode(Remove); update_on={editor/mode} } - ha:Rotate = { checked=ChkMode(rotate); a=F9; action=Mode(Rotate); update_on={editor/mode} } - ha:Thermal = { checked=ChkMode(thermal); a=F10; action=Mode(Thermal); update_on={editor/mode} } - ha:Arrow = { checked=ChkMode(arrow); a=F11; action=Mode(Arrow); update_on={editor/mode} } - ha:Insert Point = { checked=ChkMode(insertpoint); a=Insert; action=Mode(InsertPoint); update_on={editor/mode} } - ha:Move = { checked=ChkMode(move); action=Mode(Move); update_on={editor/mode} } - ha:Copy = { checked=ChkMode(copy); action=Mode(Copy); update_on={editor/mode} } - ha:Lock = { checked=ChkMode(lock); a=F12; action=Mode(Lock); update_on={editor/mode} } - ha:Cancel = { a=Escape; action=Mode(Escape) } - } - } - } - } # popup1 - } # popups -} # root Index: 1.1.4/src/stub_mincut.h =================================================================== --- 1.1.4/src/stub_mincut.h (revision 10776) +++ 1.1.4/src/stub_mincut.h (nonexistent) @@ -1,25 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -extern void (*stub_rat_found_short)(PinType * pin, PadType * pad, const char *with_net); -extern void (*stub_rat_proc_shorts)(void); - Index: 1.1.4/src/hid_helper.c =================================================================== --- 1.1.4/src/hid_helper.c (revision 10776) +++ 1.1.4/src/hid_helper.c (nonexistent) @@ -1,125 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 2004 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -#include "config.h" -#include "data.h" -#include "misc.h" -#include "layer.h" -#include "hid_helper.h" -#include "hid_attrib.h" -#include "compat_misc.h" - -const char *layer_type_to_file_name(int idx, int style) -{ - int group; - int nlayers; - const char *single_name; - - switch (idx) { - case SL(SILK, TOP): - return "topsilk"; - case SL(SILK, BOTTOM): - return "bottomsilk"; - case SL(MASK, TOP): - return "topmask"; - case SL(MASK, BOTTOM): - return "bottommask"; - case SL(PDRILL, 0): - return "plated-drill"; - case SL(UDRILL, 0): - return "unplated-drill"; - case SL(PASTE, TOP): - return "toppaste"; - case SL(PASTE, BOTTOM): - return "bottompaste"; - case SL(INVISIBLE, 0): - return "invisible"; - case SL(FAB, 0): - return "fab"; - case SL(ASSY, TOP): - return "topassembly"; - case SL(ASSY, BOTTOM): - return "bottomassembly"; - default: - group = GetLayerGroupNumberByNumber(idx); - nlayers = PCB->LayerGroups.Number[group]; - single_name = PCB->Data->Layer[idx].Name; - if (group == GetLayerGroupNumberByNumber(component_silk_layer)) { - if (style == FNS_first || (style == FNS_single && nlayers == 2)) - return single_name; - return "top"; - } - else if (group == GetLayerGroupNumberByNumber(solder_silk_layer)) { - if (style == FNS_first || (style == FNS_single && nlayers == 2)) - return single_name; - return "bottom"; - } - else if (nlayers == 1 - && (strcmp(PCB->Data->Layer[idx].Name, "route") == 0 || strcmp(PCB->Data->Layer[idx].Name, "outline") == 0)) { - return "outline"; - } - else { - static char buf[20]; - if (style == FNS_first || (style == FNS_single && nlayers == 1)) - return single_name; - sprintf(buf, "group%d", group); - return buf; - } - break; - } -} - -void derive_default_filename(const char *pcbfile, HID_Attribute * filename_attrib, const char *suffix, char **memory) -{ - char *buf; - char *pf; - - if (pcbfile == NULL) - pf = pcb_strdup("unknown.pcb"); - else - pf = pcb_strdup(pcbfile); - - if (!pf || (memory && filename_attrib->default_val.str_value != *memory)) - return; - - buf = (char *) malloc(strlen(pf) + strlen(suffix) + 1); - if (memory) - *memory = buf; - if (buf) { - size_t bl; - strcpy(buf, pf); - bl = strlen(buf); - if (bl > 4 && strcmp(buf + bl - 4, ".pcb") == 0) - buf[bl - 4] = 0; - strcat(buf, suffix); - if (filename_attrib->default_val.str_value) - free((void *) filename_attrib->default_val.str_value); - filename_attrib->default_val.str_value = buf; - } - - free(pf); -} Index: 1.1.4/src/hid_nogui.c =================================================================== --- 1.1.4/src/hid_nogui.c (revision 10776) +++ 1.1.4/src/hid_nogui.c (nonexistent) @@ -1,467 +0,0 @@ -#include "config.h" - -#include -#include -#include -#include - -#include "global.h" -#include "hid.h" -#include "compat_misc.h" - -/* This is the "gui" that is installed at startup, and is used when - there is no other real GUI to use. For the most part, it just - stops the application from (1) crashing randomly, and (2) doing - gui-specific things when it shouldn't. */ - -#define CRASH(func) fprintf(stderr, "HID error: pcb called GUI function %s without having a GUI available.\n", func); abort() - -typedef struct hid_gc_struct { - int nothing_interesting_here; -} hid_gc_struct; - -static HID_Attribute *nogui_get_export_options(int *n_ret) -{ - CRASH("get_export_options"); - return 0; -} - -static void nogui_do_export(HID_Attr_Val * options) -{ - CRASH("do_export"); -} - -static void nogui_parse_arguments(int *argc, char ***argv) -{ - CRASH("parse_arguments"); -} - -static void nogui_invalidate_lr(int l, int r, int t, int b) -{ - CRASH("invalidate_lr"); -} - -static void nogui_invalidate_all(void) -{ - CRASH("invalidate_all"); -} - -static int nogui_set_layer(const char *name, int idx, int empty) -{ - CRASH("set_layer"); - return 0; -} - -static void nogui_end_layer(void) -{ -} - -static hidGC nogui_make_gc(void) -{ - return 0; -} - -static void nogui_destroy_gc(hidGC gc) -{ -} - -static void nogui_use_mask(int use_it) -{ - CRASH("use_mask"); -} - -static void nogui_set_color(hidGC gc, const char *name) -{ - CRASH("set_color"); -} - -static void nogui_set_line_cap(hidGC gc, EndCapStyle style) -{ - CRASH("set_line_cap"); -} - -static void nogui_set_line_width(hidGC gc, Coord width) -{ - CRASH("set_line_width"); -} - -static void nogui_set_draw_xor(hidGC gc, int xor_) -{ - CRASH("set_draw_xor"); -} - -static void nogui_set_draw_faded(hidGC gc, int faded) -{ -} - -static void nogui_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - CRASH("draw_line"); -} - -static void nogui_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle end_angle) -{ - CRASH("draw_arc"); -} - -static void nogui_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - CRASH("draw_rect"); -} - -static void nogui_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) -{ - CRASH("fill_circle"); -} - -static void nogui_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) -{ - CRASH("fill_polygon"); -} - -static void nogui_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) -{ - CRASH("fill_pcb_polygon"); -} - -static void nogui_fill_pcb_pad(hidGC gc, PadType * pad, pcb_bool clear, pcb_bool mask) -{ - CRASH("fill_pcb_pad"); -} - -static void nogui_thindraw_pcb_pad(hidGC gc, PadType * pad, pcb_bool clear, pcb_bool mask) -{ - CRASH("thindraw_pcb_pad"); -} - -static void nogui_fill_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pad, pcb_bool drawHole, pcb_bool mask) -{ - CRASH("fill_pcb_pv"); -} - -static void nogui_thindraw_pcb_pv(hidGC fg_gc, hidGC bg_gc, PinType * pad, pcb_bool drawHole, pcb_bool mask) -{ - CRASH("thindraw_pcb_pv"); -} - -static void nogui_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - CRASH("fill_rect"); -} - -static void nogui_calibrate(double xval, double yval) -{ - CRASH("calibrate"); -} - -static int nogui_shift_is_pressed(void) -{ - /* This is called from FitCrosshairIntoGrid() when the board is loaded. */ - return 0; -} - -static int nogui_control_is_pressed(void) -{ - CRASH("control_is_pressed"); - return 0; -} - -static int nogui_mod1_is_pressed(void) -{ - CRASH("mod1_is_pressed"); - return 0; -} - -static void nogui_get_coords(const char *msg, Coord * x, Coord * y) -{ - CRASH("get_coords"); -} - -static void nogui_set_crosshair(int x, int y, int action) -{ -} - -static hidval nogui_add_timer(void (*func) (hidval user_data), unsigned long milliseconds, hidval user_data) -{ - hidval rv; - CRASH("add_timer"); - rv.lval = 0; - return rv; -} - -static void nogui_stop_timer(hidval timer) -{ - CRASH("stop_timer"); -} - -static hidval nogui_watch_file(int fd, unsigned int condition, void (*func) (hidval watch, int fd, unsigned int condition, hidval user_data), hidval user_data) -{ - hidval rv; - CRASH("watch_file"); - rv.lval = 0; - return rv; -} - -static void nogui_unwatch_file(hidval watch) -{ - CRASH("unwatch_file"); -} - -static hidval nogui_add_block_hook(void (*func) (hidval data), hidval data) -{ - hidval rv; - CRASH("add_block_hook"); - rv.ptr = NULL; - return rv; -} - -static void nogui_stop_block_hook(hidval block_hook) -{ - CRASH("stop_block_hook"); -} - -static void nogui_log(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); -} - -static void nogui_logv(enum pcb_message_level level, const char *fmt, va_list ap) -{ - switch (level) { - case PCB_MSG_DEBUG: - printf("D:"); - break; - case PCB_MSG_INFO: - printf("I:"); - break; - case PCB_MSG_WARNING: - printf("W:"); - break; - case PCB_MSG_ERROR: - printf("E:"); - break; - } - vprintf(fmt, ap); -} - -/* Return a line of user input text, stripped of any newline characters. - * Returns NULL if the user simply presses enter, or otherwise gives no input. - */ -#define MAX_LINE_LENGTH 1024 -static char *read_stdin_line(void) -{ - static char buf[MAX_LINE_LENGTH]; - char *s; - int i; - - s = fgets(buf, MAX_LINE_LENGTH, stdin); - if (s == NULL) { - printf("\n"); - return NULL; - } - - /* Strip any trailing newline characters */ - for (i = strlen(s) - 1; i >= 0; i--) - if (s[i] == '\r' || s[i] == '\n') - s[i] = '\0'; - - if (s[0] == '\0') - return NULL; - - return pcb_strdup(s); -} - -#undef MAX_LINE_LENGTH - -static int nogui_confirm_dialog(const char *msg, ...) -{ - char *answer; - int ret = 0; - pcb_bool valid_answer = pcb_false; - va_list args; - - do { - va_start(args, msg); - vprintf(msg, args); - va_end(args); - - printf(" ? 0=cancel 1 = ok : "); - - answer = read_stdin_line(); - - if (answer == NULL) - continue; - - if (answer[0] == '0' && answer[1] == '\0') { - ret = 0; - valid_answer = pcb_true; - } - - if (answer[0] == '1' && answer[1] == '\0') { - ret = 1; - valid_answer = pcb_true; - } - - free(answer); - } - while (!valid_answer); - return ret; -} - -static int nogui_close_confirm_dialog() -{ - return nogui_confirm_dialog(_("OK to lose data ?"), NULL); -} - -static void nogui_report_dialog(const char *title, const char *msg) -{ - printf("--- %s ---\n%s\n", title, msg); -} - -static char *nogui_prompt_for(const char *msg, const char *default_string) -{ - char *answer; - - if (default_string) - printf("%s [%s] : ", msg, default_string); - else - printf("%s : ", msg); - - answer = read_stdin_line(); - if (answer == NULL) - return pcb_strdup((default_string != NULL) ? default_string : ""); - else - return pcb_strdup(answer); -} - -/* FIXME - this could use some enhancement to actually use the other - args */ -static char *nogui_fileselect(const char *title, const char *descr, - const char *default_file, const char *default_ext, const char *history_tag, int flags) -{ - char *answer; - - if (default_file) - printf("%s [%s] : ", title, default_file); - else - printf("%s : ", title); - - answer = read_stdin_line(); - if (answer == NULL) - return (default_file != NULL) ? pcb_strdup(default_file) : NULL; - else - return pcb_strdup(answer); -} - -static int nogui_attribute_dialog(HID_Attribute * attrs, int n_attrs, HID_Attr_Val * results, const char *title, const char *descr) -{ - CRASH("attribute_dialog"); -} - -static void nogui_show_item(void *item) -{ - CRASH("show_item"); -} - -static void nogui_beep(void) -{ - putchar(7); - fflush(stdout); -} - -static int nogui_progress(int so_far, int total, const char *message) -{ - return 0; -} - -static HID *nogui_request_debug_draw(void) -{ - return NULL; -} - -static void nogui_flush_debug_draw(void) -{ -} - -static void nogui_finish_debug_draw(void) -{ -} - -static void nogui_create_menu(const char *menu, const char *action, const char *mnemonic, const char *accel, const char *tip, const char *cookie) -{ -} - -void common_nogui_init(HID * hid) -{ - hid->get_export_options = nogui_get_export_options; - hid->do_export = nogui_do_export; - hid->parse_arguments = nogui_parse_arguments; - hid->invalidate_lr = nogui_invalidate_lr; - hid->invalidate_all = nogui_invalidate_all; - hid->set_layer = nogui_set_layer; - hid->end_layer = nogui_end_layer; - hid->make_gc = nogui_make_gc; - hid->destroy_gc = nogui_destroy_gc; - hid->use_mask = nogui_use_mask; - hid->set_color = nogui_set_color; - hid->set_line_cap = nogui_set_line_cap; - hid->set_line_width = nogui_set_line_width; - hid->set_draw_xor = nogui_set_draw_xor; - hid->set_draw_faded = nogui_set_draw_faded; - hid->draw_line = nogui_draw_line; - hid->draw_arc = nogui_draw_arc; - hid->draw_rect = nogui_draw_rect; - hid->fill_circle = nogui_fill_circle; - hid->fill_polygon = nogui_fill_polygon; - hid->fill_pcb_polygon = nogui_fill_pcb_polygon; - hid->fill_pcb_pad = nogui_fill_pcb_pad; - hid->thindraw_pcb_pad = nogui_thindraw_pcb_pad; - hid->fill_pcb_pv = nogui_fill_pcb_pv; - hid->thindraw_pcb_pv = nogui_thindraw_pcb_pv; - hid->fill_rect = nogui_fill_rect; - hid->calibrate = nogui_calibrate; - hid->shift_is_pressed = nogui_shift_is_pressed; - hid->control_is_pressed = nogui_control_is_pressed; - hid->mod1_is_pressed = nogui_mod1_is_pressed; - hid->get_coords = nogui_get_coords; - hid->set_crosshair = nogui_set_crosshair; - hid->add_timer = nogui_add_timer; - hid->stop_timer = nogui_stop_timer; - hid->watch_file = nogui_watch_file; - hid->unwatch_file = nogui_unwatch_file; - hid->add_block_hook = nogui_add_block_hook; - hid->stop_block_hook = nogui_stop_block_hook; - hid->log = nogui_log; - hid->logv = nogui_logv; - hid->confirm_dialog = nogui_confirm_dialog; - hid->close_confirm_dialog = nogui_close_confirm_dialog; - hid->report_dialog = nogui_report_dialog; - hid->prompt_for = nogui_prompt_for; - hid->fileselect = nogui_fileselect; - hid->attribute_dialog = nogui_attribute_dialog; - hid->show_item = nogui_show_item; - hid->beep = nogui_beep; - hid->progress = nogui_progress; - hid->request_debug_draw = nogui_request_debug_draw; - hid->flush_debug_draw = nogui_flush_debug_draw; - hid->finish_debug_draw = nogui_finish_debug_draw; - hid->create_menu = nogui_create_menu; -} - -static HID nogui_hid; - -HID *hid_nogui_get_hid(void) -{ - memset(&nogui_hid, 0, sizeof(HID)); - - nogui_hid.struct_size = sizeof(HID); - nogui_hid.name = "nogui"; - nogui_hid.description = "Default GUI when no other GUI is present. " "Does nothing."; - - common_nogui_init(&nogui_hid); - - return &nogui_hid; -} Index: 1.1.4/src/macro.h =================================================================== --- 1.1.4/src/macro.h (revision 10776) +++ 1.1.4/src/macro.h (nonexistent) @@ -1,436 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* some commonly used macros not related to a special C-file - * the file is included by global.h after const.h - */ - -#ifndef PCB_MACRO_H -#define PCB_MACRO_H - -/* --------------------------------------------------------------------------- - * macros to transform coord systems - * draw.c uses a different definition of TO_SCREEN - */ -#ifndef SWAP_IDENT -#define SWAP_IDENT conf_core.editor.show_solder_side -#endif - -#define SWAP_SIGN_X(x) (x) -#define SWAP_SIGN_Y(y) (-(y)) -#define SWAP_ANGLE(a) (-(a)) -#define SWAP_DELTA(d) (-(d)) -#define SWAP_X(x) (SWAP_SIGN_X(x)) -#define SWAP_Y(y) (PCB->MaxHeight +SWAP_SIGN_Y(y)) - -/* --------------------------------------------------------------------------- - * misc macros, some might already be defined by - */ -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif -#ifndef SGN -#define SGN(a) ((a) >0 ? 1 : ((a) == 0 ? 0 : -1)) -#endif -#define SGNZ(a) ((a) >=0 ? 1 : -1) -#define MAKEMIN(a,b) if ((b) < (a)) (a) = (b) -#define MAKEMAX(a,b) if ((b) > (a)) (a) = (b) - -#define ENTRIES(x) (sizeof((x))/sizeof((x)[0])) -#define UNKNOWN(a) ((a) && *(a) ? (a) : "(unknown)") -#define NSTRCMP(a, b) ((a) ? ((b) ? strcmp((a),(b)) : 1) : -1) -#define EMPTY(a) ((a) ? (a) : "") -#define EMPTY_STRING_P(a) ((a) ? (a)[0]==0 : 1) -#define XOR(a,b) (((a) && !(b)) || (!(a) && (b))) -#define SQUARE(x) ((float) (x) * (float) (x)) -#define TO_RADIANS(degrees) (PCB_M180 * (degrees)) - -/* --------------------------------------------------------------------------- - * returns the object ID - */ -#define OBJECT_ID(p) (((AnyObjectTypePtr) p)->ID) - -/* --------------------------------------------------------------------------- - * access macro for current buffer - */ -#define PASTEBUFFER (&Buffers[conf_core.editor.buffer_number]) - -/* --------------------------------------------------------------------------- - * some routines for flag setting, clearing, changing and testing - */ -#define SET_FLAG(F,P) ((P)->Flags.f |= (F)) -#define CLEAR_FLAG(F,P) ((P)->Flags.f &= (~(F))) -#define TEST_FLAG(F,P) ((P)->Flags.f & (F) ? 1 : 0) -#define TOGGLE_FLAG(F,P) ((P)->Flags.f ^= (F)) -#define ASSIGN_FLAG(F,V,P) ((P)->Flags.f = ((P)->Flags.f & (~(F))) | ((V) ? (F) : 0)) -#define TEST_FLAGS(F,P) (((P)->Flags.f & (F)) == (F) ? 1 : 0) - -typedef enum { - PCB_CHGFLG_CLEAR, - PCB_CHGFLG_SET, - PCB_CHGFLG_TOGGLE -} pcb_change_flag_t; - -#define CHANGE_FLAG(how, F, P) \ -do { \ - switch(how) { \ - case PCB_CHGFLG_CLEAR: CLEAR_FLAG(F, P); break; \ - case PCB_CHGFLG_SET: SET_FLAG(F, P); break; \ - case PCB_CHGFLG_TOGGLE: TOGGLE_FLAG(F, P); break; \ - } \ -} while(0) - -#define FLAGS_EQUAL(F1,F2) (memcmp (&F1, &F2, sizeof(FlagType)) == 0) - -#define THERMFLAG(L) (0xf << (4 *((L) % 2))) - -#define TEST_THERM(L,P) ((P)->Flags.t[(L)/2] & THERMFLAG(L) ? 1 : 0) -#define GET_THERM(L,P) (((P)->Flags.t[(L)/2] >> (4 * ((L) % 2))) & 0xf) -#define CLEAR_THERM(L,P) (P)->Flags.t[(L)/2] &= ~THERMFLAG(L) -#define ASSIGN_THERM(L,V,P) (P)->Flags.t[(L)/2] = ((P)->Flags.t[(L)/2] & ~THERMFLAG(L)) | ((V) << (4 * ((L) % 2))) - - -#define GET_SQUARE(P) ((P)->Flags.q) -#define CLEAR_SQUARE(P) (P)->Flags.q = 0 -#define ASSIGN_SQUARE(V,P) (P)->Flags.q = V - - -#define GET_INTCONN(P) ((P)->Flags.int_conn_grp) - -extern int mem_any_set(unsigned char *, int); -#define TEST_ANY_THERMS(P) mem_any_set((P)->Flags.t, sizeof((P)->Flags.t)) - -/* --------------------------------------------------------------------------- - * access macros for elements name structure - */ -#define DESCRIPTION_INDEX 0 -#define NAMEONPCB_INDEX 1 -#define VALUE_INDEX 2 -#define NAME_INDEX() (conf_core.editor.name_on_pcb ? NAMEONPCB_INDEX :\ - (conf_core.editor.description ? \ - DESCRIPTION_INDEX : VALUE_INDEX)) -#define ELEMENT_NAME(p,e) ((e)->Name[NAME_INDEX()].TextString) -#define DESCRIPTION_NAME(e) ((e)->Name[DESCRIPTION_INDEX].TextString) -#define NAMEONPCB_NAME(e) ((e)->Name[NAMEONPCB_INDEX].TextString) -#define VALUE_NAME(e) ((e)->Name[VALUE_INDEX].TextString) -#define ELEMENT_TEXT(p,e) ((e)->Name[NAME_INDEX()]) -#define DESCRIPTION_TEXT(e) ((e)->Name[DESCRIPTION_INDEX]) -#define NAMEONPCB_TEXT(e) ((e)->Name[NAMEONPCB_INDEX]) -#define VALUE_TEXT(e) ((e)->Name[VALUE_INDEX]) - -/* --------------------------------------------------------------------------- - * Determines if text is actually visible - */ -#define TEXT_IS_VISIBLE(b, l, t) \ - ((l)->On) - -/* --------------------------------------------------------------------------- - * Determines if object is on front or back - */ -#define FRONT(o) \ - ((TEST_FLAG(PCB_FLAG_ONSOLDER, (o)) != 0) == SWAP_IDENT) - -/* --------------------------------------------------------------------------- - * Determines if an object is on the given side. side is either SOLDER_LAYER - * or COMPONENT_LAYER. - */ -#define ON_SIDE(element, side) \ - (TEST_FLAG (PCB_FLAG_ONSOLDER, element) == (side == SOLDER_LAYER)) - -/* --------------------------------------------------------------------------- - * some loop shortcuts - * - * a pointer is created from index addressing because the base pointer - * may change when new memory is allocated; - * - * all data is relative to an objects name 'top' which can be either - * PCB or PasteBuffer - */ -#define END_LOOP }} while (0) - -#define VIA_LOOP(top) do { \ - PinType *via; \ - gdl_iterator_t __it__; \ - pinlist_foreach(&(top)->Via, &__it__, via) { - -#define DRILL_LOOP(top) do { \ - pcb_cardinal_t n; \ - DrillTypePtr drill; \ - for (n = 0; (top)->DrillN > 0 && n < (top)->DrillN; n++) \ - { \ - drill = &(top)->Drill[n] - -#define NETLIST_LOOP(top) do { \ - pcb_cardinal_t n; \ - NetListTypePtr netlist; \ - for (n = (top)->NetListN-1; n != -1; n--) \ - { \ - netlist = &(top)->NetList[n] - -#define NET_LOOP(top) do { \ - pcb_cardinal_t n; \ - NetTypePtr net; \ - for (n = (top)->NetN-1; n != -1; n--) \ - { \ - net = &(top)->Net[n] - -#define CONNECTION_LOOP(net) do { \ - pcb_cardinal_t n; \ - ConnectionTypePtr connection; \ - for (n = (net)->ConnectionN-1; n != -1; n--) \ - { \ - connection = & (net)->Connection[n] - -#define ELEMENT_LOOP(top) do { \ - ElementType *element; \ - gdl_iterator_t __it__; \ - pinlist_foreach(&(top)->Element, &__it__, element) { - -#define RAT_LOOP(top) do { \ - RatType *line; \ - gdl_iterator_t __it__; \ - ratlist_foreach(&(top)->Rat, &__it__, line) { - -#define ELEMENTTEXT_LOOP(element) do { \ - pcb_cardinal_t n; \ - TextTypePtr text; \ - for (n = MAX_ELEMENTNAMES-1; n != -1; n--) \ - { \ - text = &(element)->Name[n] - -#define ELEMENTNAME_LOOP(element) do { \ - pcb_cardinal_t n; \ - char *textstring; \ - for (n = MAX_ELEMENTNAMES-1; n != -1; n--) \ - { \ - textstring = (element)->Name[n].TextString - -#define PIN_LOOP(element) do { \ - PinType *pin; \ - gdl_iterator_t __it__; \ - pinlist_foreach(&(element)->Pin, &__it__, pin) { - -#define PAD_LOOP(element) do { \ - PadType *pad; \ - gdl_iterator_t __it__; \ - padlist_foreach(&(element)->Pad, &__it__, pad) { - -#define ARC_LOOP(element) do { \ - ArcType *arc; \ - gdl_iterator_t __it__; \ - linelist_foreach(&(element)->Arc, &__it__, arc) { - -#define ELEMENTLINE_LOOP(element) do { \ - LineType *line; \ - gdl_iterator_t __it__; \ - linelist_foreach(&(element)->Line, &__it__, line) { - -#define ELEMENTARC_LOOP(element) do { \ - ArcType *arc; \ - gdl_iterator_t __it__; \ - linelist_foreach(&(element)->Arc, &__it__, arc) { - -#define LINE_LOOP(layer) do { \ - LineType *line; \ - gdl_iterator_t __it__; \ - linelist_foreach(&(layer)->Line, &__it__, line) { - -#define TEXT_LOOP(layer) do { \ - TextType *text; \ - gdl_iterator_t __it__; \ - linelist_foreach(&(layer)->Text, &__it__, text) { - -#define POLYGON_LOOP(layer) do { \ - PolygonType *polygon; \ - gdl_iterator_t __it__; \ - linelist_foreach(&(layer)->Polygon, &__it__, polygon) { - -#define POLYGONPOINT_LOOP(polygon) do { \ - pcb_cardinal_t n; \ - PointTypePtr point; \ - for (n = (polygon)->PointN-1; n != -1; n--) \ - { \ - point = &(polygon)->Points[n] - -#define ENDALL_LOOP }} while (0); }} while(0) - -#define ALLPIN_LOOP(top) \ - ELEMENT_LOOP(top); \ - PIN_LOOP(element)\ - -#define ALLPAD_LOOP(top) \ - ELEMENT_LOOP(top); \ - PAD_LOOP(element) - -#define ALLLINE_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer + 2; l++, layer++) \ - { \ - LINE_LOOP(layer) - -#define ALLARC_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l =0; l < max_copper_layer + 2; l++, layer++) \ - { \ - ARC_LOOP(layer) - -#define ALLPOLYGON_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer + 2; l++, layer++) \ - { \ - POLYGON_LOOP(layer) - -#define COPPERLINE_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer; l++, layer++) \ - { \ - LINE_LOOP(layer) - -#define COPPERARC_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l =0; l < max_copper_layer; l++, layer++) \ - { \ - ARC_LOOP(layer) - -#define COPPERPOLYGON_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer; l++, layer++) \ - { \ - POLYGON_LOOP(layer) - -#define SILKLINE_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - layer += max_copper_layer; \ - for (l = 0; l < 2; l++, layer++) \ - { \ - LINE_LOOP(layer) - -#define SILKARC_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - layer += max_copper_layer; \ - for (l = 0; l < 2; l++, layer++) \ - { \ - ARC_LOOP(layer) - -#define SILKPOLYGON_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - layer += max_copper_layer; \ - for (l = 0; l < 2; l++, layer++) \ - { \ - POLYGON_LOOP(layer) - -#define ALLTEXT_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer + 2; l++, layer++) \ - { \ - TEXT_LOOP(layer) - -#define VISIBLELINE_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer + 2; l++, layer++) \ - { \ - if (layer->On) \ - LINE_LOOP(layer) - -#define VISIBLEARC_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer + 2; l++, layer++) \ - { \ - if (layer->On) \ - ARC_LOOP(layer) - -#define VISIBLETEXT_LOOP(board) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (board)->Data->Layer; \ - for (l = 0; l < max_copper_layer + 2; l++, layer++) \ - { \ - TEXT_LOOP(layer); \ - if (TEXT_IS_VISIBLE((board), layer, text)) - -#define VISIBLEPOLYGON_LOOP(top) do { \ - pcb_cardinal_t l; \ - LayerTypePtr layer = (top)->Layer; \ - for (l = 0; l < max_copper_layer + 2; l++, layer++) \ - { \ - if (layer->On) \ - POLYGON_LOOP(layer) - -#define POINTER_LOOP(top) do { \ - pcb_cardinal_t n; \ - void **ptr; \ - for (n = (top)->PtrN-1; n != -1; n--) \ - { \ - ptr = &(top)->Ptr[n] - -#define MENU_LOOP(top) do { \ - pcb_cardinal_t l; \ - LibraryMenuTypePtr menu; \ - for (l = (top)->MenuN-1; l != -1; l--) \ - { \ - menu = &(top)->Menu[l] - -#define ENTRY_LOOP(top) do { \ - pcb_cardinal_t n; \ - LibraryEntryTypePtr entry; \ - for (n = (top)->EntryN-1; n != -1; n--) \ - { \ - entry = &(top)->Entry[n] - -#define GROUP_LOOP(data, group) do { \ - pcb_cardinal_t entry; \ - for (entry = 0; entry < ((PCBTypePtr)(data->pcb))->LayerGroups.Number[(group)]; entry++) \ - { \ - LayerTypePtr layer; \ - pcb_cardinal_t number; \ - number = ((PCBTypePtr)(data->pcb))->LayerGroups.Entries[(group)][entry]; \ - if (number >= max_copper_layer) \ - continue; \ - layer = &data->Layer[number]; - -#define LAYER_LOOP(data, ml) do { \ - pcb_cardinal_t n; \ - for (n = 0; n < ml; n++) \ - { \ - LayerTypePtr layer = (&data->Layer[(n)]); - - -#define LAYER_IS_EMPTY(layer) LAYER_IS_EMPTY_((layer)) -#define LAYER_IS_EMPTY_(layer) \ - ((linelist_length(&layer->Line) == 0) && (arclist_length(&layer->Arc) == 0) && (polylist_length(&layer->Polygon) == 0) && (textlist_length(&layer->Text) == 0)) -#endif Index: 1.1.4/src/hid_helper.h =================================================================== --- 1.1.4/src/hid_helper.h (revision 10776) +++ 1.1.4/src/hid_helper.h (nonexistent) @@ -1,19 +0,0 @@ -#ifndef PCB_HID_HELPER_H -#define PCB_HID_HELPER_H - -enum File_Name_Style { - /* Files for copper layers are named top, groupN, bottom. */ - FNS_fixed, - /* Groups with multiple layers are named as above, else the single - layer name is used. */ - FNS_single, - /* The name of the first layer in each group is used. */ - FNS_first -}; - -/* Returns a filename base that can be used to output the layer. */ -const char *layer_type_to_file_name(int idx, int style); - -void derive_default_filename(const char *pcbfile, HID_Attribute * filename_attrib, const char *suffix, char **memory); - -#endif Index: 1.1.4/src/find_lookup.c =================================================================== --- 1.1.4/src/find_lookup.c (revision 10776) +++ 1.1.4/src/find_lookup.c (nonexistent) @@ -1,1425 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - -static inline r_dir_t r_search_pt(rtree_t * rtree, const PointType * pt, - int radius, - r_dir_t (*region_in_search) (const BoxType * region, void *cl), - r_dir_t (*rectangle_in_region) (const BoxType * box, void *cl), void *closure, - int *num_found) -{ - BoxType box; - - box.X1 = pt->X - radius; - box.X2 = pt->X + radius; - box.Y1 = pt->Y - radius; - box.Y2 = pt->Y + radius; - - return r_search(rtree, &box, region_in_search, rectangle_in_region, closure, num_found); -} - - -/* Connection lookup functions */ - -static pcb_bool ADD_PV_TO_LIST(PinTypePtr Pin, int from_type, void *from_ptr, found_conn_type_t type) -{ - if (User) - AddObjectToFlagUndoList(Pin->Element ? PCB_TYPE_PIN : PCB_TYPE_VIA, Pin->Element ? Pin->Element : Pin, Pin, Pin); - SET_FLAG(TheFlag, Pin); - make_callback(PCB_TYPE_PIN, Pin, from_type, from_ptr, type); - PVLIST_ENTRY(PVList.Number) = Pin; - PVList.Number++; -#ifdef DEBUG - if (PVList.Number > PVList.Size) - printf("ADD_PV_TO_LIST overflow! num=%d size=%d\n", PVList.Number, PVList.Size); -#endif - if (drc && !TEST_FLAG(PCB_FLAG_SELECTED, Pin)) - return (SetThing(PCB_TYPE_PIN, Pin->Element, Pin, Pin)); - return pcb_false; -} - -static pcb_bool ADD_PAD_TO_LIST(pcb_cardinal_t L, PadTypePtr Pad, int from_type, void *from_ptr, found_conn_type_t type) -{ -/*fprintf(stderr, "ADD_PAD_TO_LIST cardinal %d %p %d\n", L, Pad, from_type);*/ - if (User) - AddObjectToFlagUndoList(PCB_TYPE_PAD, Pad->Element, Pad, Pad); - SET_FLAG(TheFlag, Pad); - make_callback(PCB_TYPE_PAD, Pad, from_type, from_ptr, type); - PADLIST_ENTRY((L), PadList[(L)].Number) = Pad; - PadList[(L)].Number++; -#ifdef DEBUG - if (PadList[(L)].Number > PadList[(L)].Size) - printf("ADD_PAD_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, PadList[(L)].Number, PadList[(L)].Size); -#endif - if (drc && !TEST_FLAG(PCB_FLAG_SELECTED, Pad)) - return (SetThing(PCB_TYPE_PAD, Pad->Element, Pad, Pad)); - return pcb_false; -} - -static pcb_bool ADD_LINE_TO_LIST(pcb_cardinal_t L, LineTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) -{ - if (User) - AddObjectToFlagUndoList(PCB_TYPE_LINE, LAYER_PTR(L), (Ptr), (Ptr)); - SET_FLAG(TheFlag, (Ptr)); - make_callback(PCB_TYPE_LINE, Ptr, from_type, from_ptr, type); - LINELIST_ENTRY((L), LineList[(L)].Number) = (Ptr); - LineList[(L)].Number++; -#ifdef DEBUG - if (LineList[(L)].Number > LineList[(L)].Size) - printf("ADD_LINE_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, LineList[(L)].Number, LineList[(L)].Size); -#endif - if (drc && !TEST_FLAG(PCB_FLAG_SELECTED, (Ptr))) - return (SetThing(PCB_TYPE_LINE, LAYER_PTR(L), (Ptr), (Ptr))); - return pcb_false; -} - -static pcb_bool ADD_ARC_TO_LIST(pcb_cardinal_t L, ArcTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) -{ - if (User) - AddObjectToFlagUndoList(PCB_TYPE_ARC, LAYER_PTR(L), (Ptr), (Ptr)); - SET_FLAG(TheFlag, (Ptr)); - make_callback(PCB_TYPE_ARC, Ptr, from_type, from_ptr, type); - ARCLIST_ENTRY((L), ArcList[(L)].Number) = (Ptr); - ArcList[(L)].Number++; -#ifdef DEBUG - if (ArcList[(L)].Number > ArcList[(L)].Size) - printf("ADD_ARC_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, ArcList[(L)].Number, ArcList[(L)].Size); -#endif - if (drc && !TEST_FLAG(PCB_FLAG_SELECTED, (Ptr))) - return (SetThing(PCB_TYPE_ARC, LAYER_PTR(L), (Ptr), (Ptr))); - return pcb_false; -} - -static pcb_bool ADD_RAT_TO_LIST(RatTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) -{ - if (User) - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, (Ptr), (Ptr), (Ptr)); - SET_FLAG(TheFlag, (Ptr)); - make_callback(PCB_TYPE_RATLINE, Ptr, from_type, from_ptr, type); - RATLIST_ENTRY(RatList.Number) = (Ptr); - RatList.Number++; -#ifdef DEBUG - if (RatList.Number > RatList.Size) - printf("ADD_RAT_TO_LIST overflow! num=%d size=%d\n", RatList.Number, RatList.Size); -#endif - if (drc && !TEST_FLAG(PCB_FLAG_SELECTED, (Ptr))) - return (SetThing(PCB_TYPE_RATLINE, (Ptr), (Ptr), (Ptr))); - return pcb_false; -} - -static pcb_bool ADD_POLYGON_TO_LIST(pcb_cardinal_t L, PolygonTypePtr Ptr, int from_type, void *from_ptr, found_conn_type_t type) -{ - if (User) - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, LAYER_PTR(L), (Ptr), (Ptr)); - SET_FLAG(TheFlag, (Ptr)); - make_callback(PCB_TYPE_POLYGON, Ptr, from_type, from_ptr, type); - POLYGONLIST_ENTRY((L), PolygonList[(L)].Number) = (Ptr); - PolygonList[(L)].Number++; -#ifdef DEBUG - if (PolygonList[(L)].Number > PolygonList[(L)].Size) - printf("ADD_ARC_TO_LIST overflow! lay=%d, num=%d size=%d\n", L, PolygonList[(L)].Number, PolygonList[(L)].Size); -#endif - if (drc && !TEST_FLAG(PCB_FLAG_SELECTED, (Ptr))) - return (SetThing(PCB_TYPE_POLYGON, LAYER_PTR(L), (Ptr), (Ptr))); - return pcb_false; -} - -pcb_bool SetThing(int type, void *ptr1, void *ptr2, void *ptr3) -{ - thing_ptr1 = ptr1; - thing_ptr2 = ptr2; - thing_ptr3 = ptr3; - thing_type = type; - if (type == PCB_TYPE_PIN && ptr1 == NULL) { - thing_ptr1 = ptr3; - thing_type = PCB_TYPE_VIA; - } - return pcb_true; -} - -/* --------------------------------------------------------------------------- - * releases all allocated memory - */ -void FreeLayoutLookupMemory(void) -{ - pcb_cardinal_t i; - - for (i = 0; i < max_copper_layer; i++) { - free(LineList[i].Data); - LineList[i].Data = NULL; - free(ArcList[i].Data); - ArcList[i].Data = NULL; - free(PolygonList[i].Data); - PolygonList[i].Data = NULL; - } - free(PVList.Data); - PVList.Data = NULL; - free(RatList.Data); - RatList.Data = NULL; -} - -void FreeComponentLookupMemory(void) -{ -/*fprintf(stderr, "PadList free both\n");*/ - free(PadList[0].Data); - PadList[0].Data = NULL; - free(PadList[1].Data); - PadList[1].Data = NULL; -} - -/* --------------------------------------------------------------------------- - * allocates memory for component related stacks ... - * initializes index and sorts it by X1 and X2 - */ -void InitComponentLookup(void) -{ - pcb_cardinal_t i; - - /* initialize pad data; start by counting the total number - * on each of the two possible layers - */ - NumberOfPads[COMPONENT_LAYER] = NumberOfPads[SOLDER_LAYER] = 0; - ALLPAD_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_ONSOLDER, pad)) - NumberOfPads[SOLDER_LAYER]++; - else - NumberOfPads[COMPONENT_LAYER]++; - } - ENDALL_LOOP; - for (i = 0; i < 2; i++) { -/*fprintf(stderr, "PadList alloc %d: %d\n", i, NumberOfPads[i]);*/ - - /* allocate memory for working list */ - PadList[i].Data = (void **) calloc(NumberOfPads[i], sizeof(PadTypePtr)); - - /* clear some struct members */ - PadList[i].Location = 0; - PadList[i].DrawLocation = 0; - PadList[i].Number = 0; - PadList[i].Size = NumberOfPads[i]; - } -} - -/* --------------------------------------------------------------------------- - * allocates memory for component related stacks ... - * initializes index and sorts it by X1 and X2 - */ -void InitLayoutLookup(void) -{ - pcb_cardinal_t i; - - /* initialize line arc and polygon data */ - for (i = 0; i < max_copper_layer; i++) { - LayerTypePtr layer = LAYER_PTR(i); - - if (linelist_length(&layer->Line)) { - LineList[i].Size = linelist_length(&layer->Line); - LineList[i].Data = (void **) calloc(LineList[i].Size, sizeof(LineTypePtr)); - } - if (arclist_length(&layer->Arc)) { - ArcList[i].Size = arclist_length(&layer->Arc); - ArcList[i].Data = (void **) calloc(ArcList[i].Size, sizeof(ArcTypePtr)); - } - if (polylist_length(&layer->Polygon)) { - PolygonList[i].Size = polylist_length(&layer->Polygon); - PolygonList[i].Data = (void **) calloc(PolygonList[i].Size, sizeof(PolygonTypePtr)); - } - - /* clear some struct members */ - LineList[i].Location = 0; - LineList[i].DrawLocation = 0; - LineList[i].Number = 0; - ArcList[i].Location = 0; - ArcList[i].DrawLocation = 0; - ArcList[i].Number = 0; - PolygonList[i].Location = 0; - PolygonList[i].DrawLocation = 0; - PolygonList[i].Number = 0; - } - - if (PCB->Data->pin_tree) - TotalP = PCB->Data->pin_tree->size; - else - TotalP = 0; - if (PCB->Data->via_tree) - TotalV = PCB->Data->via_tree->size; - else - TotalV = 0; - /* allocate memory for 'new PV to check' list and clear struct */ - PVList.Data = (void **) calloc(TotalP + TotalV, sizeof(PinTypePtr)); - PVList.Size = TotalP + TotalV; - PVList.Location = 0; - PVList.DrawLocation = 0; - PVList.Number = 0; - /* Initialize ratline data */ - RatList.Size = ratlist_length(&PCB->Data->Rat); - RatList.Data = (void **) calloc(RatList.Size, sizeof(RatTypePtr)); - RatList.Location = 0; - RatList.DrawLocation = 0; - RatList.Number = 0; -} - -struct pv_info { - pcb_cardinal_t layer; - PinType pv; - jmp_buf env; -}; - -static r_dir_t LOCtoPVline_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct pv_info *i = (struct pv_info *) cl; - - if (!TEST_FLAG(TheFlag, line) && PinLineIntersect(&i->pv, line) && !TEST_FLAG(PCB_FLAG_HOLE, &i->pv)) { - if (ADD_LINE_TO_LIST(i->layer, line, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPVarc_callback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct pv_info *i = (struct pv_info *) cl; - - if (!TEST_FLAG(TheFlag, arc) && IS_PV_ON_ARC(&i->pv, arc) && !TEST_FLAG(PCB_FLAG_HOLE, &i->pv)) { - if (ADD_ARC_TO_LIST(i->layer, arc, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPVpad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct pv_info *i = (struct pv_info *) cl; - - if (!TEST_FLAG(TheFlag, pad) && IS_PV_ON_PAD(&i->pv, pad) && - !TEST_FLAG(PCB_FLAG_HOLE, &i->pv) && - ADD_PAD_TO_LIST(TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER, pad, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) - longjmp(i->env, 1); - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPVrat_callback(const BoxType * b, void *cl) -{ - RatTypePtr rat = (RatTypePtr) b; - struct pv_info *i = (struct pv_info *) cl; - - if (!TEST_FLAG(TheFlag, rat) && IS_PV_ON_RAT(&i->pv, rat) && ADD_RAT_TO_LIST(rat, PCB_TYPE_PIN, &i->pv, FCT_RAT)) - longjmp(i->env, 1); - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPVpoly_callback(const BoxType * b, void *cl) -{ - PolygonTypePtr polygon = (PolygonTypePtr) b; - struct pv_info *i = (struct pv_info *) cl; - - /* if the pin doesn't have a therm and polygon is clearing - * then it can't touch due to clearance, so skip the expensive - * test. If it does have a therm, you still need to test - * because it might not be inside the polygon, or it could - * be on an edge such that it doesn't actually touch. - */ - if (!TEST_FLAG(TheFlag, polygon) && !TEST_FLAG(PCB_FLAG_HOLE, &i->pv) && - (TEST_THERM(i->layer, &i->pv) || !TEST_FLAG(PCB_FLAG_CLEARPOLY, polygon) - || !i->pv.Clearance)) { - double wide = MAX(0.5 * i->pv.Thickness + Bloat, 0); - if (TEST_FLAG(PCB_FLAG_SQUARE, &i->pv)) { - Coord x1 = i->pv.X - (i->pv.Thickness + 1 + Bloat) / 2; - Coord x2 = i->pv.X + (i->pv.Thickness + 1 + Bloat) / 2; - Coord y1 = i->pv.Y - (i->pv.Thickness + 1 + Bloat) / 2; - Coord y2 = i->pv.Y + (i->pv.Thickness + 1 + Bloat) / 2; - if (IsRectangleInPolygon(x1, y1, x2, y2, polygon) - && ADD_POLYGON_TO_LIST(i->layer, polygon, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) - longjmp(i->env, 1); - } - else if (TEST_FLAG(PCB_FLAG_OCTAGON, &i->pv)) { - POLYAREA *oct = OctagonPoly(i->pv.X, i->pv.Y, i->pv.Thickness / 2, GET_SQUARE(&i->pv)); - if (isects(oct, polygon, pcb_true) - && ADD_POLYGON_TO_LIST(i->layer, polygon, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) - longjmp(i->env, 1); - } - else if (IsPointInPolygon(i->pv.X, i->pv.Y, wide, polygon) - && ADD_POLYGON_TO_LIST(i->layer, polygon, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * checks if a PV is connected to LOs, if it is, the LO is added to - * the appropriate list and the 'used' flag is set - */ -static pcb_bool LookupLOConnectionsToPVList(pcb_bool AndRats) -{ - pcb_cardinal_t layer; - struct pv_info info; - - /* loop over all PVs currently on list */ - while (PVList.Location < PVList.Number) { - /* get pointer to data */ - info.pv = *(PVLIST_ENTRY(PVList.Location)); - EXPAND_BOUNDS(&info.pv); - - /* check pads */ - if (setjmp(info.env) == 0) - r_search(PCB->Data->pad_tree, (BoxType *) & info.pv, NULL, LOCtoPVpad_callback, &info, NULL); - else - return pcb_true; - - /* now all lines, arcs and polygons of the several layers */ - for (layer = 0; layer < max_copper_layer; layer++) { - if (LAYER_PTR(layer)->no_drc) - continue; - info.layer = layer; - /* add touching lines */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.pv, NULL, LOCtoPVline_callback, &info, NULL); - else - return pcb_true; - /* add touching arcs */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.pv, NULL, LOCtoPVarc_callback, &info, NULL); - else - return pcb_true; - /* check all polygons */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->polygon_tree, (BoxType *) & info.pv, NULL, LOCtoPVpoly_callback, &info, NULL); - else - return pcb_true; - } - /* Check for rat-lines that may intersect the PV */ - if (AndRats) { - if (setjmp(info.env) == 0) - r_search(PCB->Data->rat_tree, (BoxType *) & info.pv, NULL, LOCtoPVrat_callback, &info, NULL); - else - return pcb_true; - } - PVList.Location++; - } - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * find all connections between LO at the current list position and new LOs - */ -static pcb_bool LookupLOConnectionsToLOList(pcb_bool AndRats) -{ - pcb_bool done; - pcb_cardinal_t i, group, layer, ratposition, - lineposition[MAX_LAYER], polyposition[MAX_LAYER], arcposition[MAX_LAYER], padposition[2]; - - /* copy the current LO list positions; the original data is changed - * by 'LookupPVConnectionsToLOList()' which has to check the same - * list entries plus the new ones - */ - for (i = 0; i < max_copper_layer; i++) { - lineposition[i] = LineList[i].Location; - polyposition[i] = PolygonList[i].Location; - arcposition[i] = ArcList[i].Location; - } - for (i = 0; i < 2; i++) - padposition[i] = PadList[i].Location; - ratposition = RatList.Location; - - /* loop over all new LOs in the list; recurse until no - * more new connections in the layergroup were found - */ - do { - pcb_cardinal_t *position; - - if (AndRats) { - position = &ratposition; - for (; *position < RatList.Number; (*position)++) { - group = RATLIST_ENTRY(*position)->group1; - if (LookupLOConnectionsToRatEnd(&(RATLIST_ENTRY(*position)->Point1), group)) - return (pcb_true); - group = RATLIST_ENTRY(*position)->group2; - if (LookupLOConnectionsToRatEnd(&(RATLIST_ENTRY(*position)->Point2), group)) - return (pcb_true); - } - } - /* loop over all layergroups */ - for (group = 0; group < max_group; group++) { - pcb_cardinal_t entry; - - for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) { - layer = PCB->LayerGroups.Entries[group][entry]; - - /* be aware that the layer number equal max_copper_layer - * and max_copper_layer+1 have a special meaning for pads - */ - if (layer < max_copper_layer) { - /* try all new lines */ - position = &lineposition[layer]; - for (; *position < LineList[layer].Number; (*position)++) - if (LookupLOConnectionsToLine(LINELIST_ENTRY(layer, *position), group, pcb_true)) - return (pcb_true); - - /* try all new arcs */ - position = &arcposition[layer]; - for (; *position < ArcList[layer].Number; (*position)++) - if (LookupLOConnectionsToArc(ARCLIST_ENTRY(layer, *position), group)) - return (pcb_true); - - /* try all new polygons */ - position = &polyposition[layer]; - for (; *position < PolygonList[layer].Number; (*position)++) - if (LookupLOConnectionsToPolygon(POLYGONLIST_ENTRY(layer, *position), group)) - return (pcb_true); - } - else { - /* try all new pads */ - layer -= max_copper_layer; - if (layer > 1) { - Message(PCB_MSG_DEFAULT, _("bad layer number %d max_copper_layer=%d in find.c\n"), layer, max_copper_layer); - return pcb_false; - } - position = &padposition[layer]; - for (; *position < PadList[layer].Number; (*position)++) - if (LookupLOConnectionsToPad(PADLIST_ENTRY(layer, *position), group)) - return (pcb_true); - } - } - } - - /* check if all lists are done; Later for-loops - * may have changed the prior lists - */ - done = !AndRats || ratposition >= RatList.Number; - for (layer = 0; layer < max_copper_layer + 2; layer++) { - if (layer < max_copper_layer) - done = done && - lineposition[layer] >= LineList[layer].Number - && arcposition[layer] >= ArcList[layer].Number && polyposition[layer] >= PolygonList[layer].Number; - else - done = done && padposition[layer - max_copper_layer] >= PadList[layer - max_copper_layer].Number; - } - } - while (!done); - return (pcb_false); -} - -static r_dir_t pv_pv_callback(const BoxType * b, void *cl) -{ - PinTypePtr pin = (PinTypePtr) b; - struct pv_info *i = (struct pv_info *) cl; - - if (!TEST_FLAG(TheFlag, pin) && PV_TOUCH_PV(&i->pv, pin)) { - if (TEST_FLAG(PCB_FLAG_HOLE, pin) || TEST_FLAG(PCB_FLAG_HOLE, &i->pv)) { - SET_FLAG(PCB_FLAG_WARN, pin); - conf_core.temp.rat_warn = pcb_true; - if (pin->Element) - Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to pin.\n")); - else - Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to via.\n")); - } - else if (ADD_PV_TO_LIST(pin, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches for new PVs that are connected to PVs on the list - */ -static pcb_bool LookupPVConnectionsToPVList(void) -{ - pcb_cardinal_t save_place; - struct pv_info info; - - - /* loop over all PVs on list */ - save_place = PVList.Location; - while (PVList.Location < PVList.Number) { - int ic; - PinType *orig_pin; - /* get pointer to data */ - orig_pin = (PVLIST_ENTRY(PVList.Location)); - info.pv = *orig_pin; - - /* Internal connection: if pins in the same element have the same - internal connection group number, they are connected */ - ic = GET_INTCONN(orig_pin); - if ((info.pv.Element != NULL) && (ic > 0)) { - ElementType *e = info.pv.Element; - PIN_LOOP(e); - { - if ((orig_pin != pin) && (ic == GET_INTCONN(pin))) { - if (!TEST_FLAG(TheFlag, pin)) - ADD_PV_TO_LIST(pin, PCB_TYPE_PIN, orig_pin, FCT_INTERNAL); - } - } - END_LOOP; - } - - - EXPAND_BOUNDS(&info.pv); - if (setjmp(info.env) == 0) - r_search(PCB->Data->via_tree, (BoxType *) & info.pv, NULL, pv_pv_callback, &info, NULL); - else - return pcb_true; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pin_tree, (BoxType *) & info.pv, NULL, pv_pv_callback, &info, NULL); - else - return pcb_true; - PVList.Location++; - } - PVList.Location = save_place; - return (pcb_false); -} - -struct lo_info { - pcb_cardinal_t layer; - LineType line; - PadType pad; - ArcType arc; - PolygonType polygon; - RatType rat; - jmp_buf env; -}; - -static r_dir_t pv_line_callback(const BoxType * b, void *cl) -{ - PinTypePtr pv = (PinTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pv) && PinLineIntersect(pv, &i->line)) { - if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { - SET_FLAG(PCB_FLAG_WARN, pv); - conf_core.temp.rat_warn = pcb_true; - Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to line.\n")); - } - else if (ADD_PV_TO_LIST(pv, PCB_TYPE_LINE, &i->line, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t pv_pad_callback(const BoxType * b, void *cl) -{ - PinTypePtr pv = (PinTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pv) && IS_PV_ON_PAD(pv, &i->pad)) { - if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { - SET_FLAG(PCB_FLAG_WARN, pv); - conf_core.temp.rat_warn = pcb_true; - Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to pad.\n")); - } - else if (ADD_PV_TO_LIST(pv, PCB_TYPE_PAD, &i->pad, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t pv_arc_callback(const BoxType * b, void *cl) -{ - PinTypePtr pv = (PinTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pv) && IS_PV_ON_ARC(pv, &i->arc)) { - if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { - SET_FLAG(PCB_FLAG_WARN, pv); - conf_core.temp.rat_warn = pcb_true; - Message(PCB_MSG_DEFAULT, _("WARNING: Hole touches arc.\n")); - } - else if (ADD_PV_TO_LIST(pv, PCB_TYPE_ARC, &i->arc, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t pv_poly_callback(const BoxType * b, void *cl) -{ - PinTypePtr pv = (PinTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - /* note that holes in polygons are ok, so they don't generate warnings. */ - if (!TEST_FLAG(TheFlag, pv) && !TEST_FLAG(PCB_FLAG_HOLE, pv) && - (TEST_THERM(i->layer, pv) || !TEST_FLAG(PCB_FLAG_CLEARPOLY, &i->polygon) || !pv->Clearance)) { - if (TEST_FLAG(PCB_FLAG_SQUARE, pv)) { - Coord x1, x2, y1, y2; - x1 = pv->X - (PIN_SIZE(pv) + 1 + Bloat) / 2; - x2 = pv->X + (PIN_SIZE(pv) + 1 + Bloat) / 2; - y1 = pv->Y - (PIN_SIZE(pv) + 1 + Bloat) / 2; - y2 = pv->Y + (PIN_SIZE(pv) + 1 + Bloat) / 2; - if (IsRectangleInPolygon(x1, y1, x2, y2, &i->polygon) - && ADD_PV_TO_LIST(pv, PCB_TYPE_POLYGON, &i->polygon, FCT_COPPER)) - longjmp(i->env, 1); - } - else if (TEST_FLAG(PCB_FLAG_OCTAGON, pv)) { - POLYAREA *oct = OctagonPoly(pv->X, pv->Y, PIN_SIZE(pv) / 2, GET_SQUARE(pv)); - if (isects(oct, &i->polygon, pcb_true) && ADD_PV_TO_LIST(pv, PCB_TYPE_POLYGON, &i->polygon, FCT_COPPER)) - longjmp(i->env, 1); - } - else { - if (IsPointInPolygon(pv->X, pv->Y, PIN_SIZE(pv) * 0.5 + Bloat, &i->polygon) - && ADD_PV_TO_LIST(pv, PCB_TYPE_POLYGON, &i->polygon, FCT_COPPER)) - longjmp(i->env, 1); - } - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t pv_rat_callback(const BoxType * b, void *cl) -{ - PinTypePtr pv = (PinTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - /* rats can't cause DRC so there is no early exit */ - if (!TEST_FLAG(TheFlag, pv) && IS_PV_ON_RAT(pv, &i->rat)) - ADD_PV_TO_LIST(pv, PCB_TYPE_RATLINE, &i->rat, FCT_RAT); - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches for new PVs that are connected to NEW LOs on the list - * This routine updates the position counter of the lists too. - */ -static pcb_bool LookupPVConnectionsToLOList(pcb_bool AndRats) -{ - pcb_cardinal_t layer; - struct lo_info info; - - /* loop over all layers */ - for (layer = 0; layer < max_copper_layer; layer++) { - if (LAYER_PTR(layer)->no_drc) - continue; - /* do nothing if there are no PV's */ - if (TotalP + TotalV == 0) { - LineList[layer].Location = LineList[layer].Number; - ArcList[layer].Location = ArcList[layer].Number; - PolygonList[layer].Location = PolygonList[layer].Number; - continue; - } - - /* check all lines */ - while (LineList[layer].Location < LineList[layer].Number) { - info.line = *(LINELIST_ENTRY(layer, LineList[layer].Location)); - EXPAND_BOUNDS(&info.line); - if (setjmp(info.env) == 0) - r_search(PCB->Data->via_tree, (BoxType *) & info.line, NULL, pv_line_callback, &info, NULL); - else - return pcb_true; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pin_tree, (BoxType *) & info.line, NULL, pv_line_callback, &info, NULL); - else - return pcb_true; - LineList[layer].Location++; - } - - /* check all arcs */ - while (ArcList[layer].Location < ArcList[layer].Number) { - info.arc = *(ARCLIST_ENTRY(layer, ArcList[layer].Location)); - EXPAND_BOUNDS(&info.arc); - if (setjmp(info.env) == 0) - r_search(PCB->Data->via_tree, (BoxType *) & info.arc, NULL, pv_arc_callback, &info, NULL); - else - return pcb_true; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pin_tree, (BoxType *) & info.arc, NULL, pv_arc_callback, &info, NULL); - else - return pcb_true; - ArcList[layer].Location++; - } - - /* now all polygons */ - info.layer = layer; - while (PolygonList[layer].Location < PolygonList[layer].Number) { - info.polygon = *(POLYGONLIST_ENTRY(layer, PolygonList[layer].Location)); - EXPAND_BOUNDS(&info.polygon); - if (setjmp(info.env) == 0) - r_search(PCB->Data->via_tree, (BoxType *) & info.polygon, NULL, pv_poly_callback, &info, NULL); - else - return pcb_true; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pin_tree, (BoxType *) & info.polygon, NULL, pv_poly_callback, &info, NULL); - else - return pcb_true; - PolygonList[layer].Location++; - } - } - - /* loop over all pad-layers */ - for (layer = 0; layer < 2; layer++) { - /* do nothing if there are no PV's */ - if (TotalP + TotalV == 0) { - PadList[layer].Location = PadList[layer].Number; - continue; - } - - /* check all pads; for a detailed description see - * the handling of lines in this subroutine - */ - while (PadList[layer].Location < PadList[layer].Number) { - info.pad = *(PADLIST_ENTRY(layer, PadList[layer].Location)); - EXPAND_BOUNDS(&info.pad); - if (setjmp(info.env) == 0) - r_search(PCB->Data->via_tree, (BoxType *) & info.pad, NULL, pv_pad_callback, &info, NULL); - else - return pcb_true; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pin_tree, (BoxType *) & info.pad, NULL, pv_pad_callback, &info, NULL); - else - return pcb_true; - PadList[layer].Location++; - } - } - - /* do nothing if there are no PV's */ - if (TotalP + TotalV == 0) - RatList.Location = RatList.Number; - - /* check all rat-lines */ - if (AndRats) { - while (RatList.Location < RatList.Number) { - info.rat = *(RATLIST_ENTRY(RatList.Location)); - r_search_pt(PCB->Data->via_tree, &info.rat.Point1, 1, NULL, pv_rat_callback, &info, NULL); - r_search_pt(PCB->Data->via_tree, &info.rat.Point2, 1, NULL, pv_rat_callback, &info, NULL); - r_search_pt(PCB->Data->pin_tree, &info.rat.Point1, 1, NULL, pv_rat_callback, &info, NULL); - r_search_pt(PCB->Data->pin_tree, &info.rat.Point2, 1, NULL, pv_rat_callback, &info, NULL); - - RatList.Location++; - } - } - return (pcb_false); -} - -r_dir_t pv_touch_callback(const BoxType * b, void *cl) -{ - PinTypePtr pin = (PinTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pin) && PinLineIntersect(pin, &i->line)) - longjmp(i->env, 1); - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoArcLine_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, line) && LineArcIntersect(line, &i->arc)) { - if (ADD_LINE_TO_LIST(i->layer, line, PCB_TYPE_ARC, &i->arc, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoArcArc_callback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!arc->Thickness) - return 0; - if (!TEST_FLAG(TheFlag, arc) && ArcArcIntersect(&i->arc, arc)) { - if (ADD_ARC_TO_LIST(i->layer, arc, PCB_TYPE_ARC, &i->arc, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoArcPad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER) - && ArcPadIntersect(&i->arc, pad) && ADD_PAD_TO_LIST(i->layer, pad, PCB_TYPE_ARC, &i->arc, FCT_COPPER)) - longjmp(i->env, 1); - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches all LOs that are connected to the given arc on the given - * layergroup. All found connections are added to the list - * - * the notation that is used is: - * Xij means Xj at arc i - */ -static pcb_bool LookupLOConnectionsToArc(ArcTypePtr Arc, pcb_cardinal_t LayerGroup) -{ - pcb_cardinal_t entry; - struct lo_info info; - - info.arc = *Arc; - EXPAND_BOUNDS(&info.arc); - /* loop over all layers of the group */ - for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { - pcb_cardinal_t layer; - - layer = PCB->LayerGroups.Entries[LayerGroup][entry]; - - /* handle normal layers */ - if (layer < max_copper_layer) { - PolygonType *polygon; - gdl_iterator_t it; - - info.layer = layer; - /* add arcs */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->line_tree, &info.arc.BoundingBox, NULL, LOCtoArcLine_callback, &info, NULL); - else - return pcb_true; - - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->arc_tree, &info.arc.BoundingBox, NULL, LOCtoArcArc_callback, &info, NULL); - else - return pcb_true; - - /* now check all polygons */ - polylist_foreach(&(PCB->Data->Layer[layer].Polygon), &it, polygon) { - if (!TEST_FLAG(TheFlag, polygon) && IsArcInPolygon(Arc, polygon) - && ADD_POLYGON_TO_LIST(layer, polygon, PCB_TYPE_ARC, Arc, FCT_COPPER)) - return pcb_true; - } - } - else { - info.layer = layer - max_copper_layer; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pad_tree, &info.arc.BoundingBox, NULL, LOCtoArcPad_callback, &info, NULL); - else - return pcb_true; - } - } - return (pcb_false); -} - -static r_dir_t LOCtoLineLine_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, line) && LineLineIntersect(&i->line, line)) { - if (ADD_LINE_TO_LIST(i->layer, line, PCB_TYPE_LINE, &i->line, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoLineArc_callback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!arc->Thickness) - return 0; - if (!TEST_FLAG(TheFlag, arc) && LineArcIntersect(&i->line, arc)) { - if (ADD_ARC_TO_LIST(i->layer, arc, PCB_TYPE_LINE, &i->line, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoLineRat_callback(const BoxType * b, void *cl) -{ - RatTypePtr rat = (RatTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, rat)) { - if ((rat->group1 == i->layer) - && IsRatPointOnLineEnd(&rat->Point1, &i->line)) { - if (ADD_RAT_TO_LIST(rat, PCB_TYPE_LINE, &i->line, FCT_RAT)) - longjmp(i->env, 1); - } - else if ((rat->group2 == i->layer) - && IsRatPointOnLineEnd(&rat->Point2, &i->line)) { - if (ADD_RAT_TO_LIST(rat, PCB_TYPE_LINE, &i->line, FCT_RAT)) - longjmp(i->env, 1); - } - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoLinePad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER) - && LinePadIntersect(&i->line, pad) && ADD_PAD_TO_LIST(i->layer, pad, PCB_TYPE_LINE, &i->line, FCT_COPPER)) - longjmp(i->env, 1); - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches all LOs that are connected to the given line on the given - * layergroup. All found connections are added to the list - * - * the notation that is used is: - * Xij means Xj at line i - */ -static pcb_bool LookupLOConnectionsToLine(LineTypePtr Line, pcb_cardinal_t LayerGroup, pcb_bool PolysTo) -{ - pcb_cardinal_t entry; - struct lo_info info; - - info.line = *Line; - info.layer = LayerGroup; - EXPAND_BOUNDS(&info.line) - /* add the new rat lines */ - if (setjmp(info.env) == 0) - r_search(PCB->Data->rat_tree, &info.line.BoundingBox, NULL, LOCtoLineRat_callback, &info, NULL); - else - return pcb_true; - - /* loop over all layers of the group */ - for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { - pcb_cardinal_t layer; - - layer = PCB->LayerGroups.Entries[LayerGroup][entry]; - - /* handle normal layers */ - if (layer < max_copper_layer) { - info.layer = layer; - /* add lines */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.line, NULL, LOCtoLineLine_callback, &info, NULL); - else - return pcb_true; - /* add arcs */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.line, NULL, LOCtoLineArc_callback, &info, NULL); - else - return pcb_true; - /* now check all polygons */ - if (PolysTo) { - gdl_iterator_t it; - PolygonType *polygon; - - polylist_foreach(&(PCB->Data->Layer[layer].Polygon), &it, polygon) { - if (!TEST_FLAG(TheFlag, polygon) && IsLineInPolygon(Line, polygon) - && ADD_POLYGON_TO_LIST(layer, polygon, PCB_TYPE_LINE, Line, FCT_COPPER)) - return pcb_true; - } - } - } - else { - /* handle special 'pad' layers */ - info.layer = layer - max_copper_layer; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pad_tree, &info.line.BoundingBox, NULL, LOCtoLinePad_callback, &info, NULL); - else - return pcb_true; - } - } - return (pcb_false); -} - - -struct rat_info { - pcb_cardinal_t layer; - PointTypePtr Point; - jmp_buf env; -}; - -static r_dir_t LOCtoRat_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct rat_info *i = (struct rat_info *) cl; - - if (!TEST_FLAG(TheFlag, line) && - ((line->Point1.X == i->Point->X && - line->Point1.Y == i->Point->Y) || (line->Point2.X == i->Point->X && line->Point2.Y == i->Point->Y))) { - if (ADD_LINE_TO_LIST(i->layer, line, PCB_TYPE_RATLINE, &i->Point, FCT_RAT)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t PolygonToRat_callback(const BoxType * b, void *cl) -{ - PolygonTypePtr polygon = (PolygonTypePtr) b; - struct rat_info *i = (struct rat_info *) cl; - - if (!TEST_FLAG(TheFlag, polygon) && polygon->Clipped && - (i->Point->X == polygon->Clipped->contours->head.point[0]) && - (i->Point->Y == polygon->Clipped->contours->head.point[1])) { - if (ADD_POLYGON_TO_LIST(i->layer, polygon, PCB_TYPE_RATLINE, &i->Point, FCT_RAT)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct rat_info *i = (struct rat_info *) cl; - - if (!TEST_FLAG(TheFlag, pad) && i->layer == - (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER) && - ((pad->Point1.X == i->Point->X && pad->Point1.Y == i->Point->Y) || - (pad->Point2.X == i->Point->X && pad->Point2.Y == i->Point->Y) || - ((pad->Point1.X + pad->Point2.X) / 2 == i->Point->X && - (pad->Point1.Y + pad->Point2.Y) / 2 == i->Point->Y)) && - ADD_PAD_TO_LIST(i->layer, pad, PCB_TYPE_RATLINE, &i->Point, FCT_RAT)) - longjmp(i->env, 1); - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches all LOs that are connected to the given rat-line on the given - * layergroup. All found connections are added to the list - * - * the notation that is used is: - * Xij means Xj at line i - */ -static pcb_bool LookupLOConnectionsToRatEnd(PointTypePtr Point, pcb_cardinal_t LayerGroup) -{ - pcb_cardinal_t entry; - struct rat_info info; - - info.Point = Point; - /* loop over all layers of this group */ - for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { - pcb_cardinal_t layer; - - layer = PCB->LayerGroups.Entries[LayerGroup][entry]; - /* handle normal layers - rats don't ever touch - arcs by definition - */ - - if (layer < max_copper_layer) { - info.layer = layer; - if (setjmp(info.env) == 0) - r_search_pt(LAYER_PTR(layer)->line_tree, Point, 1, NULL, LOCtoRat_callback, &info, NULL); - else - return pcb_true; - if (setjmp(info.env) == 0) - r_search_pt(LAYER_PTR(layer)->polygon_tree, Point, 1, NULL, PolygonToRat_callback, &info, NULL); - } - else { - /* handle special 'pad' layers */ - info.layer = layer - max_copper_layer; - if (setjmp(info.env) == 0) - r_search_pt(PCB->Data->pad_tree, Point, 1, NULL, LOCtoPad_callback, &info, NULL); - else - return pcb_true; - } - } - return (pcb_false); -} - -static r_dir_t LOCtoPadLine_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, line) && LinePadIntersect(line, &i->pad)) { - if (ADD_LINE_TO_LIST(i->layer, line, PCB_TYPE_PAD, &i->pad, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPadArc_callback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!arc->Thickness) - return 0; - if (!TEST_FLAG(TheFlag, arc) && ArcPadIntersect(arc, &i->pad)) { - if (ADD_ARC_TO_LIST(i->layer, arc, PCB_TYPE_PAD, &i->pad, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPadPoly_callback(const BoxType * b, void *cl) -{ - PolygonTypePtr polygon = (PolygonTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - - if (!TEST_FLAG(TheFlag, polygon) && (!TEST_FLAG(PCB_FLAG_CLEARPOLY, polygon) || !i->pad.Clearance)) { - if (IsPadInPolygon(&i->pad, polygon) && ADD_POLYGON_TO_LIST(i->layer, polygon, PCB_TYPE_PAD, &i->pad, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPadRat_callback(const BoxType * b, void *cl) -{ - RatTypePtr rat = (RatTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, rat)) { - if (rat->group1 == i->layer && - ((rat->Point1.X == i->pad.Point1.X && rat->Point1.Y == i->pad.Point1.Y) || - (rat->Point1.X == i->pad.Point2.X && rat->Point1.Y == i->pad.Point2.Y) || - (rat->Point1.X == (i->pad.Point1.X + i->pad.Point2.X) / 2 && - rat->Point1.Y == (i->pad.Point1.Y + i->pad.Point2.Y) / 2))) { - if (ADD_RAT_TO_LIST(rat, PCB_TYPE_PAD, &i->pad, FCT_RAT)) - longjmp(i->env, 1); - } - else if (rat->group2 == i->layer && - ((rat->Point2.X == i->pad.Point1.X && rat->Point2.Y == i->pad.Point1.Y) || - (rat->Point2.X == i->pad.Point2.X && rat->Point2.Y == i->pad.Point2.Y) || - (rat->Point2.X == (i->pad.Point1.X + i->pad.Point2.X) / 2 && - rat->Point2.Y == (i->pad.Point1.Y + i->pad.Point2.Y) / 2))) { - if (ADD_RAT_TO_LIST(rat, PCB_TYPE_PAD, &i->pad, FCT_RAT)) - longjmp(i->env, 1); - } - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPadPad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER) - && PadPadIntersect(pad, &i->pad) && ADD_PAD_TO_LIST(i->layer, pad, PCB_TYPE_PAD, &i->pad, FCT_COPPER)) - longjmp(i->env, 1); - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches all LOs that are connected to the given pad on the given - * layergroup. All found connections are added to the list - */ -static pcb_bool LookupLOConnectionsToPad(PadTypePtr Pad, pcb_cardinal_t LayerGroup) -{ - pcb_cardinal_t entry; - struct lo_info info; - int ic; - pcb_bool retv = pcb_false; - - /* Internal connection: if pads in the same element have the same - internal connection group number, they are connected */ - ic = GET_INTCONN(Pad); - if ((Pad->Element != NULL) && (ic > 0)) { - ElementType *e = Pad->Element; - PadTypePtr orig_pad = Pad; - int tlayer = -1; - -/*fprintf(stderr, "lg===\n");*/ - for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { - pcb_cardinal_t layer; - layer = PCB->LayerGroups.Entries[LayerGroup][entry]; -/*fprintf(stderr, "lg: %d\n", layer);*/ - if (layer == COMPONENT_LAYER) - tlayer = COMPONENT_LAYER; - else if (layer == SOLDER_LAYER) - tlayer = SOLDER_LAYER; - } - -/*fprintf(stderr, "tlayer=%d\n", tlayer);*/ - - if (tlayer >= 0) { - PAD_LOOP(e); - { - if ((orig_pad != pad) && (ic == GET_INTCONN(pad))) { - int padlayer = TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER; -/*fprintf(stderr, "layergroup1: %d {%d %d %d} %d \n", tlayer, TEST_FLAG(PCB_FLAG_ONSOLDER, pad), SOLDER_LAYER, COMPONENT_LAYER, padlayer);*/ - if ((!TEST_FLAG(TheFlag, pad)) && (tlayer != padlayer)) { -/*fprintf(stderr, "layergroup2\n");*/ - ADD_PAD_TO_LIST(padlayer, pad, PCB_TYPE_PAD, orig_pad, FCT_INTERNAL); - if (LookupLOConnectionsToPad(pad, LayerGroup)) - retv = pcb_true; - } - } - } - END_LOOP; - } - } - - - if (!TEST_FLAG(PCB_FLAG_SQUARE, Pad)) - return (LookupLOConnectionsToLine((LineTypePtr) Pad, LayerGroup, pcb_false)); - - info.pad = *Pad; - EXPAND_BOUNDS(&info.pad); - /* add the new rat lines */ - info.layer = LayerGroup; - if (setjmp(info.env) == 0) - r_search(PCB->Data->rat_tree, &info.pad.BoundingBox, NULL, LOCtoPadRat_callback, &info, NULL); - else - return pcb_true; - - /* loop over all layers of the group */ - for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { - pcb_cardinal_t layer; - - layer = PCB->LayerGroups.Entries[LayerGroup][entry]; - /* handle normal layers */ - if (layer < max_copper_layer) { - info.layer = layer; - /* add lines */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->line_tree, &info.pad.BoundingBox, NULL, LOCtoPadLine_callback, &info, NULL); - else - return pcb_true; - /* add arcs */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->arc_tree, &info.pad.BoundingBox, NULL, LOCtoPadArc_callback, &info, NULL); - else - return pcb_true; - /* add polygons */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->polygon_tree, &info.pad.BoundingBox, NULL, LOCtoPadPoly_callback, &info, NULL); - else - return pcb_true; - } - else { - /* handle special 'pad' layers */ - info.layer = layer - max_copper_layer; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pad_tree, (BoxType *) & info.pad, NULL, LOCtoPadPad_callback, &info, NULL); - else - return pcb_true; - } - - } - return retv; -} - -static r_dir_t LOCtoPolyLine_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, line) && IsLineInPolygon(line, &i->polygon)) { - if (ADD_LINE_TO_LIST(i->layer, line, PCB_TYPE_POLYGON, &i->polygon, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPolyArc_callback(const BoxType * b, void *cl) -{ - ArcTypePtr arc = (ArcTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!arc->Thickness) - return 0; - if (!TEST_FLAG(TheFlag, arc) && IsArcInPolygon(arc, &i->polygon)) { - if (ADD_ARC_TO_LIST(i->layer, arc, PCB_TYPE_POLYGON, &i->polygon, FCT_COPPER)) - longjmp(i->env, 1); - } - return 0; -} - -static r_dir_t LOCtoPolyPad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, pad) && i->layer == (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER) - && IsPadInPolygon(pad, &i->polygon)) { - if (ADD_PAD_TO_LIST(i->layer, pad, PCB_TYPE_POLYGON, &i->polygon, FCT_COPPER)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static r_dir_t LOCtoPolyRat_callback(const BoxType * b, void *cl) -{ - RatTypePtr rat = (RatTypePtr) b; - struct lo_info *i = (struct lo_info *) cl; - - if (!TEST_FLAG(TheFlag, rat)) { - if ((rat->Point1.X == (i->polygon.Clipped->contours->head.point[0]) && - rat->Point1.Y == (i->polygon.Clipped->contours->head.point[1]) && - rat->group1 == i->layer) || - (rat->Point2.X == (i->polygon.Clipped->contours->head.point[0]) && - rat->Point2.Y == (i->polygon.Clipped->contours->head.point[1]) && rat->group2 == i->layer)) - if (ADD_RAT_TO_LIST(rat, PCB_TYPE_POLYGON, &i->polygon, FCT_RAT)) - longjmp(i->env, 1); - } - return R_DIR_NOT_FOUND; -} - - -/* --------------------------------------------------------------------------- - * looks up LOs that are connected to the given polygon - * on the given layergroup. All found connections are added to the list - */ -static pcb_bool LookupLOConnectionsToPolygon(PolygonTypePtr Polygon, pcb_cardinal_t LayerGroup) -{ - pcb_cardinal_t entry; - struct lo_info info; - - if (!Polygon->Clipped) - return pcb_false; - info.polygon = *Polygon; - EXPAND_BOUNDS(&info.polygon); - info.layer = LayerGroup; - /* check rats */ - if (setjmp(info.env) == 0) - r_search(PCB->Data->rat_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyRat_callback, &info, NULL); - else - return pcb_true; -/* loop over all layers of the group */ - for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { - pcb_cardinal_t layer; - - layer = PCB->LayerGroups.Entries[LayerGroup][entry]; - - /* handle normal layers */ - if (layer < max_copper_layer) { - gdl_iterator_t it; - PolygonType *polygon; - - /* check all polygons */ - polylist_foreach(&(PCB->Data->Layer[layer].Polygon), &it, polygon) { - if (!TEST_FLAG(TheFlag, polygon) - && IsPolygonInPolygon(polygon, Polygon) - && ADD_POLYGON_TO_LIST(layer, polygon, PCB_TYPE_POLYGON, Polygon, FCT_COPPER)) - return pcb_true; - } - - info.layer = layer; - /* check all lines */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->line_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyLine_callback, &info, NULL); - else - return pcb_true; - /* check all arcs */ - if (setjmp(info.env) == 0) - r_search(LAYER_PTR(layer)->arc_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyArc_callback, &info, NULL); - else - return pcb_true; - } - else { - info.layer = layer - max_copper_layer; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pad_tree, (BoxType *) & info.polygon, NULL, LOCtoPolyPad_callback, &info, NULL); - else - return pcb_true; - } - } - return (pcb_false); -} Index: 1.1.4/src/hid_nogui.h =================================================================== --- 1.1.4/src/hid_nogui.h (revision 10776) +++ 1.1.4/src/hid_nogui.h (nonexistent) @@ -1,7 +0,0 @@ -#ifndef PCB_HID_COMMON_HIDNOGUI_H -#define PCB_HID_COMMON_HIDNOGUI_H - -void common_nogui_init(HID * hid); -HID *hid_nogui_get_hid(void); - -#endif Index: 1.1.4/src/action_helper.c =================================================================== --- 1.1.4/src/action_helper.c (revision 10776) +++ 1.1.4/src/action_helper.c (nonexistent) @@ -1,1242 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* action routines for output window - */ - -#include "config.h" - -#include "conf_core.h" - -#include "action_helper.h" -#include "buffer.h" -#include "change.h" -#include "copy.h" -#include "create.h" -#include "crosshair.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "find.h" -#include "insert.h" -#include "line.h" -#include "misc.h" -#include "move.h" -#include "polygon.h" -#include "rats.h" -#include "remove.h" -#include "rotate.h" -#include "rubberband.h" -#include "search.h" -#include "select.h" -#include "set.h" -#include "undo.h" -#include "rtree.h" -#include "stub_stroke.h" -#include "funchash_core.h" -#include "hid_actions.h" -#include "compat_misc.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- */ - -/* %start-doc actions 00delta - -Many actions take a @code{delta} parameter as the last parameter, -which is an amount to change something. That @code{delta} may include -units, as an additional parameter, such as @code{Action(Object,5,mm)}. -If no units are specified, the default is PCB's native units -(currently 1/100 mil). Also, if the delta is prefixed by @code{+} or -@code{-}, the size is increased or decreased by that amount. -Otherwise, the size size is set to the given amount. - -@example -Action(Object,5,mil) -Action(Object,+0.5,mm) -Action(Object,-1) -@end example - -Actions which take a @code{delta} parameter which do not accept all -these options will specify what they do take. - -%end-doc */ - -/* %start-doc actions 00objects - -Many actions act on indicated objects on the board. They will have -parameters like @code{ToggleObject} or @code{SelectedVias} to indicate -what group of objects they act on. Unless otherwise specified, these -parameters are defined as follows: - -@table @code - -@item Object -@itemx ToggleObject -Affects the object under the mouse pointer. If this action is invoked -from a menu or script, the user will be prompted to click on an -object, which is then the object affected. - -@item Selected -@itemx SelectedObjects - -Affects all objects which are currently selected. At least, all -selected objects for which the given action makes sense. - -@item SelectedPins -@itemx SelectedVias -@itemx Selected@var{Type} -@itemx @i{etc} -Affects all objects which are both selected and of the @var{Type} specified. - -@end table - -%end-doc */ - -/* %start-doc actions 00macros - -@macro pinshapes - -Pins, pads, and vias can have various shapes. All may be round. Pins -and pads may be square (obviously "square" pads are usually -rectangular). Pins and vias may be octagonal. When you change a -shape flag of an element, you actually change all of its pins and -pads. - -Note that the square flag takes precedence over the octagon flag, -thus, if both the square and octagon flags are set, the object is -square. When the square flag is cleared, the pins and pads will be -either round or, if the octagon flag is set, octagonal. - -@end macro - -%end-doc */ - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static PointType InsertedPoint; -LayerTypePtr lastLayer; -static struct { - PolygonTypePtr poly; - LineType line; -} fake; - -action_note_t Note; -int defer_updates = 0; -int defer_needs_update = 0; - - -static pcb_cardinal_t polyIndex = 0; -pcb_bool saved_mode = pcb_false; - -/* --------------------------------------------------------------------------- - * some local routines - */ -static void AdjustAttachedBox(void); -/* --------------------------------------------------------------------------- - * Clear warning color from pins/pads - */ -void ClearWarnings() -{ - conf_core.temp.rat_warn = pcb_false; - ALLPIN_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_WARN, pin)) { - CLEAR_FLAG(PCB_FLAG_WARN, pin); - DrawPin(pin); - } - } - ENDALL_LOOP; - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_WARN, via)) { - CLEAR_FLAG(PCB_FLAG_WARN, via); - DrawVia(via); - } - } - END_LOOP; - ALLPAD_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_WARN, pad)) { - CLEAR_FLAG(PCB_FLAG_WARN, pad); - DrawPad(pad); - } - } - ENDALL_LOOP; - ALLLINE_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_WARN, line)) { - CLEAR_FLAG(PCB_FLAG_WARN, line); - DrawLine(layer, line); - } - } - ENDALL_LOOP; - ALLARC_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_WARN, arc)) { - CLEAR_FLAG(PCB_FLAG_WARN, arc); - DrawArc(layer, arc); - } - } - ENDALL_LOOP; - ALLPOLYGON_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_WARN, polygon)) { - CLEAR_FLAG(PCB_FLAG_WARN, polygon); - DrawPolygon(layer, polygon); - } - } - ENDALL_LOOP; - - Draw(); -} - -static void click_cb(hidval hv) -{ - if (Note.Click) { - notify_crosshair_change(pcb_false); - Note.Click = pcb_false; - if (Note.Moving && !gui->shift_is_pressed()) { - Note.Buffer = conf_core.editor.buffer_number; - SetBufferNumber(MAX_BUFFER - 1); - ClearBuffer(PASTEBUFFER); - AddSelectedToBuffer(PASTEBUFFER, Note.X, Note.Y, pcb_true); - SaveUndoSerialNumber(); - RemoveSelected(); - SaveMode(); - saved_mode = pcb_true; - SetMode(PCB_MODE_PASTE_BUFFER); - } - else if (Note.Hit && !gui->shift_is_pressed()) { - BoxType box; - - SaveMode(); - saved_mode = pcb_true; - SetMode(gui->control_is_pressed()? PCB_MODE_COPY : PCB_MODE_MOVE); - Crosshair.AttachedObject.Ptr1 = Note.ptr1; - Crosshair.AttachedObject.Ptr2 = Note.ptr2; - Crosshair.AttachedObject.Ptr3 = Note.ptr3; - Crosshair.AttachedObject.Type = Note.Hit; - - if (Crosshair.drags != NULL) { - free(Crosshair.drags); - Crosshair.drags = NULL; - } - Crosshair.dragx = Note.X; - Crosshair.dragy = Note.Y; - box.X1 = Note.X + SLOP * pixel_slop; - box.X2 = Note.X - SLOP * pixel_slop; - box.Y1 = Note.Y + SLOP * pixel_slop; - box.Y2 = Note.Y - SLOP * pixel_slop; - Crosshair.drags = ListBlock(&box, &Crosshair.drags_len); - Crosshair.drags_current = 0; - AttachForCopy(Note.X, Note.Y); - } - else { - BoxType box; - - Note.Hit = 0; - Note.Moving = pcb_false; - SaveUndoSerialNumber(); - box.X1 = -MAX_COORD; - box.Y1 = -MAX_COORD; - box.X2 = MAX_COORD; - box.Y2 = MAX_COORD; - /* unselect first if shift key not down */ - if (!gui->shift_is_pressed() && SelectBlock(&box, pcb_false)) - SetChangedFlag(pcb_true); - NotifyBlock(); - Crosshair.AttachedBox.Point1.X = Note.X; - Crosshair.AttachedBox.Point1.Y = Note.Y; - } - notify_crosshair_change(pcb_true); - } -} - -void ReleaseMode(void) -{ - BoxType box; - - if (Note.Click) { - BoxType box; - - box.X1 = -MAX_COORD; - box.Y1 = -MAX_COORD; - box.X2 = MAX_COORD; - box.Y2 = MAX_COORD; - - Note.Click = pcb_false; /* inhibit timer action */ - SaveUndoSerialNumber(); - /* unselect first if shift key not down */ - if (!gui->shift_is_pressed()) { - if (SelectBlock(&box, pcb_false)) - SetChangedFlag(pcb_true); - if (Note.Moving) { - Note.Moving = 0; - Note.Hit = 0; - return; - } - } - /* Restore the SN so that if we select something the deselect/select combo - gets the same SN. */ - RestoreUndoSerialNumber(); - if (SelectObject()) - SetChangedFlag(pcb_true); - else - IncrementUndoSerialNumber(); /* We didn't select anything new, so, the deselection should get its own SN. */ - Note.Hit = 0; - Note.Moving = 0; - } - else if (Note.Moving) { - RestoreUndoSerialNumber(); - NotifyMode(); - ClearBuffer(PASTEBUFFER); - SetBufferNumber(Note.Buffer); - Note.Moving = pcb_false; - Note.Hit = 0; - } - else if (Note.Hit) { - NotifyMode(); - Note.Hit = 0; - } - else if (conf_core.editor.mode == PCB_MODE_ARROW) { - box.X1 = Crosshair.AttachedBox.Point1.X; - box.Y1 = Crosshair.AttachedBox.Point1.Y; - box.X2 = Crosshair.AttachedBox.Point2.X; - box.Y2 = Crosshair.AttachedBox.Point2.Y; - - RestoreUndoSerialNumber(); - if (SelectBlock(&box, pcb_true)) - SetChangedFlag(pcb_true); - else if (Bumped) - IncrementUndoSerialNumber(); - Crosshair.AttachedBox.State = STATE_FIRST; - } - if (saved_mode) - RestoreMode(); - saved_mode = pcb_false; -} - -/* --------------------------------------------------------------------------- - * set new coordinates if in 'RECTANGLE' mode - * the cursor shape is also adjusted - */ -static void AdjustAttachedBox(void) -{ - if (conf_core.editor.mode == PCB_MODE_ARC) { - Crosshair.AttachedBox.otherway = gui->shift_is_pressed(); - return; - } - switch (Crosshair.AttachedBox.State) { - case STATE_SECOND: /* one corner is selected */ - { - /* update coordinates */ - Crosshair.AttachedBox.Point2.X = Crosshair.X; - Crosshair.AttachedBox.Point2.Y = Crosshair.Y; - break; - } - } -} - -/* --------------------------------------------------------------------------- - * adjusts the objects which are to be created like attached lines... - */ -void AdjustAttachedObjects(void) -{ - PointTypePtr pnt; - switch (conf_core.editor.mode) { - /* update at least an attached block (selection) */ - case PCB_MODE_NO: - case PCB_MODE_ARROW: - if (Crosshair.AttachedBox.State) { - Crosshair.AttachedBox.Point2.X = Crosshair.X; - Crosshair.AttachedBox.Point2.Y = Crosshair.Y; - } - break; - - /* rectangle creation mode */ - case PCB_MODE_RECTANGLE: - case PCB_MODE_ARC: - AdjustAttachedBox(); - break; - - /* polygon creation mode */ - case PCB_MODE_POLYGON: - case PCB_MODE_POLYGON_HOLE: - AdjustAttachedLine(); - break; - /* line creation mode */ - case PCB_MODE_LINE: - if (PCB->RatDraw || conf_core.editor.line_refraction == 0) - AdjustAttachedLine(); - else - AdjustTwoLine(conf_core.editor.line_refraction - 1); - break; - /* point insertion mode */ - case PCB_MODE_INSERT_POINT: - pnt = AdjustInsertPoint(); - if (pnt) - InsertedPoint = *pnt; - break; - case PCB_MODE_ROTATE: - break; - } -} - -/* --------------------------------------------------------------------------- - * creates points of a line - */ -void NotifyLine(void) -{ - int type = PCB_TYPE_NONE; - void *ptr1, *ptr2, *ptr3; - - if (!Marked.status || conf_core.editor.local_ref) - SetLocalRef(Crosshair.X, Crosshair.Y, pcb_true); - switch (Crosshair.AttachedLine.State) { - case STATE_FIRST: /* first point */ - if (PCB->RatDraw && SearchScreen(Crosshair.X, Crosshair.Y, PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr1, &ptr1) == PCB_TYPE_NONE) { - gui->beep(); - break; - } - if (conf_core.editor.auto_drc && conf_core.editor.mode == PCB_MODE_LINE) { - type = SearchScreen(Crosshair.X, Crosshair.Y, PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_VIA, &ptr1, &ptr2, &ptr3); - LookupConnection(Crosshair.X, Crosshair.Y, pcb_true, 1, PCB_FLAG_FOUND); - } - if (type == PCB_TYPE_PIN || type == PCB_TYPE_VIA) { - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = ((PinTypePtr) ptr2)->X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = ((PinTypePtr) ptr2)->Y; - } - else if (type == PCB_TYPE_PAD) { - PadTypePtr pad = (PadTypePtr) ptr2; - double d1 = Distance(Crosshair.X, Crosshair.Y, pad->Point1.X, pad->Point1.Y); - double d2 = Distance(Crosshair.X, Crosshair.Y, pad->Point2.X, pad->Point2.Y); - double dm = Distance(Crosshair.X, Crosshair.Y, (pad->Point1.X + pad->Point2.X) / 2, (pad->Point1.Y + pad->Point2.Y)/2); - if ((dm <= d1) && (dm <= d2)) { /* prefer to snap to the middle of a pin if that's the closest */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.Y; - } - else if (d2 < d1) { /* else select the closest endpoint */ - Crosshair.AttachedLine.Point1 = Crosshair.AttachedLine.Point2 = pad->Point2; - } - else { - Crosshair.AttachedLine.Point1 = Crosshair.AttachedLine.Point2 = pad->Point1; - } - } - else { - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.Y; - } - Crosshair.AttachedLine.State = STATE_SECOND; - break; - - case STATE_SECOND: - /* fall through to third state too */ - lastLayer = CURRENT; - default: /* all following points */ - Crosshair.AttachedLine.State = STATE_THIRD; - break; - } -} - -/* --------------------------------------------------------------------------- - * create first or second corner of a marked block - */ -void NotifyBlock(void) -{ - notify_crosshair_change(pcb_false); - switch (Crosshair.AttachedBox.State) { - case STATE_FIRST: /* setup first point */ - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Crosshair.X; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Crosshair.Y; - Crosshair.AttachedBox.State = STATE_SECOND; - break; - - case STATE_SECOND: /* setup second point */ - Crosshair.AttachedBox.State = STATE_THIRD; - break; - } - notify_crosshair_change(pcb_true); -} - - -/* --------------------------------------------------------------------------- - * - * does what's appropriate for the current mode setting. This normally - * means creation of an object at the current crosshair location. - * - * new created objects are added to the create undo list of course - */ -void NotifyMode(void) -{ - void *ptr1, *ptr2, *ptr3; - int type; - - if (conf_core.temp.rat_warn) - ClearWarnings(); - switch (conf_core.editor.mode) { - case PCB_MODE_ARROW: - { - int test; - hidval hv; - - Note.Click = pcb_true; - /* do something after click time */ - gui->add_timer(click_cb, conf_core.editor.click_time, hv); - - /* see if we clicked on something already selected - * (Note.Moving) or clicked on a MOVE_TYPE - * (Note.Hit) - */ - for (test = (SELECT_TYPES | MOVE_TYPES) & ~PCB_TYPE_RATLINE; test; test &= ~type) { - type = SearchScreen(Note.X, Note.Y, test, &ptr1, &ptr2, &ptr3); - if (!Note.Hit && (type & MOVE_TYPES) && !TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) { - Note.Hit = type; - Note.ptr1 = ptr1; - Note.ptr2 = ptr2; - Note.ptr3 = ptr3; - } - if (!Note.Moving && (type & SELECT_TYPES) && TEST_FLAG(PCB_FLAG_SELECTED, (PinTypePtr) ptr2)) - Note.Moving = pcb_true; - if ((Note.Hit && Note.Moving) || type == PCB_TYPE_NONE) - break; - } - break; - } - - case PCB_MODE_VIA: - { - PinTypePtr via; - - if (!PCB->ViaOn) { - Message(PCB_MSG_DEFAULT, _("You must turn via visibility on before\n" "you can place vias\n")); - break; - } - if ((via = CreateNewVia(PCB->Data, Note.X, Note.Y, - conf_core.design.via_thickness, 2 * conf_core.design.clearance, - 0, conf_core.design.via_drilling_hole, NULL, NoFlags())) != NULL) { - AddObjectToCreateUndoList(PCB_TYPE_VIA, via, via, via); - if (gui->shift_is_pressed()) - ChangeObjectThermal(PCB_TYPE_VIA, via, via, via, PCB->ThermStyle); - IncrementUndoSerialNumber(); - DrawVia(via); - Draw(); - } - break; - } - - case PCB_MODE_ARC: - { - switch (Crosshair.AttachedBox.State) { - case STATE_FIRST: - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Note.X; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Note.Y; - Crosshair.AttachedBox.State = STATE_SECOND; - break; - - case STATE_SECOND: - case STATE_THIRD: - { - ArcTypePtr arc; - Coord wx, wy; - Angle sa, dir; - - wx = Note.X - Crosshair.AttachedBox.Point1.X; - wy = Note.Y - Crosshair.AttachedBox.Point1.Y; - if (XOR(Crosshair.AttachedBox.otherway, coord_abs(wy) > coord_abs(wx))) { - Crosshair.AttachedBox.Point2.X = Crosshair.AttachedBox.Point1.X + coord_abs(wy) * SGNZ(wx); - sa = (wx >= 0) ? 0 : 180; -#ifdef ARC45 - if (abs(wy) / 2 >= abs(wx)) - dir = (SGNZ(wx) == SGNZ(wy)) ? 45 : -45; - else -#endif - dir = (SGNZ(wx) == SGNZ(wy)) ? 90 : -90; - } - else { - Crosshair.AttachedBox.Point2.Y = Crosshair.AttachedBox.Point1.Y + coord_abs(wx) * SGNZ(wy); - sa = (wy >= 0) ? -90 : 90; -#ifdef ARC45 - if (abs(wx) / 2 >= abs(wy)) - dir = (SGNZ(wx) == SGNZ(wy)) ? -45 : 45; - else -#endif - dir = (SGNZ(wx) == SGNZ(wy)) ? -90 : 90; - wy = wx; - } - if (coord_abs(wy) > 0 && (arc = CreateNewArcOnLayer(CURRENT, - Crosshair.AttachedBox.Point2.X, - Crosshair.AttachedBox.Point2.Y, - coord_abs(wy), - coord_abs(wy), - sa, - dir, - conf_core.design.line_thickness, - 2 * conf_core.design.clearance, - MakeFlags(conf_core.editor.clear_line ? PCB_FLAG_CLEARLINE : 0)))) { - BoxTypePtr bx; - - bx = GetArcEnds(arc); - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = bx->X2; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = bx->Y2; - AddObjectToCreateUndoList(PCB_TYPE_ARC, CURRENT, arc, arc); - IncrementUndoSerialNumber(); - addedLines++; - DrawArc(CURRENT, arc); - Draw(); - Crosshair.AttachedBox.State = STATE_THIRD; - } - break; - } - } - break; - } - case PCB_MODE_LOCK: - { - type = SearchScreen(Note.X, Note.Y, PCB_TYPEMASK_LOCK, &ptr1, &ptr2, &ptr3); - if (type == PCB_TYPE_ELEMENT) { - ElementTypePtr element = (ElementTypePtr) ptr2; - - TOGGLE_FLAG(PCB_FLAG_LOCK, element); - PIN_LOOP(element); - { - TOGGLE_FLAG(PCB_FLAG_LOCK, pin); - CLEAR_FLAG(PCB_FLAG_SELECTED, pin); - } - END_LOOP; - PAD_LOOP(element); - { - TOGGLE_FLAG(PCB_FLAG_LOCK, pad); - CLEAR_FLAG(PCB_FLAG_SELECTED, pad); - } - END_LOOP; - CLEAR_FLAG(PCB_FLAG_SELECTED, element); - /* always re-draw it since I'm too lazy - * to tell if a selected flag changed - */ - DrawElement(element); - Draw(); - hid_actionl("Report", "Object", NULL); - } - else if (type != PCB_TYPE_NONE) { - TextTypePtr thing = (TextTypePtr) ptr3; - TOGGLE_FLAG(PCB_FLAG_LOCK, thing); - if (TEST_FLAG(PCB_FLAG_LOCK, thing) - && TEST_FLAG(PCB_FLAG_SELECTED, thing)) { - /* this is not un-doable since LOCK isn't */ - CLEAR_FLAG(PCB_FLAG_SELECTED, thing); - DrawObject(type, ptr1, ptr2); - Draw(); - } - hid_actionl("Report", "Object", NULL); - } - break; - } - case PCB_MODE_THERMAL: - { - if (((type = SearchScreen(Note.X, Note.Y, PCB_TYPEMASK_PIN, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) - && !TEST_FLAG(PCB_FLAG_HOLE, (PinTypePtr) ptr3)) { - if (gui->shift_is_pressed()) { - int tstyle = GET_THERM(INDEXOFCURRENT, (PinTypePtr) ptr3); - tstyle++; - if (tstyle > 5) - tstyle = 1; - ChangeObjectThermal(type, ptr1, ptr2, ptr3, tstyle); - } - else if (GET_THERM(INDEXOFCURRENT, (PinTypePtr) ptr3)) - ChangeObjectThermal(type, ptr1, ptr2, ptr3, 0); - else - ChangeObjectThermal(type, ptr1, ptr2, ptr3, PCB->ThermStyle); - } - break; - } - - case PCB_MODE_LINE: - /* do update of position */ - NotifyLine(); - if (Crosshair.AttachedLine.State != STATE_THIRD) - break; - - /* Remove anchor if clicking on start point; - * this means we can't paint 0 length lines - * which could be used for square SMD pads. - * Instead use a very small delta, or change - * the file after saving. - */ - if (Crosshair.X == Crosshair.AttachedLine.Point1.X && Crosshair.Y == Crosshair.AttachedLine.Point1.Y) { - SetMode(PCB_MODE_LINE); - break; - } - - if (PCB->RatDraw) { - RatTypePtr line; - if ((line = AddNet())) { - addedLines++; - AddObjectToCreateUndoList(PCB_TYPE_RATLINE, line, line, line); - IncrementUndoSerialNumber(); - DrawRat(line); - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; - Draw(); - } - break; - } - else - /* create line if both ends are determined && length != 0 */ - { - LineTypePtr line; - int maybe_found_flag; - - if (conf_core.editor.line_refraction - && Crosshair.AttachedLine.Point1.X == - Crosshair.AttachedLine.Point2.X - && Crosshair.AttachedLine.Point1.Y == - Crosshair.AttachedLine.Point2.Y - && (Crosshair.AttachedLine.Point2.X != Note.X || Crosshair.AttachedLine.Point2.Y != Note.Y)) { - /* We will only need to paint the second line segment. - Since we only check for vias on the first segment, - swap them so the non-empty segment is the first segment. */ - Crosshair.AttachedLine.Point2.X = Note.X; - Crosshair.AttachedLine.Point2.Y = Note.Y; - } - - if (conf_core.editor.auto_drc - && !TEST_SILK_LAYER(CURRENT)) - maybe_found_flag = PCB_FLAG_FOUND; - else - maybe_found_flag = 0; - - if ((Crosshair.AttachedLine.Point1.X != - Crosshair.AttachedLine.Point2.X || Crosshair.AttachedLine.Point1.Y != Crosshair.AttachedLine.Point2.Y) - && (line = - CreateDrawnLineOnLayer(CURRENT, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, - conf_core.design.line_thickness, - 2 * conf_core.design.clearance, - MakeFlags(maybe_found_flag | - (conf_core.editor.clear_line ? PCB_FLAG_CLEARLINE : 0)))) != NULL) { - PinTypePtr via; - - addedLines++; - AddObjectToCreateUndoList(PCB_TYPE_LINE, CURRENT, line, line); - DrawLine(CURRENT, line); - /* place a via if vias are visible, the layer is - in a new group since the last line and there - isn't a pin already here */ - if (PCB->ViaOn && GetLayerGroupNumberByPointer(CURRENT) != - GetLayerGroupNumberByPointer(lastLayer) && - SearchObjectByLocation(PCB_TYPEMASK_PIN, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - conf_core.design.via_thickness / 2) == - PCB_TYPE_NONE - && (via = - CreateNewVia(PCB->Data, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - conf_core.design.via_thickness, - 2 * conf_core.design.clearance, 0, conf_core.design.via_drilling_hole, NULL, NoFlags())) != NULL) { - AddObjectToCreateUndoList(PCB_TYPE_VIA, via, via, via); - DrawVia(via); - } - /* copy the coordinates */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; - IncrementUndoSerialNumber(); - lastLayer = CURRENT; - } - if (conf_core.editor.line_refraction && (Note.X != Crosshair.AttachedLine.Point2.X || Note.Y != Crosshair.AttachedLine.Point2.Y) - && (line = - CreateDrawnLineOnLayer(CURRENT, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, - Note.X, Note.Y, - conf_core.design.line_thickness, - 2 * conf_core.design.clearance, - MakeFlags((conf_core.editor.auto_drc ? PCB_FLAG_FOUND : 0) | - (conf_core.editor.clear_line ? PCB_FLAG_CLEARLINE : 0)))) != NULL) { - addedLines++; - AddObjectToCreateUndoList(PCB_TYPE_LINE, CURRENT, line, line); - IncrementUndoSerialNumber(); - DrawLine(CURRENT, line); - /* move to new start point */ - Crosshair.AttachedLine.Point1.X = Note.X; - Crosshair.AttachedLine.Point1.Y = Note.Y; - Crosshair.AttachedLine.Point2.X = Note.X; - Crosshair.AttachedLine.Point2.Y = Note.Y; - - - if (conf_core.editor.swap_start_direction) { - conf_setf(CFR_DESIGN,"editor/line_refraction", -1, "%d",conf_core.editor.line_refraction ^ 3); - } - } - if (conf_core.editor.orthogonal_moves) { - /* set the mark to the new starting point so ortho works as expected and we can draw a perpendicular line from here */ - Marked.X = Note.X; - Marked.Y = Note.Y; - } - Draw(); - } - break; - - case PCB_MODE_RECTANGLE: - /* do update of position */ - NotifyBlock(); - - /* create rectangle if both corners are determined - * and width, height are != 0 - */ - if (Crosshair.AttachedBox.State == STATE_THIRD && - Crosshair.AttachedBox.Point1.X != Crosshair.AttachedBox.Point2.X && - Crosshair.AttachedBox.Point1.Y != Crosshair.AttachedBox.Point2.Y) { - PolygonTypePtr polygon; - - int flags = PCB_FLAG_CLEARPOLY; - if (conf_core.editor.full_poly) - flags |= PCB_FLAG_FULLPOLY; - if ((polygon = CreateNewPolygonFromRectangle(CURRENT, - Crosshair.AttachedBox.Point1.X, - Crosshair.AttachedBox.Point1.Y, - Crosshair.AttachedBox.Point2.X, - Crosshair.AttachedBox.Point2.Y, MakeFlags(flags))) != NULL) { - AddObjectToCreateUndoList(PCB_TYPE_POLYGON, CURRENT, polygon, polygon); - IncrementUndoSerialNumber(); - DrawPolygon(CURRENT, polygon); - Draw(); - } - - /* reset state to 'first corner' */ - Crosshair.AttachedBox.State = STATE_FIRST; - } - break; - - case PCB_MODE_TEXT: - { - char *string; - - if ((string = gui->prompt_for(_("Enter text:"), "")) != NULL) { - if (strlen(string) > 0) { - TextTypePtr text; - int flag = PCB_FLAG_CLEARLINE; - - if (GetLayerGroupNumberByNumber(INDEXOFCURRENT) == GetLayerGroupNumberByNumber(solder_silk_layer)) - flag |= PCB_FLAG_ONSOLDER; - if ((text = CreateNewText(CURRENT, &PCB->Font, Note.X, - Note.Y, 0, conf_core.design.text_scale, string, MakeFlags(flag))) != NULL) { - AddObjectToCreateUndoList(PCB_TYPE_TEXT, CURRENT, text, text); - IncrementUndoSerialNumber(); - DrawText(CURRENT, text); - Draw(); - } - } - free(string); - } - break; - } - - case PCB_MODE_POLYGON: - { - PointTypePtr points = Crosshair.AttachedPolygon.Points; - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN; - - /* do update of position; use the 'PCB_MODE_LINE' mechanism */ - NotifyLine(); - - /* check if this is the last point of a polygon */ - if (n >= 3 && points[0].X == Crosshair.AttachedLine.Point2.X && points[0].Y == Crosshair.AttachedLine.Point2.Y) { - hid_actionl("Polygon", "Close", NULL); - ClosePolygon(); - break; - } - - /* Someone clicking twice on the same point ('doubleclick'): close polygon */ - if (n >= 3 && points[n - 1].X == Crosshair.AttachedLine.Point2.X && points[n - 1].Y == Crosshair.AttachedLine.Point2.Y) { - hid_actionl("Polygon", "Close", NULL); - break; - } - - /* create new point if it's the first one or if it's - * different to the last one - */ - if (!n || points[n - 1].X != Crosshair.AttachedLine.Point2.X || points[n - 1].Y != Crosshair.AttachedLine.Point2.Y) { - CreateNewPointInPolygon(&Crosshair.AttachedPolygon, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); - - /* copy the coordinates */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; - } - - if (conf_core.editor.orthogonal_moves) { - /* set the mark to the new starting point so ortho works */ - Marked.X = Note.X; - Marked.Y = Note.Y; - } - - break; - } - - case PCB_MODE_POLYGON_HOLE: - { - switch (Crosshair.AttachedObject.State) { - /* first notify, lookup object */ - case STATE_FIRST: - Crosshair.AttachedObject.Type = - SearchScreen(Note.X, Note.Y, PCB_TYPE_POLYGON, - &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); - - if (Crosshair.AttachedObject.Type == PCB_TYPE_NONE) { - Message(PCB_MSG_DEFAULT, "The first point of a polygon hole must be on a polygon.\n"); - break; /* don't start doing anything if clicket out of polys */ - } - - if (TEST_FLAG(PCB_FLAG_LOCK, (PolygonTypePtr) - Crosshair.AttachedObject.Ptr2)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - break; - } - else - Crosshair.AttachedObject.State = STATE_SECOND; - /* fall thru: first click is also the first point of the poly hole */ - - /* second notify, insert new point into object */ - case STATE_SECOND: - { - PointTypePtr points = Crosshair.AttachedPolygon.Points; - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN; - POLYAREA *original, *new_hole, *result; - FlagType Flags; - - /* do update of position; use the 'PCB_MODE_LINE' mechanism */ - NotifyLine(); - - if (conf_core.editor.orthogonal_moves) { - /* set the mark to the new starting point so ortho works */ - Marked.X = Note.X; - Marked.Y = Note.Y; - } - - /* check if this is the last point of a polygon */ - if (n >= 3 && points[0].X == Crosshair.AttachedLine.Point2.X && points[0].Y == Crosshair.AttachedLine.Point2.Y) { - /* Create POLYAREAs from the original polygon - * and the new hole polygon */ - original = PolygonToPoly((PolygonType *) Crosshair.AttachedObject.Ptr2); - new_hole = PolygonToPoly(&Crosshair.AttachedPolygon); - - /* Subtract the hole from the original polygon shape */ - poly_Boolean_free(original, new_hole, &result, PBO_SUB); - - /* Convert the resulting polygon(s) into a new set of nodes - * and place them on the page. Delete the original polygon. - */ - SaveUndoSerialNumber(); - Flags = ((PolygonType *) Crosshair.AttachedObject.Ptr2)->Flags; - PolyToPolygonsOnLayer(PCB->Data, (LayerType *) Crosshair.AttachedObject.Ptr1, result, Flags); - RemoveObject(PCB_TYPE_POLYGON, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); - RestoreUndoSerialNumber(); - IncrementUndoSerialNumber(); - Draw(); - - /* reset state of attached line */ - memset(&Crosshair.AttachedPolygon, 0, sizeof(PolygonType)); - Crosshair.AttachedLine.State = STATE_FIRST; - Crosshair.AttachedObject.State = STATE_FIRST; - addedLines = 0; - - break; - } - - /* create new point if it's the first one or if it's - * different to the last one - */ - if (!n || points[n - 1].X != Crosshair.AttachedLine.Point2.X || points[n - 1].Y != Crosshair.AttachedLine.Point2.Y) { - CreateNewPointInPolygon(&Crosshair.AttachedPolygon, - Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); - - /* copy the coordinates */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; - } - break; - } - } - break; - } - - case PCB_MODE_PASTE_BUFFER: - { - TextType estr[MAX_ELEMENTNAMES]; - ElementTypePtr e = 0; - - if (gui->shift_is_pressed()) { - int type = SearchScreen(Note.X, Note.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, - &ptr3); - if (type == PCB_TYPE_ELEMENT) { - e = (ElementTypePtr) ptr1; - if (e) { - int i; - - memcpy(estr, e->Name, MAX_ELEMENTNAMES * sizeof(TextType)); - for (i = 0; i < MAX_ELEMENTNAMES; ++i) - estr[i].TextString = estr[i].TextString ? pcb_strdup(estr[i].TextString) : NULL; - RemoveElement(e); - } - } - } - if (CopyPastebufferToLayout(Note.X, Note.Y)) - SetChangedFlag(pcb_true); - if (e) { - int type = SearchScreen(Note.X, Note.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, - &ptr3); - if (type == PCB_TYPE_ELEMENT && ptr1) { - int i, save_n; - e = (ElementTypePtr) ptr1; - - save_n = NAME_INDEX(); - - for (i = 0; i < MAX_ELEMENTNAMES; i++) { - if (i == save_n) - EraseElementName(e); - r_delete_entry(PCB->Data->name_tree[i], (BoxType *) & (e->Name[i])); - memcpy(&(e->Name[i]), &(estr[i]), sizeof(TextType)); - e->Name[i].Element = e; - SetTextBoundingBox(&PCB->Font, &(e->Name[i])); - r_insert_entry(PCB->Data->name_tree[i], (BoxType *) & (e->Name[i]), 0); - if (i == save_n) - DrawElementName(e); - } - } - } - break; - } - - case PCB_MODE_REMOVE: - if ((type = SearchScreen(Note.X, Note.Y, REMOVE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { - if (TEST_FLAG(PCB_FLAG_LOCK, (LineTypePtr) ptr2)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - break; - } - if (type == PCB_TYPE_ELEMENT) { - RubberbandTypePtr ptr; - int i; - - Crosshair.AttachedObject.RubberbandN = 0; - LookupRatLines(type, ptr1, ptr2, ptr3); - ptr = Crosshair.AttachedObject.Rubberband; - for (i = 0; i < Crosshair.AttachedObject.RubberbandN; i++) { - if (PCB->RatOn) - EraseRat((RatTypePtr) ptr->Line); - if (TEST_FLAG(PCB_FLAG_RUBBEREND, ptr->Line)) - MoveObjectToRemoveUndoList(PCB_TYPE_RATLINE, ptr->Line, ptr->Line, ptr->Line); - else - TOGGLE_FLAG(PCB_FLAG_RUBBEREND, ptr->Line); /* only remove line once */ - ptr++; - } - } - RemoveObject(type, ptr1, ptr2, ptr3); - IncrementUndoSerialNumber(); - SetChangedFlag(pcb_true); - } - break; - - case PCB_MODE_ROTATE: - RotateScreenObject(Note.X, Note.Y, gui->shift_is_pressed()? (SWAP_IDENT ? 1 : 3) - : (SWAP_IDENT ? 3 : 1)); - break; - - /* both are almost the same */ - case PCB_MODE_COPY: - case PCB_MODE_MOVE: - switch (Crosshair.AttachedObject.State) { - /* first notify, lookup object */ - case STATE_FIRST: - { - int types = (conf_core.editor.mode == PCB_MODE_COPY) ? COPY_TYPES : MOVE_TYPES; - - Crosshair.AttachedObject.Type = - SearchScreen(Note.X, Note.Y, types, - &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); - if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { - if (conf_core.editor.mode == PCB_MODE_MOVE && TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) - Crosshair.AttachedObject.Ptr2)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - } - else - AttachForCopy(Note.X, Note.Y); - } - break; - } - - /* second notify, move or copy object */ - case STATE_SECOND: - if (conf_core.editor.mode == PCB_MODE_COPY) - CopyObject(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, - Crosshair.AttachedObject.Ptr3, Note.X - Crosshair.AttachedObject.X, Note.Y - Crosshair.AttachedObject.Y); - else { - MoveObjectAndRubberband(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, - Crosshair.AttachedObject.Ptr3, - Note.X - Crosshair.AttachedObject.X, Note.Y - Crosshair.AttachedObject.Y); - SetLocalRef(0, 0, pcb_false); - } - SetChangedFlag(pcb_true); - - /* reset identifiers */ - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - Crosshair.AttachedObject.State = STATE_FIRST; - break; - } - break; - - /* insert a point into a polygon/line/... */ - case PCB_MODE_INSERT_POINT: - switch (Crosshair.AttachedObject.State) { - /* first notify, lookup object */ - case STATE_FIRST: - Crosshair.AttachedObject.Type = - SearchScreen(Note.X, Note.Y, INSERT_TYPES, - &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); - - if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { - if (TEST_FLAG(PCB_FLAG_LOCK, (PolygonTypePtr) - Crosshair.AttachedObject.Ptr2)) { - Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - break; - } - else { - /* get starting point of nearest segment */ - if (Crosshair.AttachedObject.Type == PCB_TYPE_POLYGON) { - fake.poly = (PolygonTypePtr) Crosshair.AttachedObject.Ptr2; - polyIndex = GetLowestDistancePolygonPoint(fake.poly, Note.X, Note.Y); - fake.line.Point1 = fake.poly->Points[polyIndex]; - fake.line.Point2 = fake.poly->Points[prev_contour_point(fake.poly, polyIndex)]; - Crosshair.AttachedObject.Ptr2 = &fake.line; - - } - Crosshair.AttachedObject.State = STATE_SECOND; - InsertedPoint = *AdjustInsertPoint(); - } - } - break; - - /* second notify, insert new point into object */ - case STATE_SECOND: - if (Crosshair.AttachedObject.Type == PCB_TYPE_POLYGON) - InsertPointIntoObject(PCB_TYPE_POLYGON, - Crosshair.AttachedObject.Ptr1, fake.poly, - &polyIndex, InsertedPoint.X, InsertedPoint.Y, pcb_false, pcb_false); - else - InsertPointIntoObject(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, &polyIndex, InsertedPoint.X, InsertedPoint.Y, pcb_false, pcb_false); - SetChangedFlag(pcb_true); - - /* reset identifiers */ - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - Crosshair.AttachedObject.State = STATE_FIRST; - break; - } - break; - } -} - -/* --------------------------------------------------------------------------- - * !!! no action routine !!! - * - * event handler to set the cursor according to the X pointer position - * called from inside main.c - */ -void EventMoveCrosshair(int ev_x, int ev_y) -{ - if (mid_stroke) - stub_stroke_record(ev_x, ev_y); - if (MoveCrosshairAbsolute(ev_x, ev_y)) { - /* update object position and cursor location */ - AdjustAttachedObjects(); - notify_crosshair_change(pcb_true); - } -} - -/* --------------------------------------------------------------------------- */ -/* helper: get route style size for a function and selected object type. - size_id: 0=main size; 1=2nd size (drill); 2=clearance */ -int get_style_size(int funcid, Coord * out, int type, int size_id) -{ - switch (funcid) { - case F_Object: - switch (type) { - case PCB_TYPE_ELEMENT: /* we'd set pin/pad properties, so fall thru */ - case PCB_TYPE_VIA: - case PCB_TYPE_PIN: - return get_style_size(F_SelectedVias, out, 0, size_id); - case PCB_TYPE_PAD: - return get_style_size(F_SelectedPads, out, 0, size_id); - case PCB_TYPE_LINE: - return get_style_size(F_SelectedLines, out, 0, size_id); - case PCB_TYPE_ARC: - return get_style_size(F_SelectedArcs, out, 0, size_id); - } - Message(PCB_MSG_DEFAULT, _("Sorry, can't fetch the style of that object type (%x)\n"), type); - return -1; - case F_SelectedPads: - if (size_id != 2) /* don't mess with pad size */ - return -1; - case F_SelectedVias: - case F_SelectedPins: - case F_SelectedObjects: - case F_Selected: - case F_SelectedElements: - if (size_id == 0) - *out = conf_core.design.via_thickness; - else if (size_id == 1) - *out = conf_core.design.via_drilling_hole; - else - *out = conf_core.design.clearance; - break; - case F_SelectedArcs: - case F_SelectedLines: - if (size_id == 2) - *out = conf_core.design.clearance; - else - *out = conf_core.design.line_thickness; - return 0; - case F_SelectedTexts: - case F_SelectedNames: - Message(PCB_MSG_DEFAULT, _("Sorry, can't change style of every selected object\n")); - return -1; - } - return 0; -} Index: 1.1.4/src/heap.c =================================================================== --- 1.1.4/src/heap.c (revision 10776) +++ 1.1.4/src/heap.c (nonexistent) @@ -1,236 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, heap.c, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* operations on heaps. - */ - -#include -#include "config.h" -#include "heap.h" - -/* define this for more thorough self-checking of data structures */ -#undef SLOW_ASSERTIONS - -/* --------------------------------------------------------------------------- - * some local prototypes - */ - -/* --------------------------------------------------------------------------- - * some local types - */ -struct heap_element { - cost_t cost; - void *data; -}; -struct heap_struct { - struct heap_element *element; - int size, max; -}; - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static cost_t MIN_COST = 0; - -/* --------------------------------------------------------------------------- - * functions. - */ -/* helper functions for assertions */ -#ifndef NDEBUG -#ifdef SLOW_ASSERTIONS -static int __heap_is_good_slow(heap_t * heap) -{ - int i; - /* heap condition: key in each node should be smaller than in its children */ - /* alternatively (and this is what we check): key in each node should be - * larger than (or equal to) key of its parent. */ - /* note that array element[0] is not used (except as a sentinel) */ - for (i = 2; i < heap->size; i++) - if (heap->element[i].cost < heap->element[i / 2].cost) - return 0; - return 1; -} -#endif /* SLOW_ASSERTIONS */ -static int __heap_is_good(heap_t * heap) -{ - return heap && (heap->max == 0 || heap->element) && - (heap->max >= 0) && (heap->size >= 0) && (heap->max == 0 || heap->size < heap->max) && -#ifdef SLOW_ASSERTIONS - __heap_is_good_slow(heap) && -#endif - 1; -} -#endif /* ! NDEBUG */ - -/* create an empty heap */ -heap_t *heap_create() -{ - heap_t *heap; - /* initialize MIN_COST if necessary */ - if (MIN_COST == 0) - MIN_COST = -1e23; - assert(MIN_COST < 0); - /* okay, create empty heap */ - heap = (heap_t *) calloc(1, sizeof(*heap)); - assert(heap); - assert(__heap_is_good(heap)); - return heap; -} - -/* destroy a heap */ -void heap_destroy(heap_t ** heap) -{ - assert(heap && *heap); - assert(__heap_is_good(*heap)); - if ((*heap)->element) - free((*heap)->element); - free(*heap); - *heap = NULL; -} - -/* free all elements in the heap */ -void heap_free(heap_t * heap, void (*freefunc) (void *)) -{ - assert(heap); - assert(__heap_is_good(heap)); - for (; heap->size; heap->size--) { - if (heap->element[heap->size].data) - freefunc(heap->element[heap->size].data); - } -} - -/* -- mutation -- */ -static void __upheap(heap_t * heap, int k) -{ - struct heap_element v; - - assert(heap && heap->size < heap->max); - assert(k <= heap->size); - - v = heap->element[k]; - heap->element[0].cost = MIN_COST; - for (v = heap->element[k]; heap->element[k / 2].cost > v.cost; k = k / 2) - heap->element[k] = heap->element[k / 2]; - heap->element[k] = v; -} - -void heap_insert(heap_t * heap, cost_t cost, void *data) -{ - assert(heap && __heap_is_good(heap)); - assert(cost >= MIN_COST); - - /* determine whether we need to grow the heap */ - if (heap->size + 1 >= heap->max) { - heap->max *= 2; - if (heap->max == 0) - heap->max = 256; /* default initial heap size */ - heap->element = (struct heap_element *) realloc(heap->element, heap->max * sizeof(*heap->element)); - } - heap->size++; - assert(heap->size < heap->max); - heap->element[heap->size].cost = cost; - heap->element[heap->size].data = data; - __upheap(heap, heap->size); /* fix heap condition violation */ - assert(__heap_is_good(heap)); - return; -} - -/* this procedure moves down the heap, exchanging the node at position - * k with the smaller of its two children as necessary and stopping when - * the node at k is smaller than both children or the bottom is reached. - */ -static void __downheap(heap_t * heap, int k) -{ - struct heap_element v; - - assert(heap && heap->size < heap->max); - assert(k <= heap->size); - - v = heap->element[k]; - while (k <= heap->size / 2) { - int j = k + k; - if (j < heap->size && heap->element[j].cost > heap->element[j + 1].cost) - j++; - if (v.cost < heap->element[j].cost) - break; - heap->element[k] = heap->element[j]; - k = j; - } - heap->element[k] = v; -} - -void *heap_remove_smallest(heap_t * heap) -{ - struct heap_element v; - assert(heap && __heap_is_good(heap)); - assert(heap->size > 0); - assert(heap->max > 1); - - v = heap->element[1]; - heap->element[1] = heap->element[heap->size--]; - if (heap->size > 0) - __downheap(heap, 1); - - assert(__heap_is_good(heap)); - return v.data; -} - -void *heap_replace(heap_t * heap, cost_t cost, void *data) -{ - assert(heap && __heap_is_good(heap)); - - if (heap_is_empty(heap)) - return data; - - assert(heap->size > 0); - assert(heap->max > 1); - - heap->element[0].cost = cost; - heap->element[0].data = data; - __downheap(heap, 0); /* ooh, tricky! */ - - assert(__heap_is_good(heap)); - return heap->element[0].data; -} - -/* -- interrogation -- */ -int heap_is_empty(heap_t * heap) -{ - assert(__heap_is_good(heap)); - return heap->size == 0; -} - -/* -- size -- */ -int heap_size(heap_t * heap) -{ - assert(__heap_is_good(heap)); - return heap->size; -} Index: 1.1.4/src/paths.c =================================================================== --- 1.1.4/src/paths.c (revision 10776) +++ 1.1.4/src/paths.c (nonexistent) @@ -1,87 +0,0 @@ -#include -#include -#include -#include "config.h" -#include "paths.h" -#include "error.h" -#include "conf.h" -#include "conf_core.h" - -void resolve_paths(const char **in, char **out, int numpaths, unsigned int extra_room) -{ - const char *subst_to; - int subst_offs; - for (; numpaths > 0; numpaths--, in++, out++) { - if (*in != NULL) { - if (**in == '~') { - int l1, l2; - if (conf_core.rc.path.home == NULL) { - Message(PCB_MSG_DEFAULT, "can't resolve home dir required for path %s\n", *in); - exit(1); - } - subst_to = conf_core.rc.path.home; - subst_offs = 1; - replace:; - /* avoid Concat() here to reduce dependencies for external tools */ - l1 = strlen(subst_to); - l2 = strlen((*in) + 1); - *out = malloc(l1 + l2 + 4 + extra_room); - sprintf(*out, "%s%s", subst_to, (*in) + subst_offs); - } - else if (**in == '$') { - if ((*in)[1] == '(') { - char *end = strchr((*in)+2, ')'); - if (end != NULL) { - char hash_path[128]; - int len = end - (*in); - if (len < sizeof(hash_path)-1) { - conf_native_t *cn; - const char *si; - char *so; - int n; - - (*in) += 2; - len -= 2; - for(si = *in, so = hash_path, n=0; n < len; n++,si++,so++) { - if (*si == '.') - *so = '/'; - else - *so = *si; - } - *so = 0; - cn = conf_get_field(hash_path); - if ((cn != NULL) && (cn->type == CFN_STRING)) { - subst_to = cn->val.string[0]; - subst_offs = len+1; - goto replace; - } - } - } - Message(PCB_MSG_DEFAULT, "can't resolve conf-hash dir required for path %s\n", *in); - *out = NULL; - } - else - *out = NULL; - } - else { - *out = malloc(strlen(*in) + 1 + extra_room); - strcpy(*out, *in); - } - } - else - *out = NULL; - } -} - -void resolve_path(const char *in, char **out, unsigned int extra_room) -{ - resolve_paths(&in, out, 1, extra_room); -} - -char *resolve_path_inplace(char *in, unsigned int extra_room) -{ - char *out; - resolve_path(in, &out, extra_room); - free(in); - return out; -} Index: 1.1.4/src/action_helper.h =================================================================== --- 1.1.4/src/action_helper.h (revision 10776) +++ 1.1.4/src/action_helper.h (nonexistent) @@ -1,76 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for action routines */ - -#ifndef PCB_ACTION_HELPER_H -#define PCB_ACTION_HELPER_H - -#include "global.h" - -#define CLONE_TYPES PCB_TYPE_LINE | PCB_TYPE_ARC | PCB_TYPE_VIA | PCB_TYPE_POLYGON - -void ActionAdjustStyle(char *); -void EventMoveCrosshair(int, int); - -void AdjustAttachedObjects(void); - -void warpNoWhere(void); - -/* In gui-misc.c */ -pcb_bool ActionGetLocation(char *); -void ActionGetXY(char *); - -#define ACTION_ARG(n) (argc > (n) ? argv[n] : NULL) - -int get_style_size(int funcid, Coord * out, int type, int size_id); - -extern int defer_updates; -extern int defer_needs_update; -extern LayerTypePtr lastLayer; - -void NotifyLine(void); -void NotifyBlock(void); -void NotifyMode(void); -void ClearWarnings(void); - -typedef struct { - Coord X, Y; - pcb_cardinal_t Buffer; - pcb_bool Click; - pcb_bool Moving; /* selected type clicked on */ - int Hit; /* move type clicked on */ - void *ptr1; - void *ptr2; - void *ptr3; -} action_note_t; - -extern action_note_t Note; -extern pcb_bool saved_mode; - -void ReleaseMode(void); - -#endif Index: 1.1.4/src/obj_any.c =================================================================== --- 1.1.4/src/obj_any.c (revision 10776) +++ 1.1.4/src/obj_any.c (nonexistent) @@ -1,27 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* object model - type+union that can represent any object */ - -#define TDL_DONT_UNDEF -#include "obj_any.h" -#include Index: 1.1.4/src/netlist.c =================================================================== --- 1.1.4/src/netlist.c (revision 10776) +++ 1.1.4/src/netlist.c (nonexistent) @@ -1,257 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* generic netlist operations - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "action_helper.h" -#include "data.h" -#include "error.h" -#include "plug_io.h" -#include "find.h" -#include "mymem.h" -#include "rats.h" -#include "create.h" -#include "rats_patch.h" -#include "hid_actions.h" -#include "compat_misc.h" -#include "netlist.h" - -/* - int PCB->NetlistLib[n].MenuN - char * PCB->NetlistLib[n].Menu[i].Name - [0] == '*' (ok for rats) or ' ' (skip for rats) - [1] == unused - [2..] actual name - char * PCB->NetlistLib[n].Menu[i].Style - int PCB->NetlistLib[n].Menu[i].EntryN - char * PCB->NetlistLib[n].Menu[i].Entry[j].ListEntry -*/ - -void pcb_netlist_changed(int force_unfreeze) -{ - if (force_unfreeze) - PCB->netlist_frozen = 0; - if (PCB->netlist_frozen) - PCB->netlist_needs_update = 1; - else { - PCB->netlist_needs_update = 0; - hid_action("NetlistChanged"); - } -} - -LibraryMenuTypePtr pcb_netnode_to_netname(const char *nodename) -{ - int i, j; - /*printf("nodename [%s]\n", nodename); */ - for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) { - for (j = 0; j < PCB->NetlistLib[NETLIST_EDITED].Menu[i].EntryN; j++) { - if (strcmp(PCB->NetlistLib[NETLIST_EDITED].Menu[i].Entry[j].ListEntry, nodename) == 0) { - /*printf(" in [%s]\n", PCB->NetlistLib.Menu[i].Name); */ - return &(PCB->NetlistLib[NETLIST_EDITED].Menu[i]); - } - } - } - return 0; -} - -LibraryMenuTypePtr pcb_netname_to_netname(const char *netname) -{ - int i; - - if ((netname[0] == '*' || netname[0] == ' ') && netname[1] == ' ') { - /* Looks like we were passed an internal netname, skip the prefix */ - netname += 2; - } - for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) { - if (strcmp(PCB->NetlistLib[NETLIST_EDITED].Menu[i].Name + 2, netname) == 0) { - return &(PCB->NetlistLib[NETLIST_EDITED].Menu[i]); - } - } - return 0; -} - -int pcb_pin_name_to_xy(LibraryEntryType * pin, Coord *x, Coord *y) -{ - ConnectionType conn; - if (!SeekPad(pin, &conn, pcb_false)) - return 1; - switch (conn.type) { - case PCB_TYPE_PIN: - *x = ((PinType *) (conn.ptr2))->X; - *y = ((PinType *) (conn.ptr2))->Y; - return 0; - case PCB_TYPE_PAD: - *x = ((PadType *) (conn.ptr2))->Point1.X; - *y = ((PadType *) (conn.ptr2))->Point1.Y; - return 0; - } - return 1; -} - -void pcb_netlist_find(LibraryMenuType * net, LibraryEntryType * pin) -{ - Coord x, y; - if (pcb_pin_name_to_xy(net->Entry, &x, &y)) - return; - LookupConnection(x, y, 1, 1, PCB_FLAG_FOUND); -} - -void pcb_netlist_select(LibraryMenuType * net, LibraryEntryType * pin) -{ - Coord x, y; - if (pcb_pin_name_to_xy(net->Entry, &x, &y)) - return; - LookupConnection(x, y, 1, 1, PCB_FLAG_SELECTED); -} - -void pcb_netlist_rats(LibraryMenuType * net, LibraryEntryType * pin) -{ - net->Name[0] = ' '; - net->flag = 1; - pcb_netlist_changed(0); -} - -void pcb_netlist_norats(LibraryMenuType * net, LibraryEntryType * pin) -{ - net->Name[0] = '*'; - net->flag = 0; - pcb_netlist_changed(0); -} - -/* The primary purpose of this action is to remove the netlist - completely so that a new one can be loaded, usually via a gsch2pcb - style script. */ -void pcb_netlist_clear(LibraryMenuType * net, LibraryEntryType * pin) -{ - LibraryType *netlist = (LibraryType *) & PCB->NetlistLib; - int ni, pi; - - if (net == 0) { - /* Clear the entire netlist. */ - for (ni = 0; ni < NUM_NETLISTS; ni++) - FreeLibraryMemory(&(PCB->NetlistLib[ni])); - } - else if (pin == 0) { - /* Remove a net from the netlist. */ - ni = net - netlist->Menu; - if (ni >= 0 && ni < netlist->MenuN) { - /* if there is exactly one item, MenuN is 1 and ni is 0 */ - if (netlist->MenuN - ni > 1) - memmove(net, net + 1, (netlist->MenuN - ni - 1) * sizeof(*net)); - netlist->MenuN--; - } - } - else { - /* Remove a pin from the given net. Note that this may leave an - empty net, which is different than removing the net - (above). */ - pi = pin - net->Entry; - if (pi >= 0 && pi < net->EntryN) { - /* if there is exactly one item, MenuN is 1 and ni is 0 */ - if (net->EntryN - pi > 1) - memmove(pin, pin + 1, (net->EntryN - pi - 1) * sizeof(*pin)); - net->EntryN--; - } - } - pcb_netlist_changed(0); -} - -void pcb_netlist_style(LibraryMenuType * net, const char *style) -{ - free(net->Style); - net->Style = pcb_strdup_null((char *) style); -} - -LibraryMenuTypePtr pcb_netlist_find_net4pinname(PCBTypePtr pcb, const char *pin) -{ - int n; - - for (n = 0; n < pcb->NetlistLib[NETLIST_EDITED].MenuN; n++) { - LibraryMenuTypePtr menu = &pcb->NetlistLib[NETLIST_EDITED].Menu[n]; - int p; - for (p = 0; p < menu->EntryN; p++) { - LibraryEntryTypePtr entry = &menu->Entry[p]; - if (strcmp(entry->ListEntry, pin) == 0) - return menu; - } - } - return NULL; -} - -static LibraryMenuTypePtr pcb_netlist_find_net4pin_any(PCBTypePtr pcb, const char *ename, const char *pname) -{ - char pinname[256]; - int len; - - if ((ename == NULL) || (pname == NULL)) - return NULL; - - len = pcb_snprintf(pinname, sizeof(pinname), "%s-%s", ename, pname); - if (len >= sizeof(pinname)) - return NULL; - - return pcb_netlist_find_net4pinname(pcb, pinname); -} - -LibraryMenuTypePtr pcb_netlist_find_net4pin(PCBTypePtr pcb, const PinType *pin) -{ - const ElementType *e = pin->Element; - - if (e == NULL) - return NULL; - - return pcb_netlist_find_net4pin_any(pcb, e->Name[NAMEONPCB_INDEX].TextString, pin->Number); -} - - -LibraryMenuTypePtr pcb_netlist_find_net4pad(PCBTypePtr pcb, const PadType *pad) -{ - const ElementType *e = pad->Element; - - if (e == NULL) - return NULL; - - return pcb_netlist_find_net4pin_any(pcb, e->Name[NAMEONPCB_INDEX].TextString, pad->Number); -} - -pcb_cardinal_t pcb_netlist_net_idx(PCBTypePtr pcb, LibraryMenuType *net) -{ - LibraryMenuType *first = &pcb->NetlistLib[NETLIST_EDITED].Menu[0]; - LibraryMenuType *last = &pcb->NetlistLib[NETLIST_EDITED].Menu[pcb->NetlistLib[NETLIST_EDITED].MenuN-1]; - - if ((net < first) || (net > last)) - return PCB_NETLIST_INVALID_INDEX; - - return net - first; -} Index: 1.1.4/src/heap.h =================================================================== --- 1.1.4/src/heap.h (revision 10776) +++ 1.1.4/src/heap.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, heap.h, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* prototypes for heap routines. - */ - -#ifndef PCB_HEAP_H -#define PCB_HEAP_H - -#include "global.h" - -/* type of heap costs */ -typedef double cost_t; -/* what a heap looks like */ -typedef struct heap_struct heap_t; - -/* create an empty heap */ -heap_t *heap_create(); -/* destroy a heap */ -void heap_destroy(heap_t ** heap); -/* free all elements in a heap */ -void heap_free(heap_t * heap, void (*funcfree) (void *)); - -/* -- mutation -- */ -void heap_insert(heap_t * heap, cost_t cost, void *data); -void *heap_remove_smallest(heap_t * heap); -/* replace the smallest item with a new item and return the smallest item. - * (if the new item is the smallest, than return it, instead.) */ -void *heap_replace(heap_t * heap, cost_t cost, void *data); - -/* -- interrogation -- */ -int heap_is_empty(heap_t * heap); -int heap_size(heap_t * heap); - -#endif /* PCB_HEAP_H */ Index: 1.1.4/src/hid_cfg.c =================================================================== --- 1.1.4/src/hid_cfg.c (revision 10776) +++ 1.1.4/src/hid_cfg.c (nonexistent) @@ -1,516 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include - -#include "global.h" -#include "hid_cfg.h" -#include "error.h" -#include "paths.h" -#include "compat_misc.h" - -char hid_cfg_error_shared[1024]; - -typedef struct { - hid_cfg_t *hr; - create_menu_widget_t cb; - void *cb_ctx; - lht_node_t *parent; - const char *action; - const char *mnemonic; - const char *accel; - const char *tip; - const char *cookie; - int target_level; - int err; -} create_menu_ctx_t; - -static lht_node_t *create_menu_cb(void *ctx, lht_node_t *node, const char *path, int rel_level) -{ - create_menu_ctx_t *cmc = ctx; - lht_node_t *psub; - -/* printf(" CB: '%s' %p at %d->%d\n", path, node, rel_level, cmc->target_level);*/ - if (node == NULL) { /* level does not exist, create it */ - const char *name; - name = strrchr(path, '/'); - if (name != NULL) - name++; - else - name = path; - - if (rel_level <= 1) { - /* creating a main menu */ - char *end, *name = pcb_strdup(path); - for(end = name; *end == '/'; end++) ; - end = strchr(end, '/'); - *end = '\0'; - psub = cmc->parent = hid_cfg_get_menu(cmc->hr, name); - free(name); - } - else - psub = hid_cfg_menu_field(cmc->parent, MF_SUBMENU, NULL); - - if (rel_level == cmc->target_level) { - node = hid_cfg_create_hash_node(psub, name, "dyn", "1", "m", "cookie", cmc->cookie, cmc->mnemonic, "a", cmc->accel, "tip", cmc->tip, ((cmc->action != NULL) ? "action": NULL), cmc->action, NULL); - if (node != NULL) - cmc->err = 0; - } - else - node = hid_cfg_create_hash_node(psub, name, "dyn", "1", "cookie", cmc->cookie, NULL); - - if (node == NULL) - return NULL; - - if ((rel_level != cmc->target_level) || (cmc->action == NULL)) - lht_dom_hash_put(node, lht_dom_node_alloc(LHT_LIST, "submenu")); - - if (node->parent == NULL) - lht_dom_list_append(psub, node); - else - assert(node->parent == psub); - - if (cmc->cb(cmc->cb_ctx, path, name, (rel_level == 1), cmc->parent, node) != 0) { - cmc->err = -1; - return NULL; - } - } - cmc->parent = node; - return node; -} - -int hid_cfg_create_menu(hid_cfg_t *hr, const char *path, const char *action, const char *mnemonic, const char *accel, const char *tip, const char *cookie, create_menu_widget_t cb, void *cb_ctx) -{ - const char *name; - create_menu_ctx_t cmc; - - cmc.hr = hr; - cmc.cb = cb; - cmc.cb_ctx = cb_ctx; - cmc.parent = NULL; - cmc.action = action; - cmc.mnemonic = mnemonic; - cmc.accel = accel; - cmc.tip = tip; - cmc.cookie = cookie; - cmc.err = -1; - - /* Allow creating new nodes only under certain main paths that correspond to menus */ - name = path; - while(*name == '/') name++; - - if ((strncmp(name, "main_menu/", 10) == 0) || (strncmp(name, "popups/", 7) == 0)) { - /* calculate target level */ - for(cmc.target_level = 0; *name != '\0'; name++) { - if (*name == '/') { - cmc.target_level++; - while(*name == '/') name++; - name--; - } - } - - /* descend and visit each level, create missing levels */ - - hid_cfg_get_menu_at(hr, NULL, path, create_menu_cb, &cmc); - } - - return cmc.err; -} - -static int hid_cfg_remove_item(hid_cfg_t *hr, lht_node_t *item, int (*gui_remove)(void *ctx, lht_node_t *nd), void *ctx) -{ - if (gui_remove(ctx, item) != 0) - return -1; - lht_tree_del(item); - return 0; -} - - -static int hid_cfg_remove_menu_(hid_cfg_t *hr, lht_node_t *root, int (*gui_remove)(void *ctx, lht_node_t *nd), void *ctx) -{ - if (root == NULL) - return -1; - - if (root->type == LHT_HASH) { - lht_node_t *psub, *n, *next; - psub = hid_cfg_menu_field(root, MF_SUBMENU, NULL); - if (psub != NULL) { /* remove a whole submenu with all children */ - int res = 0; - for(n = psub->data.list.first; n != NULL; n = next) { - next = n->next; - if (hid_cfg_remove_menu_(hr, n, gui_remove, ctx) != 0) - res = -1; - } - if (res == 0) - res = hid_cfg_remove_item(hr, root, gui_remove, ctx); - return res; - } - } - - if ((root->type != LHT_TEXT) && (root->type != LHT_HASH)) /* allow text for the sep */ - return -1; - - /* remove a simple menu item */ - return hid_cfg_remove_item(hr, root, gui_remove, ctx); -} - -int hid_cfg_remove_menu(hid_cfg_t *hr, const char *path, int (*gui_remove)(void *ctx, lht_node_t *nd), void *ctx) -{ - return hid_cfg_remove_menu_(hr, hid_cfg_get_menu_at(hr, NULL, path, NULL, NULL), gui_remove, ctx); -} - - -static int hid_cfg_load_error(lht_doc_t *doc, const char *filename, lht_err_t err) -{ - const char *fn; - int line, col; - lht_dom_loc_active(doc, &fn, &line, &col); - Message(PCB_MSG_DEFAULT, "Resource error: %s (%s:%d.%d)*\n", lht_err_str(err), filename, line+1, col+1); - return 1; -} - -lht_doc_t *hid_cfg_load_lht(const char *filename) -{ - FILE *f; - lht_doc_t *doc; - int error = 0; - char *efn; - - resolve_path(filename, &efn, 0); - - f = fopen(efn, "r"); - if (f == NULL) { - free(efn); - return NULL; - } - doc = lht_dom_init(); - lht_dom_loc_newfile(doc, efn); - - while(!(feof(f))) { - lht_err_t err; - int c = fgetc(f); - err = lht_dom_parser_char(doc, c); - if (err != LHTE_SUCCESS) { - if (err != LHTE_STOP) { - error = hid_cfg_load_error(doc, efn, err); - break; - } - break; /* error or stop, do not read anymore (would get LHTE_STOP without any processing all the time) */ - } - } - - if (error) { - lht_dom_uninit(doc); - doc = NULL; - } - fclose(f); - - free(efn); - return doc; -} - -lht_doc_t *hid_cfg_load_str(const char *text) -{ - lht_doc_t *doc; - int error = 0; - - doc = lht_dom_init(); - lht_dom_loc_newfile(doc, "embedded"); - - while(*text != '\0') { - lht_err_t err; - int c = *text++; - err = lht_dom_parser_char(doc, c); - if (err != LHTE_SUCCESS) { - if (err != LHTE_STOP) { - error = hid_cfg_load_error(doc, "internal", err); - break; - } - break; /* error or stop, do not read anymore (would get LHTE_STOP without any processing all the time) */ - } - } - - if (error) { - lht_dom_uninit(doc); - doc = NULL; - } - - return doc; -} - -const char *hid_cfg_text_value(lht_doc_t *doc, const char *path) -{ - lht_node_t *n = lht_tree_path(doc, "/", path, 1, NULL); - if (n == NULL) - return NULL; - if (n->type != LHT_TEXT) { - hid_cfg_error(n, "Error: node %s should be a text node\n", path); - return NULL; - } - return n->data.text.value; -} - -hid_cfg_t *hid_cfg_load(const char *fn, int exact_fn, const char *embedded_fallback) -{ - lht_doc_t *doc; - hid_cfg_t *hr; - - if (!exact_fn) { - /* try different paths to find the menu file inventing its exact name */ - static const char *hid_cfg_paths_in[] = { "./", PCBSHAREDIR "/", NULL }; - char **paths = NULL, **p; - int fn_len = strlen(fn); - - doc = NULL; - resolve_all_paths(hid_cfg_paths_in, paths, fn_len+32); - for(p = paths; *p != NULL; p++) { - if (doc == NULL) { - char *end = *p + strlen(*p); - sprintf(end, "pcb-menu-%s.lht", fn); - doc = hid_cfg_load_lht(*p); - if (doc != NULL) - Message(PCB_MSG_DEFAULT, "Loaded menu file '%s'\n", *p); - } - free(*p); - } - free(paths); - } - else - doc = hid_cfg_load_lht(fn); - - if (doc == NULL) - doc = hid_cfg_load_str(embedded_fallback); - if (doc == NULL) - return NULL; - - hr = calloc(sizeof(hid_cfg_t), 1); /* make sure the cache is cleared */ - hr->doc = doc; - - return hr; -} - -/************* "parsing" **************/ - -lht_node_t *hid_cfg_get_menu_at(hid_cfg_t *hr, lht_node_t *at, const char *menu_path, lht_node_t *(*cb)(void *ctx, lht_node_t *node, const char *path, int rel_level), void *ctx) -{ - lht_err_t err; - lht_node_t *curr; - int level = 0, len = strlen(menu_path); - char *next_seg, *path; - - path = malloc(len+4); /* need a few bytes after the end for the ':' */ - strcpy(path, menu_path); - - next_seg = path; - curr = (at == NULL) ? hr->doc->root : at; - - /* Have to descend manually because of the submenu nodes */ - for(;;) { - char *next, *end, save; - while(*next_seg == '/') next_seg++; - if (curr != hr->doc->root) { - if (level > 1) { - curr = lht_tree_path_(hr->doc, curr, "submenu", 1, 0, &err); - if (curr == NULL) - break; - } - } - next = end = strchr(next_seg, '/'); - if (end == NULL) - end = next_seg + strlen(next_seg); - - if (level > 0) - *end = ':'; - else - *end = '\0'; - end++; - save = *end; - *end = '\0'; - - curr = lht_tree_path_(hr->doc, curr, next_seg, 1, 0, &err); - if (cb != NULL) { - end[-1] = '\0'; - curr = cb(ctx, curr, path, level); - } - - *end = save; - if (next != NULL) /* restore previous / so that path is a full path */ - *next = '/'; - next_seg = next; - if ((curr == NULL) || (next_seg == NULL)) - break; - next_seg++; - level++; - } - - free(path); - return curr; -} - -lht_node_t *hid_cfg_get_menu(hid_cfg_t *hr, const char *menu_path) -{ - return hid_cfg_get_menu_at(hr, NULL, menu_path, NULL, NULL); -} - -lht_node_t *hid_cfg_menu_field(const lht_node_t *submenu, hid_cfg_menufield_t field, const char **field_name) -{ - lht_err_t err; - const char *fieldstr = NULL; - - switch(field) { - case MF_ACCELERATOR: fieldstr = "a"; break; - case MF_MNEMONIC: fieldstr = "m"; break; - case MF_SUBMENU: fieldstr = "submenu"; break; - case MF_CHECKED: fieldstr = "checked"; break; - case MF_UPDATE_ON: fieldstr = "update_on"; break; - case MF_SENSITIVE: fieldstr = "sensitive"; break; - case MF_TIP: fieldstr = "tip"; break; - case MF_ACTIVE: fieldstr = "active"; break; - case MF_ACTION: fieldstr = "action"; break; - case MF_FOREGROUND: fieldstr = "foreground"; break; - case MF_BACKGROUND: fieldstr = "background"; break; - case MF_FONT: fieldstr = "font"; break; -/* case MF_RADIO: fieldstr = "radio"; break; */ - } - if (field_name != NULL) - *field_name = fieldstr; - - if (fieldstr == NULL) - return NULL; - - return lht_tree_path_(submenu->doc, submenu, fieldstr, 1, 0, &err); -} - -const char *hid_cfg_menu_field_str(const lht_node_t *submenu, hid_cfg_menufield_t field) -{ - const char *fldname; - lht_node_t *n = hid_cfg_menu_field(submenu, field, &fldname); - - if (n == NULL) - return NULL; - if (n->type != LHT_TEXT) { - hid_cfg_error(submenu, "Error: field %s should be a text node\n", fldname); - return NULL; - } - return n->data.text.value; -} - -int hid_cfg_has_submenus(const lht_node_t *submenu) -{ - const char *fldname; - lht_node_t *n = hid_cfg_menu_field(submenu, MF_SUBMENU, &fldname); - if (n == NULL) - return 0; - if (n->type != LHT_LIST) { - hid_cfg_error(submenu, "Error: field %s should be a list (of submenus)\n", fldname); - return 0; - } - return 1; -} - - -void hid_cfg_extend_hash_nodev(lht_node_t *node, va_list ap) -{ - for(;;) { - char *cname, *cval; - lht_node_t *t; - - cname = va_arg(ap, char *); - if (cname == NULL) - break; - cval = va_arg(ap, char *); - - if (cval != NULL) { - t = lht_dom_node_alloc(LHT_TEXT, cname); - t->data.text.value = pcb_strdup(cval); - lht_dom_hash_put(node, t); - } - } -} - -void hid_cfg_extend_hash_node(lht_node_t *node, ...) -{ - va_list ap; - va_start(ap, node); - hid_cfg_extend_hash_nodev(node, ap); - va_end(ap); -} - -lht_node_t *hid_cfg_create_hash_node(lht_node_t *parent, const char *name, ...) -{ - lht_node_t *n; - va_list ap; - - if ((parent != NULL) && (parent->type != LHT_LIST)) - return NULL; - - n = lht_dom_node_alloc(LHT_HASH, name); - if (parent != NULL) - lht_dom_list_append(parent, n); - - va_start(ap, name); - hid_cfg_extend_hash_nodev(n, ap); - va_end(ap); - - return n; -} - -lht_node_t *hid_cfg_menu_field_path(const lht_node_t *parent, const char *path) -{ - return lht_tree_path_(parent->doc, parent, path, 1, 0, NULL); -} - -int hid_cfg_dfs(lht_node_t *parent, int (*cb)(void *ctx, lht_node_t *n), void *ctx) -{ - lht_dom_iterator_t it; - lht_node_t *n; - - for(n = lht_dom_first(&it, parent); n != NULL; n = lht_dom_next(&it)) { - int ret; - ret = cb(ctx, n); - if (ret != 0) - return ret; - if (n->type != LHT_TEXT) { - ret = hid_cfg_dfs(n, cb, ctx); - if (ret != 0) - return ret; - } - } - return 0; -} - -/* extern char hid_cfg_error_shared[]; */ -void hid_cfg_error(const lht_node_t *node, const char *fmt, ...) -{ - char *end; - va_list ap; - - end = hid_cfg_error_shared + sprintf(hid_cfg_error_shared, "Error in lihata node %s:%d.%d:", node->file_name, node->line, node->col); - va_start(ap, fmt); - end += vsprintf(end, fmt, ap); - va_end(ap); - Message(PCB_MSG_DEFAULT, hid_cfg_error_shared); -} Index: 1.1.4/src/hid_actions.c =================================================================== --- 1.1.4/src/hid_actions.c (revision 10776) +++ 1.1.4/src/hid_actions.c (nonexistent) @@ -1,517 +0,0 @@ -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include - -#include -#include - -#include "error.h" -#include "event.h" -#include "hid_actions.h" -#include "compat_misc.h" - -/* do not throw "unknown action" warning for these: they are known - actions, the GUI HID may register them, but nothing bad happens if - they are not registered or not handled by the GUI. */ -static const char *action_no_warn[] = { - "LayersChanged", "PointCursor", "LibraryChanged", "RouteStylesChanged", - NULL -}; -static int action_legal_unknown(const char *name) -{ - const char **s; - for(s = action_no_warn; *s != NULL; s++) - if (strcmp(*s, name) == 0) - return 1; - return 0; -} - -static htsp_t *all_actions = NULL; -const HID_Action *current_action = NULL; - -static const char *check_action_name(const char *s) -{ - while (*s) - if (isspace((int) *s++) || *s == '(') - return (s - 1); - return NULL; -} - -typedef struct { - const char *cookie; - const HID_Action *action; -} hid_cookie_action_t; - -void hid_register_actions(const HID_Action * a, int n, const char *cookie, int copy) -{ - int i; - hid_cookie_action_t *ca; - - if (all_actions == NULL) - all_actions = htsp_alloc(strhash_case, strkeyeq_case); - - for (i = 0; i < n; i++) { - if (check_action_name(a[i].name)) { - Message(PCB_MSG_DEFAULT, _("ERROR! Invalid action name, " "action \"%s\" not registered.\n"), a[i].name); - continue; - } - if (htsp_get(all_actions, a[i].name) != NULL) { - Message(PCB_MSG_DEFAULT, _("ERROR! Invalid action name, " "action \"%s\" is already registered.\n"), a[i].name); - continue; - } - ca = malloc(sizeof(hid_cookie_action_t)); - ca->cookie = cookie; - ca->action = a+i; - htsp_set(all_actions, pcb_strdup(a[i].name), ca); - } -} - -void hid_register_action(const HID_Action * a, const char *cookie, int copy) -{ - hid_register_actions(a, 1, cookie, copy); -} - -void hid_remove_actions(const HID_Action * a, int n) -{ - int i; - - if (all_actions == NULL) - return; - - for (i = 0; i < n; i++) { - htsp_entry_t *e; - e = htsp_popentry(all_actions, a[i].name); - free(e->key); - free(e->value); - } -} - -void hid_remove_actions_by_cookie(const char *cookie) -{ - htsp_entry_t *e; - - if (all_actions == NULL) - return; - - /* Slow linear search - probably OK, this will run only on uninit */ - for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { - hid_cookie_action_t *ca = e->value; - if (ca->cookie == cookie) { - htsp_pop(all_actions, e->key); - free(e->key); - free(e->value); - } - } -} - -void hid_remove_action(const HID_Action * a) -{ - htsp_entry_t *e; - - if (all_actions == NULL) - return; - - e = htsp_popentry(all_actions, a->name); - if (e != NULL) { - free(e->key); - free(e->value); - } -} - -const HID_Action *hid_find_action(const char *name) -{ - hid_cookie_action_t *ca; - - if ((name == NULL) && (all_actions == NULL)) - return 0; - - ca = htsp_get(all_actions, (char *) name); - - if (ca) - return ca->action; - - if (!action_legal_unknown(name)) - Message(PCB_MSG_DEFAULT, "unknown action `%s'\n", name); - return 0; -} - -void print_actions() -{ - htsp_entry_t *e; - - fprintf(stderr, "Registered Actions:\n"); - for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { - hid_cookie_action_t *ca = e->value; - if (ca->action->description) - fprintf(stderr, " %s - %s\n", ca->action->name, ca->action->description); - else - fprintf(stderr, " %s\n", ca->action->name); - if (ca->action->syntax) { - const char *bb, *eb; - bb = eb = ca->action->syntax; - while (1) { - for (eb = bb; *eb && *eb != '\n'; eb++); - fwrite(" ", 4, 1, stderr); - fwrite(bb, eb - bb, 1, stderr); - fputc('\n', stderr); - if (*eb == 0) - break; - bb = eb + 1; - } - } - } -} - -static void dump_string(char prefix, const char *str) -{ - int eol = 1; - while (*str) { - if (eol) { - putchar(prefix); - eol = 0; - } - putchar(*str); - if (*str == '\n') - eol = 1; - str++; - } - if (!eol) - putchar('\n'); -} - -void dump_actions(void) -{ - htsp_entry_t *e; - - fprintf(stderr, "Registered Actions:\n"); - for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { - hid_cookie_action_t *ca = e->value; - const char *desc = ca->action->description; - const char *synt = ca->action->syntax; - - desc = desc ? desc : ""; - synt = synt ? synt : ""; - - printf("A%s\n", ca->action->name); - dump_string('D', desc); - dump_string('S', synt); - } -} - -int hid_action(const char *name) -{ - return hid_actionv(name, 0, 0); -} - -int hid_actionl(const char *name, ...) -{ - const char *argv[20]; - int argc = 0; - va_list ap; - char *arg; - - va_start(ap, name); - while ((arg = va_arg(ap, char *)) != 0) - argv[argc++] = arg; - va_end(ap); - return hid_actionv(name, argc, argv); -} - -int hid_actionv_(const HID_Action *a, int argc, const char **argv) -{ - Coord x = 0, y = 0; - int i, ret; - const HID_Action *old_action; - - if (a->need_coord_msg) - gui->get_coords(_(a->need_coord_msg), &x, &y); - - if (conf_core.rc.verbose) { - printf("Action: \033[34m%s(", a->name); - for (i = 0; i < argc; i++) - printf("%s%s", i ? "," : "", argv[i]); - printf(")\033[0m\n"); - } - - old_action = current_action; - current_action = a; - ret = current_action->trigger_cb(argc, argv, x, y); - current_action = old_action; - - return ret; -} - -int hid_actionv(const char *name, int argc, const char **argv) -{ - const HID_Action *a; - - if (!name) - return 1; - - a = hid_find_action(name); - if (!a) { - int i; - if (action_legal_unknown(name)) - return 1; - Message(PCB_MSG_DEFAULT, "no action %s(", name); - for (i = 0; i < argc; i++) - Message(PCB_MSG_DEFAULT, "%s%s", i ? ", " : "", argv[i]); - Message(PCB_MSG_DEFAULT, ")\n"); - return 1; - } - return hid_actionv_(a, argc, argv); -} - -static int hid_parse_actionstring(const char *rstr, char require_parens) -{ - const char **list = NULL; - int max = 0; - int num; - char *str = NULL; - const char *sp; - char *cp, *aname, *cp2; - int maybe_empty = 0; - char in_quotes = 0; - char parens = 0; - int retcode = 0; - - /*fprintf(stderr, "invoke: `%s'\n", rstr); */ - - sp = rstr; - str = (char *) malloc(strlen(rstr) + 1); - -another: - num = 0; - cp = str; - - /* eat leading spaces and tabs */ - while (*sp && isspace((int) *sp)) - sp++; - - if (!*sp) { - retcode = 0; - goto cleanup; - } - - aname = cp; - - /* copy the action name, assumes name does not have a space or '(' - * in its name */ - while (*sp && !isspace((int) *sp) && *sp != '(') - *cp++ = *sp++; - *cp++ = 0; - - /* skip whitespace */ - while (*sp && isspace((int) *sp)) - sp++; - - /* - * we only have an action name, so invoke the action - * with no parameters or event. - */ - if (!*sp) { - retcode = hid_actionv(aname, 0, 0); - goto cleanup; - } - - /* are we using parenthesis? */ - if (*sp == '(') { - parens = 1; - sp++; - } - else if (require_parens) { - Message(PCB_MSG_DEFAULT, _("Syntax error: %s\n"), rstr); - Message(PCB_MSG_DEFAULT, _(" expected: Action(arg1, arg2)")); - retcode = 1; - goto cleanup; - } - - /* get the parameters to pass to the action */ - while (1) { - /* - * maybe_empty == 0 means that the last char examined was not a - * "," - */ - if (!maybe_empty && ((parens && *sp == ')') || (!parens && !*sp))) { - retcode = hid_actionv(aname, num, list); - if (retcode) - goto cleanup; - - /* strip any white space or ';' following the action */ - if (parens) - sp++; - while (*sp && (isspace((int) *sp) || *sp == ';')) - sp++; - goto another; - } - else if (*sp == 0 && !maybe_empty) - break; - else { - maybe_empty = 0; - in_quotes = 0; - /* - * if we have more parameters than memory in our array of - * pointers, then either allocate some or grow the array - */ - if (num >= max) { - max += 10; - if (list) - list = (const char **) realloc(list, max * sizeof(char *)); - else - list = (const char **) malloc(max * sizeof(char *)); - } - /* Strip leading whitespace. */ - while (*sp && isspace((int) *sp)) - sp++; - list[num++] = cp; - - /* search for the end of the argument, we want to keep going - * if we are in quotes or the char is not a delimiter - */ - while (*sp && (in_quotes || ((*sp != ',') - && (!parens || *sp != ')') - && (parens || !isspace((int) *sp))))) { - /* - * single quotes give literal value inside, including '\'. - * you can't have a single inside single quotes. - * doubles quotes gives literal value inside, but allows escape. - */ - if ((*sp == '"' || *sp == '\'') && (!in_quotes || *sp == in_quotes)) { - in_quotes = in_quotes ? 0 : *sp; - sp++; - continue; - } - /* unless within single quotes, \ will just be */ - else if (*sp == '\\' && in_quotes != '\'') - sp++; - *cp++ = *sp++; - } - cp2 = cp - 1; - *cp++ = 0; - if (*sp == ',' || (!parens && isspace((int) *sp))) { - maybe_empty = 1; - sp++; - } - /* Strip trailing whitespace. */ - for (; isspace((int) *cp2) && cp2 >= list[num - 1]; cp2--) - *cp2 = 0; - } - } - -cleanup: - - if (list != NULL) - free(list); - - if (str != NULL) - free(str); - - return retcode; -} - -int hid_parse_command(const char *str_) -{ - event(EVENT_CLI_ENTER, "s", str_); - return hid_parse_actionstring(str_, FALSE); -} - -int hid_parse_actions(const char *str_) -{ - return hid_parse_actionstring(str_, TRUE); -} - -void hid_actions_init(void) -{ - -} - -void hid_actions_uninit(void) -{ - htsp_entry_t *e; - - if (all_actions == NULL) - return; - - for (e = htsp_first(all_actions); e; e = htsp_next(all_actions, e)) { - hid_cookie_action_t *ca = e->value; - if (ca->cookie != NULL) - fprintf(stderr, "WARNING: hid_actions_uninit: action '%s' with cookie '%s' left registered, check your plugins!\n", e->key, ca->cookie); - free(e->key); - free(e->value); - } - - htsp_free(all_actions); - all_actions = NULL; -} - -/* trick for the doc extractor */ -#define static - -/* %start-doc actions 00macros - -@macro hidaction - -This is one of a number of actions which are part of the HID -interface. The core functions use these actions to tell the current -GUI when to change the presented information in response to changes -that the GUI may not know about. The user normally does not invoke -these directly. - -@end macro - -%end-doc */ - - -static const char pcbchanged_syntax[] = "PCBChanged([revert])"; -static const char pcbchanged_help[] = - "Tells the GUI that the whole PCB has changed. The optional \"revert\"" - "parameter can be used as a hint to the GUI that the same design is being" - "reloaded, and that it might keep some viewport settings"; - -/* %start-doc actions PCBChanged - -@hidaction - -%end-doc */ - -static const char routestyleschanged_syntax[] = "RouteStylesChanged()"; -static const char routestyleschanged_help[] = "Tells the GUI that the routing styles have changed."; - -/* %start-doc actions RouteStylesChanged - -@hidaction - -%end-doc */ - -static const char netlistchanged_syntax[] = "NetlistChanged()"; -static const char netlistchanged_help[] = "Tells the GUI that the netlist has changed."; - -/* %start-doc actions NetlistChanged - -@hidaction - -%end-doc */ - -static const char layerschanged_syntax[] = "LayersChanged()"; -static const char layerschanged_help[] = "Tells the GUI that the layers have changed."; - -/* %start-doc actions LayersChanged - -This includes layer names, colors, stacking order, visibility, etc. - -@hidaction - -%end-doc */ - -static const char librarychanged_syntax[] = "LibraryChanged()"; -static const char librarychanged_help[] = "Tells the GUI that the libraries have changed."; - -/* %start-doc actions LibraryChanged - -@hidaction - -%end-doc */ Index: 1.1.4/src/paths.h =================================================================== --- 1.1.4/src/paths.h (revision 10776) +++ 1.1.4/src/paths.h (nonexistent) @@ -1,23 +0,0 @@ - -/* Allocate *out and copy the path from in to out, replacing ~ with conf_core.rc.path.home - If extra_room is non-zero, allocate this many bytes extra for each slot; - this leaves some room to append a file name. */ -void resolve_path(const char *in, char **out, unsigned int extra_room); - -/* Same as resolve_path, but it returns the pointer to the new path and calls - free() on in */ -char *resolve_path_inplace(char *in, unsigned int extra_room); - - -/* Resolve all paths from a in[] into out[](should be large enough) */ -void resolve_paths(const char **in, char **out, int numpaths, unsigned int extra_room); - -/* Resolve all paths from a char *in[] into a freshly allocated char **out */ -#define resolve_all_paths(in, out, extra_room) \ -do { \ - int __numpath__ = sizeof(in) / sizeof(char *); \ - if (__numpath__ > 0) { \ - out = malloc(sizeof(char *) * __numpath__); \ - resolve_paths(in, out, __numpath__, extra_room); \ - } \ -} while(0) Index: 1.1.4/src/change.c =================================================================== --- 1.1.4/src/change.c (revision 10776) +++ 1.1.4/src/change.c (nonexistent) @@ -1,2746 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* functions used to change object properties - * - */ - -#include "config.h" - -#include -#include -#include - -#include "conf_core.h" - -#include "crosshair.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "misc.h" -#include "mirror.h" -#include "polygon.h" -#include "rtree.h" -#include "select.h" -#include "undo.h" -#include "hid_actions.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void *ChangePinSize(ElementTypePtr, PinTypePtr); -static void *ChangePinClearSize(ElementTypePtr, PinTypePtr); -static void *ChangePinMaskSize(ElementTypePtr, PinTypePtr); -static void *ChangePadSize(ElementTypePtr, PadTypePtr); -static void *ChangePadClearSize(ElementTypePtr, PadTypePtr); -static void *ChangePadMaskSize(ElementTypePtr, PadTypePtr); -static void *ChangePin2ndSize(ElementTypePtr, PinTypePtr); -static void *ChangeElement1stSize(ElementTypePtr); -static void *ChangeElement2ndSize(ElementTypePtr); -static void *ChangeViaSize(PinTypePtr); -static void *ChangeVia2ndSize(PinTypePtr); -static void *ChangeViaClearSize(PinTypePtr); -static void *ChangeViaMaskSize(PinTypePtr); -static void *ChangeLineSize(LayerTypePtr, LineTypePtr); -static void *ChangeLineClearSize(LayerTypePtr, LineTypePtr); -static void *ChangePolygonClearSize(LayerTypePtr, PolygonTypePtr); -static void *ChangeArcSize(LayerTypePtr, ArcTypePtr); -static void *ChangeArcClearSize(LayerTypePtr, ArcTypePtr); -static void *ChangeTextSize(LayerTypePtr, TextTypePtr); -static void *ChangeElementSize(ElementTypePtr); -static void *ChangeElementNameSize(ElementTypePtr); -static void *ChangeElementClearSize(ElementTypePtr); -static void *ChangePinName(ElementTypePtr, PinTypePtr); -static void *ChangePadName(ElementTypePtr, PadTypePtr); -static void *ChangePinNum(ElementTypePtr, PinTypePtr); -static void *ChangePadNum(ElementTypePtr, PadTypePtr); -static void *ChangeViaName(PinTypePtr); -static void *ChangeLineName(LayerTypePtr, LineTypePtr); -static void *ChangeElementName(ElementTypePtr); -static void *ChangeElementNonetlist(ElementTypePtr); -static void *ChangeTextName(LayerTypePtr, TextTypePtr); -static void *ChangeElementSquare(ElementTypePtr); -static void *SetElementSquare(ElementTypePtr); -static void *ClrElementSquare(ElementTypePtr); -static void *ChangeElementOctagon(ElementTypePtr); -static void *SetElementOctagon(ElementTypePtr); -static void *ClrElementOctagon(ElementTypePtr); -static void *ChangeViaSquare(PinTypePtr); -static void *ChangePinSquare(ElementTypePtr, PinTypePtr); -static void *SetPinSquare(ElementTypePtr, PinTypePtr); -static void *ClrPinSquare(ElementTypePtr, PinTypePtr); -static void *ChangePinOctagon(ElementTypePtr, PinTypePtr); -static void *SetPinOctagon(ElementTypePtr, PinTypePtr); -static void *ClrPinOctagon(ElementTypePtr, PinTypePtr); -static void *ChangeViaOctagon(PinTypePtr); -static void *SetViaOctagon(PinTypePtr); -static void *ClrViaOctagon(PinTypePtr); -static void *ChangePadSquare(ElementTypePtr, PadTypePtr); -static void *SetPadSquare(ElementTypePtr, PadTypePtr); -static void *ClrPadSquare(ElementTypePtr, PadTypePtr); -static void *ChangeViaThermal(PinTypePtr); -static void *ChangePinThermal(ElementTypePtr, PinTypePtr); -static void *ChangeLineJoin(LayerTypePtr, LineTypePtr); -static void *SetLineJoin(LayerTypePtr, LineTypePtr); -static void *ClrLineJoin(LayerTypePtr, LineTypePtr); -static void *ChangeArcJoin(LayerTypePtr, ArcTypePtr); -static void *SetArcJoin(LayerTypePtr, ArcTypePtr); -static void *ClrArcJoin(LayerTypePtr, ArcTypePtr); -static void *ChangeTextJoin(LayerTypePtr, TextTypePtr); -static void *SetTextJoin(LayerTypePtr, TextTypePtr); -static void *ClrTextJoin(LayerTypePtr, TextTypePtr); -static void *ChangePolyClear(LayerTypePtr, PolygonTypePtr); -static void *ChangeArcRadius(LayerTypePtr, ArcTypePtr); -static void *ChangeArcAngle(LayerTypePtr, ArcTypePtr); - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static Coord Delta; /* change of size */ -static Coord Absolute; /* Absolute size */ -static int is_primary; /* whether the primary parameter should be changed */ -static char *NewName; /* new name */ - -static Angle ADelta, AAbsolute; /* same as above, but for angles */ - -static ObjectFunctionType ChangeSizeFunctions = { - ChangeLineSize, - ChangeTextSize, - ChangePolyClear, - ChangeViaSize, - ChangeElementSize, /* changes silk screen line width */ - ChangeElementNameSize, - ChangePinSize, - ChangePadSize, - NULL, - NULL, - ChangeArcSize, - NULL -}; - -static ObjectFunctionType Change1stSizeFunctions = { - ChangeLineSize, - ChangeTextSize, - ChangePolyClear, - ChangeViaSize, - ChangeElement1stSize, - ChangeElementNameSize, - ChangePinSize, - ChangePadSize, - NULL, - NULL, - ChangeArcSize, - NULL -}; - -static ObjectFunctionType Change2ndSizeFunctions = { - NULL, - NULL, - NULL, - ChangeVia2ndSize, - ChangeElement2ndSize, - NULL, - ChangePin2ndSize, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangeThermalFunctions = { - NULL, - NULL, - NULL, - ChangeViaThermal, - NULL, - NULL, - ChangePinThermal, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangeClearSizeFunctions = { - ChangeLineClearSize, - NULL, - ChangePolygonClearSize, /* just to tell the user not to :-) */ - ChangeViaClearSize, - ChangeElementClearSize, - NULL, - ChangePinClearSize, - ChangePadClearSize, - NULL, - NULL, - ChangeArcClearSize, - NULL -}; - -static ObjectFunctionType ChangeNameFunctions = { - ChangeLineName, - ChangeTextName, - NULL, - ChangeViaName, - ChangeElementName, - NULL, - ChangePinName, - ChangePadName, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangePinnumFunctions = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ChangePinNum, - ChangePadNum, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangeSquareFunctions = { - NULL, - NULL, - NULL, - ChangeViaSquare, - ChangeElementSquare, - NULL, - ChangePinSquare, - ChangePadSquare, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangeNonetlistFunctions = { - NULL, - NULL, - NULL, - NULL, - ChangeElementNonetlist, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangeJoinFunctions = { - ChangeLineJoin, - ChangeTextJoin, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ChangeArcJoin, - NULL -}; - -static ObjectFunctionType ChangeOctagonFunctions = { - NULL, - NULL, - NULL, - ChangeViaOctagon, - ChangeElementOctagon, - NULL, - ChangePinOctagon, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangeMaskSizeFunctions = { - NULL, - NULL, - NULL, - ChangeViaMaskSize, -#if 0 - ChangeElementMaskSize, -#else - NULL, -#endif - NULL, - ChangePinMaskSize, - ChangePadMaskSize, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType SetSquareFunctions = { - NULL, - NULL, - NULL, - NULL, - SetElementSquare, - NULL, - SetPinSquare, - SetPadSquare, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType SetJoinFunctions = { - SetLineJoin, - SetTextJoin, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - SetArcJoin, - NULL -}; - -static ObjectFunctionType SetOctagonFunctions = { - NULL, - NULL, - NULL, - SetViaOctagon, - SetElementOctagon, - NULL, - SetPinOctagon, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ClrSquareFunctions = { - NULL, - NULL, - NULL, - NULL, - ClrElementSquare, - NULL, - ClrPinSquare, - ClrPadSquare, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ClrJoinFunctions = { - ClrLineJoin, - ClrTextJoin, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ClrArcJoin, - NULL -}; - -static ObjectFunctionType ClrOctagonFunctions = { - NULL, - NULL, - NULL, - ClrViaOctagon, - ClrElementOctagon, - NULL, - ClrPinOctagon, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -static ObjectFunctionType ChangeRadiusFunctions = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ChangeArcRadius, - NULL -}; - -static ObjectFunctionType ChangeAngleFunctions = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ChangeArcAngle, - NULL -}; - - -/* --------------------------------------------------------------------------- - * changes the thermal on a via - * returns TRUE if changed - */ -static void *ChangeViaThermal(PinTypePtr Via) -{ - AddObjectToClearPolyUndoList(PCB_TYPE_VIA, Via, Via, Via, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, CURRENT, Via); - AddObjectToFlagUndoList(PCB_TYPE_VIA, Via, Via, Via); - if (!Delta) /* remove the thermals */ - CLEAR_THERM(INDEXOFCURRENT, Via); - else - ASSIGN_THERM(INDEXOFCURRENT, Delta, Via); - AddObjectToClearPolyUndoList(PCB_TYPE_VIA, Via, Via, Via, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, CURRENT, Via); - DrawVia(Via); - return Via; -} - -/* --------------------------------------------------------------------------- - * changes the thermal on a pin - * returns TRUE if changed - */ -static void *ChangePinThermal(ElementTypePtr element, PinTypePtr Pin) -{ - AddObjectToClearPolyUndoList(PCB_TYPE_PIN, element, Pin, Pin, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, CURRENT, Pin); - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, Pin, Pin); - if (!Delta) /* remove the thermals */ - CLEAR_THERM(INDEXOFCURRENT, Pin); - else - ASSIGN_THERM(INDEXOFCURRENT, Delta, Pin); - AddObjectToClearPolyUndoList(PCB_TYPE_PIN, element, Pin, Pin, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, CURRENT, Pin); - DrawPin(Pin); - return Pin; -} - -/* --------------------------------------------------------------------------- - * changes the size of a via - * returns TRUE if changed - */ -static void *ChangeViaSize(PinTypePtr Via) -{ - Coord value = Absolute ? Absolute : Via->Thickness + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Via)) - return (NULL); - if (!TEST_FLAG(PCB_FLAG_HOLE, Via) && value <= MAX_PINORVIASIZE && - value >= MIN_PINORVIASIZE && value >= Via->DrillingHole + MIN_PINORVIACOPPER && value != Via->Thickness) { - AddObjectToSizeUndoList(PCB_TYPE_VIA, Via, Via, Via); - EraseVia(Via); - r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Via, Via); - if (Via->Mask) { - AddObjectToMaskSizeUndoList(PCB_TYPE_VIA, Via, Via, Via); - Via->Mask += value - Via->Thickness; - } - Via->Thickness = value; - SetPinBoundingBox(Via); - r_insert_entry(PCB->Data->via_tree, (BoxType *) Via, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - DrawVia(Via); - return (Via); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the drilling hole of a via - * returns TRUE if changed - */ -static void *ChangeVia2ndSize(PinTypePtr Via) -{ - Coord value = (Absolute) ? Absolute : Via->DrillingHole + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Via)) - return (NULL); - if (value <= MAX_PINORVIASIZE && - value >= MIN_PINORVIAHOLE && (TEST_FLAG(PCB_FLAG_HOLE, Via) || value <= Via->Thickness - MIN_PINORVIACOPPER) - && value != Via->DrillingHole) { - AddObjectTo2ndSizeUndoList(PCB_TYPE_VIA, Via, Via, Via); - EraseVia(Via); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - Via->DrillingHole = value; - if (TEST_FLAG(PCB_FLAG_HOLE, Via)) { - AddObjectToSizeUndoList(PCB_TYPE_VIA, Via, Via, Via); - Via->Thickness = value; - } - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - DrawVia(Via); - return (Via); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the clearance size of a via - * returns TRUE if changed - */ -static void *ChangeViaClearSize(PinTypePtr Via) -{ - Coord value = (Absolute) ? Absolute : Via->Clearance + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Via)) - return (NULL); - value = MIN(MAX_LINESIZE, value); - if (value < 0) - value = 0; - if (Delta < 0 && value < PCB->Bloat * 2) - value = 0; - if ((Delta > 0 || Absolute) && value < PCB->Bloat * 2) - value = PCB->Bloat * 2 + 2; - if (Via->Clearance == value) - return NULL; - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - AddObjectToClearSizeUndoList(PCB_TYPE_VIA, Via, Via, Via); - EraseVia(Via); - r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); - Via->Clearance = value; - SetPinBoundingBox(Via); - r_insert_entry(PCB->Data->via_tree, (BoxType *) Via, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - DrawVia(Via); - Via->Element = NULL; - return (Via); -} - - -/* --------------------------------------------------------------------------- - * changes the size of a pin - * returns TRUE if changed - */ -static void *ChangePinSize(ElementTypePtr Element, PinTypePtr Pin) -{ - Coord value = (Absolute) ? Absolute : Pin->Thickness + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Pin)) - return (NULL); - if (!TEST_FLAG(PCB_FLAG_HOLE, Pin) && value <= MAX_PINORVIASIZE && - value >= MIN_PINORVIASIZE && value >= Pin->DrillingHole + MIN_PINORVIACOPPER && value != Pin->Thickness) { - AddObjectToSizeUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - AddObjectToMaskSizeUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - ErasePin(Pin); - r_delete_entry(PCB->Data->pin_tree, &Pin->BoundingBox); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - Pin->Mask += value - Pin->Thickness; - Pin->Thickness = value; - /* SetElementBB updates all associated rtrees */ - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - DrawPin(Pin); - return (Pin); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the clearance size of a pin - * returns TRUE if changed - */ -static void *ChangePinClearSize(ElementTypePtr Element, PinTypePtr Pin) -{ - Coord value = (Absolute) ? Absolute : Pin->Clearance + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Pin)) - return (NULL); - value = MIN(MAX_LINESIZE, value); - if (value < 0) - value = 0; - if (Delta < 0 && value < PCB->Bloat * 2) - value = 0; - if ((Delta > 0 || Absolute) && value < PCB->Bloat * 2) - value = PCB->Bloat * 2 + 2; - if (Pin->Clearance == value) - return NULL; - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - AddObjectToClearSizeUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - ErasePin(Pin); - r_delete_entry(PCB->Data->pin_tree, &Pin->BoundingBox); - Pin->Clearance = value; - /* SetElementBB updates all associated rtrees */ - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - DrawPin(Pin); - return (Pin); -} - -/* --------------------------------------------------------------------------- - * changes the size of a pad - * returns TRUE if changed - */ -static void *ChangePadSize(ElementTypePtr Element, PadTypePtr Pad) -{ - Coord value = (Absolute) ? Absolute : Pad->Thickness + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Pad)) - return (NULL); - if (value <= MAX_PADSIZE && value >= MIN_PADSIZE && value != Pad->Thickness) { - AddObjectToSizeUndoList(PCB_TYPE_PAD, Element, Pad, Pad); - AddObjectToMaskSizeUndoList(PCB_TYPE_PAD, Element, Pad, Pad); - RestoreToPolygon(PCB->Data, PCB_TYPE_PAD, Element, Pad); - ErasePad(Pad); - r_delete_entry(PCB->Data->pad_tree, &Pad->BoundingBox); - Pad->Mask += value - Pad->Thickness; - Pad->Thickness = value; - /* SetElementBB updates all associated rtrees */ - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - ClearFromPolygon(PCB->Data, PCB_TYPE_PAD, Element, Pad); - DrawPad(Pad); - return (Pad); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the clearance size of a pad - * returns TRUE if changed - */ -static void *ChangePadClearSize(ElementTypePtr Element, PadTypePtr Pad) -{ - Coord value = (Absolute) ? Absolute : Pad->Clearance + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Pad)) - return (NULL); - value = MIN(MAX_LINESIZE, value); - if (value < 0) - value = 0; - if (Delta < 0 && value < PCB->Bloat * 2) - value = 0; - if ((Delta > 0 || Absolute) && value < PCB->Bloat * 2) - value = PCB->Bloat * 2 + 2; - if (value == Pad->Clearance) - return NULL; - AddObjectToClearSizeUndoList(PCB_TYPE_PAD, Element, Pad, Pad); - RestoreToPolygon(PCB->Data, PCB_TYPE_PAD, Element, Pad); - ErasePad(Pad); - r_delete_entry(PCB->Data->pad_tree, &Pad->BoundingBox); - Pad->Clearance = value; - /* SetElementBB updates all associated rtrees */ - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - ClearFromPolygon(PCB->Data, PCB_TYPE_PAD, Element, Pad); - DrawPad(Pad); - return Pad; -} - -/* --------------------------------------------------------------------------- - * changes the drilling hole of all pins of an element - * returns TRUE if changed - */ -static void *ChangeElement2ndSize(ElementTypePtr Element) -{ - pcb_bool changed = pcb_false; - Coord value; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - value = (Absolute) ? Absolute : pin->DrillingHole + Delta; - if (value <= MAX_PINORVIASIZE && - value >= MIN_PINORVIAHOLE && (TEST_FLAG(PCB_FLAG_HOLE, pin) || value <= pin->Thickness - MIN_PINORVIACOPPER) - && value != pin->DrillingHole) { - changed = pcb_true; - AddObjectTo2ndSizeUndoList(PCB_TYPE_PIN, Element, pin, pin); - ErasePin(pin); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, pin); - pin->DrillingHole = value; - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) { - AddObjectToSizeUndoList(PCB_TYPE_PIN, Element, pin, pin); - pin->Thickness = value; - } - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, pin); - DrawPin(pin); - } - } - END_LOOP; - if (changed) - return (Element); - else - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes ring dia of all pins of an element - * returns TRUE if changed - */ -static void *ChangeElement1stSize(ElementTypePtr Element) -{ - pcb_bool changed = pcb_false; - Coord value; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - value = (Absolute) ? Absolute : pin->DrillingHole + Delta; - if (value <= MAX_PINORVIASIZE && value >= pin->DrillingHole + MIN_PINORVIACOPPER && value != pin->Thickness) { - changed = pcb_true; - AddObjectToSizeUndoList(PCB_TYPE_PIN, Element, pin, pin); - ErasePin(pin); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, pin); - pin->Thickness = value; - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) { - AddObjectToSizeUndoList(PCB_TYPE_PIN, Element, pin, pin); - pin->Thickness = value; - } - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, pin); - DrawPin(pin); - } - } - END_LOOP; - if (changed) - return (Element); - else - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the clearance of all pins of an element - * returns TRUE if changed - */ -static void *ChangeElementClearSize(ElementTypePtr Element) -{ - pcb_bool changed = pcb_false; - Coord value; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - value = (Absolute) ? Absolute : pin->Clearance + Delta; - if (value <= MAX_PINORVIASIZE && - value >= MIN_PINORVIAHOLE && (TEST_FLAG(PCB_FLAG_HOLE, pin) || value <= pin->Thickness - MIN_PINORVIACOPPER) - && value != pin->Clearance) { - changed = pcb_true; - AddObjectToClearSizeUndoList(PCB_TYPE_PIN, Element, pin, pin); - ErasePin(pin); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, pin); - pin->Clearance = value; - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) { - AddObjectToSizeUndoList(PCB_TYPE_PIN, Element, pin, pin); - pin->Thickness = value; - } - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, pin); - DrawPin(pin); - } - } - END_LOOP; - - PAD_LOOP(Element); - { - value = (Absolute) ? Absolute : pad->Clearance + Delta; - if (value <= MAX_PINORVIASIZE && value >= MIN_PINORVIAHOLE && value != pad->Clearance) { - changed = pcb_true; - AddObjectToClearSizeUndoList(PCB_TYPE_PAD, Element, pad, pad); - ErasePad(pad); - RestoreToPolygon(PCB->Data, PCB_TYPE_PAD, Element, pad); - r_delete_entry(PCB->Data->pad_tree, &pad->BoundingBox); - pad->Clearance = value; - if (TEST_FLAG(PCB_FLAG_HOLE, pad)) { - AddObjectToSizeUndoList(PCB_TYPE_PAD, Element, pad, pad); - pad->Thickness = value; - } - /* SetElementBB updates all associated rtrees */ - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - - ClearFromPolygon(PCB->Data, PCB_TYPE_PAD, Element, pad); - DrawPad(pad); - } - } - END_LOOP; - - if (changed) - return (Element); - else - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the drilling hole of a pin - * returns TRUE if changed - */ -static void *ChangePin2ndSize(ElementTypePtr Element, PinTypePtr Pin) -{ - Coord value = (Absolute) ? Absolute : Pin->DrillingHole + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Pin)) - return (NULL); - if (value <= MAX_PINORVIASIZE && - value >= MIN_PINORVIAHOLE && (TEST_FLAG(PCB_FLAG_HOLE, Pin) || value <= Pin->Thickness - MIN_PINORVIACOPPER) - && value != Pin->DrillingHole) { - AddObjectTo2ndSizeUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - ErasePin(Pin); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - Pin->DrillingHole = value; - if (TEST_FLAG(PCB_FLAG_HOLE, Pin)) { - AddObjectToSizeUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - Pin->Thickness = value; - } - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - DrawPin(Pin); - return (Pin); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the size of a line - * returns TRUE if changed - */ -static void *ChangeLineSize(LayerTypePtr Layer, LineTypePtr Line) -{ - Coord value = (Absolute) ? Absolute : Line->Thickness + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Line)) - return (NULL); - if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != Line->Thickness) { - AddObjectToSizeUndoList(PCB_TYPE_LINE, Layer, Line, Line); - EraseLine(Line); - r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - Line->Thickness = value; - SetLineBoundingBox(Line); - r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - DrawLine(Layer, Line); - return (Line); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the clearance size of a line - * returns TRUE if changed - */ -static void *ChangeLineClearSize(LayerTypePtr Layer, LineTypePtr Line) -{ - Coord value = (Absolute) ? Absolute : Line->Clearance + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Line) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) - return (NULL); - value = MIN(MAX_LINESIZE, MAX(value, PCB->Bloat * 2 + 2)); - if (value != Line->Clearance) { - AddObjectToClearSizeUndoList(PCB_TYPE_LINE, Layer, Line, Line); - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - EraseLine(Line); - r_delete_entry(Layer->line_tree, (BoxTypePtr) Line); - Line->Clearance = value; - if (Line->Clearance == 0) { - CLEAR_FLAG(PCB_FLAG_CLEARLINE, Line); - Line->Clearance = PCB_MIL_TO_COORD(10); - } - SetLineBoundingBox(Line); - r_insert_entry(Layer->line_tree, (BoxTypePtr) Line, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - DrawLine(Layer, Line); - return (Line); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * Handle attempts to change the clearance of a polygon. - */ -static void *ChangePolygonClearSize(LayerTypePtr Layer, PolygonTypePtr poly) -{ - static int shown_this_message = 0; - if (!shown_this_message) { - gui->confirm_dialog(_("To change the clearance of objects in a polygon, " - "change the objects, not the polygon.\n" - "Hint: To set a minimum clearance for a group of objects, " - "select them all then :MinClearGap(Selected,=10,mil)"), "Ok", NULL); - shown_this_message = 1; - } - - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the size of an arc - * returns TRUE if changed - */ -static void *ChangeArcSize(LayerTypePtr Layer, ArcTypePtr Arc) -{ - Coord value = (Absolute) ? Absolute : Arc->Thickness + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Arc)) - return (NULL); - if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != Arc->Thickness) { - AddObjectToSizeUndoList(PCB_TYPE_ARC, Layer, Arc, Arc); - EraseArc(Arc); - r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - Arc->Thickness = value; - SetArcBoundingBox(Arc); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - DrawArc(Layer, Arc); - return (Arc); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the clearance size of an arc - * returns TRUE if changed - */ -static void *ChangeArcClearSize(LayerTypePtr Layer, ArcTypePtr Arc) -{ - Coord value = (Absolute) ? Absolute : Arc->Clearance + Delta; - - if (TEST_FLAG(PCB_FLAG_LOCK, Arc) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) - return (NULL); - value = MIN(MAX_LINESIZE, MAX(value, PCB->Bloat * 2 + 2)); - if (value != Arc->Clearance) { - AddObjectToClearSizeUndoList(PCB_TYPE_ARC, Layer, Arc, Arc); - EraseArc(Arc); - r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - Arc->Clearance = value; - if (Arc->Clearance == 0) { - CLEAR_FLAG(PCB_FLAG_CLEARLINE, Arc); - Arc->Clearance = PCB_MIL_TO_COORD(10); - } - SetArcBoundingBox(Arc); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - DrawArc(Layer, Arc); - return (Arc); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the radius of an arc (is_primary 0=width or 1=height or 2=both) - * returns TRUE if changed - */ -static void *ChangeArcRadius(LayerTypePtr Layer, ArcTypePtr Arc) -{ - Coord value, *dst; - void *a0, *a1; - - if (TEST_FLAG(PCB_FLAG_LOCK, Arc)) - return (NULL); - - switch(is_primary) { - case 0: dst = &Arc->Width; break; - case 1: dst = &Arc->Height; break; - case 2: - is_primary = 0; a0 = ChangeArcRadius(Layer, Arc); - is_primary = 1; a1 = ChangeArcRadius(Layer, Arc); - if ((a0 != NULL) || (a1 != NULL)) - return Arc; - return NULL; - } - - value = (Absolute) ? Absolute : (*dst) + Delta; - value = MIN(MAX_ARCSIZE, MAX(value, MIN_ARCSIZE)); - if (value != *dst) { - AddObjectToChangeRadiiUndoList(PCB_TYPE_ARC, Layer, Arc, Arc); - EraseArc(Arc); - r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - *dst = value; - SetArcBoundingBox(Arc); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - DrawArc(Layer, Arc); - return (Arc); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the angle of an arc (is_primary 0=start or 1=end) - * returns TRUE if changed - */ -static void *ChangeArcAngle(LayerTypePtr Layer, ArcTypePtr Arc) -{ - Angle value, *dst; - void *a0, *a1; - - if (TEST_FLAG(PCB_FLAG_LOCK, Arc)) - return (NULL); - - switch(is_primary) { - case 0: dst = &Arc->StartAngle; break; - case 1: dst = &Arc->Delta; break; - case 2: - is_primary = 0; a0 = ChangeArcAngle(Layer, Arc); - is_primary = 1; a1 = ChangeArcAngle(Layer, Arc); - if ((a0 != NULL) || (a1 != NULL)) - return Arc; - return NULL; - } - - value = (AAbsolute) ? AAbsolute : (*dst) + ADelta; - value = fmod(value, 360.0); - if (value < 0) - value += 360; - - if (value != *dst) { - AddObjectToChangeAnglesUndoList(PCB_TYPE_ARC, Layer, Arc, Arc); - EraseArc(Arc); - r_delete_entry(Layer->arc_tree, (BoxTypePtr) Arc); - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - *dst = value; - SetArcBoundingBox(Arc); - r_insert_entry(Layer->arc_tree, (BoxTypePtr) Arc, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - DrawArc(Layer, Arc); - return (Arc); - } - return (NULL); -} - - -/* --------------------------------------------------------------------------- - * changes the scaling factor of a text object - * returns TRUE if changed - */ -static void *ChangeTextSize(LayerTypePtr Layer, TextTypePtr Text) -{ - int value = Absolute ? PCB_COORD_TO_MIL(Absolute) - : Text->Scale + PCB_COORD_TO_MIL(Delta); - - if (TEST_FLAG(PCB_FLAG_LOCK, Text)) - return (NULL); - if (value <= MAX_TEXTSCALE && value >= MIN_TEXTSCALE && value != Text->Scale) { - AddObjectToSizeUndoList(PCB_TYPE_TEXT, Layer, Text, Text); - EraseText(Layer, Text); - r_delete_entry(Layer->text_tree, (BoxTypePtr) Text); - RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - Text->Scale = value; - SetTextBoundingBox(&PCB->Font, Text); - r_insert_entry(Layer->text_tree, (BoxTypePtr) Text, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - DrawText(Layer, Text); - return (Text); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the scaling factor of an element's outline - * returns TRUE if changed - */ -static void *ChangeElementSize(ElementTypePtr Element) -{ - Coord value; - pcb_bool changed = pcb_false; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - if (PCB->ElementOn) - EraseElement(Element); - ELEMENTLINE_LOOP(Element); - { - value = (Absolute) ? Absolute : line->Thickness + Delta; - if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != line->Thickness) { - AddObjectToSizeUndoList(PCB_TYPE_ELEMENT_LINE, Element, line, line); - line->Thickness = value; - changed = pcb_true; - } - } - END_LOOP; - ARC_LOOP(Element); - { - value = (Absolute) ? Absolute : arc->Thickness + Delta; - if (value <= MAX_LINESIZE && value >= MIN_LINESIZE && value != arc->Thickness) { - AddObjectToSizeUndoList(PCB_TYPE_ELEMENT_ARC, Element, arc, arc); - arc->Thickness = value; - changed = pcb_true; - } - } - END_LOOP; - if (PCB->ElementOn) { - DrawElement(Element); - } - if (changed) - return (Element); - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the scaling factor of a elementname object - * returns TRUE if changed - */ -static void *ChangeElementNameSize(ElementTypePtr Element) -{ - int value = Absolute ? PCB_COORD_TO_MIL(Absolute) - : DESCRIPTION_TEXT(Element).Scale + PCB_COORD_TO_MIL(Delta); - - if (TEST_FLAG(PCB_FLAG_LOCK, &Element->Name[0])) - return (NULL); - if (value <= MAX_TEXTSCALE && value >= MIN_TEXTSCALE) { - EraseElementName(Element); - ELEMENTTEXT_LOOP(Element); - { - AddObjectToSizeUndoList(PCB_TYPE_ELEMENT_NAME, Element, text, text); - r_delete_entry(PCB->Data->name_tree[n], (BoxType *) text); - text->Scale = value; - SetTextBoundingBox(&PCB->Font, text); - r_insert_entry(PCB->Data->name_tree[n], (BoxType *) text, 0); - } - END_LOOP; - DrawElementName(Element); - return (Element); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the name of a via - */ -static void *ChangeViaName(PinTypePtr Via) -{ - char *old = Via->Name; - - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Via)) { - ErasePinName(Via); - Via->Name = NewName; - DrawPinName(Via); - } - else - Via->Name = NewName; - return (old); -} - -/* --------------------------------------------------------------------------- - * changes the name of a pin - */ -static void *ChangePinName(ElementTypePtr Element, PinTypePtr Pin) -{ - char *old = Pin->Name; - - Element = Element; /* get rid of 'unused...' warnings */ - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pin)) { - ErasePinName(Pin); - Pin->Name = NewName; - DrawPinName(Pin); - } - else - Pin->Name = NewName; - return (old); -} - -/* --------------------------------------------------------------------------- - * changes the name of a pad - */ -static void *ChangePadName(ElementTypePtr Element, PadTypePtr Pad) -{ - char *old = Pad->Name; - - Element = Element; /* get rid of 'unused...' warnings */ - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pad)) { - ErasePadName(Pad); - Pad->Name = NewName; - DrawPadName(Pad); - } - else - Pad->Name = NewName; - return (old); -} - -/* --------------------------------------------------------------------------- - * changes the number of a pin - */ -static void *ChangePinNum(ElementTypePtr Element, PinTypePtr Pin) -{ - char *old = Pin->Number; - - Element = Element; /* get rid of 'unused...' warnings */ - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pin)) { - ErasePinName(Pin); - Pin->Number = NewName; - DrawPinName(Pin); - } - else - Pin->Number = NewName; - return (old); -} - -/* --------------------------------------------------------------------------- - * changes the number of a pad - */ -static void *ChangePadNum(ElementTypePtr Element, PadTypePtr Pad) -{ - char *old = Pad->Number; - - Element = Element; /* get rid of 'unused...' warnings */ - if (TEST_FLAG(PCB_FLAG_DISPLAYNAME, Pad)) { - ErasePadName(Pad); - Pad->Number = NewName; - DrawPadName(Pad); - } - else - Pad->Number = NewName; - return (old); -} - -/* --------------------------------------------------------------------------- - * changes the name of a line - */ -static void *ChangeLineName(LayerTypePtr Layer, LineTypePtr Line) -{ - char *old = Line->Number; - - Layer = Layer; - Line->Number = NewName; - return (old); -} - -/* --------------------------------------------------------------------------- - * changes the layout-name of an element - */ - -char *ChangeElementText(PCBType * pcb, DataType * data, ElementTypePtr Element, int which, char *new_name) -{ - char *old = Element->Name[which].TextString; - -#ifdef DEBUG - printf("In ChangeElementText, updating old TextString %s to %s\n", old, new_name); -#endif - - if (pcb && which == NAME_INDEX()) - EraseElementName(Element); - - r_delete_entry(data->name_tree[which], &Element->Name[which].BoundingBox); - - Element->Name[which].TextString = new_name; - SetTextBoundingBox(&PCB->Font, &Element->Name[which]); - - r_insert_entry(data->name_tree[which], &Element->Name[which].BoundingBox, 0); - - if (pcb && which == NAME_INDEX()) - DrawElementName(Element); - - return old; -} - -static void *ChangeElementName(ElementTypePtr Element) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, &Element->Name[0])) - return (NULL); - if (NAME_INDEX() == NAMEONPCB_INDEX) { - if (conf_core.editor.unique_names && UniqueElementName(PCB->Data, NewName) != NewName) { - Message(PCB_MSG_DEFAULT, _("Error: The name \"%s\" is not unique!\n"), NewName); - return ((char *) -1); - } - } - - return ChangeElementText(PCB, PCB->Data, Element, NAME_INDEX(), NewName); -} - -static void *ChangeElementNonetlist(ElementTypePtr Element) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - TOGGLE_FLAG(PCB_FLAG_NONETLIST, Element); - return Element; -} - -/* --------------------------------------------------------------------------- - * sets data of a text object and calculates bounding box - * memory must have already been allocated - * the one for the new string is allocated - * returns pcb_true if the string has been changed - */ -static void *ChangeTextName(LayerTypePtr Layer, TextTypePtr Text) -{ - char *old = Text->TextString; - - if (TEST_FLAG(PCB_FLAG_LOCK, Text)) - return (NULL); - EraseText(Layer, Text); - RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - Text->TextString = NewName; - - /* calculate size of the bounding box */ - SetTextBoundingBox(&PCB->Font, Text); - r_insert_entry(Layer->text_tree, (BoxTypePtr) Text, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - DrawText(Layer, Text); - return (old); -} - -/* --------------------------------------------------------------------------- - * changes the name of a layout; memory has to be already allocated - */ -pcb_bool ChangeLayoutName(char *Name) -{ - free(PCB->Name); - PCB->Name = Name; - if (gui != NULL) - hid_action("PCBChanged"); - return (pcb_true); -} - -/* --------------------------------------------------------------------------- - * changes the side of the board an element is on - * returns TRUE if done - */ -pcb_bool ChangeElementSide(ElementTypePtr Element, Coord yoff) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (pcb_false); - EraseElement(Element); - AddObjectToMirrorUndoList(PCB_TYPE_ELEMENT, Element, Element, Element, yoff); - MirrorElementCoordinates(PCB->Data, Element, yoff); - DrawElement(Element); - return (pcb_true); -} - -/* --------------------------------------------------------------------------- - * changes the name of a layer; memory has to be already allocated - */ -pcb_bool ChangeLayerName(LayerTypePtr Layer, char *Name) -{ - free((char*)CURRENT->Name); - CURRENT->Name = Name; - hid_action("LayersChanged"); - return (pcb_true); -} - -/* --------------------------------------------------------------------------- - * changes the clearance flag of a line - */ -static void *ChangeLineJoin(LayerTypePtr Layer, LineTypePtr Line) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Line)) - return (NULL); - EraseLine(Line); - if (TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) { - AddObjectToClearPolyUndoList(PCB_TYPE_LINE, Layer, Line, Line, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - } - AddObjectToFlagUndoList(PCB_TYPE_LINE, Layer, Line, Line); - TOGGLE_FLAG(PCB_FLAG_CLEARLINE, Line); - if (TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) { - AddObjectToClearPolyUndoList(PCB_TYPE_LINE, Layer, Line, Line, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_LINE, Layer, Line); - } - DrawLine(Layer, Line); - return (Line); -} - -/* --------------------------------------------------------------------------- - * sets the clearance flag of a line - */ -static void *SetLineJoin(LayerTypePtr Layer, LineTypePtr Line) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Line) || TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) - return (NULL); - return ChangeLineJoin(Layer, Line); -} - -/* --------------------------------------------------------------------------- - * clears the clearance flag of a line - */ -static void *ClrLineJoin(LayerTypePtr Layer, LineTypePtr Line) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Line) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Line)) - return (NULL); - return ChangeLineJoin(Layer, Line); -} - -/* --------------------------------------------------------------------------- - * changes the clearance flag of an arc - */ -static void *ChangeArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Arc)) - return (NULL); - EraseArc(Arc); - if (TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) { - RestoreToPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - AddObjectToClearPolyUndoList(PCB_TYPE_ARC, Layer, Arc, Arc, pcb_false); - } - AddObjectToFlagUndoList(PCB_TYPE_ARC, Layer, Arc, Arc); - TOGGLE_FLAG(PCB_FLAG_CLEARLINE, Arc); - if (TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) { - ClearFromPolygon(PCB->Data, PCB_TYPE_ARC, Layer, Arc); - AddObjectToClearPolyUndoList(PCB_TYPE_ARC, Layer, Arc, Arc, pcb_true); - } - DrawArc(Layer, Arc); - return (Arc); -} - -/* --------------------------------------------------------------------------- - * sets the clearance flag of an arc - */ -static void *SetArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Arc) || TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) - return (NULL); - return ChangeArcJoin(Layer, Arc); -} - -/* --------------------------------------------------------------------------- - * clears the clearance flag of an arc - */ -static void *ClrArcJoin(LayerTypePtr Layer, ArcTypePtr Arc) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Arc) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Arc)) - return (NULL); - return ChangeArcJoin(Layer, Arc); -} - -/* --------------------------------------------------------------------------- - * changes the clearance flag of a text - */ -static void *ChangeTextJoin(LayerTypePtr Layer, TextTypePtr Text) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Text)) - return (NULL); - EraseText(Layer, Text); - if (TEST_FLAG(PCB_FLAG_CLEARLINE, Text)) { - AddObjectToClearPolyUndoList(PCB_TYPE_TEXT, Layer, Text, Text, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - } - AddObjectToFlagUndoList(PCB_TYPE_LINE, Layer, Text, Text); - TOGGLE_FLAG(PCB_FLAG_CLEARLINE, Text); - if (TEST_FLAG(PCB_FLAG_CLEARLINE, Text)) { - AddObjectToClearPolyUndoList(PCB_TYPE_TEXT, Layer, Text, Text, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_TEXT, Layer, Text); - } - DrawText(Layer, Text); - return (Text); -} - -/* --------------------------------------------------------------------------- - * sets the clearance flag of a text - */ -static void *SetTextJoin(LayerTypePtr Layer, TextTypePtr Text) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Text) || TEST_FLAG(PCB_FLAG_CLEARLINE, Text)) - return (NULL); - return ChangeTextJoin(Layer, Text); -} - -/* --------------------------------------------------------------------------- - * clears the clearance flag of a text - */ -static void *ClrTextJoin(LayerTypePtr Layer, TextTypePtr Text) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Text) || !TEST_FLAG(PCB_FLAG_CLEARLINE, Text)) - return (NULL); - return ChangeTextJoin(Layer, Text); -} - -/* --------------------------------------------------------------------------- - * changes the square flag of all pins on an element - */ -static void *ChangeElementSquare(ElementTypePtr Element) -{ - void *ans = NULL; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - ans = ChangePinSquare(Element, pin); - } - END_LOOP; - PAD_LOOP(Element); - { - ans = ChangePadSquare(Element, pad); - } - END_LOOP; - return (ans); -} - -/* --------------------------------------------------------------------------- - * sets the square flag of all pins on an element - */ -static void *SetElementSquare(ElementTypePtr Element) -{ - void *ans = NULL; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - ans = SetPinSquare(Element, pin); - } - END_LOOP; - PAD_LOOP(Element); - { - ans = SetPadSquare(Element, pad); - } - END_LOOP; - return (ans); -} - -/* --------------------------------------------------------------------------- - * clears the square flag of all pins on an element - */ -static void *ClrElementSquare(ElementTypePtr Element) -{ - void *ans = NULL; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - ans = ClrPinSquare(Element, pin); - } - END_LOOP; - PAD_LOOP(Element); - { - ans = ClrPadSquare(Element, pad); - } - END_LOOP; - return (ans); -} - -/* --------------------------------------------------------------------------- - * changes the octagon flags of all pins of an element - */ -static void *ChangeElementOctagon(ElementTypePtr Element) -{ - void *result = NULL; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - ChangePinOctagon(Element, pin); - result = Element; - } - END_LOOP; - return (result); -} - -/* --------------------------------------------------------------------------- - * sets the octagon flags of all pins of an element - */ -static void *SetElementOctagon(ElementTypePtr Element) -{ - void *result = NULL; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - SetPinOctagon(Element, pin); - result = Element; - } - END_LOOP; - return (result); -} - -/* --------------------------------------------------------------------------- - * clears the octagon flags of all pins of an element - */ -static void *ClrElementOctagon(ElementTypePtr Element) -{ - void *result = NULL; - - if (TEST_FLAG(PCB_FLAG_LOCK, Element)) - return (NULL); - PIN_LOOP(Element); - { - ClrPinOctagon(Element, pin); - result = Element; - } - END_LOOP; - return (result); -} - -/* --------------------------------------------------------------------------- - * changes the square flag of a pad - */ -static void *ChangePadSquare(ElementTypePtr Element, PadTypePtr Pad) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pad)) - return (NULL); - ErasePad(Pad); - AddObjectToClearPolyUndoList(PCB_TYPE_PAD, Element, Pad, Pad, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_PAD, Element, Pad); - AddObjectToFlagUndoList(PCB_TYPE_PAD, Element, Pad, Pad); - TOGGLE_FLAG(PCB_FLAG_SQUARE, Pad); - AddObjectToClearPolyUndoList(PCB_TYPE_PAD, Element, Pad, Pad, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_PAD, Element, Pad); - DrawPad(Pad); - return (Pad); -} - -/* --------------------------------------------------------------------------- - * sets the square flag of a pad - */ -static void *SetPadSquare(ElementTypePtr Element, PadTypePtr Pad) -{ - - if (TEST_FLAG(PCB_FLAG_LOCK, Pad) || TEST_FLAG(PCB_FLAG_SQUARE, Pad)) - return (NULL); - - return (ChangePadSquare(Element, Pad)); -} - - -/* --------------------------------------------------------------------------- - * clears the square flag of a pad - */ -static void *ClrPadSquare(ElementTypePtr Element, PadTypePtr Pad) -{ - - if (TEST_FLAG(PCB_FLAG_LOCK, Pad) || !TEST_FLAG(PCB_FLAG_SQUARE, Pad)) - return (NULL); - - return (ChangePadSquare(Element, Pad)); -} - - -/* --------------------------------------------------------------------------- - * changes the square flag of a via - */ -static void *ChangeViaSquare(PinTypePtr Via) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Via)) - return (NULL); - EraseVia(Via); - AddObjectToClearPolyUndoList(PCB_TYPE_VIA, NULL, Via, Via, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, NULL, Via); - AddObjectToFlagUndoList(PCB_TYPE_VIA, NULL, Via, Via); - ASSIGN_SQUARE(Absolute, Via); - if (Absolute == 0) - CLEAR_FLAG(PCB_FLAG_SQUARE, Via); - else - SET_FLAG(PCB_FLAG_SQUARE, Via); - SetPinBoundingBox(Via); - AddObjectToClearPolyUndoList(PCB_TYPE_VIA, NULL, Via, Via, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, NULL, Via); - DrawVia(Via); - return (Via); -} - -/* --------------------------------------------------------------------------- - * changes the square flag of a pin - */ -static void *ChangePinSquare(ElementTypePtr Element, PinTypePtr Pin) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pin)) - return (NULL); - ErasePin(Pin); - AddObjectToClearPolyUndoList(PCB_TYPE_PIN, Element, Pin, Pin, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - AddObjectToFlagUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - ASSIGN_SQUARE(Absolute, Pin); - if (Absolute == 0) - CLEAR_FLAG(PCB_FLAG_SQUARE, Pin); - else - SET_FLAG(PCB_FLAG_SQUARE, Pin); - SetPinBoundingBox(Pin); - AddObjectToClearPolyUndoList(PCB_TYPE_PIN, Element, Pin, Pin, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - DrawPin(Pin); - return (Pin); -} - -/* --------------------------------------------------------------------------- - * sets the square flag of a pin - */ -static void *SetPinSquare(ElementTypePtr Element, PinTypePtr Pin) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || TEST_FLAG(PCB_FLAG_SQUARE, Pin)) - return (NULL); - - return (ChangePinSquare(Element, Pin)); -} - -/* --------------------------------------------------------------------------- - * clears the square flag of a pin - */ -static void *ClrPinSquare(ElementTypePtr Element, PinTypePtr Pin) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || !TEST_FLAG(PCB_FLAG_SQUARE, Pin)) - return (NULL); - - return (ChangePinSquare(Element, Pin)); -} - -/* --------------------------------------------------------------------------- - * changes the octagon flag of a via - */ -static void *ChangeViaOctagon(PinTypePtr Via) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Via)) - return (NULL); - EraseVia(Via); - AddObjectToClearPolyUndoList(PCB_TYPE_VIA, Via, Via, Via, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - AddObjectToFlagUndoList(PCB_TYPE_VIA, Via, Via, Via); - TOGGLE_FLAG(PCB_FLAG_OCTAGON, Via); - AddObjectToClearPolyUndoList(PCB_TYPE_VIA, Via, Via, Via, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - DrawVia(Via); - return (Via); -} - -/* --------------------------------------------------------------------------- - * sets the octagon flag of a via - */ -static void *SetViaOctagon(PinTypePtr Via) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Via) || TEST_FLAG(PCB_FLAG_OCTAGON, Via)) - return (NULL); - - return (ChangeViaOctagon(Via)); -} - -/* --------------------------------------------------------------------------- - * clears the octagon flag of a via - */ -static void *ClrViaOctagon(PinTypePtr Via) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Via) || !TEST_FLAG(PCB_FLAG_OCTAGON, Via)) - return (NULL); - - return (ChangeViaOctagon(Via)); -} - -/* --------------------------------------------------------------------------- - * changes the octagon flag of a pin - */ -static void *ChangePinOctagon(ElementTypePtr Element, PinTypePtr Pin) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pin)) - return (NULL); - ErasePin(Pin); - AddObjectToClearPolyUndoList(PCB_TYPE_PIN, Element, Pin, Pin, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - AddObjectToFlagUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - TOGGLE_FLAG(PCB_FLAG_OCTAGON, Pin); - AddObjectToClearPolyUndoList(PCB_TYPE_PIN, Element, Pin, Pin, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_PIN, Element, Pin); - DrawPin(Pin); - return (Pin); -} - -/* --------------------------------------------------------------------------- - * sets the octagon flag of a pin - */ -static void *SetPinOctagon(ElementTypePtr Element, PinTypePtr Pin) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || TEST_FLAG(PCB_FLAG_OCTAGON, Pin)) - return (NULL); - - return (ChangePinOctagon(Element, Pin)); -} - -/* --------------------------------------------------------------------------- - * clears the octagon flag of a pin - */ -static void *ClrPinOctagon(ElementTypePtr Element, PinTypePtr Pin) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pin) || !TEST_FLAG(PCB_FLAG_OCTAGON, Pin)) - return (NULL); - - return (ChangePinOctagon(Element, Pin)); -} - -/* --------------------------------------------------------------------------- - * changes the hole flag of a via - */ -pcb_bool ChangeHole(PinTypePtr Via) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Via)) - return (pcb_false); - EraseVia(Via); - AddObjectToFlagUndoList(PCB_TYPE_VIA, Via, Via, Via); - AddObjectToMaskSizeUndoList(PCB_TYPE_VIA, Via, Via, Via); - r_delete_entry(PCB->Data->via_tree, (BoxType *) Via); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - TOGGLE_FLAG(PCB_FLAG_HOLE, Via); - - if (TEST_FLAG(PCB_FLAG_HOLE, Via)) { - /* A tented via becomes an minimally untented hole. An untented - via retains its mask clearance. */ - if (Via->Mask > Via->Thickness) { - Via->Mask = (Via->DrillingHole + (Via->Mask - Via->Thickness)); - } - else if (Via->Mask < Via->DrillingHole) { - Via->Mask = Via->DrillingHole + 2 * MASKFRAME; - } - } - else { - Via->Mask = (Via->Thickness + (Via->Mask - Via->DrillingHole)); - } - - SetPinBoundingBox(Via); - r_insert_entry(PCB->Data->via_tree, (BoxType *) Via, 0); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, Via, Via); - DrawVia(Via); - Draw(); - return (pcb_true); -} - -/* --------------------------------------------------------------------------- - * changes the nopaste flag of a pad - */ -pcb_bool ChangePaste(PadTypePtr Pad) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Pad)) - return (pcb_false); - ErasePad(Pad); - AddObjectToFlagUndoList(PCB_TYPE_PAD, Pad, Pad, Pad); - TOGGLE_FLAG(PCB_FLAG_NOPASTE, Pad); - DrawPad(Pad); - Draw(); - return (pcb_true); -} - -/* --------------------------------------------------------------------------- - * changes the CLEARPOLY flag of a polygon - */ -static void *ChangePolyClear(LayerTypePtr Layer, PolygonTypePtr Polygon) -{ - if (TEST_FLAG(PCB_FLAG_LOCK, Polygon)) - return (NULL); - AddObjectToClearPolyUndoList(PCB_TYPE_POLYGON, Layer, Polygon, Polygon, pcb_true); - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, Layer, Polygon, Polygon); - TOGGLE_FLAG(PCB_FLAG_CLEARPOLY, Polygon); - InitClip(PCB->Data, Layer, Polygon); - DrawPolygon(Layer, Polygon); - return (Polygon); -} - -/* ---------------------------------------------------------------------- - * changes the side of all selected and visible elements - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedElementSide(void) -{ - pcb_bool change = pcb_false; - - /* setup identifiers */ - if (PCB->PinOn && PCB->ElementOn) - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, element)) { - change |= ChangeElementSide(element, 0); - } - } - END_LOOP; - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the thermals on all selected and visible pins - * and/or vias. Returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedThermals(int types, int therm_style) -{ - pcb_bool change = pcb_false; - - Delta = therm_style; - change = SelectedOperation(&ChangeThermalFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the size of all selected and visible object types - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedSize(int types, Coord Difference, pcb_bool fixIt) -{ - pcb_bool change = pcb_false; - - /* setup identifiers */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - - change = SelectedOperation(&ChangeSizeFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the clearance size of all selected and visible objects - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedClearSize(int types, Coord Difference, pcb_bool fixIt) -{ - pcb_bool change = pcb_false; - - /* setup identifiers */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - if (conf_core.editor.show_mask) - change = SelectedOperation(&ChangeMaskSizeFunctions, pcb_false, types); - else - change = SelectedOperation(&ChangeClearSizeFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* -------------------------------------------------------------------------- - * changes the 2nd size (drilling hole) of all selected and visible objects - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelected2ndSize(int types, Coord Difference, pcb_bool fixIt) -{ - pcb_bool change = pcb_false; - - /* setup identifiers */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - change = SelectedOperation(&Change2ndSizeFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the clearance flag (join) of all selected and visible lines - * and/or arcs. Returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedJoin(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ChangeJoinFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the clearance flag (join) of all selected and visible lines - * and/or arcs. Returns pcb_true if anything has changed - */ -pcb_bool SetSelectedJoin(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&SetJoinFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the clearance flag (join) of all selected and visible lines - * and/or arcs. Returns pcb_true if anything has changed - */ -pcb_bool ClrSelectedJoin(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ClrJoinFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the nonetlist-flag of all selected and visible elements - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedNonetlist(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ChangeNonetlistFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -#if 0 -/* ---------------------------------------------------------------------- - * sets the square-flag of all selected and visible pins or pads - * returns pcb_true if anything has changed - */ -pcb_bool SetSelectedNonetlist(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&SetNonetlistFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * clears the square-flag of all selected and visible pins or pads - * returns pcb_true if anything has changed - */ -pcb_bool ClrSelectedNonetlist(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ClrNonetlistFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} -#endif - -/* ---------------------------------------------------------------------- - * changes the square-flag of all selected and visible pins or pads - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedSquare(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ChangeSquareFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the angle of all selected and visible object types - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedAngle(int types, int is_start, Angle Difference, pcb_bool fixIt) -{ - pcb_bool change = pcb_false; - - /* setup identifiers */ - AAbsolute = (fixIt) ? Difference : 0; - ADelta = Difference; - is_primary = is_start; - - change = SelectedOperation(&ChangeAngleFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the radius of all selected and visible object types - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedRadius(int types, int is_start, Angle Difference, pcb_bool fixIt) -{ - pcb_bool change = pcb_false; - - /* setup identifiers */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - is_primary = is_start; - - change = SelectedOperation(&ChangeRadiusFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - - -/* ---------------------------------------------------------------------- - * sets the square-flag of all selected and visible pins or pads - * returns pcb_true if anything has changed - */ -pcb_bool SetSelectedSquare(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&SetSquareFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * clears the square-flag of all selected and visible pins or pads - * returns pcb_true if anything has changed - */ -pcb_bool ClrSelectedSquare(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ClrSquareFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the octagon-flag of all selected and visible pins and vias - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedOctagon(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ChangeOctagonFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * sets the octagon-flag of all selected and visible pins and vias - * returns pcb_true if anything has changed - */ -pcb_bool SetSelectedOctagon(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&SetOctagonFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * clears the octagon-flag of all selected and visible pins and vias - * returns pcb_true if anything has changed - */ -pcb_bool ClrSelectedOctagon(int types) -{ - pcb_bool change = pcb_false; - - change = SelectedOperation(&ClrOctagonFunctions, pcb_false, types); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the hole-flag of all selected and visible vias - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedHole(void) -{ - pcb_bool change = pcb_false; - - if (PCB->ViaOn) - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, via)) - change |= ChangeHole(via); - } - END_LOOP; - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* ---------------------------------------------------------------------- - * changes the no paste-flag of all selected and visible pads - * returns pcb_true if anything has changed - */ -pcb_bool ChangeSelectedPaste(void) -{ - pcb_bool change = pcb_false; - - ALLPAD_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, pad)) - change |= ChangePaste(pad); - } - ENDALL_LOOP; - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - - -/* --------------------------------------------------------------------------- - * changes the size of the passed object; element size is silk size - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) -{ - pcb_bool change; - - /* setup identifier */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - change = (ObjectOperation(&ChangeSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* --------------------------------------------------------------------------- - * changes the size of the passed object; element size is pin ring sizes - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObject1stSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) -{ - pcb_bool change; - - /* setup identifier */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - change = (ObjectOperation(&Change1stSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* --------------------------------------------------------------------------- - * changes the radius of the passed object (e.g. arc width/height) - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectRadius(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int is_x, Coord r, pcb_bool fixIt) -{ - pcb_bool change; - - /* setup identifier */ - Absolute = (fixIt) ? r : 0; - Delta = r; - is_primary = is_x; - change = (ObjectOperation(&ChangeRadiusFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* --------------------------------------------------------------------------- - * changes the angles of the passed object (e.g. arc start/delta) - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectAngle(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int is_start, Angle a, pcb_bool fixIt) -{ - pcb_bool change; - - /* setup identifier */ - AAbsolute = (fixIt) ? a : 0; - ADelta = a; - is_primary = is_start; - change = (ObjectOperation(&ChangeAngleFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - - -/* --------------------------------------------------------------------------- - * changes the clearance size of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectClearSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) -{ - pcb_bool change; - - /* setup identifier */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - if (conf_core.editor.show_mask) - change = (ObjectOperation(&ChangeMaskSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - else - change = (ObjectOperation(&ChangeClearSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* --------------------------------------------------------------------------- - * changes the thermal of the passed object - * Returns pcb_true if anything is changed - * - */ -pcb_bool ChangeObjectThermal(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int therm_type) -{ - pcb_bool change; - - Delta = Absolute = therm_type; - change = (ObjectOperation(&ChangeThermalFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* --------------------------------------------------------------------------- - * changes the 2nd size of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObject2ndSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt, pcb_bool incundo) -{ - pcb_bool change; - - /* setup identifier */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - change = (ObjectOperation(&Change2ndSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - if (incundo) - IncrementUndoSerialNumber(); - } - return (change); -} - -/* --------------------------------------------------------------------------- - * changes the mask size of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectMaskSize(int Type, void *Ptr1, void *Ptr2, void *Ptr3, Coord Difference, pcb_bool fixIt) -{ - pcb_bool change; - - /* setup identifier */ - Absolute = (fixIt) ? Difference : 0; - Delta = Difference; - change = (ObjectOperation(&ChangeMaskSizeFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL); - if (change) { - Draw(); - IncrementUndoSerialNumber(); - } - return (change); -} - -/* --------------------------------------------------------------------------- - * changes the name of the passed object - * returns the old name - * - * The allocated memory isn't freed because the old string is used - * by the undo module. - */ -void *ChangeObjectName(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name) -{ - void *result; - /* setup identifier */ - NewName = Name; - result = ObjectOperation(&ChangeNameFunctions, Type, Ptr1, Ptr2, Ptr3); - Draw(); - return (result); -} - -/* --------------------------------------------------------------------------- - * changes the pin number of the passed object - * returns the old name - * - * The allocated memory isn't freed because the old string is used - * by the undo module. - */ -void *ChangeObjectPinnum(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name) -{ - void *result; - /* setup identifier */ - NewName = Name; - result = ObjectOperation(&ChangePinnumFunctions, Type, Ptr1, Ptr2, Ptr3); - Draw(); - return (result); -} - -/* --------------------------------------------------------------------------- - * changes the clearance-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&ChangeJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * sets the clearance-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool SetObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&SetJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * clears the clearance-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ClrObjectJoin(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&ClrJoinFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * changes the square-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectNonetlist(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&ChangeNonetlistFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * changes the square-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int style) -{ - Absolute = style; - if (ObjectOperation(&ChangeSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * sets the square-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool SetObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&SetSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * clears the square-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ClrObjectSquare(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&ClrSquareFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * changes the octagon-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ChangeObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&ChangeOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * sets the octagon-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool SetObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&SetOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * clears the octagon-flag of the passed object - * Returns pcb_true if anything is changed - */ -pcb_bool ClrObjectOctagon(int Type, void *Ptr1, void *Ptr2, void *Ptr3) -{ - if (ObjectOperation(&ClrOctagonFunctions, Type, Ptr1, Ptr2, Ptr3) != NULL) { - Draw(); - IncrementUndoSerialNumber(); - return (pcb_true); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * queries the user for a new object name and changes it - * - * The allocated memory isn't freed because the old string is used - * by the undo module. - */ -void *QueryInputAndChangeObjectName(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int pinnum) -{ - char *name = NULL; - char msg[513]; - - /* if passed an element name, make it an element reference instead */ - if (Type == PCB_TYPE_ELEMENT_NAME) { - Type = PCB_TYPE_ELEMENT; - Ptr2 = Ptr1; - Ptr3 = Ptr1; - } - switch (Type) { - case PCB_TYPE_LINE: - name = gui->prompt_for(_("Linename:"), EMPTY(((LineTypePtr) Ptr2)->Number)); - break; - - case PCB_TYPE_VIA: - name = gui->prompt_for(_("Vianame:"), EMPTY(((PinTypePtr) Ptr2)->Name)); - break; - - case PCB_TYPE_PIN: - if (pinnum) - sprintf(msg, _("%s Pin Number:"), EMPTY(((PinTypePtr) Ptr2)->Number)); - else - sprintf(msg, _("%s Pin Name:"), EMPTY(((PinTypePtr) Ptr2)->Number)); - name = gui->prompt_for(msg, EMPTY(((PinTypePtr) Ptr2)->Name)); - break; - - case PCB_TYPE_PAD: - if (pinnum) - sprintf(msg, _("%s Pad Number:"), EMPTY(((PadTypePtr) Ptr2)->Number)); - else - sprintf(msg, _("%s Pad Name:"), EMPTY(((PadTypePtr) Ptr2)->Number)); - name = gui->prompt_for(msg, EMPTY(((PadTypePtr) Ptr2)->Name)); - break; - - case PCB_TYPE_TEXT: - name = gui->prompt_for(_("Enter text:"), EMPTY(((TextTypePtr) Ptr2)->TextString)); - break; - - case PCB_TYPE_ELEMENT: - name = gui->prompt_for(_("Elementname:"), EMPTY(ELEMENT_NAME(PCB, (ElementTypePtr) Ptr2))); - break; - } - if (name) { - /* NB: ChangeObjectName takes ownership of the passed memory */ - char *old; - if (pinnum) - old = (char *) ChangeObjectPinnum(Type, Ptr1, Ptr2, Ptr3, name); - else - old = (char *) ChangeObjectName(Type, Ptr1, Ptr2, Ptr3, name); - - if (old != (char *) -1) { - if (pinnum) - AddObjectToChangePinnumUndoList(Type, Ptr1, Ptr2, Ptr3, old); - else - AddObjectToChangeNameUndoList(Type, Ptr1, Ptr2, Ptr3, old); - IncrementUndoSerialNumber(); - } - Draw(); - return (Ptr3); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the maximum size of a layout - * adjusts the scrollbars - * releases the saved pixmap if necessary - * and adjusts the cursor confinement box - */ -void ChangePCBSize(Coord Width, Coord Height) -{ - PCB->MaxWidth = Width; - PCB->MaxHeight = Height; - - /* crosshair range is different if pastebuffer-mode - * is enabled - */ - if (conf_core.editor.mode == PCB_MODE_PASTE_BUFFER) - SetCrosshairRange(PASTEBUFFER->X - PASTEBUFFER->BoundingBox.X1, - PASTEBUFFER->Y - PASTEBUFFER->BoundingBox.Y1, - MAX(0, - Width - (PASTEBUFFER->BoundingBox.X2 - - PASTEBUFFER->X)), MAX(0, Height - (PASTEBUFFER->BoundingBox.Y2 - PASTEBUFFER->Y))); - else - SetCrosshairRange(0, 0, Width, Height); - - if (gui != NULL) - hid_action("PCBChanged"); -} - -/* --------------------------------------------------------------------------- - * changes the mask size of a pad - * returns TRUE if changed - */ -static void *ChangePadMaskSize(ElementTypePtr Element, PadTypePtr Pad) -{ - Coord value = (Absolute) ? Absolute : Pad->Mask + Delta; - - value = MAX(value, 0); - if (value == Pad->Mask && Absolute == 0) - value = Pad->Thickness; - if (value != Pad->Mask) { - AddObjectToMaskSizeUndoList(PCB_TYPE_PAD, Element, Pad, Pad); - ErasePad(Pad); - r_delete_entry(PCB->Data->pad_tree, &Pad->BoundingBox); - Pad->Mask = value; - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - DrawPad(Pad); - return (Pad); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the mask size of a pin - * returns TRUE if changed - */ -static void *ChangePinMaskSize(ElementTypePtr Element, PinTypePtr Pin) -{ - Coord value = (Absolute) ? Absolute : Pin->Mask + Delta; - - value = MAX(value, 0); - if (value == Pin->Mask && Absolute == 0) - value = Pin->Thickness; - if (value != Pin->Mask) { - AddObjectToMaskSizeUndoList(PCB_TYPE_PIN, Element, Pin, Pin); - ErasePin(Pin); - r_delete_entry(PCB->Data->pin_tree, &Pin->BoundingBox); - Pin->Mask = value; - SetElementBoundingBox(PCB->Data, Element, &PCB->Font); - DrawPin(Pin); - return (Pin); - } - return (NULL); -} - -/* --------------------------------------------------------------------------- - * changes the mask size of a via - * returns TRUE if changed - */ -static void *ChangeViaMaskSize(PinTypePtr Via) -{ - Coord value; - - value = (Absolute) ? Absolute : Via->Mask + Delta; - value = MAX(value, 0); - if (value != Via->Mask) { - AddObjectToMaskSizeUndoList(PCB_TYPE_VIA, Via, Via, Via); - EraseVia(Via); - r_delete_entry(PCB->Data->via_tree, &Via->BoundingBox); - Via->Mask = value; - SetPinBoundingBox(Via); - r_insert_entry(PCB->Data->via_tree, &Via->BoundingBox, 0); - DrawVia(Via); - return (Via); - } - return (NULL); -} Index: 1.1.4/src/obj_any.h =================================================================== --- 1.1.4/src/obj_any.h (revision 10776) +++ 1.1.4/src/obj_any.h (nonexistent) @@ -1,120 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* object model - type+union that can represent any object */ - -#ifndef PCB_OBJ_H -#define PCB_OBJ_H - -#include "global_objs.h" -#include "global_typedefs.h" - -/* Can be used as a bitfield */ -typedef enum pcb_objtype_e { - PCB_OBJ_VOID = 0x000000, - - PCB_OBJ_POINT = 0x000001, - PCB_OBJ_LINE = 0x000002, - PCB_OBJ_TEXT = 0x000004, - PCB_OBJ_POLYGON = 0x000008, - PCB_OBJ_ARC = 0x000010, - PCB_OBJ_RAT = 0x000020, - PCB_OBJ_PAD = 0x000040, - PCB_OBJ_PIN = 0x000080, - PCB_OBJ_VIA = 0x000100, - PCB_OBJ_ELEMENT = 0x000200, - - /* more abstract objects */ - PCB_OBJ_NET = 0x100001, - PCB_OBJ_LAYER = 0x100002, - - /* temporary, for backward compatibility */ - PCB_OBJ_ELINE = 0x200001, - PCB_OBJ_EARC = 0x200002, - PCB_OBJ_ETEXT = 0x200004, - - /* combinations, groups, masks */ - PCB_OBJ_CLASS_MASK= 0xF00000, - PCB_OBJ_CLASS_OBJ = 0x000000, /* anything with common object fields (AnyObjectType) */ - PCB_OBJ_ANY = 0xFFFFFF -} pcb_objtype_t; - -/* which elem of the parent union is active */ -typedef enum pcb_parenttype_e { - PCB_PARENT_INVALID = 0, /* invalid or unknown */ - PCB_PARENT_LAYER, /* object is on a layer */ - PCB_PARENT_ELEMENT, /* object is part of an element */ - PCB_PARENT_DATA /* global objects like via */ -} pcb_parenttype_t; - - -/* class is e.g. PCB_OBJ_CLASS_OBJ */ -#define PCB_OBJ_IS_CLASS(type, class) (((type) & PCB_OBJ_CLASS_MASK) == (class)) - - -typedef struct pcb_obj_s pcb_obj_t; - -struct pcb_obj_s { - pcb_objtype_t type; - union { - void *any; - AnyObjectType *anyobj; - PointType *point; - LineType *line; - TextType *text; - PolygonType *polygon; - ArcType *arc; - RatType *rat; - PadType *pad; - PinType *pin; - PinType *via; - ElementType *element; - NetType *net; - LayerType *layer; - } data; - - pcb_parenttype_t parent_type; - union { - void *any; - LayerType *layer; - DataType *data; - ElementType *element; - } parent; - gdl_elem_t link; -}; - - -/* List of objects */ -#define TDL(x) pcb_objlist_ ## x -#define TDL_LIST_T pcb_objlist_t -#define TDL_ITEM_T pcb_obj_t -#define TDL_FIELD link -#define TDL_SIZE_T size_t -#define TDL_FUNC - -#define pcb_objlist_foreach(list, iterator, loop_elem) \ - gdl_foreach_((&((list)->lst)), (iterator), (loop_elem)) - -#include -#include - -#endif Index: 1.1.4/src/find_clear.c =================================================================== --- 1.1.4/src/find_clear.c (revision 10776) +++ 1.1.4/src/find_clear.c (nonexistent) @@ -1,148 +0,0 @@ -/* - * PCB, interactive printed circuit board design - * - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - */ - -/*! - * \brief Resets all used flags of pins and vias. - */ -pcb_bool ClearFlagOnPinsViasAndPads(pcb_bool AndDraw, int flag) -{ - pcb_bool change = pcb_false; - - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(flag, via)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); - CLEAR_FLAG(flag, via); - if (AndDraw) - DrawVia(via); - change = pcb_true; - } - } - END_LOOP; - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (TEST_FLAG(flag, pin)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - CLEAR_FLAG(flag, pin); - if (AndDraw) - DrawPin(pin); - change = pcb_true; - } - } - END_LOOP; - PAD_LOOP(element); - { - if (TEST_FLAG(flag, pad)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - CLEAR_FLAG(flag, pad); - if (AndDraw) - DrawPad(pad); - change = pcb_true; - } - } - END_LOOP; - } - END_LOOP; - if (change) - SetChangedFlag(pcb_true); - return change; -} - -/*! - * \brief Resets all used flags of LOs. - */ -pcb_bool ClearFlagOnLinesAndPolygons(pcb_bool AndDraw, int flag) -{ - pcb_bool change = pcb_false; - - RAT_LOOP(PCB->Data); - { - if (TEST_FLAG(flag, line)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, line, line, line); - CLEAR_FLAG(flag, line); - if (AndDraw) - DrawRat(line); - change = pcb_true; - } - } - END_LOOP; - COPPERLINE_LOOP(PCB->Data); - { - if (TEST_FLAG(flag, line)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_LINE, layer, line, line); - CLEAR_FLAG(flag, line); - if (AndDraw) - DrawLine(layer, line); - change = pcb_true; - } - } - ENDALL_LOOP; - COPPERARC_LOOP(PCB->Data); - { - if (TEST_FLAG(flag, arc)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_ARC, layer, arc, arc); - CLEAR_FLAG(flag, arc); - if (AndDraw) - DrawArc(layer, arc); - change = pcb_true; - } - } - ENDALL_LOOP; - COPPERPOLYGON_LOOP(PCB->Data); - { - if (TEST_FLAG(flag, polygon)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, layer, polygon, polygon); - CLEAR_FLAG(flag, polygon); - if (AndDraw) - DrawPolygon(layer, polygon); - change = pcb_true; - } - } - ENDALL_LOOP; - if (change) - SetChangedFlag(pcb_true); - return change; -} - -/*! - * \brief Resets all found connections. - */ -pcb_bool ClearFlagOnAllObjects(pcb_bool AndDraw, int flag) -{ - pcb_bool change = pcb_false; - - change = ClearFlagOnPinsViasAndPads(AndDraw, flag) || change; - change = ClearFlagOnLinesAndPolygons(AndDraw, flag) || change; - - return change; -} Index: 1.1.4/src/dolists.h =================================================================== --- 1.1.4/src/dolists.h (revision 10776) +++ 1.1.4/src/dolists.h (nonexistent) @@ -1,6 +0,0 @@ -#undef REGISTER_ACTIONS -#undef REGISTER_ATTRIBUTES - -#define REGISTER_ACTIONS(a, cookie) {extern void HIDCONCAT(register_,a)();HIDCONCAT(register_,a)();} -#define REGISTER_ATTRIBUTES(a, cookie) {extern void HIDCONCAT(register_,a)();HIDCONCAT(register_,a)();} - Index: 1.1.4/src/netlist.h =================================================================== --- 1.1.4/src/netlist.h (revision 10776) +++ 1.1.4/src/netlist.h (nonexistent) @@ -1,63 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* generic netlist operations */ -#include "global.h" - -void pcb_netlist_changed(int force_unfreeze); -LibraryMenuTypePtr pcb_netnode_to_netname(const char *nodename); -LibraryMenuTypePtr pcb_netname_to_netname(const char *netname); - -int pcb_pin_name_to_xy(LibraryEntryType *pin, Coord *x, Coord *y); -void pcb_netlist_find(LibraryMenuType *net, LibraryEntryType *pin); -void pcb_netlist_select(LibraryMenuType *net, LibraryEntryType *pin); -void pcb_netlist_rats(LibraryMenuType *net, LibraryEntryType *pin); -void pcb_netlist_norats(LibraryMenuType *net, LibraryEntryType *pin); -void pcb_netlist_clear(LibraryMenuType *net, LibraryEntryType *pin); -void pcb_netlist_style(LibraryMenuType *net, const char *style); - -/* Return the net entry for a pin name (slow search). The pin name is - like "U101-5", so element's refdes, dash, pin number */ -LibraryMenuTypePtr pcb_netlist_find_net4pinname(PCBTypePtr pcb, const char *pinname); - -/* Same as pcb_netlist_find_net4pinname but with pin pointer */ -LibraryMenuTypePtr pcb_netlist_find_net4pin(PCBTypePtr pcb, const PinType *pin); -LibraryMenuTypePtr pcb_netlist_find_net4pad(PCBTypePtr pcb, const PadType *pad); - - -/* Evaluate to const char * name of the network; lmt is (LibraryMenuType *) */ -#define pcb_netlist_name(lmt) ((const char *)((lmt)->Name+2)) - -/* Evaluate to 0 or 1 depending on whether the net is marked with *; lmt is (LibraryMenuType *) */ -#define pcb_netlist_is_bad(lmt) (((lmt)->Name[0]) == '*') - - -/* Return the index of the net or PCB_NETLIST_INVALID_INDEX if the net is not - on the netlist. NOTE: indices returned are valid only until the first - netlist change! */ -pcb_cardinal_t pcb_netlist_net_idx(PCBTypePtr pcb, LibraryMenuType *net); - -#define PCB_NETLIST_INVALID_INDEX ((pcb_cardinal_t)(-1)) Index: 1.1.4/src/hid_cfg.h =================================================================== --- 1.1.4/src/hid_cfg.h (revision 10776) +++ 1.1.4/src/hid_cfg.h (nonexistent) @@ -1,113 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Helpers for loading and handling lihata HID config files */ - -#ifndef PCB_HID_CFG_H -#define PCB_HID_CFG_H - -#include - -typedef struct hid_cfg_s { - lht_doc_t *doc; -} hid_cfg_t; - -/* Create a set of resources representing a single menu item - If action is NULL, it's a drop-down item that has submenus. - The callback is called after the new lihata node is created. - NOTE: unlike other cookies, this cookie is strdup()'d. - */ -typedef int (*create_menu_widget_t)(void *ctx, const char *path, const char *name, int is_main, lht_node_t *parent, lht_node_t *menu_item); -int hid_cfg_create_menu(hid_cfg_t *hr, const char *path, const char *action, const char *mnemonic, const char *accel, const char *tip, const char *cookie, create_menu_widget_t cb, void *cb_ctx); - -/* Remove a path recursively; call gui_remove() on leaf paths until the subtree - is consumed (should return 0 on success) */ -int hid_cfg_remove_menu(hid_cfg_t *hr, const char *path, int (*gui_remove)(void *ctx, lht_node_t *nd), void *ctx); - -/* Search and load the menu res for hidname; if not found, and embedded_fallback - is not NULL, parse that string instead. Returns NULL on error */ -hid_cfg_t *hid_cfg_load(const char *fn, int exact_fn, const char *embedded_fallback); - -/* Generic, low level lihata loader */ -lht_doc_t *hid_cfg_load_lht(const char *filename); -lht_doc_t *hid_cfg_load_str(const char *text); - -/* Generic, low level lihata text value fetch */ -const char *hid_cfg_text_value(lht_doc_t *doc, const char *path); - -lht_node_t *hid_cfg_get_menu(hid_cfg_t *hr, const char *menu_path); -lht_node_t *hid_cfg_get_menu_at(hid_cfg_t *hr, lht_node_t *at, const char *menu_path, lht_node_t *(*cb)(void *ctx, lht_node_t *node, const char *path, int rel_level), void *ctx); - - -/* Fields are retrieved using this enum so that HIDs don't need to hardwire - lihata node names */ -typedef enum { - MF_ACCELERATOR, - MF_MNEMONIC, - MF_SUBMENU, - MF_CHECKED, - MF_UPDATE_ON, - MF_SENSITIVE, - MF_TIP, - MF_ACTIVE, - MF_ACTION, - MF_FOREGROUND, - MF_BACKGROUND, - MF_FONT -/* MF_RADIO*/ -} hid_cfg_menufield_t; - -/* Return a field of a submenu and optionally fill in field_name with the - field name expected in the lihata document (useful for error messages) */ -lht_node_t *hid_cfg_menu_field(const lht_node_t *submenu, hid_cfg_menufield_t field, const char **field_name); - -/* Return a lihata node using a relative lihata path from parent - this is - just a wrapper around lht_tree_path_ */ -lht_node_t *hid_cfg_menu_field_path(const lht_node_t *parent, const char *path); - -/* Return a text field of a submenu; return NULL and generate a Message(PCB_MSG_DEFAULT, ) if - the given field is not text */ -const char *hid_cfg_menu_field_str(const lht_node_t *submenu, hid_cfg_menufield_t field); - -/* Return non-zero if submenu has further submenus; generate Message(PCB_MSG_DEFAULT, ) if - there is a submenu field with the wrong lihata type */ -int hid_cfg_has_submenus(const lht_node_t *submenu); - -/* Create a new hash node under parent (optional) and create a flat subtree of - text nodes from name,value varargs (NULL terminated). This is a shorthand - for creating a menu item in a subtree list. */ -lht_node_t *hid_cfg_create_hash_node(lht_node_t *parent, const char *name, ...); - -/* Create a flat subtree of text nodes from name,value varargs (NULL - terminated). This is a shorthand for creating a menu item in a - subtree list. */ -void hid_cfg_extend_hash_node(lht_node_t *node, ...); -void hid_cfg_extend_hash_nodev(lht_node_t *node, va_list ap); - -/* Search a subtree in depth-first-search manner. Call cb on each node as - descending. If cb returns non-zero, stop the search and return that value. - Do all this recursively. */ -int hid_cfg_dfs(lht_node_t *parent, int (*cb)(void *ctx, lht_node_t *n), void *ctx); - -/* Report an error about a node */ -void hid_cfg_error(const lht_node_t *node, const char *fmt, ...); -#endif Index: 1.1.4/src/rats_patch.c =================================================================== --- 1.1.4/src/rats_patch.c (revision 10776) +++ 1.1.4/src/rats_patch.c (nonexistent) @@ -1,500 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2015 Tibor 'Igor2' Palinkas - * - * This module, rats.c, was written and is Copyright (C) 1997 by harry eaton - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "rats_patch.h" -#include "genht/htsp.h" -#include "genht/hash.h" -#include "create.h" - -#include "config.h" -#include "data.h" -#include "error.h" -#include "buffer.h" -#include "remove.h" -#include "copy.h" -#include "compat_misc.h" - -static void rats_patch_remove(PCBTypePtr pcb, rats_patch_line_t * n, int do_free); - -const char *pcb_netlist_names[NUM_NETLISTS] = { - "input", - "edited" -}; - -void rats_patch_append(PCBTypePtr pcb, rats_patch_op_t op, const char *id, const char *a1, const char *a2) -{ - rats_patch_line_t *n; - - n = malloc(sizeof(rats_patch_line_t)); - - n->op = op; - n->id = pcb_strdup(id); - n->arg1.net_name = pcb_strdup(a1); - if (a2 != NULL) - n->arg2.attrib_val = pcb_strdup(a2); - else - n->arg2.attrib_val = NULL; - - /* link in */ - n->prev = pcb->NetlistPatchLast; - if (pcb->NetlistPatches != NULL) { - pcb->NetlistPatchLast->next = n; - pcb->NetlistPatchLast = n; - } - else - pcb->NetlistPatchLast = pcb->NetlistPatches = n; - n->next = NULL; -} - -static void rats_patch_free_fields(rats_patch_line_t *n) -{ - if (n->id != NULL) - free(n->id); - if (n->arg1.net_name != NULL) - free(n->arg1.net_name); - if (n->arg2.attrib_val != NULL) - free(n->arg2.attrib_val); -} - -void rats_patch_destroy(PCBTypePtr pcb) -{ - rats_patch_line_t *n, *next; - - for(n = pcb->NetlistPatches; n != NULL; n = next) { - next = n->next; - rats_patch_free_fields(n); - free(n); - } -} - -void rats_patch_append_optimize(PCBTypePtr pcb, rats_patch_op_t op, const char *id, const char *a1, const char *a2) -{ - rats_patch_op_t seek_op; - rats_patch_line_t *n; - - switch (op) { - case RATP_ADD_CONN: - seek_op = RATP_DEL_CONN; - break; - case RATP_DEL_CONN: - seek_op = RATP_ADD_CONN; - break; - case RATP_CHANGE_ATTRIB: - seek_op = RATP_CHANGE_ATTRIB; - break; - } - - /* keep the list clean: remove the last operation that becomes obsolete by the new one */ - for (n = pcb->NetlistPatchLast; n != NULL; n = n->prev) { - if ((n->op == seek_op) && (strcmp(n->id, id) == 0)) { - switch (op) { - case RATP_CHANGE_ATTRIB: - if (strcmp(n->arg1.attrib_name, a1) != 0) - break; - rats_patch_remove(pcb, n, 1); - goto quit; - case RATP_ADD_CONN: - case RATP_DEL_CONN: - if (strcmp(n->arg1.net_name, a1) != 0) - break; - rats_patch_remove(pcb, n, 1); - goto quit; - } - } - } - -quit:; - rats_patch_append(pcb, op, id, a1, a2); -} - -/* Unlink n from the list; if do_free is non-zero, also free fields and n */ -static void rats_patch_remove(PCBTypePtr pcb, rats_patch_line_t * n, int do_free) -{ - /* if we are the first or last... */ - if (n == pcb->NetlistPatches) - pcb->NetlistPatches = n->next; - if (n == pcb->NetlistPatchLast) - pcb->NetlistPatchLast = n->prev; - - /* extra ifs, just in case n is already unlinked */ - if (n->prev != NULL) - n->prev->next = n->next; - if (n->next != NULL) - n->next->prev = n->prev; - - if (do_free) { - rats_patch_free_fields(n); - free(n); - } -} - -static void netlist_free(LibraryTypePtr dst) -{ - int n, p; - - if (dst->Menu == NULL) - return; - - for (n = 0; n < dst->MenuN; n++) { - LibraryMenuTypePtr dmenu = &dst->Menu[n]; - free(dmenu->Name); - for (p = 0; p < dmenu->EntryN; p++) { - LibraryEntryTypePtr dentry = &dmenu->Entry[p]; - free((char*)dentry->ListEntry); - } - free(dmenu->Entry); - } - free(dst->Menu); - dst->Menu = NULL; -} - -static void netlist_copy(LibraryTypePtr dst, LibraryTypePtr src) -{ - int n, p; - dst->MenuMax = dst->MenuN = src->MenuN; - if (src->MenuN != 0) { - dst->Menu = calloc(sizeof(LibraryMenuType), dst->MenuN); - for (n = 0; n < src->MenuN; n++) { - LibraryMenuTypePtr smenu = &src->Menu[n]; - LibraryMenuTypePtr dmenu = &dst->Menu[n]; -/* fprintf(stderr, "Net %d name='%s': ", n, smenu->Name+2);*/ - dmenu->Name = pcb_strdup(smenu->Name); - dmenu->EntryMax = dmenu->EntryN = smenu->EntryN; - dmenu->Entry = calloc(sizeof(LibraryEntryType), dmenu->EntryN); - dmenu->flag = smenu->flag; - dmenu->internal = smenu->internal; - for (p = 0; p < smenu->EntryN; p++) { - LibraryEntryTypePtr sentry = &smenu->Entry[p]; - LibraryEntryTypePtr dentry = &dmenu->Entry[p]; - dentry->ListEntry = pcb_strdup(sentry->ListEntry); - dentry->ListEntry_dontfree = 0; -/* fprintf (stderr, " '%s'/%p", dentry->ListEntry, dentry->ListEntry);*/ - } -/* fprintf(stderr, "\n");*/ - } - } - else - dst->Menu = NULL; -} - - -int rats_patch_apply_conn(PCBTypePtr pcb, rats_patch_line_t * patch, int del) -{ - int n; - - for (n = 0; n < pcb->NetlistLib[NETLIST_EDITED].MenuN; n++) { - LibraryMenuTypePtr menu = &pcb->NetlistLib[NETLIST_EDITED].Menu[n]; - if (strcmp(menu->Name + 2, patch->arg1.net_name) == 0) { - int p; - for (p = 0; p < menu->EntryN; p++) { - LibraryEntryTypePtr entry = &menu->Entry[p]; -/* fprintf (stderr, "C'%s'/%p '%s'/%p\n", entry->ListEntry, entry->ListEntry, patch->id, patch->id);*/ - if (strcmp(entry->ListEntry, patch->id) == 0) { - if (del) { - /* want to delete and it's on the list */ - memmove(&menu->Entry[p], &menu->Entry[p + 1], (menu->EntryN - p - 1) * sizeof(LibraryEntryType)); - menu->EntryN--; - return 0; - } - /* want to add, and pin is on the list -> already added */ - return 1; - } - } - /* If we got here, pin is not on the list */ - if (del) - return 1; - - /* Wanted to add, let's add it */ - CreateNewConnection(menu, (char *) patch->id); - return 0; - } - } - - /* couldn't find the net: create it */ - { - LibraryMenuType *net = NULL; - net = CreateNewNet(&pcb->NetlistLib[NETLIST_EDITED], patch->arg1.net_name, NULL); - if (net == NULL) - return 1; - CreateNewConnection(net, (char *) patch->id); - } - return 0; -} - - -int rats_patch_apply(PCBTypePtr pcb, rats_patch_line_t * patch) -{ - switch (patch->op) { - case RATP_ADD_CONN: - return rats_patch_apply_conn(pcb, patch, 0); - case RATP_DEL_CONN: - return rats_patch_apply_conn(pcb, patch, 1); - case RATP_CHANGE_ATTRIB: -#warning TODO: just check wheter it is still valid - break; - } - return 0; -} - -void rats_patch_make_edited(PCBTypePtr pcb) -{ - rats_patch_line_t *n; - - netlist_free(&(pcb->NetlistLib[NETLIST_EDITED])); - netlist_copy(&(pcb->NetlistLib[NETLIST_EDITED]), &(pcb->NetlistLib[NETLIST_INPUT])); - for (n = pcb->NetlistPatches; n != NULL; n = n->next) - rats_patch_apply(pcb, n); -} - -static LibraryMenuTypePtr rats_patch_find_net(PCBTypePtr pcb, const char *netname, int listidx) -{ - int n; - - for (n = 0; n < pcb->NetlistLib[listidx].MenuN; n++) { - LibraryMenuTypePtr menu = &pcb->NetlistLib[listidx].Menu[n]; - if (strcmp(menu->Name + 2, netname) == 0) - return menu; - } - return NULL; -} - -int rats_patch_export(PCBType *pcb, rats_patch_line_t *pat, pcb_bool need_info_lines, void (*cb)(void *ctx, pcb_rats_patch_export_ev_t ev, const char *netn, const char *key, const char *val), void *ctx) -{ - rats_patch_line_t *n; - - if (need_info_lines) { - htsp_t *seen; - seen = htsp_alloc(strhash, strkeyeq); - - /* have to print net_info lines */ - for (n = pat; n != NULL; n = n->next) { - switch (n->op) { - case RATP_ADD_CONN: - case RATP_DEL_CONN: - if (htsp_get(seen, n->arg1.net_name) == NULL) { - LibraryMenuTypePtr net; - int p; - - net = rats_patch_find_net(pcb, n->arg1.net_name, NETLIST_INPUT); -/* printf("net: '%s' %p\n", n->arg1.net_name, (void *)net);*/ - if (net != NULL) { - htsp_set(seen, n->arg1.net_name, net); - cb(ctx, PCB_RPE_INFO_BEGIN, n->arg1.net_name, NULL, NULL); - for (p = 0; p < net->EntryN; p++) { - LibraryEntryTypePtr entry = &net->Entry[p]; - cb(ctx, PCB_RPE_INFO_TERMINAL, n->arg1.net_name, NULL, entry->ListEntry); - } - cb(ctx, PCB_RPE_INFO_END, n->arg1.net_name, NULL, NULL); - - } - } - case RATP_CHANGE_ATTRIB: - break; - } - } - htsp_free(seen); - } - - /* action lines */ - for (n = pat; n != NULL; n = n->next) { - switch (n->op) { - case RATP_ADD_CONN: - cb(ctx, PCB_RPE_CONN_ADD, n->arg1.net_name, NULL, n->id); - break; - case RATP_DEL_CONN: - cb(ctx, PCB_RPE_CONN_DEL, n->arg1.net_name, NULL, n->id); - break; - case RATP_CHANGE_ATTRIB: - cb(ctx, PCB_RPE_ATTR_CHG, n->id, n->arg1.attrib_name, n->arg2.attrib_val); - break; - } - } - return 0; -} - -typedef struct { - FILE *f; - const char *q, *po, *pc, *line_prefix; -} fexport_t; - -static void fexport_cb(void *ctx_, pcb_rats_patch_export_ev_t ev, const char *netn, const char *key, const char *val) -{ - fexport_t *ctx = ctx_; - switch(ev) { - case PCB_RPE_INFO_BEGIN: fprintf(ctx->f, "%snet_info%s%s%s%s", ctx->line_prefix, ctx->po, ctx->q, netn, ctx->q); break; - case PCB_RPE_INFO_TERMINAL: fprintf(ctx->f, " %s%s%s", ctx->q, val, ctx->q); break; - case PCB_RPE_INFO_END: fprintf(ctx->f, "%s\n", ctx->pc); break; - case PCB_RPE_CONN_ADD: fprintf(ctx->f, "%sadd_conn%s%s%s%s %s%s%s%s\n", ctx->line_prefix, ctx->po, ctx->q, val, ctx->q, ctx->q, netn, ctx->q, ctx->pc); break; - case PCB_RPE_CONN_DEL: fprintf(ctx->f, "%sdel_conn%s%s%s%s %s%s%s%s\n", ctx->line_prefix, ctx->po, ctx->q, val, ctx->q, ctx->q, netn, ctx->q, ctx->pc); break; - case PCB_RPE_ATTR_CHG: - fprintf(ctx->f, "%schange_attrib%s%s%s%s %s%s%s %s%s%s%s\n", - ctx->line_prefix, ctx->po, - ctx->q, netn, ctx->q, - ctx->q, key, ctx->q, - ctx->q, val, ctx->q, - ctx->pc); - } -} - -int rats_patch_fexport(PCBTypePtr pcb, FILE *f, int fmt_pcb) -{ - fexport_t ctx; - if (fmt_pcb) { - ctx.q = "\""; - ctx.po = "("; - ctx.pc = ")"; - ctx.line_prefix = "\t"; - } - else { - ctx.q = ""; - ctx.po = " "; - ctx.pc = ""; - ctx.line_prefix = ""; - } - ctx.f = f; - return rats_patch_export(pcb, pcb->NetlistPatches, !fmt_pcb, fexport_cb, &ctx); -} - - -/* ---------------------------------------------------------------- */ -static const char replacefootprint_syntax[] = "ReplaceFootprint()\n"; - -static const char replacefootprint_help[] = "Replace the footprint of the selected components with the footprint specified."; - -static int ActionReplaceFootprint(int argc, const char **argv, Coord x, Coord y) -{ - const char *a[4]; - const char *fpname; - int found = 0; - - /* check if we have elements selected and quit if not */ - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, element)) { - found = 1; - break; - } - } - END_LOOP; - - if (!(found)) { - Message(PCB_MSG_DEFAULT, "ReplaceFootprint works on selected elements, please select elements first!\n"); - return 1; - } - - /* fetch the name of the new footprint */ - if (argc == 0) { - fpname = gui->prompt_for("Footprint name", ""); - if (fpname == NULL) { - Message(PCB_MSG_DEFAULT, "No footprint name supplied\n"); - return 1; - } - } - else - fpname = argv[0]; - - /* check if the footprint is available */ - a[0] = fpname; - a[1] = NULL; - if (LoadFootprint(1, a, x, y) != 0) { - Message(PCB_MSG_DEFAULT, "Can't load footprint %s\n", fpname); - return 1; - } - - - /* action: replace selected elements */ - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, element)) { - a[0] = fpname; - a[1] = element->Name[1].TextString; - a[2] = element->Name[2].TextString; - a[3] = NULL; - LoadFootprint(3, a, element->MarkX, element->MarkY); - CopyPastebufferToLayout(element->MarkX, element->MarkY); - rats_patch_append_optimize(PCB, RATP_CHANGE_ATTRIB, a[1], "footprint", fpname); - RemoveElement(element); - } - } - END_LOOP; - return 0; -} - -static const char savepatch_syntax[] = "SavePatch(filename)"; - -static const char savepatch_help[] = "Save netlist patch for back annotation."; - -/* %start-doc actions SavePatch -Save netlist patch for back annotation. -%end-doc */ -static int ActionSavePatch(int argc, const char **argv, Coord x, Coord y) -{ - const char *fn; - FILE *f; - - if (argc < 1) { - char *default_file; - - if (PCB->Filename != NULL) { - char *end; - int len; - len = strlen(PCB->Filename); - default_file = malloc(len + 8); - memcpy(default_file, PCB->Filename, len + 1); - end = strrchr(default_file, '.'); - if ((end == NULL) || (strcasecmp(end, ".pcb") != 0)) - end = default_file + len; - strcpy(end, ".bap"); - } - else - default_file = pcb_strdup("unnamed.bap"); - - fn = gui->fileselect(_("Save netlist patch as ..."), - _("Choose a file to save netlist patch to\n" - "for back annotation\n"), default_file, ".bap", "patch", 0); - - free(default_file); - } - else - fn = argv[0]; - f = fopen(fn, "w"); - if (f == NULL) { - Message(PCB_MSG_DEFAULT, "Can't open netlist patch file %s for writing\n", fn); - return 1; - } - rats_patch_fexport(PCB, f, 0); - fclose(f); - return 0; -} - -HID_Action rats_patch_action_list[] = { - {"ReplaceFootprint", 0, ActionReplaceFootprint, - replacefootprint_help, replacefootprint_syntax} - , - {"SavePatch", 0, ActionSavePatch, - savepatch_help, savepatch_syntax} -}; - -REGISTER_ACTIONS(rats_patch_action_list, NULL) Index: 1.1.4/src/misc_util.c =================================================================== --- 1.1.4/src/misc_util.c (revision 10776) +++ 1.1.4/src/misc_util.c (nonexistent) @@ -1,181 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2004,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* misc functions used by several modules - */ - -#include "config.h" -#include -#include -#include -#include -#include -#include -#include "misc_util.h" -#include "unit.h" - -/* Distance() should be used so that there is only one - * place to deal with overflow/precision errors - */ -double Distance(double x1, double y1, double x2, double y2) -{ - double delta_x = (x2 - x1); - double delta_y = (y2 - y1); - return sqrt(delta_x * delta_x + delta_y * delta_y); -} - -/* Distance2() should be used so that there is only one - * place to deal with overflow/precision errors - */ -double Distance2(double x1, double y1, double x2, double y2) -{ - double delta_x = (x2 - x1); - double delta_y = (y2 - y1); - return delta_x * delta_x + delta_y * delta_y; -} - -/* Get Value returns a numeric value passed from the string and sets the - * pcb_bool variable absolute to false if it leads with a +/- character - */ -double GetValue(const char *val, const char *units, pcb_bool * absolute, pcb_bool *success) -{ - return GetValueEx(val, units, absolute, NULL, "cmil", success); -} - -double GetValueEx(const char *val, const char *units, pcb_bool * absolute, UnitList extra_units, const char *default_unit, pcb_bool *success) -{ - double value; - int n = -1; - pcb_bool scaled = 0; - pcb_bool dummy; - - /* Allow NULL to be passed for absolute */ - if (absolute == NULL) - absolute = &dummy; - - /* if the first character is a sign we have to add the - * value to the current one - */ - if (*val == '=') { - *absolute = pcb_true; - sscanf(val + 1, "%lf%n", &value, &n); - n++; - } - else { - if (isdigit((int) *val)) - *absolute = pcb_true; - else - *absolute = pcb_false; - sscanf(val, "%lf%n", &value, &n); - } - if (n <= 0) - goto fail; - - if (!units && n > 0) - units = val + n; - - while (units && isspace(*units)) - units++; - - if (units && *units) { - int i, unit_ok = 0; - const Unit *unit = get_unit_struct(units); - if (unit != NULL) { - value = unit_to_coord(unit, value); - scaled = 1; - unit_ok = 1; - } - if (extra_units) { - for (i = 0; *extra_units[i].suffix; ++i) { - if (strncmp(units, extra_units[i].suffix, strlen(extra_units[i].suffix)) == 0) { - value *= extra_units[i].scale; - if (extra_units[i].flags & UNIT_PERCENT) - value /= 100.0; - scaled = 1; - unit_ok = 1; - } - } - } - if ((!unit_ok) && (success != NULL)) /* there was something after the number but it doesn't look like a valid unit */ - goto fail; - } - - /* Apply default unit */ - if (!scaled && default_unit && *default_unit) { - int i; - const Unit *unit = get_unit_struct(default_unit); - if (extra_units) - for (i = 0; *extra_units[i].suffix; ++i) - if (strcmp(extra_units[i].suffix, default_unit) == 0) { - value *= extra_units[i].scale; - if (extra_units[i].flags & UNIT_PERCENT) - value /= 100.0; - scaled = 1; - } - if (!scaled && unit != NULL) - value = unit_to_coord(unit, value); - } - - if (success != NULL) - *success = 1; - return value; - - fail:; - if (success != NULL) - *success = 0; - return 0; -} - -char *Concat(const char *first, ...) -{ - char *rv; - int len; - va_list a; - - len = strlen(first); - rv = (char *) malloc(len + 1); - strcpy(rv, first); - - va_start(a, first); - while (1) { - const char *s = va_arg(a, const char *); - if (!s) - break; - len += strlen(s); - rv = (char *) realloc(rv, len + 1); - strcat(rv, s); - } - va_end(a); - return rv; -} - -int mem_any_set(unsigned char *ptr, int bytes) -{ - while (bytes--) - if (*ptr++) - return 1; - return 0; -} Index: 1.1.4/src/hid_actions.h =================================================================== --- 1.1.4/src/hid_actions.h (revision 10776) +++ 1.1.4/src/hid_actions.h (nonexistent) @@ -1,35 +0,0 @@ -#ifndef PCB_HID_ACTIONS_H -#define PCB_HID_ACTIONS_H - -/* These are called from main_act.c */ -void print_actions(void); -void dump_actions(void); - - -/* HID internal interfaces. These may ONLY be called from the HID - modules, not from the common PCB code. */ - -const HID_Action *hid_find_action(const char *name); - -extern void hid_remove_actions(const HID_Action * a, int n); -extern void hid_remove_action(const HID_Action * a); -extern void hid_remove_actions_by_cookie(const char *cookie); - -int hid_action(const char *action_); -int hid_actionl(const char *action_, ...); /* NULL terminated */ -int hid_actionv(const char *action_, int argc_, const char **argv_); -int hid_actionv_(const HID_Action *a, int argc, const char **argv); - -/* Parse the given command string into action calls, and call - hid_actionv for each action found. Accepts both "action(arg1, - arg2)" and command-style "action arg1 arg2", allowing only one - action in the later case. Returns nonzero if the action handler(s) - return nonzero. */ -int hid_parse_command(const char *str_); - -/* Parse the given string into action calls, and call - hid_actionv for each action found. Accepts only - "action(arg1, arg2)" */ -int hid_parse_actions(const char *str_); - -#endif Index: 1.1.4/src/vtroutestyle.c =================================================================== --- 1.1.4/src/vtroutestyle.c (revision 10776) +++ 1.1.4/src/vtroutestyle.c (nonexistent) @@ -1,3 +0,0 @@ -#define GVT_DONT_UNDEF -#include "vtroutestyle.h" -#include Index: 1.1.4/src/change.h =================================================================== --- 1.1.4/src/change.h (revision 10776) +++ 1.1.4/src/change.h (nonexistent) @@ -1,122 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes to change object properties */ - -#ifndef PCB_CHANGE_H -#define PCB_CHANGE_H - -#include "global.h" - -/* --------------------------------------------------------------------------- - * some defines - */ -#define CHANGENAME_TYPES \ - (PCB_TYPE_VIA | PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT | PCB_TYPE_ELEMENT_NAME | PCB_TYPE_LINE) - -#define CHANGESIZE_TYPES \ - (PCB_TYPE_POLYGON | PCB_TYPE_VIA | PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_LINE | \ - PCB_TYPE_ARC | PCB_TYPE_TEXT | PCB_TYPE_ELEMENT_NAME | PCB_TYPE_ELEMENT) - -#define CHANGE2NDSIZE_TYPES \ - (PCB_TYPE_VIA | PCB_TYPE_PIN | PCB_TYPE_ELEMENT) - -/* We include polygons here only to inform the user not to do it that way. */ -#define CHANGECLEARSIZE_TYPES \ - (PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_VIA | PCB_TYPE_LINE | PCB_TYPE_ARC | PCB_TYPE_POLYGON) - -#define CHANGENONETLIST_TYPES \ - (PCB_TYPE_ELEMENT) - -#define CHANGESQUARE_TYPES \ - (PCB_TYPE_ELEMENT | PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_VIA) - -#define CHANGEOCTAGON_TYPES \ - (PCB_TYPE_ELEMENT | PCB_TYPE_PIN | PCB_TYPE_VIA) - -#define CHANGEJOIN_TYPES \ - (PCB_TYPE_ARC | PCB_TYPE_LINE | PCB_TYPE_TEXT) - -#define CHANGETHERMAL_TYPES \ - (PCB_TYPE_PIN | PCB_TYPE_VIA) - -#define CHANGEMASKSIZE_TYPES \ - (PCB_TYPE_PIN | PCB_TYPE_VIA | PCB_TYPE_PAD) - -pcb_bool ChangeLayoutName(char *); -pcb_bool ChangeLayerName(LayerTypePtr, char *); -pcb_bool ChangeSelectedSize(int, Coord, pcb_bool); -pcb_bool ChangeSelectedClearSize(int, Coord, pcb_bool); -pcb_bool ChangeSelected2ndSize(int, Coord, pcb_bool); -pcb_bool ChangeSelectedMaskSize(int, Coord, pcb_bool); -pcb_bool ChangeSelectedJoin(int); -pcb_bool SetSelectedJoin(int); -pcb_bool ClrSelectedJoin(int); -pcb_bool ChangeSelectedNonetlist(int); -pcb_bool ChangeSelectedSquare(int); -pcb_bool SetSelectedSquare(int); -pcb_bool ClrSelectedSquare(int); -pcb_bool ChangeSelectedThermals(int, int); -pcb_bool ChangeSelectedHole(void); -pcb_bool ChangeSelectedPaste(void); -pcb_bool ChangeSelectedOctagon(int); -pcb_bool SetSelectedOctagon(int); -pcb_bool ClrSelectedOctagon(int); -pcb_bool ChangeSelectedElementSide(void); -pcb_bool ChangeElementSide(ElementTypePtr, Coord); -pcb_bool ChangeHole(PinTypePtr); -pcb_bool ChangePaste(PadTypePtr); -pcb_bool ChangeObjectSize(int, void *, void *, void *, Coord, pcb_bool); -pcb_bool ChangeObject1stSize(int, void *, void *, void *, Coord, pcb_bool); -pcb_bool ChangeObjectThermal(int, void *, void *, void *, int); -pcb_bool ChangeObjectClearSize(int, void *, void *, void *, Coord, pcb_bool); -pcb_bool ChangeObject2ndSize(int, void *, void *, void *, Coord, pcb_bool, pcb_bool); -pcb_bool ChangeObjectMaskSize(int, void *, void *, void *, Coord, pcb_bool); -pcb_bool ChangeObjectJoin(int, void *, void *, void *); -pcb_bool SetObjectJoin(int, void *, void *, void *); -pcb_bool ClrObjectJoin(int, void *, void *, void *); -pcb_bool ChangeObjectNonetlist(int Type, void *Ptr1, void *Ptr2, void *Ptr3); -pcb_bool ChangeObjectSquare(int, void *, void *, void *, int); -pcb_bool SetObjectSquare(int, void *, void *, void *); -pcb_bool ClrObjectSquare(int, void *, void *, void *); -pcb_bool ChangeObjectOctagon(int, void *, void *, void *); -pcb_bool SetObjectOctagon(int, void *, void *, void *); -pcb_bool ClrObjectOctagon(int, void *, void *, void *); -void *ChangeObjectName(int, void *, void *, void *, char *); -void *QueryInputAndChangeObjectName(int, void *, void *, void *, int); -void ChangePCBSize(Coord, Coord); -void *ChangeObjectPinnum(int Type, void *Ptr1, void *Ptr2, void *Ptr3, char *Name); -pcb_bool ChangeObjectRadius(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int is_x, Coord r, pcb_bool absolute); -pcb_bool ChangeObjectAngle(int Type, void *Ptr1, void *Ptr2, void *Ptr3, int is_start, Angle a, pcb_bool absolute); -pcb_bool ChangeSelectedAngle(int types, int is_start, Angle Difference, pcb_bool fixIt); -pcb_bool ChangeSelectedRadius(int types, int is_start, Angle Difference, pcb_bool fixIt); - -/* Change the specified text on an element, either on the board (give - PCB, PCB->Data) or in a buffer (give NULL, Buffer->Data). The old - string is returned, and must be properly freed by the caller. */ -char *ChangeElementText(PCBType * pcb, DataType * data, ElementTypePtr Element, int which, char *new_name); - -#endif Index: 1.1.4/src/find_misc.c =================================================================== --- 1.1.4/src/find_misc.c (revision 10776) +++ 1.1.4/src/find_misc.c (nonexistent) @@ -1,476 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - -static void DrawNewConnections(void); - -/* --------------------------------------------------------------------------- - * checks if all lists of new objects are handled - */ -static pcb_bool ListsEmpty(pcb_bool AndRats) -{ - pcb_bool empty; - int i; - - empty = (PVList.Location >= PVList.Number); - if (AndRats) - empty = empty && (RatList.Location >= RatList.Number); - for (i = 0; i < max_copper_layer && empty; i++) - empty = empty && LineList[i].Location >= LineList[i].Number - && ArcList[i].Location >= ArcList[i].Number && PolygonList[i].Location >= PolygonList[i].Number; - return (empty); -} - -static void reassign_no_drc_flags(void) -{ - int layer; - - for (layer = 0; layer < max_copper_layer; layer++) { - LayerTypePtr l = LAYER_PTR(layer); - l->no_drc = AttributeGet(l, "PCB::skip-drc") != NULL; - } -} - - -/* --------------------------------------------------------------------------- - * loops till no more connections are found - */ -static pcb_bool DoIt(pcb_bool AndRats, pcb_bool AndDraw) -{ - pcb_bool newone = pcb_false; - reassign_no_drc_flags(); - do { - /* lookup connections; these are the steps (2) to (4) - * from the description - */ - newone = LookupPVConnectionsToPVList() || - LookupLOConnectionsToPVList(AndRats) || LookupLOConnectionsToLOList(AndRats) || LookupPVConnectionsToLOList(AndRats); - if (AndDraw) - DrawNewConnections(); - } - while (!newone && !ListsEmpty(AndRats)); - if (AndDraw) - Draw(); - return (newone); -} - -/* --------------------------------------------------------------------------- - * draws all new connections which have been found since the - * routine was called the last time - */ -static void DrawNewConnections(void) -{ - int i; - pcb_cardinal_t position; - - /* decrement 'i' to keep layerstack order */ - for (i = max_copper_layer - 1; i != -1; i--) { - pcb_cardinal_t layer = LayerStack[i]; - - if (PCB->Data->Layer[layer].On) { - /* draw all new lines */ - position = LineList[layer].DrawLocation; - for (; position < LineList[layer].Number; position++) - DrawLine(LAYER_PTR(layer), LINELIST_ENTRY(layer, position)); - LineList[layer].DrawLocation = LineList[layer].Number; - - /* draw all new arcs */ - position = ArcList[layer].DrawLocation; - for (; position < ArcList[layer].Number; position++) - DrawArc(LAYER_PTR(layer), ARCLIST_ENTRY(layer, position)); - ArcList[layer].DrawLocation = ArcList[layer].Number; - - /* draw all new polygons */ - position = PolygonList[layer].DrawLocation; - for (; position < PolygonList[layer].Number; position++) - DrawPolygon(LAYER_PTR(layer), POLYGONLIST_ENTRY(layer, position)); - PolygonList[layer].DrawLocation = PolygonList[layer].Number; - } - } - - /* draw all new pads */ - if (PCB->PinOn) - for (i = 0; i < 2; i++) { - position = PadList[i].DrawLocation; - - for (; position < PadList[i].Number; position++) - DrawPad(PADLIST_ENTRY(i, position)); - PadList[i].DrawLocation = PadList[i].Number; - } - - /* draw all new PVs; 'PVList' holds a list of pointers to the - * sorted array pointers to PV data - */ - while (PVList.DrawLocation < PVList.Number) { - PinTypePtr pv = PVLIST_ENTRY(PVList.DrawLocation); - - if (TEST_FLAG(PCB_FLAG_PIN, pv)) { - if (PCB->PinOn) - DrawPin(pv); - } - else if (PCB->ViaOn) - DrawVia(pv); - PVList.DrawLocation++; - } - /* draw the new rat-lines */ - if (PCB->RatOn) { - position = RatList.DrawLocation; - for (; position < RatList.Number; position++) - DrawRat(RATLIST_ENTRY(position)); - RatList.DrawLocation = RatList.Number; - } -} - -/*--------------------------------------------------------------------------- - * add the starting object to the list of found objects - */ -static pcb_bool ListStart(int type, void *ptr1, void *ptr2, void *ptr3) -{ - DumpList(); - switch (type) { - case PCB_TYPE_PIN: - case PCB_TYPE_VIA: - { - if (ADD_PV_TO_LIST((PinTypePtr) ptr2, 0, NULL, FCT_START)) - return pcb_true; - break; - } - - case PCB_TYPE_RATLINE: - { - if (ADD_RAT_TO_LIST((RatTypePtr) ptr1, 0, NULL, FCT_START)) - return pcb_true; - break; - } - - case PCB_TYPE_LINE: - { - int layer = GetLayerNumber(PCB->Data, - (LayerTypePtr) ptr1); - - if (ADD_LINE_TO_LIST(layer, (LineTypePtr) ptr2, 0, NULL, FCT_START)) - return pcb_true; - break; - } - - case PCB_TYPE_ARC: - { - int layer = GetLayerNumber(PCB->Data, - (LayerTypePtr) ptr1); - - if (ADD_ARC_TO_LIST(layer, (ArcTypePtr) ptr2, 0, NULL, FCT_START)) - return pcb_true; - break; - } - - case PCB_TYPE_POLYGON: - { - int layer = GetLayerNumber(PCB->Data, - (LayerTypePtr) ptr1); - - if (ADD_POLYGON_TO_LIST(layer, (PolygonTypePtr) ptr2, 0, NULL, FCT_START)) - return pcb_true; - break; - } - - case PCB_TYPE_PAD: - { - PadTypePtr pad = (PadTypePtr) ptr2; - if (ADD_PAD_TO_LIST(TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER, pad, 0, NULL, FCT_START)) - return pcb_true; - break; - } - } - return (pcb_false); -} - - -/* --------------------------------------------------------------------------- - * looks up all connections from the object at the given coordinates - * the TheFlag (normally 'PCB_FLAG_FOUND') is set for all objects found - * the objects are re-drawn if AndDraw is pcb_true - * also the action is marked as undoable if AndDraw is pcb_true - */ -void LookupConnection(Coord X, Coord Y, pcb_bool AndDraw, Coord Range, int which_flag) -{ - void *ptr1, *ptr2, *ptr3; - char *name; - int type; - - /* check if there are any pins or pads at that position */ - - reassign_no_drc_flags(); - - type = SearchObjectByLocation(LOOKUP_FIRST, &ptr1, &ptr2, &ptr3, X, Y, Range); - if (type == PCB_TYPE_NONE) { - type = SearchObjectByLocation(LOOKUP_MORE, &ptr1, &ptr2, &ptr3, X, Y, Range); - if (type == PCB_TYPE_NONE) - return; - if (type & SILK_TYPE) { - int laynum = GetLayerNumber(PCB->Data, - (LayerTypePtr) ptr1); - - /* don't mess with non-conducting objects! */ - if (laynum >= max_copper_layer || ((LayerTypePtr) ptr1)->no_drc) - return; - } - } - else { - name = ConnectionName(type, ptr1, ptr2); - hid_actionl("NetlistShow", name, NULL); - } - - TheFlag = which_flag; - User = AndDraw; - InitConnectionLookup(); - - /* now add the object to the appropriate list and start scanning - * This is step (1) from the description - */ - ListStart(type, ptr1, ptr2, ptr3); - DoIt(pcb_true, AndDraw); - if (User) - IncrementUndoSerialNumber(); - User = pcb_false; - - /* we are done */ - if (AndDraw) - Draw(); - if (AndDraw && conf_core.editor.beep_when_finished) - gui->beep(); - FreeConnectionLookupMemory(); -} - -void LookupConnectionByPin(int type, void *ptr1) -{ - User = 0; - InitConnectionLookup(); - ListStart(type, NULL, ptr1, NULL); - - DoIt(pcb_true, pcb_false); - - FreeConnectionLookupMemory(); -} - - -/* --------------------------------------------------------------------------- - * find connections for rats nesting - * assumes InitConnectionLookup() has already been done - */ -void RatFindHook(int type, void *ptr1, void *ptr2, void *ptr3, pcb_bool undo, pcb_bool AndRats) -{ - User = undo; - DumpList(); - ListStart(type, ptr1, ptr2, ptr3); - DoIt(AndRats, pcb_false); - User = pcb_false; -} - -/* --------------------------------------------------------------------------- - * resets all used flags of pins and vias - */ -pcb_bool ResetFoundPinsViasAndPads(pcb_bool AndDraw) -{ - pcb_bool change = pcb_false; - - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(TheFlag, via)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_VIA, via, via, via); - CLEAR_FLAG(TheFlag, via); - if (AndDraw) - DrawVia(via); - change = pcb_true; - } - } - END_LOOP; - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (TEST_FLAG(TheFlag, pin)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_PIN, element, pin, pin); - CLEAR_FLAG(TheFlag, pin); - if (AndDraw) - DrawPin(pin); - change = pcb_true; - } - } - END_LOOP; - PAD_LOOP(element); - { - if (TEST_FLAG(TheFlag, pad)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_PAD, element, pad, pad); - CLEAR_FLAG(TheFlag, pad); - if (AndDraw) - DrawPad(pad); - change = pcb_true; - } - } - END_LOOP; - } - END_LOOP; - if (change) - SetChangedFlag(pcb_true); - return change; -} - -/* --------------------------------------------------------------------------- - * resets all used flags of LOs - */ -pcb_bool ResetFoundLinesAndPolygons(pcb_bool AndDraw) -{ - pcb_bool change = pcb_false; - - RAT_LOOP(PCB->Data); - { - if (TEST_FLAG(TheFlag, line)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, line, line, line); - CLEAR_FLAG(TheFlag, line); - if (AndDraw) - DrawRat(line); - change = pcb_true; - } - } - END_LOOP; - COPPERLINE_LOOP(PCB->Data); - { - if (TEST_FLAG(TheFlag, line)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_LINE, layer, line, line); - CLEAR_FLAG(TheFlag, line); - if (AndDraw) - DrawLine(layer, line); - change = pcb_true; - } - } - ENDALL_LOOP; - COPPERARC_LOOP(PCB->Data); - { - if (TEST_FLAG(TheFlag, arc)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_ARC, layer, arc, arc); - CLEAR_FLAG(TheFlag, arc); - if (AndDraw) - DrawArc(layer, arc); - change = pcb_true; - } - } - ENDALL_LOOP; - COPPERPOLYGON_LOOP(PCB->Data); - { - if (TEST_FLAG(TheFlag, polygon)) { - if (AndDraw) - AddObjectToFlagUndoList(PCB_TYPE_POLYGON, layer, polygon, polygon); - CLEAR_FLAG(TheFlag, polygon); - if (AndDraw) - DrawPolygon(layer, polygon); - change = pcb_true; - } - } - ENDALL_LOOP; - if (change) - SetChangedFlag(pcb_true); - return change; -} - -/* --------------------------------------------------------------------------- - * resets all found connections - */ -pcb_bool ResetConnections(pcb_bool AndDraw) -{ - pcb_bool change = pcb_false; - - change = ResetFoundPinsViasAndPads(AndDraw) || change; - change = ResetFoundLinesAndPolygons(AndDraw) || change; - - return change; -} - -/*---------------------------------------------------------------------------- - * Dumps the list contents - */ -static void DumpList(void) -{ - pcb_cardinal_t i; - - for (i = 0; i < 2; i++) { - PadList[i].Number = 0; - PadList[i].Location = 0; - PadList[i].DrawLocation = 0; - } - - PVList.Number = 0; - PVList.Location = 0; - - for (i = 0; i < max_copper_layer; i++) { - LineList[i].Location = 0; - LineList[i].DrawLocation = 0; - LineList[i].Number = 0; - ArcList[i].Location = 0; - ArcList[i].DrawLocation = 0; - ArcList[i].Number = 0; - PolygonList[i].Location = 0; - PolygonList[i].DrawLocation = 0; - PolygonList[i].Number = 0; - } - RatList.Number = 0; - RatList.Location = 0; - RatList.DrawLocation = 0; -} - -/*---------------------------------------------------------------------------- - * set up a temporary flag to use - */ -void SaveFindFlag(int NewFlag) -{ - OldFlag = TheFlag; - TheFlag = NewFlag; -} - -/*---------------------------------------------------------------------------- - * restore flag - */ -void RestoreFindFlag(void) -{ - TheFlag = OldFlag; -} - -void InitConnectionLookup(void) -{ - InitComponentLookup(); - InitLayoutLookup(); -} - -void FreeConnectionLookupMemory(void) -{ - FreeComponentLookupMemory(); - FreeLayoutLookupMemory(); -} Index: 1.1.4/src/find_print.c =================================================================== --- 1.1.4/src/find_print.c (revision 10776) +++ 1.1.4/src/find_print.c (nonexistent) @@ -1,288 +0,0 @@ -/* - * - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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 - * - */ - -/* Connection export/output functions */ - -static pcb_bool PrepareNextLoop(FILE * FP); - -/* --------------------------------------------------------------------------- - * prints all unused pins of an element to file FP - */ -static pcb_bool PrintAndSelectUnusedPinsAndPadsOfElement(ElementTypePtr Element, FILE * FP) -{ - pcb_bool first = pcb_true; - pcb_cardinal_t number; - - /* check all pins in element */ - - PIN_LOOP(Element); - { - if (!TEST_FLAG(PCB_FLAG_HOLE, pin)) { - /* pin might have bee checked before, add to list if not */ - if (!TEST_FLAG(TheFlag, pin) && FP) { - int i; - if (ADD_PV_TO_LIST(pin, 0, NULL, 0)) - return pcb_true; - DoIt(pcb_true, pcb_true); - number = PadList[COMPONENT_LAYER].Number + PadList[SOLDER_LAYER].Number + PVList.Number; - /* the pin has no connection if it's the only - * list entry; don't count vias - */ - for (i = 0; i < PVList.Number; i++) - if (!PVLIST_ENTRY(i)->Element) - number--; - if (number == 1) { - /* output of element name if not already done */ - if (first) { - PrintConnectionElementName(Element, FP); - first = pcb_false; - } - - /* write name to list and draw selected object */ - fputc('\t', FP); - PrintQuotedString(FP, (char *) EMPTY(pin->Name)); - fputc('\n', FP); - SET_FLAG(PCB_FLAG_SELECTED, pin); - DrawPin(pin); - } - - /* reset found objects for the next pin */ - if (PrepareNextLoop(FP)) - return (pcb_true); - } - } - } - END_LOOP; - - /* check all pads in element */ - PAD_LOOP(Element); - { - /* lookup pad in list */ - /* pad might has bee checked before, add to list if not */ - if (!TEST_FLAG(TheFlag, pad) && FP) { - int i; - if (ADD_PAD_TO_LIST(TEST_FLAG(PCB_FLAG_ONSOLDER, pad) - ? SOLDER_LAYER : COMPONENT_LAYER, pad, 0, NULL, 0)) - return pcb_true; - DoIt(pcb_true, pcb_true); - number = PadList[COMPONENT_LAYER].Number + PadList[SOLDER_LAYER].Number + PVList.Number; - /* the pin has no connection if it's the only - * list entry; don't count vias - */ - for (i = 0; i < PVList.Number; i++) - if (!PVLIST_ENTRY(i)->Element) - number--; - if (number == 1) { - /* output of element name if not already done */ - if (first) { - PrintConnectionElementName(Element, FP); - first = pcb_false; - } - - /* write name to list and draw selected object */ - fputc('\t', FP); - PrintQuotedString(FP, (char *) EMPTY(pad->Name)); - fputc('\n', FP); - - SET_FLAG(PCB_FLAG_SELECTED, pad); - DrawPad(pad); - } - - /* reset found objects for the next pin */ - if (PrepareNextLoop(FP)) - return (pcb_true); - } - } - END_LOOP; - - /* print separator if element has unused pins or pads */ - if (!first) { - fputs("}\n\n", FP); - SEPARATE(FP); - } - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * resets some flags for looking up the next pin/pad - */ -static pcb_bool PrepareNextLoop(FILE * FP) -{ - pcb_cardinal_t layer; - - /* reset found LOs for the next pin */ - for (layer = 0; layer < max_copper_layer; layer++) { - LineList[layer].Location = LineList[layer].Number = 0; - ArcList[layer].Location = ArcList[layer].Number = 0; - PolygonList[layer].Location = PolygonList[layer].Number = 0; - } - - /* reset found pads */ - for (layer = 0; layer < 2; layer++) - PadList[layer].Location = PadList[layer].Number = 0; - - /* reset PVs */ - PVList.Number = PVList.Location = 0; - RatList.Number = RatList.Location = 0; - - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * finds all connections to the pins of the passed element. - * The result is written to file FP - * Returns pcb_true if operation was aborted - */ -static pcb_bool PrintElementConnections(ElementTypePtr Element, FILE * FP, pcb_bool AndDraw) -{ - PrintConnectionElementName(Element, FP); - - /* check all pins in element */ - PIN_LOOP(Element); - { - /* pin might have been checked before, add to list if not */ - if (TEST_FLAG(TheFlag, pin)) { - PrintConnectionListEntry((char *) EMPTY(pin->Name), NULL, pcb_true, FP); - fputs("\t\t__CHECKED_BEFORE__\n\t}\n", FP); - continue; - } - if (ADD_PV_TO_LIST(pin, PCB_TYPE_ELEMENT, Element, FCT_ELEMENT)) - return pcb_true; - DoIt(pcb_true, AndDraw); - /* printout all found connections */ - PrintPinConnections(FP, pcb_true); - PrintPadConnections(COMPONENT_LAYER, FP, pcb_false); - PrintPadConnections(SOLDER_LAYER, FP, pcb_false); - fputs("\t}\n", FP); - if (PrepareNextLoop(FP)) - return (pcb_true); - } - END_LOOP; - - /* check all pads in element */ - PAD_LOOP(Element); - { - pcb_cardinal_t layer; - /* pad might have been checked before, add to list if not */ - if (TEST_FLAG(TheFlag, pad)) { - PrintConnectionListEntry((char *) EMPTY(pad->Name), NULL, pcb_true, FP); - fputs("\t\t__CHECKED_BEFORE__\n\t}\n", FP); - continue; - } - layer = TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? SOLDER_LAYER : COMPONENT_LAYER; - if (ADD_PAD_TO_LIST(layer, pad, PCB_TYPE_ELEMENT, Element, FCT_ELEMENT)) - return pcb_true; - DoIt(pcb_true, AndDraw); - /* print all found connections */ - PrintPadConnections(layer, FP, pcb_true); - PrintPadConnections(layer == (COMPONENT_LAYER ? SOLDER_LAYER : COMPONENT_LAYER), FP, pcb_false); - PrintPinConnections(FP, pcb_false); - fputs("\t}\n", FP); - if (PrepareNextLoop(FP)) - return (pcb_true); - } - END_LOOP; - fputs("}\n\n", FP); - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * find all unused pins of all element - */ -void LookupUnusedPins(FILE * FP) -{ - /* reset all currently marked connections */ - User = pcb_true; - ResetConnections(pcb_true); - InitConnectionLookup(); - - ELEMENT_LOOP(PCB->Data); - { - /* break if abort dialog returned pcb_true; - * passing NULL as filedescriptor discards the normal output - */ - if (PrintAndSelectUnusedPinsAndPadsOfElement(element, FP)) - break; - } - END_LOOP; - - if (conf_core.editor.beep_when_finished) - gui->beep(); - FreeConnectionLookupMemory(); - IncrementUndoSerialNumber(); - User = pcb_false; - Draw(); -} - -/* --------------------------------------------------------------------------- - * find all connections to pins within one element - */ -void LookupElementConnections(ElementTypePtr Element, FILE * FP) -{ - /* reset all currently marked connections */ - User = pcb_true; - TheFlag = PCB_FLAG_FOUND; - ResetConnections(pcb_true); - InitConnectionLookup(); - PrintElementConnections(Element, FP, pcb_true); - SetChangedFlag(pcb_true); - if (conf_core.editor.beep_when_finished) - gui->beep(); - FreeConnectionLookupMemory(); - IncrementUndoSerialNumber(); - User = pcb_false; - Draw(); -} - - -/* --------------------------------------------------------------------------- - * find all connections to pins of all element - */ -void LookupConnectionsToAllElements(FILE * FP) -{ - /* reset all currently marked connections */ - User = pcb_false; - TheFlag = PCB_FLAG_FOUND; - ResetConnections(pcb_false); - InitConnectionLookup(); - - ELEMENT_LOOP(PCB->Data); - { - /* break if abort dialog returned pcb_true */ - if (PrintElementConnections(element, FP, pcb_false)) - break; - SEPARATE(FP); - if (conf_core.editor.reset_after_element && gdl_it_idx(&__it__) != 1) - ResetConnections(pcb_false); - } - END_LOOP; - if (conf_core.editor.beep_when_finished) - gui->beep(); - ResetConnections(pcb_false); - FreeConnectionLookupMemory(); - Redraw(); -} Index: 1.1.4/src/misc_util.h =================================================================== --- 1.1.4/src/misc_util.h (revision 10776) +++ 1.1.4/src/misc_util.h (nonexistent) @@ -1,51 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for misc routines - independent of PCB data types */ - -#ifndef PCB_MISC_UTIL_H -#define PCB_MISC_UTIL_H - -#include "pcb_bool.h" - -double Distance(double x1, double y1, double x2, double y2); -double Distance2(double x1, double y1, double x2, double y2); /* distance square */ - -enum unitflags { UNIT_PERCENT = 1 }; - -typedef struct { - const char *suffix; - double scale; - enum unitflags flags; -} UnitList[]; - -double GetValue(const char *, const char *, pcb_bool *, pcb_bool *success); -double GetValueEx(const char *, const char *, pcb_bool *, UnitList, const char *, pcb_bool *success); - -char *Concat(const char *, ...); /* end with NULL */ -int mem_any_set(unsigned char *ptr, int bytes); - -#endif Index: 1.1.4/src/rats_patch.h =================================================================== --- 1.1.4/src/rats_patch.h (revision 10776) +++ 1.1.4/src/rats_patch.h (nonexistent) @@ -1,76 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2013..2015 Tibor 'Igor2' Palinkas - * - * This module, rats.c, was written and is Copyright (C) 1997 by harry eaton - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Change History: - * Started 6/10/97 - * Added support for minimum length rat lines 6/13/97 - * rat lines to nearest line/via 8/29/98 - * support for netlist window 10/24/98 - */ - -#include "global.h" - -/* Single-word netlist class names */ -const char *pcb_netlist_names[NUM_NETLISTS]; - -/* Allocate and append a patch line to the patch list */ -void rats_patch_append(PCBTypePtr pcb, rats_patch_op_t op, const char *id, const char *a1, const char *a2); - -/* Free the patch list and all memory claimed by patch list items */ -void rats_patch_destroy(PCBTypePtr pcb); - -/* Same as rats_patch_append() but also optimize previous entries so that - redundant entries are removed */ -void rats_patch_append_optimize(PCBTypePtr pcb, rats_patch_op_t op, const char *id, const char *a1, const char *a2); - -/* Create [NETLIST_EDITED] from [NETLIST_INPUT] applying the patch */ -void rats_patch_make_edited(PCBTypePtr pcb); - -/* apply a single patch record on [NETLIST_EDITED]; returns non-zero on failure */ -int rats_patch_apply(PCBTypePtr pcb, rats_patch_line_t * patch); - -/**** exporter ****/ - -/* Special text exporter: - save all patch lines as an ordered list of text lines - if fmt is non-zero, generate pcb savefile compatible lines, else generate a back annotation patch */ -int rats_patch_fexport(PCBTypePtr pcb, FILE * f, int fmt_pcb); - -/* Generic, callback based exporter: */ - - /* EVENT ARGUMENTS */ -typedef enum { /* netn is always the net name, unless specified otherwise */ - PCB_RPE_INFO_BEGIN, /* netn */ - PCB_RPE_INFO_TERMINAL, /* netn; val is the terminal pin/pad name */ - PCB_RPE_INFO_END, /* netn */ - - PCB_RPE_CONN_ADD, /* netn; val is the terminal pin/pad name */ - PCB_RPE_CONN_DEL, /* netn; val is the terminal pin/pad name */ - PCB_RPE_ATTR_CHG /* netn; key is the attribute name, val is the new attribute value */ -} pcb_rats_patch_export_ev_t; - -/* Call cb() for each item to output; PCB_PTRE_INFO* is calculated/called only - if need_info_lines is true; the pcb pointer is used for looking up connections */ -int rats_patch_export(PCBType *pcb, rats_patch_line_t *pat, pcb_bool need_info_lines, void (*cb)(void *ctx, pcb_rats_patch_export_ev_t ev, const char *netn, const char *key, const char *val), void *ctx); Index: 1.1.4/src/vtroutestyle.h =================================================================== --- 1.1.4/src/vtroutestyle.h (revision 10776) +++ 1.1.4/src/vtroutestyle.h (nonexistent) @@ -1,74 +0,0 @@ -#include -#include -#include "unit.h" - -/* Elem=RouteStyle; init=0 */ - -typedef struct { - Coord Thick, /* line thickness */ - Diameter, /* via diameter */ - Hole, /* via drill hole */ - Clearance; /* min. separation from other nets */ - char name[32]; /* fixed length name to save malloc/free */ -/* int index;*/ -} RouteStyleType, *RouteStyleTypePtr; - -/* all public symbols are wrapped in GVT() - see vt_t(7) */ -#define GVT(x) vtroutestyle_ ## x -#define HAVE_VTROUTESTYLE_T - -/* Array elem type - see vt_t(7) */ -#define GVT_ELEM_TYPE RouteStyleType - -/* Type that represents array lengths - see vt_t(7) */ -#define GVT_SIZE_TYPE size_t - -/* Below this length, always double allocation size when the array grows */ -#define GVT_DOUBLING_THRS 16 - -/* Initial array size when the first element is written */ -#define GVT_START_SIZE 4 - -/* Optional terminator; when present, it is always appended at the end - see - vt_term(7)*/ -/* #define GVT_TERM '\0' */ - -/* Optional prefix for function definitions (e.g. static inline) */ -#define GVT_FUNC - -/* Enable this to set all new bytes ever allocated to this value - see - vt_set_new_bytes_to(7) */ -#define GVT_SET_NEW_BYTES_TO 0 - -/* Enable GVT_INIT_ELEM_FUNC and an user configured function is called - for each new element allocated (even between used and alloced). - See vt_init_elem(7) */ -/*#define GVT_INIT_ELEM_FUNC*/ - -/* Enable GVT_ELEM_CONSTRUCTOR and an user configured function is called - for each element that is getting within the range of ->used. - See vt_construction(7) */ -/*#define GVT_ELEM_CONSTRUCTOR */ - -/* Enable GVT_ELEM_DESTRUCTOR and an user configured function is called - for each element that was once constructed and now getting beyond ->used. - See vt_construction(7) */ -/*#define GVT_ELEM_DESTRUCTOR */ - -/* Enable GVT_ELEM_COPY and an user configured function is called - for copying elements into the array. - See vt_construction(7) */ -/*#define GVT_ELEM_COPY */ - -/* Optional extra fields in the vector struct - see vt_user_fields(7) */ -/* #define GVT_USER_FIELDS int foo; char bar[12]; */ - -/* Include the actual header implementation */ -#include - -/* Memory allocator - see vt_allocation(7) */ -#define GVT_REALLOC(vect, ptr, size) realloc(ptr, size) -#define GVT_FREE(vect, ptr) free(ptr) - -/* clean up #defines */ -#include Index: 1.1.4/src/free_atexit.c =================================================================== --- 1.1.4/src/free_atexit.c (revision 10776) +++ 1.1.4/src/free_atexit.c (nonexistent) @@ -1,109 +0,0 @@ -/* COPYRIGHT - * - * Copyright (C) 2010 PCB Contributors (see ChangeLog for details) - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -#include -#include - -/* we need one ID per context - short int with 64k IDs should be enough */ -typedef unsigned int leaky_idx_t; - - -/* This structure should be as big as void *, which should be the natural -bit-width of the architecture. We allocate extra admin space to be as big -as this union, to preserve alignment of pointers returned by malloc(). -NOTE: in the special corner case when leaky_idx_t is wider than void * but -not multiple of it, the alignment will be messed up, potentially causing slower -memory access. */ -typedef union { - leaky_idx_t idx; - void *ptr; -} leaky_admin_t; - -static void **free_list = NULL; -static leaky_idx_t free_size = 0; - - -void *leaky_malloc(size_t size) -{ - char *new_memory = malloc(size + sizeof(leaky_admin_t)); - - free_list = (void **) realloc(free_list, (free_size + 1) * sizeof(void *)); - free_list[free_size] = new_memory; - *(leaky_idx_t *) new_memory = free_size; - - free_size++; - return new_memory + sizeof(leaky_admin_t); -} - -void *leaky_calloc(size_t nmemb, size_t size) -{ - size_t size_ = size * nmemb; - void *new_memory = leaky_malloc(size_); - - memset(new_memory, 0, size_); - return new_memory; -} - -void *leaky_realloc(void *old_memory_, size_t size) -{ - char *new_memory; - char *old_memory = old_memory_; - leaky_idx_t i; - - if (old_memory == NULL) - return leaky_malloc(size); - - old_memory -= sizeof(leaky_admin_t); - - i = *(leaky_idx_t *) old_memory; - - new_memory = realloc(old_memory, size + sizeof(leaky_admin_t)); - free_list[i] = new_memory; - - return new_memory + sizeof(leaky_admin_t); -} - -char *leaky_strdup(const char *src) -{ - int len = strlen(src)+1; - char *res = leaky_malloc(len); - memcpy(res, src, len); - return res; -} - -void leaky_uninit(void) -{ - int i; - - for (i = 0; i < free_size; i++) - free(free_list[i]); - - free(free_list); - free_size = 0; -} - -void leaky_init(void) -{ - atexit(leaky_uninit); -} Index: 1.1.4/src/hid_cfg_input.c =================================================================== --- 1.1.4/src/hid_cfg_input.c (revision 10776) +++ 1.1.4/src/hid_cfg_input.c (nonexistent) @@ -1,459 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "global.h" -#include "hid.h" -#include "hid_cfg.h" -#include "hid_cfg_input.h" -#include "hid_actions.h" -#include "hid_cfg_action.h" -#include "error.h" - -/* split value into a list of '-' separated words; examine each word - and set the bitmask of modifiers */ -static hid_cfg_mod_t parse_mods(const char *value, const char **last, unsigned int vlen) -{ - hid_cfg_mod_t m = 0; - int press = 0; - const char *next; - - while(isspace(*value)) value++; - - if (*value != '<') { - for(;;) { - if ((vlen >= 5) && (strncasecmp(value, "shift", 5) == 0)) m |= M_Shift; - else if ((vlen >= 4) && (strncasecmp(value, "ctrl", 4) == 0)) m |= M_Ctrl; - else if ((vlen >= 3) && (strncasecmp(value, "alt", 3) == 0)) m |= M_Alt; - else if ((vlen >= 7) && (strncasecmp(value, "release", 7) == 0)) m |= M_Release; - else if ((vlen >= 5) && (strncasecmp(value, "press", 5) == 0)) press = 1; - else - Message(PCB_MSG_DEFAULT, "Unknown modifier: %s\n", value); - /* skip to next word */ - next = strpbrk(value, "<- \t"); - if (next == NULL) - break; - if (*next == '<') - break; - vlen -= (next - value); - value = next+1; - } - } - - if (last != NULL) - *last = value; - - if (press && (m & M_Release)) - Message(PCB_MSG_DEFAULT, "Bogus modifier: both press and release\n"); - - return m; -} - -static hid_cfg_mod_t button_name2mask(const char *name) -{ - /* All mouse-related resources must be named. The name is the - mouse button number. */ - if (!name) - return 0; - else if (strcasecmp(name, "left") == 0) return MB_LEFT; - else if (strcasecmp(name, "middle") == 0) return MB_MIDDLE; - else if (strcasecmp(name, "right") == 0) return MB_RIGHT; - - else if (strcasecmp(name, "scroll-up") == 0) return MB_SCROLL_UP; - else if (strcasecmp(name, "scroll-down") == 0) return MB_SCROLL_DOWN; - else if (strcasecmp(name, "scroll-left") == 0) return MB_SCROLL_UP; - else if (strcasecmp(name, "scroll-right") == 0) return MB_SCROLL_DOWN; - else { - Message(PCB_MSG_DEFAULT, "Error: unknown mouse button: %s\n", name); - return 0; - } -} - -static unsigned int keyhash_int(htip_key_t a) { return murmurhash32(a & 0xFFFF); } - -/************************** MOUSE ***************************/ - -int hid_cfg_mouse_init(hid_cfg_t *hr, hid_cfg_mouse_t *mouse) -{ - lht_node_t *btn, *m; - - mouse->mouse = hid_cfg_get_menu(hr, "/mouse"); - - if (mouse->mouse == NULL) { - Message(PCB_MSG_DEFAULT, "Warning: no /mouse section in the resource file - mouse is disabled\n"); - return -1; - } - - if (mouse->mouse->type != LHT_LIST) { - hid_cfg_error(mouse->mouse, "Warning: should be a list - mouse is disabled\n"); - return -1; - } - - if (mouse->mouse_mask == NULL) - mouse->mouse_mask = htip_alloc(keyhash_int, htip_keyeq); - else - htip_clear(mouse->mouse_mask); - - for(btn = mouse->mouse->data.list.first; btn != NULL; btn = btn->next) { - hid_cfg_mod_t btn_mask = button_name2mask(btn->name); - if (btn_mask == 0) { - hid_cfg_error(btn, "unknown mouse button"); - continue; - } - if (btn->type != LHT_LIST) { - hid_cfg_error(btn, "needs to be a list"); - continue; - } - for(m = btn->data.list.first; m != NULL; m = m->next) { - hid_cfg_mod_t mod_mask = parse_mods(m->name, NULL, -1); - htip_set(mouse->mouse_mask, btn_mask|mod_mask, m); - } - } - return 0; -} - -static lht_node_t *find_best_action(hid_cfg_mouse_t *mouse, hid_cfg_mod_t button_and_mask) -{ - lht_node_t *n; - - if (mouse->mouse_mask == NULL) - return NULL; - - /* look for exact mod match */ - n = htip_get(mouse->mouse_mask, button_and_mask); - if (n != NULL) - return n; - - if (button_and_mask & M_Release) { - /* look for plain release for the given button */ - n = htip_get(mouse->mouse_mask, (button_and_mask & M_ANY) | M_Release); - if (n != NULL) - return n; - } - - return NULL; -} - -void hid_cfg_mouse_action(hid_cfg_mouse_t *mouse, hid_cfg_mod_t button_and_mask) -{ - hid_cfg_action(find_best_action(mouse, button_and_mask)); -} - - -/************************** KEYBOARD ***************************/ -int hid_cfg_keys_init(hid_cfg_keys_t *km) -{ - htip_init(&km->keys, keyhash_int, htip_keyeq); - return 0; -} - -int hid_cfg_keys_uninit(hid_cfg_keys_t *km) -{ -#warning TODO: recursive free of nodes - htip_uninit(&km->keys); - return 0; -} - -hid_cfg_keyseq_t *hid_cfg_keys_add_under(hid_cfg_keys_t *km, hid_cfg_keyseq_t *parent, hid_cfg_mod_t mods, unsigned short int key_char, int terminal) -{ - hid_cfg_keyseq_t *ns; - hid_cfg_keyhash_t addr; - htip_t *phash = (parent == NULL) ? &km->keys : &parent->seq_next; - - /* do not grow the tree under actions */ - if ((parent != NULL) && (parent->action_node != NULL)) - return NULL; - - - addr.hash = 0; - addr.details.mods = mods; - addr.details.key_char = key_char; - - /* already in the tree */ - ns = htip_get(phash, addr.hash); - if (ns != NULL) { - if (terminal) - return NULL; /* full-path-match is collision */ - return ns; - } - - /* new node on this level */ - ns = calloc(sizeof(hid_cfg_keyseq_t), 1); - if (!terminal) - htip_init(&ns->seq_next, keyhash_int, htip_keyeq); - htip_set(phash, addr.hash, ns); - return ns; -} - -const hid_cfg_keytrans_t hid_cfg_key_default_trans[] = { - { "semicolon", ';' }, - { NULL, 0 }, -}; - -static unsigned short int translate_key(hid_cfg_keys_t *km, const char *desc, int len) -{ - char tmp[256]; - - if ((km->auto_chr) && (len == 1)) - return *desc; - - if (len > sizeof(tmp)-1) { - Message(PCB_MSG_DEFAULT, "key sym name too long\n"); - return 0; - } - strncpy(tmp, desc, len); - tmp[len] = '\0'; - - if (km->auto_tr != NULL) { - const hid_cfg_keytrans_t *t; - for(t = km->auto_tr; t->name != NULL; t++) { - if (strcasecmp(tmp, t->name) == 0) { - tmp[0] = t->sym; - tmp[1] = '\0'; - len = 1; - break; - } - } - } - - return km->translate_key(tmp, len); -} - -static int parse_keydesc(hid_cfg_keys_t *km, const char *keydesc, hid_cfg_mod_t *mods, unsigned short int *key_chars, int arr_len) -{ - const char *curr, *next, *last, *k; - int slen, len; - - slen = 0; - curr = keydesc; - do { - if (slen >= arr_len) - return -1; - while(isspace(*curr)) curr++; - if (*curr == '\0') - break; - next = strchr(curr, ';'); - if (next != NULL) { - len = next - curr; - while(*next == ';') next++; - } - else - len = strlen(curr); - - mods[slen] = parse_mods(curr, &last, len); - - k = strchr(last, '<'); - if (k == NULL) { - Message(PCB_MSG_DEFAULT, "Missing in the key description: '%s'\n", keydesc); - return -1; - } - len -= k-last; - k++; len--; - if ((strncmp(k, "key>", 4) != 0) && (strncmp(k, "Key>", 4) != 0)) { - Message(PCB_MSG_DEFAULT, "Missing in the key description\n"); - return -1; - } - k+=4; len-=4; - key_chars[slen] = translate_key(km, k, len); - - if (key_chars[slen] == 0) { - char *s; - s = malloc(len+1); - memcpy(s, k, len); - s[len] = '\0'; - Message(PCB_MSG_DEFAULT, "Unrecognised key symbol in key description: %s\n", s); - free(s); - return -1; - } - - slen++; - curr = next; - } while(curr != NULL); - return slen; -} - -int hid_cfg_keys_add_by_strdesc(hid_cfg_keys_t *km, const char *keydesc, const lht_node_t *action_node, hid_cfg_keyseq_t **out_seq, int out_seq_len) -{ - hid_cfg_mod_t mods[HIDCFG_MAX_KEYSEQ_LEN]; - unsigned short int key_chars[HIDCFG_MAX_KEYSEQ_LEN]; - hid_cfg_keyseq_t *lasts; - int slen, n; - - slen = parse_keydesc(km, keydesc, mods, key_chars, HIDCFG_MAX_KEYSEQ_LEN); - if (slen <= 0) - return slen; - - if ((out_seq != NULL) && (slen >= out_seq_len)) - return -1; - -/* printf("KEY insert\n");*/ - - lasts = NULL; - for(n = 0; n < slen; n++) { - hid_cfg_keyseq_t *s; - int terminal = (n == slen-1); - -/* printf(" mods=%x sym=%x\n", mods[n], key_chars[n]);*/ - - s = hid_cfg_keys_add_under(km, lasts, mods[n], key_chars[n], terminal); - if (s == NULL) { - printf(" ERROR\n"); -#warning TODO: free stuff? - return -1; - } - if (terminal) - s->action_node = action_node; - - if (out_seq != NULL) - out_seq[n] = s; - lasts = s; - } - - return slen; -} - -int hid_cfg_keys_add_by_desc(hid_cfg_keys_t *km, const lht_node_t *keydescn, const lht_node_t *action_node, hid_cfg_keyseq_t **out_seq, int out_seq_len) -{ - switch(keydescn->type) { - case LHT_TEXT: return hid_cfg_keys_add_by_strdesc(km, keydescn->data.text.value, action_node, out_seq, out_seq_len); - case LHT_LIST: - { - int ret = -1, cnt; - lht_node_t *n; - for(n = keydescn->data.list.first, cnt = 0; n != NULL; n = n->next, cnt++) { - if (n->type != LHT_TEXT) - break; - if (cnt == 0) - ret = hid_cfg_keys_add_by_strdesc(km, n->data.text.value, action_node, out_seq, out_seq_len); - else - hid_cfg_keys_add_by_strdesc(km, n->data.text.value, action_node, NULL, 0); - } - return ret; - } - default:; - } - return -1; -} - -static void gen_accel(gds_t *s, hid_cfg_keys_t *km, const char *keydesc, int *cnt, const char *sep) -{ - hid_cfg_mod_t mods[HIDCFG_MAX_KEYSEQ_LEN]; - unsigned short int key_chars[HIDCFG_MAX_KEYSEQ_LEN]; - int slen, n; - - slen = parse_keydesc(km, keydesc, mods, key_chars, HIDCFG_MAX_KEYSEQ_LEN); - if (slen <= 0) - return; - - if (*cnt > 0) - gds_append_str(s, sep); - - for(n = 0; n < slen; n++) { - char buff[64]; - - if (n > 0) - gds_append(s, ' '); - - if (km->key_name(key_chars[n], buff, sizeof(buff)) != 0) - strcpy(buff, ""); - - if (mods[n] & M_Alt) gds_append_str(s, "Alt-"); - if (mods[n] & M_Ctrl) gds_append_str(s, "Ctrl-"); - if (mods[n] & M_Shift) gds_append_str(s, "Shift-"); - gds_append_str(s, buff); - } -} - -char *hid_cfg_keys_gen_accel(hid_cfg_keys_t *km, const lht_node_t *keydescn, unsigned long mask, const char *sep) -{ - gds_t s; - int cnt = 0; - - memset(&s, 0, sizeof(s)); - - switch(keydescn->type) { - case LHT_TEXT: - if (mask & 1) - gen_accel(&s, km, keydescn->data.text.value, &cnt, sep); - break; - case LHT_LIST: - { - int cnt; - lht_node_t *n; - for(n = keydescn->data.list.first, cnt = 0; n != NULL; n = n->next, cnt++, mask >>= 1) { - if (n->type != LHT_TEXT) - break; - if (!(mask & 1)) - continue; - gen_accel(&s, km, n->data.text.value, &cnt, sep); - } - } - default:; - } - return s.array; -} - - -int hid_cfg_keys_input(hid_cfg_keys_t *km, hid_cfg_mod_t mods, unsigned short int key_char, hid_cfg_keyseq_t **seq, int *seq_len) -{ - hid_cfg_keyseq_t *ns; - hid_cfg_keyhash_t addr; - htip_t *phash = (*seq_len == 0) ? &km->keys : &((seq[(*seq_len)-1])->seq_next); - - addr.hash = 0; - addr.details.mods = mods; - addr.details.key_char = key_char; - - /* already in the tree */ - ns = htip_get(phash, addr.hash); - if (ns == NULL) { - (*seq_len) = 0; - return -1; - } - - seq[*seq_len] = ns; - (*seq_len)++; - - /* found a terminal node with an action */ - if (ns->action_node != NULL) { - int len = *seq_len; - (*seq_len) = 0; - return len; - } - - return 0; -} - -int hid_cfg_keys_action(hid_cfg_keyseq_t **seq, int seq_len) -{ - if (seq_len < 1) - return -1; - - return hid_cfg_action(seq[seq_len-1]->action_node); -} Index: 1.1.4/src/compat_dl.c =================================================================== --- 1.1.4/src/compat_dl.c (revision 10776) +++ 1.1.4/src/compat_dl.c (nonexistent) @@ -1,68 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2004, 2006 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "config.h" - -#include "compat_dl.h" -#include "global.h" - -#ifdef USE_LOADLIBRARY -#include - -void *dlopen(const char *f, int ATTRIBUTE_UNUSED flag) -{ - return LoadLibrary(f); -} - -void dlclose(void *h) -{ - FreeLibrary((HINSTANCE) h); -} - -char *dlerror() -{ - static LPVOID lpMsgBuf = NULL; - DWORD dw; - - /* free the error message buffer */ - if (lpMsgBuf) - LocalFree(lpMsgBuf); - - /* get the error code */ - dw = GetLastError(); - - /* get the corresponding error message */ - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) & lpMsgBuf, 0, NULL); - - return (char *) lpMsgBuf; -} - -void *dlsym(void *handle, const char *symbol) -{ - return (void *) GetProcAddress((HMODULE) handle, symbol); -} - - -#endif Index: 1.1.4/src/Makefile.dep =================================================================== --- 1.1.4/src/Makefile.dep (revision 10776) +++ 1.1.4/src/Makefile.dep (nonexistent) @@ -1,3679 +0,0 @@ -### Generated file, do not edit, run make dep ### - -../src_plugins/autocrop/autocrop.o: ../src_plugins/autocrop/autocrop.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h hid.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h create.h rtree.h undo.h move.h \ - draw.h set.h polygon.h rtree.h plugins.h hid_actions.h dolists.h -../src_plugins/autoplace/action.o: ../src_plugins/autoplace/action.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/autoplace/autoplace.h \ - plugins.h set.h global.h hid_actions.h dolists.h -../src_plugins/autoplace/autoplace.o: \ - ../src_plugins/autoplace/autoplace.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/autoplace/autoplace.h \ - box.h global.h misc_util.h compat_misc.h data.h draw.h error.h layer.h \ - intersect.h rtree.h macro.h mirror.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h move.h mymem.h rats.h remove.h \ - rotate.h -../src_plugins/autoroute/action.o: ../src_plugins/autoroute/action.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/autoroute/autoroute.h \ - action_helper.h global.h plugins.h set.h hid_actions.h dolists.h -../src_plugins/autoroute/autoroute.o: \ - ../src_plugins/autoroute/autoroute.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h macro.h ../src_plugins/autoroute/autoroute.h box.h \ - misc_util.h create.h draw.h error.h find.h heap.h rtree.h misc.h mymem.h \ - ../src_plugins/autoroute/mtspace.h ../src_plugins/autoroute/vector.h \ - mymem.h polygon.h rtree.h rats.h remove.h thermal.h undo.h pcb-printf.h \ - set.h layer.h -../src_plugins/autoroute/mtspace.o: ../src_plugins/autoroute/mtspace.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h box.h global.h misc_util.h heap.h \ - rtree.h ../src_plugins/autoroute/mtspace.h \ - ../src_plugins/autoroute/vector.h -../src_plugins/autoroute/vector.o: ../src_plugins/autoroute/vector.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/autoroute/vector.h -../src_plugins/boardflip/boardflip.o: \ - ../src_plugins/boardflip/boardflip.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h hid.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h create.h rtree.h undo.h \ - plugins.h hid_actions.h dolists.h -../src_plugins/dbus/dbus-pcbmain.o: ../src_plugins/dbus/dbus-pcbmain.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/dbus/dbus-pcbmain.h -../src_plugins/dbus/dbus.o: ../src_plugins/dbus/dbus.c \ - ../src_plugins/dbus/dbus-pcbmain.h ../src_plugins/dbus/dbus-introspect.h \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h plugins.h \ - hid_actions.h event.h compat_misc.h compat_lrealpath.h dolists.h -../src_plugins/diag/diag.o: ../src_plugins/diag/diag.c ../config.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h layer.h \ - ../src_plugins/diag/diag_conf.h action_helper.h hid_actions.h plugins.h \ - conf.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h conf.h error.h dolists.h -../src_plugins/diag/diag_conf.o: ../src_plugins/diag/diag_conf.c conf.h \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf.h -../src_plugins/distalign/distalign.o: \ - ../src_plugins/distalign/distalign.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h hid.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h create.h rtree.h undo.h rats.h \ - error.h move.h draw.h set.h plugins.h hid_actions.h dolists.h -../src_plugins/distaligntext/distaligntext.o: \ - ../src_plugins/distaligntext/distaligntext.c ../config.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h hid.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h create.h rtree.h undo.h rats.h \ - error.h move.h draw.h set.h plugins.h hid_actions.h conf_core.h conf.h \ - pcb-printf.h ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h dolists.h -../src_plugins/djopt/djopt.o: ../src_plugins/djopt/djopt.c ../config.h \ - conf_core.h conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h \ - unit.h global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h \ - polyarea.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h create.h remove.h move.h draw.h undo.h strflags.h find.h \ - layer.h pcb-printf.h plugins.h hid_flags.h hid_actions.h \ - ../src_plugins/djopt/djopt_conf.h conf.h dolists.h \ - ../src_plugins/djopt/djopt_conf_fields.h -../src_plugins/export_bboard/bboard.o: \ - ../src_plugins/export_bboard/bboard.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h error.h buffer.h create.h \ - layer.h plugins.h compat_misc.h misc_util.h hid.h hid_attrib.h \ - hid_nogui.h hid_draw_helpers.h hid_init.h hid_helper.h -../src_plugins/export_bom/bom.o: ../src_plugins/export_bom/bom.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h error.h misc.h mymem.h pcb-printf.h plugins.h \ - compat_misc.h hid.h hid_nogui.h hid_attrib.h hid_helper.h hid_init.h -../src_plugins/export_dxf/dxf.o: ../src_plugins/export_dxf/dxf.c \ - ../config.h macro.h global.h const.h macro.h global_typedefs.h \ - pcb_bool.h unit.h global_objs.h ../src_3rd/genlist/gendlist.h \ - globalconst.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h error.h draw.h \ - hid_draw_helpers.h pcb-printf.h compat_misc.h layer.h hid_attrib.h \ - hid_flags.h hid_helper.h hid.h hid_init.h plugins.h -../src_plugins/export_gcode/curve.o: ../src_plugins/export_gcode/curve.c \ - ../src_plugins/export_gcode/potracelib.h \ - ../src_plugins/export_gcode/lists.h ../src_plugins/export_gcode/curve.h \ - ../src_plugins/export_gcode/auxiliary.h ../config.h -../src_plugins/export_gcode/decompose.o: \ - ../src_plugins/export_gcode/decompose.c \ - ../src_plugins/export_gcode/potracelib.h \ - ../src_plugins/export_gcode/curve.h \ - ../src_plugins/export_gcode/auxiliary.h ../config.h \ - ../src_plugins/export_gcode/lists.h ../src_plugins/export_gcode/bitmap.h \ - ../src_plugins/export_gcode/decompose.h -../src_plugins/export_gcode/gcode.o: ../src_plugins/export_gcode/gcode.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - plugins.h global.h error.h data.h misc.h mymem.h rats.h hid_helper.h \ - layer.h compat_misc.h hid.h hid_nogui.h hid_draw_helpers.h \ - ../src_plugins/export_gcode/gcode.h ../src_plugins/export_gcode/bitmap.h \ - ../src_plugins/export_gcode/potracelib.h \ - ../src_plugins/export_gcode/curve.h \ - ../src_plugins/export_gcode/auxiliary.h \ - ../src_plugins/export_gcode/trace.h \ - ../src_plugins/export_gcode/decompose.h pcb-printf.h hid_init.h \ - hid_attrib.h hid_flags.h hid_color.h dolists.h -../src_plugins/export_gcode/trace.o: ../src_plugins/export_gcode/trace.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h \ - ../src_plugins/export_gcode/potracelib.h \ - ../src_plugins/export_gcode/curve.h \ - ../src_plugins/export_gcode/auxiliary.h \ - ../src_plugins/export_gcode/lists.h ../src_plugins/export_gcode/trace.h -../src_plugins/export_gerber/gerber.o: \ - ../src_plugins/export_gerber/gerber.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h error.h draw.h layer.h \ - pcb-printf.h plugins.h hid_helper.h compat_misc.h hid.h hid_nogui.h \ - hid_draw_helpers.h hid_init.h hid_attrib.h hid_flags.h conf_core.h \ - conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h -../src_plugins/export_ipcd356/ipcd356.o: \ - ../src_plugins/export_ipcd356/ipcd356.c ../config.h data.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h global.h rats.h error.h find.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h pcb-printf.h netlist.h \ - conf_core.h conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - hid.h hid_nogui.h hid_helper.h hid_attrib.h hid_init.h plugins.h -../src_plugins/export_lpr/lpr.o: ../src_plugins/export_lpr/lpr.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h plugins.h compat_misc.h hid.h \ - ../src_plugins/export_lpr/../export_ps/ps.h hid_nogui.h hid_init.h \ - hid_attrib.h hid_actions.h -../src_plugins/export_nelma/nelma.o: ../src_plugins/export_nelma/nelma.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h error.h data.h global.h layer.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h rats.h plugins.h hid_helper.h \ - hid.h hid_nogui.h hid_draw_helpers.h hid_init.h hid_attrib.h hid_flags.h \ - hid_color.h dolists.h -../src_plugins/export_png/png.o: ../src_plugins/export_png/png.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h error.h misc.h mymem.h layer.h misc_util.h compat_misc.h \ - plugins.h hid.h hid_nogui.h hid_draw_helpers.h \ - ../src_plugins/export_png/png.h hid_init.h hid_attrib.h hid_color.h \ - hid_helper.h hid_flags.h dolists.h -../src_plugins/export_ps/eps.o: ../src_plugins/export_ps/eps.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h layer.h misc.h mymem.h pcb-printf.h hid.h hid_nogui.h \ - hid_draw_helpers.h ../src_plugins/export_ps/ps.h hid_init.h hid_attrib.h \ - hid_helper.h hid_flags.h hid_color.h -../src_plugins/export_ps/ps.o: ../src_plugins/export_ps/ps.c ../config.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h layer.h error.h draw.h \ - pcb-printf.h plugins.h hid_helper.h hid.h hid_nogui.h hid_draw_helpers.h \ - ../src_plugins/export_ps/ps.h draw_fab.h hid_init.h hid_attrib.h \ - hid_flags.h hid_actions.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h compat_misc.h dolists.h -../src_plugins/export_svg/svg.o: ../src_plugins/export_svg/svg.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h error.h misc.h mymem.h layer.h misc_util.h compat_misc.h \ - plugins.h hid.h hid_nogui.h hid_draw_helpers.h hid_init.h hid_attrib.h \ - hid_color.h hid_helper.h hid_flags.h dolists.h -../src_plugins/export_test/export_test.o: \ - ../src_plugins/export_test/export_test.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h error.h misc.h mymem.h pcb-printf.h plugins.h hid.h \ - hid_nogui.h hid_attrib.h hid_helper.h hid_init.h -../src_plugins/export_xy/xy.o: ../src_plugins/export_xy/xy.c ../config.h \ - conf_core.h conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h \ - unit.h global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h \ - polyarea.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h error.h misc.h mymem.h pcb-printf.h plugins.h \ - compat_misc.h hid.h hid_nogui.h hid_attrib.h hid_helper.h hid_init.h -../src_plugins/fontmode/fontmode.o: ../src_plugins/fontmode/fontmode.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h create.h data.h draw.h layer.h misc.h mymem.h move.h remove.h \ - rtree.h strflags.h undo.h pcb-printf.h plugins.h hid_actions.h \ - compat_misc.h dolists.h -../src_plugins/fp_fs/fp_fs.o: ../src_plugins/fp_fs/fp_fs.c ../config.h \ - mymem.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h paths.h plugins.h \ - plug_footprint.h vtlibrary.h compat_fs.h compat_misc.h error.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h conf.h conf_core.h compat_inc.h -../src_plugins/fp_wget/fp_wget.o: ../src_plugins/fp_wget/fp_wget.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/fp_wget/gedasymbols.h \ - plug_footprint.h vtlibrary.h plugins.h -../src_plugins/fp_wget/gedasymbols.o: \ - ../src_plugins/fp_wget/gedasymbols.c ../src_3rd/genvector/gds_char.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h hid.h error.h vtroutestyle.h global_element.h list_element.h \ - ht_element.h ../src_3rd/liblihata/genht/ht.h \ - ../src_plugins/fp_wget/wget_common.h \ - ../src_plugins/fp_wget/gedasymbols.h plug_footprint.h vtlibrary.h \ - plugins.h compat_misc.h -../src_plugins/fp_wget/wget_common.o: \ - ../src_plugins/fp_wget/wget_common.c \ - ../src_plugins/fp_wget/wget_common.h -../src_plugins/hid_batch/batch.o: ../src_plugins/hid_batch/batch.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h layer.h pcb-printf.h plugins.h \ - compat_misc.h hid_draw_helpers.h hid_nogui.h hid_actions.h hid_init.h \ - dolists.h -../src_plugins/hid_gtk/ghid-cell-renderer-visibility.o: \ - ../src_plugins/hid_gtk/ghid-cell-renderer-visibility.c \ - ../src_plugins/hid_gtk/gtkhid.h conf_hid.h conf.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/ghid-cell-renderer-visibility.h -../src_plugins/hid_gtk/ghid-coord-entry.o: \ - ../src_plugins/hid_gtk/ghid-coord-entry.c \ - ../src_plugins/hid_gtk/gtkhid.h conf_hid.h conf.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h pcb-printf.h -../src_plugins/hid_gtk/ghid-layer-selector.o: \ - ../src_plugins/hid_gtk/ghid-layer-selector.c \ - ../src_plugins/hid_gtk/gtkhid.h conf_hid.h conf.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h pcb-printf.h \ - ../src_plugins/hid_gtk/ghid-cell-renderer-visibility.h -../src_plugins/hid_gtk/ghid-main-menu.o: \ - ../src_plugins/hid_gtk/ghid-main-menu.c ../src_3rd/liblihata/tree.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_plugins/hid_gtk/gtkhid.h conf_hid.h conf.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/hash.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h pcb-printf.h misc_util.h \ - error.h ../src_plugins/hid_gtk/gschem_accel_label.h -../src_plugins/hid_gtk/ghid-propedit.o: \ - ../src_plugins/hid_gtk/ghid-propedit.c ../src_plugins/hid_gtk/gui.h \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid.h hid_cfg.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/genvector/vtp0.h list_conf.h \ - event.h compat_misc.h ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - create.h polygon.h rtree.h -../src_plugins/hid_gtk/ghid-route-style-selector.o: \ - ../src_plugins/hid_gtk/ghid-route-style-selector.c global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf_core.h conf.h global.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h ../src_plugins/hid_gtk/gtkhid.h \ - conf_hid.h ../src_plugins/hid_gtk/gui.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h pcb-printf.h route_style.h \ - set.h -../src_plugins/hid_gtk/ghid-search.o: \ - ../src_plugins/hid_gtk/ghid-search.c ../src_3rd/genlist/gendlist.h \ - ../src_plugins/hid_gtk/gui.h global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h globalconst.h \ - polyarea.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid.h hid_cfg.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/genvector/vtp0.h list_conf.h \ - event.h compat_misc.h ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - create.h ../src_plugins/hid_gtk/ghid-search.h \ - ../src_plugins/hid_gtk/win_place.h hid_actions.h misc_util.h \ - ../src_plugins/hid_gtk/ghid-search-tab.h -../src_plugins/hid_gtk/gschem_accel_label.o: \ - ../src_plugins/hid_gtk/gschem_accel_label.c \ - ../src_plugins/hid_gtk/gschem_accel_label.h -../src_plugins/hid_gtk/gtk_conf_list.o: \ - ../src_plugins/hid_gtk/gtk_conf_list.c \ - ../src_plugins/hid_gtk/gtk_conf_list.h conf.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf.h compat_misc.h -../src_plugins/hid_gtk/gtkhid-gdk.o: ../src_plugins/hid_gtk/gtkhid-gdk.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf_core.h conf.h global.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h crosshair.h clip.h layer.h \ - ../src_plugins/hid_gtk/gui.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h hid_draw_helpers.h \ - hid_attrib.h hid_helper.h hid_color.h -../src_plugins/hid_gtk/gtkhid-main.o: \ - ../src_plugins/hid_gtk/gtkhid-main.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - action_helper.h crosshair.h error.h ../src_plugins/hid_gtk/gui.h \ - global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h hid_nogui.h \ - hid_draw_helpers.h pcb-printf.h plugins.h hid_attrib.h hid_init.h \ - hid_flags.h hid_actions.h plug_footprint.h vtlibrary.h plug_io.h \ - misc_util.h layer.h ../src_plugins/hid_gtk/ghid-search.h \ - ../src_plugins/hid_gtk/gtkhid.h conf_hid.h dolists.h \ - ../src_plugins/hid_gtk/hid_gtk_conf_fields.h -../src_plugins/hid_gtk/gui-command-window.o: \ - ../src_plugins/hid_gtk/gui-command-window.c ../config.h conf_core.h \ - conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h crosshair.h hid_actions.h -../src_plugins/hid_gtk/gui-config.o: ../src_plugins/hid_gtk/gui-config.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/win_place.h ../src_plugins/hid_gtk/gtkhid.h \ - conf_hid.h action_helper.h change.h plug_io.h error.h draw.h \ - pcb-printf.h set.h hid_attrib.h misc_util.h \ - ../src_plugins/hid_gtk/gtk_conf_list.h paths.h plug_footprint.h \ - vtlibrary.h fptr_cast.h ../src_3rd/liblihata/tree.h -../src_plugins/hid_gtk/gui-dialog-print.o: \ - ../src_plugins/hid_gtk/gui-dialog-print.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h pcb-printf.h hid_attrib.h \ - hid_init.h misc_util.h -../src_plugins/hid_gtk/gui-dialog.o: ../src_plugins/hid_gtk/gui-dialog.c \ - ../config.h compat_misc.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/hid_gtk/gui.h global.h \ - hid.h hid_cfg.h ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/genvector/vtp0.h list_conf.h \ - event.h ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h -../src_plugins/hid_gtk/gui-drc-window.o: \ - ../src_plugins/hid_gtk/gui-drc-window.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - error.h search.h misc_util.h draw.h layer.h pcb-printf.h undo.h set.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/win_place.h \ - ../src_plugins/hid_gtk/gui-drc-window.h hid_actions.h -../src_plugins/hid_gtk/gui-keyref-window.o: \ - ../src_plugins/hid_gtk/gui-keyref-window.c ../config.h \ - ../src_plugins/hid_gtk/gui.h global.h const.h macro.h global_typedefs.h \ - pcb_bool.h unit.h global_objs.h ../src_3rd/genlist/gendlist.h \ - globalconst.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid.h hid_cfg.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/genvector/vtp0.h list_conf.h \ - event.h compat_misc.h ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/win_place.h -../src_plugins/hid_gtk/gui-library-window.o: \ - ../src_plugins/hid_gtk/gui-library-window.c ../config.h conf_core.h \ - conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/win_place.h buffer.h set.h plug_footprint.h \ - vtlibrary.h ../src_plugins/hid_gtk/gui-library-window.h -../src_plugins/hid_gtk/gui-log-window.o: \ - ../src_plugins/hid_gtk/gui-log-window.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf_hid.h ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h \ - hid_cfg_input.h ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h \ - misc.h mymem.h ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/win_place.h pcb-printf.h hid_actions.h -../src_plugins/hid_gtk/gui-misc.o: ../src_plugins/hid_gtk/gui-misc.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h crosshair.h data.h misc.h mymem.h action_helper.h set.h \ - pcb-printf.h misc_util.h ../src_plugins/hid_gtk/gui.h hid.h hid_cfg.h \ - hid_cfg_input.h ../src_3rd/liblihata/genht/htip.h hid_cfg.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h -../src_plugins/hid_gtk/gui-netlist-window.o: \ - ../src_plugins/hid_gtk/gui-netlist-window.c ../config.h conf_core.h \ - conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h ../src_plugins/hid_gtk/win_place.h ../src_plugins/hid_gtk/gui.h \ - hid.h hid_cfg.h hid_cfg_input.h ../src_3rd/liblihata/genht/htip.h \ - hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h create.h draw.h error.h \ - find.h mymem.h rats.h remove.h search.h misc_util.h select.h set.h \ - undo.h hid_actions.h -../src_plugins/hid_gtk/gui-output-events.o: \ - ../src_plugins/hid_gtk/gui-output-events.c ../config.h conf_core.h \ - conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/gtkhid.h conf_hid.h action_helper.h crosshair.h \ - draw.h error.h layer.h set.h find.h search.h misc_util.h rats.h -../src_plugins/hid_gtk/gui-pinout-preview.o: \ - ../src_plugins/hid_gtk/gui-pinout-preview.c ../config.h conf_core.h \ - conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h ../src_plugins/hid_gtk/gui.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h copy.h draw.h mymem.h \ - move.h rotate.h -../src_plugins/hid_gtk/gui-pinout-window.o: \ - ../src_plugins/hid_gtk/gui-pinout-window.c ../config.h conf_core.h \ - conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h ../src_plugins/hid_gtk/gui.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/hid_gtk/win_place.h copy.h draw.h mymem.h move.h rotate.h -../src_plugins/hid_gtk/gui-top-window.o: \ - ../src_plugins/hid_gtk/gui-top-window.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h global.h \ - ../src_plugins/hid_gtk/gtkhid.h conf_hid.h ../src_plugins/hid_gtk/gui.h \ - hid.h hid_cfg.h hid_cfg_input.h ../src_3rd/liblihata/genht/htip.h \ - hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h hid_cfg_action.h \ - action_helper.h buffer.h change.h copy.h create.h crosshair.h draw.h \ - error.h plug_io.h find.h insert.h line.h mymem.h layer.h move.h \ - pcb-printf.h polygon.h rtree.h rats.h remove.h rotate.h rubberband.h \ - search.h misc_util.h select.h set.h undo.h free_atexit.h paths.h \ - ../src_plugins/hid_gtk/gui-icons-mode-buttons.data \ - ../src_plugins/hid_gtk/gui-icons-misc.data \ - ../src_plugins/hid_gtk/win_place.h hid_attrib.h hid_actions.h \ - hid_flags.h route_style.h -../src_plugins/hid_gtk/gui-utils.o: ../src_plugins/hid_gtk/gui-utils.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h misc.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h event.h compat_misc.h \ - ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h -../src_plugins/hid_gtk/menu_lht.o: ../src_plugins/hid_gtk/menu_lht.c -../src_plugins/hid_gtk/win_place.o: ../src_plugins/hid_gtk/win_place.c \ - ../src_plugins/hid_gtk/win_place.h ../src_plugins/hid_gtk/gui.h global.h \ - ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid.h hid_cfg.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h \ - ../src_plugins/hid_gtk/ghid-coord-entry.h unit.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h \ - ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h \ - ../src_plugins/hid_gtk/gui-pinout-preview.h \ - ../src_plugins/hid_gtk/ghid-propedit.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/genvector/vtp0.h list_conf.h \ - event.h compat_misc.h ../src_plugins/hid_gtk/hid_gtk_conf.h conf.h -../src_plugins/hid_lesstif/dialogs.o: \ - ../src_plugins/hid_lesstif/dialogs.c \ - ../src_plugins/hid_lesstif/xincludes.h ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - compat_misc.h global.h data.h crosshair.h layer.h misc.h mymem.h \ - pcb-printf.h hid.h ../src_plugins/hid_lesstif/lesstif.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h hid_attrib.h hid_actions.h \ - hid_init.h ../src_plugins/hid_lesstif/stdarg.h misc_util.h -../src_plugins/hid_lesstif/library.o: \ - ../src_plugins/hid_lesstif/library.c \ - ../src_plugins/hid_lesstif/xincludes.h ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - compat_misc.h global.h data.h misc.h mymem.h set.h buffer.h vtptr.h \ - plug_footprint.h vtlibrary.h hid.h ../src_plugins/hid_lesstif/lesstif.h \ - hid_cfg_input.h ../src_3rd/liblihata/genht/htip.h hid_cfg.h \ - ../src_plugins/hid_lesstif/stdarg.h -../src_plugins/hid_lesstif/main.o: ../src_plugins/hid_lesstif/main.c \ - ../src_plugins/hid_lesstif/xincludes.h ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h action_helper.h crosshair.h layer.h mymem.h misc.h \ - mymem.h pcb-printf.h clip.h event.h error.h plugins.h hid.h hid_nogui.h \ - hid_draw_helpers.h hid_cfg.h ../src_plugins/hid_lesstif/lesstif.h \ - hid_cfg_input.h ../src_3rd/liblihata/genht/htip.h hid_cfg.h hid_attrib.h \ - hid_helper.h hid_init.h hid_color.h hid_extents.h hid_flags.h \ - hid_actions.h ../src_plugins/hid_lesstif/stdarg.h misc_util.h \ - compat_misc.h dolists.h -../src_plugins/hid_lesstif/menu.o: ../src_plugins/hid_lesstif/menu.c \ - ../src_plugins/hid_lesstif/xincludes.h ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h error.h misc.h mymem.h pcb-printf.h layer.h hid.h \ - hid_cfg.h hid_cfg_action.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h ../src_plugins/hid_lesstif/lesstif.h \ - mymem.h paths.h hid_actions.h hid_flags.h \ - ../src_plugins/hid_lesstif/stdarg.h compat_misc.h -../src_plugins/hid_lesstif/menu_lht.o: \ - ../src_plugins/hid_lesstif/menu_lht.c -../src_plugins/hid_lesstif/netlist.o: \ - ../src_plugins/hid_lesstif/netlist.c ../config.h \ - ../src_plugins/hid_lesstif/xincludes.h compat_misc.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h find.h rats.h select.h \ - undo.h remove.h crosshair.h draw.h hid.h hid_actions.h \ - ../src_plugins/hid_lesstif/lesstif.h hid_cfg_input.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/htip.h \ - hid_cfg.h ../src_plugins/hid_lesstif/stdarg.h -../src_plugins/hid_lesstif/stdarg.o: ../src_plugins/hid_lesstif/stdarg.c \ - ../src_plugins/hid_lesstif/stdarg.h \ - ../src_plugins/hid_lesstif/xincludes.h -../src_plugins/hid_lesstif/styles.o: ../src_plugins/hid_lesstif/styles.c \ - ../src_plugins/hid_lesstif/xincludes.h ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - compat_misc.h global.h data.h set.h misc.h mymem.h mymem.h pcb-printf.h \ - hid.h ../src_plugins/hid_lesstif/lesstif.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h hid_flags.h \ - ../src_plugins/hid_lesstif/stdarg.h misc_util.h -../src_plugins/import_dsn/dsn.o: ../src_plugins/import_dsn/dsn.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h error.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h rats.h buffer.h change.h draw.h \ - set.h undo.h pcb-printf.h create.h polygon.h rtree.h compat_misc.h hid.h \ - hid_draw_helpers.h hid_nogui.h hid_actions.h hid_init.h hid_attrib.h \ - hid_helper.h plugins.h dolists.h -../src_plugins/import_edif/edif.o: ../src_plugins/import_edif/edif.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h error.h plugins.h \ - compat_misc.h -../src_plugins/import_edif/import_edif.o: \ - ../src_plugins/import_edif/import_edif.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h plugins.h \ - plug_import.h conf.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h netlist.h rats_patch.h plug_io.h -../src_plugins/import_netlist/import_netlist.o: \ - ../src_plugins/import_netlist/import_netlist.c ../config.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h plugins.h plug_io.h global.h conf.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h plug_import.h conf_core.h \ - error.h misc.h mymem.h data.h rats_patch.h compat_misc.h -../src_plugins/import_sch/import_sch.o: \ - ../src_plugins/import_sch/import_sch.c ../config.h conf_core.h conf.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h data.h action_helper.h change.h error.h undo.h plugins.h misc.h \ - mymem.h compat_fs.h pcb-printf.h remove.h rats.h hid_actions.h \ - ../src_plugins/import_sch/import_sch_conf.h conf.h misc_util.h dolists.h \ - ../src_plugins/import_sch/import_sch_conf_fields.h -../src_plugins/io_kicad/io_kicad.o: ../src_plugins/io_kicad/io_kicad.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h plugins.h plug_io.h global.h conf.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h ../src_plugins/io_kicad/write.h \ - data.h ../src_plugins/io_kicad/read.h -../src_plugins/io_kicad/read.o: ../src_plugins/io_kicad/read.c \ - ../src_3rd/gensexpr/gsxl.h ../src_3rd/gensexpr/gensexpr_impl.h \ - ../src_3rd/gensexpr/gsx_parse.h ../src_3rd/liblihata/genht/htsi.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - compat_misc.h ../config.h plug_io.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/hash.h conf.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/genvector/vtp0.h \ - list_conf.h error.h data.h ../src_plugins/io_kicad/read.h global.h \ - layer.h const.h netlist.h create.h polygon.h rtree.h misc.h mymem.h \ - misc_util.h conf_core.h move.h macro.h -../src_plugins/io_kicad/uniq_name.o: ../src_plugins/io_kicad/uniq_name.c \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/io_kicad/uniq_name.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h compat_misc.h ../config.h -../src_plugins/io_kicad/write.o: ../src_plugins/io_kicad/write.c \ - plug_io.h global.h ../config.h const.h macro.h global_typedefs.h \ - pcb_bool.h unit.h global_objs.h ../src_3rd/genlist/gendlist.h \ - globalconst.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - error.h ../src_plugins/io_kicad/uniq_name.h \ - ../src_3rd/liblihata/genht/htsp.h data.h ../src_plugins/io_kicad/write.h \ - global.h layer.h const.h netlist.h misc.h mymem.h -../src_plugins/io_kicad_legacy/io_kicad_legacy.o: \ - ../src_plugins/io_kicad_legacy/io_kicad_legacy.c ../config.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h plugins.h plug_io.h global.h conf.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/io_kicad_legacy/write.h data.h -../src_plugins/io_kicad_legacy/write.o: \ - ../src_plugins/io_kicad_legacy/write.c plug_io.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - error.h ../src_plugins/io_kicad_legacy/../io_kicad/uniq_name.h \ - ../src_3rd/liblihata/genht/htsp.h data.h \ - ../src_plugins/io_kicad_legacy/write.h global.h layer.h const.h \ - netlist.h misc.h mymem.h -../src_plugins/io_lihata/common.o: ../src_plugins/io_lihata/common.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h macro.h \ - ../src_plugins/io_lihata/common.h -../src_plugins/io_lihata/io_lihata.o: \ - ../src_plugins/io_lihata/io_lihata.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h plugins.h plug_io.h global.h conf.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h ../src_plugins/io_lihata/read.h \ - ../src_plugins/io_lihata/write.h ../src_plugins/io_lihata/io_lihata.h \ - conf.h ../src_plugins/io_lihata/lht_conf.h \ - ../src_plugins/io_lihata/lht_conf_fields.h -../src_plugins/io_lihata/read.o: ../src_plugins/io_lihata/read.c \ - ../src_3rd/liblihata/tree.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/hash.h data.h \ - global.h plugins.h plug_io.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/genvector/vtp0.h list_conf.h strflags.h compat_misc.h macro.h \ - error.h misc.h mymem.h misc_util.h layer.h create.h vtptr.h \ - ../src_plugins/io_lihata/common.h polygon.h rtree.h conf_core.h -../src_plugins/io_lihata/write.o: ../src_plugins/io_lihata/write.c \ - ../src_3rd/liblihata/tree.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/hash.h data.h \ - global.h plugins.h plug_io.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/genvector/vtp0.h list_conf.h strflags.h compat_misc.h \ - rats_patch.h hid_actions.h misc_util.h macro.h layer.h \ - ../src_plugins/io_lihata/common.h ../src_plugins/io_lihata/write_style.h \ - ../src_3rd/liblhtpers/lhtpers.h ../src_plugins/io_lihata/io_lihata.h \ - conf.h ../src_plugins/io_lihata/lht_conf.h -../src_plugins/io_lihata/write_style.o: \ - ../src_plugins/io_lihata/write_style.c \ - ../src_plugins/io_lihata/write_style.h ../src_3rd/liblhtpers/lhtpers.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h -../src_plugins/io_pcb/attribs.o: ../src_plugins/io_pcb/attribs.c conf.h \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf.h misc.h mymem.h compat_misc.h -../src_plugins/io_pcb/file.o: ../src_plugins/io_pcb/file.c ../config.h \ - conf_core.h conf.h global.h const.h macro.h global_typedefs.h pcb_bool.h \ - unit.h global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h \ - polyarea.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h buffer.h change.h create.h crosshair.h data.h error.h \ - ../src_plugins/io_pcb/file.h plug_io.h hid.h layer.h misc.h mymem.h \ - move.h mymem.h ../src_plugins/io_pcb/parse_common.h pcb-printf.h \ - polygon.h rtree.h rats.h remove.h set.h strflags.h compat_fs.h paths.h \ - rats_patch.h hid_actions.h hid_flags.h ../src_plugins/io_pcb/flags.h \ - ../src_plugins/io_pcb/attribs.h route_style.h -../src_plugins/io_pcb/flags.o: ../src_plugins/io_pcb/flags.c strflags.h \ - global_objs.h ../src_3rd/genlist/gendlist.h ../config.h globalconst.h \ - global_typedefs.h pcb_bool.h unit.h polyarea.h \ - ../src_plugins/io_pcb/flags.h const.h macro.h -../src_plugins/io_pcb/io_pcb.o: ../src_plugins/io_pcb/io_pcb.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h plugins.h \ - ../src_plugins/io_pcb/parse_common.h plug_io.h global.h conf.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h ../src_plugins/io_pcb/file.h -../src_plugins/io_pcb/parse_l.o: ../src_plugins/io_pcb/parse_l.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h ../src_plugins/io_pcb/flags.h crosshair.h data.h error.h \ - ../src_plugins/io_pcb/file.h plug_io.h mymem.h misc.h mymem.h strflags.h \ - ../src_plugins/io_pcb/parse_common.h ../src_plugins/io_pcb/parse_y.h \ - create.h plug_footprint.h vtlibrary.h ../src_plugins/io_pcb/attribs.h \ - compat_misc.h -../src_plugins/io_pcb/parse_y.o: ../src_plugins/io_pcb/parse_y.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h layer.h create.h data.h error.h ../src_plugins/io_pcb/file.h \ - plug_io.h mymem.h misc.h mymem.h ../src_plugins/io_pcb/parse_l.h \ - polygon.h rtree.h remove.h rtree.h strflags.h thermal.h rats_patch.h \ - ../src_plugins/io_pcb/flags.h route_style.h compat_misc.h \ - ../src_plugins/io_pcb/parse_y.h -../src_plugins/jostle/jostle.o: ../src_plugins/jostle/jostle.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h hid.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h create.h rtree.h undo.h rats.h \ - polygon.h rtree.h remove.h error.h set.h pcb-printf.h plugins.h \ - hid_actions.h layer.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h misc_util.h dolists.h -../src_plugins/lib_gensexpr/lib_gensexpr.o: \ - ../src_plugins/lib_gensexpr/lib_gensexpr.c plugins.h -../src_plugins/lib_legacy_func/lib_legacy_func.o: \ - ../src_plugins/lib_legacy_func/lib_legacy_func.c \ - ../src_3rd/genvector/gds_char.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h hid.h error.h vtroutestyle.h global_element.h list_element.h \ - ht_element.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h action_helper.h \ - change.h error.h undo.h plugins.h -../src_plugins/loghid/loghid.o: ../src_plugins/loghid/loghid.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf.h global.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf.h data.h action_helper.h change.h error.h undo.h plugins.h \ - hid_init.h hid_attrib.h dolists.h -../src_plugins/mincut/pcb-mincut/graph.o: \ - ../src_plugins/mincut/pcb-mincut/graph.c \ - ../src_plugins/mincut/pcb-mincut/graph.h \ - ../src_plugins/mincut/pcb-mincut/../../../config.h -../src_plugins/mincut/pcb-mincut/solve.o: \ - ../src_plugins/mincut/pcb-mincut/solve.c \ - ../src_plugins/mincut/pcb-mincut/solve.h \ - ../src_plugins/mincut/pcb-mincut/graph.h \ - ../src_plugins/mincut/pcb-mincut/../../../config.h compat_misc.h \ - ../config.h -../src_plugins/mincut/rats_mincut.o: ../src_plugins/mincut/rats_mincut.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h create.h global.h data.h draw.h \ - error.h plug_io.h conf.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h find.h misc.h mymem.h mymem.h \ - polygon.h rtree.h rats.h search.h misc_util.h set.h undo.h plugins.h \ - compat_misc.h ../src_plugins/mincut/pcb-mincut/graph.h \ - ../src_plugins/mincut/pcb-mincut/../../../config.h \ - ../src_plugins/mincut/pcb-mincut/solve.h \ - ../src_plugins/mincut/pcb-mincut/graph.h conf.h \ - ../src_plugins/mincut/rats_mincut_conf.h stub_mincut.h \ - ../src_plugins/mincut/rats_mincut_conf_fields.h -../src_plugins/oldactions/oldactions.o: \ - ../src_plugins/oldactions/oldactions.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf.h global.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf.h data.h action_helper.h change.h error.h undo.h plugins.h \ - hid_actions.h plug_footprint.h vtlibrary.h dolists.h -../src_plugins/polycombine/polycombine.o: \ - ../src_plugins/polycombine/polycombine.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h macro.h create.h \ - remove.h hid.h error.h rtree.h polygon.h rtree.h polyarea.h strflags.h \ - find.h misc.h ../src_3rd/genvector/gds_char.h mymem.h draw.h undo.h \ - plugins.h hid_actions.h dolists.h -../src_plugins/polystitch/polystitch.o: \ - ../src_plugins/polystitch/polystitch.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h macro.h create.h \ - remove.h hid.h error.h rtree.h draw.h set.h polygon.h rtree.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h plugins.h hid_actions.h \ - dolists.h -../src_plugins/propedit/propedit.o: ../src_plugins/propedit/propedit.c \ - plugins.h ../src_plugins/propedit/props.h global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_plugins/propedit/propsel.h \ - hid_actions.h pcb-printf.h ../src_3rd/genvector/gds_char.h error.h \ - dolists.h -../src_plugins/propedit/props.o: ../src_plugins/propedit/props.c \ - ../src_plugins/propedit/props.h global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_plugins/propedit/propsel.h \ - compat_misc.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/genht/ht.c -../src_plugins/propedit/propsel.o: ../src_plugins/propedit/propsel.c \ - data.h global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h \ - unit.h global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h \ - polyarea.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/propedit/props.h \ - global.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_plugins/propedit/propsel.h \ - change.h misc.h ../src_3rd/genvector/gds_char.h mymem.h misc_util.h \ - compat_misc.h undo.h rotate.h -../src_plugins/puller/puller.o: ../src_plugins/puller/puller.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h create.h data.h draw.h misc.h mymem.h move.h pcb-printf.h \ - remove.h rtree.h strflags.h undo.h layer.h plugins.h hid_actions.h \ - misc_util.h dolists.h -../src_plugins/query/basic_fnc.o: ../src_plugins/query/basic_fnc.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h \ - ../src_plugins/query/query_access.h ../src_plugins/query/query.h \ - obj_any.h ../src_3rd/liblihata/genht/htsi.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genregex/regex_se.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - ../src_plugins/query/fields_sphash.h ../src_plugins/query/query_exec.h -../src_plugins/query/fields_sphash.o: \ - ../src_plugins/query/fields_sphash.c -../src_plugins/query/query.o: ../src_plugins/query/query.c ../config.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/liblihata/genht/htsi.h \ - ../src_3rd/liblihata/genht/ht.h conf.h global.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/genvector/vtp0.h list_conf.h conf.h data.h action_helper.h \ - change.h error.h undo.h plugins.h hid_init.h hid_actions.h compat_misc.h \ - ../src_plugins/query/query.h obj_any.h ../src_3rd/genregex/regex_se.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - ../src_plugins/query/fields_sphash.h fptr_cast.h -../src_plugins/query/query_access.o: ../src_plugins/query/query_access.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h \ - ../src_plugins/query/query_access.h ../src_plugins/query/query.h \ - obj_any.h ../src_3rd/liblihata/genht/htsi.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genregex/regex_se.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - ../src_plugins/query/fields_sphash.h ../src_plugins/query/query_exec.h \ - misc.h ../src_3rd/genvector/gds_char.h mymem.h layer.h -../src_plugins/query/query_act.o: ../src_plugins/query/query_act.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_plugins/query/query.h obj_any.h \ - ../src_3rd/liblihata/genht/htsi.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genregex/regex_se.h ../src_3rd/genregex/regex_templ.h \ - ../src_3rd/genregex/regex.h ../src_plugins/query/fields_sphash.h \ - ../src_plugins/query/query_y.h ../src_plugins/query/query_exec.h set.h \ - global.h draw.h select.h macro.h dolists.h -../src_plugins/query/query_exec.o: ../src_plugins/query/query_exec.c \ - global.h ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h \ - ../src_plugins/query/query.h obj_any.h ../src_3rd/liblihata/genht/htsi.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genregex/regex_se.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - ../src_plugins/query/fields_sphash.h ../src_plugins/query/query_exec.h \ - ../src_plugins/query/query_access.h -../src_plugins/query/query_l.o: ../src_plugins/query/query_l.c global.h \ - ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h unit.h ../src_plugins/query/query.h \ - obj_any.h ../src_3rd/liblihata/genht/htsi.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genregex/regex_se.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - ../src_plugins/query/fields_sphash.h ../src_plugins/query/query_y.h \ - compat_misc.h layer.h -../src_plugins/query/query_y.o: ../src_plugins/query/query_y.c global.h \ - ../config.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h unit.h ../src_plugins/query/query.h \ - obj_any.h ../src_3rd/liblihata/genht/htsi.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genregex/regex_se.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - ../src_plugins/query/fields_sphash.h ../src_plugins/query/query_l.h \ - compat_misc.h -../src_plugins/renumber/renumber.o: ../src_plugins/renumber/renumber.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h action_helper.h \ - change.h error.h undo.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ - set.h plugins.h hid_actions.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h compat_misc.h pcb-printf.h \ - dolists.h -../src_plugins/renumber/renumberblock.o: \ - ../src_plugins/renumber/renumberblock.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h hid.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h create.h rtree.h undo.h error.h \ - change.h conf_core.h conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h -../src_plugins/report/report.o: ../src_plugins/report/report.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_plugins/report/report.h global.h crosshair.h data.h drill.h \ - error.h search.h misc_util.h misc.h mymem.h mymem.h rats.h rtree.h \ - strflags.h macro.h undo.h find.h draw.h pcb-printf.h plugins.h \ - hid_actions.h misc_util.h ../src_plugins/report/report_conf.h conf.h \ - compat_misc.h layer.h ../src_3rd/genregex/regex_sei.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h dolists.h \ - ../src_plugins/report/report_conf_fields.h -../src_plugins/shand_cmd/command.o: ../src_plugins/shand_cmd/command.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - global.h action_helper.h buffer.h ../src_plugins/shand_cmd/command.h \ - data.h error.h plug_io.h mymem.h misc.h mymem.h rats.h set.h plugins.h \ - hid_actions.h compat_misc.h dolists.h -../src_plugins/smartdisperse/smartdisperse.o: \ - ../src_plugins/smartdisperse/smartdisperse.c \ - ../src_3rd/liblihata/genht/htpi.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/hash.h data.h \ - global.h hid.h misc.h ../src_3rd/genvector/gds_char.h mymem.h create.h \ - rtree.h undo.h rats.h error.h move.h draw.h set.h plugins.h \ - hid_actions.h dolists.h -../src_plugins/stroke/stroke.o: ../src_plugins/stroke/stroke.c \ - ../config.h global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf.h global.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf.h conf_core.h data.h crosshair.h stub_stroke.h rotate.h undo.h \ - set.h error.h misc.h mymem.h plugins.h -../src_plugins/teardrops/teardrops.o: \ - ../src_plugins/teardrops/teardrops.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h global.h hid.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h create.h rtree.h undo.h \ - plugins.h hid_actions.h dolists.h -../src_plugins/toporouter/toporouter.o: \ - ../src_plugins/toporouter/toporouter.c \ - ../src_plugins/toporouter/toporouter.h data.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h macro.h \ - ../src_plugins/toporouter/../autoroute/autoroute.h global.h box.h \ - misc_util.h create.h draw.h error.h find.h heap.h rtree.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h mymem.h polygon.h rtree.h rats.h \ - remove.h thermal.h undo.h ../src_3rd/gts/gts.h pcb-printf.h -../src_plugins/vendordrill/vendor.o: ../src_plugins/vendordrill/vendor.c \ - ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_3rd/genregex/regex_sei.h ../src_3rd/genregex/regex_templ.h \ - ../src_3rd/genregex/regex.h change.h data.h draw.h error.h global.h \ - set.h undo.h ../src_plugins/vendordrill/vendor.h stub_vendor.h plugins.h \ - hid_flags.h hid_actions.h hid_cfg.h \ - ../src_plugins/vendordrill/vendor_conf.h conf.h compat_misc.h \ - ../src_3rd/liblihata/tree.h dolists.h \ - ../src_plugins/vendordrill/vendor_conf_fields.h -../src_3rd/gensexpr/gsx_parse.o: ../src_3rd/gensexpr/gsx_parse.c \ - ../src_3rd/gensexpr/gsx_parse.h -../src_3rd/gensexpr/gsxl.o: ../src_3rd/gensexpr/gsxl.c \ - ../src_3rd/gensexpr/gsxl.h ../src_3rd/gensexpr/gensexpr_impl.h \ - ../src_3rd/gensexpr/gsx_parse.h ../src_3rd/gensexpr/gensexpr_impl.c -../src_3rd/genregex/regex.o: ../src_3rd/genregex/regex.c \ - ../src_3rd/genregex/regex.h -../src_3rd/genregex/regex_se.o: ../src_3rd/genregex/regex_se.c \ - ../src_3rd/genregex/regex_templ.c ../src_3rd/genregex/regex_templ.h \ - ../src_3rd/genregex/regex.h -../src_3rd/genregex/regex_sei.o: ../src_3rd/genregex/regex_sei.c \ - ../src_3rd/genregex/regex_templ.c ../src_3rd/genregex/regex_templ.h \ - ../src_3rd/genregex/regex.h -../src_3rd/genvector/gds_char.o: ../src_3rd/genvector/gds_char.c \ - ../src_3rd/genvector/gds_char.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h \ - ../src_3rd/genvector/genvector_impl.c -../src_3rd/genvector/vtp0.o: ../src_3rd/genvector/vtp0.c \ - ../src_3rd/genvector/vtp0.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h \ - ../src_3rd/genvector/genvector_impl.c -../src_3rd/liblhtpers/lhtpers.o: ../src_3rd/liblhtpers/lhtpers.c \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/liblhtpers/lhtpers.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblhtpers/output.c ../src_3rd/liblhtpers/pers_list.c \ - ../src_3rd/liblhtpers/pers_hash.c ../src_3rd/liblhtpers/pers_text.c \ - ../src_3rd/liblhtpers/pers_table.c -../src_3rd/liblihata/dom.o: ../src_3rd/liblihata/dom.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/dom_internal.h ../src_3rd/liblihata/hash_str.h -../src_3rd/liblihata/dom_hash.o: ../src_3rd/liblihata/dom_hash.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/dom_internal.h ../src_3rd/liblihata/hash_str.h -../src_3rd/liblihata/dom_list.o: ../src_3rd/liblihata/dom_list.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/dom_internal.h -../src_3rd/liblihata/dom_table.o: ../src_3rd/liblihata/dom_table.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/dom_internal.h ../src_3rd/liblihata/tree.h \ - ../src_3rd/liblihata/dom.h -../src_3rd/liblihata/genht/hash.o: ../src_3rd/liblihata/genht/hash.c -../src_3rd/liblihata/genht/htip.o: ../src_3rd/liblihata/genht/htip.c \ - ../src_3rd/liblihata/genht/htip.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h ../src_3rd/liblihata/genht/ht.c -../src_3rd/liblihata/genht/htpi.o: ../src_3rd/liblihata/genht/htpi.c \ - ../src_3rd/liblihata/genht/htpi.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h ../src_3rd/liblihata/genht/ht.c -../src_3rd/liblihata/genht/htpp.o: ../src_3rd/liblihata/genht/htpp.c \ - ../src_3rd/liblihata/genht/htpp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h ../src_3rd/liblihata/genht/ht.c -../src_3rd/liblihata/genht/htsi.o: ../src_3rd/liblihata/genht/htsi.c \ - ../src_3rd/liblihata/genht/htsi.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h ../src_3rd/liblihata/genht/ht.c -../src_3rd/liblihata/genht/htsp.o: ../src_3rd/liblihata/genht/htsp.c \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h ../src_3rd/liblihata/genht/ht.c -../src_3rd/liblihata/hash_str.o: ../src_3rd/liblihata/hash_str.c -../src_3rd/liblihata/lihata.o: ../src_3rd/liblihata/lihata.c \ - ../src_3rd/liblihata/lihata.h -../src_3rd/liblihata/parser.o: ../src_3rd/liblihata/parser.c \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/lihata.h -../src_3rd/liblihata/tree.o: ../src_3rd/liblihata/tree.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/tree.h ../src_3rd/liblihata/dom_internal.h -../src_3rd/liblihata/tree_hash.o: ../src_3rd/liblihata/tree_hash.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/dom_internal.h ../src_3rd/liblihata/tree.h \ - ../src_3rd/liblihata/dom.h -../src_3rd/liblihata/tree_list.o: ../src_3rd/liblihata/tree_list.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/dom_internal.h ../src_3rd/liblihata/tree.h \ - ../src_3rd/liblihata/dom.h -../src_3rd/liblihata/tree_path.o: ../src_3rd/liblihata/tree_path.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/tree.h -../src_3rd/liblihata/tree_symlink.o: ../src_3rd/liblihata/tree_symlink.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/tree.h -../src_3rd/liblihata/tree_table.o: ../src_3rd/liblihata/tree_table.c \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/dom_internal.h ../src_3rd/liblihata/tree.h \ - ../src_3rd/liblihata/dom.h -action_act.o: action_act.c ../config.h error.h action_helper.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid_actions.h undo.h -action_helper.o: action_helper.c ../config.h conf_core.h conf.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - action_helper.h buffer.h change.h copy.h create.h crosshair.h data.h \ - draw.h find.h insert.h line.h misc.h mymem.h move.h polygon.h rtree.h \ - rats.h remove.h rotate.h rubberband.h search.h misc_util.h select.h \ - set.h undo.h stub_stroke.h funchash_core.h funchash.h \ - funchash_core_list.h hid_actions.h compat_misc.h layer.h -buffer.o: buffer.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - action_helper.h buffer.h copy.h create.h crosshair.h data.h plug_io.h \ - mirror.h misc.h mymem.h misc_util.h polygon.h rtree.h rotate.h remove.h \ - select.h set.h funchash_core.h funchash.h funchash_core_list.h \ - compat_misc.h layer.h -buildin.o: buildin.c plugins.h buildin.h -change.o: change.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - crosshair.h data.h draw.h misc.h mymem.h mirror.h polygon.h rtree.h \ - select.h undo.h hid_actions.h layer.h -change_act.o: change_act.c ../config.h conf_core.h conf.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h funchash_core.h funchash.h funchash_core_list.h action_helper.h \ - hid_actions.h change.h draw.h search.h misc_util.h misc.h mymem.h set.h \ - undo.h rubberband.h compat_misc.h layer.h -clip.o: clip.c ../config.h clip.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -compat_dl.o: compat_dl.c ../config.h compat_dl.h compat_inc.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -compat_fs.o: compat_fs.c ../config.h compat_inc.h compat_fs.h \ - compat_misc.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h hid.h error.h vtroutestyle.h global_element.h list_element.h \ - ht_element.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h mymem.h -compat_lrealpath.o: compat_lrealpath.c ../config.h compat_lrealpath.h \ - compat_misc.h -compat_misc.o: compat_misc.c ../config.h compat_misc.h compat_inc.h \ - global.h const.h macro.h global_typedefs.h pcb_bool.h unit.h \ - global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -conf.o: conf.c ../src_3rd/liblihata/genht/hash.h \ - ../src_3rd/liblihata/tree.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h conf.h global.h ../config.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/genvector/vtp0.h list_conf.h conf_core.h conf_hid.h hid_cfg.h \ - hid_init.h hid_attrib.h misc_util.h paths.h compat_fs.h compat_misc.h \ - ../src_3rd/genvector/genvector_impl.c -conf_act.o: conf_act.c global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf_core.h misc.h mymem.h misc_util.h route_style.h -conf_core.o: conf_core.c conf.h global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf_core.h conf_core_fields.h -conf_hid.o: conf_hid.c conf_hid.h conf.h global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_3rd/liblihata/genht/htpp.h conf_core.h -conf_internal.o: conf_internal.c -copy.o: copy.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - create.h data.h draw.h misc.h mymem.h layer.h move.h polygon.h rtree.h \ - select.h undo.h compat_misc.h -create.o: create.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - create.h data.h misc.h mymem.h layer.h rtree.h search.h misc_util.h \ - undo.h plug_io.h stub_vendor.h hid_actions.h paths.h compat_misc.h -crosshair.o: crosshair.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - box.h misc_util.h crosshair.h data.h draw.h line.h rtree.h search.h \ - polygon.h misc.h mymem.h hid_actions.h layer.h compat_misc.h -data.o: data.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -draw.o: draw.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h draw.h misc.h mymem.h rotate.h rtree.h draw_fab.h hid_helper.h \ - layer.h -draw_fab.o: draw_fab.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h draw.h drill.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h draw_fab.h polygon.h rtree.h \ - layer.h -drill.o: drill.c ../config.h mymem.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -error.o: error.c ../config.h global.h const.h macro.h global_typedefs.h \ - pcb_bool.h unit.h global_objs.h ../src_3rd/genlist/gendlist.h \ - globalconst.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h plug_io.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - compat_misc.h -event.o: event.c event.h error.h fptr_cast.h -file_act.o: file_act.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h action_helper.h crosshair.h set.h plug_io.h plug_import.h \ - buffer.h misc.h mymem.h remove.h create.h draw.h find.h search.h \ - misc_util.h hid_actions.h hid_attrib.h compat_misc.h -find.o: find.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h draw.h find.h misc.h mymem.h rtree.h polygon.h search.h \ - misc_util.h set.h undo.h rats.h plug_io.h hid_actions.h compat_misc.h \ - layer.h find_geo.c find_lookup.c find_drc.c find_misc.c find_clear.c \ - find_debug.c find_print.c -find_act.o: find_act.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h find.h -fptr_cast.o: fptr_cast.c fptr_cast.h -free_atexit.o: free_atexit.c -funchash.o: funchash.c ../src_3rd/liblihata/genht/htpi.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h funchash_core.h funchash.h \ - funchash_core_list.h macro.h -gui_act.o: gui_act.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h action_helper.h undo.h funchash_core.h funchash.h \ - funchash_core_list.h draw.h search.h misc_util.h crosshair.h find.h \ - set.h misc.h mymem.h stub_stroke.h hid_actions.h hid_init.h \ - route_style.h layer.h -heap.o: heap.c ../config.h heap.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -hid_actions.o: hid_actions.c ../config.h conf_core.h conf.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_3rd/liblihata/genht/htsp.h event.h hid_actions.h compat_misc.h -hid_attrib.o: hid_attrib.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid_attrib.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h misc_util.h pcb-printf.h \ - compat_fs.h -hid_cfg.o: hid_cfg.c ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/tree.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/hash.h \ - hid_cfg.h paths.h compat_misc.h -hid_cfg_action.o: hid_cfg_action.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid_cfg_action.h hid_cfg.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h hid_actions.h -hid_cfg_input.o: hid_cfg_input.c ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/tree.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h hid.h error.h vtroutestyle.h global_element.h list_element.h \ - ht_element.h ../src_3rd/liblihata/genht/ht.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_actions.h hid_cfg_action.h -hid_color.o: hid_color.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid_color.h compat_misc.h \ - ../src_3rd/liblihata/genht/ht.c -hid_draw_helpers.o: hid_draw_helpers.c global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h polygon.h rtree.h -hid_extents.o: hid_extents.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h layer.h hid_draw_helpers.h \ - hid_helper.h -hid_flags.o: hid_flags.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h misc.h ../src_3rd/genvector/gds_char.h \ - mymem.h conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - hid_flags.h ../src_3rd/liblihata/genht/htsp.h hid_actions.h -hid_helper.o: hid_helper.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h misc.h ../src_3rd/genvector/gds_char.h \ - mymem.h layer.h hid_helper.h hid_attrib.h compat_misc.h -hid_init.o: hid_init.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid_nogui.h compat_dl.h compat_inc.h \ - misc.h ../src_3rd/genvector/gds_char.h mymem.h plugins.h hid_attrib.h \ - hid_flags.h misc_util.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h compat_misc.h fptr_cast.h -hid_nogui.o: hid_nogui.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h compat_misc.h -ht_element.o: ht_element.c global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/liblihata/genht/ht.c -insert.o: insert.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - create.h crosshair.h data.h draw.h line.h misc.h mymem.h polygon.h \ - rtree.h search.h misc_util.h select.h set.h undo.h layer.h -intersect.o: intersect.c ../config.h intersect.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -layer.o: layer.c global.h ../config.h const.h macro.h global_typedefs.h \ - pcb_bool.h unit.h global_objs.h ../src_3rd/genlist/gendlist.h \ - globalconst.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - layer.h hid_actions.h compat_misc.h -line.o: line.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h crosshair.h find.h line.h misc.h mymem.h rtree.h layer.h -list_arc.o: list_arc.c global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - list_arc.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - ../src_3rd/genlist/gentdlist_impl.c -list_conf.o: list_conf.c conf.h global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_3rd/genlist/gentdlist_impl.c -list_element.o: list_element.c global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/genlist/gentdlist_impl.c -list_line.o: list_line.c global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - ../src_3rd/genlist/gentdlist_impl.c -list_pad.o: list_pad.c global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - list_pad.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - ../src_3rd/genlist/gentdlist_impl.c -list_pin.o: list_pin.c global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - list_pin.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - ../src_3rd/genlist/gentdlist_impl.c -list_poly.o: list_poly.c global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - list_poly.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - ../src_3rd/genlist/gentdlist_impl.c -list_rat.o: list_rat.c global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - list_rat.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - ../src_3rd/genlist/gentdlist_impl.c -list_text.o: list_text.c global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - list_text.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - ../src_3rd/genlist/gentdlist_impl.c -main.o: main.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h buffer.h create.h crosshair.h plug_io.h set.h layer.h misc.h \ - mymem.h compat_lrealpath.h free_atexit.h polygon.h rtree.h buildin.h \ - paths.h strflags.h plugins.h plug_footprint.h vtlibrary.h event.h \ - funchash.h hid_actions.h hid_attrib.h hid_init.h compat_misc.h dolists.h \ - generated_lists.h -main_act.o: main_act.c ../config.h action_helper.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h hid_actions.h hid_attrib.h hid_init.h \ - data.h conf_core.h conf.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h -mirror.o: mirror.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h mirror.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h polygon.h rtree.h -misc.o: misc.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - box.h misc_util.h crosshair.h data.h plug_io.h misc.h mymem.h move.h \ - polygon.h rtree.h rotate.h rubberband.h set.h undo.h compat_misc.h \ - hid_actions.h hid_init.h -misc_util.o: misc_util.c ../config.h misc_util.h pcb_bool.h unit.h -move.o: move.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - create.h data.h draw.h misc.h mymem.h move.h polygon.h rtree.h search.h \ - misc_util.h select.h undo.h hid_actions.h compat_misc.h layer.h -mymem.o: mymem.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h mymem.h rtree.h rats_patch.h -netlist.o: netlist.c ../config.h ../src_3rd/genregex/regex_sei.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - action_helper.h global.h const.h macro.h global_typedefs.h pcb_bool.h \ - unit.h global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h \ - polyarea.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h plug_io.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - find.h mymem.h rats.h create.h rats_patch.h hid_actions.h compat_misc.h \ - netlist.h -netlist_act.o: netlist_act.c ../config.h ../src_3rd/genregex/regex_sei.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h \ - action_helper.h global.h const.h macro.h global_typedefs.h pcb_bool.h \ - unit.h global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h \ - polyarea.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h plug_io.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - find.h mymem.h rats.h create.h rats_patch.h hid_actions.h compat_misc.h \ - netlist.h -obj_any.o: obj_any.c obj_any.h global_objs.h \ - ../src_3rd/genlist/gendlist.h ../config.h globalconst.h \ - global_typedefs.h pcb_bool.h unit.h polyarea.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h ../src_3rd/genlist/gentdlist_impl.c -object_act.o: object_act.c ../config.h conf_core.h conf.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h action_helper.h change.h undo.h funchash_core.h funchash.h \ - funchash_core_list.h search.h misc_util.h move.h draw.h mirror.h \ - rotate.h set.h copy.h misc.h mymem.h rubberband.h buffer.h remove.h \ - create.h compat_misc.h layer.h -paths.o: paths.c ../config.h paths.h error.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - conf_core.h -pcb-printf.o: pcb-printf.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h -plug_footprint.o: plug_footprint.c ../config.h plug_footprint.h \ - vtlibrary.h global_objs.h ../src_3rd/genlist/gendlist.h globalconst.h \ - global_typedefs.h pcb_bool.h unit.h polyarea.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h plugins.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h conf_core.h conf.h global.h const.h \ - macro.h list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h hid.h error.h vtroutestyle.h global_element.h list_element.h \ - ht_element.h ../src_3rd/liblihata/genht/ht.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/genvector/vtp0.h list_conf.h compat_misc.h -plug_footprint_act.o: plug_footprint_act.c ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h plug_footprint.h vtlibrary.h -plug_import.o: plug_import.c ../config.h conf_core.h conf.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - plugins.h plug_import.h -plug_io.o: plug_io.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - buffer.h change.h create.h data.h plug_io.h misc.h mymem.h remove.h \ - set.h paths.h rats_patch.h hid_actions.h hid_flags.h plugins.h event.h \ - compat_misc.h route_style.h compat_fs.h compat_inc.h -plugins.o: plugins.c plugins.h global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/genvector/gds_char.h \ - compat_misc.h -polygon.o: polygon.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - box.h misc_util.h create.h crosshair.h data.h draw.h polygon.h rtree.h \ - remove.h search.h set.h thermal.h mymem.h undo.h misc.h layer.h -polygon1.o: polygon1.c rtree.h global.h ../config.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h heap.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h -polygon_act.o: polygon_act.c ../config.h conf_core.h conf.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h action_helper.h undo.h funchash_core.h funchash.h \ - funchash_core_list.h polygon.h rtree.h draw.h search.h misc_util.h \ - crosshair.h -rats.o: rats.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - create.h data.h draw.h find.h misc.h mymem.h layer.h polygon.h rtree.h \ - rats.h search.h misc_util.h undo.h stub_mincut.h route_style.h \ - compat_misc.h netlist.h -rats_act.o: rats_act.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h action_helper.h undo.h set.h misc.h mymem.h find.h remove.h \ - funchash_core.h funchash.h funchash_core_list.h rats.h draw.h -rats_patch.o: rats_patch.c rats_patch.h global.h ../config.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h create.h data.h buffer.h remove.h copy.h \ - compat_misc.h -remove.o: remove.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h draw.h misc.h mymem.h move.h polygon.h rtree.h remove.h select.h \ - undo.h -remove_act.o: remove_act.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h action_helper.h set.h remove.h \ - funchash_core.h funchash.h funchash_core_list.h -rotate.o: rotate.c ../config.h data.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h draw.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h polygon.h rtree.h rotate.h \ - rubberband.h search.h misc_util.h select.h set.h undo.h conf_core.h \ - conf.h pcb-printf.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h -route_style.o: route_style.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h route_style.h misc.h mymem.h conf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h -rtree.o: rtree.c ../config.h rtree.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -rubberband.o: rubberband.c ../config.h create.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h data.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h layer.h polygon.h rtree.h -search.o: search.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - box.h misc_util.h data.h find.h polygon.h rtree.h search.h misc.h \ - mymem.h layer.h -select.o: select.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h draw.h search.h misc_util.h select.h undo.h rats.h misc.h mymem.h \ - find.h layer.h compat_misc.h ../src_3rd/genregex/regex_sei.h \ - ../src_3rd/genregex/regex_templ.h ../src_3rd/genregex/regex.h -select_act.o: select_act.c ../config.h conf_core.h conf.h global.h \ - const.h macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h action_helper.h undo.h funchash_core.h funchash.h \ - funchash_core_list.h select.h crosshair.h set.h buffer.h draw.h remove.h \ - copy.h hid_attrib.h compat_misc.h -set.o: set.c ../config.h conf_core.h conf.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - action_helper.h buffer.h crosshair.h data.h draw.h find.h set.h undo.h \ - hid_actions.h route_style.h -strflags.o: strflags.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h strflags.h compat_misc.h -stub_mincut.o: stub_mincut.c ../config.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h stub_mincut.h -stub_stroke.o: stub_stroke.c error.h pcb_bool.h -stub_vendor.o: stub_vendor.c stub_vendor.h ../config.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h -thermal.o: thermal.c ../config.h misc.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h ../src_3rd/genvector/gds_char.h \ - mymem.h polygon.h rtree.h thermal.h -undo.o: undo.c ../config.h buffer.h global.h const.h macro.h \ - global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h change.h create.h data.h draw.h \ - insert.h layer.h misc.h ../src_3rd/genvector/gds_char.h mymem.h mirror.h \ - move.h polygon.h rtree.h remove.h rotate.h search.h misc_util.h set.h \ - undo.h strflags.h conf_core.h conf.h pcb-printf.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ - ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ - ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ - ../src_3rd/genvector/vtp0.h list_conf.h compat_misc.h netlist.h -undo_act.o: undo_act.c ../config.h conf_core.h conf.h global.h const.h \ - macro.h global_typedefs.h pcb_bool.h unit.h global_objs.h \ - ../src_3rd/genlist/gendlist.h globalconst.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - data.h action_helper.h funchash_core.h funchash.h funchash_core_list.h \ - crosshair.h undo.h polygon.h rtree.h set.h search.h misc_util.h draw.h \ - misc.h mymem.h layer.h -unit.o: unit.c ../config.h global.h const.h macro.h global_typedefs.h \ - pcb_bool.h unit.h global_objs.h ../src_3rd/genlist/gendlist.h \ - globalconst.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h error.h vtroutestyle.h \ - global_element.h list_element.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ - ../src_3rd/liblihata/genht/hash.h compat_misc.h -vtlibrary.o: vtlibrary.c vtlibrary.h global_objs.h \ - ../src_3rd/genlist/gendlist.h ../config.h globalconst.h \ - global_typedefs.h pcb_bool.h unit.h polyarea.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h \ - ../src_3rd/genvector/genvector_impl.c -vtonpoint.o: vtonpoint.c vtonpoint.h global_objs.h \ - ../src_3rd/genlist/gendlist.h ../config.h globalconst.h \ - global_typedefs.h pcb_bool.h unit.h polyarea.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h \ - ../src_3rd/genvector/genvector_impl.c -vtptr.o: vtptr.c vtptr.h global_objs.h ../src_3rd/genlist/gendlist.h \ - ../config.h globalconst.h global_typedefs.h pcb_bool.h unit.h polyarea.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h \ - ../src_3rd/genvector/genvector_impl.c -vtroutestyle.o: vtroutestyle.c vtroutestyle.h unit.h ../config.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h \ - ../src_3rd/genvector/genvector_impl.c Index: 1.1.4/src/free_atexit.h =================================================================== --- 1.1.4/src/free_atexit.h (revision 10776) +++ 1.1.4/src/free_atexit.h (nonexistent) @@ -1,38 +0,0 @@ -/* This tiny library is to assist cleaning up harmless memory leaks caused - by (growing) buffers allocated in static variables in functions. The - library provides leaky_ prefixed variants of the common allocation - routines. These wrappers will remember all pointers they return and - can free all memory used, at the end of the application. -*/ - -#include - -#ifdef NDEBUG -#define leaky_init() -#define leaky_uninit() -#define leaky_malloc(size) malloc(size) -#define leaky_calloc(nmemb, size) calloc(nmemb, size) -#define leaky_realloc(old_memory, size) realloc(old_memory, size) -#define leaky_strdup(str) strdup(str) -#else - -/* set up atexit() hook - can be avoided if leaky_uninit() is called by hand */ -void leaky_init(void); - -/* free all allocations */ -void leaky_uninit(void); - -/* allocate memory, remember the pointer and free it after exit from the application */ -void *leaky_malloc(size_t size); - -/* same as leaky_malloc but this one wraps calloc() */ -void *leaky_calloc(size_t nmemb, size_t size); - -/* reallocate memory, remember the new pointer and free it after exit from the application */ -void *leaky_realloc(void *old_memory, size_t size); - -/* strdup() using leaky_malloc() */ -char *leaky_strdup(const char *src); - - -#endif Index: 1.1.4/src/search.c =================================================================== --- 1.1.4/src/search.c (revision 10776) +++ 1.1.4/src/search.c (nonexistent) @@ -1,1396 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* search routines - * some of the functions use dummy parameters - */ - -#include "config.h" -#include "conf_core.h" - -#include - -#include "box.h" -#include "data.h" -#include "error.h" -#include "find.h" -#include "polygon.h" -#include "rtree.h" -#include "search.h" -#include "misc.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -static double PosX, PosY; /* search position for subroutines */ -static Coord SearchRadius; -static BoxType SearchBox; -static LayerTypePtr SearchLayer; - -/* --------------------------------------------------------------------------- - * some local prototypes. The first parameter includes PCB_TYPE_LOCKED if we - * want to include locked types in the search. - */ -static pcb_bool SearchLineByLocation(int, LayerTypePtr *, LineTypePtr *, LineTypePtr *); -static pcb_bool SearchArcByLocation(int, LayerTypePtr *, ArcTypePtr *, ArcTypePtr *); -static pcb_bool SearchRatLineByLocation(int, RatTypePtr *, RatTypePtr *, RatTypePtr *); -static pcb_bool SearchTextByLocation(int, LayerTypePtr *, TextTypePtr *, TextTypePtr *); -static pcb_bool SearchPolygonByLocation(int, LayerTypePtr *, PolygonTypePtr *, PolygonTypePtr *); -static pcb_bool SearchPinByLocation(int, ElementTypePtr *, PinTypePtr *, PinTypePtr *); -static pcb_bool SearchPadByLocation(int, ElementTypePtr *, PadTypePtr *, PadTypePtr *, pcb_bool); -static pcb_bool SearchViaByLocation(int, PinTypePtr *, PinTypePtr *, PinTypePtr *); -static pcb_bool SearchElementNameByLocation(int, ElementTypePtr *, TextTypePtr *, TextTypePtr *, pcb_bool); -static pcb_bool SearchLinePointByLocation(int, LayerTypePtr *, LineTypePtr *, PointTypePtr *); -static pcb_bool SearchPointByLocation(int, LayerTypePtr *, PolygonTypePtr *, PointTypePtr *); -static pcb_bool SearchElementByLocation(int, ElementTypePtr *, ElementTypePtr *, ElementTypePtr *, pcb_bool); - -/* --------------------------------------------------------------------------- - * searches a via - */ -struct ans_info { - void **ptr1, **ptr2, **ptr3; - pcb_bool BackToo; - double area; - int locked; /* This will be zero or PCB_FLAG_LOCK */ -}; - -static r_dir_t pinorvia_callback(const BoxType * box, void *cl) -{ - struct ans_info *i = (struct ans_info *) cl; - PinTypePtr pin = (PinTypePtr) box; - AnyObjectType *ptr1 = pin->Element ? pin->Element : pin; - - if (TEST_FLAG(i->locked, ptr1)) - return R_DIR_NOT_FOUND; - - if (!IsPointOnPin(PosX, PosY, SearchRadius, pin)) - return R_DIR_NOT_FOUND; - *i->ptr1 = ptr1; - *i->ptr2 = *i->ptr3 = pin; - return R_DIR_CANCEL; /* found, stop searching */ -} - -static pcb_bool SearchViaByLocation(int locked, PinTypePtr * Via, PinTypePtr * Dummy1, PinTypePtr * Dummy2) -{ - struct ans_info info; - - /* search only if via-layer is visible */ - if (!PCB->ViaOn) - return pcb_false; - - info.ptr1 = (void **) Via; - info.ptr2 = (void **) Dummy1; - info.ptr3 = (void **) Dummy2; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - - if (r_search(PCB->Data->via_tree, &SearchBox, NULL, pinorvia_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * searches a pin - * starts with the newest element - */ -static pcb_bool SearchPinByLocation(int locked, ElementTypePtr * Element, PinTypePtr * Pin, PinTypePtr * Dummy) -{ - struct ans_info info; - - /* search only if pin-layer is visible */ - if (!PCB->PinOn) - return pcb_false; - info.ptr1 = (void **) Element; - info.ptr2 = (void **) Pin; - info.ptr3 = (void **) Dummy; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - - if (r_search(PCB->Data->pin_tree, &SearchBox, NULL, pinorvia_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - return pcb_false; -} - -static r_dir_t pad_callback(const BoxType * b, void *cl) -{ - PadTypePtr pad = (PadTypePtr) b; - struct ans_info *i = (struct ans_info *) cl; - AnyObjectType *ptr1 = pad->Element; - - if (TEST_FLAG(i->locked, ptr1)) - return R_DIR_NOT_FOUND; - - if (FRONT(pad) || i->BackToo) { - if (IsPointInPad(PosX, PosY, SearchRadius, pad)) { - *i->ptr1 = ptr1; - *i->ptr2 = *i->ptr3 = pad; - return R_DIR_CANCEL; /* found */ - } - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches a pad - * starts with the newest element - */ -static pcb_bool SearchPadByLocation(int locked, ElementTypePtr * Element, PadTypePtr * Pad, PadTypePtr * Dummy, pcb_bool BackToo) -{ - struct ans_info info; - - /* search only if pin-layer is visible */ - if (!PCB->PinOn) - return (pcb_false); - info.ptr1 = (void **) Element; - info.ptr2 = (void **) Pad; - info.ptr3 = (void **) Dummy; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - info.BackToo = (BackToo && PCB->InvisibleObjectsOn); - if (r_search(PCB->Data->pad_tree, &SearchBox, NULL, pad_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * searches ordinary line on the SearchLayer - */ - -struct line_info { - LineTypePtr *Line; - PointTypePtr *Point; - double least; - int locked; -}; - -static r_dir_t line_callback(const BoxType * box, void *cl) -{ - struct line_info *i = (struct line_info *) cl; - LineTypePtr l = (LineTypePtr) box; - - if (TEST_FLAG(i->locked, l)) - return R_DIR_NOT_FOUND; - - if (!IsPointInPad(PosX, PosY, SearchRadius, (PadTypePtr) l)) - return R_DIR_NOT_FOUND; - *i->Line = l; - *i->Point = (PointTypePtr) l; - - return R_DIR_CANCEL; /* found what we were looking for */ -} - - -static pcb_bool SearchLineByLocation(int locked, LayerTypePtr * Layer, LineTypePtr * Line, LineTypePtr * Dummy) -{ - struct line_info info; - - info.Line = Line; - info.Point = (PointTypePtr *) Dummy; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - - *Layer = SearchLayer; - if (r_search(SearchLayer->line_tree, &SearchBox, NULL, line_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - - return pcb_false; -} - -static r_dir_t rat_callback(const BoxType * box, void *cl) -{ - LineTypePtr line = (LineTypePtr) box; - struct ans_info *i = (struct ans_info *) cl; - - if (TEST_FLAG(i->locked, line)) - return R_DIR_NOT_FOUND; - - if (TEST_FLAG(PCB_FLAG_VIA, line) ? - (Distance(line->Point1.X, line->Point1.Y, PosX, PosY) <= - line->Thickness * 2 + SearchRadius) : IsPointOnLine(PosX, PosY, SearchRadius, line)) { - *i->ptr1 = *i->ptr2 = *i->ptr3 = line; - return R_DIR_CANCEL; - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches rat lines if they are visible - */ -static pcb_bool SearchRatLineByLocation(int locked, RatTypePtr * Line, RatTypePtr * Dummy1, RatTypePtr * Dummy2) -{ - struct ans_info info; - - info.ptr1 = (void **) Line; - info.ptr2 = (void **) Dummy1; - info.ptr3 = (void **) Dummy2; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - - if (r_search(PCB->Data->rat_tree, &SearchBox, NULL, rat_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * searches arc on the SearchLayer - */ -struct arc_info { - ArcTypePtr *Arc, *Dummy; - int locked; -}; - -static r_dir_t arc_callback(const BoxType * box, void *cl) -{ - struct arc_info *i = (struct arc_info *) cl; - ArcTypePtr a = (ArcTypePtr) box; - - if (TEST_FLAG(i->locked, a)) - return R_DIR_NOT_FOUND; - - if (!IsPointOnArc(PosX, PosY, SearchRadius, a)) - return 0; - *i->Arc = a; - *i->Dummy = a; - return R_DIR_CANCEL; /* found */ -} - - -static pcb_bool SearchArcByLocation(int locked, LayerTypePtr * Layer, ArcTypePtr * Arc, ArcTypePtr * Dummy) -{ - struct arc_info info; - - info.Arc = Arc; - info.Dummy = Dummy; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - - *Layer = SearchLayer; - if (r_search(SearchLayer->arc_tree, &SearchBox, NULL, arc_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - return pcb_false; -} - -static r_dir_t text_callback(const BoxType * box, void *cl) -{ - TextTypePtr text = (TextTypePtr) box; - struct ans_info *i = (struct ans_info *) cl; - - if (TEST_FLAG(i->locked, text)) - return R_DIR_NOT_FOUND; - - if (POINT_IN_BOX(PosX, PosY, &text->BoundingBox)) { - *i->ptr2 = *i->ptr3 = text; - return R_DIR_CANCEL; /* found */ - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches text on the SearchLayer - */ -static pcb_bool SearchTextByLocation(int locked, LayerTypePtr * Layer, TextTypePtr * Text, TextTypePtr * Dummy) -{ - struct ans_info info; - - *Layer = SearchLayer; - info.ptr2 = (void **) Text; - info.ptr3 = (void **) Dummy; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - - if (r_search(SearchLayer->text_tree, &SearchBox, NULL, text_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - return pcb_false; -} - -static r_dir_t polygon_callback(const BoxType * box, void *cl) -{ - PolygonTypePtr polygon = (PolygonTypePtr) box; - struct ans_info *i = (struct ans_info *) cl; - - if (TEST_FLAG(i->locked, polygon)) - return R_DIR_NOT_FOUND; - - if (IsPointInPolygon(PosX, PosY, SearchRadius, polygon)) { - *i->ptr2 = *i->ptr3 = polygon; - return R_DIR_CANCEL; /* found */ - } - return R_DIR_NOT_FOUND; -} - - -/* --------------------------------------------------------------------------- - * searches a polygon on the SearchLayer - */ -static pcb_bool SearchPolygonByLocation(int locked, LayerTypePtr * Layer, PolygonTypePtr * Polygon, PolygonTypePtr * Dummy) -{ - struct ans_info info; - - *Layer = SearchLayer; - info.ptr2 = (void **) Polygon; - info.ptr3 = (void **) Dummy; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - - if (r_search(SearchLayer->polygon_tree, &SearchBox, NULL, polygon_callback, &info, NULL) != R_DIR_NOT_FOUND) - return pcb_true; - return pcb_false; -} - -static r_dir_t linepoint_callback(const BoxType * b, void *cl) -{ - LineTypePtr line = (LineTypePtr) b; - struct line_info *i = (struct line_info *) cl; - r_dir_t ret_val = R_DIR_NOT_FOUND; - double d; - - if (TEST_FLAG(i->locked, line)) - return R_DIR_NOT_FOUND; - - /* some stupid code to check both points */ - d = Distance(PosX, PosY, line->Point1.X, line->Point1.Y); - if (d < i->least) { - i->least = d; - *i->Line = line; - *i->Point = &line->Point1; - ret_val = R_DIR_FOUND_CONTINUE; - } - - d = Distance(PosX, PosY, line->Point2.X, line->Point2.Y); - if (d < i->least) { - i->least = d; - *i->Line = line; - *i->Point = &line->Point2; - ret_val = R_DIR_FOUND_CONTINUE; - } - return ret_val; -} - -/* --------------------------------------------------------------------------- - * searches a line-point on all the search layer - */ -static pcb_bool SearchLinePointByLocation(int locked, LayerTypePtr * Layer, LineTypePtr * Line, PointTypePtr * Point) -{ - struct line_info info; - *Layer = SearchLayer; - info.Line = Line; - info.Point = Point; - *Point = NULL; - info.least = MAX_LINE_POINT_DISTANCE + SearchRadius; - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - if (r_search(SearchLayer->line_tree, &SearchBox, NULL, linepoint_callback, &info, NULL)) - return pcb_true; - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * searches a polygon-point on all layers that are switched on - * in layerstack order - */ -static pcb_bool SearchPointByLocation(int locked, LayerTypePtr * Layer, PolygonTypePtr * Polygon, PointTypePtr * Point) -{ - double d, least; - pcb_bool found = pcb_false; - - least = SearchRadius + MAX_POLYGON_POINT_DISTANCE; - *Layer = SearchLayer; - POLYGON_LOOP(*Layer); - { - POLYGONPOINT_LOOP(polygon); - { - d = Distance(point->X, point->Y, PosX, PosY); - if (d < least) { - least = d; - *Polygon = polygon; - *Point = point; - found = pcb_true; - } - } - END_LOOP; - } - END_LOOP; - if (found) - return (pcb_true); - return (pcb_false); -} - -static r_dir_t name_callback(const BoxType * box, void *cl) -{ - TextTypePtr text = (TextTypePtr) box; - struct ans_info *i = (struct ans_info *) cl; - ElementTypePtr element = (ElementTypePtr) text->Element; - double newarea; - - if (TEST_FLAG(i->locked, text)) - return R_DIR_NOT_FOUND; - - if ((FRONT(element) || i->BackToo) && !TEST_FLAG(PCB_FLAG_HIDENAME, element) && POINT_IN_BOX(PosX, PosY, &text->BoundingBox)) { - /* use the text with the smallest bounding box */ - newarea = (text->BoundingBox.X2 - text->BoundingBox.X1) * (double) (text->BoundingBox.Y2 - text->BoundingBox.Y1); - if (newarea < i->area) { - i->area = newarea; - *i->ptr1 = element; - *i->ptr2 = *i->ptr3 = text; - } - return R_DIR_FOUND_CONTINUE; - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches the name of an element - * the search starts with the last element and goes back to the beginning - */ -static pcb_bool -SearchElementNameByLocation(int locked, ElementTypePtr * Element, TextTypePtr * Text, TextTypePtr * Dummy, pcb_bool BackToo) -{ - struct ans_info info; - - /* package layer have to be switched on */ - if (PCB->ElementOn) { - info.ptr1 = (void **) Element; - info.ptr2 = (void **) Text; - info.ptr3 = (void **) Dummy; - info.area = SQUARE(MAX_COORD); - info.BackToo = (BackToo && PCB->InvisibleObjectsOn); - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - if (r_search(PCB->Data->name_tree[NAME_INDEX()], &SearchBox, NULL, name_callback, &info, NULL)) - return pcb_true; - } - return (pcb_false); -} - -static r_dir_t element_callback(const BoxType * box, void *cl) -{ - ElementTypePtr element = (ElementTypePtr) box; - struct ans_info *i = (struct ans_info *) cl; - double newarea; - - if (TEST_FLAG(i->locked, element)) - return R_DIR_NOT_FOUND; - - if ((FRONT(element) || i->BackToo) && POINT_IN_BOX(PosX, PosY, &element->VBox)) { - /* use the element with the smallest bounding box */ - newarea = (element->VBox.X2 - element->VBox.X1) * (double) (element->VBox.Y2 - element->VBox.Y1); - if (newarea < i->area) { - i->area = newarea; - *i->ptr1 = *i->ptr2 = *i->ptr3 = element; - return R_DIR_FOUND_CONTINUE; - } - } - return R_DIR_NOT_FOUND; -} - -/* --------------------------------------------------------------------------- - * searches an element - * the search starts with the last element and goes back to the beginning - * if more than one element matches, the smallest one is taken - */ -static pcb_bool -SearchElementByLocation(int locked, ElementTypePtr * Element, ElementTypePtr * Dummy1, ElementTypePtr * Dummy2, pcb_bool BackToo) -{ - struct ans_info info; - - /* Both package layers have to be switched on */ - if (PCB->ElementOn && PCB->PinOn) { - info.ptr1 = (void **) Element; - info.ptr2 = (void **) Dummy1; - info.ptr3 = (void **) Dummy2; - info.area = SQUARE(MAX_COORD); - info.BackToo = (BackToo && PCB->InvisibleObjectsOn); - info.locked = (locked & PCB_TYPE_LOCKED) ? 0 : PCB_FLAG_LOCK; - if (r_search(PCB->Data->element_tree, &SearchBox, NULL, element_callback, &info, NULL)) - return pcb_true; - } - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * checks if a point is on a pin - */ -pcb_bool IsPointOnPin(Coord X, Coord Y, Coord Radius, PinTypePtr pin) -{ - Coord t = PIN_SIZE(pin) / 2; - if (TEST_FLAG(PCB_FLAG_SQUARE, pin)) { - BoxType b; - - b.X1 = pin->X - t; - b.X2 = pin->X + t; - b.Y1 = pin->Y - t; - b.Y2 = pin->Y + t; - if (IsPointInBox(X, Y, &b, Radius)) - return pcb_true; - } - else if (Distance(pin->X, pin->Y, X, Y) <= Radius + t) - return pcb_true; - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * checks if a rat-line end is on a PV - */ -pcb_bool IsPointOnLineEnd(Coord X, Coord Y, RatTypePtr Line) -{ - if (((X == Line->Point1.X) && (Y == Line->Point1.Y)) || ((X == Line->Point2.X) && (Y == Line->Point2.Y))) - return (pcb_true); - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * checks if a line intersects with a PV - * - * let the point be (X,Y) and the line (X1,Y1)(X2,Y2) - * the length of the line is - * - * L = ((X2-X1)^2 + (Y2-Y1)^2)^0.5 - * - * let Q be the point of perpendicular projection of (X,Y) onto the line - * - * QX = X1 + D1*(X2-X1) / L - * QY = Y1 + D1*(Y2-Y1) / L - * - * with (from vector geometry) - * - * (Y1-Y)(Y1-Y2)+(X1-X)(X1-X2) - * D1 = --------------------------- - * L - * - * D1 < 0 Q is on backward extension of the line - * D1 > L Q is on forward extension of the line - * else Q is on the line - * - * the signed distance from (X,Y) to Q is - * - * (Y2-Y1)(X-X1)-(X2-X1)(Y-Y1) - * D2 = ---------------------------- - * L - * - * Finally, D1 and D2 are orthogonal, so we can sum them easily - * by Pythagorean theorem. - */ -pcb_bool IsPointOnLine(Coord X, Coord Y, Coord Radius, LineTypePtr Line) -{ - double D1, D2, L; - - /* Get length of segment */ - L = Distance(Line->Point1.X, Line->Point1.Y, Line->Point2.X, Line->Point2.Y); - if (L < 0.1) - return Distance(X, Y, Line->Point1.X, Line->Point1.Y) < Radius + Line->Thickness / 2; - - /* Get distance from (X1, Y1) to Q (on the line) */ - D1 = ((double) (Y - Line->Point1.Y) * (Line->Point2.Y - Line->Point1.Y) - + (double) (X - Line->Point1.X) * (Line->Point2.X - Line->Point1.X)) / L; - /* Translate this into distance to Q from segment */ - if (D1 < 0) - D1 = -D1; - else if (D1 > L) - D1 -= L; - else - D1 = 0; - /* Get distance from (X, Y) to Q */ - D2 = ((double) (X - Line->Point1.X) * (Line->Point2.Y - Line->Point1.Y) - - (double) (Y - Line->Point1.Y) * (Line->Point2.X - Line->Point1.X)) / L; - /* Total distance is then the Pythagorean sum of these */ - return sqrt(D1 * D1 + D2 * D2) <= Radius + Line->Thickness / 2; -} - -static int is_point_on_line(Coord px, Coord py, Coord lx1, Coord ly1, Coord lx2, Coord ly2) -{ - /* ohh well... let's hope the optimizer does something clever with inlining... */ - LineType l; - l.Point1.X = lx1; - l.Point1.Y = ly1; - l.Point2.X = lx2; - l.Point2.Y = ly2; - l.Thickness = 1; - return IsPointOnLine(px, py, 1, &l); -} - -/* --------------------------------------------------------------------------- - * checks if a line crosses a rectangle - */ -pcb_bool IsLineInRectangle(Coord X1, Coord Y1, Coord X2, Coord Y2, LineTypePtr Line) -{ - LineType line; - - /* first, see if point 1 is inside the rectangle */ - /* in case the whole line is inside the rectangle */ - if (X1 < Line->Point1.X && X2 > Line->Point1.X && Y1 < Line->Point1.Y && Y2 > Line->Point1.Y) - return (pcb_true); - /* construct a set of dummy lines and check each of them */ - line.Thickness = 0; - line.Flags = NoFlags(); - - /* upper-left to upper-right corner */ - line.Point1.Y = line.Point2.Y = Y1; - line.Point1.X = X1; - line.Point2.X = X2; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - /* upper-right to lower-right corner */ - line.Point1.X = X2; - line.Point1.Y = Y1; - line.Point2.Y = Y2; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - /* lower-right to lower-left corner */ - line.Point1.Y = Y2; - line.Point1.X = X1; - line.Point2.X = X2; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - /* lower-left to upper-left corner */ - line.Point2.X = X1; - line.Point1.Y = Y1; - line.Point2.Y = Y2; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - return (pcb_false); -} - -static int /*checks if a point (of null radius) is in a slanted rectangle */ IsPointInQuadrangle(PointType p[4], PointTypePtr l) -{ - Coord dx, dy, x, y; - double prod0, prod1; - - dx = p[1].X - p[0].X; - dy = p[1].Y - p[0].Y; - x = l->X - p[0].X; - y = l->Y - p[0].Y; - prod0 = (double) x *dx + (double) y *dy; - x = l->X - p[1].X; - y = l->Y - p[1].Y; - prod1 = (double) x *dx + (double) y *dy; - if (prod0 * prod1 <= 0) { - dx = p[1].X - p[2].X; - dy = p[1].Y - p[2].Y; - prod0 = (double) x *dx + (double) y *dy; - x = l->X - p[2].X; - y = l->Y - p[2].Y; - prod1 = (double) x *dx + (double) y *dy; - if (prod0 * prod1 <= 0) - return pcb_true; - } - return pcb_false; -} - -/* --------------------------------------------------------------------------- - * checks if a line crosses a quadrangle: almost copied from IsLineInRectangle() - * Note: actually this quadrangle is a slanted rectangle - */ -pcb_bool IsLineInQuadrangle(PointType p[4], LineTypePtr Line) -{ - LineType line; - - /* first, see if point 1 is inside the rectangle */ - /* in case the whole line is inside the rectangle */ - if (IsPointInQuadrangle(p, &(Line->Point1))) - return pcb_true; - if (IsPointInQuadrangle(p, &(Line->Point2))) - return pcb_true; - /* construct a set of dummy lines and check each of them */ - line.Thickness = 0; - line.Flags = NoFlags(); - - /* upper-left to upper-right corner */ - line.Point1.X = p[0].X; - line.Point1.Y = p[0].Y; - line.Point2.X = p[1].X; - line.Point2.Y = p[1].Y; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - /* upper-right to lower-right corner */ - line.Point1.X = p[2].X; - line.Point1.Y = p[2].Y; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - /* lower-right to lower-left corner */ - line.Point2.X = p[3].X; - line.Point2.Y = p[3].Y; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - /* lower-left to upper-left corner */ - line.Point1.X = p[0].X; - line.Point1.Y = p[0].Y; - if (LineLineIntersect(&line, Line)) - return (pcb_true); - - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * checks if an arc crosses a square - */ -pcb_bool IsArcInRectangle(Coord X1, Coord Y1, Coord X2, Coord Y2, ArcTypePtr Arc) -{ - LineType line; - - /* construct a set of dummy lines and check each of them */ - line.Thickness = 0; - line.Flags = NoFlags(); - - /* upper-left to upper-right corner */ - line.Point1.Y = line.Point2.Y = Y1; - line.Point1.X = X1; - line.Point2.X = X2; - if (LineArcIntersect(&line, Arc)) - return (pcb_true); - - /* upper-right to lower-right corner */ - line.Point1.X = line.Point2.X = X2; - line.Point1.Y = Y1; - line.Point2.Y = Y2; - if (LineArcIntersect(&line, Arc)) - return (pcb_true); - - /* lower-right to lower-left corner */ - line.Point1.Y = line.Point2.Y = Y2; - line.Point1.X = X1; - line.Point2.X = X2; - if (LineArcIntersect(&line, Arc)) - return (pcb_true); - - /* lower-left to upper-left corner */ - line.Point1.X = line.Point2.X = X1; - line.Point1.Y = Y1; - line.Point2.Y = Y2; - if (LineArcIntersect(&line, Arc)) - return (pcb_true); - - return (pcb_false); -} - -/* --------------------------------------------------------------------------- - * Check if a circle of Radius with center at (X, Y) intersects a Pad. - * Written to enable arbitrary pad directions; for rounded pads, too. - */ -pcb_bool IsPointInPad(Coord X, Coord Y, Coord Radius, PadTypePtr Pad) -{ - double r, Sin, Cos; - Coord x; - - /* Also used from line_callback with line type smaller than pad type; - use the smallest common subset; ->Thickness is still ok. */ - Coord t2 = (Pad->Thickness + 1) / 2, range; - AnyLineObjectType pad = *(AnyLineObjectType *) Pad; - - - /* series of transforms saving range */ - /* move Point1 to the origin */ - X -= pad.Point1.X; - Y -= pad.Point1.Y; - - pad.Point2.X -= pad.Point1.X; - pad.Point2.Y -= pad.Point1.Y; - /* so, pad.Point1.X = pad.Point1.Y = 0; */ - - /* rotate round (0, 0) so that Point2 coordinates be (r, 0) */ - r = Distance(0, 0, pad.Point2.X, pad.Point2.Y); - if (r < .1) { - Cos = 1; - Sin = 0; - } - else { - Sin = pad.Point2.Y / r; - Cos = pad.Point2.X / r; - } - x = X; - X = X * Cos + Y * Sin; - Y = Y * Cos - x * Sin; - /* now pad.Point2.X = r; pad.Point2.Y = 0; */ - - /* take into account the ends */ - if (TEST_FLAG(PCB_FLAG_SQUARE, Pad)) { - r += Pad->Thickness; - X += t2; - } - if (Y < 0) - Y = -Y; /* range value is evident now */ - - if (TEST_FLAG(PCB_FLAG_SQUARE, Pad)) { - if (X <= 0) { - if (Y <= t2) - range = -X; - else - return Radius > Distance(0, t2, X, Y); - } - else if (X >= r) { - if (Y <= t2) - range = X - r; - else - return Radius > Distance(r, t2, X, Y); - } - else - range = Y - t2; - } - else { /*Rounded pad: even more simple */ - - if (X <= 0) - return (Radius + t2) > Distance(0, 0, X, Y); - else if (X >= r) - return (Radius + t2) > Distance(r, 0, X, Y); - else - range = Y - t2; - } - return range < Radius; -} - -pcb_bool IsPointInBox(Coord X, Coord Y, BoxTypePtr box, Coord Radius) -{ - Coord width, height, range; - - /* NB: Assumes box has point1 with numerically lower X and Y coordinates */ - - /* Compute coordinates relative to Point1 */ - X -= box->X1; - Y -= box->Y1; - - width = box->X2 - box->X1; - height = box->Y2 - box->Y1; - - if (X <= 0) { - if (Y < 0) - return Radius > Distance(0, 0, X, Y); - else if (Y > height) - return Radius > Distance(0, height, X, Y); - else - range = -X; - } - else if (X >= width) { - if (Y < 0) - return Radius > Distance(width, 0, X, Y); - else if (Y > height) - return Radius > Distance(width, height, X, Y); - else - range = X - width; - } - else { - if (Y < 0) - range = -Y; - else if (Y > height) - range = Y - height; - else - return pcb_true; - } - - return range < Radius; -} - -/* TODO: this code is BROKEN in the case of non-circular arcs, - * and in the case that the arc thickness is greater than - * the radius. - */ -pcb_bool IsPointOnArc(Coord X, Coord Y, Coord Radius, ArcTypePtr Arc) -{ - /* Calculate angle of point from arc center */ - double p_dist = Distance(X, Y, Arc->X, Arc->Y); - double p_cos = (X - Arc->X) / p_dist; - Angle p_ang = acos(p_cos) * PCB_RAD_TO_DEG; - Angle ang1, ang2; - - /* Convert StartAngle, Delta into bounding angles in [0, 720) */ - if (Arc->Delta > 0) { - ang1 = NormalizeAngle(Arc->StartAngle); - ang2 = NormalizeAngle(Arc->StartAngle + Arc->Delta); - } - else { - ang1 = NormalizeAngle(Arc->StartAngle + Arc->Delta); - ang2 = NormalizeAngle(Arc->StartAngle); - } - if (ang1 > ang2) - ang2 += 360; - /* Make sure full circles aren't treated as zero-length arcs */ - if (Arc->Delta == 360 || Arc->Delta == -360) - ang2 = ang1 + 360; - - if (Y > Arc->Y) - p_ang = -p_ang; - p_ang += 180; - - /* Check point is outside arc range, check distance from endpoints */ - if (ang1 >= p_ang || ang2 <= p_ang) { - Coord ArcX, ArcY; - - ArcX = Arc->X + Arc->Width * cos((Arc->StartAngle + 180) / PCB_RAD_TO_DEG); - ArcY = Arc->Y - Arc->Width * sin((Arc->StartAngle + 180) / PCB_RAD_TO_DEG); - if (Distance(X, Y, ArcX, ArcY) < Radius + Arc->Thickness / 2) - return pcb_true; - - ArcX = Arc->X + Arc->Width * cos((Arc->StartAngle + Arc->Delta + 180) / PCB_RAD_TO_DEG); - ArcY = Arc->Y - Arc->Width * sin((Arc->StartAngle + Arc->Delta + 180) / PCB_RAD_TO_DEG); - if (Distance(X, Y, ArcX, ArcY) < Radius + Arc->Thickness / 2) - return pcb_true; - return pcb_false; - } - /* If point is inside the arc range, just compare it to the arc */ - return fabs(Distance(X, Y, Arc->X, Arc->Y) - Arc->Width) < Radius + Arc->Thickness / 2; -} - -/* --------------------------------------------------------------------------- - * searches for any kind of object or for a set of object types - * the calling routine passes two pointers to allocated memory for storing - * the results. - * A type value is returned too which is PCB_TYPE_NONE if no objects has been found. - * A set of object types is passed in. - * The object is located by it's position. - * - * The layout is checked in the following order: - * polygon-point, pin, via, line, text, elementname, polygon, element - * - * Note that if Type includes PCB_TYPE_LOCKED, then the search includes - * locked items. Otherwise, locked items are ignored. - */ -int SearchObjectByLocation(unsigned Type, void **Result1, void **Result2, void **Result3, Coord X, Coord Y, Coord Radius) -{ - void *r1, *r2, *r3; - void **pr1 = &r1, **pr2 = &r2, **pr3 = &r3; - int i; - double HigherBound = 0; - int HigherAvail = PCB_TYPE_NONE; - int locked = Type & PCB_TYPE_LOCKED; - /* setup variables used by local functions */ - PosX = X; - PosY = Y; - SearchRadius = Radius; - if (Radius) { - SearchBox.X1 = X - Radius; - SearchBox.Y1 = Y - Radius; - SearchBox.X2 = X + Radius; - SearchBox.Y2 = Y + Radius; - } - else { - SearchBox = point_box(X, Y); - } - - if (conf_core.editor.lock_names) { - Type &= ~(PCB_TYPE_ELEMENT_NAME | PCB_TYPE_TEXT); - } - if (conf_core.editor.hide_names) { - Type &= ~PCB_TYPE_ELEMENT_NAME; - } - if (conf_core.editor.only_names) { - Type &= (PCB_TYPE_ELEMENT_NAME | PCB_TYPE_TEXT); - } - if (conf_core.editor.thin_draw || conf_core.editor.thin_draw_poly) { - Type &= ~PCB_TYPE_POLYGON; - } - - if (Type & PCB_TYPE_RATLINE && PCB->RatOn && - SearchRatLineByLocation(locked, (RatTypePtr *) Result1, (RatTypePtr *) Result2, (RatTypePtr *) Result3)) - return (PCB_TYPE_RATLINE); - - if (Type & PCB_TYPE_VIA && SearchViaByLocation(locked, (PinTypePtr *) Result1, (PinTypePtr *) Result2, (PinTypePtr *) Result3)) - return (PCB_TYPE_VIA); - - if (Type & PCB_TYPE_PIN && SearchPinByLocation(locked, (ElementTypePtr *) pr1, (PinTypePtr *) pr2, (PinTypePtr *) pr3)) - HigherAvail = PCB_TYPE_PIN; - - if (!HigherAvail && Type & PCB_TYPE_PAD && - SearchPadByLocation(locked, (ElementTypePtr *) pr1, (PadTypePtr *) pr2, (PadTypePtr *) pr3, pcb_false)) - HigherAvail = PCB_TYPE_PAD; - - if (!HigherAvail && Type & PCB_TYPE_ELEMENT_NAME && - SearchElementNameByLocation(locked, (ElementTypePtr *) pr1, (TextTypePtr *) pr2, (TextTypePtr *) pr3, pcb_false)) { - BoxTypePtr box = &((TextTypePtr) r2)->BoundingBox; - HigherBound = (double) (box->X2 - box->X1) * (double) (box->Y2 - box->Y1); - HigherAvail = PCB_TYPE_ELEMENT_NAME; - } - - if (!HigherAvail && Type & PCB_TYPE_ELEMENT && - SearchElementByLocation(locked, (ElementTypePtr *) pr1, (ElementTypePtr *) pr2, (ElementTypePtr *) pr3, pcb_false)) { - BoxTypePtr box = &((ElementTypePtr) r1)->BoundingBox; - HigherBound = (double) (box->X2 - box->X1) * (double) (box->Y2 - box->Y1); - HigherAvail = PCB_TYPE_ELEMENT; - } - - for (i = -1; i < max_copper_layer + 1; i++) { - if (i < 0) - SearchLayer = &PCB->Data->SILKLAYER; - else if (i < max_copper_layer) - SearchLayer = LAYER_ON_STACK(i); - else { - SearchLayer = &PCB->Data->BACKSILKLAYER; - if (!PCB->InvisibleObjectsOn) - continue; - } - if (SearchLayer->On) { - if ((HigherAvail & (PCB_TYPE_PIN | PCB_TYPE_PAD)) == 0 && - Type & PCB_TYPE_POLYGON_POINT && - SearchPointByLocation(locked, (LayerTypePtr *) Result1, (PolygonTypePtr *) Result2, (PointTypePtr *) Result3)) - return (PCB_TYPE_POLYGON_POINT); - - if ((HigherAvail & (PCB_TYPE_PIN | PCB_TYPE_PAD)) == 0 && - Type & PCB_TYPE_LINE_POINT && - SearchLinePointByLocation(locked, (LayerTypePtr *) Result1, (LineTypePtr *) Result2, (PointTypePtr *) Result3)) - return (PCB_TYPE_LINE_POINT); - - if ((HigherAvail & (PCB_TYPE_PIN | PCB_TYPE_PAD)) == 0 && Type & PCB_TYPE_LINE - && SearchLineByLocation(locked, (LayerTypePtr *) Result1, (LineTypePtr *) Result2, (LineTypePtr *) Result3)) - return (PCB_TYPE_LINE); - - if ((HigherAvail & (PCB_TYPE_PIN | PCB_TYPE_PAD)) == 0 && Type & PCB_TYPE_ARC && - SearchArcByLocation(locked, (LayerTypePtr *) Result1, (ArcTypePtr *) Result2, (ArcTypePtr *) Result3)) - return (PCB_TYPE_ARC); - - if ((HigherAvail & (PCB_TYPE_PIN | PCB_TYPE_PAD)) == 0 && Type & PCB_TYPE_TEXT - && SearchTextByLocation(locked, (LayerTypePtr *) Result1, (TextTypePtr *) Result2, (TextTypePtr *) Result3)) - return (PCB_TYPE_TEXT); - - if (Type & PCB_TYPE_POLYGON && - SearchPolygonByLocation(locked, (LayerTypePtr *) Result1, (PolygonTypePtr *) Result2, (PolygonTypePtr *) Result3)) { - if (HigherAvail) { - BoxTypePtr box = &(*(PolygonTypePtr *) Result2)->BoundingBox; - double area = (double) (box->X2 - box->X1) * (double) (box->X2 - box->X1); - if (HigherBound < area) - break; - else - return (PCB_TYPE_POLYGON); - } - else - return (PCB_TYPE_POLYGON); - } - } - } - /* return any previously found objects */ - if (HigherAvail & PCB_TYPE_PIN) { - *Result1 = r1; - *Result2 = r2; - *Result3 = r3; - return (PCB_TYPE_PIN); - } - - if (HigherAvail & PCB_TYPE_PAD) { - *Result1 = r1; - *Result2 = r2; - *Result3 = r3; - return (PCB_TYPE_PAD); - } - - if (HigherAvail & PCB_TYPE_ELEMENT_NAME) { - *Result1 = r1; - *Result2 = r2; - *Result3 = r3; - return (PCB_TYPE_ELEMENT_NAME); - } - - if (HigherAvail & PCB_TYPE_ELEMENT) { - *Result1 = r1; - *Result2 = r2; - *Result3 = r3; - return (PCB_TYPE_ELEMENT); - } - - /* search the 'invisible objects' last */ - if (!PCB->InvisibleObjectsOn) - return (PCB_TYPE_NONE); - - if (Type & PCB_TYPE_PAD && - SearchPadByLocation(locked, (ElementTypePtr *) Result1, (PadTypePtr *) Result2, (PadTypePtr *) Result3, pcb_true)) - return (PCB_TYPE_PAD); - - if (Type & PCB_TYPE_ELEMENT_NAME && - SearchElementNameByLocation(locked, (ElementTypePtr *) Result1, (TextTypePtr *) Result2, (TextTypePtr *) Result3, pcb_true)) - return (PCB_TYPE_ELEMENT_NAME); - - if (Type & PCB_TYPE_ELEMENT && - SearchElementByLocation(locked, (ElementTypePtr *) Result1, (ElementTypePtr *) Result2, (ElementTypePtr *) Result3, pcb_true)) - return (PCB_TYPE_ELEMENT); - - return (PCB_TYPE_NONE); -} - -/* --------------------------------------------------------------------------- - * searches for a object by it's unique ID. It doesn't matter if - * the object is visible or not. The search is performed on a PCB, a - * buffer or on the remove list. - * The calling routine passes two pointers to allocated memory for storing - * the results. - * A type value is returned too which is PCB_TYPE_NONE if no objects has been found. - */ -int SearchObjectByID(DataTypePtr Base, void **Result1, void **Result2, void **Result3, int ID, int type) -{ - if (type == PCB_TYPE_LINE || type == PCB_TYPE_LINE_POINT) { - ALLLINE_LOOP(Base); - { - if (line->ID == ID) { - *Result1 = (void *) layer; - *Result2 = *Result3 = (void *) line; - return (PCB_TYPE_LINE); - } - if (line->Point1.ID == ID) { - *Result1 = (void *) layer; - *Result2 = (void *) line; - *Result3 = (void *) &line->Point1; - return (PCB_TYPE_LINE_POINT); - } - if (line->Point2.ID == ID) { - *Result1 = (void *) layer; - *Result2 = (void *) line; - *Result3 = (void *) &line->Point2; - return (PCB_TYPE_LINE_POINT); - } - } - ENDALL_LOOP; - } - if (type == PCB_TYPE_ARC) { - ALLARC_LOOP(Base); - { - if (arc->ID == ID) { - *Result1 = (void *) layer; - *Result2 = *Result3 = (void *) arc; - return (PCB_TYPE_ARC); - } - } - ENDALL_LOOP; - } - - if (type == PCB_TYPE_TEXT) { - ALLTEXT_LOOP(Base); - { - if (text->ID == ID) { - *Result1 = (void *) layer; - *Result2 = *Result3 = (void *) text; - return (PCB_TYPE_TEXT); - } - } - ENDALL_LOOP; - } - - if (type == PCB_TYPE_POLYGON || type == PCB_TYPE_POLYGON_POINT) { - ALLPOLYGON_LOOP(Base); - { - if (polygon->ID == ID) { - *Result1 = (void *) layer; - *Result2 = *Result3 = (void *) polygon; - return (PCB_TYPE_POLYGON); - } - if (type == PCB_TYPE_POLYGON_POINT) - POLYGONPOINT_LOOP(polygon); - { - if (point->ID == ID) { - *Result1 = (void *) layer; - *Result2 = (void *) polygon; - *Result3 = (void *) point; - return (PCB_TYPE_POLYGON_POINT); - } - } - END_LOOP; - } - ENDALL_LOOP; - } - if (type == PCB_TYPE_VIA) { - VIA_LOOP(Base); - { - if (via->ID == ID) { - *Result1 = *Result2 = *Result3 = (void *) via; - return (PCB_TYPE_VIA); - } - } - END_LOOP; - } - - if (type == PCB_TYPE_RATLINE || type == PCB_TYPE_LINE_POINT) { - RAT_LOOP(Base); - { - if (line->ID == ID) { - *Result1 = *Result2 = *Result3 = (void *) line; - return (PCB_TYPE_RATLINE); - } - if (line->Point1.ID == ID) { - *Result1 = (void *) NULL; - *Result2 = (void *) line; - *Result3 = (void *) &line->Point1; - return (PCB_TYPE_LINE_POINT); - } - if (line->Point2.ID == ID) { - *Result1 = (void *) NULL; - *Result2 = (void *) line; - *Result3 = (void *) &line->Point2; - return (PCB_TYPE_LINE_POINT); - } - } - END_LOOP; - } - - if (type == PCB_TYPE_ELEMENT || type == PCB_TYPE_PAD || type == PCB_TYPE_PIN - || type == PCB_TYPE_ELEMENT_LINE || type == PCB_TYPE_ELEMENT_NAME || type == PCB_TYPE_ELEMENT_ARC) - /* check pins and elementnames too */ - ELEMENT_LOOP(Base); - { - if (element->ID == ID) { - *Result1 = *Result2 = *Result3 = (void *) element; - return (PCB_TYPE_ELEMENT); - } - if (type == PCB_TYPE_ELEMENT_LINE) - ELEMENTLINE_LOOP(element); - { - if (line->ID == ID) { - *Result1 = (void *) element; - *Result2 = *Result3 = (void *) line; - return (PCB_TYPE_ELEMENT_LINE); - } - } - END_LOOP; - if (type == PCB_TYPE_ELEMENT_ARC) - ARC_LOOP(element); - { - if (arc->ID == ID) { - *Result1 = (void *) element; - *Result2 = *Result3 = (void *) arc; - return (PCB_TYPE_ELEMENT_ARC); - } - } - END_LOOP; - if (type == PCB_TYPE_ELEMENT_NAME) - ELEMENTTEXT_LOOP(element); - { - if (text->ID == ID) { - *Result1 = (void *) element; - *Result2 = *Result3 = (void *) text; - return (PCB_TYPE_ELEMENT_NAME); - } - } - END_LOOP; - if (type == PCB_TYPE_PIN) - PIN_LOOP(element); - { - if (pin->ID == ID) { - *Result1 = (void *) element; - *Result2 = *Result3 = (void *) pin; - return (PCB_TYPE_PIN); - } - } - END_LOOP; - if (type == PCB_TYPE_PAD) - PAD_LOOP(element); - { - if (pad->ID == ID) { - *Result1 = (void *) element; - *Result2 = *Result3 = (void *) pad; - return (PCB_TYPE_PAD); - } - } - END_LOOP; - } - END_LOOP; - - Message(PCB_MSG_DEFAULT, "hace: Internal error, search for ID %d failed\n", ID); - return (PCB_TYPE_NONE); -} - -/* --------------------------------------------------------------------------- - * searches for an element by its board name. - * The function returns a pointer to the element, NULL if not found - */ -ElementTypePtr SearchElementByName(DataTypePtr Base, const char *Name) -{ - ElementTypePtr result = NULL; - - ELEMENT_LOOP(Base); - { - if (element->Name[1].TextString && NSTRCMP(element->Name[1].TextString, Name) == 0) { - result = element; - return (result); - } - } - END_LOOP; - return result; -} - -/* --------------------------------------------------------------------------- - * searches the cursor position for the type - */ -int SearchScreen(Coord X, Coord Y, int Type, void **Result1, void **Result2, void **Result3) -{ - int ans; - - ans = SearchObjectByLocation(Type, Result1, Result2, Result3, X, Y, SLOP * pixel_slop); - return (ans); -} - -/* --------------------------------------------------------------------------- - * searches the cursor position for the type - */ -int SearchScreenGridSlop(Coord X, Coord Y, int Type, void **Result1, void **Result2, void **Result3) -{ - int ans; - - ans = SearchObjectByLocation(Type, Result1, Result2, Result3, X, Y, PCB->Grid / 2); - return (ans); -} - -int lines_intersect(Coord ax1, Coord ay1, Coord ax2, Coord ay2, Coord bx1, Coord by1, Coord bx2, Coord by2) -{ -/* TODO: this should be long double if Coord is 64 bits */ - double ua, xi, yi, X1, Y1, X2, Y2, X3, Y3, X4, Y4, tmp; - int is_a_pt, is_b_pt; - - /* degenerate cases: a line is actually a point */ - is_a_pt = (ax1 == ax2) && (ay1 == ay2); - is_b_pt = (bx1 == bx2) && (by1 == by2); - - if (is_a_pt && is_b_pt) - return (ax1 == bx1) && (ay1 == by1); - - if (is_a_pt) - return is_point_on_line(ax1, ay1, bx1, by1, bx2, by2); - if (is_b_pt) - return is_point_on_line(bx1, by1, ax1, ay1, ax2, ay2); - - /* maths from http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ */ - - X1 = ax1; - X2 = ax2; - X3 = bx1; - X4 = bx2; - Y1 = ay1; - Y2 = ay2; - Y3 = by1; - Y4 = by2; - - tmp = ((Y4 - Y3) * (X2 - X1) - (X4 - X3) * (Y2 - Y1)); - ua = ((X4 - X3) * (Y1 - Y3) - (Y4 - Y3) * (X1 - X3)) / tmp; -/* ub = ((X2 - X1) * (Y1 - Y3) - (Y2 - Y1) * (X1 - X3)) / tmp;*/ - xi = X1 + ua * (X2 - X1); - yi = Y1 + ua * (Y2 - Y1); - -#define check(e1, e2, i) \ - if (e1 < e2) { \ - if ((i < e1) || (i > e2)) \ - return 0; \ - } \ - else { \ - if ((i > e1) || (i < e2)) \ - return 0; \ - } - - check(ax1, ax2, xi); - check(bx1, bx2, xi); - check(ay1, ay2, yi); - check(by1, by2, yi); - return 1; -} Index: 1.1.4/src/select_act.c =================================================================== --- 1.1.4/src/select_act.c (revision 10776) +++ 1.1.4/src/select_act.c (nonexistent) @@ -1,388 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" - -#include "data.h" -#include "action_helper.h" -#include "error.h" -#include "undo.h" -#include "funchash_core.h" - -#include "select.h" -#include "crosshair.h" -#include "set.h" -#include "buffer.h" -#include "draw.h" -#include "remove.h" -#include "copy.h" -#include "hid_attrib.h" -#include "compat_misc.h" - -/* --------------------------------------------------------------------------- */ -/* Ask the user for a search pattern */ -static char *gui_get_pat(search_method_t * method) -{ - const char *methods[] = { "regexp", "list of names", NULL }; - HID_Attribute attrs[2]; -#define nattr sizeof(attrs)/sizeof(attrs[0]) - static HID_Attr_Val results[nattr] = { 0 }; - - memset(attrs, 0, sizeof(attrs)); - - attrs[0].name = "Pattern"; - attrs[0].help_text = "Name/refdes pattern"; - attrs[0].type = HID_String; - attrs[0].default_val.str_value = results[0].str_value; - - attrs[1].name = "Method"; - attrs[1].help_text = "method of search: either regular expression or a list of full names separated by |"; - attrs[1].type = HID_Enum; - attrs[1].enumerations = methods; - attrs[1].default_val.int_value = results[1].int_value; - - gui->attribute_dialog(attrs, nattr, results, "Find element", "Find element by name"); - - *method = results[1].int_value; - if (results[0].str_value == NULL) - return NULL; - return pcb_strdup(results[0].str_value); -#undef nattr -} - - -/* --------------------------------------------------------------------------- */ - -static const char select_syntax[] = - "Select(Object|ToggleObject)\n" - "Select(All|Block|Connection)\n" - "Select(ElementByName|ObjectByName|PadByName|PinByName)\n" - "Select(ElementByName|ObjectByName|PadByName|PinByName, Name)\n" - "Select(TextByName|ViaByName|NetByName)\n" "Select(TextByName|ViaByName|NetByName, Name)\n" "Select(Convert)"; - -static const char select_help[] = "Toggles or sets the selection."; - -/* %start-doc actions Select - -@table @code - -@item ElementByName -@item ObjectByName -@item PadByName -@item PinByName -@item TextByName -@item ViaByName -@item NetByName - -These all rely on having a regular expression parser built into -@code{pcb}. If the name is not specified then the user is prompted -for a pattern, and all objects that match the pattern and are of the -type specified are selected. - -@item Object -@item ToggleObject -Selects the object under the cursor. - -@item Block -Selects all objects in a rectangle indicated by the cursor. - -@item All -Selects all objects on the board. - -@item Connection -Selects all connections with the ``found'' flag set. - -@item Convert -Converts the selected objects to an element. This uses the highest -numbered paste buffer. - -@end table - -%end-doc */ - -static int ActionSelect(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - int type; - - switch (funchash_get(function, NULL)) { /* select objects by their names */ - case F_ElementByName: - type = PCB_TYPE_ELEMENT; - goto commonByName; - case F_ObjectByName: - type = PCB_TYPEMASK_ALL; - goto commonByName; - case F_PadByName: - type = PCB_TYPE_PAD; - goto commonByName; - case F_PinByName: - type = PCB_TYPE_PIN; - goto commonByName; - case F_TextByName: - type = PCB_TYPE_TEXT; - goto commonByName; - case F_ViaByName: - type = PCB_TYPE_VIA; - goto commonByName; - case F_NetByName: - type = PCB_TYPE_NET; - goto commonByName; - - commonByName: - { - const char *pattern = ACTION_ARG(1); - search_method_t method = SM_REGEX; - - if (pattern || (pattern = gui_get_pat(&method)) != NULL) { - if (SelectObjectByName(type, pattern, pcb_true, method)) - SetChangedFlag(pcb_true); - if (ACTION_ARG(1) == NULL) - free((char*)pattern); - } - break; - } - - /* select a single object */ - case F_ToggleObject: - case F_Object: - if (SelectObject()) - SetChangedFlag(pcb_true); - break; - - /* all objects in block */ - case F_Block: - { - BoxType box; - - box.X1 = MIN(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y1 = MIN(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); - box.X2 = MAX(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y2 = MAX(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); - notify_crosshair_change(pcb_false); - NotifyBlock(); - if (Crosshair.AttachedBox.State == STATE_THIRD && SelectBlock(&box, pcb_true)) { - SetChangedFlag(pcb_true); - Crosshair.AttachedBox.State = STATE_FIRST; - } - notify_crosshair_change(pcb_true); - break; - } - - /* select all visible objects */ - case F_All: - { - BoxType box; - - box.X1 = -MAX_COORD; - box.Y1 = -MAX_COORD; - box.X2 = MAX_COORD; - box.Y2 = MAX_COORD; - if (SelectBlock(&box, pcb_true)) - SetChangedFlag(pcb_true); - break; - } - - /* all found connections */ - case F_Connection: - if (SelectConnection(pcb_true)) { - Draw(); - IncrementUndoSerialNumber(); - SetChangedFlag(pcb_true); - } - break; - - case F_Convert: - { - Coord x, y; - Note.Buffer = conf_core.editor.buffer_number; - SetBufferNumber(MAX_BUFFER - 1); - ClearBuffer(PASTEBUFFER); - gui->get_coords(_("Select the Element's Mark Location"), &x, &y); - x = GridFit(x, PCB->Grid, PCB->GridOffsetX); - y = GridFit(y, PCB->Grid, PCB->GridOffsetY); - AddSelectedToBuffer(PASTEBUFFER, x, y, pcb_true); - SaveUndoSerialNumber(); - RemoveSelected(); - ConvertBufferToElement(PASTEBUFFER); - RestoreUndoSerialNumber(); - CopyPastebufferToLayout(x, y); - SetBufferNumber(Note.Buffer); - } - break; - - default: - AFAIL(select); - break; - } - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char unselect_syntax[] = - "Unselect(All|Block|Connection)\n" - "Unselect(ElementByName|ObjectByName|PadByName|PinByName)\n" - "Unselect(ElementByName|ObjectByName|PadByName|PinByName, Name)\n" - "Unselect(TextByName|ViaByName)\n" "Unselect(TextByName|ViaByName, Name)\n"; - -static const char unselect_help[] = "Unselects the object at the pointer location or the specified objects."; - -/* %start-doc actions Unselect - -@table @code - -@item All -Unselect all objects. - -@item Block -Unselect all objects in a rectangle given by the cursor. - -@item Connection -Unselect all connections with the ``found'' flag set. - -@item ElementByName -@item ObjectByName -@item PadByName -@item PinByName -@item TextByName -@item ViaByName - -These all rely on having a regular expression parser built into -@code{pcb}. If the name is not specified then the user is prompted -for a pattern, and all objects that match the pattern and are of the -type specified are unselected. - - -@end table - -%end-doc */ - -static int ActionUnselect(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (function) { - int type; - switch (funchash_get(function, NULL)) { - /* select objects by their names */ - case F_ElementByName: - type = PCB_TYPE_ELEMENT; - goto commonByName; - case F_ObjectByName: - type = PCB_TYPEMASK_ALL; - goto commonByName; - case F_PadByName: - type = PCB_TYPE_PAD; - goto commonByName; - case F_PinByName: - type = PCB_TYPE_PIN; - goto commonByName; - case F_TextByName: - type = PCB_TYPE_TEXT; - goto commonByName; - case F_ViaByName: - type = PCB_TYPE_VIA; - goto commonByName; - case F_NetByName: - type = PCB_TYPE_NET; - goto commonByName; - - commonByName: - { - const char *pattern = ACTION_ARG(1); - search_method_t method = SM_REGEX; - - if (pattern || (pattern = gui_get_pat(&method)) != NULL) { - if (SelectObjectByName(type, pattern, pcb_false, method)) - SetChangedFlag(pcb_true); - if (ACTION_ARG(1) == NULL) - free((char*)pattern); - } - break; - } - - /* all objects in block */ - case F_Block: - { - BoxType box; - - box.X1 = MIN(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y1 = MIN(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); - box.X2 = MAX(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y2 = MAX(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); - notify_crosshair_change(pcb_false); - NotifyBlock(); - if (Crosshair.AttachedBox.State == STATE_THIRD && SelectBlock(&box, pcb_false)) { - SetChangedFlag(pcb_true); - Crosshair.AttachedBox.State = STATE_FIRST; - } - notify_crosshair_change(pcb_true); - break; - } - - /* unselect all visible objects */ - case F_All: - { - BoxType box; - - box.X1 = -MAX_COORD; - box.Y1 = -MAX_COORD; - box.X2 = MAX_COORD; - box.Y2 = MAX_COORD; - if (SelectBlock(&box, pcb_false)) - SetChangedFlag(pcb_true); - break; - } - - /* all found connections */ - case F_Connection: - if (SelectConnection(pcb_false)) { - Draw(); - IncrementUndoSerialNumber(); - SetChangedFlag(pcb_true); - } - break; - - default: - AFAIL(unselect); - break; - - } - } - return 0; -} - -HID_Action select_action_list[] = { - {"Select", 0, ActionSelect, - select_help, select_syntax} - , - {"Unselect", 0, ActionUnselect, - unselect_help, unselect_syntax} -}; - -REGISTER_ACTIONS(select_action_list, NULL) Index: 1.1.4/src/hid_cfg_input.h =================================================================== --- 1.1.4/src/hid_cfg_input.h (revision 10776) +++ 1.1.4/src/hid_cfg_input.h (nonexistent) @@ -1,144 +0,0 @@ -#ifndef PCB_HID_CFG_INPUT_H -#define PCB_HID_CFG_INPUT_H - -#include -#include -#include "hid_cfg.h" - -#define M_Mod0(n) (1u<<(n)) -typedef enum { - M_Shift = M_Mod0(0), - M_Ctrl = M_Mod0(1), - M_Alt = M_Mod0(2), - M_Mod1 = M_Alt, - /* M_Mod(3) is M_Mod0(4) */ - /* M_Mod(4) is M_Mod0(5) */ - M_Release = M_Mod0(6), /* there might be a random number of modkeys, but hopefully not this many */ - - MB_LEFT = M_Mod0(7), - MB_MIDDLE = M_Mod0(8), - MB_RIGHT = M_Mod0(9), - -/* scroll wheel */ - MB_SCROLL_UP = M_Mod0(10), - MB_SCROLL_DOWN = M_Mod0(11), - MB_SCROLL_LEFT = M_Mod0(12), - MB_SCROLL_RIGHT = M_Mod0(13) -} hid_cfg_mod_t; -#undef M_Mod0 - -#define MB_ANY (MB_LEFT | MB_MIDDLE | MB_RIGHT | MB_SCROLL_UP | MB_SCROLL_DOWN | MB_SCROLL_LEFT | MB_SCROLL_RIGHT) -#define M_ANY (M_Release-1) - -/************************** MOUSE ***************************/ - -typedef struct { - lht_node_t *mouse; - htip_t *mouse_mask; -} hid_cfg_mouse_t; - -int hid_cfg_mouse_init(hid_cfg_t *hr, hid_cfg_mouse_t *mouse); -void hid_cfg_mouse_action(hid_cfg_mouse_t *mouse, hid_cfg_mod_t button_and_mask); - - -/************************** KEYBOARD ***************************/ -#define HIDCFG_MAX_KEYSEQ_LEN 32 -typedef union hid_cfg_keyhash_u { /* integer hash key */ - unsigned long hash; - struct { - unsigned short int mods; /* of hid_cfg_mod_t */ - unsigned short int key_char; - } details; -} hid_cfg_keyhash_t; - - -typedef struct hid_cfg_keyseq_s hid_cfg_keyseq_t; -struct hid_cfg_keyseq_s { - unsigned long int keysym; /* optional 32 bit long storage the GUI hid should cast to whatever the GUI backend supports */ - - const lht_node_t *action_node; /* terminal node: end of sequence, run actions */ - - htip_t seq_next; /* ... or if node is NULL, a hash for each key that may follow the current one */ - hid_cfg_keyseq_t *parent; -}; - -/* Translate symbolic name to single-char keysym before processing; useful - for shortcuts like "Return -> '\r'" which are otherwise hard to describe - in text format */ -typedef struct hid_cfg_keytrans_s { - const char *name; - char sym; -} hid_cfg_keytrans_t; - -extern const hid_cfg_keytrans_t hid_cfg_key_default_trans[]; - -/* A complete tree of keyboard shortcuts/hotkeys */ -typedef struct hid_cfg_keys_s { - htip_t keys; - - /* translate key sym description (the portion after ) to key_char; - desc is a \0 terminated string, len is only a hint. Should return 0 - on error. */ - unsigned short int (*translate_key)(const char *desc, int len); - - /* convert a key_char to human readable name, copy the string to out/out_len. - Return 0 on success. */ - int (*key_name)(unsigned short int key_char, char *out, int out_len); - - - int auto_chr; /* if non-zero: don't call translate_key() for 1-char symbols, handle the default way */ - const hid_cfg_keytrans_t *auto_tr; /* apply this table before calling translate_key() */ -} hid_cfg_keys_t; - - -/* Initialize a new keyboard context - Returns 0 on success. -*/ -int hid_cfg_keys_init(hid_cfg_keys_t *km); - -/* Free km's fields recursively */ -int hid_cfg_keys_uninit(hid_cfg_keys_t *km); - -/* Add the next key of a key sequence; key sequences form a tree. A key starting - a new key sequence should have parent set NULL, subsequent calls should have - parent set to the previously returned keyseq value. Terminal is non-zero if - this is the last key of the sequence. - Returns NULL on error */ -hid_cfg_keyseq_t *hid_cfg_keys_add_under(hid_cfg_keys_t *km, hid_cfg_keyseq_t *parent, hid_cfg_mod_t mods, unsigned short int key_char, int terminal); - -/* Add a new key using a description (read from a lihata file usually) - If out_seq is not NULL, load the array with pointers pointing to each - key in the sequence, up to out_seq_len. - When key desc is a lihata node, it may be a list (multiple keys for the - same action). In this case return value and seq are set using the first key. - Returns -1 on failure or the length of the sequence. -*/ -int hid_cfg_keys_add_by_desc(hid_cfg_keys_t *km, const lht_node_t *keydesc, const lht_node_t *action_node, hid_cfg_keyseq_t **out_seq, int out_seq_len); -int hid_cfg_keys_add_by_strdesc(hid_cfg_keys_t *km, const char *keydesc, const lht_node_t *action_node, hid_cfg_keyseq_t **out_seq, int out_seq_len); - - -/* Allocate a new string and generate a human readable accel-text; mask determines - which keys on the list are generated (when multiple key sequences are - specified for the same action; from LSB to MSB, at most 32 keys) - Caller needs to free the string; returns NULL on error. - */ -char *hid_cfg_keys_gen_accel(hid_cfg_keys_t *km, const lht_node_t *keydescn, unsigned long mask, const char *sep); - -/* Process next input key stroke. - Seq and seq_len must not be NULL as they are the internal state of multi-key - processing. Load seq array with pointers pointing to each key in the - sequence, up to seq_len. - Returns: - -1 if the key stroke or sequence is invalid - 0 if more characters needed to complete the sequence - + a positive integer means the lookup succeeded and the return value - is the length of the resulting sequence. -*/ -int hid_cfg_keys_input(hid_cfg_keys_t *km, hid_cfg_mod_t mods, unsigned short int key_char, hid_cfg_keyseq_t **seq, int *seq_len); - -/* Run the action for a key sequence looked up by hid_cfg_keys_input(). - Returns: the result of the action or -1 on error */ -int hid_cfg_keys_action(hid_cfg_keyseq_t **seq, int seq_len); - - -#endif Index: 1.1.4/src/compat_dl.h =================================================================== --- 1.1.4/src/compat_dl.h (revision 10776) +++ 1.1.4/src/compat_dl.h (nonexistent) @@ -1,51 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_COMPAT_DL_H -#define PCB_COMPAT_DL_H - -#include "config.h" -#include "compat_inc.h" - -#ifdef USE_LOADLIBRARY -void *dlopen(const char *, int); -void dlclose(void *); -char *dlerror(void); - -void *dlsym(void *, const char *); - -#ifndef RTLD_NOW -#define RTLD_NOW 2 -#endif - -#ifndef RTLD_LOCAL -#define RTLD_LOCAL 0 -#endif - -#ifndef RTLD_GLOBAL -#define RTLD_GLOBAL 4 -#endif - -#endif - - -#endif /* PCB_COMPAT_DL_H */ Index: 1.1.4/src/hid.h =================================================================== --- 1.1.4/src/hid.h (revision 10776) +++ 1.1.4/src/hid.h (nonexistent) @@ -1,578 +0,0 @@ -#ifndef PCB_HID_H -#define PCB_HID_H - -#include - -#include "config.h" -#include "error.h" -#include "global_typedefs.h" - -typedef struct HID_Attr_Val_s HID_Attr_Val; -typedef struct HID_Attribute_s HID_Attribute; - -/* Human Interface Device */ - -/* - -The way the HID layer works is that you instantiate a HID device -structure, and invoke functions through its members. Code in the -common part of PCB may *not* rely on *anything* other than what's -defined in this file. Code in the HID layers *may* rely on data and -functions in the common code (like, board size and such) but it's -considered bad form to do so when not needed. - -Coordinates are ALWAYS in pcb's default resolution (1/100 mil at the -moment). Positive X is right, positive Y is down. Angles are -degrees, with 0 being right (positive X) and 90 being up (negative Y). -All zoom, scaling, panning, and conversions are hidden inside the HID -layers. - -The main structure is at the end of this file. - -Data structures passed to the HIDs will be copied if the HID needs to -save them. Data structures returned from the HIDs must not be freed, -and may be changed by the HID in response to new information. - -*/ - -/* Like end cap styles. The cap *always* extends beyond the - coordinates given, by half the width of the line. Beveled ends can - used to make octagonal pads by giving the same x,y coordinate - twice. */ -typedef enum { - Trace_Cap, /* This means we're drawing a trace, which has round caps. */ - Square_Cap, /* Square pins or pads. */ - Round_Cap, /* Round pins or round-ended pads, thermals. */ - Beveled_Cap /* Octagon pins or bevel-cornered pads. */ -} EndCapStyle; - -/* The HID may need something more than an "int" for colors, timers, - etc. So it passes/returns one of these, which is castable to a - variety of things. */ -typedef union { - long lval; - void *ptr; -} hidval; - -/* This graphics context is an opaque pointer defined by the HID. GCs - are HID-specific; attempts to use one HID's GC for a different HID - will result in a fatal error. */ -typedef struct hid_gc_struct *hidGC; - -#define HIDCONCAT(a,b) a##b - -/* This is used to register the action callbacks (for menus and - whatnot). HID assumes the following actions are available for its - use: - SaveAs(filename); - Quit(); -*/ -typedef struct { - /* This is matched against action names in the GUI configuration */ - const char *name; - /* If this string is non-NULL, the action needs to know the X,Y - coordinates to act on, and this string may be used to prompt - the user to select a coordinate. If NULL, the coordinates may - be 0,0 if none are known. */ - const char *need_coord_msg; - /* Called when the action is triggered. If this function returns - non-zero, no further actions will be invoked for this key/mouse - event. */ - int (*trigger_cb) (int argc, const char **argv, Coord x, Coord y); - /* Short description that sometimes accompanies the name. */ - const char *description; - /* Full allowed syntax; use \n to separate lines. */ - const char *syntax; -} HID_Action; - -extern void hid_register_action(const HID_Action *a, const char *cookie, int copy); - -extern void hid_register_actions(const HID_Action *a, int, const char *cookie, int copy); -#define REGISTER_ACTIONS(a, cookie) HIDCONCAT(void register_,a) ()\ -{ hid_register_actions(a, sizeof(a)/sizeof(a[0]), cookie, 0); } - -/* Note that PCB expects the gui to provide the following actions: - - PCBChanged(); - RouteStylesChanged() - NetlistChanged() (but core should call "void NetlistChanged(int);" in netlist.c) - LayersChanged() - LibraryChanged() - Busy() - */ - -extern const char pcbchanged_help[]; -extern const char pcbchanged_syntax[]; -extern const char routestyleschanged_help[]; -extern const char routestyleschanged_syntax[]; -extern const char netlistchanged_help[]; -extern const char netlistchanged_syntax[]; -extern const char layerschanged_help[]; -extern const char layerschanged_syntax[]; -extern const char librarychanged_help[]; -extern const char librarychanged_syntax[]; - -/* File Watch flags */ -/* Based upon those in dbus/dbus-connection.h */ -typedef enum { - PCB_WATCH_READABLE = 1 << 0, - /**< As in POLLIN */ - PCB_WATCH_WRITABLE = 1 << 1, - /**< As in POLLOUT */ - PCB_WATCH_ERROR = 1 << 2, /**< As in POLLERR */ - PCB_WATCH_HANGUP = 1 << 3 /**< As in POLLHUP */ -} PCBWatchFlags; - -/* DRC GUI Hooks */ -typedef struct { - int log_drc_overview; - int log_drc_violations; - void (*reset_drc_dialog_message) (void); - void (*append_drc_violation) (DrcViolationType * violation); - int (*throw_drc_dialog) (void); -} HID_DRC_GUI; - -typedef struct hid_st HID; - -/* This is the main HID structure. */ -struct hid_st { - /* The size of this structure. We use this as a compatibility - check; a HID built with a different hid.h than we're expecting - should have a different size here. */ - int struct_size; - - /* The name of this HID. This should be suitable for - command line options, multi-selection menus, file names, - etc. */ - const char *name; - - /* Likewise, but allowed to be longer and more descriptive. */ - const char *description; - - /* The hid may use this field to store its context. */ - void *user_context; - - /* If set, this is the GUI HID. Exactly one of these three flags - must be set; setting "gui" lets the expose callback optimize and - coordinate itself. */ - unsigned gui:1; - - /* If set, this is the printer-class HID. The common part of PCB - may use this to do command-line printing, without having - instantiated any GUI HIDs. Only one printer HID is normally - defined at a time. */ - unsigned printer:1; - - /* If set, this HID provides an export option, and should be used as - part of the File->Export menu option. Examples are PNG, Gerber, - and EPS exporters. */ - unsigned exporter:1; - - /* If set, the redraw code will draw polygons before erasing the - clearances. */ - unsigned poly_before:1; - - /* If set, the redraw code will draw polygons after erasing the - clearances. Note that HIDs may set both of these, in which case - polygons will be drawn twice. */ - unsigned poly_after:1; - - /* If set, draw holes after copper, silk and mask, to make sure it - punches through everything. */ - unsigned holes_after:1; - - /* Returns a set of resources describing options the export or print - HID supports. In GUI mode, the print/export dialogs use this to - set up the selectable options. In command line mode, these are - used to interpret command line options. If n_ret is non-NULL, - the number of attributes is stored there. */ - HID_Attribute *(*get_export_options) (int *n_ret_); - - /* Export (or print) the current PCB. The options given represent - the choices made from the options returned from - get_export_options. Call with options == NULL to start the - primary GUI (create a main window, print, export, etc) */ - void (*do_export) (HID_Attr_Val * options_); - - /* uninit a GUI hid */ - void (*uninit) (HID *hid); - - /* uninit a GUI hid */ - void (*do_exit) (HID *hid); - - /* Parse the command line. Call this early for whatever HID will be - the primary HID, as it will set all the registered attributes. - The HID should remove all arguments, leaving any possible file - names behind. */ - void (*parse_arguments) (int *argc_, char ***argv_); - - /* This may be called to ask the GUI to force a redraw of a given area */ - void (*invalidate_lr) (int left_, int right_, int top_, int bottom_); - void (*invalidate_all) (void); - void (*notify_crosshair_change) (pcb_bool changes_complete); - void (*notify_mark_change) (pcb_bool changes_complete); - - /* During redraw or print/export cycles, this is called once per - layer (or layer group, for copper layers). If it returns false - (zero), the HID does not want that layer, and none of the drawing - functions should be called. If it returns pcb_true (nonzero), the - items in that layer [group] should be drawn using the various - drawing functions. In addition to the MAX_LAYERS copper layer - groups, you may select layers indicated by the macros SL_* - defined above, or any others with an index of -1. For copper - layer groups, you may pass NULL for name to have a name fetched - from the PCB struct. The EMPTY argument is a hint - if set, the - layer is empty, if zero it may be non-empty. */ - int (*set_layer) (const char *name_, int group_, int _empty); - - /* Tell the GUI the layer last selected has been finished with */ - void (*end_layer) (void); - - /* Drawing Functions. Coordinates and distances are ALWAYS in PCB's - default coordinates (1/100 mil at the time this comment was - written). Angles are always in degrees, with 0 being "right" - (positive X) and 90 being "up" (positive Y). */ - - /* Make an empty graphics context. */ - hidGC (*make_gc) (void); - void (*destroy_gc) (hidGC gc_); - - /* Special note about the "erase" color: To use this color, you must - use this function to tell the HID when you're using it. At the - beginning of a layer redraw cycle (i.e. after set_layer), call - use_mask() to redirect output to a buffer. Draw to the buffer - (using regular HID calls) using regular and "erase" colors. Then - call use_mask(HID_MASK_OFF) to flush the buffer to the HID. If - you use the "erase" color when use_mask is disabled, it simply - draws in the background color. */ - void (*use_mask) (int use_it_); - /* Flush the buffer and return to non-mask operation. */ -#define HID_MASK_OFF 0 - /* Polygons being drawn before clears. */ -#define HID_MASK_BEFORE 1 - /* Clearances being drawn. */ -#define HID_MASK_CLEAR 2 - /* Polygons being drawn after clears. */ -#define HID_MASK_AFTER 3 - - /* Set a color. Names can be like "red" or "#rrggbb" or special - names like "erase". *Always* use the "erase" color for removing - ink (like polygon reliefs or thermals), as you cannot rely on - knowing the background color or special needs of the HID. Always - use the "drill" color to draw holes. You may assume this is - cheap enough to call inside the redraw callback, but not cheap - enough to call for each item drawn. */ - void (*set_color) (hidGC gc_, const char *name_); - - /* Set the line style. While calling this is cheap, calling it with - different values each time may be expensive, so grouping items by - line style is helpful. */ - void (*set_line_cap) (hidGC gc_, EndCapStyle style_); - void (*set_line_width) (hidGC gc_, Coord width_); - void (*set_draw_xor) (hidGC gc_, int xor_); - /* Blends 20% or so color with 80% background. Only used for - assembly drawings so far. */ - void (*set_draw_faded) (hidGC gc_, int faded_); - - /* The usual drawing functions. "draw" means to use segments of the - given width, whereas "fill" means to fill to a zero-width - outline. */ - void (*draw_line) (hidGC gc_, Coord x1_, Coord y1_, Coord x2_, Coord y2_); - void (*draw_arc) (hidGC gc_, Coord cx_, Coord cy_, Coord xradius_, Coord yradius_, Angle start_angle_, Angle delta_angle_); - void (*draw_rect) (hidGC gc_, Coord x1_, Coord y1_, Coord x2_, Coord y2_); - void (*fill_circle) (hidGC gc_, Coord cx_, Coord cy_, Coord radius_); - void (*fill_polygon) (hidGC gc_, int n_coords_, Coord * x_, Coord * y_); - void (*fill_pcb_polygon) (hidGC gc_, PolygonType * poly, const BoxType * clip_box); - void (*thindraw_pcb_polygon) (hidGC gc_, PolygonType * poly, const BoxType * clip_box); - void (*fill_pcb_pad) (hidGC gc_, PadType * pad, pcb_bool clip, pcb_bool mask); - void (*thindraw_pcb_pad) (hidGC gc_, PadType * pad, pcb_bool clip, pcb_bool mask); - void (*fill_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType * pv, pcb_bool drawHole, pcb_bool mask); - void (*thindraw_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType * pv, pcb_bool drawHole, pcb_bool mask); - void (*fill_rect) (hidGC gc_, Coord x1_, Coord y1_, Coord x2_, Coord y2_); - - - /* This is for the printer. If you call this for the GUI, xval and - yval are ignored, and a dialog pops up to lead you through the - calibration procedure. For the printer, if xval and yval are - zero, a calibration page is printed with instructions for - calibrating your printer. After calibrating, nonzero xval and - yval are passed according to the instructions. Metric is nonzero - if the user prefers metric units, else inches are used. */ - void (*calibrate) (double xval_, double yval_); - - - /* GUI layout functions. Not used or defined for print/export - HIDs. */ - - /* Temporary */ - int (*shift_is_pressed) (void); - int (*control_is_pressed) (void); - int (*mod1_is_pressed) (void); - void (*get_coords) (const char *msg_, Coord * x_, Coord * y_); - - /* Sets the crosshair, which may differ from the pointer depending - on grid and pad snap. Note that the HID is responsible for - hiding, showing, redrawing, etc. The core just tells it what - coordinates it's actually using. Note that this routine may - need to know what "pcb units" are so it can display them in mm - or mils accordingly. If cursor_action is set, the cursor or - screen may be adjusted so that the cursor and the crosshair are - at the same point on the screen. */ - void (*set_crosshair) (int x_, int y_, int cursor_action_); -#define HID_SC_DO_NOTHING 0 -#define HID_SC_WARP_POINTER 1 -#define HID_SC_PAN_VIEWPORT 2 - - /* Causes func to be called at some point in the future. Timers are - only good for *one* call; if you want it to repeat, add another - timer during the callback for the first. user_data can be - anything, it's just passed to func. Times are not guaranteed to - be accurate. */ - hidval(*add_timer) (void (*func) (hidval user_data_), unsigned long milliseconds_, hidval user_data_); - /* Use this to stop a timer that hasn't triggered yet. */ - void (*stop_timer) (hidval timer_); - - /* Causes func to be called when some condition occurs on the file - descriptor passed. Conditions include data for reading, writing, - hangup, and errors. user_data can be anything, it's just passed - to func. */ - hidval(*watch_file) (int fd_, unsigned int condition_, - void (*func_) (hidval watch_, int fd_, unsigned int condition_, hidval user_data_), - hidval user_data); - /* Use this to stop a file watch. */ - void (*unwatch_file) (hidval watch_); - - /* Causes func to be called in the mainloop prior to blocking */ - hidval(*add_block_hook) (void (*func_) (hidval data_), hidval data_); - /* Use this to stop a mainloop block hook. */ - void (*stop_block_hook) (hidval block_hook_); - - /* Various dialogs */ - - /* Log a message to the log window. */ - void (*log) (const char *fmt_, ...); - void (*logv) (enum pcb_message_level, const char *fmt_, va_list args_); - - /* A generic yes/no dialog. Returns zero if the cancel button is - pressed, one for the ok button. If you specify alternate labels - for ..., they are used instead of the default OK/Cancel ones, and - the return value is the index of the label chosen. You MUST pass - NULL as the last parameter to this. */ - int (*confirm_dialog) (const char *msg_, ...); - - /* A close confirmation dialog for unsaved pages, for example, with - options "Close without saving", "Cancel" and "Save". Returns zero - if the close is cancelled, or one if it should proceed. The HID - is responsible for any "Save" action the user may wish before - confirming the close. - */ - int (*close_confirm_dialog) (); -#define HID_CLOSE_CONFIRM_CANCEL 0 -#define HID_CLOSE_CONFIRM_OK 1 - - /* Just prints text. */ - void (*report_dialog) (const char *title_, const char *msg_); - - /* Prompts the user to enter a string, returns the string. If - default_string isn't NULL, the form is pre-filled with this - value. "msg" is like "Enter value:". */ - char *(*prompt_for) (const char *msg_, const char *default_string_); - - /* Prompts the user for a filename or directory name. For GUI - HID's this would mean a file select dialog box. The 'flags' - argument is the bitwise OR of the following values. */ -#define HID_FILESELECT_READ 0x01 - - /* The function calling hid->fileselect will deal with the case - where the selected file already exists. If not given, then the - gui will prompt with an "overwrite?" prompt. Only used when - writing. - */ -#define HID_FILESELECT_MAY_NOT_EXIST 0x02 - - /* The call is supposed to return a file template (for gerber - output for example) instead of an actual file. Only used when - writing. - */ -#define HID_FILESELECT_IS_TEMPLATE 0x04 - - /* title may be used as a dialog box title. Ignored if NULL. - * - * descr is a longer help string. Ignored if NULL. - * - * default_file is the default file name. Ignored if NULL. - * - * default_ext is the default file extension, like ".pdf". - * Ignored if NULL. - * - * history_tag may be used by the GUI to keep track of file - * history. Examples would be "board", "vendor", "renumber", - * etc. If NULL, no specific history is kept. - * - * flags are the bitwise or of the HID_FILESELECT defines above - */ - - char *(*fileselect) (const char *title_, const char *descr_, - const char *default_file_, const char *default_ext_, const char *history_tag_, int flags_); - - /* A generic dialog to ask for a set of attributes. If n_attrs is - zero, attrs(.name) must be NULL terminated. Returns non-zero if - an error occurred (usually, this means the user cancelled the - dialog or something). title is the title of the dialog box - descr (if not NULL) can be a longer description of what the - attributes are used for. The HID may choose to ignore it or it - may use it for a tooltip or text in a dialog box, or a help - string. - */ - int (*attribute_dialog) (HID_Attribute * attrs_, - int n_attrs_, HID_Attr_Val * results_, const char *title_, const char *descr_); - - /* This causes a second window to display, which only shows the - selected item. The expose callback is called twice; once to size - the extents of the item, and once to draw it. To pass magic - values, pass the address of a variable created for this - purpose. */ - void (*show_item) (void *item_); - - /* Something to alert the user. */ - void (*beep) (void); - - /* Used by optimizers and autorouter to show progress to the user. - Pass all zeros to flush display and remove any dialogs. - Returns nonzero if the user wishes to cancel the operation. */ - int (*progress) (int so_far_, int total_, const char *message_); - - HID_DRC_GUI *drc_gui; - - void (*edit_attributes) (const char *owner, AttributeListType * attrlist_); - - /* Debug drawing support. These APIs must be implemented (non NULL), - * but they do not have to be functional. request_debug_draw can - * return NULL to indicate debug drawing is not permitted. - * - * Debug drawing is not guaranteed to be re-entrant. - * The caller must not nest requests for debug drawing. - */ - - /* Request permission for debug drawing - * - * Returns a HID pointer which should be used rather than the global - * gui-> for making drawing calls. If the return value is NULL, then - * permission has been denied, and the drawing must not continue. - */ - HID *(*request_debug_draw) (void); - - /* Flush pending drawing to the screen - * - * May be implemented as a NOOP if the GUI has chosen to send the - * debug drawing directly to the screen. - */ - void (*flush_debug_draw) (void); - - /* When finished, the user must inform the GUI to clean up resources - * - * Any remaining rendering will be flushed to the screen. - */ - void (*finish_debug_draw) (void); - - /* Notification to the GUI around saving the PCB file. - * - * Called with a false parameter before the save, called again - * with pcb_true after the save. - * - * Allows GUIs which watch for file-changes on disk to ignore - * our deliberate changes. - */ - void (*notify_save_pcb) (const char *filename, pcb_bool done); - - /* Notification to the GUI that the PCB file has been renamed. */ - void (*notify_filename_changed) (void); - - /* Create a new menu and/or submenus - * menu_path is a / separated path to the new menu (parents are silently created). - * The last non-NULL item is the new menu item. - * action, mnemonic, accel and tip affect the new menu item. - * Cookie is strdup()'d into the lihata tree and can be used later to search - * and remove menu items that are no longer needed. - * If action is NULL, the menu may get submenus. - */ - void (*create_menu) (const char *menu_path, const char *action, const char *mnemonic, const char *accel, const char *tip, const char *cookie); - - /* Remove a menu recursively */ - int (*remove_menu) (const char *menu_path); - - /* Optional: print usage string (if accepts command line arguments) - Subtopic: - NULL print generic help - string print summary for the topic in string - Return 0 on success. - */ - int (*usage)(const char *subtopic); - - - /*** PROPEDIT (optional) ****/ - /* Optional: start a propedit session: a series of propedit calls will follow - Return 0 on success; non-zero aborts the session. - */ - int (*propedit_start)(void *pe, int num_props, const char *(*query)(void *pe, const char *cmd, const char *key, const char *val, int idx)); - - /* Optional: end a propedit session: all data has been sent, no more; this call - should present and run the user dialog and should return only when the - propedit section can be closed. */ - void (*propedit_end)(void *pe); - - /* Optional: register a new property - Returns a prop context passed with each value - */ - void *(*propedit_add_prop)(void *pe, const char *propname, int is_mutable, int num_vals); - - /* Optional: register a new value for a property */ - void (*propedit_add_value)(void *pe, const char *propname, void *propctx, const char *value, int repeat_cnt); - - /* Optional: register statistical info for a property */ - void (*propedit_add_stat)(void *pe, const char *propname, void *propctx, const char *most_common, const char *min, const char *max, const char *avg); -}; - -/* This function (in the common code) will be called whenever the GUI - needs to redraw the screen, print the board, or export a layer. If - item is not NULL, only draw the given item. Item is only non-NULL - if the HID was created via show_item. - - Each time func is called, it should do the following: - - * allocate any colors needed, via get_color. - - * cycle through the layers, calling set_layer for each layer to be - drawn, and only drawing elements (all or specified) of desired - layers. - - Do *not* assume that the hid that is passed is the GUI hid. This - callback is also used for printing and exporting. */ -struct BoxType; -void hid_expose_callback(HID * hid_, struct BoxType *region_, void *item_); - -/* This is initially set to a "no-gui" gui, and later reset by - main. hid_expose_callback also temporarily set it for drawing. */ -extern HID *gui; - -/* When not NULL, auto-start the next gui after the current one quits */ -extern HID *next_gui; - -/* This is either NULL or points to the current HID that is being called to - do the exporting. The gui HIDs set and unset this var.*/ -extern HID *exporter; - -/* This is either NULL or points to the current HID_Action that is being - called. The action launcher sets and unsets this variable. */ -extern const HID_Action *current_action; - -/* The GUI may set this to be approximately the PCB size of a pixel, - to allow for near-misses in selection and changes in drawing items - smaller than a screen pixel. */ -extern int pixel_slop; - -/* Init and uninit the whole action framework */ -void hid_actions_init(void); -void hid_actions_uninit(void); - -#endif Index: 1.1.4/src/netlist_act.c =================================================================== --- 1.1.4/src/netlist_act.c (revision 10776) +++ 1.1.4/src/netlist_act.c (nonexistent) @@ -1,371 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* generic netlist operations - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "action_helper.h" -#include "data.h" -#include "error.h" -#include "plug_io.h" -#include "find.h" -#include "mymem.h" -#include "rats.h" -#include "create.h" -#include "rats_patch.h" -#include "hid_actions.h" -#include "compat_misc.h" -#include "netlist.h" - -static int pcb_netlist_swap() -{ - char *pins[3] = { NULL, NULL, NULL }; - int next = 0, n; - int ret = -1; - LibraryMenuTypePtr nets[2]; - - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, pin)) { - int le, lp; - - if (next > 2) { - Message(PCB_MSG_DEFAULT, "Exactly two pins should be selected for swap (more than 2 selected at the moment)\n"); - goto quit; - } - - le = strlen(element->Name[1].TextString); - lp = strlen(pin->Number); - pins[next] = malloc(le + lp + 2); - sprintf(pins[next], "%s-%s", element->Name[1].TextString, pin->Number); - next++; - } - } - END_LOOP; - } - END_LOOP; - - if (next < 2) { - Message(PCB_MSG_DEFAULT, "Exactly two pins should be selected for swap (less than 2 selected at the moment)\n"); - goto quit; - } - - - nets[0] = pcb_netlist_find_net4pinname(PCB, pins[0]); - nets[1] = pcb_netlist_find_net4pinname(PCB, pins[1]); - if ((nets[0] == NULL) || (nets[1] == NULL)) { - Message(PCB_MSG_DEFAULT, "That pin is not on a net.\n"); - goto quit; - } - if (nets[0] == nets[1]) { - Message(PCB_MSG_DEFAULT, "Those two pins are on the same net, can't swap them.\n"); - goto quit; - } - - - rats_patch_append_optimize(PCB, RATP_DEL_CONN, pins[0], nets[0]->Name + 2, NULL); - rats_patch_append_optimize(PCB, RATP_DEL_CONN, pins[1], nets[1]->Name + 2, NULL); - rats_patch_append_optimize(PCB, RATP_ADD_CONN, pins[0], nets[1]->Name + 2, NULL); - rats_patch_append_optimize(PCB, RATP_ADD_CONN, pins[1], nets[0]->Name + 2, NULL); - - /* TODO: not very efficient to regenerate the whole list... */ - rats_patch_make_edited(PCB); - ret = 0; - -quit:; - for (n = 0; n < 3; n++) - if (pins[n] != NULL) - free(pins[n]); - return ret; -} - - -/* The primary purpose of this action is to rebuild a netlist from a - script, in conjunction with the clear action above. */ -static int pcb_netlist_add(int patch, const char *netname, const char *pinname) -{ - int ni, pi; - LibraryType *netlist = patch ? &PCB->NetlistLib[NETLIST_EDITED] : &PCB->NetlistLib[NETLIST_INPUT]; - LibraryMenuType *net = NULL; - LibraryEntryType *pin = NULL; - - for (ni = 0; ni < netlist->MenuN; ni++) { - if (strcmp(netlist->Menu[ni].Name + 2, netname) == 0) { - net = &(netlist->Menu[ni]); - break; - } - } - - - if (net == NULL) { - if (!patch) { - net = CreateNewNet(netlist, (char *) netname, NULL); - net->Name = pcb_strdup_printf(" %s", netname); - net->flag = 1; - PCB->netlist_needs_update=1; - } - else { - abort(); /* applying this to net patch is not supported until 1.2.0 */ - } - } - - for (pi = 0; pi < net->EntryN; pi++) { - if (strcmp(net->Entry[pi].ListEntry, pinname) == 0) { - pin = &(net->Entry[pi]); - break; - } - } - - - if (pin == NULL) { - if (!patch) { - LibraryEntryType *entry = GetLibraryEntryMemory(net); - entry->ListEntry = pcb_strdup_printf("%s", pinname); - entry->ListEntry_dontfree = 0; - PCB->netlist_needs_update=1; - } - else { - abort(); /* applying this to net patch is not supported until 1.2.0 */ - } - } - - pcb_netlist_changed(0); - return 0; -} - -static const char netlist_syntax[] = - "Net(find|select|rats|norats|clear[,net[,pin]])\n" "Net(freeze|thaw|forcethaw)\n" "Net(swap)\n" "Net(add,net,pin)"; - -static const char netlist_help[] = "Perform various actions on netlists."; - -/* %start-doc actions Netlist - -Each of these actions apply to a specified set of nets. @var{net} and -@var{pin} are patterns which match one or more nets or pins; these -patterns may be full names or regular expressions. If an exact match -is found, it is the only match; if no exact match is found, -@emph{then} the pattern is tried as a regular expression. - -If neither @var{net} nor @var{pin} are specified, all nets apply. If -@var{net} is specified but not @var{pin}, all nets matching @var{net} -apply. If both are specified, nets which match @var{net} and contain -a pin matching @var{pin} apply. - -@table @code - -@item find -Nets which apply are marked @emph{found} and are drawn in the -@code{connected-color} color. - -@item select -Nets which apply are selected. - -@item rats -Nets which apply are marked as available for the rats nest. - -@item norats -Nets which apply are marked as not available for the rats nest. - -@item clear -Clears the netlist. - -@item add -Add the given pin to the given netlist, creating either if needed. - -@item swap -Swap the connections one end of two selected rats and pins. - -@item sort -Called after a list of add's, this sorts the netlist. - -@item freeze -@itemx thaw -@itemx forcethaw -Temporarily prevents changes to the netlist from being reflected in -the GUI. For example, if you need to make multiple changes, you -freeze the netlist, make the changes, then thaw it. Note that -freeze/thaw requests may nest, with the netlist being fully thawed -only when all pending freezes are thawed. You can bypass the nesting -by using forcethaw, which resets the freeze count and immediately -updates the GUI. - -@end table - -%end-doc */ - -typedef void (*NFunc) (LibraryMenuType *, LibraryEntryType *); - -static int ActionNetlist(int argc, const char **argv, Coord x, Coord y) -{ - NFunc func; - int i, j; - LibraryMenuType *net; - LibraryEntryType *pin; - int net_found = 0; - int pin_found = 0; - int use_re = 0; - re_sei_t *regex; - - if (!PCB) - return 1; - if (argc == 0) { - Message(PCB_MSG_DEFAULT, netlist_syntax); - return 1; - } - if (strcasecmp(argv[0], "find") == 0) - func = pcb_netlist_find; - else if (strcasecmp(argv[0], "select") == 0) - func = pcb_netlist_select; - else if (strcasecmp(argv[0], "rats") == 0) - func = pcb_netlist_rats; - else if (strcasecmp(argv[0], "norats") == 0) - func = pcb_netlist_norats; - else if (strcasecmp(argv[0], "clear") == 0) { - func = pcb_netlist_clear; - if (argc == 1) { - pcb_netlist_clear(NULL, NULL); - return 0; - } - } - else if (strcasecmp(argv[0], "style") == 0) - func = (NFunc) pcb_netlist_style; - else if (strcasecmp(argv[0], "swap") == 0) - return pcb_netlist_swap(); - else if (strcasecmp(argv[0], "add") == 0) { - /* Add is different, because the net/pin won't already exist. */ - return pcb_netlist_add(0, ACTION_ARG(1), ACTION_ARG(2)); - } - else if (strcasecmp(argv[0], "sort") == 0) { - pcb_sort_netlist(); - rats_patch_make_edited(PCB); - return 0; - } - else if (strcasecmp(argv[0], "freeze") == 0) { - PCB->netlist_frozen++; - return 0; - } - else if (strcasecmp(argv[0], "thaw") == 0) { - if (PCB->netlist_frozen > 0) { - PCB->netlist_frozen--; - if (PCB->netlist_needs_update) - pcb_netlist_changed(0); - } - return 0; - } - else if (strcasecmp(argv[0], "forcethaw") == 0) { - PCB->netlist_frozen = 0; - if (PCB->netlist_needs_update) - pcb_netlist_changed(0); - return 0; - } - else { - Message(PCB_MSG_DEFAULT, netlist_syntax); - return 1; - } - - if (argc > 1) { - use_re = 1; - for (i = 0; i < PCB->NetlistLib[NETLIST_INPUT].MenuN; i++) { - net = PCB->NetlistLib[NETLIST_INPUT].Menu + i; - if (strcasecmp(argv[1], net->Name + 2) == 0) - use_re = 0; - } - if (use_re) { - regex = re_sei_comp(argv[1]); - if (re_sei_errno(regex) != 0) { - Message(PCB_MSG_DEFAULT, _("regexp error: %s\n"), re_error_str(re_sei_errno(regex))); - re_sei_free(regex); - return (1); - } - } - } - - -/* This code is for changing the netlist style */ - for (i = PCB->NetlistLib[NETLIST_INPUT].MenuN - 1; i >= 0; i--) { - net = PCB->NetlistLib[NETLIST_INPUT].Menu + i; - if (argc > 1) { - if (use_re) { - if (re_sei_exec(regex, net->Name + 2) == 0) - continue; - } - else { - if (strcasecmp(net->Name + 2, argv[1])) - continue; - } - } - net_found = 1; - - pin = 0; - if (func == (NFunc) pcb_netlist_style) { - pcb_netlist_style(net, ACTION_ARG(2)); - } - else if (argc > 2) { - int l = strlen(argv[2]); - for (j = net->EntryN - 1; j >= 0; j--) - if (strcasecmp(net->Entry[j].ListEntry, argv[2]) == 0 - || (strncasecmp(net->Entry[j].ListEntry, argv[2], l) == 0 && net->Entry[j].ListEntry[l] == '-')) { - pin = net->Entry + j; - pin_found = 1; - func(net, pin); - } - } - else - func(net, 0); - } - - if (argc > 2 && !pin_found) { - gui->log("Net %s has no pin %s\n", argv[1], argv[2]); - return 1; - } - else if (!net_found) { - gui->log("No net named %s\n", argv[1]); - } - - if (use_re) - re_sei_free(regex); - - return 0; -} - -HID_Action netlist_action_list[] = { - {"net", 0, ActionNetlist, - netlist_help, netlist_syntax} - , - {"netlist", 0, ActionNetlist, - netlist_help, netlist_syntax} -}; - -REGISTER_ACTIONS(netlist_action_list, NULL) Index: 1.1.4/src/search.h =================================================================== --- 1.1.4/src/search.h (revision 10776) +++ 1.1.4/src/search.h (nonexistent) @@ -1,162 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for search routines */ - -#ifndef PCB_SEARCH_H -#define PCB_SEARCH_H - -#include "global.h" -#include "misc_util.h" - -int lines_intersect(Coord ax1, Coord ay1, Coord ax2, Coord ay2, Coord bx1, Coord by1, Coord bx2, Coord by2); - -#define SLOP 5 -/* --------------------------------------------------------------------------- - * some useful macros - */ -/* --------------------------------------------------------------------------- - * some define to check for 'type' in box - */ -#define POINT_IN_BOX(x,y,b) \ - (IS_BOX_NEGATIVE(b) ? \ - ((x) >= (b)->X2 && (x) <= (b)->X1 && (y) >= (b)->Y2 && (y) <= (b)->Y1) \ - : \ - ((x) >= (b)->X1 && (x) <= (b)->X2 && (y) >= (b)->Y1 && (y) <= (b)->Y2)) - -#define VIA_OR_PIN_IN_BOX(v,b) \ - POINT_IN_BOX((v)->X,(v)->Y,(b)) - -#define LINE_IN_BOX(l,b) \ - (POINT_IN_BOX((l)->Point1.X,(l)->Point1.Y,(b)) && \ - POINT_IN_BOX((l)->Point2.X,(l)->Point2.Y,(b))) - -#define PAD_IN_BOX(p,b) LINE_IN_BOX((LineTypePtr)(p),(b)) - -#define BOX_IN_BOX(b1,b) \ - ((b1)->X1 >= (b)->X1 && (b1)->X2 <= (b)->X2 && \ - ((b1)->Y1 >= (b)->Y1 && (b1)->Y2 <= (b)->Y2)) - -#define TEXT_IN_BOX(t,b) \ - (BOX_IN_BOX(&((t)->BoundingBox), (b))) - -#define POLYGON_IN_BOX(p,b) \ - (BOX_IN_BOX(&((p)->BoundingBox), (b))) - -#define ELEMENT_IN_BOX(e,b) \ - (BOX_IN_BOX(&((e)->BoundingBox), (b))) - -#define ARC_IN_BOX(a,b) \ - (BOX_IN_BOX(&((a)->BoundingBox), (b))) - -/* == the same but accept if any part of the object touches the box == */ -#define POINT_IN_CIRCLE(x, y, cx, cy, r) \ - (Distance2(x, y, cx, cy) <= (double)(r) * (double)(r)) - -#define CIRCLE_TOUCHES_BOX(cx, cy, r, b) \ - ( POINT_IN_BOX((cx)-(r),(cy),(b)) || POINT_IN_BOX((cx)+(r),(cy),(b)) || POINT_IN_BOX((cx),(cy)-(r),(b)) || POINT_IN_BOX((cx),(cy)+(r),(b)) \ - || POINT_IN_CIRCLE((b)->X1, (b)->Y1, (cx), (cy), (r)) || POINT_IN_CIRCLE((b)->X2, (b)->Y1, (cx), (cy), (r)) || POINT_IN_CIRCLE((b)->X1, (b)->Y2, (cx), (cy), (r)) || POINT_IN_CIRCLE((b)->X2, (b)->Y2, (cx), (cy), (r))) - -#define VIA_OR_PIN_TOUCHES_BOX(v,b) \ - CIRCLE_TOUCHES_BOX((v)->X,(v)->Y,((v)->Thickness + (v)->DrillingHole/2),(b)) - -#define LINE_TOUCHES_BOX(l,b) \ - ( lines_intersect((l)->Point1.X,(l)->Point1.Y,(l)->Point2.X,(l)->Point2.Y, (b)->X1, (b)->Y1, (b)->X2, (b)->Y1) \ - || lines_intersect((l)->Point1.X,(l)->Point1.Y,(l)->Point2.X,(l)->Point2.Y, (b)->X1, (b)->Y1, (b)->X1, (b)->Y2) \ - || lines_intersect((l)->Point1.X,(l)->Point1.Y,(l)->Point2.X,(l)->Point2.Y, (b)->X2, (b)->Y2, (b)->X1, (b)->Y2) \ - || lines_intersect((l)->Point1.X,(l)->Point1.Y,(l)->Point2.X,(l)->Point2.Y, (b)->X2, (b)->Y2, (b)->X2, (b)->Y1) \ - || LINE_IN_BOX((l), (b))) - -#define PAD_TOUCHES_BOX(p,b) LINE_TOUCHES_BOX((LineTypePtr)(p),(b)) - -/* a corner of either box is within the other, or edges cross */ -#define BOX_TOUCHES_BOX(b1,b2) \ - ( POINT_IN_BOX((b1)->X1,(b1)->Y1,b2) || POINT_IN_BOX((b1)->X1,(b1)->Y2,b2) || POINT_IN_BOX((b1)->X2,(b1)->Y1,b2) || POINT_IN_BOX((b1)->X2,(b1)->Y2,b2) \ - || POINT_IN_BOX((b2)->X1,(b2)->Y1,b1) || POINT_IN_BOX((b2)->X1,(b2)->Y2,b1) || POINT_IN_BOX((b2)->X2,(b2)->Y1,b1) || POINT_IN_BOX((b2)->X2,(b2)->Y2,b1) \ - || lines_intersect((b1)->X1,(b1)->Y1, (b1)->X2,(b1)->Y1, (b2)->X1,(b2)->Y1, (b2)->X1,(b2)->Y2) \ - || lines_intersect((b2)->X1,(b2)->Y1, (b2)->X2,(b2)->Y1, (b1)->X1,(b1)->Y1, (b1)->X1,(b1)->Y2)) - -#define TEXT_TOUCHES_BOX(t,b) \ - (BOX_TOUCHES_BOX(&((t)->BoundingBox), (b))) - -#define POLYGON_TOUCHES_BOX(p,b) \ - (BOX_TOUCHES_BOX(&((p)->BoundingBox), (b))) - -#define ELEMENT_TOUCHES_BOX(e,b) \ - (BOX_TOUCHES_BOX(&((e)->BoundingBox), (b))) - -#define ARC_TOUCHES_BOX(a,b) \ - (BOX_TOUCHES_BOX(&((a)->BoundingBox), (b))) - - -/* == the combination of *_IN_* and *_TOUCHES_*: use IN for positive boxes == */ -#define IS_BOX_NEGATIVE(b) (((b)->X2 < (b)->X1) || ((b)->Y2 < (b)->Y1)) - -#define BOX_NEAR_BOX(b1,b) \ - (IS_BOX_NEGATIVE(b) ? BOX_TOUCHES_BOX(b1,b) : BOX_IN_BOX(b1,b)) - -#define VIA_OR_PIN_NEAR_BOX(v,b) \ - (IS_BOX_NEGATIVE(b) ? VIA_OR_PIN_TOUCHES_BOX(v,b) : VIA_OR_PIN_IN_BOX(v,b)) - -#define LINE_NEAR_BOX(l,b) \ - (IS_BOX_NEGATIVE(b) ? LINE_TOUCHES_BOX(l,b) : LINE_IN_BOX(l,b)) - -#define PAD_NEAR_BOX(p,b) \ - (IS_BOX_NEGATIVE(b) ? PAD_TOUCHES_BOX(p,b) : PAD_IN_BOX(p,b)) - -#define TEXT_NEAR_BOX(t,b) \ - (IS_BOX_NEGATIVE(b) ? TEXT_TOUCHES_BOX(t,b) : TEXT_IN_BOX(t,b)) - -#define POLYGON_NEAR_BOX(p,b) \ - (IS_BOX_NEGATIVE(b) ? POLYGON_TOUCHES_BOX(p,b) : POLYGON_IN_BOX(p,b)) - -#define ELEMENT_NEAR_BOX(e,b) \ - (IS_BOX_NEGATIVE(b) ? ELEMENT_TOUCHES_BOX(e,b) : ELEMENT_IN_BOX(e,b)) - -#define ARC_NEAR_BOX(a,b) \ - (IS_BOX_NEGATIVE(b) ? ARC_TOUCHES_BOX(a,b) : ARC_IN_BOX(a,b)) - - - -/* --------------------------------------------------------------------------- - * prototypes - */ -pcb_bool IsPointOnLine(Coord, Coord, Coord, LineTypePtr); -pcb_bool IsPointOnPin(Coord, Coord, Coord, PinTypePtr); -pcb_bool IsPointOnArc(Coord, Coord, Coord, ArcTypePtr); -pcb_bool IsPointOnLineEnd(Coord, Coord, RatTypePtr); -pcb_bool IsLineInRectangle(Coord, Coord, Coord, Coord, LineTypePtr); -pcb_bool IsLineInQuadrangle(PointType p[4], LineTypePtr Line); -pcb_bool IsArcInRectangle(Coord, Coord, Coord, Coord, ArcTypePtr); -pcb_bool IsPointInPad(Coord, Coord, Coord, PadTypePtr); -pcb_bool IsPointInBox(Coord, Coord, BoxTypePtr, Coord); -int SearchObjectByLocation(unsigned, void **, void **, void **, Coord, Coord, Coord); -int SearchScreen(Coord, Coord, int, void **, void **, void **); -int SearchScreenGridSlop(Coord, Coord, int, void **, void **, void **); -int SearchObjectByID(DataTypePtr, void **, void **, void **, int, int); -ElementTypePtr SearchElementByName(DataTypePtr, const char *); - -#endif Index: 1.1.4/src/layer.c =================================================================== --- 1.1.4/src/layer.c (revision 10776) +++ 1.1.4/src/layer.c (nonexistent) @@ -1,831 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2004,2006 Thomas Nau - * Copyright (C) 2016 Tibor 'Igor2' Palinkas (pcb-rnd extensions) - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -#include "global.h" -#include "data.h" -#include "conf_core.h" -#include "layer.h" -#include "hid_actions.h" -#include "compat_misc.h" - -/* - * Used by SaveStackAndVisibility() and - * RestoreStackAndVisibility() - */ - -static struct { - pcb_bool ElementOn, InvisibleObjectsOn, PinOn, ViaOn, RatOn; - int LayerStack[MAX_LAYER]; - pcb_bool LayerOn[MAX_LAYER]; - int cnt; -} SavedStack; - - -pcb_bool IsLayerEmpty(LayerTypePtr layer) -{ - return LAYER_IS_EMPTY(layer); -} - -pcb_bool IsLayerNumEmpty(int num) -{ - return IsLayerEmpty(PCB->Data->Layer + num); -} - -pcb_bool IsLayerGroupEmpty(int num) -{ - int i; - for (i = 0; i < PCB->LayerGroups.Number[num]; i++) - if (!IsLayerNumEmpty(PCB->LayerGroups.Entries[num][i])) - return pcb_false; - return pcb_true; -} - -/* ---------------------------------------------------------------------- - * parses the group definition string which is a colon separated list of - * comma separated layer numbers (1,2,b:4,6,8,t) - */ -int ParseGroupString(const char *s, LayerGroupTypePtr LayerGroup, int LayerN) -{ - int group, member, layer; - pcb_bool c_set = pcb_false, /* flags for the two special layers to */ - s_set = pcb_false; /* provide a default setting for old formats */ - int groupnum[MAX_LAYER + 2]; - - /* clear struct */ - memset(LayerGroup, 0, sizeof(LayerGroupType)); - - /* Clear assignments */ - for (layer = 0; layer < MAX_LAYER + 2; layer++) - groupnum[layer] = -1; - - /* loop over all groups */ - for (group = 0; s && *s && group < LayerN; group++) { - while (*s && isspace((int) *s)) - s++; - - /* loop over all group members */ - for (member = 0; *s; s++) { - /* ignore white spaces and get layernumber */ - while (*s && isspace((int) *s)) - s++; - switch (*s) { - case 'c': - case 'C': - case 't': - case 'T': - layer = LayerN + COMPONENT_LAYER; - c_set = pcb_true; - break; - - case 's': - case 'S': - case 'b': - case 'B': - layer = LayerN + SOLDER_LAYER; - s_set = pcb_true; - break; - - default: - if (!isdigit((int) *s)) - goto error; - layer = atoi(s) - 1; - break; - } - if (layer > LayerN + MAX(SOLDER_LAYER, COMPONENT_LAYER) || member >= LayerN + 1) - goto error; - groupnum[layer] = group; - LayerGroup->Entries[group][member++] = layer; - while (*++s && isdigit((int) *s)); - - /* ignore white spaces and check for separator */ - while (*s && isspace((int) *s)) - s++; - if (!*s || *s == ':') - break; - if (*s != ',') - goto error; - } - LayerGroup->Number[group] = member; - if (*s == ':') - s++; - } - if (!s_set) - LayerGroup->Entries[SOLDER_LAYER][LayerGroup->Number[SOLDER_LAYER]++] = LayerN + SOLDER_LAYER; - if (!c_set) - LayerGroup->Entries[COMPONENT_LAYER][LayerGroup->Number[COMPONENT_LAYER]++] = LayerN + COMPONENT_LAYER; - - for (layer = 0; layer < LayerN && group < LayerN; layer++) - if (groupnum[layer] == -1) { - LayerGroup->Entries[group][0] = layer; - LayerGroup->Number[group] = 1; - group++; - } - return (0); - - /* reset structure on error */ -error: - memset(LayerGroup, 0, sizeof(LayerGroupType)); - return (1); -} - - - -/* --------------------------------------------------------------------------- - * returns the layer number for the passed pointer - */ -int GetLayerNumber(DataTypePtr Data, LayerTypePtr Layer) -{ - int i; - - for (i = 0; i < MAX_LAYER + 2; i++) - if (Layer == &Data->Layer[i]) - break; - return (i); -} - -/* --------------------------------------------------------------------------- - * move layer (number is passed in) to top of layerstack - */ -static void PushOnTopOfLayerStack(int NewTop) -{ - int i; - - /* ignore silk layers */ - if (NewTop < max_copper_layer) { - /* first find position of passed one */ - for (i = 0; i < max_copper_layer; i++) - if (LayerStack[i] == NewTop) - break; - - /* bring this element to the top of the stack */ - for (; i; i--) - LayerStack[i] = LayerStack[i - 1]; - LayerStack[0] = NewTop; - } -} - - -/* ---------------------------------------------------------------------- - * changes the visibility of all layers in a group - * returns the number of changed layers - */ -int ChangeGroupVisibility(int Layer, pcb_bool On, pcb_bool ChangeStackOrder) -{ - int group, i, changed = 1; /* at least the current layer changes */ - - /* Warning: these special case values must agree with what gui-top-window.c - | thinks the are. - */ - - if (conf_core.rc.verbose) - printf("ChangeGroupVisibility(Layer=%d, On=%d, ChangeStackOrder=%d)\n", Layer, On, ChangeStackOrder); - - /* decrement 'i' to keep stack in order of layergroup */ - if ((group = GetGroupOfLayer(Layer)) < max_group) - for (i = PCB->LayerGroups.Number[group]; i;) { - int layer = PCB->LayerGroups.Entries[group][--i]; - - /* don't count the passed member of the group */ - if (layer != Layer && layer < max_copper_layer) { - PCB->Data->Layer[layer].On = On; - - /* push layer on top of stack if switched on */ - if (On && ChangeStackOrder) - PushOnTopOfLayerStack(layer); - changed++; - } - } - - /* change at least the passed layer */ - PCB->Data->Layer[Layer].On = On; - if (On && ChangeStackOrder) - PushOnTopOfLayerStack(Layer); - - /* update control panel and exit */ - hid_action("LayersChanged"); - return (changed); -} - -/* ---------------------------------------------------------------------- - * Given a string description of a layer stack, adjust the layer stack - * to correspond. -*/ - -void LayerStringToLayerStack(const char *layer_string) -{ - static int listed_layers = 0; - int l = strlen(layer_string); - char **args; - int i, argn, lno; - int prev_sep = 1; - char *s; - - s = pcb_strdup(layer_string); - args = (char **) malloc(l * sizeof(char *)); - argn = 0; - - for (i = 0; i < l; i++) { - switch (s[i]) { - case ' ': - case '\t': - case ',': - case ';': - case ':': - prev_sep = 1; - s[i] = '\0'; - break; - default: - if (prev_sep) - args[argn++] = s + i; - prev_sep = 0; - break; - } - } - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - LayerStack[i] = i; - PCB->Data->Layer[i].On = pcb_false; - } - PCB->ElementOn = pcb_false; - PCB->InvisibleObjectsOn = pcb_false; - PCB->PinOn = pcb_false; - PCB->ViaOn = pcb_false; - PCB->RatOn = pcb_false; - - conf_set_editor(show_mask, 0); - conf_set_editor(show_solder_side, 0); - - for (i = argn - 1; i >= 0; i--) { - if (strcasecmp(args[i], "rats") == 0) - PCB->RatOn = pcb_true; - else if (strcasecmp(args[i], "invisible") == 0) - PCB->InvisibleObjectsOn = pcb_true; - else if (strcasecmp(args[i], "pins") == 0) - PCB->PinOn = pcb_true; - else if (strcasecmp(args[i], "vias") == 0) - PCB->ViaOn = pcb_true; - else if (strcasecmp(args[i], "elements") == 0 || strcasecmp(args[i], "silk") == 0) - PCB->ElementOn = pcb_true; - else if (strcasecmp(args[i], "mask") == 0) - conf_set_editor(show_mask, 1); - else if (strcasecmp(args[i], "solderside") == 0) - conf_set_editor(show_solder_side, 1); - else if (isdigit((int) args[i][0])) { - lno = atoi(args[i]); - ChangeGroupVisibility(lno, pcb_true, pcb_true); - } - else { - int found = 0; - for (lno = 0; lno < max_copper_layer; lno++) - if (strcasecmp(args[i], PCB->Data->Layer[lno].Name) == 0) { - ChangeGroupVisibility(lno, pcb_true, pcb_true); - found = 1; - break; - } - if (!found) { - fprintf(stderr, "Warning: layer \"%s\" not known\n", args[i]); - if (!listed_layers) { - fprintf(stderr, "Named layers in this board are:\n"); - listed_layers = 1; - for (lno = 0; lno < max_copper_layer; lno++) - fprintf(stderr, "\t%s\n", PCB->Data->Layer[lno].Name); - fprintf(stderr, "Also: component, solder, rats, invisible, pins, vias, elements or silk, mask, solderside.\n"); - } - } - } - } -} - -/* ---------------------------------------------------------------------- - * lookup the group to which a layer belongs to - * returns max_group if no group is found, or is - * passed Layer is equal to max_copper_layer - */ -int GetGroupOfLayer(int Layer) -{ - int group, i; - - if (Layer == max_copper_layer) - return max_group; - for (group = 0; group < max_group; group++) - for (i = 0; i < PCB->LayerGroups.Number[group]; i++) - if (PCB->LayerGroups.Entries[group][i] == Layer) - return (group); - return max_group; -} - - -/* --------------------------------------------------------------------------- - * returns the layergroup number for the passed pointer - */ -int GetLayerGroupNumberByPointer(LayerTypePtr Layer) -{ - return (GetLayerGroupNumberByNumber(GetLayerNumber(PCB->Data, Layer))); -} - -/* --------------------------------------------------------------------------- - * returns the layergroup number for the passed layernumber - */ -int GetLayerGroupNumberByNumber(pcb_cardinal_t Layer) -{ - int group, entry; - - for (group = 0; group < max_group; group++) - for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) - if (PCB->LayerGroups.Entries[group][entry] == Layer) - return (group); - - /* since every layer belongs to a group it is safe to return - * the value without boundary checking - */ - return (group); -} - - -/* --------------------------------------------------------------------------- - * resets the layerstack setting - */ -void ResetStackAndVisibility(void) -{ - int comp_group; - pcb_cardinal_t i; - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - LayerStack[i] = i; - PCB->Data->Layer[i].On = pcb_true; - } - PCB->ElementOn = pcb_true; - PCB->InvisibleObjectsOn = pcb_true; - PCB->PinOn = pcb_true; - PCB->ViaOn = pcb_true; - PCB->RatOn = pcb_true; - - /* Bring the component group to the front and make it active. */ - comp_group = GetLayerGroupNumberByNumber(component_silk_layer); - ChangeGroupVisibility(PCB->LayerGroups.Entries[comp_group][0], 1, 1); -} - -/* --------------------------------------------------------------------------- - * saves the layerstack setting - */ -void SaveStackAndVisibility(void) -{ - pcb_cardinal_t i; - static pcb_bool run = pcb_false; - - if (run == pcb_false) { - SavedStack.cnt = 0; - run = pcb_true; - } - - if (SavedStack.cnt != 0) { - fprintf(stderr, - "SaveStackAndVisibility() layerstack was already saved and not" "yet restored. cnt = %d\n", SavedStack.cnt); - } - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - SavedStack.LayerStack[i] = LayerStack[i]; - SavedStack.LayerOn[i] = PCB->Data->Layer[i].On; - } - SavedStack.ElementOn = PCB->ElementOn; - SavedStack.InvisibleObjectsOn = PCB->InvisibleObjectsOn; - SavedStack.PinOn = PCB->PinOn; - SavedStack.ViaOn = PCB->ViaOn; - SavedStack.RatOn = PCB->RatOn; - SavedStack.cnt++; -} - -/* --------------------------------------------------------------------------- - * restores the layerstack setting - */ -void RestoreStackAndVisibility(void) -{ - pcb_cardinal_t i; - - if (SavedStack.cnt == 0) { - fprintf(stderr, "RestoreStackAndVisibility() layerstack has not" " been saved. cnt = %d\n", SavedStack.cnt); - return; - } - else if (SavedStack.cnt != 1) { - fprintf(stderr, "RestoreStackAndVisibility() layerstack save count is" " wrong. cnt = %d\n", SavedStack.cnt); - } - - for (i = 0; i < max_copper_layer + 2; i++) { - if (i < max_copper_layer) - LayerStack[i] = SavedStack.LayerStack[i]; - PCB->Data->Layer[i].On = SavedStack.LayerOn[i]; - } - PCB->ElementOn = SavedStack.ElementOn; - PCB->InvisibleObjectsOn = SavedStack.InvisibleObjectsOn; - PCB->PinOn = SavedStack.PinOn; - PCB->ViaOn = SavedStack.ViaOn; - PCB->RatOn = SavedStack.RatOn; - - SavedStack.cnt--; -} - -/*********************************************************************** - * Layer Group Functions - */ - -int MoveLayerToGroup(int layer, int group) -{ - int prev, i, j; - - if (layer < 0 || layer > max_copper_layer + 1) - return -1; - prev = GetLayerGroupNumberByNumber(layer); - if ((layer == solder_silk_layer && group == GetLayerGroupNumberByNumber(component_silk_layer)) - || (layer == component_silk_layer && group == GetLayerGroupNumberByNumber(solder_silk_layer)) - || (group < 0 || group >= max_group) || (prev == group)) - return prev; - - /* Remove layer from prev group */ - for (j = i = 0; i < PCB->LayerGroups.Number[prev]; i++) - if (PCB->LayerGroups.Entries[prev][i] != layer) - PCB->LayerGroups.Entries[prev][j++] = PCB->LayerGroups.Entries[prev][i]; - PCB->LayerGroups.Number[prev]--; - - /* Add layer to new group. */ - i = PCB->LayerGroups.Number[group]++; - PCB->LayerGroups.Entries[group][i] = layer; - - return group; -} - -char *LayerGroupsToString(LayerGroupTypePtr lg) -{ -#if MAX_LAYER < 9998 - /* Allows for layer numbers 0..9999 */ - static char buf[(MAX_LAYER + 2) * 5 + 1]; -#endif - char *cp = buf; - char sep = 0; - int group, entry; - for (group = 0; group < max_group; group++) - if (PCB->LayerGroups.Number[group]) { - if (sep) - *cp++ = ':'; - sep = 1; - for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) { - int layer = PCB->LayerGroups.Entries[group][entry]; - if (layer == component_silk_layer) { - *cp++ = 'c'; - } - else if (layer == solder_silk_layer) { - *cp++ = 's'; - } - else { - sprintf(cp, "%d", layer + 1); - while (*++cp); - } - if (entry != PCB->LayerGroups.Number[group] - 1) - *cp++ = ','; - } - } - *cp++ = 0; - return buf; -} - -unsigned int pcb_layer_flags(int layer_idx) -{ - unsigned int res = 0; - - if (layer_idx == solder_silk_layer) - return PCB_LYT_SILK | PCB_LYT_BOTTOM; - - if (layer_idx == component_silk_layer) - return PCB_LYT_SILK | PCB_LYT_TOP; - - if (layer_idx > max_copper_layer+2) - return 0; - - if (layer_idx < max_copper_layer) { - if (!LAYER_IS_OUTLINE(layer_idx)) { - /* check whether it's top, bottom or internal */ - int group, entry; - for (group = 0; group < max_group; group++) { - if (PCB->LayerGroups.Number[group]) { - unsigned int my_group = 0, gf = 0; - for (entry = 0; entry < PCB->LayerGroups.Number[group]; entry++) { - int layer = PCB->LayerGroups.Entries[group][entry]; - if (layer == layer_idx) - my_group = 1; - if (layer == component_silk_layer) - gf |= PCB_LYT_TOP; - else if (layer == solder_silk_layer) - gf |= PCB_LYT_BOTTOM; - } - if (my_group) { - res |= gf; - if (gf == 0) - res |= PCB_LYT_INTERN; - break; /* stop searching groups */ - } - } - } - res |= PCB_LYT_COPPER; - } - else - res |= PCB_LYT_OUTLINE; - } - - return res; -} - -#define APPEND(n) \ - do { \ - if (res != NULL) { \ - if (used < res_len) { \ - res[used] = n; \ - used++; \ - } \ - } \ - else \ - used++; \ - } while(0) - -int pcb_layer_list(pcb_layer_type_t mask, int *res, int res_len) -{ - int n, used = 0; - - for (n = 0; n < MAX_LAYER + 2; n++) { - if ((pcb_layer_flags(n) & mask) == mask) - APPEND(n); - } - return used; -} - -int pcb_layer_group_list(pcb_layer_type_t mask, int *res, int res_len) -{ - int group, layeri, used = 0; - for (group = 0; group < max_group; group++) { - for (layeri = 0; layeri < PCB->LayerGroups.Number[group]; layeri++) { - int layer = PCB->LayerGroups.Entries[group][layeri]; - if ((pcb_layer_flags(layer) & mask) == mask) { - APPEND(group); - goto added; /* do not add a group twice */ - } - } - added:; - } - return used; -} - -int pcb_layer_by_name(const char *name) -{ - int n; - for (n = 0; n < max_copper_layer + 2; n++) - if (strcmp(PCB->Data->Layer[n].Name, name) == 0) - return n; - return -1; -} - -int pcb_layer_lookup_group(int layer_id) -{ - int group, layeri; - for (group = 0; group < max_group; group++) { - for (layeri = 0; layeri < PCB->LayerGroups.Number[group]; layeri++) { - int layer = PCB->LayerGroups.Entries[group][layeri]; - if (layer == layer_id) - return group; - } - } - return -1; -} - -void pcb_layer_add_in_group(int layer_id, int group_id) -{ - int glen = PCB->LayerGroups.Number[group_id]; - PCB->LayerGroups.Entries[group_id][glen] = layer_id; - PCB->LayerGroups.Number[group_id]++; -} - - -void pcb_layers_reset() -{ - int n; - - /* reset layer names */ - for(n = 2; n < MAX_LAYER; n++) { - if (PCB->Data->Layer[n].Name != NULL) - free((char *)PCB->Data->Layer[n].Name); - PCB->Data->Layer[n].Name = pcb_strdup(""); - } - - /* reset layer groups */ - for(n = 0; n < MAX_LAYER; n++) - PCB->LayerGroups.Number[n] = 0; - - /* set up one copper layer on top and one on bottom */ - PCB->Data->LayerN = 2; - PCB->LayerGroups.Number[SOLDER_LAYER] = 1; - PCB->LayerGroups.Number[COMPONENT_LAYER] = 1; - PCB->LayerGroups.Entries[SOLDER_LAYER][0] = SOLDER_LAYER; - PCB->LayerGroups.Entries[COMPONENT_LAYER][0] = COMPONENT_LAYER; - - /* Name top and bottom layers */ - if (PCB->Data->Layer[COMPONENT_LAYER].Name != NULL) - free((char *)PCB->Data->Layer[COMPONENT_LAYER].Name); - PCB->Data->Layer[COMPONENT_LAYER].Name = pcb_strdup(""); - - if (PCB->Data->Layer[SOLDER_LAYER].Name != NULL) - free((char *)PCB->Data->Layer[SOLDER_LAYER].Name); - PCB->Data->Layer[SOLDER_LAYER].Name = pcb_strdup(""); -} - -int pcb_layer_create(pcb_layer_type_t type, pcb_bool reuse_layer, pcb_bool_t reuse_group, const char *lname) -{ - int id, grp = -1, found; - unsigned int loc = type & PCB_LYT_ANYWHERE; - unsigned int role = type & PCB_LYT_ANYTHING; - - /* look for an existing layer if reuse is enabled */ - if (reuse_layer) { - switch(role) { - case PCB_LYT_MASK: - case PCB_LYT_PASTE: - case PCB_LYT_SILK: - return -1; /* do not create silk, paste or mask layers, they are special */ - - case PCB_LYT_COPPER: - switch(loc) { - case PCB_LYT_TOP: return COMPONENT_LAYER; - case PCB_LYT_BOTTOM: return SOLDER_LAYER; - case PCB_LYT_INTERN: - for(grp = 2; grp < MAX_LAYER; grp++) { - if (PCB->LayerGroups.Number[grp] > 0) { - id = PCB->LayerGroups.Entries[grp][0]; - if (strcmp(PCB->Data->Layer[id].Name, "outline") != 0) - return id; - } - } - return -1; - } - break; - - case PCB_LYT_OUTLINE: - for(grp = 2; grp < MAX_LAYER; grp++) { - if (PCB->LayerGroups.Number[grp] > 0) { - id = PCB->LayerGroups.Entries[grp][0]; - if (strcmp(PCB->Data->Layer[id].Name, "outline") == 0) - return id; - } - } - return -1; - } - return -1; - } - - /* Need to create a new layers, look for an existing group first */ - if (role == PCB_LYT_OUTLINE) { - lname = "outline"; - - for(id = 0; id < PCB->Data->LayerN; id++) - if (strcmp(PCB->Data->Layer[id].Name, lname) == 0) - return id; /* force reuse outline */ - - /* not found: create a new layer for outline */ - grp = -1; - reuse_group = pcb_false; - } - - /* there's only one top and bottom group, always reuse them */ - if (role == PCB_LYT_COPPER) { - switch(loc) { - case PCB_LYT_TOP: grp = COMPONENT_LAYER; reuse_group = 0; break; - case PCB_LYT_BOTTOM: grp = SOLDER_LAYER; reuse_group = 0; break; - } - } - - if (reuse_group) { /* can't use group find here, it depends on existing silks! */ - switch(role) { - case PCB_LYT_MASK: - case PCB_LYT_PASTE: - case PCB_LYT_SILK: - return -1; /* do not create silk, paste or mask layers, they are special */ - - case PCB_LYT_COPPER: - switch(loc) { - case PCB_LYT_TOP: - case PCB_LYT_BOTTOM: - abort(); /* can't get here */ - case PCB_LYT_INTERN: - /* find the first internal layer */ - for(found = 0, grp = 2; grp < MAX_LAYER; grp++) { - if (PCB->LayerGroups.Number[grp] > 0) { - id = PCB->LayerGroups.Entries[grp][0]; - if (strcmp(PCB->Data->Layer[id].Name, "outline") != 0) { - found = 1; - break; - } - } - } - if (!found) - return -1; - id = -1; - } - break; - case PCB_LYT_OUTLINE: - abort(); /* can't get here */ - } - } - - if (grp < 0) { - /* Also need to create a group */ - for(grp = 0; grp < MAX_LAYER; grp++) - if (PCB->LayerGroups.Number[grp] == 0) - break; - if (grp >= MAX_LAYER) - return -2; - } - - id = PCB->Data->LayerN++; - - if (lname != NULL) { - if (PCB->Data->Layer[id].Name != NULL) - free((char *)PCB->Data->Layer[id].Name); - PCB->Data->Layer[id].Name = pcb_strdup(lname); - } - - /* add layer to group */ - PCB->LayerGroups.Entries[grp][PCB->LayerGroups.Number[grp]] = id; - PCB->LayerGroups.Number[grp]++; - - return id; -} - -/* Temporary hack: silk layers have to be added as the last entry in the top and bottom layer groups, if they are not already in */ -static void hack_in_silks() -{ - int sl, cl, found, n; - - sl = SOLDER_LAYER + PCB->Data->LayerN; - for(found = 0, n = 0; n < PCB->LayerGroups.Number[SOLDER_LAYER]; n++) - if (PCB->LayerGroups.Entries[SOLDER_LAYER][n] == sl) - found = 1; - - if (!found) { - PCB->LayerGroups.Entries[SOLDER_LAYER][PCB->LayerGroups.Number[SOLDER_LAYER]] = sl; - PCB->LayerGroups.Number[SOLDER_LAYER]++; - if (PCB->Data->Layer[sl].Name != NULL) - free((char *)PCB->Data->Layer[sl].Name); - PCB->Data->Layer[sl].Name = pcb_strdup("silk"); - } - - - cl = COMPONENT_LAYER + PCB->Data->LayerN; - for(found = 0, n = 0; n < PCB->LayerGroups.Number[COMPONENT_LAYER]; n++) - if (PCB->LayerGroups.Entries[COMPONENT_LAYER][n] == cl) - found = 1; - - if (!found) { - PCB->LayerGroups.Entries[COMPONENT_LAYER][PCB->LayerGroups.Number[COMPONENT_LAYER]] = cl; - PCB->LayerGroups.Number[COMPONENT_LAYER]++; - if (PCB->Data->Layer[cl].Name != NULL) - free((char *)PCB->Data->Layer[cl].Name); - PCB->Data->Layer[cl].Name = pcb_strdup("silk"); - } -} - -int pcb_layer_rename(int layer, const char *lname) -{ - if (PCB->Data->Layer[layer].Name != NULL) - free((char *)PCB->Data->Layer[layer].Name); - PCB->Data->Layer[layer].Name = pcb_strdup(lname); - return 0; -} - -void pcb_layers_finalize() -{ - hack_in_silks(); -} - -#undef APPEND Index: 1.1.4/src/global_element.h =================================================================== --- 1.1.4/src/global_element.h (revision 10776) +++ 1.1.4/src/global_element.h (nonexistent) @@ -1,17 +0,0 @@ -struct element_st { - ANYOBJECTFIELDS; - TextType Name[MAX_ELEMENTNAMES]; /* the elements names; */ - /* description text */ - /* name on PCB second, */ - /* value third */ - /* see macro.h */ - Coord MarkX, MarkY; /* position mark */ - pinlist_t Pin; - padlist_t Pad; - linelist_t Line; - arclist_t Arc; - BoxType VBox; - gdl_elem_t link; -}; - -#include "list_element.h" Index: 1.1.4/src/layer.h =================================================================== --- 1.1.4/src/layer.h (revision 10776) +++ 1.1.4/src/layer.h (nonexistent) @@ -1,157 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2006 Thomas Nau - * Copyright (C) 2016 Tibor 'Igor2' Palinkas (pcb-rnd extensions) - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for layer manipulation */ - -/* Returns pcb_true if the given layer is empty (there are no objects on the layer) */ -pcb_bool IsLayerEmpty(LayerTypePtr); -pcb_bool IsLayerNumEmpty(int); - -/* Returns pcb_true if all layers in a group are empty */ -pcb_bool IsLayerGroupEmpty(int); - - -/************ OLD API - new code should not use these **************/ - -int ParseGroupString(const char *, LayerGroupTypePtr, int /* LayerN */ ); - -int GetLayerNumber(DataTypePtr, LayerTypePtr); -int GetLayerGroupNumberByPointer(LayerTypePtr); -int GetLayerGroupNumberByNumber(pcb_cardinal_t); -int GetGroupOfLayer(int); -int ChangeGroupVisibility(int, pcb_bool, pcb_bool); -void LayerStringToLayerStack(const char *); - -/* Layer Group Functions */ - -/* Returns group actually moved to (i.e. either group or previous) */ -int MoveLayerToGroup(int layer, int group); - -/* Returns pointer to private buffer */ -char *LayerGroupsToString(LayerGroupTypePtr); - -#define LAYER_ON_STACK(n) (&PCB->Data->Layer[LayerStack[(n)]]) -#define LAYER_PTR(n) (&PCB->Data->Layer[(n)]) -#define CURRENT (PCB->SilkActive ? &PCB->Data->Layer[ \ - (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer)] \ - : LAYER_ON_STACK(0)) -#define INDEXOFCURRENT (PCB->SilkActive ? \ - (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer) \ - : LayerStack[0]) -#define SILKLAYER Layer[ \ - (conf_core.editor.show_solder_side ? solder_silk_layer : component_silk_layer)] -#define BACKSILKLAYER Layer[ \ - (conf_core.editor.show_solder_side ? component_silk_layer : solder_silk_layer)] - -#define TEST_SILK_LAYER(layer) (GetLayerNumber (PCB->Data, layer) >= max_copper_layer) - -/* These decode the set_layer index. */ -#define SL_TYPE(x) ((x) < 0 ? (x) & 0x0f0 : 0) -#define SL_SIDE(x) ((x) & 0x00f) -#define SL_MYSIDE(x) ((((x) & SL_BOTTOM_SIDE)!=0) == (SWAP_IDENT != 0)) - -#define SL_0_SIDE 0x0000 -#define SL_TOP_SIDE 0x0001 -#define SL_BOTTOM_SIDE 0x0002 -#define SL_SILK 0x0010 -#define SL_MASK 0x0020 -#define SL_PDRILL 0x0030 -#define SL_UDRILL 0x0040 -#define SL_PASTE 0x0050 -#define SL_INVISIBLE 0x0060 -#define SL_FAB 0x0070 -#define SL_ASSY 0x0080 -#define SL_RATS 0x0090 -/* Callers should use this. */ -#define SL(type,side) (~0xfff | SL_##type | SL_##side##_SIDE) - - -#define LAYER_IS_OUTLINE(idx) (strcmp(PCB->Data->Layer[idx].Name, "route") == 0 || strcmp(PCB->Data->Layer[idx].Name, "outline") == 0) - -/************ NEW API - new code should use these **************/ - -/* Layer type bitfield */ -typedef enum { - /* Stack-up (vertical position): */ - PCB_LYT_TOP = 0x0001, /* layer is on the top side of the board */ - PCB_LYT_BOTTOM = 0x0002, /* layer is on the bottom side of the board */ - PCB_LYT_INTERN = 0x0004, /* layer is internal */ - PCB_LYT_ANYWHERE = 0x00FF, /* MASK: layer is anywhere on the stack */ - - /* What the layer consists of */ - PCB_LYT_COPPER = 0x0100, /* copper objects */ - PCB_LYT_SILK = 0x0200, /* silk objects */ - PCB_LYT_MASK = 0x0400, /* solder mask */ - PCB_LYT_PASTE = 0x0800, /* paste */ - PCB_LYT_OUTLINE = 0x1000, /* outline (contour of the board) */ - PCB_LYT_ANYTHING = 0xFF00 /* MASK */ -} pcb_layer_type_t; - - -/* returns a bitfield of pcb_layer_type_t; returns 0 if layer_idx is invalid. */ -unsigned int pcb_layer_flags(int layer_idx); - -/* List layer IDs that matches mask - write the first res_len items in res, - if res is not NULL. Returns: - - the total number of layers matching the query, if res is NULL - - the number of layers copied into res if res is not NULL -*/ -int pcb_layer_list(pcb_layer_type_t mask, int *res, int res_len); - -/* Same as pcb_layer_list but lists layer groups. A group is matching - if any layer in that group matches mask. */ -int pcb_layer_group_list(pcb_layer_type_t mask, int *res, int res_len); - -/* Looks up which group a layer is in. Returns group ID. */ -int pcb_layer_lookup_group(int layer_id); - -/* Put a layer in a group (the layer should not be in any other group) */ -void pcb_layer_add_in_group(int layer_id, int group_id); - -/* Slow linear search for a layer by name */ -int pcb_layer_by_name(const char *name); - -/**** layer creation (for load/import code) ****/ - -/* Reset layers to the bare minimum (double sided board) */ -void pcb_layers_reset(); - -/* If reuse_layer is false, create a new layer of the given type; if - reuse_group is true, try to put the new layer on an existing group. - If reuse_layer is 1, first try to return an already exiting layer that - matches type and create a new one if that fails. - Upon creating a new layer, name it according to lname if it is not NULL - Returns a layer index (or -1 on error) - Do not create: mask, silk, paste; they are special layers. - */ -int pcb_layer_create(pcb_layer_type_t type, pcb_bool reuse_layer, pcb_bool_t reuse_group, const char *lname); - -/* Rename an existing layer */ -int pcb_layer_rename(int layer, const char *lname); - -/* Needs to be called once at the end, when all layers has been added */ -void pcb_layers_finalize(); Index: 1.1.4/src/pcb_bool.h =================================================================== --- 1.1.4/src/pcb_bool.h (revision 10776) +++ 1.1.4/src/pcb_bool.h (nonexistent) @@ -1,31 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_BOOL_H -#define PCB_BOOL_H -/* Because stdbool is not c89 */ -typedef int pcb_bool; -typedef enum pcb_bool_e { - pcb_false = 0, - pcb_true = 1 -} pcb_bool_t; -#endif Index: 1.1.4/src/set.c =================================================================== --- 1.1.4/src/set.c (revision 10776) +++ 1.1.4/src/set.c (nonexistent) @@ -1,278 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - - -/* routines to update widgets and global settings - * (except output window and dialogs) - */ - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include - -#include "action_helper.h" -#include "buffer.h" -#include "crosshair.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "find.h" -#include "set.h" -#include "undo.h" -#include "hid_actions.h" -#include "route_style.h" - -static int mode_position = 0; -static int mode_stack[MAX_MODESTACK_DEPTH]; - -/* --------------------------------------------------------------------------- - * sets cursor grid with respect to grid offset values - */ -void SetGrid(Coord Grid, pcb_bool align) -{ - if (Grid >= 1 && Grid <= MAX_GRID) { - if (align) { - PCB->GridOffsetX = Crosshair.X % Grid; - PCB->GridOffsetY = Crosshair.Y % Grid; - } - PCB->Grid = Grid; - conf_set_design("editor/grid", "%$mS", Grid); - if (conf_core.editor.draw_grid) - Redraw(); - } -} - -/* --------------------------------------------------------------------------- - * sets a new line thickness - */ -void SetLineSize(Coord Size) -{ - if (Size >= MIN_LINESIZE && Size <= MAX_LINESIZE) { - conf_set_design("design/line_thickness", "%$mS", Size); - if (conf_core.editor.auto_drc) - FitCrosshairIntoGrid(Crosshair.X, Crosshair.Y); - } -} - -/* --------------------------------------------------------------------------- - * sets a new via thickness - */ -void SetViaSize(Coord Size, pcb_bool Force) -{ - if (Force || (Size <= MAX_PINORVIASIZE && Size >= MIN_PINORVIASIZE && Size >= conf_core.design.via_drilling_hole + MIN_PINORVIACOPPER)) { - conf_set_design("design/via_thickness", "%$mS", Size); - } -} - -/* --------------------------------------------------------------------------- - * sets a new via drilling hole - */ -void SetViaDrillingHole(Coord Size, pcb_bool Force) -{ - if (Force || (Size <= MAX_PINORVIASIZE && Size >= MIN_PINORVIAHOLE && Size <= conf_core.design.via_thickness - MIN_PINORVIACOPPER)) { - conf_set_design("design/via_drilling_hole", "%$mS", Size); - } -} - -/* --------------------------------------------------------------------------- - * sets a clearance width - */ -void SetClearanceWidth(Coord Width) -{ - if (Width <= MAX_LINESIZE) { - conf_set_design("design/clearance", "%$mS", Width); - } -} - -/* --------------------------------------------------------------------------- - * sets a text scaling - */ -void SetTextScale(int Scale) -{ - if (Scale <= MAX_TEXTSCALE && Scale >= MIN_TEXTSCALE) { - conf_set_design("design/text_scale", "%d", Scale); - } -} - -/* --------------------------------------------------------------------------- - * sets or resets changed flag and redraws status - */ -void SetChangedFlag(pcb_bool New) -{ - if (PCB->Changed != New) { - PCB->Changed = New; - - } -} - -/* --------------------------------------------------------------------------- - * sets the crosshair range to the current buffer extents - */ -void SetCrosshairRangeToBuffer(void) -{ - if (conf_core.editor.mode == PCB_MODE_PASTE_BUFFER) { - SetBufferBoundingBox(PASTEBUFFER); - SetCrosshairRange(PASTEBUFFER->X - PASTEBUFFER->BoundingBox.X1, - PASTEBUFFER->Y - PASTEBUFFER->BoundingBox.Y1, - PCB->MaxWidth - - (PASTEBUFFER->BoundingBox.X2 - PASTEBUFFER->X), - PCB->MaxHeight - (PASTEBUFFER->BoundingBox.Y2 - PASTEBUFFER->Y)); - } -} - -/* --------------------------------------------------------------------------- - * sets a new buffer number - */ -void SetBufferNumber(int Number) -{ - if (Number >= 0 && Number < MAX_BUFFER) { - conf_set_design("editor/buffer_number", "%d", Number); - - /* do an update on the crosshair range */ - SetCrosshairRangeToBuffer(); - } -} - -/* --------------------------------------------------------------------------- - */ - -void SaveMode(void) -{ - mode_stack[mode_position] = conf_core.editor.mode; - if (mode_position < MAX_MODESTACK_DEPTH - 1) - mode_position++; -} - -void RestoreMode(void) -{ - if (mode_position == 0) { - Message(PCB_MSG_DEFAULT, "hace: underflow of restore mode\n"); - return; - } - SetMode(mode_stack[--mode_position]); -} - - -/* --------------------------------------------------------------------------- - * set a new mode and update X cursor - */ -void SetMode(int Mode) -{ - char sMode[32]; - static pcb_bool recursing = pcb_false; - /* protect the cursor while changing the mode - * perform some additional stuff depending on the new mode - * reset 'state' of attached objects - */ - if (recursing) - return; - recursing = pcb_true; - notify_crosshair_change(pcb_false); - addedLines = 0; - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - Crosshair.AttachedObject.State = STATE_FIRST; - Crosshair.AttachedPolygon.PointN = 0; - if (PCB->RatDraw) { - if (Mode == PCB_MODE_ARC || Mode == PCB_MODE_RECTANGLE || - Mode == PCB_MODE_VIA || Mode == PCB_MODE_POLYGON || - Mode == PCB_MODE_POLYGON_HOLE || Mode == PCB_MODE_TEXT || Mode == PCB_MODE_INSERT_POINT || Mode == PCB_MODE_THERMAL) { - Message(PCB_MSG_DEFAULT, _("That mode is NOT allowed when drawing ratlines!\n")); - Mode = PCB_MODE_NO; - } - } - if (conf_core.editor.mode == PCB_MODE_LINE && Mode == PCB_MODE_ARC && Crosshair.AttachedLine.State != STATE_FIRST) { - Crosshair.AttachedLine.State = STATE_FIRST; - Crosshair.AttachedBox.State = STATE_SECOND; - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Crosshair.AttachedLine.Point1.X; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Crosshair.AttachedLine.Point1.Y; - AdjustAttachedObjects(); - } - else if (conf_core.editor.mode == PCB_MODE_ARC && Mode == PCB_MODE_LINE && Crosshair.AttachedBox.State != STATE_FIRST) { - Crosshair.AttachedBox.State = STATE_FIRST; - Crosshair.AttachedLine.State = STATE_SECOND; - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.AttachedBox.Point1.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.AttachedBox.Point1.Y; - sprintf(sMode, "%d", Mode); - conf_set(CFR_DESIGN, "editor/mode", -1, sMode, POL_OVERWRITE); - AdjustAttachedObjects(); - } - else { - if (conf_core.editor.mode == PCB_MODE_ARC || conf_core.editor.mode == PCB_MODE_LINE) - SetLocalRef(0, 0, pcb_false); - Crosshair.AttachedBox.State = STATE_FIRST; - Crosshair.AttachedLine.State = STATE_FIRST; - if (Mode == PCB_MODE_LINE && conf_core.editor.auto_drc) { - if (ResetConnections(pcb_true)) { - IncrementUndoSerialNumber(); - Draw(); - } - } - } - - sprintf(sMode, "%d", Mode); - conf_set(CFR_DESIGN, "editor/mode", -1, sMode, POL_OVERWRITE); - - if (Mode == PCB_MODE_PASTE_BUFFER) - /* do an update on the crosshair range */ - SetCrosshairRangeToBuffer(); - else - SetCrosshairRange(0, 0, PCB->MaxWidth, PCB->MaxHeight); - - recursing = pcb_false; - - /* force a crosshair grid update because the valid range - * may have changed - */ - MoveCrosshairRelative(0, 0); - notify_crosshair_change(pcb_true); -} - -void SetLocalRef(Coord X, Coord Y, pcb_bool Showing) -{ - static MarkType old; - static int count = 0; - - if (Showing) { - notify_mark_change(pcb_false); - if (count == 0) - old = Marked; - Marked.X = X; - Marked.Y = Y; - Marked.status = pcb_true; - count++; - notify_mark_change(pcb_true); - } - else if (count > 0) { - notify_mark_change(pcb_false); - count = 0; - Marked = old; - notify_mark_change(pcb_true); - } -} Index: 1.1.4/src/undo_act.c =================================================================== --- 1.1.4/src/undo_act.c (revision 10776) +++ 1.1.4/src/undo_act.c (nonexistent) @@ -1,299 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" - -#include "data.h" -#include "action_helper.h" -#include "error.h" -#include "funchash_core.h" - -#include "crosshair.h" -#include "undo.h" -#include "polygon.h" -#include "set.h" -#include "search.h" -#include "draw.h" -#include "misc.h" -#include "layer.h" - -/* --------------------------------------------------------------------------- */ - -static const char atomic_syntax[] = "Atomic(Save|Restore|Close|Block)"; - -static const char atomic_help[] = "Save or restore the undo serial number."; - -/* %start-doc actions Atomic - -This action allows making multiple-action bindings into an atomic -operation that will be undone by a single Undo command. For example, -to optimize rat lines, you'd delete the rats and re-add them. To -group these into a single undo, you'd want the deletions and the -additions to have the same undo serial number. So, you @code{Save}, -delete the rats, @code{Restore}, add the rats - using the same serial -number as the deletes, then @code{Block}, which checks to see if the -deletions or additions actually did anything. If not, the serial -number is set to the saved number, as there's nothing to undo. If -something did happen, the serial number is incremented so that these -actions are counted as a single undo step. - -@table @code - -@item Save -Saves the undo serial number. - -@item Restore -Returns it to the last saved number. - -@item Close -Sets it to 1 greater than the last save. - -@item Block -Does a Restore if there was nothing to undo, else does a Close. - -@end table - -%end-doc */ - -int ActionAtomic(int argc, const char **argv, Coord x, Coord y) -{ - if (argc != 1) - AFAIL(atomic); - - switch (funchash_get(argv[0], NULL)) { - case F_Save: - SaveUndoSerialNumber(); - break; - case F_Restore: - RestoreUndoSerialNumber(); - break; - case F_Close: - RestoreUndoSerialNumber(); - IncrementUndoSerialNumber(); - break; - case F_Block: - RestoreUndoSerialNumber(); - if (Bumped) - IncrementUndoSerialNumber(); - break; - } - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char undo_syntax[] = "Undo()\n" "Undo(ClearList)"; - -static const char undo_help[] = "Undo recent changes."; - -/* %start-doc actions Undo - -The unlimited undo feature of @code{Pcb} allows you to recover from -most operations that materially affect you work. Calling -@code{Undo()} without any parameter recovers from the last (non-undo) -operation. @code{ClearList} is used to release the allocated -memory. @code{ClearList} is called whenever a new layout is started or -loaded. See also @code{Redo} and @code{Atomic}. - -Note that undo groups operations by serial number; changes with the -same serial number will be undone (or redone) as a group. See -@code{Atomic}. - -%end-doc */ - -int ActionUndo(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - if (!function || !*function) { - /* don't allow undo in the middle of an operation */ - if (conf_core.editor.mode != PCB_MODE_POLYGON_HOLE && Crosshair.AttachedObject.State != STATE_FIRST) - return 1; - if (Crosshair.AttachedBox.State != STATE_FIRST && conf_core.editor.mode != PCB_MODE_ARC) - return 1; - /* undo the last operation */ - - notify_crosshair_change(pcb_false); - if ((conf_core.editor.mode == PCB_MODE_POLYGON || conf_core.editor.mode == PCB_MODE_POLYGON_HOLE) && Crosshair.AttachedPolygon.PointN) { - GoToPreviousPoint(); - notify_crosshair_change(pcb_true); - return 0; - } - /* move anchor point if undoing during line creation */ - if (conf_core.editor.mode == PCB_MODE_LINE) { - if (Crosshair.AttachedLine.State == STATE_SECOND) { - if (conf_core.editor.auto_drc) - Undo(pcb_true); /* undo the connection find */ - Crosshair.AttachedLine.State = STATE_FIRST; - SetLocalRef(0, 0, pcb_false); - notify_crosshair_change(pcb_true); - return 0; - } - if (Crosshair.AttachedLine.State == STATE_THIRD) { - int type; - void *ptr1, *ptr3, *ptrtmp; - LineTypePtr ptr2; - /* this search is guaranteed to succeed */ - SearchObjectByLocation(PCB_TYPE_LINE | PCB_TYPE_RATLINE, &ptr1, - &ptrtmp, &ptr3, Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, 0); - ptr2 = (LineTypePtr) ptrtmp; - - /* save both ends of line */ - Crosshair.AttachedLine.Point2.X = ptr2->Point1.X; - Crosshair.AttachedLine.Point2.Y = ptr2->Point1.Y; - if ((type = Undo(pcb_true))) - SetChangedFlag(pcb_true); - /* check that the undo was of the right type */ - if ((type & UNDO_CREATE) == 0) { - /* wrong undo type, restore anchor points */ - Crosshair.AttachedLine.Point2.X = Crosshair.AttachedLine.Point1.X; - Crosshair.AttachedLine.Point2.Y = Crosshair.AttachedLine.Point1.Y; - notify_crosshair_change(pcb_true); - return 0; - } - /* move to new anchor */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; - /* check if an intermediate point was removed */ - if (type & UNDO_REMOVE) { - /* this search should find the restored line */ - SearchObjectByLocation(PCB_TYPE_LINE | PCB_TYPE_RATLINE, &ptr1, - &ptrtmp, &ptr3, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y, 0); - ptr2 = (LineTypePtr) ptrtmp; - if (conf_core.editor.auto_drc) { - /* undo loses PCB_FLAG_FOUND */ - SET_FLAG(PCB_FLAG_FOUND, ptr2); - DrawLine(CURRENT, ptr2); - } - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = ptr2->Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = ptr2->Point2.Y; - } - FitCrosshairIntoGrid(Crosshair.X, Crosshair.Y); - AdjustAttachedObjects(); - if (--addedLines == 0) { - Crosshair.AttachedLine.State = STATE_SECOND; - lastLayer = CURRENT; - } - else { - /* this search is guaranteed to succeed too */ - SearchObjectByLocation(PCB_TYPE_LINE | PCB_TYPE_RATLINE, &ptr1, - &ptrtmp, &ptr3, Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, 0); - ptr2 = (LineTypePtr) ptrtmp; - lastLayer = (LayerTypePtr) ptr1; - } - notify_crosshair_change(pcb_true); - return 0; - } - } - if (conf_core.editor.mode == PCB_MODE_ARC) { - if (Crosshair.AttachedBox.State == STATE_SECOND) { - Crosshair.AttachedBox.State = STATE_FIRST; - notify_crosshair_change(pcb_true); - return 0; - } - if (Crosshair.AttachedBox.State == STATE_THIRD) { - void *ptr1, *ptr2, *ptr3; - BoxTypePtr bx; - /* guaranteed to succeed */ - SearchObjectByLocation(PCB_TYPE_ARC, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point1.Y, 0); - bx = GetArcEnds((ArcTypePtr) ptr2); - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = bx->X1; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = bx->Y1; - AdjustAttachedObjects(); - if (--addedLines == 0) - Crosshair.AttachedBox.State = STATE_SECOND; - } - } - /* undo the last destructive operation */ - if (Undo(pcb_true)) - SetChangedFlag(pcb_true); - } - else if (function) { - switch (funchash_get(function, NULL)) { - /* clear 'undo objects' list */ - case F_ClearList: - ClearUndoList(pcb_false); - break; - } - } - notify_crosshair_change(pcb_true); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char redo_syntax[] = "Redo()"; - -static const char redo_help[] = "Redo recent \"undo\" operations."; - -/* %start-doc actions Redo - -This routine allows you to recover from the last undo command. You -might want to do this if you thought that undo was going to revert -something other than what it actually did (in case you are confused -about which operations are un-doable), or if you have been backing up -through a long undo list and over-shoot your stopping point. Any -change that is made since the undo in question will trim the redo -list. For example if you add ten lines, then undo three of them you -could use redo to put them back, but if you move a line on the board -before performing the redo, you will lose the ability to "redo" the -three "undone" lines. - -%end-doc */ - -int ActionRedo(int argc, const char **argv, Coord x, Coord y) -{ - if (((conf_core.editor.mode == PCB_MODE_POLYGON || - conf_core.editor.mode == PCB_MODE_POLYGON_HOLE) && Crosshair.AttachedPolygon.PointN) || Crosshair.AttachedLine.State == STATE_SECOND) - return 1; - notify_crosshair_change(pcb_false); - if (Redo(pcb_true)) { - SetChangedFlag(pcb_true); - if (conf_core.editor.mode == PCB_MODE_LINE && Crosshair.AttachedLine.State != STATE_FIRST) { - LineType *line = linelist_last(&CURRENT->Line); - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = line->Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = line->Point2.Y; - addedLines++; - } - } - notify_crosshair_change(pcb_true); - return 0; -} - - -HID_Action undo_action_list[] = { - {"Atomic", 0, ActionAtomic, - atomic_help, atomic_syntax} - , - {"Undo", 0, ActionUndo, - undo_help, undo_syntax} - , - {"Redo", 0, ActionRedo, - redo_help, redo_syntax} -}; - -REGISTER_ACTIONS(undo_action_list, NULL) Index: 1.1.4/src =================================================================== --- 1.1.4/src (revision 10776) +++ 1.1.4/src (nonexistent) Property changes on: 1.1.4/src ___________________________________________________________________ Deleted: svn:externals ## -1 +0,0 ## - Index: 1.1.4/src_plugins/lib_gensexpr/lib_gensexpr.c =================================================================== --- 1.1.4/src_plugins/lib_gensexpr/lib_gensexpr.c (revision 10776) +++ 1.1.4/src_plugins/lib_gensexpr/lib_gensexpr.c (nonexistent) @@ -1,7 +0,0 @@ -#include -#include "plugins.h" - -pcb_uninit_t hid_lib_gensexpr_init(void) -{ - return NULL; -} Index: 1.1.4/src_plugins/lib_gensexpr/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/lib_gensexpr/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/lib_gensexpr/Plug.tmpasm (nonexistent) @@ -1,12 +0,0 @@ -put /local/pcb/mod {lib_gensexpr} -put /local/pcb/mod/OBJS [@ - $(PLUGDIR)/lib_gensexpr/lib_gensexpr.o - $(SRC_3RD_DIR)/gensexpr/gsxl.o - $(SRC_3RD_DIR)/gensexpr/gsx_parse.o -@] - -switch /local/pcb/lib_gensexpr/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/lib_gensexpr/README =================================================================== --- 1.1.4/src_plugins/lib_gensexpr/README (revision 10776) +++ 1.1.4/src_plugins/lib_gensexpr/README (nonexistent) @@ -1,5 +0,0 @@ -S-expression parser lib - -#state: works -#default: disabled -#implements: (lib) Index: 1.1.4/src_plugins/lib_gensexpr/Makefile =================================================================== --- 1.1.4/src_plugins/lib_gensexpr/Makefile (revision 10776) +++ 1.1.4/src_plugins/lib_gensexpr/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && make mod_lib_gensexpr - -clean: - rm *.o *.so 2>/dev/null ; true - Index: 1.1.4/src_plugins/export_dxf/dxf.c =================================================================== --- 1.1.4/src_plugins/export_dxf/dxf.c (revision 10776) +++ 1.1.4/src_plugins/export_dxf/dxf.c (nonexistent) @@ -1,5978 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/*! - * \file dxf.c - * - * \author Copyright (C) 2007 .. 2011 by Bert Timmerman - * for DXF relevant code.\n - * - * \brief This file contains the DXF HID (Human Interface Device) exporter to - * generate a DXF file containing Xref's of components and a series of DXF - * files, one for every pcb layer. - * - *
    - * Drawing eXchange Format (DXF)\n - * DXF is a defacto industry standard for the exchange of drawing files - * between various Computer Aided Drafting programs.\n - * DXF is designed by Autodesk(TM).\n - * For more details see http://www.autodesk.com . - *
    - *

    Warning.

    \n - * Some notes about Coordinate systems:\n - *
      - *
    • PCB follows a "left handed" Cartesian Coordinate System.\n - * Positive X is right, positive Y is down.\n - * Angles are increasing counter clockwise (CCW) in degrees, with 0 degrees being left - * (negative X-axis) and 90 degrees being down (positive Y-axis).\n - *
    • AutoCAD DXF follows a "right handed" Cartesian Coordinate system.\n - * Positive X is right, positive Y is up.\n - * Angles are counter clockwise (CCW) in degrees, with 0 being right - * (positive X) and 90 being up (positive Y).\n - *
    • Autocad coordinates are either in mil (default) or in mm (see checkbox - * in the DXF HID dialog).\n - *
    • Lookup Wikipedia with keywords "Cartesian Coordinates" if you want more - * information on this subject.\n - *
    - * Filled polygons are drawn with a hatch entity.\n - * Elliptic arcs are drawn with an ellipse entity.\n - * Successful importing the generated dxf files with these entities - * requires AutoCAD version R14 or higher, or any other mechanical CAD - * program with the same level of compatibility with regard to the DXF - * format.\n - *
    - *

    - * Please send remarks, bugs, improvements, relevant opinions to - * bert.timmerman@xs4all.nl or to the geda-dev mailing list. \n - * Donations to speed up the development of the gEDA suite best go to - * www.gedaconsulting.com. \n - *

  • Have fun ;-) - * - *
    - *

    - *

    The DXF HID function treeview.

    \n - * The following function hierarchy, with the status of the functions in - * between [], exists: - *
      - *
    • dxf_get_export_options [stable] - *
    • dxf_do_export [stable] - *
        - *
      • dxf_get_export_options [stable] - *
      • dxf_export_xref_file [exp] - *
          - *
        • dxf_write_comment [stable] - *
        • dxf_write_header [stable] - *
            - *
          • dxf_write_header_metric_new [stable] - *
          • dxf_write_header_imperial_new [todo] - *
          - *
        • dxf_write_block_record [todo] - *
        • dxf_write_block [stable] - *
        • dxf_write_endsection [stable] - *
        • dxf_write_section [stable] - *
        • dxf_insert [stable] - *
        • dxf_write_eof [stable] - *
        - *
      • dxf_maybe_close_file [exp] - *
          - *
        • dxf_write_tail [todo] - *
        • dxf_write_tail_metric_new [todo] - *
        • dxf_write_tail_imperial_new [todo] - *
        • dxf_write_eof [stable] - *
        - *
      - *
    • dxf_parse_arguments [stable] - *
    • dxf_set_layer [exp] - *
        - *
      • dxf_maybe_close_file [stable] - *
      • dxf_write_header [stable] - *
          - *
        • dxf_write_header_metric_new [stable] - *
        • dxf_write_header_imperial_new [todo] - *
        - *
      • dxf_write_block_record [todo] - *
      • dxf_write_block [stable] - *
      • dxf_write_endsection [stable] - *
      • dxf_write_section [stable] - *
      - *
    • dxf_make_gc [stable] - *
    • dxf_destroy_gc [stable] - *
    • dxf_use_mask [stable] - *
    • dxf_set_color [stable] - *
    • dxf_set_line_cap [stable] - *
    • dxf_set_line_width [stable] - *
    • dxf_draw_line [exp] - *
        - *
      • dxf_write_polyline [exp] - *
      • dxf_write_vertex [stable] - *
      • dxf_write_endseq [stable] - *
      - *
    • dxf_draw_arc [exp] - *
        - *
      • dxf_write_ellipse [exp] - *
      - *
    • dxf_draw_rect [exp] - *
        - *
      • dxf_write_polyline [exp] - *
      • dxf_write_vertex [stable] - *
      • dxf_write_endseq [stable] - *
      - *
    • dxf_fill_circle [exp] - *
        - *
      • dxf_write_circle [exp] - *
      - *
    • dxf_fill_polygon [exp] - *
        - *
      • dxf_write_hatch [stable] - *
      • dxf_write_hatch_boundary_path_polyline [stable] - *
      • dxf_write_hatch_boundary_path_polyline_vertex [stable] - *
      - *
    • dxf_fill_rect [stable] - *
        - *
      • dxf_write_solid [stable] - *
      - *
    • dxf_calibrate [stable] - *
    • dxf_set_crosshair [stable] - *
    - *
    - * Notes:\n - * [todo] denotes a function not yet implemented.\n - * [exp] denotes a function not yet fully implemented.\n - * [stable] denotes a function fully implemented.\n - *
    - * \n\n - * Include files - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "macro.h" -#include "global.h" -#include "data.h" -#include "misc.h" -#include "error.h" -#include "draw.h" -#include "hid_draw_helpers.h" -#include "pcb-printf.h" -#include "compat_misc.h" -#include "layer.h" -#include "hid_attrib.h" -#include "hid_flags.h" -#include "hid_helper.h" -#include "hid.h" -#include "draw.h" -#include "hid_init.h" -#include "plugins.h" - -/*! - * \brief List with string data. - */ -typedef struct _StringList { - char *str; - /*!< String value. */ - struct _StringList *next; - /*!< Pointer to next item. */ -} StringList; - - -/*! - * \brief List with pcb element header data. - */ -typedef struct _DxfList { - char *descr; - /*!< description of pcb element. */ - char *value; - /*!< value of pcb element. */ - int num; - /*!< amount of elements per unique pcb element. */ - StringList *refdes; - /*!< list of reference designators (refdes's) of pcb elements. */ - struct _DxfList *next; - /*!< pointer to next (unique) element header data. */ -} DxfList; - - -#define NOSHAPE 0 -#define SHP_ROUND 1 /* shaped like a circle */ -#define SHP_OCTAGON 2 /* shape like an octagon */ -#define SHP_SQUARE 3 /* shaped like a square */ -#define SHP_ROUNDCLEAR 4 /* round clearance in negatives */ -#define SHP_SQUARECLEAR 5 /* square clearance in negatives */ -#define SHP_THERMAL 6 /* negative thermal relief */ - - -/* - * Function prototypes. - */ -static void dxf_beep(void); -static void dxf_calibrate(double xval, double yval); -static char *dxf_clean_string(char *in); -static void dxf_destroy_gc(hidGC gc); -static void dxf_do_export(HID_Attr_Val * options); -static void dxf_draw_arc(hidGC gc, int cx, int cy, int width, int height, int start_angle, int delta_angle); -static void dxf_draw_line(hidGC gc, int x1, int y1, int x2, int y2); -static void dxf_draw_rect(hidGC gc, int x1, int y1, int x2, int y2); -static int dxf_drill_sort(const void *va, const void *vb); -static int dxf_export_xref_file(void); -static void dxf_fill_circle(hidGC gc, int cx, int cy, int radius); -static void dxf_fill_polygon(hidGC gc, int n_coords, int *x, int *y); -static void dxf_fill_rect(hidGC gc, int x1, int y1, int x2, int y2); -static HID_Attribute *dxf_get_export_options(int *n); -static int dxf_group_for_layer(int l); -static DxfList *dxf_insert(char *refdes, char *descr, char *value, DxfList * dxf); -static int dxf_layer_sort(const void *va, const void *vb); -static hidGC dxf_make_gc(void); -static void dxf_maybe_close_file(); -static void dxf_parse_arguments(int *argc, char ***argv); -static void dxf_progress(int dxf_so_far, int dxf_total, const char *dxf_message); -static void dxf_set_color(hidGC gc, const char *name); -static void dxf_set_crosshair(int x, int y); -static int dxf_set_layer(const char *name, int group); -static void dxf_set_line_cap(hidGC gc, EndCapStyle style); -static void dxf_set_line_width(hidGC gc, int width); -static void dxf_show_item(void *item); -static StringList *dxf_string_insert(char *str, StringList * list); -static void dxf_use_gc(hidGC gc, int radius); -static void dxf_use_mask(int use_it); -static void dxf_write_block(FILE * fp, int id_code, char *xref_name, - char *block_name, char *linetype, char *layer, double x0, - double y0, double z0, double thickness, int color, int paperspace, int block_type); -static void dxf_write_circle(FILE * fp, int id_code, char *linetype, - char *layer, double x0, double y0, double z0, double extr_x0, - double extr_y0, double extr_z0, double thickness, double radius, int color, int paperspace); -static void dxf_write_comment(FILE * fp, char *comment_string); -static void dxf_write_ellipse(FILE * fp, int id_code, char *linetype, - char *layer, double x0, double y0, double z0, double x1, - double y1, double z1, double extr_x0, double extr_y0, - double extr_z0, double thickness, double ratio, - double start_angle, double end_angle, int color, int paperspace); -static void dxf_write_endsection(FILE * fp); -static void dxf_write_eof(FILE * fp); -static void dxf_write_hatch(FILE * fp, char *pattern_name, int id_code, - char *linetype, char *layer, double x0, double y0, double z0, - double extr_x0, double extr_y0, double extr_z0, double thickness, - double pattern_scale, double pixel_size, double pattern_angle, - int color, int paperspace, int solid_fill, int associative, - int style, int pattern_style, int pattern_double, - int pattern_def_lines, int boundary_paths, int seed_points, double *seed_x0, double *seed_y0); -static void dxf_write_hatch_boundary_path_polyline(FILE * fp, - int type_flag, int polyline_has_bulge, int polyline_is_closed, - int polyline_vertices); -static void dxf_write_hatch_boundary_path_polyline_vertex(FILE * fp, double x0, double y0, double bulge); -static void dxf_write_header(); -static void dxf_write_header_imperial_new(); -static void dxf_write_header_metric_new(); -static void dxf_write_insert(FILE * fp, int id_code, char *block_name, - char *linetype, char *layer, double x0, double y0, double z0, - double thickness, double rel_x_scale, double rel_y_scale, - double rel_z_scale, double column_spacing, double row_spacing, - double rot_angle, int color, int attribute_follows, int paperspace, int columns, int rows); -static void dxf_write_polyline(FILE * fp, int id_code, char *linetype, - char *layer, double x0, double y0, double z0, - double extr_x0, double extr_y0, double extr_z0, - double thickness, double start_width, double end_width, - int color, int vertices_follow, int paperspace, int flag, - int polygon_mesh_M_vertex_count, int polygon_mesh_N_vertex_count, - int smooth_M_surface_density, int smooth_N_surface_density, int surface_type); -static void dxf_write_section(FILE * fp, char *section_name); -static void dxf_write_solid(FILE * fp, int id_code, char *linetype, - char *layer, double x0, double y0, double z0, double x1, - double y1, double z1, double x2, double y2, double z2, - double x3, double y3, double z3, double thickness, int color, int paperspace); -static void dxf_write_table_block_record(FILE * fp); -static void dxf_write_vertex(FILE * fp, int id_code, char *linetype, - char *layer, double x0, double y0, double z0, double thickness, - double start_width, double end_width, double bulge, - double curve_fit_tangent_direction, int color, int paperspace, int flag); -static double dxf_xy_to_angle(double x, double y); - -/*! - * \brief Debugging on/off switch. - */ -#define DEBUG 0 - -/*! - * \brief Error handling of not yet implemented functions. - */ -#define CRASH fprintf(stderr, "DXF error: pcb called an unimplemented DXF-HID function %s.\n", __FUNCTION__); abort() - -/*! - * pcb dxf HID version string - */ -#define PCB_DXF_HID_VERSION "PCB DXF HID - Version 0.0.1 (2011-10-23)" - -/*! - * \brief Dxf X-coordinate (in mil). - */ -#define DXF_X(pcb,x) (x) - -/*! - * \brief Dxf Y-coordinate (in mil). - */ -#define DXF_Y(pcb,y) ((pcb)->MaxHeight-(y)) - -/*! - * \brief Dxf X offset (in mil). - */ -#define DXF_XOffset(pcb,x) (x) - -/*! - * \brief Dxf Y offset (in mil). - */ -#define DXF_YOffset(pcb,y) (-(y)) - -/*! - * \brief Round of value to the nearest multiple of 100. - */ -#define DXF_ROUND(x) ((int)(((x)+50)/100)*100) - -/*! - * \brief DXF color definition, entities with this color follow the color - * definition of the block in which it lives. - */ -#define DXF_COLOR_BYBLOCK 0 - -/*! - * \brief DXF color definition, pen number "1" in the virtual pen-plotter. - */ -#define DXF_COLOR_RED 1 - -/*! - * \brief DXF color definition, pen number "2" in the virtual pen-plotter. - */ -#define DXF_COLOR_YELLOW 2 - -/*! - * \brief DXF color definition, pen number "3" in the virtual pen-plotter. - */ -#define DXF_COLOR_GREEN 3 - -/*! - * \brief DXF color definition, pen number "4" in the virtual pen-plotter. - */ -#define DXF_COLOR_CYAN 4 - -/*! - * \brief DXF color definition, pen number "5" in the virtual pen-plotter. - */ -#define DXF_COLOR_BLUE 5 - -/*! - * \brief DXF color definition, pen number "6" in the virtual pen-plotter. - */ -#define DXF_COLOR_MAGENTA 6 - -/*! - * \brief DXF color definition, pen number "7" in the virtual pen-plotter. - */ -#define DXF_COLOR_WHITE 7 - -/*! - * \brief DXF color definition, pen number "8" in the virtual pen-plotter. - */ -#define DXF_COLOR_GREY 8 - -/*! - * \brief DXF color definition, color of the entity follows the color - * definition of the layer on which it lives. - */ -#define DXF_COLOR_BYLAYER 256 - -/*! - * \brief This is where our hardware is going to live, default value, can be - * ommitted in dxf output. - */ -#define DXF_MODELSPACE 0 - -/*! - * \brief This is where your annotation (papersheet templates, fab notes and - * such) should live, has to be included in DXF output for any entity to live - * on paperspace. - */ -#define DXF_PAPERSPACE 1 - -/*! - * \brief There is always a layer "0" defined, it's reasonably safe to - * assume that this is a valid layername. - */ -#define DXF_DEFAULT_LAYER "0" - -/*! - * \brief There is always a linetype "BYLAYER" defined, it's reasonably - * safe to assume that this is a valid linetype. - */ -#define DXF_DEFAULT_LINETYPE "BYLAYER" - -/*! - * \brief There is always a textstyle "STANDARD" defined, it's - * reasonably safe to assume that this is a valid text style. - */ -#define DXF_DEFAULT_TEXTSTYLE "STANDARD" - -/*! - * \brief Directory where 3D models of parts live. - * - * For now the dxf_xref_pathname is set to "parts", in AutoCAD one can - * configure default search directories for xrefs. - */ -#define DXF_DEFAULT_XREF_PATH_NAME "parts" - -/*! - * \brief Directory separator character (back slash). - * - * We target an Autodesk universe with all of it's quirks. - * - * \todo This has to be solved in a more elegant manner if we want to - * use DXF files for *nix based CAD software. - */ -#define DXF_DIR_SEPARATOR "\\" - -/*! - * \brief Default hatch pattern for pcb polygons. - * - * \todo For now the hatch pattern name is set to "SOLID".\n - * If pcb is ever to have thieving implemented, a hatch pattern name field - * has to be added to the graphic context. - */ -#define DXF_DEFAULT_HATCH_PATTERN_NAME "SOLID" - -/*! - * \brief File pointer for DXF layer files. - */ -static FILE *fp; - -/*! - * \brief File name of layer DXF files. - */ -static char *dxf_filename; - -/*! - * \brief File name suffix for layer files. - */ -static char *dxf_filesuffix; - -/*! - * \brief . - */ -static int dxf_finding_apertures = 0; - -/*! - * \brief Layer name. - */ -static char *dxf_layername = 0; - -/*! - * \brief Line count ??. - */ -static int lncount = 0; - -/*! - * \brief DXF file with xrefs needed. - */ -static int dxf_xrefs; - -/*! - * \brief File name of Xref (blocks) DXF file. - */ -static char *dxf_xref_filename; - -/*! - * \brief DXF file with output in mm (not mils). - */ -static int dxf_metric; - -/*! - * \brief DXF file with layer color BYBLOCK (or by layer number). - */ -static int dxf_color_is_byblock; - -/*! - * \brief DXF file with verbose output (to contain DXF comments). - */ -static int dxf_verbose; - -/*! - * \brief export all PCB layers to DXF files. - */ -static int dxf_export_all_layers; - -/*! - * \brief Every DXF entity has a unique identifier (per DXF file). - */ -static int dxf_id_code = 0; - -/*! - * \brief Record with all values of the DXF HID. - */ -static HID dxf_hid; - -/*! - * \brief Drill (hole) properties. - */ -typedef struct { - int diam; - /*!< drill diameter. */ - int x; - /*!< X-coordinate. */ - int y; - /*!< Y-coordinate. */ -} DxfPendingDrills; - -/*! - * \brief Layer is a mask. - */ -static int is_mask; - -/*! - * \brief Current mask. - */ -static int current_mask; - -/*! - * \brief Entity is a drill (hole). - */ -static int is_drill; - -static int was_drill; - -static int n_layerapps = 0; - -static int c_layerapps = 0; - -/*! - * \brief Pending drill (holes). - */ -DxfPendingDrills *dxf_pending_drills = 0; - -/*! - * \brief Number of pending drill (holes). - */ -int dxf_n_pending_drills = 0; - -/*! - * \brief Maximum number of pending drills (holes). - */ -int dxf_max_pending_drills = 0; - -/*! - * \brief Definition of graphic context for the dxf HID. - * - * This graphics context is an opaque pointer defined by the HID.\n - * GCs are HID-specific; attempts to use one HID's GC for a different - * HID will result in a fatal error.\n - * - * \todo In pcb the cap always extends beyond the coordinates - * given, by half the width of the line.\n - * With DXF polylines the cap is by default 0, and thus doesn't extend - * beyond the coordinates.\n - * A round cap could be implemented by drawing a donut (a series of - * polyline vertices) with an inner radius of zero at the start and - * endpoint of a line, this doesn't solve the problem for other aperture - * shapes, and is thus not yet implemented. - */ -typedef struct hid_gc_struct { - EndCapStyle cap; - /*!< end cap style. */ - int width; - /*!< width. */ - int color; - /*!< color. */ - int erase; - /*!< erase. */ - int drill; - /*!< drill. */ -} hid_gc_struct; - -/*! - * \brief Definition of options the user can select in the DXF exporter - * dialog. - */ -static HID_Attribute dxf_options[] = { -/* -%start-doc options "DXF Export" -@ftable @code -@item --dxffile -DXF output file prefix. Can include a path. -@end ftable -%end-doc -*/ - {"dxffile", "DXF layer filename base", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_dxffile 0 - -/* -%start-doc options "DXF Export" -@ftable @code -@item --metric -Export DXF files in mm. Default is mil -@end ftable -%end-doc -*/ - {"metric", "export DXF files in mm", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_metric 1 - -/* -%start-doc options "DXF Export" -@ftable @code -@item --layer-color-BYBLOCK -Export entities in color BYBLOCK. Default is BYLAYER. -@end ftable -%end-doc -*/ - {"layer-color-BYBLOCK", "export entities in color BYBLOCK", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_color_byblock 2 - -/* -%start-doc options "DXF Export" -@ftable @code -@item --xrefs -Export a DXF file with XREFS. Default is no XREFS. -@end ftable -%end-doc -*/ - {"xrefs", "export a DXF file with xrefs", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_xrefs 3 - -/* -%start-doc options "DXF Export" -@ftable @code -@item --xreffile -DXF Xrefs filename. Can include a path. -@end ftable -%end-doc -*/ - {"xreffile", "DXF Xrefs filename", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_xreffile 4 - -/* -%start-doc options "DXF Export" -@ftable @code -@item --verbose -Verbose output to stderr (comments). -@end ftable -%end-doc -*/ - {"be verbose", "verbose output to stderr (comments)", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_verbose 5 - -/* -%start-doc options "DXF Export" -@ftable @code -@item --export-all-layers -Export all layers. -@end ftable -%end-doc -*/ - {"export all layers", "export all layers", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_export_all_layers 6 -}; - -#define NUM_OPTIONS (sizeof(dxf_options)/sizeof(dxf_options[0])) - -/*! - * \brief Used for HID attributes (exporting and printing, mostly). - * - * HA_boolean uses int_value, HA_enum sets int_value to the index and - * str_value to the enumeration string.\n - * HID_Label just shows the default str_value.\n - * HID_Mixed is a real_value followed by an enum, like 0.5in or 100mm. - */ -static HID_Attr_Val dxf_values[NUM_OPTIONS]; - -static int pagecount = 0; - -static int linewidth = -1; - -static int lastgroup = -1; - -static int lastcap = -1; - -static int lastcolor = -1; - -static int print_layer[MAX_LAYER]; - -/*! - * \brief The last X coordinate. - */ -static int dxf_lastX; - -/*! - * \brief The last Y coordinate. - */ -static int dxf_lastY; - -/*! - * \brief Find a group for a given layer ??. - */ -static int dxf_group_for_layer(int l) { - if ((l < max_copper_layer + 2) && (l >= 0)) { - return GetLayerGroupNumberByNumber(l); - } - /* else something unique */ - return max_group + 3 + l; -} - -/*! - * \brief Sort layers ??. - */ -static int dxf_layer_sort(const void *va, const void *vb) { - int a; - int b; - int d; - - a = *(int *) va; - b = *(int *) vb; - d = dxf_group_for_layer(b) - dxf_group_for_layer(a); - if (d) - return d; - return b - a; -} - -/*! - * \brief Convert pcb x,y coordinates to an angle relative to (0.0, 0.0). - */ -static double dxf_xy_to_angle(double x, double y) { - double theta; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_xy_to_angle () function.\n", __FILE__, __LINE__); -#endif - if ((x > 0.0) && (y >= 0.0)) - theta = 180.0; - else if ((x <= 0.0) && (y > 0.0)) - theta = 90.0; - else if ((x < 0.0) && (y <= 0.0)) - theta = 0.0; - else if ((x >= 0.0) && (y < 0.0)) - theta = 270.0; - else { - theta = 0.0; - Message(PCB_MSG_WARNING, "DXF: in dxf_xy_to_angle ():\n" - " unable to figure out angle of element\n" - " because the pin is at the centroid of the part.\n" - " This is a BUG!!!\n" " Setting to %g degrees\n", theta); - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_xy_to_angle () function.\n", __FILE__, __LINE__); -#endif - return (theta); -} - - -/*! - * \brief Clean up a string. - * - * Copy over input string to output string with some character conversions.\n - * Go all the way to end of string to get the termination character. - */ -static char *dxf_clean_string(char *in) { - char *out; - int i; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_clean_string () function.\n", __FILE__, __LINE__); -#endif - if ((out = malloc((strlen(in) + 1) * sizeof(char))) == NULL) { - Message(PCB_MSG_ERROR, "DXF: in dxf_clean_string (): malloc () failed.\n"); - exit(1); - } - for (i = 0; i <= strlen(in); i++) { - switch (in[i]) { - case '"': - out[i] = '\''; - break; - case ' ': - out[i] = '_'; - break; - default: - out[i] = in[i]; - break; - } - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_clean_string () function.\n", __FILE__, __LINE__); -#endif - return (out); -} - - -/*! - * \brief Insert the string to the list of strings. - */ -static StringList *dxf_string_insert(char *str, StringList * list) { - StringList *new; - StringList *cur; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_string_insert () function.\n", __FILE__, __LINE__); -#endif - if ((new = (StringList *) malloc(sizeof(StringList))) == NULL) { - Message(PCB_MSG_ERROR, "DXF: in dxf_string_insert (): malloc () failed.\n"); - exit(1); - } - new->next = NULL; - new->str = pcb_strdup(str); - if (list == NULL) { - return (new); - } - cur = list; - while (cur->next != NULL) - cur = cur->next; - cur->next = new; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_string_insert () function.\n", __FILE__, __LINE__); -#endif - return (list); -} - - -/*! - * \brief Write DXF output to a file for a block entity. - * - * The BLOCKS section of the DXF file contains all the block - * definitions.\n - * It contains the entities that make up the blocks used in the drawing, - * including anonymous blocks generated by the HATCH command and by - * associative dimensioning.\n - * The format of the entities in this section is identical to those in the - * ENTITIES section.\n - * All entities in the BLOCKS section appear between block and endblk - * entities.\n - * Block and endblk entities appear only in the BLOCKS section.\n - * Block definitions are never nested (that is, no block or endblk entity ever - * appears within another block-endblk pair), although a block definition can - * contain an insert entity.\n - * \n - * External references are written in the DXF file as block definitions, - * except that they also include a string (group code 1) that specifies the - * path and file name of the external reference.\n - * \n - * The block table handle, along with any xdata and persistent reactors, - * appears in each block definition immediately following the BLOCK - * record, which contains all of the specific information that a block table - * record stores.\n - * \n - * The UCS in effect when a block definition is created becomes the WCS for - * all entities in the block definition.\n - * The new origin for these entities is shifted to match the base point - * defined for the block definition.\n - * All entity data is translated to fit this new WCS.\n - * \n - * *MODEL_SPACE and *PAPER_SPACE Block Definition.\n - * Now, there are always two extra, empty definitions in the BLOCKS section, - * titled *MODEL_SPACE and *PAPER_SPACE.\n - * These definitions manifest the new representation of model space and paper - * space as block definitions internally.\n - * The entities contained in these definitions still appear in the - * ENTITIES section for compatibility.\n - * \n - * Model Space and Paper Space Entity Segregation.\n - * The interleaving between model space and paper space will no longer occurs, - * because of internal organization.\n - * Instead, all paper space entities are output, followed by model space - * entities.\n - * The flag distinguishing them is the group code 67.\n - * - * \todo Add group code 102 stuff. - */ -static void dxf_write_block(FILE * fp, - /*!< file pointer to output file (or device). */ - int id_code, - /*!< group code = 5. */ - char *xref_name, - /*!< group code = 1. */ - char *block_name, - /*!< group code = 2 and 3. */ - char *linetype, - /*!< group code = 6\n - * optional, if omitted defaults to BYLAYER. */ - char *layer, - /*!< group code = 8. */ - double x0, - /*!< group code = 10\n - * base point. */ - double y0, - /*!< group code = 20\n - * base point. */ - double z0, - /*!< group code = 30\n - * base point. */ - double thickness, - /*!< group code = 39\n - * optional, if omitted defaults to 0.0. */ - int color, - /*!< group code = 62\n - * optional, if omitted defaults to BYLAYER. */ - int paperspace, - /*!< group code = 67\n - * optional, if omitted defaults to 0 (modelspace). */ - int block_type - /*!< group code = 70\n - * bit codes:\n - * 1 = this is an anonymous Block generated by hatching, - * associative dimensioning, other internal operations, or an - * application\n - * 2 = this Block has Attributes\n - * 4 = this Block is an external reference (Xref)\n - * 8 = not used\n - * 16 = this Block is externally dependent\n - * 32 = this is a resolved external reference, or dependent - * of an external reference\n - * 64 = this definition is referenced. */ - ) { - char *dxf_entity_name; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_block () function.\n", __FILE__, __LINE__); - fprintf(stderr, "[DXF entity with code %x]\n", id_code); -#endif - dxf_entity_name = pcb_strdup("BLOCK"); - if (strcmp(block_name, "") == 0) { - if (dxf_verbose) { - fprintf(stderr, "DXF Warning: empty block name string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, "\t%s entity is discarded from output.\n", dxf_entity_name); - } - return; - } - if (strcmp(xref_name, "") == 0) { - if (dxf_verbose) { - fprintf(stderr, "DXF Warning: empty xref name string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, "\t%s entity is discarded from output.\n", dxf_entity_name); - } - return; - } - if (strcmp(layer, "") == 0) { - if (dxf_verbose) { - fprintf(stderr, "DXF Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, "\t%s entity is relocated to layer 0.\n", dxf_entity_name); - } - layer = pcb_strdup(DXF_DEFAULT_LAYER); - } - fprintf(fp, " 0\n%s\n", dxf_entity_name); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - /* group code 102 stuff goes here */ - fprintf(fp, "100\nAcDbEntity\n"); - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, "100\nAcDbBlockBegin\n"); - fprintf(fp, " 2\n%s\n", block_name); - fprintf(fp, " 70\n%d\n", block_type); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - fprintf(fp, " 3\n%s\n", block_name); - if ((block_type && 4) || (block_type && 32)) { - fprintf(fp, " 1\n%s%s%s.dwg\n", xref_name, DXF_DIR_SEPARATOR, block_name); - } - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } - /* now write an end block marker */ - fprintf(fp, " 0\nENDBLK\n"); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - /* group code 102 stuff goes here */ - fprintf(fp, "100\nAcDbBlockEnd\n"); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_block () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a BLOCK_RECORD table. - * - * The DXF BLOCK_RECORD table is part of the TABLES section of - * the header that comes after the DIMSTYLE table and before the - * ENTITIES section.\n - * The BLOCK_RECORD table contains record definitions of all - * BLOCK entities, either regular BLOCK entities or external - * referenced BLOCK entities, the so calld XREFS.\n - * \todo Code it !! Make it happen !! - */ -static void dxf_write_table_block_record(FILE * fp - /*!< file pointer to output file (or device). */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_table_block_record () function.\n", __FILE__, __LINE__); -#endif - /*! \todo Add code. */ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_table_block_record () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a CIRCLE entity. - * - * \todo The CIRCLE entity has to be replaced by a POLYLINE - * entity with the correct line width (trace width). - * \todo The CIRCLE entity is to be used for (unplated) drill holes only. - * In the mechanical CAD program these circles (drill holes) can be extruded - * to the board thickness and subtracted from the extruded pcb outline. - */ -static void dxf_write_circle(FILE * fp, - /*!< file pointer to output file (or device). */ - int id_code, - /*!< group code = 5. */ - char *linetype, - /*!< group code = 6\n - * optional, defaults to BYLAYER. */ - char *layer, - /*!< group code = 8. */ - double x0, - /*!< group code = 10\n - * base point. */ - double y0, - /*!< group code = 20\n - * base point. */ - double z0, - /*!< group code = 30\n - * base point. */ - double extr_x0, - /*!< group code = 210\n - * extrusion direction\n - * optional, if ommited defaults to 0.0. */ - double extr_y0, - /*!< group code = 220\n - * extrusion direction\n - * optional, if ommited defaults to 0.0. */ - double extr_z0, - /*!< group code = 230\n - * extrusion direction\n - * optional, if ommited defaults to 1.0. */ - double thickness, - /*!< group code = 39\n - * optional, defaults to 0.0. */ - double radius, - /*!< group code = 40. */ - int color, - /*!< group code = 62\n - * optional, defaults to BYLAYER. */ - int paperspace - /*!< group code = 67\n - * optional, defaults to 0 (modelspace). */ - ) { - char *dxf_entity_name; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_circle () function.\n", __FILE__, __LINE__); - fprintf(stderr, "[DXF entity with code %x]\n", id_code); -#endif - dxf_entity_name = pcb_strdup("CIRCLE"); - if (radius == 0.0) { - if (dxf_verbose) { - fprintf(stderr, "Error: radius value equals 0.0 for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - return; - } - } - if (strcmp(layer, "") == 0) { - layer = pcb_strdup(DXF_DEFAULT_LAYER); - if (dxf_verbose) { - fprintf(stderr, "Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is relocated to layer 0", dxf_entity_name); - } - } - fprintf(fp, " 0\n%s\n", dxf_entity_name); - fprintf(fp, "100\nAcDbCircle\n"); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - if (strcmp(linetype, DXF_DEFAULT_LINETYPE) != 0) { - fprintf(fp, " 6\n%s\n", linetype); - } - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - fprintf(fp, " 210\n%f\n", extr_x0); - fprintf(fp, " 220\n%f\n", extr_y0); - fprintf(fp, " 230\n%f\n", extr_z0); - if (thickness != 0.0) { - fprintf(fp, " 39\n%f\n", thickness); - } - fprintf(fp, " 40\n%f\n", radius); - if (color != DXF_COLOR_BYLAYER) { - fprintf(fp, " 62\n%d\n", color); - } - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_circle () function.\n", __FILE__, __LINE__); -#endif - return; -} - - -/*! - * \brief Write DXF output for a comment string with line termination. - * - * The group code "999" indicates that the following line is a comment - * string.\n - * The AutoCAD command "DXFOUT" does not currently include such groups in a - * DXF output file.\n - * The AutoCAD command "DXFIN" honors them and ignores the comments.\n - * Thus, you can use the 999 group to include comments in a DXF file you've - * created. - */ -static void dxf_write_comment(FILE * fp, - /*!< file pointer to output file (or device). */ - char *comment_string - /*!< comment string. */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_comment () function.\n", __FILE__, __LINE__); -#endif - if (strcmp(comment_string, "") == 0) { - /* no use in writing an empty comment string to file */ - return; - } - fprintf(fp, "999\n%s\n", comment_string); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_comment () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for an ellipse entity. - * - * This entity requires AutoCAD version R14 or higher.\n - * The ellipse entity is currently used to draw arcs.\n - * Since the pcb file format allows for a height and a width value, it is thus - * possible to draw an elliptical arc. - * - * \todo The ellipse entity has to be replaced by a polyline with the correct - * line width (trace width). - * When we figured out how to draw a polyline (with vertices) for an arc - * (part of a circle) or an elliptical arc (part of an ellipse). - * This function will then become obsolete. - */ -static void dxf_write_ellipse(FILE * fp, - /*!< file pointer to output file (or device). */ - int id_code, - /*!< group code = 5. */ - char *linetype, - /*!< group code = 6\n - * optional, defaults to BYLAYER. */ - char *layer, - /*!< group code = 8. */ - double x0, - /*!< group code = 10\n - * base point. */ - double y0, - /*!< group code = 20\n - * base point. */ - double z0, - /*!< group code = 30\n - * base point. */ - double x1, - /*!< group code = 11\n - * endpoint of major axis, relative to the center (in WCS). */ - double y1, - /*!< group code = 21\n - * endpoint of major axis, relative to the center (in WCS). */ - double z1, - /*!< group code = 31\n - * endpoint of major axis, relative to the center (in WCS). */ - double extr_x0, - /*!< group code = 210\n - * extrusion direction\n - * optional, if ommited defaults to 0.0. */ - double extr_y0, - /*!< group code = 220\n - * extrusion direction\n - * optional, if ommited defaults to 0.0. */ - double extr_z0, - /*!< group code = 230\n - * extrusion direction\n - * optional, if ommited defaults to 1.0. */ - double thickness, - /*!< group code = 39\n - * optional, defaults to 0.0. */ - double ratio, - /*!< group code = 40\n - * ratio of minor axis to major axis. */ - double start_angle, - /*!< group code = 41\n - * start parameter (this value is 0.0 for a full ellipse). */ - double end_angle, - /*!< group code = 42\n - * end parameter (this value is 2*pi for a full ellipse). */ - int color, - /*!< group code = 62\n - * optional, defaults to BYLAYER. */ - int paperspace - /*!< group code = 67\n - * optional, defaults to 0 (modelspace). */ - ) { - char *dxf_entity_name; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_ellipse () function.\n", __FILE__, __LINE__); -#endif - dxf_entity_name = pcb_strdup("ELLIPSE"); - if (ratio == 0.0) { - if (dxf_verbose) { - fprintf(stderr, "Error: ratio value equals 0.0 for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - } - return; - } - if (strcmp(layer, "") == 0) { - layer = pcb_strdup(DXF_DEFAULT_LAYER); - if (dxf_verbose) { - fprintf(stderr, "Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is relocated to layer 0", dxf_entity_name); - } - } - fprintf(fp, " 0\n%s\n", dxf_entity_name); - fprintf(fp, "100\nAcDbEllipse\n"); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - if (strcmp(linetype, DXF_DEFAULT_LINETYPE) != 0) { - fprintf(fp, " 6\n%s\n", linetype); - } - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - fprintf(fp, " 11\n%f\n", x1); - fprintf(fp, " 21\n%f\n", y1); - fprintf(fp, " 31\n%f\n", z1); - fprintf(fp, " 210\n%f\n", extr_x0); - fprintf(fp, " 220\n%f\n", extr_y0); - fprintf(fp, " 230\n%f\n", extr_z0); - if (thickness != 0.0) { - fprintf(fp, " 39\n%f\n", thickness); - } - fprintf(fp, " 40\n%f\n", ratio); - fprintf(fp, " 41\n%f\n", start_angle); - fprintf(fp, " 42\n%f\n", end_angle); - if (color != DXF_COLOR_BYLAYER) { - fprintf(fp, " 62\n%d\n", color); - } - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_ellipse () function.\n", __FILE__, __LINE__); -#endif - return; -} - - -/*! - * \brief Write DXF output to a file for an end of section marker. - */ -static void dxf_write_endsection(FILE * fp - /*!< file pointer to output file (or device) */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_endsection () function.\n", __FILE__, __LINE__); -#endif - fprintf(fp, " 0\nENDSEC\n"); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_endsection () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for an end of sequence marker. - * - * No fields.\n - * This marks the end of:\n - *
      - *
    • vertices (one or more "Vertex" entity) of a Polyline - *
    • attribute entities ("Attrib" entity) to an "Insert" entity that has - * Attributes (indicated by 66 group present and nonzero in Insert - * entity).\n - *
    - */ -static void dxf_write_endseq(FILE * fp - /*!< file pointer to output file (or device). */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_endseq () function.\n", __FILE__, __LINE__); -#endif - fprintf(fp, " 0\nENDSEQ\n"); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_endseq () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write dxf output to a file for an EOF marker. - */ -static void dxf_write_eof(FILE * fp - /*!< file pointer to output file (or device). */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_eof () function.\n", __FILE__, __LINE__); -#endif - fprintf(fp, " 0\nEOF\n"); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_eof () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a hatch entity. - * - * This entity requires AutoCAD version R14 or higher. - * - * \todo writing a hatch with a number of hatch_seed_points > 0 is creating a - * segmentation fault in the dxf hid (and thus pcb). - */ -static void dxf_write_hatch(FILE * fp, - /*!< file pointer to output file (or device). */ - char *pattern_name, - /*!< group code = 2. */ - int id_code, - /*!< group code = 5. */ - char *linetype, - /*!< group code = 6\n - * optional, defaults to BYLAYER. */ - char *layer, - /*!< group code = 8. */ - double x0, - /*!< group code = 10\n - * base point. */ - double y0, - /*!< group code = 20\n - * base point. */ - double z0, - /*!< group code = 30\n - * base point. */ - double extr_x0, - /*!< group code = 210\n - * extrusion direction\n - * optional, if ommited defaults to 0.0. */ - double extr_y0, - /*!< group code = 220\n - * extrusion direction\n - * optional, if ommited defaults to 0.0. */ - double extr_z0, - /*!< group code = 230\n - * extrusion direction\n - * optional, if ommited defaults to 1.0. */ - double thickness, - /*!< group code = 39\n - * optional, defaults to 0.0. */ - double pattern_scale, - /*!< group code 41\n - * pattern fill only. */ - double pixel_size, - /*!< group code 47. */ - double pattern_angle, - /*!< group code 52\n - * pattern fill only. */ - int color, - /*!< group code = 62\n - * optional, defaults to \c BYLAYER. */ - int paperspace, - /*!< group code = 67\n - * optional, defaults to 0 (modelspace). */ - int solid_fill, - /*!< group code = 70\n - * 0 = pattern fill\n - * 1 = solid fill. */ - int associative, - /*!< group code = 71\n - * 0 = non-associative\n - * 1 = associative. */ - int style, - /*!< group code = 75\n - * 0 = hatch "odd parity" area (Normal style)\n - * 1 = hatch outermost area only (Outer style)\n - * 2 = hatch through entire area (Ignore style). */ - int pattern_style, - /*!< group code = 76\n - * 0 = user defined\n - * 1 = predefined\n - * 2 = custom. */ - int pattern_double, - /*!< group code = 77\n - * pattern fill only\n - * 0 = not double\n - * 1 = double. */ - int pattern_def_lines, - /*!< group code = 78\n - * number of pattern definition lines. */ - int boundary_paths, - /*!< group code = 91\n - * number of boundary paths (loops). */ - int seed_points, - /*!< group code = 98\n - * number of seed points. */ - double *seed_x0, - /*!< group code = 10\n - * seed point X-value. */ - double *seed_y0 - /*!< group code = 20\n - * seed point Y-value. */ - ) { - char *dxf_entity_name; - int i; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_hatch () function.\n", __FILE__, __LINE__); - fprintf(stderr, "[DXF entity with code %x]\n", id_code); -#endif - dxf_entity_name = pcb_strdup("HATCH"); - if (strcmp(layer, "") == 0) { - fprintf(stderr, "Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is relocated to layer 0", dxf_entity_name); - layer = pcb_strdup(DXF_DEFAULT_LAYER); - } - fprintf(fp, " 0\n%s\n", dxf_entity_name); - fprintf(fp, "100\nAcDbHatch\n"); - fprintf(fp, " 2\n%s\n", pattern_name); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - if (strcmp(linetype, DXF_DEFAULT_LINETYPE) != 0) { - fprintf(fp, " 6\n%s\n", linetype); - } - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - fprintf(fp, "210\n%f\n", extr_x0); - fprintf(fp, "220\n%f\n", extr_y0); - fprintf(fp, "230\n%f\n", extr_z0); - if (thickness != 0.0) { - fprintf(fp, " 39\n%f\n", thickness); - } - if (!solid_fill) { - fprintf(fp, " 42\n%f\n", pattern_scale); - } - fprintf(fp, " 47\n%f\n", pixel_size); - if (!solid_fill) { - fprintf(fp, " 52\n%f\n", pattern_angle); - } - if (color != DXF_COLOR_BYLAYER) { - fprintf(fp, " 62\n%d\n", color); - } - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } - fprintf(fp, " 70\n%d\n", solid_fill); - fprintf(fp, " 71\n%d\n", associative); - fprintf(fp, " 75\n%d\n", style); - if (!solid_fill) { - fprintf(fp, " 77\n%d\n", pattern_double); - } - fprintf(fp, " 78\n%d\n", pattern_def_lines); - fprintf(fp, " 98\n%d\n", seed_points); - for (i = 0; i < seed_points; i++) { - fprintf(fp, " 10\n%f\n", seed_x0[i]); - fprintf(fp, " 20\n%f\n", seed_y0[i]); - } - fprintf(fp, " 91\n%d\n", boundary_paths); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_hatch () function.\n", __FILE__, __LINE__); -#endif - return; -} - - -/*! - * \brief Write DXF output to a file for a hatch boundary path polyline. - * - * This entity requires AutoCAD version R14 or higher. - */ -static void dxf_write_hatch_boundary_path_polyline(FILE * fp, - /*!< file pointer to output file (or device). */ - int type_flag, - /*!< group code 92. */ - int polyline_has_bulge, - /*!< group code = 72\n - * polyline boundary data group only. */ - int polyline_is_closed, - /*!< group code = 73\n - * polyline boundary data group only. */ - int polyline_vertices - /*!< group code 93\n - * number of polyline vertices to follow. */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_hatch_boundary_path_polyline () function.\n", __FILE__, __LINE__); -#endif - fprintf(fp, " 92\n%d\n", type_flag); - fprintf(fp, " 72\n%d\n", polyline_has_bulge); - fprintf(fp, " 73\n%d\n", polyline_is_closed); - fprintf(fp, " 93\n%d\n", polyline_vertices); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_hatch_boundary_path_polyline () function.\n", __FILE__, __LINE__); -#endif - return; -} - - -/*! - * \brief Write DXF output to a file for a hatch boundary polyline entity. - * - * This entity requires AutoCAD version R14 or higher. - */ -static void dxf_write_hatch_boundary_path_polyline_vertex(FILE * fp, - /*!< file pointer to output file (or device). */ - double x0, - /*!< group code = 10\n - * X-value of vertex point. */ - double y0, - /*!< group code = 20\n - * Y-value of vertex point. */ - double bulge - /*!< group code 42\n - * bulge of polyline vertex\n - * optional, defaults to 0.0. */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_hatch_boundary_polyline_vertex () function.\n", __FILE__, __LINE__); -#endif - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - if (bulge != 0.0) { - fprintf(fp, " 42\n%f\n", bulge); - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_hatch_boundary_polyline_vertex () function.\n", __FILE__, __LINE__); -#endif - return; -} - - -/*! - * \brief Write DXF output to a file for a imperial DXF header. - * - * Fall back for if no default imperial header template file exists in the - * pcb/src/hid/dxf/template directory.\n - * Write down a DXF header from scratch based on imperial values.\n - * Included sections and tables are:\n - *
      -*
    • HEADER section - *
    • CLASSES section - *
    • TABLES section - *
        - *
      • VPORT table - *
      • LTYPE table - *
      • LAYER table - *
      • STYLE table - *
      • VIEW table - *
      • UCS table - *
      • APPID table - *
      • DIMSTYLE table - *
      - *
    - */ -static void dxf_write_header_imperial_new() -{ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_header_imperial_new () function.\n", __FILE__, __LINE__); -#endif - /* write an imperial HEADER section */ - fprintf(fp, " 0\nSECTION\n"); - fprintf(fp, " 2\nHEADER\n"); /* Section name. */ - fprintf(fp, " 9\n$ACADVER\n 1\nAC1014\n"); /* AutoCAD drawing database version number. */ - fprintf(fp, " 9\n$ACADMAINTVER\n 70\n 0\n"); /* Maintenance version number. */ - fprintf(fp, " 9\n$DWGCODEPAGE\n 3\nANSI_1252\n"); /* Drawing code page. */ - fprintf(fp, " 9\n$INSBASE\n 10\n0.0\n 20\n0.0\n 30\n0.0\n"); /* Insertion base set by BASE command (in WCS). */ - fprintf(fp, " 9\n$EXTMIN\n0 10\n-0.012816\n 20\n-0.009063\n 30\n-0.001526\n"); /* X, Y, and Z drawing extents lower-left corner (in WCS). */ - fprintf(fp, " 9\n$EXTMAX\n 10\n88.01056\n 20\n35.022217\n 30\n0.0\n"); /* X, Y, and Z drawing extents upper-right corner (in WCS). */ - fprintf(fp, " 9\n$LIMMIN\n 10\n0.0\n 20\n0.0\n"); /* XY drawing limits lower-left corner (in WCS). */ - fprintf(fp, " 9\n$LIMMAX\n 10\n420.0\n 20\n297.0\n"); /* XY drawing limits upper-right corner (in WCS). */ - fprintf(fp, " 9\n$ORTHOMODE\n 70\n 0\n"); /* Ortho mode on if nonzero. */ - fprintf(fp, " 9\n$REGENMODE\n 70\n 1\n"); /* REGENAUTO mode on if nonzero. */ - fprintf(fp, " 9\n$FILLMODE\n 70\n 1\n"); /* Fill mode on if nonzero. */ - fprintf(fp, " 9\n$QTEXTMODE\n 70\n 0\n"); /* Quick text mode on if nonzero. */ - fprintf(fp, " 9\n$MIRRTEXT\n 70\n 1\n"); /* Mirror text if nonzero. */ - fprintf(fp, " 9\n$DRAGMODE\n 70\n 2\n"); /* 0 = off, 1 = on, 2 = auto. */ - fprintf(fp, " 9\n$LTSCALE\n 40\n1.0\n"); /* Global linetype scale. */ - fprintf(fp, " 9\n$OSMODE\n 70\n 125\n"); /* Running object snap modes. */ - fprintf(fp, " 9\n$ATTMODE\n 70\n 1\n"); /* Attribute visibility: 0 = none, 1 = normal, 2 = all. */ - fprintf(fp, " 9\n$TEXTSIZE\n 40\n0.1\n"); /* Default text height = 100 mil. */ - fprintf(fp, " 9\n$TRACEWID\n 40\n1.0\n"); /* Default trace width. */ - fprintf(fp, " 9\n$TEXTSTYLE\n 7\nSTANDARD\n"); /* Current text style name. */ - fprintf(fp, " 9\n$CLAYER\n 8\n0\n"); /* Current layer name. */ - fprintf(fp, " 9\n$CELTYPE\n 6\nBYLAYER\n"); /* Entity linetype name, or BYBLOCK or BYLAYER. */ - fprintf(fp, " 9\n$CECOLOR\n 62\n 256\n"); /* Current entity color number: 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$CELTSCALE\n 40\n1.0\n"); /* Current entity linetype scale. */ - fprintf(fp, " 9\n$DELOBJ\n 70\n 1\n"); /* Controls object deletion: 0=deleted, 1=retained. */ - fprintf(fp, " 9\n$DISPSILH\n 70\n 0\n"); /* Controls the display of silhouette curves of body objects in wire-frame mode: 0=Off, 1=On. */ - fprintf(fp, " 9\n$DIMSCALE\n 40\n1.0\n"); /* Overall dimensioning scale factor. */ - fprintf(fp, " 9\n$DIMASZ\n 40\n0.1\n"); /* Dimensioning arrow size = 100 mil. */ - fprintf(fp, " 9\n$DIMEXO\n 40\n0.01\n"); /* Extension line offset = 10 mil. */ - fprintf(fp, " 9\n$DIMDLI\n 40\n0.1\n"); /* Dimension line increment = 100 mil. */ - fprintf(fp, " 9\n$DIMRND\n 40\n0.0\n"); /* Rounding value for dimension distances. */ - fprintf(fp, " 9\n$DIMDLE\n 40\n0.0\n"); /* Dimension line extension */ - fprintf(fp, " 9\n$DIMEXE\n 40\n0.05\n"); /* Extension line extension = 50 mil. */ - fprintf(fp, " 9\n$DIMTP\n 40\n0.0\n"); /* Plus tolerance. */ - fprintf(fp, " 9\n$DIMTM\n 40\n0.0\n"); /* Minus tolerance. */ - fprintf(fp, " 9\n$DIMTXT\n 40\n0.1\n"); /* Dimensioning text height = 100 mil. */ - fprintf(fp, " 9\n$DIMCEN\n 40\n0.01\n"); /* Size of center mark/lines = 10 mil. */ - fprintf(fp, " 9\n$DIMTSZ\n 40\n0.01\n"); /* Dimensioning tick size = 10 mil; 0 = no ticks. */ - fprintf(fp, " 9\n$DIMTOL\n 70\n 0\n"); /* Dimension tolerances generated if nonzero. */ - fprintf(fp, " 9\n$DIMLIM\n 70\n 0\n"); /* Dimension limits generated if nonzero. */ - fprintf(fp, " 9\n$DIMTIH\n 70\n 0\n"); /* Text inside horizontal if nonzero. */ - fprintf(fp, " 9\n$DIMTOH\n 70\n 0\n"); /* Text outside horizontal if nonzero. */ - fprintf(fp, " 9\n$DIMSE1\n 70\n 0\n"); /* First extension line suppressed if nonzero. */ - fprintf(fp, " 9\n$DIMSE2\n 70\n 0\n"); /* Second extension line suppressed if nonzero. */ - fprintf(fp, " 9\n$DIMTAD\n 70\n 1\n"); /* Text above dimension line if nonzero. */ - fprintf(fp, " 9\n$DIMZIN\n 70\n 8\n"); /* Controls suppression of zeros for primary unit values. */ - fprintf(fp, " 9\n$DIMBLK\n 1\n\n"); /* Arrow block name. */ - fprintf(fp, " 9\n$DIMASO\n 70\n 1\n"); /* 1 = create associative dimensioning, 0 = draw individual entities. */ - fprintf(fp, " 9\n$DIMSHO\n 70\n 1\n"); /* 1 = Recompute dimensions while dragging, 0 = drag original image. */ - fprintf(fp, " 9\n$DIMPOST\n 1\n\n"); /* General dimensioning suffix. */ - fprintf(fp, " 9\n$DIMAPOST\n 1\n\n"); /* Alternate dimensioning suffix. */ - fprintf(fp, " 9\n$DIMALT\n 70\n 0\n"); /* Alternate unit dimensioning performed if nonzero. */ - fprintf(fp, " 9\n$DIMALTD\n 70\n 4\n"); /* Alternate unit decimal places. */ - fprintf(fp, " 9\n$DIMALTF\n 40\n0.0254\n"); /* Alternate unit scale factor = inch --> mm. */ - fprintf(fp, " 9\n$DIMLFAC\n 40\n1.0\n"); /* Linear measurements scale factor. */ - fprintf(fp, " 9\n$DIMTOFL\n 70\n 1\n"); /* If text outside extensions, force line extensions between extensions if nonzero. */ - fprintf(fp, " 9\n$DIMTVP\n 40\n0.0\n"); /* Text vertical position. */ - fprintf(fp, " 9\n$DIMTIX\n 70\n 0\n"); /* Force text inside extensions if nonzero. */ - fprintf(fp, " 9\n$DIMSOXD\n 70\n 0\n"); /* Suppress outside-extensions dimension lines if nonzero. */ - fprintf(fp, " 9\n$DIMSAH\n 70\n 0\n"); /* Use separate arrow blocks if nonzero. */ - fprintf(fp, " 9\n$DIMBLK1\n 1\n\n"); /* First arrow block name. */ - fprintf(fp, " 9\n$DIMBLK2\n 1\n\n"); /* Second arrow block name. */ - fprintf(fp, " 9\n$DIMSTYLE\n 2\nSTANDARD\n"); /* Dimension style name. */ - fprintf(fp, " 9\n$DIMCLRD\n 70\n 0\n"); /*Dimension line color: range is 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$DIMCLRE\n 70\n 0\n"); /* Dimension extension line color: range is 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$DIMCLRT\n 70\n 0\n"); /* Dimension text color: range is 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$DIMTFAC\n 40\n1.0\n"); /* Dimension tolerance display scale factor. */ - fprintf(fp, " 9\n$DIMGAP\n 40\n25.0\n"); /* Dimension line gap = 25 mil. */ - fprintf(fp, " 9\n$DIMJUST\n 70\n 0\n"); /* Horizontal dimension text position: 0=above dimension line and center-justified between extension lines, 1=above dimension line and next to first extension line, 2=above dimension line and next to second extension line, 3=above and center-justified to first extension line, 4=above and center-justified to second extension line. */ - fprintf(fp, " 9\n$DIMSD1\n 70\n 0\n"); /* Suppression of first extension line: 0=not suppressed, 1=suppressed. */ - fprintf(fp, " 9\n$DIMSD2\n 70\n 0\n"); /* Suppression of second extension line: 0=not suppressed, 1=suppressed. */ - fprintf(fp, " 9\n$DIMTOLJ\n 70\n 1\n"); /* Vertical justification for tolerance values: 0=Top, 1=Middle, 2=Bottom. */ - fprintf(fp, " 9\n$DIMTZIN\n 70\n 0\n"); /* Controls suppression of zeros for tolerance values: 0 = Suppresses zero feet and precisely zero inches; 1 = Includes zero feet and precisely zero inches; 2 = Includes zero feet and suppresses zero inches; 3 = Includes zero inches and suppresses zero feet. */ - fprintf(fp, " 9\n$DIMALTZ\n 70\n 0\n"); /* Controls suppression of zeros for alternate unit dimension values: 0 = Suppresses zero feet and precisely zero inches; 1 = Includes zero feet and precisely zero inches; 2 = Includes zero feet and suppresses zero inches; 3 = Includes zero inches and suppresses zero feet. */ - fprintf(fp, " 9\n$DIMALTTZ\n 70\n 0\n"); /* Controls suppression of zeros for alternate tolerance values: 0 = Suppresses zero feet and precisely zero inches; 1 = Includes zero feet and precisely zero inches; 2 = Includes zero feet and suppresses zero inches; 3 = Includes zero inches and suppresses zero feet. */ - fprintf(fp, " 9\n$DIMFIT\n 70\n 3\n"); /* Placement of text and arrowheads; Possible values: 0 through 3. */ - fprintf(fp, " 9\n$DIMUPT\n 70\n 0\n"); /* Cursor functionality for user positioned text: 0=controls only the dimension line location, 1=controls the text position as well as the dimension line location. */ - fprintf(fp, " 9\n$DIMUNIT\n 70\n 2\n"); /* Units format for all dimension style family members except angular: 1 = Scientific; 2 = Decimal; 3 = Engineering; 4 = Architectural (stacked); 5 = Fractional (stacked); 6 = Architectural; 7 = Fractional. */ - fprintf(fp, " 9\n$DIMDEC\n 70\n 4\n"); /* Number of decimal places for the tolerance values of a primary units dimension. */ - fprintf(fp, " 9\n$DIMTDEC\n 70\n 4\n"); /* Number of decimal places to display the tolerance values. */ - fprintf(fp, " 9\n$DIMALTU\n 70\n 2\n"); /*Units format for alternate units of all dimension style family members except angular: 1 = Scientific; 2 = Decimal; 3 = Engineering; 4 = Architectural (stacked); 5 = Fractional (stacked); 6 = Architectural; 7 = Fractional. */ - fprintf(fp, " 9\n$DIMALTTD\n 70\n 2\n"); /*Number of decimal places for tolerance values of an alternate units dimension. */ - fprintf(fp, " 9\n$DIMTXSTY\n 7\nSTANDARD\n"); /* Dimension text style. */ - fprintf(fp, " 9\n$DIMAUNIT\n 70\n 0\n"); /* Angle format for angular dimensions: 0=Decimal degrees, 1=Degrees/minutes/seconds, 2=Gradians, 3=Radians, 4=Surveyor's units. */ - fprintf(fp, " 9\n$LUNITS\n 70\n 2\n"); /* Units format for coordinates and distances. */ - fprintf(fp, " 9\n$LUPREC\n 70\n 4\n"); /* Units precision for coordinates and distances */ - fprintf(fp, " 9\n$SKETCHINC\n 40\n1.0\n"); /* Sketch record increment. */ - fprintf(fp, " 9\n$FILLETRAD\n 40\n1.0\n"); /* Fillet radius. */ - fprintf(fp, " 9\n$AUNITS\n 70\n 0\n"); /* Units format for angles. */ - fprintf(fp, " 9\n$AUPREC\n 70\n 0\n"); /* Units precision for angles. */ - fprintf(fp, " 9\n$MENU\n 1\n.\n"); /* Name of menu file. */ - fprintf(fp, " 9\n$ELEVATION\n 40\n0.0\n"); /* Current elevation set by ELEV command. */ - fprintf(fp, " 9\n$PELEVATION\n 40\n0.0\n"); /* Current paper space elevation. */ - fprintf(fp, " 9\n$THICKNESS\n 40\n0.0\n"); /* Current thickness set by ELEV command. */ - fprintf(fp, " 9\n$LIMCHECK\n 70\n 0\n"); /* Nonzero if limits checking is on. */ - fprintf(fp, " 9\n$BLIPMODE\n 70\n 0\n"); /* Blip mode on if nonzero. */ - fprintf(fp, " 9\n$CHAMFERA\n 40\n10.0\n"); /* First chamfer distance. */ - fprintf(fp, " 9\n$CHAMFERB\n 40\n10.0\n"); /* Second chamfer distance. */ - fprintf(fp, " 9\n$CHAMFERC\n 40\n0.0\n"); /* Chamfer length. */ - fprintf(fp, " 9\n$CHAMFERD\n 40\n0.0\n"); /* Chamfer angle. */ - fprintf(fp, " 9\n$SKPOLY\n 70\n 0\n"); /* 0 = sketch lines, 1 = sketch polylines. */ - fprintf(fp, " 9\n$TDCREATE\n 40\n0.0\n"); /* Date/time of drawing creation. */ - fprintf(fp, " 9\n$TDUPDATE\n 40\n0.0\n"); /* Date/time of last drawing update. */ - fprintf(fp, " 9\n$TDINDWG\n 40\n0.0\n"); /* Cumulative editing time for this drawing. */ - fprintf(fp, " 9\n$TDUSRTIMER\n 40\n0.0\n"); /* User elapsed timer. */ - fprintf(fp, " 9\n$USRTIMER\n 70\n 1\n"); /* 0 = timer off, 1 = timer on. */ - fprintf(fp, " 9\n$ANGBASE\n 50\n0.0\n"); /* Angle 0 direction . */ - fprintf(fp, " 9\n$ANGDIR\n 70\n 0\n"); /* 1 = clockwise angles, 0 = counterclockwise. */ - fprintf(fp, " 9\n$PDMODE\n 70\n 98\n"); /* Point display mode. */ - fprintf(fp, " 9\n$PDSIZE\n 40\n0.0\n"); /* Point display size. */ - fprintf(fp, " 9\n$PLINEWID\n 40\n0.0\n"); /* Default polyline width. */ - fprintf(fp, " 9\n$COORDS\n 70\n 2\n"); /* Coordinate display: 0 = static, 1 = continuous update, 2 = "d -*
  • HEADER section - *
  • CLASSES section - *
  • TABLES section - *
      - *
    • VPORT table - *
    • LTYPE table - *
    • LAYER table - *
    • STYLE table - *
    • VIEW table - *
    • UCS table - *
    • APPID table - *
    • DIMSTYLE table - *
    - * - */ -static void dxf_write_header_metric_new() -{ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_header_metric_new () function.\n", __FILE__, __LINE__); -#endif - /* write a metric HEADER section */ - fprintf(fp, " 0\nSECTION\n"); - fprintf(fp, " 2\nHEADER\n"); /* Section name. */ - fprintf(fp, " 9\n$ACADVER\n 1\nAC1014\n"); /* AutoCAD drawing database version number. */ - fprintf(fp, " 9\n$ACADMAINTVER\n 70\n 0\n"); /* Maintenance version number. */ - fprintf(fp, " 9\n$DWGCODEPAGE\n 3\nANSI_1252\n"); /* Drawing code page. */ - fprintf(fp, " 9\n$INSBASE\n 10\n0.0\n 20\n0.0\n 30\n0.0\n"); /* Insertion base set by BASE command (in WCS). */ - fprintf(fp, " 9\n$EXTMIN\n 10\n0.0\n 20\n0.0\n 30\n0.0\n"); /* X, Y, and Z drawing extents lower-left corner (in WCS). */ - fprintf(fp, " 9\n$EXTMAX\n 10\n88.01056\n 20\n35.022217\n 30\n0.0\n"); /* X, Y, and Z drawing extents upper-right corner (in WCS). */ - fprintf(fp, " 9\n$LIMMIN\n 10\n0.0\n 20\n0.0\n"); /* XY drawing limits lower-left corner (in WCS). */ - fprintf(fp, " 9\n$LIMMAX\n 10\n420.0\n 20\n297.0\n"); /* XY drawing limits upper-right corner (in WCS). */ - fprintf(fp, " 9\n$ORTHOMODE\n 70\n 0\n"); /* Ortho mode on if nonzero. */ - fprintf(fp, " 9\n$REGENMODE\n 70\n 1\n"); /* REGENAUTO mode on if nonzero. */ - fprintf(fp, " 9\n$FILLMODE\n 70\n 1\n"); /* Fill mode on if nonzero. */ - fprintf(fp, " 9\n$QTEXTMODE\n 70\n 0\n"); /* Quick text mode on if nonzero. */ - fprintf(fp, " 9\n$MIRRTEXT\n 70\n 1\n"); /* Mirror text if nonzero. */ - fprintf(fp, " 9\n$DRAGMODE\n 70\n 2\n"); /* 0 = off, 1 = on, 2 = auto. */ - fprintf(fp, " 9\n$LTSCALE\n 40\n1.0\n"); /* Global linetype scale. */ - fprintf(fp, " 9\n$OSMODE\n 70\n 125\n"); /* Running object snap modes. */ - fprintf(fp, " 9\n$ATTMODE\n 70\n 1\n"); /* Attribute visibility: 0 = none, 1 = normal, 2 = all. */ - fprintf(fp, " 9\n$TEXTSIZE\n 40\n2.5\n"); /* Default text height = 2.5 mm. */ - fprintf(fp, " 9\n$TRACEWID\n 40\n1.0\n"); /* Default trace width. */ - fprintf(fp, " 9\n$TEXTSTYLE\n 7\nSTANDARD\n"); /* Current text style name. */ - fprintf(fp, " 9\n$CLAYER\n 8\n0\n"); /* Current layer name. */ - fprintf(fp, " 9\n$CELTYPE\n 6\nBYLAYER\n"); /* Entity linetype name, or BYBLOCK or BYLAYER. */ - fprintf(fp, " 9\n$CECOLOR\n 62\n 256\n"); /* Current entity color number: 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$CELTSCALE\n 40\n1.0\n"); /* Current entity linetype scale. */ - fprintf(fp, " 9\n$DELOBJ\n 70\n 1\n"); /* Controls object deletion: 0 = deleted, 1 = retained. */ - fprintf(fp, " 9\n$DISPSILH\n 70\n 0\n"); /* Controls the display of silhouette curves of body objects in wire-frame mode: 0 = Off, 1 = On. */ - fprintf(fp, " 9\n$DIMSCALE\n 40\n1.0\n"); /* Overall dimensioning scale factor. */ - fprintf(fp, " 9\n$DIMASZ\n 40\n2.5\n"); /* Dimensioning arrow size = 2.5 mm. */ - fprintf(fp, " 9\n$DIMEXO\n 40\n0.625\n"); /* Extension line offset = 0.625 mm. */ - fprintf(fp, " 9\n$DIMDLI\n 40\n3.75\n"); /* Dimension line increment = 3.75 mm. */ - fprintf(fp, " 9\n$DIMRND\n 40\n0.0\n"); /* Rounding value for dimension distances. */ - fprintf(fp, " 9\n$DIMDLE\n 40\n0.0\n"); /* Dimension line extension */ - fprintf(fp, " 9\n$DIMEXE\n 40\n1.25\n"); /* Extension line extension = 1.25 mm. */ - fprintf(fp, " 9\n$DIMTP\n 40\n0.0\n"); /* Plus tolerance. */ - fprintf(fp, " 9\n$DIMTM\n 40\n0.0\n"); /* Minus tolerance. */ - fprintf(fp, " 9\n$DIMTXT\n 40\n2.5\n"); /* Dimensioning text height = 2.5 mm. */ - fprintf(fp, " 9\n$DIMCEN\n 40\n2.5\n"); /* Size of center mark/lines = 2.5 mm. */ - fprintf(fp, " 9\n$DIMTSZ\n 40\n0.0\n"); /* Dimensioning tick size; 0 = no ticks. */ - fprintf(fp, " 9\n$DIMTOL\n 70\n 0\n"); /* Dimension tolerances generated if nonzero. */ - fprintf(fp, " 9\n$DIMLIM\n 70\n 0\n"); /* Dimension limits generated if nonzero. */ - fprintf(fp, " 9\n$DIMTIH\n 70\n 0\n"); /* Text inside horizontal if nonzero. */ - fprintf(fp, " 9\n$DIMTOH\n 70\n 0\n"); /* Text outside horizontal if nonzero. */ - fprintf(fp, " 9\n$DIMSE1\n 70\n 0\n"); /* First extension line suppressed if nonzero. */ - fprintf(fp, " 9\n$DIMSE2\n 70\n 0\n"); /* Second extension line suppressed if nonzero. */ - fprintf(fp, " 9\n$DIMTAD\n 70\n 1\n"); /* Text above dimension line if nonzero. */ - fprintf(fp, " 9\n$DIMZIN\n 70\n 8\n"); /* Controls suppression of zeros for primary unit values. */ - fprintf(fp, " 9\n$DIMBLK\n 1\n\n"); /* Arrow block name. */ - fprintf(fp, " 9\n$DIMASO\n 70\n 1\n"); /* 1 = create associative dimensioning, 0 = draw individual entities. */ - fprintf(fp, " 9\n$DIMSHO\n 70\n 1\n"); /* 1 = Recompute dimensions while dragging, 0 = drag original image. */ - fprintf(fp, " 9\n$DIMPOST\n 1\n\n"); /* General dimensioning suffix. */ - fprintf(fp, " 9\n$DIMAPOST\n 1\n\n"); /* Alternate dimensioning suffix. */ - fprintf(fp, " 9\n$DIMALT\n 70\n 0\n"); /* Alternate unit dimensioning performed if nonzero. */ - fprintf(fp, " 9\n$DIMALTD\n 70\n 4\n") /* Alternate unit decimal places. */ ; - fprintf(fp, " 9\n$DIMALTF\n 40\n0.0394\n") /* Alternate unit scale factor (mm --> mil). */ ; - fprintf(fp, " 9\n$DIMLFAC\n 40\n1.0\n"); /* Linear measurements scale factor. */ - fprintf(fp, " 9\n$DIMTOFL\n 70\n 1\n"); /* If text outside extensions, force line extensions between extensions if nonzero. */ - fprintf(fp, " 9\n$DIMTVP\n 40\n0.0\n"); /* Text vertical position. */ - fprintf(fp, " 9\n$DIMTIX\n 70\n 0\n"); /* Force text inside extensions if nonzero. */ - fprintf(fp, " 9\n$DIMSOXD\n 70\n 0\n"); /* Suppress outside-extensions dimension lines if nonzero. */ - fprintf(fp, " 9\n$DIMSAH\n 70\n 0\n"); /* Use separate arrow blocks if nonzero. */ - fprintf(fp, " 9\n$DIMBLK1\n 1\n\n"); /* First arrow block name. */ - fprintf(fp, " 9\n$DIMBLK2\n 1\n\n"); /* Second arrow block name. */ - fprintf(fp, " 9\n$DIMSTYLE\n 2\nSTANDARD\n"); /* Dimension style name. */ - fprintf(fp, " 9\n$DIMCLRD\n 70\n 0\n"); /* Dimension line color: range is 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$DIMCLRE\n 70\n 0\n"); /* Dimension extension line color: range is 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$DIMCLRT\n 70\n 0\n"); /* Dimension text color: range is 0 = BYBLOCK, 256 = BYLAYER. */ - fprintf(fp, " 9\n$DIMTFAC\n 40\n1.0\n"); /* Dimension tolerance display scale factor. */ - fprintf(fp, " 9\n$DIMGAP\n 40\n0.625\n") /* Dimension line gap. */ ; - fprintf(fp, " 9\n$DIMJUST\n 70\n 0\n"); /* Horizontal dimension text position: 0 = above dimension line and center-justified between extension lines, 1 = above dimension line and next to first extension line, 2=above dimension line and next to second extension line, 3 = above and center-justified to first extension line, 4 = above and center-justified to second extension line. */ - fprintf(fp, " 9\n$DIMSD1\n 70\n 0\n"); /* Suppression of first extension line: 0 = not suppressed, 1 = suppressed. */ - fprintf(fp, " 9\n$DIMSD2\n 70\n 0\n"); /* Suppression of second extension line: 0 = not suppressed, 1 = suppressed. */ - fprintf(fp, " 9\n$DIMTOLJ\n 70\n 1\n"); /* Vertical justification for tolerance values: 0 = Top, 1 = Middle, 2 = Bottom. */ - fprintf(fp, " 9\n$DIMTZIN\n 70\n 0\n"); /* Controls suppression of zeros for tolerance values: 0 = Suppresses zero feet and precisely zero inches; 1 = Includes zero feet and precisely zero inches; 2 = Includes zero feet and suppresses zero inches; 3 = Includes zero inches and suppresses zero feet. */ - fprintf(fp, " 9\n$DIMALTZ\n 70\n 0\n"); /* Controls suppression of zeros for alternate unit dimension values: 0 = Suppresses zero feet and precisely zero inches; 1 = Includes zero feet and precisely zero inches; 2 = Includes zero feet and suppresses zero inches; 3 = Includes zero inches and suppresses zero feet. */ - fprintf(fp, - " 9\n$DIMALTTZ\n 70\n 0\n") - /* Controls suppression of zeros for alternate tolerance values: 0 = Suppresses zero feet and precisely zero inches; 1 = Includes zero feet and precisely zero inches; 2 = Includes zero feet and suppresses zero inches; 3 = Includes zero inches and suppresses zero feet. */ - ; - fprintf(fp, " 9\n$DIMFIT\n 70\n 3\n"); /* Placement of text and arrowheads; Possible values: 0 through 3. */ - fprintf(fp, " 9\n$DIMUPT\n 70\n 0\n"); /* Cursor functionality for user positioned text: 0=controls only the dimension line location, 1=controls the text position as well as the dimension line location. */ - fprintf(fp, " 9\n$DIMUNIT\n 70\n 2\n"); /* Units format for all dimension style family members except angular: 1 = Scientific; 2 = Decimal; 3 = Engineering; 4 = Architectural (stacked); 5 = Fractional (stacked); 6 = Architectural; 7 = Fractional. */ - fprintf(fp, " 9\n$DIMDEC\n 70\n 4\n"); /* Number of decimal places for the tolerance values of a primary units dimension. */ - fprintf(fp, " 9\n$DIMTDEC\n 70\n 4\n"); /* Number of decimal places to display the tolerance values. */ - fprintf(fp, " 9\n$DIMALTU\n 70\n 2\n"); /*Units format for alternate units of all dimension style family members except angular: 1 = Scientific; 2 = Decimal; 3 = Engineering; 4 = Architectural (stacked); 5 = Fractional (stacked); 6 = Architectural; 7 = Fractional. */ - fprintf(fp, " 9\n$DIMALTTD\n 70\n 2\n"); /*Number of decimal places for tolerance values of an alternate units dimension. */ - fprintf(fp, " 9\n$DIMTXSTY\n 7\nSTANDARD\n"); /* Dimension text style. */ - fprintf(fp, " 9\n$DIMAUNIT\n 70\n 0\n"); /* Angle format for angular dimensions: 0 = Decimal degrees, 1 = Degrees/minutes/seconds, 2 = Gradians, 3=Radians, 4 = Surveyor's units. */ - fprintf(fp, " 9\n$LUNITS\n 70\n 2\n"); /* Units format for coordinates and distances. */ - fprintf(fp, " 9\n$LUPREC\n 70\n 4\n"); /* Units precision for coordinates and distances. */ - fprintf(fp, " 9\n$SKETCHINC\n 40\n1.0\n"); /* Sketch record increment. */ - fprintf(fp, " 9\n$FILLETRAD\n 40\n1.0\n"); /* Fillet radius. */ - fprintf(fp, " 9\n$AUNITS\n 70\n 0\n"); /* Units format for angles. */ - fprintf(fp, " 9\n$AUPREC\n 70\n 0\n"); /* Units precision for angles. */ - fprintf(fp, " 9\n$MENU\n 1\n.\n"); /* Name of menu file. */ - fprintf(fp, " 9\n$ELEVATION\n 40\n0.0\n"); /* Current elevation set by ELEV command. */ - fprintf(fp, " 9\n$PELEVATION\n 40\n0.0\n") /* Current paper space elevation. */ ; - fprintf(fp, " 9\n$THICKNESS\n 40\n0.0\n"); /* Current thickness set by ELEV command. */ - fprintf(fp, " 9\n$LIMCHECK\n 70\n 0\n"); /* Nonzero if limits checking is on. */ - fprintf(fp, " 9\n$BLIPMODE\n 70\n 0\n"); /* Blip mode on if nonzero. */ - fprintf(fp, " 9\n$CHAMFERA\n 40\n10.0\n"); /* First chamfer distance. */ - fprintf(fp, " 9\n$CHAMFERB\n 40\n10.0\n"); /* Second chamfer distance. */ - fprintf(fp, " 9\n$CHAMFERC\n 40\n0.0\n"); /* Chamfer length. */ - fprintf(fp, " 9\n$CHAMFERD\n 40\n0.0\n"); /* Chamfer angle. */ - fprintf(fp, " 9\n$SKPOLY\n 70\n 0\n"); /* 0 = sketch lines, 1 = sketch polylines. */ - fprintf(fp, " 9\n$TDCREATE\n 40\n0.0\n"); /* Date/time of drawing creation. */ - fprintf(fp, " 9\n$TDUPDATE\n 40\n0.0\n"); /* Date/time of last drawing update. */ - fprintf(fp, " 9\n$TDINDWG\n 40\n0.0\n"); /* Cumulative editing time for this drawing. */ - fprintf(fp, " 9\n$TDUSRTIMER\n 40\n0.0\n"); /* User elapsed timer. */ - fprintf(fp, " 9\n$USRTIMER\n 70\n 1\n"); /* 0 = timer off, 1 = timer on. */ - fprintf(fp, " 9\n$ANGBASE\n 50\n0.0\n"); /* Angle 0 direction . */ - fprintf(fp, " 9\n$ANGDIR\n 70\n 0\n"); /* 1 = clockwise angles, 0 = counterclockwise. */ - fprintf(fp, " 9\n$PDMODE\n 70\n 98\n"); /* Point display mode. */ - fprintf(fp, " 9\n$PDSIZE\n 40\n0.0\n"); /* Point display size. */ - fprintf(fp, " 9\n$PLINEWID\n 40\n0.0\n"); /* Default polyline width. */ - fprintf(fp, " 9\n$COORDS\n 70\n 2\n"); /* Coordinate display: 0 = static, 1 = continuous update, 2 = "d - *
  • HEADER section - *
  • CLASSES section - *
  • TABLES section - *
      - *
    • VPORT table - *
    • LTYPE table - *
    • LAYER table - *
    • STYLE table - *
    • VIEW table - *
    • UCS table - *
    • APPID table - *
    • DIMSTYLE table - *
    - * - * Continue from here with writing a BLOCK_RECORD table and close the section - * with an ENDSEC marker. - */ -static void dxf_write_header() -{ - FILE *f_temp; - char *temp = NULL; - static char *dxf_header_filename; - - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_header () function.\n", __FILE__, __LINE__); -#endif - if (dxf_metric) { - dxf_header_filename = pcb_strdup("hid/dxf/template/metric_header.dxf"); - } - else { - dxf_header_filename = pcb_strdup("hid/dxf/template/imperial_header.dxf"); - } - /* check if template metric header file exists and open file - * read-only */ - f_temp = fopen(dxf_header_filename, "r"); - if (f_temp) { - /* do until EOF of the template file: - * copy line by line from template file (f_temp) to - * destination file (fp) */ - while (!feof(f_temp)) { - fscanf(f_temp, "%s", temp); - fprintf(fp, "%s", temp); - } - /* when we're done close the template file */ - fclose(f_temp); - } - else { - gui->log("Error in dxf_write_header_from_template (): cannot open file %s for reading.\n", dxf_header_filename); - if (dxf_metric) { - dxf_write_header_metric_new(); - } - else { - dxf_write_header_imperial_new(); - } - } - /* write a block record table */ - dxf_write_table_block_record(fp); - /* write ENDSEC marker to close the header */ - dxf_write_endsection(fp); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_header () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for an imperial DXF footer. - * - * Included sections are:\n - *
      - *
    • OBJECTS section - *
    • THUMBNAILIMAGE section - *
    - */ -static void dxf_write_footer_imperial_new() -{ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_footer_imperial_new () function.\n", __FILE__, __LINE__); -#endif - fprintf(fp, "0\nSECTION\n"); - fprintf(fp, " 2\nOBJECTS\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\nC\n"); - fprintf(fp, "330\n0\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nACAD_COLOR\n"); - fprintf(fp, "350\n75\n"); - fprintf(fp, " 3\nACAD_GROUP\n"); - fprintf(fp, "350\nD\n"); - fprintf(fp, " 3\nACAD_LAYOUT\n"); - fprintf(fp, "350\n76\n"); - fprintf(fp, " 3\nACAD_MATERIAL\n"); - fprintf(fp, "350\n74\n"); - fprintf(fp, " 3\nACAD_MLINESTYLE\n"); - fprintf(fp, "350\n1B\n"); - fprintf(fp, "3\nACAD_PLOTSETTINGS\n"); - fprintf(fp, "350\n77\n"); - fprintf(fp, " 3\nACAD_PLOTSTYLENAME\n"); - fprintf(fp, "350\n72\n"); - fprintf(fp, " 3\nAVE_ACITABLE\n"); - fprintf(fp, "350\n51\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n75\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\nD\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n76\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nLayout1\n"); - fprintf(fp, "350\n79\n"); - fprintf(fp, " 3\nModel\n"); - fprintf(fp, "350\n78\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n74\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n1B\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nSTANDARD\n"); - fprintf(fp, "350\n1C\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n77\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nACDBDICTIONARYWDFLT\n"); - fprintf(fp, " 5\n72\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nNormal\n"); - fprintf(fp, "350\n73\n"); - fprintf(fp, "100\nAcDbDictionaryWithDefault\n"); - fprintf(fp, "340\n73\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n51\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nLAYOUT\n"); - fprintf(fp, " 5\n79\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "100\nAcDbPlotSettings\n"); - fprintf(fp, " 1\n\n"); - fprintf(fp, " 2\n\\\\NO_SERVER\\NO_PRINTER\n"); - fprintf(fp, " 4\n\n"); - fprintf(fp, " 6\n\n"); - fprintf(fp, " 40\n0.0\n"); - fprintf(fp, " 41\n0.0\n"); - fprintf(fp, " 42\n0.0\n"); - fprintf(fp, " 43\n0.0\n"); - fprintf(fp, " 44\n0.0\n"); - fprintf(fp, " 45\n0.0\n"); - fprintf(fp, " 46\n0.0\n"); - fprintf(fp, " 47\n0.0\n"); - fprintf(fp, " 48\n0.0\n"); - fprintf(fp, " 49\n0.0\n"); - fprintf(fp, "140\n0.0\n"); - fprintf(fp, "141\n0.0\n"); - fprintf(fp, "142\n1.0\n"); - fprintf(fp, "143\n1.0\n"); - fprintf(fp, " 70\n 688\n"); - fprintf(fp, " 72\n 0\n"); - fprintf(fp, " 73\n 0\n"); - fprintf(fp, " 74\n 5\n"); - fprintf(fp, " 7\n\n"); - fprintf(fp, " 75\n 16\n"); - fprintf(fp, "147\n1.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, " 77\n 2\n"); - fprintf(fp, " 78\n 300\n"); - fprintf(fp, "148\n0.0\n"); - fprintf(fp, "149\n0.0\n"); - fprintf(fp, "100\nAcDbLayout\n"); - fprintf(fp, " 1\nLayout1\n"); - fprintf(fp, " 70\n 1\n"); - fprintf(fp, " 71\n 1\n"); - fprintf(fp, " 10\n0.0\n"); - fprintf(fp, " 20\n0.0\n"); - fprintf(fp, " 11\n17.0\n"); - fprintf(fp, " 21\n11.0\n"); - fprintf(fp, " 12\n0.0\n"); - fprintf(fp, " 22\n0.0\n"); - fprintf(fp, " 32\n0.0\n"); - fprintf(fp, " 14\n1.000000000000000E+20\n"); - fprintf(fp, " 24\n1.000000000000000E+20\n"); - fprintf(fp, " 34\n1.000000000000000E+20\n"); - fprintf(fp, " 15\n-1.000000000000000E+20\n"); - fprintf(fp, " 25\n-1.000000000000000E+20\n"); - fprintf(fp, " 35\n-1.000000000000000E+20\n"); - fprintf(fp, "146\n0.0\n"); - fprintf(fp, " 13\n0.0\n"); - fprintf(fp, " 23\n0.0\n"); - fprintf(fp, " 33\n0.0\n"); - fprintf(fp, " 16\n1.0\n"); - fprintf(fp, " 26\n0.0\n"); - fprintf(fp, " 36\n0.0\n"); - fprintf(fp, " 17\n0.0\n"); - fprintf(fp, " 27\n1.0\n"); - fprintf(fp, " 37\n0.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, "330\n15\n"); - fprintf(fp, " 0\nLAYOUT\n"); - fprintf(fp, " 5\n78\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "100\nAcDbPlotSettings\n"); - fprintf(fp, " 1\n\n"); - fprintf(fp, " 2\n\\\\NO_SERVER\\NO_PRINTER\n"); - fprintf(fp, " 4\n\n"); - fprintf(fp, " 6\n\n"); - fprintf(fp, " 40\n0.0\n"); - fprintf(fp, " 41\n0.0\n"); - fprintf(fp, " 42\n0.0\n"); - fprintf(fp, " 43\n0.0\n"); - fprintf(fp, " 44\n0.0\n"); - fprintf(fp, " 45\n0.0\n"); - fprintf(fp, " 46\n0.0\n"); - fprintf(fp, " 47\n0.0\n"); - fprintf(fp, " 48\n0.0\n"); - fprintf(fp, " 49\n0.0\n"); - fprintf(fp, "140\n0.0\n"); - fprintf(fp, "141\n0.0\n"); - fprintf(fp, "142\n1.0\n"); - fprintf(fp, "143\n1.0\n"); - fprintf(fp, " 70\n 1712\n"); - fprintf(fp, " 72\n 0\n"); - fprintf(fp, " 73\n 0\n"); - fprintf(fp, " 74\n 0\n"); - fprintf(fp, " 7\n\n"); - fprintf(fp, " 75\n 0\n"); - fprintf(fp, "147\n1.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, " 77\n 2\n"); - fprintf(fp, " 78\n 300\n"); - fprintf(fp, "148\n0.0\n"); - fprintf(fp, "149\n0.0\n"); - fprintf(fp, "100\nAcDbLayout\n"); - fprintf(fp, " 1\nModel\n"); - fprintf(fp, " 70\n 1\n"); - fprintf(fp, " 71\n 0\n"); - fprintf(fp, " 10\n0.0\n"); - fprintf(fp, " 20\n0.0\n"); - fprintf(fp, " 11\n17.0\n"); - fprintf(fp, " 21\n11.0\n"); - fprintf(fp, " 12\n0.0\n"); - fprintf(fp, " 22\n0.0\n"); - fprintf(fp, " 32\n0.0\n"); - fprintf(fp, " 14\n0.0\n"); - fprintf(fp, " 24\n0.0\n"); - fprintf(fp, " 34\n0.0\n"); - fprintf(fp, " 15\n0.0\n"); - fprintf(fp, " 25\n0.0\n"); - fprintf(fp, " 35\n0.0\n"); - fprintf(fp, "146\n0.0\n"); - fprintf(fp, " 13\n0.0\n"); - fprintf(fp, " 23\n0.0\n"); - fprintf(fp, " 33\n0.0\n"); - fprintf(fp, " 16\n1.0\n"); - fprintf(fp, " 26\n0.0\n"); - fprintf(fp, " 36\n0.0\n"); - fprintf(fp, " 17\n0.0\n"); - fprintf(fp, " 27\n1.0\n"); - fprintf(fp, " 37\n0.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, "330\n18\n"); - fprintf(fp, " 0\nMLINESTYLE\n"); - fprintf(fp, " 5\n1C\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n1B\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n1B\n"); - fprintf(fp, "100\nAcDbMlineStyle\n"); - fprintf(fp, " 2\nSTANDARD\n"); - fprintf(fp, " 70\n 0\n"); - fprintf(fp, " 3\n\n"); - fprintf(fp, " 62\n 256\n"); - fprintf(fp, " 51\n90.0\n"); - fprintf(fp, " 52\n90.0\n"); - fprintf(fp, " 71\n 2\n"); - fprintf(fp, " 49\n0.5\n"); - fprintf(fp, " 62\n 256\n"); - fprintf(fp, " 6\nBYLAYER\n"); - fprintf(fp, " 49\n-0.5\n"); - fprintf(fp, " 62\n 256\n"); - fprintf(fp, " 6\nBYLAYER\n"); - fprintf(fp, " 0\nACDBPLACEHOLDER\n"); - fprintf(fp, " 5\n73\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n72\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n72\n"); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_footer_imperial_new () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a metric DXF footer. - * - * Included sections are:\n - *
      - *
    • OBJECTS section - *
    • THUMBNAILIMAGE section - *
    - */ -static void dxf_write_footer_metric_new() -{ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_footer_metric_new () function.\n", __FILE__, __LINE__); -#endif - fprintf(fp, "0\nSECTION\n"); - fprintf(fp, " 2\nOBJECTS\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\nC\n"); - fprintf(fp, "330\n0\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nACAD_COLOR\n"); - fprintf(fp, "350\n75\n"); - fprintf(fp, " 3\nACAD_GROUP\n"); - fprintf(fp, "350\nD\n"); - fprintf(fp, " 3\nACAD_LAYOUT\n"); - fprintf(fp, "350\n76\n"); - fprintf(fp, " 3\nACAD_MATERIAL\n"); - fprintf(fp, "350\n74\n"); - fprintf(fp, " 3\nACAD_MLINESTYLE\n"); - fprintf(fp, "350\n1B\n"); - fprintf(fp, "3\nACAD_PLOTSETTINGS\n"); - fprintf(fp, "350\n77\n"); - fprintf(fp, " 3\nACAD_PLOTSTYLENAME\n"); - fprintf(fp, "350\n72\n"); - fprintf(fp, " 3\nAVE_ACITABLE\n"); - fprintf(fp, "350\n51\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n75\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\nD\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n76\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nLayout1\n"); - fprintf(fp, "350\n79\n"); - fprintf(fp, " 3\nModel\n"); - fprintf(fp, "350\n78\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n74\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n1B\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nSTANDARD\n"); - fprintf(fp, "350\n1C\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n77\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nACDBDICTIONARYWDFLT\n"); - fprintf(fp, " 5\n72\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 3\nNormal\n"); - fprintf(fp, "350\n73\n"); - fprintf(fp, "100\nAcDbDictionaryWithDefault\n"); - fprintf(fp, "340\n73\n"); - fprintf(fp, " 0\nDICTIONARY\n"); - fprintf(fp, " 5\n51\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\nC\n"); - fprintf(fp, "100\nAcDbDictionary\n"); - fprintf(fp, "281\n 1\n"); - fprintf(fp, " 0\nLAYOUT\n"); - fprintf(fp, " 5\n79\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "100\nAcDbPlotSettings\n"); - fprintf(fp, " 1\n\n"); - fprintf(fp, " 2\n\\\\NO_SERVER\\NO_PRINTER\n"); - fprintf(fp, " 4\n\n"); - fprintf(fp, " 6\n\n"); - fprintf(fp, " 40\n0.0\n"); - fprintf(fp, " 41\n0.0\n"); - fprintf(fp, " 42\n0.0\n"); - fprintf(fp, " 43\n0.0\n"); - fprintf(fp, " 44\n0.0\n"); - fprintf(fp, " 45\n0.0\n"); - fprintf(fp, " 46\n0.0\n"); - fprintf(fp, " 47\n0.0\n"); - fprintf(fp, " 48\n0.0\n"); - fprintf(fp, " 49\n0.0\n"); - fprintf(fp, "140\n0.0\n"); - fprintf(fp, "141\n0.0\n"); - fprintf(fp, "142\n1.0\n"); - fprintf(fp, "143\n1.0\n"); - fprintf(fp, " 70\n 688\n"); - fprintf(fp, " 72\n 0\n"); - fprintf(fp, " 73\n 0\n"); - fprintf(fp, " 74\n 5\n"); - fprintf(fp, " 7\n\n"); - fprintf(fp, " 75\n 16\n"); - fprintf(fp, "147\n1.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, " 77\n 2\n"); - fprintf(fp, " 78\n 300\n"); - fprintf(fp, "148\n0.0\n"); - fprintf(fp, "149\n0.0\n"); - fprintf(fp, "100\nAcDbLayout\n"); - fprintf(fp, " 1\nLayout1\n"); - fprintf(fp, " 70\n 1\n"); - fprintf(fp, " 71\n 1\n"); - fprintf(fp, " 10\n0.0\n"); - fprintf(fp, " 20\n0.0\n"); - fprintf(fp, " 11\n420.0\n"); - fprintf(fp, " 21\n297.0\n"); - fprintf(fp, " 12\n0.0\n"); - fprintf(fp, " 22\n0.0\n"); - fprintf(fp, " 32\n0.0\n"); - fprintf(fp, " 14\n1.000000000000000E+20\n"); - fprintf(fp, " 24\n1.000000000000000E+20\n"); - fprintf(fp, " 34\n1.000000000000000E+20\n"); - fprintf(fp, " 15\n-1.000000000000000E+20\n"); - fprintf(fp, " 25\n-1.000000000000000E+20\n"); - fprintf(fp, " 35\n-1.000000000000000E+20\n"); - fprintf(fp, "146\n0.0\n"); - fprintf(fp, " 13\n0.0\n"); - fprintf(fp, " 23\n0.0\n"); - fprintf(fp, " 33\n0.0\n"); - fprintf(fp, " 16\n1.0\n"); - fprintf(fp, " 26\n0.0\n"); - fprintf(fp, " 36\n0.0\n"); - fprintf(fp, " 17\n0.0\n"); - fprintf(fp, " 27\n1.0\n"); - fprintf(fp, " 37\n0.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, "330\n15\n"); - fprintf(fp, " 0\nLAYOUT\n"); - fprintf(fp, " 5\n78\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n76\n"); - fprintf(fp, "100\nAcDbPlotSettings\n"); - fprintf(fp, " 1\n\n"); - fprintf(fp, " 2\n\\\\NO_SERVER\\NO_PRINTER\n"); - fprintf(fp, " 4\n\n"); - fprintf(fp, " 6\n\n"); - fprintf(fp, " 40\n0.0\n"); - fprintf(fp, " 41\n0.0\n"); - fprintf(fp, " 42\n0.0\n"); - fprintf(fp, " 43\n0.0\n"); - fprintf(fp, " 44\n0.0\n"); - fprintf(fp, " 45\n0.0\n"); - fprintf(fp, " 46\n0.0\n"); - fprintf(fp, " 47\n0.0\n"); - fprintf(fp, " 48\n0.0\n"); - fprintf(fp, " 49\n0.0\n"); - fprintf(fp, "140\n0.0\n"); - fprintf(fp, "141\n0.0\n"); - fprintf(fp, "142\n1.0\n"); - fprintf(fp, "143\n1.0\n"); - fprintf(fp, " 70\n 1712\n"); - fprintf(fp, " 72\n 0\n"); - fprintf(fp, " 73\n 0\n"); - fprintf(fp, " 74\n 0\n"); - fprintf(fp, " 7\n\n"); - fprintf(fp, " 75\n 0\n"); - fprintf(fp, "147\n1.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, " 77\n 2\n"); - fprintf(fp, " 78\n 300\n"); - fprintf(fp, "148\n0.0\n"); - fprintf(fp, "149\n0.0\n"); - fprintf(fp, "100\nAcDbLayout\n"); - fprintf(fp, " 1\nModel\n"); - fprintf(fp, " 70\n 1\n"); - fprintf(fp, " 71\n 0\n"); - fprintf(fp, " 10\n0.0\n"); - fprintf(fp, " 20\n0.0\n"); - fprintf(fp, " 11\n12.0\n"); - fprintf(fp, " 21\n9.0\n"); - fprintf(fp, " 12\n0.0\n"); - fprintf(fp, " 22\n0.0\n"); - fprintf(fp, " 32\n0.0\n"); - fprintf(fp, " 14\n0.0\n"); - fprintf(fp, " 24\n0.0\n"); - fprintf(fp, " 34\n0.0\n"); - fprintf(fp, " 15\n0.0\n"); - fprintf(fp, " 25\n0.0\n"); - fprintf(fp, " 35\n0.0\n"); - fprintf(fp, "146\n0.0\n"); - fprintf(fp, " 13\n0.0\n"); - fprintf(fp, " 23\n0.0\n"); - fprintf(fp, " 33\n0.0\n"); - fprintf(fp, " 16\n1.0\n"); - fprintf(fp, " 26\n0.0\n"); - fprintf(fp, " 36\n0.0\n"); - fprintf(fp, " 17\n0.0\n"); - fprintf(fp, " 27\n1.0\n"); - fprintf(fp, " 37\n0.0\n"); - fprintf(fp, " 76\n 0\n"); - fprintf(fp, "330\n18\n"); - fprintf(fp, " 0\nMLINESTYLE\n"); - fprintf(fp, " 5\n1C\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n1B\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n1B\n"); - fprintf(fp, "100\nAcDbMlineStyle\n"); - fprintf(fp, " 2\nSTANDARD\n"); - fprintf(fp, " 70\n 0\n"); - fprintf(fp, " 3\n\n"); - fprintf(fp, " 62\n 256\n"); - fprintf(fp, " 51\n90.0\n"); - fprintf(fp, " 52\n90.0\n"); - fprintf(fp, " 71\n 2\n"); - fprintf(fp, " 49\n0.5\n"); - fprintf(fp, " 62\n 256\n"); - fprintf(fp, " 6\nBYLAYER\n"); - fprintf(fp, " 49\n-0.5\n"); - fprintf(fp, " 62\n 256\n"); - fprintf(fp, " 6\nBYLAYER\n"); - fprintf(fp, " 0\nACDBPLACEHOLDER\n"); - fprintf(fp, " 5\n73\n"); - fprintf(fp, "102\n{ACAD_REACTORS\n"); - fprintf(fp, "330\n72\n"); - fprintf(fp, "102\n}\n"); - fprintf(fp, "330\n72\n"); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_footer_metric_new () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a DXF footer. - * - * Depending on the metric/imperial units setting a footer will be - * appended to a DXF file.\n - * If a custom metric/imperial DXF footer file is available this will be - * used, if not aavailable a fall back functions will be called for - * appending a default metric/imperial footer. - */ -static void dxf_write_footer() -{ - FILE *f_temp; - char *temp = NULL; - static char *dxf_footer_filename; - - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_footer () function.\n", __FILE__, __LINE__); -#endif - if (dxf_metric) { - dxf_footer_filename = pcb_strdup("hid/dxf/template/metric_footer.dxf"); - } - else { - dxf_footer_filename = pcb_strdup("hid/dxf/template/imperial_footer.dxf"); - } - /* check if template metric footer file exists and open file - * read-only */ - f_temp = fopen(dxf_footer_filename, "r"); - if (f_temp) { - /* do until EOF of the template file: - * copy line by line from template file (f_temp) to - * destination file (fp) */ - while (!feof(f_temp)) { - fscanf(f_temp, "%s", temp); - fprintf(fp, "%s", temp); - } - /* when we're done close the template file */ - fclose(f_temp); - } - else { - gui->log("Error in dxf_write_footer (): cannot open file %s for reading.\n", dxf_footer_filename); - if (dxf_metric) { - dxf_write_footer_metric_new(); - } - else { - dxf_write_footer_imperial_new(); - } - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_footer () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for an insert entity. - */ -static void dxf_write_insert(FILE * fp, - /*!< file pointer to output file (or device). */ - int id_code, - /*!< group code = 5. */ - char *block_name, - /*!< group code = 2. */ - char *linetype, - /*!< group code = 6\n - * optional, if omitted defaults to \c BYLAYER. */ - char *layer, - /*!< group code = 8. */ - double x0, - /*!< group code = 10\n - * base point. */ - double y0, - /*!< group code = 20\n - * base point. */ - double z0, - /*!< group code = 30\n - * base point. */ - double thickness, - /*!< group code = 39\n - * optional, if omitted defaults to 0.0. */ - double rel_x_scale, - /*!< group code = 41\n - * optional, if omitted defaults to 1.0. */ - double rel_y_scale, - /*!< group code = 42\n - * optional, if omitted defaults to 1.0. */ - double rel_z_scale, - /*!< group code = 43\n - * optional, if omitted defaults to 1.0. */ - double column_spacing, - /*!< group code = 44\n - * optional, if omitted defaults to 0.0. */ - double row_spacing, - /*!< group code = 45\n - * optional, if omitted defaults to 0.0. */ - double rot_angle, - /*!< group code = 50\n - * optional, if omitted defaults to 0.0. */ - int color, - /*!< group code = 62\n - * optional, if omitted defaults to \c BYLAYER. */ - int attribute_follows, - /*!< group code = 66\n - * optional, if omitted defaults to 0. */ - int paperspace, - /*!< group code = 67\n - * optional, if omitted defaults to 0 (modelspace). */ - int columns, - /*!< group code = 70\n - * optional, if omitted defaults to 1. */ - int rows - /*!< group code = 71\n - * optional, if omitted defaults to 1. */ - ) { - char *dxf_entity_name; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_insert () function.\n", __FILE__, __LINE__); - fprintf(stderr, "[DXF entity with ID code %x]\n", id_code); -#endif - dxf_entity_name = pcb_strdup("INSERT"); - if (strcmp(block_name, "") == 0) { - fprintf(stderr, "Warning: empty block name string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is discarded from output.\n", dxf_entity_name); - return; - } - if (strcmp(layer, "") == 0) { - fprintf(stderr, "Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is relocated to layer 0.\n", dxf_entity_name); - layer = pcb_strdup(DXF_DEFAULT_LAYER); - } - if (rel_x_scale == 0.0) { - fprintf(stderr, "Warning: relative X-scale factor has a value of 0.0 for the %s entity with id-code: %x\n", dxf_entity_name, - id_code); - fprintf(stderr, " default relative X-scale of 1.0 applied to %s entity.\n", dxf_entity_name); - rel_x_scale = 1.0; - } - if (rel_y_scale == 0.0) { - fprintf(stderr, "Warning: relative Y-scale factor has a value of 0.0 for the %s entity with id-code: %x\n", dxf_entity_name, - id_code); - fprintf(stderr, " default relative Y-scale of 1.0 applied to %s entity.\n", dxf_entity_name); - rel_y_scale = 1.0; - } - if (rel_z_scale == 0.0) { - fprintf(stderr, "Warning: relative Z-scale factor has a value of 0.0 for the %s entity with id-code: %x\n", dxf_entity_name, - id_code); - fprintf(stderr, " default relative Z-scale of 1.0 applied to %s entity.\n", dxf_entity_name); - rel_z_scale = 1.0; - } - if ((columns > 1) && (column_spacing == 0.0)) { - fprintf(stderr, - "Warning: number of columns is greater than 1 and the column spacing has a value of 0.0 for the %s entity with id-code: %x\n", - dxf_entity_name, id_code); - fprintf(stderr, " default number of columns value of 1 applied to %s entity.\n", dxf_entity_name); - columns = 1; - } - if ((rows > 1) && (row_spacing == 0.0)) { - fprintf(stderr, - "Warning: number of rows is greater than 1 and the row spacing has a value of 0.0 for the %s entity with id-code: %x\n", - dxf_entity_name, id_code); - fprintf(stderr, " default number of rows value of 1 applied to %s entity.\n", dxf_entity_name); - rows = 1; - } - fprintf(fp, " 0\n%s\n", dxf_entity_name); - fprintf(fp, " 2\n%s\n", block_name); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - if (strcmp(linetype, DXF_DEFAULT_LINETYPE) != 0) { - fprintf(fp, " 6\n%s\n", linetype); - } - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - if (thickness != 0.0) { - fprintf(fp, " 39\n%f\n", thickness); - } - if (rel_x_scale != 1.0) { - fprintf(fp, " 41\n%f\n", rel_x_scale); - } - if (rel_y_scale != 1.0) { - fprintf(fp, " 42\n%f\n", rel_y_scale); - } - if (rel_z_scale != 1.0) { - fprintf(fp, " 43\n%f\n", rel_z_scale); - } - if ((columns > 1) && (column_spacing > 0.0)) { - fprintf(fp, " 44\n%f\n", column_spacing); - } - if ((rows > 1) && (row_spacing > 0.0)) { - fprintf(fp, " 45\n%f\n", row_spacing); - } - if (rot_angle != 0.0) { - fprintf(fp, " 50\n%f\n", rot_angle); - } - if (color != DXF_COLOR_BYLAYER) { - fprintf(fp, " 62\n%d\n", color); - } - if (attribute_follows != 0) { - fprintf(fp, " 66\n%d\n", attribute_follows); - } - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } - if (columns > 1) { - fprintf(fp, " 70\n%d\n", columns); - } - if (rows > 1) { - fprintf(fp, " 71\n%d\n", rows); - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_insert () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a polyline entity. - * - * Following the Polyline header is a sequence of Vertex entities that - * specify the vertex coordinates and faces that compose the mesh.\n - * Vertices such as these are described in the following subsection on - * Vertex.\n - * \n - * Applications might want to represent polygons with an arbitrarily large - * number of sides in polyface meshes.\n - * However, the AutoCAD entity structure imposes a limit on the number of - * vertices that a given face entity can specify.\n - * You can represent more complex polygons by decomposing them into triangular - * wedges.\n - */ -static void dxf_write_polyline(FILE * fp, - /*!< file pointer to output device */ - int id_code, - /*!< group code = 5 */ - char *linetype, - /*!< group code = 6 \n optional, if omitted defaults to BYLAYER */ - char *layer, - /*!< group code = 8 */ - double x0, - /*!< group code = 10 \n if omitted defaults to 0.0 */ - double y0, - /*!< group code = 20 \n if omitted defaults to 0.0 */ - double z0, - /*!< group code = 30 \n default elevation for vertices */ - double extr_x0, - /*!< group code = 210 \n extrusion direction \n optional, if ommited defaults to 0.0 */ - double extr_y0, - /*!< group code = 220 \n extrusion direction \n optional, if ommited defaults to 0.0 */ - double extr_z0, - /*!< group code = 230 \n extrusion direction \n optional, if ommited defaults to 1.0 */ - double thickness, - /*!< group code = 39 \n optional, if omitted defaults to 0.0 */ - double start_width, - /*!< group code = 40 \n optional, if omitted defaults to 0.0 */ - double end_width, - /*!< group code = 41 \n optional, if omitted defaults to 0.0 */ - int color, - /*!< group code = 62 \n optional, if omitted defaults to BYLAYER */ - int vertices_follow, - /*!< group code = 66 \n mandatory, always 1 (one or more vertices make up a polyline) */ - int paperspace, - /*!< group code = 67 \n optional, if omitted defaults to 0 (modelspace) */ - int flag, - /*!< group code = 70 \n optional, if omitted defaults to 0 */ - /*!< 1 = This is a closed Polyline (or a polygon mesh closed in the M direction) \n */ - /*!< 2 = Curve-fit vertices have been added \n */ - /*!< 4 = Spline-fit vertices have been added \n */ - /*!< 8 = This is a 3D Polyline \n */ - /*!< 16 = This is a 3D polygon mesh. \n */ - /*!< 32 = The polygon mesh is closed in the N direction \n */ - /*!< 64 = This Polyline is a polyface mesh \n */ - /*!< 128 = The linetype pattern is generated continuously around the vertices of this Polyline */ - int polygon_mesh_M_vertex_count, - /*!< group code = 71 \n optional, if omitted defaults to 0 */ - int polygon_mesh_N_vertex_count, - /*!< group code = 72 \n optional, if omitted defaults to 0 */ - int smooth_M_surface_density, - /*!< group code = 73 \n optional, if omitted defaults to 0 */ - int smooth_N_surface_density, - /*!< group code = 74 \n optional, if omitted defaults to 0 */ - int surface_type - /*!< group code = 75 \n optional, if omitted defaults to 0 \n integer coded, not bit-coded: \n */ - /*!< 0 = no smooth surface fitted \n */ - /*!< 5 = quadratic B-spline surface \n */ - /*!< 6 = cubic B-spline surface \n */ - /*!< 8 = Bezier surface \n */ - ) { - char *dxf_entity_name; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_polyline () function.\n", __FILE__, __LINE__); - fprintf(stderr, "[DXF entity with code %x]\n", id_code); -#endif - dxf_entity_name = pcb_strdup("POLYLINE"); - if (x0 != 0.0) { - fprintf(stderr, "Warning: start point has an invalid X-value for the %s entity with id-code: %x\n", dxf_entity_name, - id_code); - fprintf(stderr, " %s entity is discarded from output.\n", dxf_entity_name); - return; - } - if (y0 != 0.0) { - fprintf(stderr, "Warning: start point has an invalid Y-value for the %s entity with id-code: %x\n", dxf_entity_name, - id_code); - fprintf(stderr, " %s entity is discarded from output.\n", dxf_entity_name); - return; - } - if (vertices_follow != 1) { - fprintf(stderr, "Warning: vertices follow flag has an invalid value for the %s entity with id-code: %x\n", dxf_entity_name, - id_code); - fprintf(stderr, " %s entity is discarded from output.\n", dxf_entity_name); - return; - } - if (strcmp(layer, "") == 0) { - fprintf(stderr, "Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is relocated to layer 0\n", dxf_entity_name); - layer = pcb_strdup(DXF_DEFAULT_LAYER); - } - fprintf(fp, " 0\n%s\n", dxf_entity_name); - fprintf(fp, "100\nAcDb3dPolyline\n"); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - if (strcmp(linetype, DXF_DEFAULT_LINETYPE) != 0) { - fprintf(fp, " 6\n%s\n", linetype); - } - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - fprintf(fp, "210\n%f\n", extr_x0); - fprintf(fp, "220\n%f\n", extr_y0); - fprintf(fp, "230\n%f\n", extr_z0); - if (thickness != 0.0) { - fprintf(fp, " 39\n%f\n", thickness); - } - if (start_width != 0.0) { - fprintf(fp, " 40\n%f\n", start_width); - } - if (end_width != 0.0) { - fprintf(fp, " 41\n%f\n", end_width); - } - if (color != DXF_COLOR_BYLAYER) { - fprintf(fp, " 62\n%d\n", color); - } - fprintf(fp, " 66\n%d\n", vertices_follow); - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } - fprintf(fp, " 70\n%d\n", flag); - fprintf(fp, " 71\n%d\n", polygon_mesh_M_vertex_count); - fprintf(fp, " 72\n%d\n", polygon_mesh_N_vertex_count); - fprintf(fp, " 73\n%d\n", smooth_M_surface_density); - fprintf(fp, " 74\n%d\n", smooth_N_surface_density); - fprintf(fp, " 75\n%d\n", surface_type); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_polyline () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a section marker. - */ -static void dxf_write_section(FILE * fp, - /*!< file pointer to output device */ - char *section_name - /*!< section name */ - ) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_section () function.\n", __FILE__, __LINE__); -#endif - /* no use in writing an empty string to file */ - if (strcmp(section_name, "") == 0) { - return; - } - fprintf(fp, " 0\nSECTION\n 2\n%s\n", section_name); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_section () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a solid entity. - */ -static void dxf_write_solid(FILE * fp, - /*!< file pointer to output device */ - int id_code, - /*!< group code = 5 */ - char *linetype, - /*!< group code = 6 \n optional, defaults to BYLAYER */ - char *layer, - /*!< group code = 8 */ - double x0, - /*!< group code = 10 \n base point X-value, bottom left */ - double y0, - /*!< group code = 20 \n base point Y-value, bottom left */ - double z0, - /*!< group code = 30 \n base point Z-value, bottom left */ - double x1, - /*!< group code = 11 \n alignment point X-vaule, bottom right */ - double y1, - /*!< group code = 21 \n alignment point Y-vaule, bottom right */ - double z1, - /*!< group code = 31 \n alignment point Z-vaule, bottom right */ - double x2, - /*!< group code = 12 \n alignment point X-value, top left */ - double y2, - /*!< group code = 22 \n alignment point Y-value, top left */ - double z2, - /*!< group code = 32 \n alignment point Z-value, top left */ - double x3, - /*!< group code = 13 \n alignment point X-value, top right */ - double y3, - /*!< group code = 23 \n alignment point Y-value, top right */ - double z3, - /*!< group code = 33 \n alignment point Z-value, top right */ - double thickness, - /*!< group code = 39 \n optional, defaults to 0.0 */ - int color, - /*!< group code = 62 \n optional, defaults to BYLAYER */ - int paperspace - /*!< group code = 67 \n optional, defaults to 0 (modelspace) */ - ) { - char *dxf_entity_name; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_solid () function.\n", __FILE__, __LINE__); - fprintf(stderr, "[DXF entity with code %x]\n", id_code); -#endif - dxf_entity_name = pcb_strdup("SOLID"); - if (strcmp(layer, "") == 0) { - fprintf(stderr, "Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is relocated to layer 0", dxf_entity_name); - layer = pcb_strdup(DXF_DEFAULT_LAYER); - } - fprintf(fp, " 0\n%s\n", dxf_entity_name); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - if (strcmp(linetype, DXF_DEFAULT_LINETYPE) != 0) { - fprintf(fp, " 6\n%s\n", linetype); - } - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - fprintf(fp, " 11\n%f\n", x1); - fprintf(fp, " 21\n%f\n", y1); - fprintf(fp, " 31\n%f\n", z1); - fprintf(fp, " 12\n%f\n", x2); - fprintf(fp, " 22\n%f\n", y2); - fprintf(fp, " 32\n%f\n", z2); - fprintf(fp, " 13\n%f\n", x3); - fprintf(fp, " 23\n%f\n", y3); - fprintf(fp, " 33\n%f\n", z3); - if (thickness != 0.0) { - fprintf(fp, " 39\n%f\n", thickness); - } - if (color != DXF_COLOR_BYLAYER) { - fprintf(fp, " 62\n%d\n", color); - } - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_solid () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Write DXF output to a file for a polyline vertex entity. - */ -static void dxf_write_vertex(FILE * fp, - /*!< file pointer to output device */ - int id_code, - /*!< group code = 5 */ - char *linetype, - /*!< group code = 6 \n - * optional, if omitted defaults to BYLAYER */ - char *layer, - /*!< group code = 8 */ - double x0, - /*!< group code = 10 \n */ - double y0, - /*!< group code = 20 \n */ - double z0, - /*!< group code = 30 \n */ - double thickness, - /*!< group code = 39 \n - * optional, if omitted defaults to 0.0 */ - double start_width, - /*!< group code = 40 \n - * optional, if omitted defaults to 0.0 */ - double end_width, - /*!< group code = 41 \n - * optional, if omitted defaults to 0.0 */ - double bulge, - /*!< group code = 42 \n - * optional, if omitted defaults to 0.0 \n - * The bulge is the tangent of 1/4 of the included angle - * for an arc segment. \n - * Made negative if the arc goes clockwise from the start - * point to the endpoint. \n - * A bulge of 0 indicates a straight segment, and a bulge - * of 1 is a semicircle. \n */ - double curve_fit_tangent_direction, - /*!< group code = 50 \n optional, a curve-fit tangent direction of 0.0 may be omitted from the DXF output, but is significant if the flag bit is set. \n */ - int color, - /*!< group code = 62 \n optional, if omitted defaults to BYLAYER */ - int paperspace, - /*!< group code = 67 \n optional, if omitted defaults to 0 (modelspace) */ - int flag - /*!< group code = 70 \n optional, if omitted defaults to 0 - * bit coded: \n - * 1 = extra vertex created by curve-fitting \n - * 2 = curve-fit tangent defined for this vertex. \n - * 4 = unused (never set in DXF files) \n - * 8 = spline vertex created by spline-fitting \n - * 16 = spline frame control point \n - * 32 = 3D Polyline vertex \n - * 64 = 3D polygon mesh vertex \n - * 128 = polyface mesh vertex */ - ) { - char *dxf_entity_name; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_write_vertex () function.\n", __FILE__, __LINE__); - fprintf(stderr, "[DXF entity with code %x]\n", id_code); -#endif - dxf_entity_name = pcb_strdup("VERTEX"); - if (strcmp(layer, "") == 0) { - fprintf(stderr, "Warning: empty layer string for the %s entity with id-code: %x\n", dxf_entity_name, id_code); - fprintf(stderr, " %s entity is relocated to layer 0", dxf_entity_name); - layer = pcb_strdup(DXF_DEFAULT_LAYER); - } - - fprintf(fp, " 0\n%s\n", dxf_entity_name); - if (id_code != -1) { - fprintf(fp, " 5\n%x\n", id_code); - } - if (strcmp(linetype, DXF_DEFAULT_LINETYPE) != 0) { - fprintf(fp, " 6\n%s\n", linetype); - } - fprintf(fp, " 8\n%s\n", layer); - fprintf(fp, " 10\n%f\n", x0); - fprintf(fp, " 20\n%f\n", y0); - fprintf(fp, " 30\n%f\n", z0); - if (thickness != 0.0) { - fprintf(fp, " 39\n%f\n", thickness); - } - if (start_width != 0.0) { - fprintf(fp, " 40\n%f\n", start_width); - } - if (end_width != 0.0) { - fprintf(fp, " 41\n%f\n", end_width); - } - if (bulge != 0.0) { - fprintf(fp, " 42\n%f\n", bulge); - } - if (curve_fit_tangent_direction != 0.0) { - fprintf(fp, " 50\n%f\n", curve_fit_tangent_direction); - } - if (color != DXF_COLOR_BYLAYER) { - fprintf(fp, " 62\n%d\n", color); - } - if (paperspace == DXF_PAPERSPACE) { - fprintf(fp, " 67\n%d\n", DXF_PAPERSPACE); - } - fprintf(fp, " 70\n%d\n", flag); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_write_vertex () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Get export options such as filename and filename base. - * - * Returns a set of resources describing options the export or print HID - * supports.\n - * In GUI mode, the print/export dialogs use this to set up the selectable - * options.\n - * In command line mode, these are used to interpret command line options.\n - * If n_ret is non-NULL, the number of attributes is stored there. - */ -static HID_Attribute *dxf_get_export_options(int *n) -{ - static char *last_dxf_filename; - static char *last_dxf_xref_filename; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_get_export_options () function.\n", __FILE__, __LINE__); -#endif - last_dxf_filename = 0; - last_dxf_xref_filename = 0; - if (PCB) { - derive_default_filename(PCB->Filename, &dxf_options[HA_dxffile], "", &last_dxf_filename); - derive_default_filename(PCB->Filename, &dxf_options[HA_xreffile], "", &last_dxf_xref_filename); - } - if (n) { - *n = NUM_OPTIONS; - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_get_export_options () function.\n", __FILE__, __LINE__); -#endif - return dxf_options; -} - - -/*! - * \brief Insert an element in the list of elements. - */ -static DxfList *dxf_insert(char *refdes, - /*!< reference designator. */ - char *descr, - /*!< description or footprint. */ - char *value, - /*!< element value. */ - DxfList * dxf - /*!< next item in list. */ - ) { - DxfList *new; - DxfList *cur; - DxfList *prev; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_insert () function.\n", __FILE__, __LINE__); -#endif - prev = NULL; - if (dxf == NULL) { - /* - * this is the first element so automatically create an entry. - */ - if ((new = (DxfList *) malloc(sizeof(DxfList))) == NULL) { - fprintf(stderr, "Error in dxf.c|dxf_insert (): malloc() failed.\n"); - exit(1); - } - new->next = NULL; - new->descr = pcb_strdup(descr); - new->value = pcb_strdup(value); - new->num = 1; - new->refdes = dxf_string_insert(refdes, NULL); - return (new); - } - /* - * search and see if we already have used one of these components. - */ - cur = dxf; - while (cur != NULL) { - if ((NSTRCMP(descr, cur->descr) == 0) && (NSTRCMP(value, cur->value) == 0)) { - cur->num++; - cur->refdes = dxf_string_insert(refdes, cur->refdes); - break; - } - prev = cur; - cur = cur->next; - } - if (cur == NULL) { - if ((new = (DxfList *) malloc(sizeof(DxfList))) == NULL) { - fprintf(stderr, "Error in dxf.c|dxf_insert (): malloc() failed.\n"); - exit(1); - } - prev->next = new; - new->next = NULL; - new->descr = pcb_strdup(descr); - new->value = pcb_strdup(value); - new->num = 1; - new->refdes = dxf_string_insert(refdes, NULL); - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_insert () function.\n", __FILE__, __LINE__); -#endif - return (dxf); -} - - -/*! - * \brief Print Xrefs to DXF file. - * - * Generate a file in the AutoCAD R14 DXF format for insertion of 3D models as - * external references (Xref's).\n - * An external reference is a reference to an external drawing block which is - * loaded at runtime (of the mechanical CAD software; for example AutoCAD) - * during the loading of the toplevel drawing model (the dxf file) in a - * mechanical CAD program or during separate insertions after the initial - * loading whilst in drawing mode.\n - * Note that for most mechanical CAD software the inserted block cannot be a - * DXF file.\n - * In most cases a DXF file representing a (3D) model must first be converted - * to a ".dwg" file, or any other file format native to the mechanical CAD - * software used.\n - * The filename of the 3D model inserted in the dxf file is:\n - * "parts\" + "Description or footprint name" + ".dwg" (file extension).\n - * It is assumed that the 3D models (.dwg) of the parts reside in a - * "parts" directory.\n - * All spaces in the "Description or footprint name" are palced with an - * underscore "_" resulting in the following string: - * "Description_or_footprint_name".\n - * Any element without a valid description or footprint name is inserted in the - * dxf file with a 3D model with a text "(unknown)" and this has to be - * manually inserted in the toplevel model after the initial loading of the dxf - * file.\n - * This is to prevent unnoticed ommissions of parts in the toplevel 3D model. - */ -static int dxf_export_xref_file(void) -{ - char *name; - char utcTime[64]; - double x; - double y; - double theta; - double sumx; - double sumy; - double pin1x; - double pin1y; - double pin1angle; - double pin2x; - double pin2y; - double pin2angle; - int found_pin1; - int found_pin2; - int pin_cnt; - time_t currenttime; - DxfList *dxf; - DxfList *lastb; - char *dxf_block_name; - char *dxf_xref_name; - double dxf_x0; - double dxf_y0; - double dxf_rot_angle; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_export_xref_file () function.\n", __FILE__, __LINE__); -#endif - name = NULL; - theta = 0.0; - pin1x = 0.0; - pin1y = 0.0; - pin1angle = 0.0; - pin2x = 0.0; - pin2y = 0.0; - dxf = NULL; - dxf_block_name = NULL; - dxf_xref_name = NULL; - dxf_x0 = 0.0; - dxf_y0 = 0.0; - dxf_rot_angle = 0.0; - - fp = fopen(dxf_xref_filename, "w"); - if (!fp) { - gui->log("Error in dxf.c|dxf_export_xref_file (): cannot open file %s for writing.\n", dxf_xref_filename); - return 1; - } - /* - * create a portable timestamp. - */ - currenttime = time(NULL); - strftime(utcTime, sizeof(utcTime), "%c UTC", gmtime(¤ttime)); - if (dxf_verbose) { - /* report at the beginning of each file */ - fprintf(stderr, "DXF: Board Name: %s, %s \n", UNKNOWN(PCB->Name), UNKNOWN(name)); - fprintf(stderr, "DXF: Created by: %s.\n", PCB_DXF_HID_VERSION); - fprintf(stderr, "DXF: Creation date: %s \n", utcTime); - fprintf(stderr, "DXF: File Format according to: AutoCAD R14.\n"); - if (dxf_metric) { - fprintf(stderr, "DXF using Metric coordinates [mm].\n"); - pcb_fprintf(stderr, "PCB Dimensions: %.0mm x %.0mm.\n", PCB->MaxWidth, PCB->MaxHeight); - } - else { - fprintf(stderr, "DXF using Imperial coordinates [mil].\n"); - pcb_fprintf(stderr, "PCB Dimensions: %.0mil x %.0mil.\n", PCB->MaxWidth, PCB->MaxHeight); - } - fprintf(stderr, "PCB Coordinate Origin: lower left.\n"); - fprintf(stderr, "DXF: Now processing Xrefs file.\n"); - } - /* write version info as a dxf comment */ - dxf_write_comment(fp, PCB_DXF_HID_VERSION); - /* write dxf header information */ - dxf_write_header(fp); - dxf_write_section(fp, "BLOCKS"); - /* - * lookup all elements on pcb and insert element in the list of elements. - */ - ELEMENT_LOOP(PCB->Data); - { - /* - * insert the elements into the dxf list. - */ - dxf = dxf_insert(UNKNOWN(NAMEONPCB_NAME(element)), UNKNOWN(DESCRIPTION_NAME(element)), UNKNOWN(VALUE_NAME(element)), dxf); - } - END_LOOP; /* End of ELEMENT_LOOP */ - /* - * now write a single block definition for every unique element to - * the BLOCKS section of the DXF file. - * since these are all supposed to be Xref blocks they are not to - * contain entities, just the path and filename (including extension). - * write a section BLOCKS marker to the DXF file. - */ - while (dxf != NULL) { - dxf_block_name = pcb_strdup(dxf_clean_string(dxf->descr)); - dxf_xref_name = DXF_DEFAULT_XREF_PATH_NAME; - dxf_write_block(fp, dxf_id_code, dxf_xref_name, dxf_block_name, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - 0.0, /* dxf_x0, */ - 0.0, /* dxf_y0, */ - 0.0, /* dxf_z0, */ - 0.0, /* dxf_thickness, */ - DXF_COLOR_BYLAYER, /* dxf_color, */ - 0, /* dxf_paperspace, */ - 36 /* dxf_block_type */ - ); - dxf_id_code++; - lastb = dxf; - dxf = dxf->next; - free(lastb); - } - /* write an ENDSEC marker to the DXF file */ - dxf_write_endsection(fp); - /* - * write a section ENTITIES marker to the DXF file. - */ - dxf_write_section(fp, "ENTITIES"); - /* - * for each element we calculate the centroid of the footprint. - * in addition, we need to extract some notion of rotation. - */ - ELEMENT_LOOP(PCB->Data); - { - /* - * initialize our pin count and our totals for finding the - * centroid. - */ - pin_cnt = 0; - sumx = 0.0; - sumy = 0.0; - found_pin1 = 0; - found_pin2 = 0; - /* - * iterate over the pins and pads keeping a running count of - * many pins/pads total and the sum of x and y coordinates. - * While we're at it, store the location of pin/pad #1 and #2 - * if we can find them. - */ - PIN_LOOP(element); - { - sumx += (double) pin->X; - sumy += (double) pin->Y; - pin_cnt++; - if (NSTRCMP(pin->Number, "1") == 0) { - pin1x = (double) pin->X; - pin1y = (double) pin->Y; - pin1angle = 0.0; - found_pin1 = 1; - } - else if (NSTRCMP(pin->Number, "2") == 0) { - pin2x = (double) pin->X; - pin2y = (double) pin->Y; - pin2angle = 0.0; - found_pin2 = 1; - } - } - END_LOOP; /* End of PIN_LOOP */ - PAD_LOOP(element); - { - sumx += (pad->Point1.X + pad->Point2.X) / 2.0; - sumy += (pad->Point1.Y + pad->Point2.Y) / 2.0; - pin_cnt++; - if (NSTRCMP(pad->Number, "1") == 0) { - pin1x = (double) (pad->Point1.X + pad->Point2.X) / 2.0; - pin1y = (double) (pad->Point1.Y + pad->Point2.Y) / 2.0; - /* - * NOTE: we swap the Y points, because in PCB - * the Y-axis is inverted, and increasing Y - * moves down. - * we want to deal with a right-handed - * Cartesian Coordinate System where - * increasing Y moves up. - */ - pin1angle = (180.0 / M_PI) * atan2(pad->Point1.Y - pad->Point2.Y, pad->Point2.X - pad->Point1.X); - found_pin1 = 1; - } - else if (NSTRCMP(pad->Number, "2") == 0) { - pin2x = (double) (pad->Point1.X + pad->Point2.X) / 2.0; - pin2y = (double) (pad->Point1.Y + pad->Point2.Y) / 2.0; - pin2angle = (180.0 / M_PI) * atan2(pad->Point1.Y - pad->Point2.Y, pad->Point2.X - pad->Point1.X); - found_pin2 = 1; - } - } - END_LOOP; /* End of PAD_LOOP */ - if (pin_cnt > 0) { - x = sumx / (double) pin_cnt; - y = sumy / (double) pin_cnt; - if (found_pin1) { - /* - * recenter pin #1 onto the axis which cross - * at the part centroid. - */ - pin1x -= x; - pin1y -= y; - pin1y = -1.0 * pin1y; - /* if only 1 pin, use pin 1's angle */ - if (pin_cnt == 1) - theta = pin1angle; - else { - /* - * if pin #1 is at (0,0) use pin #2 for - * rotation - */ - if ((pin1x == 0.0) && (pin1y == 0.0)) { - if (found_pin2) - theta = dxf_xy_to_angle(pin2x, pin2y); - else { - Message(PCB_MSG_WARNING, "dxf.c|dxf_export_xref_file ():\n" - " unable to figure out angle of element\n" - " %s because pin #1 is at the centroid of the part\n" - " and I could not find pin #2's location.\n" - " Setting to %g degrees.\n", UNKNOWN(NAMEONPCB_NAME(element)), theta); - } - } - else - theta = dxf_xy_to_angle(pin1x, pin1y); - } - } - /* we did not find pin #1 */ - else { - theta = 0.0; - Message(PCB_MSG_WARNING, "dxf.c|dxf_export_xref_file ():\n" - " unable to figure out angle because I could\n" - " not find pin #1 of element %s.\n" - " Setting to %g degrees.\n", UNKNOWN(NAMEONPCB_NAME(element)), theta); - } - dxf_block_name = pcb_strdup(dxf_clean_string(UNKNOWN(DESCRIPTION_NAME(element)))); - if (dxf_metric) { - /* convert mils to mm */ - dxf_x0 = PCB_COORD_TO_MM(x); - /* convert mils to mm and a right handed - * Cartesian Coordinate System */ - dxf_y0 = PCB_COORD_TO_MM(PCB->MaxHeight - y); - } - else { - /* - * no need to convert, some things remain the - * same. - */ - dxf_x0 = PCB_COORD_TO_MIL(x); - /* - * only convert to a right handed Cartesian - * Coordinate System. - */ - dxf_y0 = PCB_COORD_TO_MIL(PCB->MaxHeight - y); - } -#if 0 - /* - * convert the rotation angle as well: - * theta -> CW, DXF -> CCW. - */ - /*! - * \todo for now we only support Cardinal angles - * [North, East, South, West] - */ - if (theta == 0.0) - dxf_rot_angle = 90.0; - else if (theta == 90.0) - dxf_rot_angle = 0.0; - else if (theta == 180.0) - dxf_rot_angle = 270.0; - else if (theta == 270.0) - dxf_rot_angle = 180.0; - else { - dxf_rot_angle = 0.0; - Message(PCB_MSG_WARNING, "dxf.c|dxf_export_xref_file ():\n" - " unable to figure out angle of dxf block\n" - " %s because pcb angle theta is not Cardinal [0.0, 90.0, 180.0, 270.0].\n" - " Setting dxf_rot_angle to %g degrees\n", UNKNOWN(NAMEONPCB_NAME(element)), dxf_rot_angle); - } -#endif - dxf_write_insert(fp, dxf_id_code, dxf_block_name, DXF_DEFAULT_LINETYPE, /* dxf_linetype, */ - DXF_DEFAULT_LAYER, /* dxf_layer, */ - dxf_x0, dxf_y0, 0.0, /* dxf_z0, */ - 0.0, /* dxf_thickness, */ - 1.0, /* dxf_rel_x_scale, */ - 1.0, /* dxf_rel_y_scale, */ - 1.0, /* dxf_rel_z_scale, */ - 0.0, /* dxf_column_spacing, */ - 0.0, /* dxf_row_spacing, */ - dxf_rot_angle, DXF_COLOR_BYLAYER, /* dxf_color, */ - 0, /* dxf_attribute_follows, */ - 0, /* dxf_paperspace, */ - 1, /* dxf_columns, */ - 1 /* dxf_rows */ - ); - } - dxf_id_code++; - } - END_LOOP; /* End of ELEMENT_LOOP */ - /* - * write an ENDSEC marker to the DXF file. - */ - dxf_write_endsection(fp); - /* - * write an EOF marker and close the DXF file. - */ - dxf_write_eof(fp); - fclose(fp); - fp = NULL; - dxf_id_code = 0; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_export_xref_file () function.\n", __FILE__, __LINE__); -#endif - return (0); -} - - -/*! - * \brief Close DXF layer file. - */ -static void dxf_maybe_close_file() -{ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_maybe_close_file () function.\n", __FILE__, __LINE__); -#endif - if (fp) { - /* write an EOF marker and close the DXF file */ - dxf_write_eof(fp); - fclose(fp); - } - dxf_id_code = 0; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_maybe_close_file () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Export (or print) the current PCB. - * - * The options given represent the choices made from the options returned - * from dxf_get_export_options.\n - * Call with options == NULL to start the primary GUI (create a main window, - * print, export, etc).\n - * \n - * First get the export options.\n - * Do export all the DXF files required.\n - *
      - *
    • Export the DXF file with Xref blocks to a seperate dxf file if required.\n - *
    • Export a DXF file for every PCB layer.\n - *
    - */ -static void dxf_do_export(HID_Attr_Val * options) -{ - const char *dxf_fnbase; - int i; - static int saved_layer_stack[MAX_LAYER]; - BoxType region; - int save_ons[MAX_LAYER + 2]; - int tmp[128], len; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_do_export () function.\n", __FILE__, __LINE__); -#endif - dxf_fnbase = NULL; - - if (!options) { - dxf_get_export_options(0); - for (i = 0; i < NUM_OPTIONS; i++) { - dxf_values[i] = dxf_options[i].default_val; - } - options = dxf_values; - } - /* - * verbose output (dxf files to contain comments). - */ - dxf_verbose = options[HA_verbose].int_value; - /* - * if all layers needs to be exported. - */ - dxf_export_all_layers = options[HA_export_all_layers].int_value; - /* - * output to be in in mils or mm. - */ - dxf_metric = options[HA_metric].int_value; - /* - * entity color to be BYBLOCK (or by layer number). - */ - dxf_color_is_byblock = options[HA_color_byblock].int_value; - /* - * if xrefs DXF file needs to be exported. - */ - dxf_xrefs = options[HA_xrefs].int_value; - if (dxf_xrefs) { - const char *xreff; - /* - * determine a file name for the xref file. - */ - xreff = options[HA_xreffile].str_value; - if (xreff == NULL) - xreff = "pcb-out_xrefs"; - i = strlen(xreff); - dxf_xref_filename = (char *) realloc(dxf_xref_filename, i + 40); - memcpy(dxf_xref_filename, xreff, i+1); - strcat(dxf_xref_filename, "_xrefs.dxf"); - dxf_filesuffix = dxf_xref_filename + strlen(dxf_xref_filename); - dxf_export_xref_file(); - } - /* - * determine a file name base for the DXF layer files. - */ - dxf_fnbase = options[HA_dxffile].str_value; - if (!dxf_fnbase) { - dxf_fnbase = "pcb_layers"; - } - i = strlen(dxf_fnbase); - dxf_filename = (char *) realloc(dxf_filename, i + 40); - strcpy(dxf_filename, dxf_fnbase); - strcat(dxf_filename, "_"); - dxf_filesuffix = dxf_filename + strlen(dxf_filename); - memset(print_layer, 0, sizeof(print_layer)); - /* - * use this to temporarily enable all layers. - */ - hid_save_and_show_layer_ons(save_ons); - - len = pcb_layer_list(PCB_LYT_SILK | PCB_LYT_COPPER, tmp, sizeof(tmp)); - for(i = 0; i < len; i++) - if (!IsLayerNumEmpty(tmp[i])) - print_layer[tmp[i]] = 1; - - memcpy(saved_layer_stack, LayerStack, sizeof(LayerStack)); - qsort(LayerStack, max_copper_layer, sizeof(LayerStack[0]), dxf_layer_sort); - linewidth = -1; - lastcap = -1; - lastgroup = -1; - lastcolor = -1; - region.X1 = 0; - region.Y1 = 0; - region.X2 = PCB->MaxWidth; - region.Y2 = PCB->MaxHeight; - pagecount = 1; -/* dxf_init_apertures ();*/ - lastgroup = -1; - c_layerapps = 0; - dxf_finding_apertures = 1; - hid_expose_callback(&dxf_hid, ®ion, 0); - c_layerapps = 0; - dxf_finding_apertures = 0; - hid_expose_callback(&dxf_hid, ®ion, 0); - memcpy(LayerStack, saved_layer_stack, sizeof(LayerStack)); - dxf_maybe_close_file(); - hid_restore_layer_ons(save_ons); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_do_export () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Parse the command line. - * - * Parse HID register attributes and HID command line arguments.\n - * Call this early for whatever HID will be the primary HID, as it will set - * all the registered attributes.\n - * The HID should remove all arguments, leaving any possible file names - * behind. - */ -static void dxf_parse_arguments(int *argc, char ***argv) -{ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_parse_arguments () function.\n", __FILE__, __LINE__); -#endif - hid_parse_command_line(argc, argv); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_parse_arguments () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Sort drills (holes). - */ -static int dxf_drill_sort(const void *va, const void *vb) { - DxfPendingDrills *a; - DxfPendingDrills *b; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_drill_sort () function.\n", __FILE__, __LINE__); -#endif - a = (DxfPendingDrills *) va; - b = (DxfPendingDrills *) vb; - if (a->diam != b->diam) - return a->diam - b->diam; - if (a->x != b->x) - return a->x - a->x; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_drill_sort () function.\n", __FILE__, __LINE__); -#endif - return b->y - b->y; -} - - -/*! - * \brief Set the layer with name for DXF export. - * - * During redraw or print/export cycles, this is called once per layer - * (or layer group, for copper layers).\n - * If it returns false (zero), the HID does not want that layer, and none of - * the drawing functions should be called.\n - * If it returns true (nonzero), the items in that layer [group] should be - * drawn using the various drawing functions.\n - * In addition to the MAX_LAYERS copper layer groups, you may select layers - * indicated by the macros SL_* defined, or any others with an index of -1.\n - * For copper layer groups, you may pass NULL for name to have a name fetched - * from the PCB struct.\n - * \n - * All copper containing layers are set for DXF export.\n - * All assembly layers are set for DXF export.\n - * Exceptions are: \n - *
      - *
    • Layers with the name "invisible" are not set for DXF export. - *
    • Layers with the name "keepout" are not set for DXF export. - *
    • Layers without exportable items are not set for DXF export. - *
    - */ -static int dxf_set_layer(const char *name, int group) { - char *cp; - int idx; - const char *fmt; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_set_layer () function.\n", __FILE__, __LINE__); -#endif - idx = (group >= 0 && group < max_group) ? PCB->LayerGroups.Entries[group][0] : group; - - if (name == 0) { - /* if none given, get the layer name from pcb */ - name = PCB->Data->Layer[idx].Name; - } - if (dxf_verbose) { - fprintf(stderr, "DXF: now processing Layer %s group %d\n", name, group); - } - if (dxf_export_all_layers) { - /* do nothing here to export all layers */ - } - else { - if (idx >= 0 && idx < max_copper_layer && !print_layer[idx]) { - /* do not export empty layers */ - if (dxf_verbose) { - fprintf(stderr, "DXF: Warning, Layer %s contains no exportable items and is not set.\n", name); - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_layer () function.\n", __FILE__, __LINE__); - } - return 0; - } - if (strcmp(name, "invisible") == 0) { - /* do not export the layer with the name "invisible" */ - if (dxf_verbose) { - fprintf(stderr, "DXF: Warning, Layer %s not set.\n", name); - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_layer () function.\n", __FILE__, __LINE__); - } - return 0; - } - if (strcmp(name, "keepout") == 0) { - /* do not export the layer with the name "keepout" */ - if (dxf_verbose) { - fprintf(stderr, "DXF: Warning, Layer %s not set.\n", name); - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_layer () function.\n", __FILE__, __LINE__); - } - return 0; - } - if (SL_TYPE(idx) == SL_ASSY) { - /* do not export the layers with the type SL_ASSY */ - if (dxf_verbose) { - fprintf(stderr, "DXF: Warning, Layer %s with type SL_ASSY not set.\n", name); - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_layer () function.\n", __FILE__, __LINE__); - } - return 0; - } - } - if (is_drill && dxf_n_pending_drills) { - int i; - /* dump pending drills in sequence */ - qsort(dxf_pending_drills, dxf_n_pending_drills, sizeof(DxfPendingDrills), dxf_drill_sort); - for (i = 0; i < dxf_n_pending_drills; i++) { - if (i == 0 || dxf_pending_drills[i].diam != dxf_pending_drills[i - 1].diam) { - if (dxf_verbose) { - /*! - * \todo this output should go to file in - * whatever form instead of being put on stderr. - */ -/* fprintf (stderr, - "DXF: T%02d\015\012", ap);*/ - } - } - if (dxf_verbose) { - /*! - * \todo this output should go to file in - * whatever form instead of being put on stderr. - */ - fprintf(stderr, "DXF: X:%06d Y:%06ld\n", DXF_X(PCB, dxf_pending_drills[i].x), DXF_Y(PCB, dxf_pending_drills[i].y)); - } - } - free(dxf_pending_drills); - dxf_n_pending_drills = dxf_max_pending_drills = 0; - dxf_pending_drills = 0; - } - is_drill = (SL_TYPE(idx) == SL_PDRILL || SL_TYPE(idx) == SL_UDRILL); - is_mask = (SL_TYPE(idx) == SL_MASK); - current_mask = 0; - if (group < 0 || group != lastgroup) { - time_t currenttime; - char utcTime[64]; - char *sext = "_layer.dxf"; - lastgroup = group; - dxf_lastX = -1; - dxf_lastY = -1; - lastcolor = 0; - linewidth = -1; - lastcap = -1; -/* dxf_set_app_layer (c_layerapps);*/ - c_layerapps++; - if (dxf_finding_apertures) { - return 1; - } -/* if (!curapp->nextAperture) - { - return 0; - }*/ - dxf_maybe_close_file(); - pagecount++; - switch (idx) { - case SL(PDRILL, 0): - sext = ".dxf"; - break; - case SL(UDRILL, 0): - sext = ".dxf"; - break; - } - strcpy(dxf_filesuffix, layer_type_to_file_name(idx, FNS_first)); - strcat(dxf_filesuffix, sext); - fp = fopen(dxf_filename, "w"); - if (fp == NULL) { - Message(PCB_MSG_ERROR, "DXF: could not open %s for writing.\n", dxf_filename); - return 1; - } - /* write version info as a dxf comment */ - dxf_write_comment(fp, PCB_DXF_HID_VERSION); - /* write dxf header information */ - dxf_write_header(); - /* write a section ENTITIES marker to the DXF file */ - dxf_write_section(fp, "ENTITIES"); - was_drill = is_drill; - /*! - * \todo this output should go to file in - * whatever form instead of being put on stderr. - */ - if (dxf_verbose) { - fprintf(stderr, "DXF: Start of page %d for group %d idx %d\n", pagecount, group, idx); - } - if (group < 0 || group != lastgroup) { - /* create a portable timestamp */ - currenttime = time(NULL); - /* avoid gcc complaints */ - fmt = pcb_strdup("%c UTC"); - strftime(utcTime, sizeof utcTime, fmt, gmtime(¤ttime)); - } - if (dxf_verbose) { - /* report at the beginning of each file */ - fprintf(stderr, "DXF: Board Name: %s, %s \n", UNKNOWN(PCB->Name), UNKNOWN(name)); - fprintf(stderr, "DXF: Created by: %s.\n", PCB_DXF_HID_VERSION); - fprintf(stderr, "DXF: Creation date: %s \n", utcTime); - fprintf(stderr, "DXF: File Format according to: AutoCAD R14.\n"); - if (dxf_metric) { - fprintf(stderr, "DXF using Metric coordinates [mm].\n"); - pcb_fprintf(stderr, "PCB Dimensions: %.0mm x %.0mm.\n", PCB->MaxWidth, PCB->MaxHeight); - } - else { - fprintf(stderr, "DXF using Imperial coordinates [mil].\n"); - pcb_fprintf(stderr, "PCB Dimensions: %.0ml x %.0ml.\n", PCB->MaxWidth, PCB->MaxHeight); - } - fprintf(stderr, "PCB Coordinate Origin: lower left.\n"); - fprintf(stderr, "DXF: Now processing Layer %s group %d drill %d mask %d\n", name, group, is_drill, is_mask); - } - /* build a legal identifier */ - if (dxf_layername) { - free(dxf_layername); - } - dxf_layername = pcb_strdup(dxf_filesuffix); - dxf_layername[strlen(dxf_layername) - strlen(sext)] = 0; - /* remove all non-alpha-nummerical characters and change all to upper characters */ - for (cp = dxf_layername; *cp; cp++) { - if (isalnum((int) *cp)) { - *cp = toupper(*cp); - } - else { - *cp = '_'; - } - } - lncount = 1; - if (dxf_verbose) { - fprintf(stderr, "DXF: Setting Layer %s.\n", dxf_layername); -/* fprintf (stderr, "DXF: Aperture Data %s.\n", curapp->appList.Data);*/ - } - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_layer () function.\n", __FILE__, __LINE__); -#endif - return 1; -} - - -/*! - * \brief Constructor for the graphic context. - */ -static hidGC dxf_make_gc(void) -{ - hidGC rv; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_make_gc () function.\n", __FILE__, __LINE__); -#endif - rv = (hidGC) calloc(1, sizeof(hid_gc_struct)); - rv->cap = Trace_Cap; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_make_gc () function.\n", __FILE__, __LINE__); -#endif - return rv; -} - - -/*! - * \brief Destructor for the graphic context. - */ -static void dxf_destroy_gc(hidGC gc) -{ -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_destroy_gc () function.\n", __FILE__, __LINE__); -#endif - free(gc); -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_destroy_gc () function.\n", __FILE__, __LINE__); -#endif -} - -/*! - * Special note about the "erase" color: To use this color, you must use this - * function to tell the HID when you're using it.\n - * At the beginning of a layer redraw cycle (i.e. after set_layer), call - * use_mask() to redirect output to a buffer.\n - * Draw to the buffer (using regular HID calls) using regular and "erase" - * colors.\n - * Then call use_mask(HID_MASK_OFF) to flush the buffer to the HID.\n - * If you use the "erase" color when use_mask is disabled, it simply draws in - * the background color.\n - * Values:\n - *
      - *
    • HID_MASK_OFF == 0 Flush the buffer and return to non-mask operation. - *
    • HID_MASK_BEFORE == 1 Polygons being drawn before clears. - *
    • HID_MASK_CLEAR == 2 Clearances being drawn. - *
    • HID_MASK_AFTER == 3 Polygons being drawn after clears. - *
    - */ -static void dxf_use_mask(int use_it) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_use_mask () function.\n", __FILE__, __LINE__); -#endif - current_mask = use_it; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_use_mask () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Set a color. - * - * Set the color of the entity. - * Names can be like "red" or "#rrggbb" or special names like "erase". - * Always use the "erase" color for removing ink (like polygon reliefs - * or thermals), as you cannot rely on knowing the background color or special - * needs of the HID.\n - * Always use the "drill" color to draw holes.\n - * You may assume this is cheap enough to call inside the redraw callback, - * but not cheap enough to call for each item drawn. - */ -static void dxf_set_color(hidGC gc, /*!< graphic context */ - const char *name) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_set_color () function.\n", __FILE__, __LINE__); -#endif - if (strcmp(name, "erase") == 0) { - gc->color = 1; - gc->erase = 1; - gc->drill = 0; - } - else if (strcmp(name, "drill") == 0) { - gc->color = 1; - gc->erase = 0; - gc->drill = 1; - } - else { - gc->color = 0; - gc->erase = 0; - gc->drill = 0; - } -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_color () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Set the line style. - * - * Set the line cap style in the graphic context.\n - * While calling this is cheap, calling it with different values each time - * may be expensive, so grouping items by line style is helpful. -*/ -static void dxf_set_line_cap(hidGC gc, EndCapStyle style) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_set_line_cap () function.\n", __FILE__, __LINE__); -#endif - gc->cap = style; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_line_cap () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Set the line width. - * - * Set the line width in the graphic context.\n - * While calling this is cheap, calling it with different values each time - * may be expensive, so grouping items by line width is helpful. - */ -static void dxf_set_line_width(hidGC gc, int width) { -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_set_line_width () function.\n", __FILE__, __LINE__); -#endif - gc->width = width; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_set_line_width () function.\n", __FILE__, __LINE__); -#endif -} - - -static void dxf_set_draw_xor(hidGC gc, int xor_) -{ - ; -} - - -/*! - * \brief Use the graphic context. - */ -static void dxf_use_gc(hidGC gc, int radius) { - int c; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_use_gc () function.\n", __FILE__, __LINE__); -#endif - if (radius) { - radius *= 2; - if (radius != linewidth || lastcap != Round_Cap) { -/* c = dxf_find_aperture_code (radius, ROUND);*/ - if (c <= 0) { - fprintf(stderr, "DXF: Error, aperture for radius %d type ROUND is %d\n", radius, c); - } - if (fp && !is_drill) { - fprintf(stderr, "DXF: is not a drill %d.\n", c); - } - linewidth = radius; - lastcap = Round_Cap; - } - } - else if (linewidth != gc->width || lastcap != gc->cap) { - linewidth = gc->width; - lastcap = gc->cap; - switch (gc->cap) { - case Round_Cap: - case Trace_Cap: - c = SHP_ROUND; - break; - default: - case Square_Cap: - c = SHP_SQUARE; - break; - } - if (fp) { -/* fprintf (stderr, "DXF: aperture %d.\n ", ap); */ - } - } -#if 0 - if (lastcolor != gc->color) { - c = gc->color; - if (is_drill) - return; - if (is_mask) - c = (gc->erase ? 0 : 1); - lastcolor = gc->color; - if (fp) { - if (c) { - /*! - * \todo this output should go to file in - * whatever form instead of being put on stderr. - */ - fprintf(stderr, "%%LN%s_C%d*%%\015\012", layername, lncount++); - fprintf(stderr, "%%LPC*%%\015\012"); - } - else { - fprintf(stderr, "%%LN%s_D%d*%%\015\012", layername, lncount++); - fprintf(stderr, "%%LPD*%%\015\012"); - } - } - } -#endif -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leavinging dxf_use_gc () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Draw a rectangle. - * - * The usual drawing functions.\n - * "draw" means to use segments of the given width, whereas "fill" means to - * fill to a zero-width outline.\n - * We draw the rectangle counter clockwise (CCW) with 5 vertices - * (XY-coordinates).\n - * It is assumed that the first XY-coordinate pair (x1, y1) contains the - * bottom left corner values and that the second XY-coordinate pair (x2, y2) - * contains the top right corner values. \n - * The rectangle is not filled, use dxf_fill_rect () for a filled rectangle. - */ -static void dxf_draw_rect(hidGC gc, - /*!< graphic context */ - int x1, - /*!< X-value bottom left ?? point */ - int y1, - /*!< Y-value bottom left ?? point */ - int x2, - /*!< X-value top right ?? point */ - int y2 - /*!< Y-value top right ?? point */ - ) { - double dxf_start_width; - double dxf_end_width; - int dxf_color; - double dxf_x0; - double dxf_y0; - double dxf_x1; - double dxf_y1; - double dxf_x2; - double dxf_y2; - double dxf_x3; - double dxf_y3; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_draw_rect () function.\n", __FILE__, __LINE__); -#endif - /* - * return if no valid file pointer exists. - */ - if (!fp) { - fprintf(stderr, "Warning: no valid file pointer exists.\n"); - return; - } - if ((x1 == x2) && (y1 == y2)) { - fprintf(stderr, "Warning: start point and end point are identical for the entity with id-code: %x\n", dxf_id_code); - fprintf(stderr, " entity is discarded from output.\n"); - return; - } - dxf_start_width = (double) gc->width; - dxf_end_width = (double) gc->width; - if (dxf_color_is_byblock) { - dxf_color = DXF_COLOR_BYBLOCK; - } - else - dxf_color = gc->color; - dxf_x0 = DXF_X(PCB, x1); - dxf_y0 = DXF_Y(PCB, y1); - dxf_x1 = DXF_X(PCB, x2); - dxf_y1 = DXF_Y(PCB, y1); - dxf_x2 = DXF_X(PCB, x1); - dxf_y2 = DXF_Y(PCB, y2); - dxf_x3 = DXF_X(PCB, x2); - dxf_y3 = DXF_Y(PCB, y2); - /* - * write polyline sequence. - */ - dxf_write_polyline(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - 0.0, /* x0, *//* the polyline entity always remains on 0.0, 0.0, 0.0 */ - 0.0, /* y0, */ - 0.0, /* z0, */ - 0.0, /* extr_x0, *//* the polyline extrusion vector always is 0.0, 0.0, 1.0 */ - 0.0, /* extr_y0, */ - 1.0, /* extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, dxf_color, /* color, */ - 1, /* vertices_follow, */ - 0, /* modelspace, */ - 0, /* flag, */ - 0, /* polygon_mesh_M_vertex_count, */ - 0, /* polygon_mesh_N_vertex_count, */ - 0, /* smooth_M_surface_density, */ - 0, /* smooth_N_surface_density, */ - 0 /* surface_type */ - ); - dxf_id_code++; - /* - * write first XY-coordinate (base point, bottom left corner). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, dxf_y0, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, 0.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write second XY-coordinate (bottom right corner). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x1, dxf_y0, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, 0.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write third XY-coordinate (top right left corner). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x1, dxf_y1, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, 0.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write fourth XY-coordinate (top left corner). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, dxf_y1, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, 0.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write fifth XY-coordinate (again the bottom left corner, to close - * the rectangle). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, dxf_y0, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, 0.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * end of polyline sequence. - */ - dxf_write_endseq(fp); - dxf_lastX = dxf_x1; - dxf_lastY = dxf_y1; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_draw_rect () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Draw a line. - * - * The usual drawing functions.\n - * "draw" means to use segments of the given width, whereas "fill" means to - * fill to a zero-width outline.\n - * Translate the pcb X,Y-coordinates of lines and trace segments to dxf - * X,Y,Z-coordinates.\n - * Add layer, linetype, color and width values.\n - * Write a series of polylines and vertices by calling low level functions.\n - * If the endcap style is SHP_ROUND add a donut at the begin and end coordinates - * of the line segment.\n - * If the endcap style is SHP_SQUARE elongate the line segment with half its - * width.\n - * Remarks:\n - *
      - *
    • We do not draw lines of 1 mil wide or smaller.\n - *
    • We do not draw lines with identical start and end XY-coordinates (zero - * length).\n - *
    • We draw every trace segment as a single AutoCAD entity (polyline).\n - *
    - * - * \todo In case of a series of trace segments, we have to continue with a - * vertex from the last XY-coordinates.\n - * While the conditions for starting or continuing are simple to determine:\n - * if ((dxf_x1, dxf_y1) == dxf_lastX, dxf_lastY)) ... \n - * The caveat is how to determine when to close the polyline sequence - * (with an ENDSEQ marker) after the last vertex (endpoint of the last trace - * segment).\n - * One approach could be to close the series when the start coordinates of the - * new (to be drawn) trace segment do not coincide with the endpoint of the - * previously used trace segment (dxf_last[X. Y] values).\n - * This however would not be a solution for a branching trace segment or the - * last trace segment to be drawn on that particular layer.\n - * For the last trace segment to be drawn on a particular layer, we would have - * to check if the layer didn't change since the last trace segment was - * drawn.\n - */ -static void dxf_draw_line(hidGC gc, - /*!< graphic context */ - int x1, - /*!< X-value start point */ - int y1, - /*!< Y-value start point */ - int x2, - /*!< X-value end point */ - int y2 - /*!< Y-value end point */ - ) { - pcb_bool m; - double dxf_x0; /* start point */ - double dxf_y0; /* start point */ - double dxf_x1; /* end point */ - double dxf_y1; /* end point */ - double dxf_start_width; /* trace width */ - double dxf_end_width; /* trace width */ - int dxf_color; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_draw_line () function.\n", __FILE__, __LINE__); -#endif - m = pcb_false; - if (!fp) { - /* return if no valid file pointer exists */ - fprintf(stderr, "Warning: no valid file pointer exists.\n"); - return; - } - if (gc->width == 1) { - /* we do not draw 1 mil width traces */ - fprintf(stderr, "Warning: lines with a width == 1 mil will not be drawn.\n"); - fprintf(stderr, " entity is discarded from output.\n"); - return; - } - if ((x1 == x2) && (y1 == y2)) { - /* we do not draw zero length traces */ - fprintf(stderr, "Warning: start point and end point are identical for the entity with id-code: %x.\n", dxf_id_code); - fprintf(stderr, " entity is discarded from output.\n"); - return; - } - dxf_use_gc(gc, 0); - /* determine the polyline widths */ - if (dxf_metric) { - dxf_start_width = (double) PCB_COORD_TO_MM(gc->width); - dxf_end_width = (double) PCB_COORD_TO_MM(gc->width); - } - else { - dxf_start_width = (double) PCB_COORD_TO_MIL(gc->width); - dxf_end_width = (double) PCB_COORD_TO_MIL(gc->width); - } - /* determine polyline color */ - if (dxf_color_is_byblock) { - dxf_color = DXF_COLOR_BYBLOCK; - } - else - dxf_color = gc->color; - /* - * determine start and end point X,Y-values w.r.t. metric or imperial. - */ - if (dxf_metric) { - dxf_x0 = PCB_COORD_TO_MM(DXF_X(PCB, x1)); - dxf_y0 = PCB_COORD_TO_MM(DXF_Y(PCB, y1)); - dxf_x1 = PCB_COORD_TO_MM(DXF_X(PCB, x2)); - dxf_y1 = PCB_COORD_TO_MM(DXF_Y(PCB, y2)); - } - else { - dxf_x0 = PCB_COORD_TO_MIL(DXF_X(PCB, x1)); - dxf_y0 = PCB_COORD_TO_MIL(DXF_Y(PCB, y1)); - dxf_x1 = PCB_COORD_TO_MIL(DXF_X(PCB, x2)); - dxf_y1 = PCB_COORD_TO_MIL(DXF_Y(PCB, y2)); - } - /*! - * \todo Someday we have to do something here with multiple trace - * segments here, the problem for now is how to determine when the - * last trace segment was passed. - */ - if ((dxf_x0 == dxf_lastX) && (dxf_y0 == dxf_lastY)) { - m = pcb_true; - } - /* - * This is just a dirty hack for AutoCAD doesn't have endcap styles. - * Donuts can not be implementend in the trace polyline since donuts - * are a closed polyline themselves. - */ - if (gc->cap == SHP_ROUND) { - /* place a donut at the start of the trace segment */ - dxf_write_polyline(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - 0.0, /* x0, */ - 0.0, /* y0, */ - 0.0, /* z0, */ - 0.0, /* extr_x0, */ - 0.0, /* extr_y0, */ - 1.0, /* extr_z0, */ - 0.0, /* thickness, copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, dxf_color, /* color, */ - 1, /* vertices_follow, */ - 0, /* modelspace, */ - 1, /* flag, */ - 0, /* polygon_mesh_M_vertex_count, */ - 0, /* polygon_mesh_N_vertex_count, */ - 0, /* smooth_M_surface_density, */ - 0, /* smooth_N_surface_density, */ - 0 /* surface_type */ - ); - dxf_id_code++; - /* - * write first XY-coordinate (at the start of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0 - (0.25 * dxf_start_width), dxf_y0, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write second XY-coordinate (at the start of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0 + (0.25 * dxf_start_width), dxf_y0, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* write the end of polyline sequence marker */ - dxf_write_endseq(fp); - /* place a donut at the end of the trace segment */ - dxf_write_polyline(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - 0.0, /* x0, */ - 0.0, /* y0, */ - 0.0, /* z0, */ - 0.0, /* extr_x0, */ - 0.0, /* extr_y0, */ - 1.0, /* extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, dxf_color, /* color, */ - 1, /* vertices_follow, */ - 0, /* modelspace, */ - 1, /* flag, */ - 0, /* polygon_mesh_M_vertex_count, */ - 0, /* polygon_mesh_N_vertex_count, */ - 0, /* smooth_M_surface_density, */ - 0, /* smooth_N_surface_density, */ - 0 /* surface_type */ - ); - dxf_id_code++; - /* - * write first XY-coordinate (at the end of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x1 - (0.25 * dxf_start_width), dxf_y1, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write second XY-coordinate (at the end of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x1 + (0.25 * dxf_start_width), dxf_y1, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write the end of polyline sequence marker. - */ - dxf_write_endseq(fp); - } - /* if the end cap style is an OCTAGON: ?? */ - if (gc->cap == SHP_OCTAGON) { - /*! - * \todo This end cap style has yet to be implemented at the - * start and end point of a trace. - * Note: done for SHP_ROUND and SQUARE. - */ - } - /* - * if the end cap style is SQUARE: recompute the start and end - * coordinates, that is, elongate the trace with half of the width. - */ - if (gc->cap == SHP_SQUARE) { - double length; /* trace length */ - double dxf_x0_1; /* extended start point */ - double dxf_y0_1; /* extended start point */ - double dxf_x1_1; /* extended end point */ - double dxf_y1_1; /* extended end point */ - length = sqrt((dxf_y1 - dxf_y0) * (dxf_y1 - dxf_y0) + (dxf_x1 - dxf_x0) * (dxf_x1 - dxf_x0)); - dxf_x0_1 = dxf_x0 - ((dxf_x1 - dxf_x0) / length) * 0.5 * dxf_start_width; - dxf_y0_1 = dxf_y0 - ((dxf_y1 - dxf_y0) / length) * 0.5 * dxf_start_width; - dxf_x1_1 = dxf_x1 + ((dxf_x1 - dxf_x0) / length) * 0.5 * dxf_end_width; - dxf_y1_1 = dxf_y1 + ((dxf_y1 - dxf_y0) / length) * 0.5 * dxf_end_width; - dxf_x0 = dxf_x0_1; - dxf_y0 = dxf_y0_1; - dxf_x1 = dxf_x1_1; - dxf_y1 = dxf_y1_1; - } - /* write polyline sequence for the trace */ - dxf_write_polyline(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - 0.0, /* x0, */ - 0.0, /* y0, */ - 0.0, /* z0, */ - 0.0, /* extr_x0, */ - 0.0, /* extr_y0, */ - 1.0, /* extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, dxf_color, /* color, */ - 1, /* vertices_follow, */ - 0, /* modelspace, */ - 0, /* flag, */ - 0, /* polygon_mesh_M_vertex_count, */ - 0, /* polygon_mesh_N_vertex_count, */ - 0, /* smooth_M_surface_density, */ - 0, /* smooth_N_surface_density, */ - 0 /* surface_type */ - ); - dxf_id_code++; - /* write first XY-coordinate (start of trace segment) */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, dxf_y0, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, 0.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* write second XY-coordinate (end of trace segment) */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x1, dxf_y1, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_start_width, dxf_end_width, 0.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* write the end of polyline sequence marker */ - dxf_write_endseq(fp); - dxf_lastX = dxf_x1; - dxf_lastY = dxf_y1; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_draw_line () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Draw an (elliptic ?) arc. - * - * The usual drawing functions.\n - * "draw" means to use segments of the given width, whereas "fill" means to - * fill to a zero-width outline.\n - * For now we draw an (elliptic) arc with the assumption that the width is - * along the X-axis and the height is along the Y-axis.\n - * Thus the major axis of the ellipse has a size of 2 * the maximum of the - * greatest value of [width, height], and the minor axis has a size of 2 * the - * minimum value of [width, height].\n - * An elliptic arc with a line width of 0 is implemented for now. - * - * \todo The elliptic arc entity has to be replaced by a polyline with the - * correct line width (trace width). - * \todo In the case of a series of trace segments, continue with a vertex - * from the last XY-coordinates.\n - * While the conditions for starting or continuing are simple to determine:\n - * if ((x1, y1) == dxf_lastX, dxf_lastY)) ... \n - * The caveat is how to determine when to close the polyline sequence (with - * an ENDSEQ marker) after the last vertex (endpoint of the last trace - * segment).\n - * \todo The end cap style has to be implemented at the start and end point of - * a trace. - */ -static void dxf_draw_arc(hidGC gc, - /*!< graphic context */ - int cx, - /*!< X-value center point */ - int cy, - /*!< X-value center point */ - int width, - /*!< length of major axis */ - int height, - /*!< length of minor axis */ - int start_angle, - /*!< start angle of elliptic arc */ - int delta_angle - /*!< relative angle to end angle */ - ) { - float arcStartX; - float arcStopX; - float arcStartY; - float arcStopY; - double dxf_x0; /* center point */ - double dxf_y0; /* center point */ - double dxf_x1; /* end point major axis */ - double dxf_y1; /* end point major axis */ - double dxf_arcstart_x; - double dxf_arcstart_y; - double dxf_arcstop_x; - double dxf_arcstop_y; - double dxf_start_width; /* trace width */ - double dxf_end_width; /* trace width */ - double dxf_width; /* arc width */ - double dxf_height; /* arc height */ - double dxf_ratio; - double dxf_start_angle; - double dxf_end_angle; - int dxf_color; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_draw_arc () function.\n", __FILE__, __LINE__); -#endif -#if 0 - pcb_bool m = pcb_false; -#endif - if (!fp) { - /* return if no valid file pointer exists */ - fprintf(stderr, "Warning: no valid file pointer exists.\n"); - return; - } - if (gc->width == 0) { - /* we do not draw 0 mil wide traces */ - fprintf(stderr, "Warning: arcs with a width == 0 mil will not be drawn.\n"); - fprintf(stderr, " entity is discarded from output.\n"); - return; - } - dxf_use_gc(gc, 0); - arcStartX = cx - width * cos(TO_RADIANS(start_angle)); - arcStartY = cy + height * sin(TO_RADIANS(start_angle)); - arcStopX = cx - width * cos(TO_RADIANS(start_angle + delta_angle)); - arcStopY = cy + height * sin(TO_RADIANS(start_angle + delta_angle)); - if (dxf_metric) { - /* use metric (mm) */ - dxf_x0 = PCB_COORD_TO_MM(DXF_X(PCB, cx)); - dxf_y0 = PCB_COORD_TO_MM(DXF_Y(PCB, cy)); - dxf_start_width = PCB_COORD_TO_MM(DXF_X(PCB, width)); - dxf_end_width = PCB_COORD_TO_MM(DXF_X(PCB, width)); - dxf_height = PCB_COORD_TO_MM(DXF_X(PCB, height)); - dxf_width = PCB_COORD_TO_MM(DXF_X(PCB, width)); - if (dxf_width > dxf_height) { - /* - * the major axis of the ellipse coincides with the - * X-axis. - */ - dxf_x1 = PCB_COORD_TO_MM(DXF_X(PCB, (cx + width))); - dxf_y1 = PCB_COORD_TO_MM(DXF_Y(PCB, cy)); - /* - * the dxf_ratio is the minor axis length over major - * axis length, and is always <= 1.0 - */ - dxf_ratio = dxf_height / dxf_width; - } - else { - /* - * the major axis of the ellipse coincides with the - * Y-axis. - */ - dxf_x1 = PCB_COORD_TO_MM(DXF_X(PCB, cx)); - dxf_y1 = PCB_COORD_TO_MM(DXF_Y(PCB, (cy + height))); - /* - * the dxf_ratio is the minor axis length over major - * axis length, and is always <= 1.0 - */ - dxf_ratio = dxf_width / dxf_height; - } - } - else { - /* use imperial (mil) */ - dxf_x0 = PCB_COORD_TO_MIL(DXF_X(PCB, cx)); - dxf_y0 = PCB_COORD_TO_MIL(DXF_Y(PCB, cy)); - dxf_start_width = PCB_COORD_TO_MIL(DXF_X(PCB, width)); - dxf_end_width = PCB_COORD_TO_MIL(DXF_X(PCB, width)); - dxf_height = PCB_COORD_TO_MIL(DXF_Y(PCB, height)); - dxf_width = PCB_COORD_TO_MIL(DXF_Y(PCB, width)); - if (dxf_width > dxf_height) { - /* - * the major axis of the ellipse coincides with the - * X-axis. - */ - dxf_x1 = DXF_X(PCB, (cx + width)); - dxf_y1 = DXF_Y(PCB, cy); - /* - * the dxf_ratio is the minor axis length over major - * axis length, and is always <= 1.0 - */ - dxf_ratio = dxf_height / dxf_width; - } - else { - /* - * the major axis of the ellipse coincides with the - * Y-axis. - */ - dxf_x1 = DXF_X(PCB, cx); - dxf_y1 = DXF_Y(PCB, (cy + height)); - /* - * the dxf_ratio is the minor axis length over major - * axis length, and is always <= 1.0 - */ - dxf_ratio = dxf_width / dxf_height; - } - } - /* - * we have to add 180 degrees for start_angle and end_angle because - * in the pcb universe 0 degrees (the negative X-axis) is to the left, - * and in the dxf universe 0 degrees is to the right. - */ - dxf_start_angle = TO_RADIANS(start_angle + 180); - dxf_end_angle = TO_RADIANS(start_angle + delta_angle + 180); - if (dxf_start_angle >= (2 * M_PI)) { - dxf_start_angle = dxf_start_angle - (2 * M_PI); - } - if (dxf_end_angle >= (2 * M_PI)) { - dxf_end_angle = dxf_end_angle - (2 * M_PI); - } - if (dxf_color_is_byblock) { - dxf_color = DXF_COLOR_BYBLOCK; - } - else - dxf_color = gc->color; - dxf_arcstart_x = DXF_X(PCB, arcStartX); - dxf_arcstart_y = DXF_Y(PCB, arcStartY); - dxf_arcstop_x = DXF_X(PCB, arcStopX); - dxf_arcstop_y = DXF_Y(PCB, arcStopY); - /* - * This is just a dirty hack for AutoCAD doesn't have endcap styles. - * Donuts can not be implemented in the trace polyline since donuts - * are a closed polyline themselves. - */ - if (gc->cap == SHP_ROUND) { - /* place a donut at the start of the trace segment */ - dxf_write_polyline(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - 0.0, /* x0, */ - 0.0, /* y0, */ - 0.0, /* z0, */ - 0.0, /* extr_x0, */ - 0.0, /* extr_y0, */ - 1.0, /* extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, dxf_color, /* color, */ - 1, /* vertices_follow, */ - 0, /* modelspace, */ - 1, /* flag, */ - 0, /* polygon_mesh_M_vertex_count, */ - 0, /* polygon_mesh_N_vertex_count, */ - 0, /* smooth_M_surface_density, */ - 0, /* smooth_N_surface_density, */ - 0 /* surface_type */ - ); - dxf_id_code++; - /* - * write first XY-coordinate (at the start of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_arcstart_x - (0.25 * dxf_start_width), dxf_arcstart_y, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write second XY-coordinate (at the start of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_arcstart_x + (0.25 * dxf_start_width), dxf_arcstart_y, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write the end of polyline sequence marker. - */ - dxf_write_endseq(fp); - /* - * place a donut at the end of the trace segment. - */ - dxf_write_polyline(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - 0.0, /* x0, */ - 0.0, /* y0, */ - 0.0, /* z0, */ - 0.0, /* extr_x0, */ - 0.0, /* extr_y0, */ - 1.0, /* extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, dxf_color, /* color, */ - 1, /* vertices_follow, */ - 0, /* modelspace, */ - 1, /* flag, */ - 0, /* polygon_mesh_M_vertex_count, */ - 0, /* polygon_mesh_N_vertex_count, */ - 0, /* smooth_M_surface_density, */ - 0, /* smooth_N_surface_density, */ - 0 /* surface_type */ - ); - dxf_id_code++; - /* - * write first XY-coordinate (at the end of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_arcstop_x - (0.25 * dxf_start_width), dxf_arcstop_y, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write second XY-coordinate (at the end of trace segment). - */ - dxf_write_vertex(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_arcstop_x + (0.25 * dxf_start_width), dxf_arcstop_y, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* thickness, *//* copper weight ?? */ - 0.5 * dxf_start_width, 0.5 * dxf_end_width, 1.0, /* bulge, */ - 0.0, /* curve_fit_tangent_direction, */ - dxf_color, 0, /* modelspace, */ - 0 /* flag */ - ); - dxf_id_code++; - /* - * write the end of polyline sequence marker. - */ - dxf_write_endseq(fp); - } - /* - * write an ellipse for the trace. - */ - dxf_write_ellipse(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, dxf_y0, 0.0, /* z0, */ - dxf_x1, dxf_y1, 0.0, /* z1, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* dxf_extr_x0, */ - 0.0, /* dxf_extr_y0, */ - 1.0, /* dxf_extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_ratio, dxf_start_angle, dxf_end_angle, dxf_color, 0 /* modelspace */ - ); - dxf_id_code++; - dxf_lastX = arcStopX; - dxf_lastY = arcStopY; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_draw_arc () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Draw a filled circle. - * - * The usual drawing functions.\n - * "draw" means to use segments of the given width, whereas "fill" means to - * fill to a zero-width outline.\n - * \todo Implement a donut (polyline) instead of a circle. - */ -static void dxf_fill_circle(hidGC gc, - /*!< graphic context. */ - int cx, - /*!< X-value center point. */ - int cy, - /*!< Y-value center point. */ - int radius - /*!< radius of circle. */ - ) { - double dxf_x0; - double dxf_y0; - double dxf_radius; - int dxf_color; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_fill_circle () function.\n", __FILE__, __LINE__); -#endif - /* - * return if no valid file pointer exists. - */ - if (!fp) { - fprintf(stderr, "Warning: no valid file pointer exists.\n"); - return; - } - /* - * drill sizes increase per 2 mil ? - */ - if (is_drill) { - radius = DXF_ROUND(radius * 2) / 2; - } - dxf_use_gc(gc, radius); - if (is_drill) { - if (dxf_n_pending_drills >= dxf_max_pending_drills) { - dxf_max_pending_drills += 100; - /* - * re-allocate for another 100 pending drills. - */ - dxf_pending_drills = (DxfPendingDrills *) realloc(dxf_pending_drills, dxf_max_pending_drills * sizeof(DxfPendingDrills)); - } - dxf_pending_drills[dxf_n_pending_drills].x = cx; - dxf_pending_drills[dxf_n_pending_drills].y = cy; - dxf_pending_drills[dxf_n_pending_drills].diam = radius * 2; - dxf_n_pending_drills++; - return; - } - else if (gc->drill) - return; - if (dxf_metric) { /* use metric mm */ - dxf_x0 = PCB_COORD_TO_MM(DXF_X(PCB, cx)); - dxf_y0 = PCB_COORD_TO_MM(DXF_Y(PCB, cy)); - dxf_radius = PCB_COORD_TO_MM(DXF_X(PCB, radius)); - } - else { /* use imperial mil */ - - dxf_x0 = PCB_COORD_TO_MIL(DXF_X(PCB, cx)); - dxf_y0 = PCB_COORD_TO_MIL(DXF_Y(PCB, cy)); - dxf_radius = PCB_COORD_TO_MIL(DXF_X(PCB, radius)); - } - if (dxf_color_is_byblock) { - dxf_color = DXF_COLOR_BYBLOCK; - } - else - dxf_color = gc->color; - dxf_write_circle(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, dxf_y0, 0.0, /* z0, *//* curved or flexable pcb's ?? */ - 0.0, /* dxf_extr_x0, */ - 0.0, /* dxf_extr_y0, */ - 1.0, /* dxf_extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - dxf_radius, dxf_color, 0 /* modelspace */ - ); - dxf_id_code++; - dxf_lastX = dxf_x0; - dxf_lastY = dxf_y0; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_fill_circle () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Draw a filled polygon. - * - * The usual drawing functions.\n - * "draw" means to use segments of the given width, whereas "fill" means to - * fill to a zero-width outline.\n - * A polygon is drawn with a solid fill pattern. - * - * The filled polygon is by drawn by a (closed) polyline sequence with - * (n_coords + 1) vertices and add a SOLID hatch pattern to this polyline.\n - * This solution would allow for thieving if it were ever implemented in pcb - * (select a hatch pattern, create a boundary path, apply a scale and all the - * other stuff that is needed). - */ -static void dxf_fill_polygon(hidGC gc, - /*!< graphic context. */ - int n_coords, - /*!< number of XY-coordinates. */ - int *x, - /*!< pointer to array of X-values of coordinates. */ - int *y - /*!< pointer to array of Y-values of coordinates. */ - ) { - pcb_bool m; - int i; - double dxf_x0; - double dxf_y0; - int dxf_color; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_fill_polygon () function.\n", __FILE__, __LINE__); -#endif - dxf_x0 = 0.0; - dxf_y0 = 0.0; - dxf_color = DXF_COLOR_BYLAYER; - - m = pcb_false; - if (is_mask && current_mask == HID_MASK_BEFORE) { - return; - } - dxf_use_gc(gc, 10 * 100); - /* - * return if no valid file pointer exists. - */ - if (!fp) { - fprintf(stderr, "Warning: no valid file pointer exists.\n"); - return; - } - if (dxf_color_is_byblock) { - dxf_color = DXF_COLOR_BYBLOCK; - } - else - dxf_color = gc->color; - /* - * write hatch sequence. - */ - dxf_write_hatch(fp, DXF_DEFAULT_HATCH_PATTERN_NAME, /* pattern_name, */ - dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, dxf_y0, 0.0, /* z0, *//* stacked, curved or flexable pcb's ?? */ - 0.0, /* extr_x0, */ - 0.0, /* extr_y0, */ - 1.0, /* extr_z0, */ - 0.0, /* thickness, *//* copper weight ?? */ - 1.0, /* pattern_scale, */ - 0.0, /* pixel_size, */ - 45.0, /* pattern_angle, */ - dxf_color, 0, /* modelspace, */ - 1, /* solid_fill, */ - 1, /* associative, */ - 0, /* style, */ - 1, /* pattern_style, */ - 0, /* pattern_double, */ - 0, /* pattern_def_lines, */ - 1, /* boundary_paths, */ - 0, /* seed_points, */ - 0, /* seed_x0, */ - 0 /* seed_y0, */ - ); - /* - * draw hatch boundary path polyline. - */ - dxf_write_hatch_boundary_path_polyline(fp, 2, /* path_type_flag, *//* 2 = polyline */ - 0, /* polyline_has_bulge, *//* 0 = polygons have sharp angles */ - 1, /* polyline_is_closed, *//* 1 = closed */ - n_coords + 1 /* polyline_vertices, *//* number of polyline vertices to follow */ - ); - /* - * draw hatch boundary polyline vertices, write (n_coords) - * XY-coordinates. - */ - for (i = 0; i < n_coords; i++) { - dxf_x0 = DXF_X(PCB, x[i]); - dxf_y0 = DXF_Y(PCB, y[i]); - dxf_write_hatch_boundary_path_polyline_vertex(fp, dxf_x0, dxf_y0, 0.0 /* dxf_z0 */ - ); - /* - * close polyline with first coordinate X-Y pair. - */ - dxf_x0 = DXF_X(PCB, x[0]); - dxf_y0 = DXF_Y(PCB, y[0]); - dxf_write_hatch_boundary_path_polyline_vertex(fp, dxf_x0, dxf_y0, 0.0 /* dxf_z0 */ - ); - } - dxf_id_code++; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_fill_polygon () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief Draw a filled rectangle. - * - * The usual drawing functions.\n - * "draw" means to use segments of the given width, whereas "fill" means to - * fill to a zero-width outline.\n - */ -static void dxf_fill_rect(hidGC gc, - /*!< graphic context. */ - int x1, - /*!< X-value bottom left ?? point. */ - int y1, - /*!< Y-value bottom left ?? point. */ - int x2, - /*!< X-value top right ?? point. */ - int y2 - /*!< Y-value top right ?? point. */ - ) { - int dxf_color; - double dxf_x0; - double dxf_y0; - double dxf_x1; - double dxf_y1; - double dxf_x2; - double dxf_y2; - double dxf_x3; - double dxf_y3; - -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Entering dxf_fill_rect () function.\n", __FILE__, __LINE__); -#endif - /* - * return if no valid file pointer exists. - */ - if (!fp) { - fprintf(stderr, "Warning: no valid file pointer exists.\n"); - return; - } - if ((x1 == x2) && (y1 == y2)) { - fprintf(stderr, "Warning: start point and end point are identical for the entity with id-code: %x\n", dxf_id_code); - fprintf(stderr, " entity is discarded from output.\n"); - return; - } - if (dxf_color_is_byblock) { - dxf_color = DXF_COLOR_BYBLOCK; - } - else - dxf_color = gc->color; - dxf_x0 = DXF_X(PCB, x1); - dxf_y0 = DXF_Y(PCB, y1); - dxf_x1 = DXF_X(PCB, x2); - dxf_y1 = DXF_Y(PCB, y1); - dxf_x2 = DXF_X(PCB, x1); - dxf_y2 = DXF_Y(PCB, y2); - dxf_x3 = DXF_X(PCB, x2); - dxf_y3 = DXF_Y(PCB, y2); - dxf_write_solid(fp, dxf_id_code, DXF_DEFAULT_LINETYPE, /* linetype, */ - DXF_DEFAULT_LAYER, /* layer, */ - dxf_x0, /* base point, bottom left */ - dxf_y0, 0.0, /* z0, */ - dxf_x1, /* alignment point, bottom right */ - dxf_y1, 0.0, /* z1, */ - dxf_x2, /* alignment point, top left */ - dxf_y2, 0.0, /* z2, */ - dxf_x3, /* alignment point, top right */ - dxf_y3, 0.0, /* z3, */ - 0.0, /* thickness, */ - dxf_color, 0 /* modelspace */ - ); - dxf_id_code++; -#if DEBUG - fprintf(stderr, "[File: %s: line: %d] Leaving dxf_fill_rect () function.\n", __FILE__, __LINE__); -#endif -} - - -/*! - * \brief This is for the printer. - * - * If you call this for the GUI, xval and yval are ignored, and a dialog pops - * up to lead you through the calibration procedure.\n - * For the printer, if xval and yval are zero, a calibration page is printed - * with instructions for calibrating your printer.\n - * After calibrating, nonzero xval and yval are passed according to the - * instructions.\n - * Metric is nonzero if the user prefers metric units, else inches are used.\n - * Calibrate a DXF file ?.\n - * Since we do not calibrate a DXF file, we ignore this one. - */ -static void dxf_calibrate(double xval, - /*!< X-value. */ - double yval - /*!< Y-value. */ - ) { - /* Intentionally: do nothing here */ -} - - -/*! - * \brief Sets the crosshair. - * - * Which may differ from the pointer depending on grid and pad snap.\n - * Note that the HID is responsible for hiding, showing, redrawing, etc.\n - * The core just tells it what coordinates it's actually using.\n - * Note that this routine may need to know what "pcb units" are so it can - * display them in mm or mils accordingly.\n - * Set a crosshair in a DXF file ?.\n - * Since it is useless to set a crosshair in a DXF file, we ignore this one. - */ -static void dxf_set_crosshair(int x, - /*!< X-value of coordinate. */ - int y - /*!< Y-value of coordinate. */ - ) { - /* Intentionally: do nothing here */ -} - - -/*! - * \brief Show item ?. - */ -static void dxf_show_item(void *item) -{ -} - - -/*! - * \brief Send beep signal to stdout ?. - */ -static void dxf_beep(void) -{ - putchar(7); - fflush(stdout); -} - - -/*! - * \brief Show progress ?. - */ -static void dxf_progress(int dxf_so_far, int dxf_total, const char *dxf_message) -{ -} - -const char *dxf_cookie = "dxf exporter"; - - -/*! - * \brief Call this as soon as possible from main(). - * - * Initialise and register the DXF HID. - * No other HID calls are valid until this is called. - */ -pcb_uninit_t hid_export_dxf_init() -{ - memset(&dxf_hid, 0, sizeof(HID)); - - common_nogui_init(&dxf_hid); - common_draw_helpers_init(&dxf_hid); - dxf_hid.struct_size = sizeof(HID); - dxf_hid.name = "dxf"; - dxf_hid.description = "DXF export"; - dxf_hid.exporter = 1; - dxf_hid.poly_before = 1; - - dxf_hid.get_export_options = dxf_get_export_options; - dxf_hid.do_export = dxf_do_export; - dxf_hid.parse_arguments = dxf_parse_arguments; - dxf_hid.set_layer = dxf_set_layer; - dxf_hid.calibrate = dxf_calibrate; - dxf_hid.set_crosshair = dxf_set_crosshair; - dxf_hid.show_item = dxf_show_item; - dxf_hid.beep = dxf_beep; - dxf_hid.progress = dxf_progress; - - dxf_hid.make_gc = dxf_make_gc; - dxf_hid.destroy_gc = dxf_destroy_gc; - dxf_hid.use_mask = dxf_use_mask; - dxf_hid.set_color = dxf_set_color; - dxf_hid.set_line_cap = dxf_set_line_cap; - dxf_hid.set_line_width = dxf_set_line_width; - dxf_hid.set_draw_xor = dxf_set_draw_xor; - dxf_hid.draw_line = dxf_draw_line; - dxf_hid.draw_arc = dxf_draw_arc; - dxf_hid.draw_rect = dxf_draw_rect; - dxf_hid.fill_circle = dxf_fill_circle; - dxf_hid.fill_polygon = dxf_fill_polygon; - dxf_hid.fill_rect = dxf_fill_rect; - - hid_register_hid(&dxf_hid); - - hid_register_attributes(dxf_options, sizeof(dxf_options) / sizeof(dxf_options[0]), dxf_cookie, 0); - -/* return hid_dxf_uninit();*/ - return NULL; -} - - -/* EOF */ Index: 1.1.4/src_plugins/export_dxf/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/export_dxf/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/export_dxf/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {export_dxf} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_dxf/dxf.o @] - -switch /local/pcb/export_dxf/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/export_dxf/README.orig =================================================================== --- 1.1.4/src_plugins/export_dxf/README.orig (revision 10776) +++ 1.1.4/src_plugins/export_dxf/README.orig (nonexistent) @@ -1,47 +0,0 @@ -The pcb DXF HID is a DXF exporter for pcb. - -The pcb DXF HID exports the loaded pcb layout to a series of DXF files, -typically one file for every layer, a DXF file for inserting elements by -means of "XREFS" (in AutoCAD jargon also known as eXternal REFerenced -drawings), and DXF files for plated and non-plated holes. - -These external referenced drawings can be 3D models of elements (ACIS), -including DDE/OLE attributes of any other application that is supported -by both AutoCAD (or any alternative software that supports these -features) and the (Microsoft) Operating System of your choice. - -The parameters for the DXF exporter are: - ---dxffile - -This is the basename of the generated files. -Layer-, top and bottom mask-, top and bottom paste, and drill-filenames -are based upon this string. - ---metric -Tick for mm, default is mil. - ---layer-color-BYBLOCK -Tick for layer color is BYBLOCK, default layer color is BYLAYER. - ---xrefs -Tick for generating an eXternal REFerence file, default is none. - ---xreffile -This string should contain the pathname of the location where your XREF -drawing files exist. - ---verbose -Tick if you want to see a full report on stderr of what entities are -written to the files, default is silent. - ---export-all-layers -Tick if you want to export all layers, default is to not export empty -layers. - -------------------------------------------------------------------------- - COPYRIGHT - -The pcb DXF HID is covered by the GNU General Public License. -See the individual files for the exact copyright notices. - Index: 1.1.4/src_plugins/export_dxf/README =================================================================== --- 1.1.4/src_plugins/export_dxf/README (revision 10776) +++ 1.1.4/src_plugins/export_dxf/README (nonexistent) @@ -1,5 +0,0 @@ -Export dxf - -#state: WIP -#default: disabled -#implements: export Index: 1.1.4/src_plugins/export_dxf/Makefile =================================================================== --- 1.1.4/src_plugins/export_dxf/Makefile (revision 10776) +++ 1.1.4/src_plugins/export_dxf/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_export_dxf - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/export_ps/ps.c =================================================================== --- 1.1.4/src_plugins/export_ps/ps.c (revision 10776) +++ 1.1.4/src_plugins/export_ps/ps.c (nonexistent) @@ -1,1631 +0,0 @@ -/* for popen() */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - -#include "config.h" - -#include -#include /* not used */ -#include -#include -#include /* not used */ -#include - -#include "global.h" -#include "data.h" -#include "misc.h" -#include "layer.h" -#include "error.h" -#include "draw.h" -#include "pcb-printf.h" -#include "plugins.h" -#include "hid_helper.h" - -#include "hid.h" -#include "hid_nogui.h" -#include "hid_draw_helpers.h" -#include "ps.h" -#include "draw_fab.h" -#include "hid_init.h" -#include "hid_attrib.h" -#include "hid_helper.h" -#include "hid_flags.h" -#include "hid_actions.h" -#include "conf_core.h" -#include "compat_misc.h" - -const char *ps_cookie = "ps HID"; - -static int ps_set_layer(const char *name, int group, int empty); -static void use_gc(hidGC gc); - -typedef struct hid_gc_struct { - HID *me_pointer; - EndCapStyle cap; - Coord width; - unsigned char r, g, b; - int erase; - int faded; -} hid_gc_struct; - -static const char *medias[] = { - "A0", "A1", "A2", "A3", "A4", "A5", - "A6", "A7", "A8", "A9", "A10", - "B0", "B1", "B2", "B3", "B4", "B5", - "B6", "B7", "B8", "B9", "B10", - "Letter", "11x17", "Ledger", - "Legal", "Executive", - "A-Size", "B-size", - "C-Size", "D-size", "E-size", - "US-Business_Card", "Intl-Business_Card", - 0 -}; - -typedef struct { - const char *name; - Coord Width, Height; - Coord MarginX, MarginY; -} MediaType, *MediaTypePtr; - -/* - * Metric ISO sizes in mm. See http://en.wikipedia.org/wiki/ISO_paper_sizes - * - * A0 841 x 1189 - * A1 594 x 841 - * A2 420 x 594 - * A3 297 x 420 - * A4 210 x 297 - * A5 148 x 210 - * A6 105 x 148 - * A7 74 x 105 - * A8 52 x 74 - * A9 37 x 52 - * A10 26 x 37 - * - * B0 1000 x 1414 - * B1 707 x 1000 - * B2 500 x 707 - * B3 353 x 500 - * B4 250 x 353 - * B5 176 x 250 - * B6 125 x 176 - * B7 88 x 125 - * B8 62 x 88 - * B9 44 x 62 - * B10 31 x 44 - * - * awk '{printf(" {\"%s\", %d, %d, MARGINX, MARGINY},\n", $2, $3*100000/25.4, $5*100000/25.4)}' - * - * See http://en.wikipedia.org/wiki/Paper_size#Loose_sizes for some of the other sizes. The - * {A,B,C,D,E}-Size here are the ANSI sizes and not the architectural sizes. - */ - -#define MARGINX PCB_MIL_TO_COORD(500) -#define MARGINY PCB_MIL_TO_COORD(500) - -static MediaType media_data[] = { - {"A0", PCB_MM_TO_COORD(841), PCB_MM_TO_COORD(1189), MARGINX, MARGINY}, - {"A1", PCB_MM_TO_COORD(594), PCB_MM_TO_COORD(841), MARGINX, MARGINY}, - {"A2", PCB_MM_TO_COORD(420), PCB_MM_TO_COORD(594), MARGINX, MARGINY}, - {"A3", PCB_MM_TO_COORD(297), PCB_MM_TO_COORD(420), MARGINX, MARGINY}, - {"A4", PCB_MM_TO_COORD(210), PCB_MM_TO_COORD(297), MARGINX, MARGINY}, - {"A5", PCB_MM_TO_COORD(148), PCB_MM_TO_COORD(210), MARGINX, MARGINY}, - {"A6", PCB_MM_TO_COORD(105), PCB_MM_TO_COORD(148), MARGINX, MARGINY}, - {"A7", PCB_MM_TO_COORD(74), PCB_MM_TO_COORD(105), MARGINX, MARGINY}, - {"A8", PCB_MM_TO_COORD(52), PCB_MM_TO_COORD(74), MARGINX, MARGINY}, - {"A9", PCB_MM_TO_COORD(37), PCB_MM_TO_COORD(52), MARGINX, MARGINY}, - {"A10", PCB_MM_TO_COORD(26), PCB_MM_TO_COORD(37), MARGINX, MARGINY}, - {"B0", PCB_MM_TO_COORD(1000), PCB_MM_TO_COORD(1414), MARGINX, MARGINY}, - {"B1", PCB_MM_TO_COORD(707), PCB_MM_TO_COORD(1000), MARGINX, MARGINY}, - {"B2", PCB_MM_TO_COORD(500), PCB_MM_TO_COORD(707), MARGINX, MARGINY}, - {"B3", PCB_MM_TO_COORD(353), PCB_MM_TO_COORD(500), MARGINX, MARGINY}, - {"B4", PCB_MM_TO_COORD(250), PCB_MM_TO_COORD(353), MARGINX, MARGINY}, - {"B5", PCB_MM_TO_COORD(176), PCB_MM_TO_COORD(250), MARGINX, MARGINY}, - {"B6", PCB_MM_TO_COORD(125), PCB_MM_TO_COORD(176), MARGINX, MARGINY}, - {"B7", PCB_MM_TO_COORD(88), PCB_MM_TO_COORD(125), MARGINX, MARGINY}, - {"B8", PCB_MM_TO_COORD(62), PCB_MM_TO_COORD(88), MARGINX, MARGINY}, - {"B9", PCB_MM_TO_COORD(44), PCB_MM_TO_COORD(62), MARGINX, MARGINY}, - {"B10", PCB_MM_TO_COORD(31), PCB_MM_TO_COORD(44), MARGINX, MARGINY}, - {"Letter", PCB_INCH_TO_COORD(8.5), PCB_INCH_TO_COORD(11), MARGINX, MARGINY}, - {"11x17", PCB_INCH_TO_COORD(11), PCB_INCH_TO_COORD(17), MARGINX, MARGINY}, - {"Ledger", PCB_INCH_TO_COORD(17), PCB_INCH_TO_COORD(11), MARGINX, MARGINY}, - {"Legal", PCB_INCH_TO_COORD(8.5), PCB_INCH_TO_COORD(14), MARGINX, MARGINY}, - {"Executive", PCB_INCH_TO_COORD(7.5), PCB_INCH_TO_COORD(10), MARGINX, MARGINY}, - {"A-size", PCB_INCH_TO_COORD(8.5), PCB_INCH_TO_COORD(11), MARGINX, MARGINY}, - {"B-size", PCB_INCH_TO_COORD(11), PCB_INCH_TO_COORD(17), MARGINX, MARGINY}, - {"C-size", PCB_INCH_TO_COORD(17), PCB_INCH_TO_COORD(22), MARGINX, MARGINY}, - {"D-size", PCB_INCH_TO_COORD(22), PCB_INCH_TO_COORD(34), MARGINX, MARGINY}, - {"E-size", PCB_INCH_TO_COORD(34), PCB_INCH_TO_COORD(44), MARGINX, MARGINY}, - {"US-Business_Card", PCB_INCH_TO_COORD(3.5), PCB_INCH_TO_COORD(2.0), 0, 0}, - {"Intl-Business_Card", PCB_INCH_TO_COORD(3.375), PCB_INCH_TO_COORD(2.125), 0, 0} -}; - -#undef MARGINX -#undef MARGINY - -HID_Attribute ps_attribute_list[] = { - /* other HIDs expect this to be first. */ - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --psfile -Name of the postscript output file. Can contain a path. -@end ftable -%end-doc -*/ - {"psfile", "Postscript output file", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_psfile 0 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@cindex drill-helper -@item --drill-helper -Print a centering target in large drill holes. -@end ftable -%end-doc -*/ - {"drill-helper", "Print a centering target in large drill holes", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_drillhelper 1 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@cindex align-marks -@item --align-marks -Print alignment marks on each sheet. This is meant to ease alignment during exposure. -@end ftable -%end-doc -*/ - {"align-marks", "Print alignment marks on each sheet", - HID_Boolean, 0, 0, {1, 0, 0}, 0, 0}, -#define HA_alignmarks 2 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --outline -Print the contents of the outline layer on each sheet. -@end ftable -%end-doc -*/ - {"outline", "Print outline on each sheet", - HID_Boolean, 0, 0, {1, 0, 0}, 0, 0}, -#define HA_outline 3 -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --mirror -Print mirror image. -@end ftable -%end-doc -*/ - {"mirror", "Print mirror image of every page", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_mirror 4 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --fill-page -Scale output to make the board fit the page. -@end ftable -%end-doc -*/ - {"fill-page", "Scale board to fill page", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_fillpage 5 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --auto-mirror -Print mirror image of appropriate layers. -@end ftable -%end-doc -*/ - {"auto-mirror", "Print mirror image of appropriate layers", - HID_Boolean, 0, 0, {1, 0, 0}, 0, 0}, -#define HA_automirror 6 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --ps-color -Postscript output in color. -@end ftable -%end-doc -*/ - {"ps-color", "Prints in color", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_color 7 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@cindex ps-bloat -@item --ps-bloat -Amount to add to trace/pad/pin edges. -@end ftable -%end-doc -*/ - {"ps-bloat", "Amount to add to trace/pad/pin edges", - HID_Coord, -PCB_MIL_TO_COORD(100), PCB_MIL_TO_COORD(100), {0, 0, 0}, 0, 0}, -#define HA_psbloat 8 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@cindex ps-invert -@item --ps-invert -Draw objects as white-on-black. -@end ftable -%end-doc -*/ - {"ps-invert", "Draw objects as white-on-black", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_psinvert 9 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --media -Size of the media, the postscript is fitted to. The parameter -@code{} can be any of the standard names for paper size: @samp{A0} -to @samp{A10}, @samp{B0} to @samp{B10}, @samp{Letter}, @samp{11x17}, -@samp{Ledger}, @samp{Legal}, @samp{Executive}, @samp{A-Size}, @samp{B-size}, -@samp{C-Size}, @samp{D-size}, @samp{E-size}, @samp{US-Business_Card}, -@samp{Intl-Business_Card}. -@end ftable -%end-doc -*/ - {"media", "media type", - HID_Enum, 0, 0, {22, 0, 0}, medias, 0}, -#define HA_media 10 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@cindex psfade -@item --psfade -Fade amount for assembly drawings (0.0=missing, 1.0=solid). -@end ftable -%end-doc -*/ - {"psfade", "Fade amount for assembly drawings (0.0=missing, 1.0=solid)", - HID_Real, 0, 1, {0, 0, 0.40}, 0, 0}, -#define HA_psfade 11 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --scale -Scale value to compensate for printer sizing errors (1.0 = full scale). -@end ftable -%end-doc -*/ - {"scale", "Scale value to compensate for printer sizing errors (1.0 = full scale)", - HID_Real, 0.01, 4, {0, 0, 1.00}, 0, 0}, -#define HA_scale 12 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@cindex multi-file -@item --multi-file -Produce multiple files, one per page, instead of a single multi page file. -@end ftable -%end-doc -*/ - {"multi-file", "Produce multiple files, one per page, instead of a single file", - HID_Boolean, 0, 0, {0, 0, 0.40}, 0, 0}, -#define HA_multifile 13 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --xcalib -Paper width. Used for x-Axis calibration. -@end ftable -%end-doc -*/ - {"xcalib", "Paper width. Used for x-Axis calibration", - HID_Real, 0, 0, {0, 0, 1.0}, 0, 0}, -#define HA_xcalib 14 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --ycalib -Paper height. Used for y-Axis calibration. -@end ftable -%end-doc -*/ - {"ycalib", "Paper height. Used for y-Axis calibration", - HID_Real, 0, 0, {0, 0, 1.0}, 0, 0}, -#define HA_ycalib 15 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --drill-copper -Draw drill holes in pins / vias, instead of leaving solid copper. -@end ftable -%end-doc -*/ - {"drill-copper", "Draw drill holes in pins / vias, instead of leaving solid copper", - HID_Boolean, 0, 0, {1, 0, 0}, 0, 0}, -#define HA_drillcopper 16 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@cindex show-legend -@item --show-legend -Print file name and scale on printout. -@end ftable -%end-doc -*/ - {"show-legend", "Print file name and scale on printout", - HID_Boolean, 0, 0, {1, 0, 0}, 0, 0}, -#define HA_legend 17 - -/* %start-doc options "91 Postscript Export" -@ftable @code -@item --polygrid -If non-zero grid polygons instead of filling them with gridlines spaced as specified. -@end ftable -%end-doc -*/ - {"polygrid", "When non-zero: grid polygons instead of filling with gridlines spaced as specified", - HID_Real, 0, 10, {0, 0, 0.0}, 0, 0}, -#define HA_polygrid 18 - -}; - -#define NUM_OPTIONS (sizeof(ps_attribute_list)/sizeof(ps_attribute_list[0])) - -REGISTER_ATTRIBUTES(ps_attribute_list, ps_cookie) - -/* All file-scope data is in global struct */ -static struct { - double calibration_x, calibration_y; - - FILE *f; - int pagecount; - Coord linewidth; - pcb_bool print_group[MAX_LAYER]; - pcb_bool print_layer[MAX_LAYER]; - double fade_ratio; - pcb_bool multi_file; - Coord media_width, media_height, ps_width, ps_height; - - const char *filename; - pcb_bool drill_helper; - pcb_bool align_marks; - pcb_bool outline; - pcb_bool mirror; - pcb_bool fillpage; - pcb_bool automirror; - pcb_bool incolor; - pcb_bool doing_toc; - Coord bloat; - pcb_bool invert; - int media_idx; - pcb_bool drillcopper; - pcb_bool legend; - - LayerTypePtr outline_layer; - - double scale_factor; - - BoxType region; - - HID_Attr_Val ps_values[NUM_OPTIONS]; - - pcb_bool is_mask; - pcb_bool is_drill; - pcb_bool is_assy; - pcb_bool is_copper; - pcb_bool is_paste; - - double polygrid; -} global; - -static HID_Attribute *ps_get_export_options(int *n) -{ - static char *last_made_filename = 0; - if (PCB) - derive_default_filename(PCB->Filename, &ps_attribute_list[HA_psfile], ".ps", &last_made_filename); - - if (n) - *n = NUM_OPTIONS; - return ps_attribute_list; -} - -static int group_for_layer(int l) -{ - if (l < max_copper_layer + 2 && l >= 0) - return GetLayerGroupNumberByNumber(l); - /* else something unique */ - return max_group + 3 + l; -} - -static int layer_sort(const void *va, const void *vb) -{ - int a = *(int *) va; - int b = *(int *) vb; - int d = group_for_layer(b) - group_for_layer(a); - if (d) - return d; - return b - a; -} - -void ps_start_file(FILE * f) -{ - time_t currenttime = time(NULL); - - fprintf(f, "%%!PS-Adobe-3.0\n"); - - /* Document Structuring Conventions (DCS): */ - - /* Start General Header Comments: */ - - /* - * %%Title DCS provides text title for the document that is useful - * for printing banner pages. - */ - fprintf(f, "%%%%Title: %s\n", PCB->Filename); - - /* - * %%CreationDate DCS indicates the date and time the document was - * created. Neither the date nor time need be in any standard - * format. This comment is meant to be used purely for informational - * purposes, such as printing on banner pages. - */ - fprintf(f, "%%%%CreationDate: %s", asctime(localtime(¤ttime))); - - /* - * %%Creator DCS indicates the document creator, usually the name of - * the document composition software. - */ - fprintf(f, "%%%%Creator: PCB release: pcb-rnd " VERSION "\n"); - - /* - * %%Version DCS comment can be used to note the version and - * revision number of a document or resource. A document manager may - * wish to provide version control services, or allow substitution - * of compatible versions/revisions of a resource or document. - * - * The format should be in the form of 'procname': - * ::= < name> < version> < revision> - * < name> ::= < text> - * < version> ::= < real> - * < revision> ::= < uint> - * - * If a version numbering scheme is not used, these fields should - * still be filled with a dummy value of 0. - * - * There is currently no code in PCB to manage this revision number. - * - */ - fprintf(f, "%%%%Version: (PCB pcb-rnd " VERSION ") 0.0 0\n"); - - - /* - * %%PageOrder DCS is intended to help document managers determine - * the order of pages in the document file, which in turn enables a - * document manager optionally to reorder the pages. 'Ascend'-The - * pages are in ascending order for example, 1-2-3-4-5-6. - */ - fprintf(f, "%%%%PageOrder: Ascend\n"); - - /* - * %%Pages: < numpages> | (atend) < numpages> ::= < uint> (Total - * %%number of pages) - * - * %%Pages DCS defines the number of virtual pages that a document - * will image. (atend) defers the count until the end of the file, - * which is useful for dynamically generated contents. - */ - fprintf(f, "%%%%Pages: (atend)\n"); - - /* - * %%DocumentMedia: - * - * Substitute 0 or "" for N/A. Width and height are in points - * (1/72"). - * - * Media sizes are in PCB units - */ - pcb_fprintf(f, "%%%%DocumentMedia: %s %mi %mi 0 \"\" \"\"\n", - media_data[global.media_idx].name, - 72 * media_data[global.media_idx].Width, 72 * media_data[global.media_idx].Height); - pcb_fprintf(f, "%%%%DocumentPaperSizes: %s\n", media_data[global.media_idx].name); - - /* End General Header Comments. */ - - /* General Body Comments go here. Currently there are none. */ - - /* - * %%EndComments DCS indicates an explicit end to the header - * comments of the document. All global DCS's must preceded - * this. A blank line gives an implicit end to the comments. - */ - fprintf(f, "%%%%EndComments\n\n"); -} - -static void ps_end_file(FILE * f) -{ - /* - * %%Trailer DCS must only occur once at the end of the document - * script. Any post-processing or cleanup should be contained in - * the trailer of the document, which is anything that follows the - * %%Trailer comment. Any of the document level structure comments - * that were deferred by using the (atend) convention must be - * mentioned in the trailer of the document after the %%Trailer - * comment. - */ - fprintf(f, "%%%%Trailer\n"); - - /* - * %%Pages was deferred until the end of the document via the - * (atend) mentioned, in the General Header section. - */ - fprintf(f, "%%%%Pages: %d\n", global.pagecount); - - /* - * %%EOF DCS signifies the end of the document. When the document - * manager sees this comment, it issues an end-of-file signal to the - * PostScript interpreter. This is done so system-dependent file - * endings, such as Control-D and end-of-file packets, do not - * confuse the PostScript interpreter. - */ - fprintf(f, "%%%%EOF\n"); -} - -static FILE *psopen(const char *base, const char *which) -{ - FILE *ps_open_file; - char *buf, *suff, *buf2; - - if (!global.multi_file) - return fopen(base, "w"); - - buf = (char *) malloc(strlen(base) + strlen(which) + 5); - - suff = (char *) strrchr(base, '.'); - if (suff) { - strcpy(buf, base); - buf2 = strrchr(buf, '.'); - sprintf(buf2, ".%s.%s", which, suff + 1); - } - else { - sprintf(buf, "%s.%s.ps", base, which); - } - printf("PS: open %s\n", buf); - ps_open_file = fopen(buf, "w"); - free(buf); - return ps_open_file; -} - -/* This is used by other HIDs that use a postscript format, like lpr - or eps. */ -void ps_hid_export_to_file(FILE * the_file, HID_Attr_Val * options) -{ - int i; - static int saved_layer_stack[MAX_LAYER]; - - conf_force_set_bool(conf_core.editor.thin_draw, 0); - conf_force_set_bool(conf_core.editor.thin_draw_poly, 0); - conf_force_set_bool(conf_core.editor.check_planes, 0); - - global.f = the_file; - global.drill_helper = options[HA_drillhelper].int_value; - global.align_marks = options[HA_alignmarks].int_value; - global.outline = options[HA_outline].int_value; - global.mirror = options[HA_mirror].int_value; - global.fillpage = options[HA_fillpage].int_value; - global.automirror = options[HA_automirror].int_value; - global.incolor = options[HA_color].int_value; - global.bloat = options[HA_psbloat].int_value; - global.invert = options[HA_psinvert].int_value; - global.fade_ratio = PCB_CLAMP(options[HA_psfade].real_value, 0, 1); - global.media_idx = options[HA_media].int_value; - global.media_width = media_data[global.media_idx].Width; - global.media_height = media_data[global.media_idx].Height; - global.ps_width = global.media_width - 2.0 * media_data[global.media_idx].MarginX; - global.ps_height = global.media_height - 2.0 * media_data[global.media_idx].MarginY; - global.scale_factor = options[HA_scale].real_value; - global.calibration_x = options[HA_xcalib].real_value; - global.calibration_y = options[HA_ycalib].real_value; - global.drillcopper = options[HA_drillcopper].int_value; - global.legend = options[HA_legend].int_value; - global.polygrid = options[HA_polygrid].real_value; - - if (the_file) - ps_start_file(the_file); - - if (global.fillpage) { - double zx, zy; - if (PCB->MaxWidth > PCB->MaxHeight) { - zx = global.ps_height / PCB->MaxWidth; - zy = global.ps_width / PCB->MaxHeight; - } - else { - zx = global.ps_height / PCB->MaxHeight; - zy = global.ps_width / PCB->MaxWidth; - } - global.scale_factor *= MIN(zx, zy); - } - - memset(global.print_group, 0, sizeof(global.print_group)); - memset(global.print_layer, 0, sizeof(global.print_layer)); - - global.outline_layer = NULL; - - for (i = 0; i < max_copper_layer; i++) { - LayerType *layer = PCB->Data->Layer + i; - if (!LAYER_IS_EMPTY(layer)) - global.print_group[GetLayerGroupNumberByNumber(i)] = 1; - - if (strcmp(layer->Name, "outline") == 0 || strcmp(layer->Name, "route") == 0) { - global.outline_layer = layer; - } - } - global.print_group[GetLayerGroupNumberByNumber(solder_silk_layer)] = 1; - global.print_group[GetLayerGroupNumberByNumber(component_silk_layer)] = 1; - for (i = 0; i < max_copper_layer; i++) - if (global.print_group[GetLayerGroupNumberByNumber(i)]) - global.print_layer[i] = 1; - - memcpy(saved_layer_stack, LayerStack, sizeof(LayerStack)); - qsort(LayerStack, max_copper_layer, sizeof(LayerStack[0]), layer_sort); - - global.linewidth = -1; - /* reset static vars */ - ps_set_layer(NULL, 0, -1); - use_gc(NULL); - - global.region.X1 = 0; - global.region.Y1 = 0; - global.region.X2 = PCB->MaxWidth; - global.region.Y2 = PCB->MaxHeight; - - if (!global.multi_file) { - /* %%Page DSC requires both a label and an ordinal */ - fprintf(the_file, "%%%%Page: TableOfContents 1\n"); - fprintf(the_file, "/Times-Roman findfont 24 scalefont setfont\n"); - fprintf(the_file, "/rightshow { /s exch def s stringwidth pop -1 mul 0 rmoveto s show } def\n"); - fprintf(the_file, "/y 72 9 mul def /toc { 100 y moveto show /y y 24 sub def } bind def\n"); - fprintf(the_file, "/tocp { /y y 12 sub def 90 y moveto rightshow } bind def\n"); - - global.doing_toc = 1; - global.pagecount = 1; /* 'pagecount' is modified by hid_expose_callback() call */ - hid_expose_callback(&ps_hid, &global.region, 0); - } - - global.pagecount = 1; /* Reset 'pagecount' if single file */ - global.doing_toc = 0; - ps_set_layer(NULL, 0, -1); /* reset static vars */ - hid_expose_callback(&ps_hid, &global.region, 0); - - if (the_file) - fprintf(the_file, "showpage\n"); - - memcpy(LayerStack, saved_layer_stack, sizeof(LayerStack)); - conf_update(NULL); /* restore forced sets */ -} - -static void ps_do_export(HID_Attr_Val * options) -{ - FILE *fh; - int save_ons[MAX_LAYER + 2]; - int i; - - if (!options) { - ps_get_export_options(0); - for (i = 0; i < NUM_OPTIONS; i++) - global.ps_values[i] = ps_attribute_list[i].default_val; - options = global.ps_values; - } - - global.filename = options[HA_psfile].str_value; - if (!global.filename) - global.filename = "pcb-out.ps"; - - global.multi_file = options[HA_multifile].int_value; - - if (global.multi_file) - fh = 0; - else { - fh = psopen(global.filename, "toc"); - if (!fh) { - perror(global.filename); - return; - } - } - - hid_save_and_show_layer_ons(save_ons); - ps_hid_export_to_file(fh, options); - hid_restore_layer_ons(save_ons); - - global.multi_file = 0; - if (fh) { - ps_end_file(fh); - fclose(fh); - } -} - -static void ps_parse_arguments(int *argc, char ***argv) -{ - hid_register_attributes(ps_attribute_list, NUM_OPTIONS, ps_cookie, 0); - hid_parse_command_line(argc, argv); -} - -static void corner(FILE * fh, Coord x, Coord y, Coord dx, Coord dy) -{ - Coord len = PCB_MIL_TO_COORD(2000); - Coord len2 = PCB_MIL_TO_COORD(200); - Coord thick = 0; - /* - * Originally 'thick' used thicker lines. Currently is uses - * Postscript's "device thin" line - i.e. zero width means one - * device pixel. The code remains in case you want to make them - * thicker - it needs to offset everything so that the *edge* of the - * thick line lines up with the edge of the board, not the *center* - * of the thick line. - */ - - pcb_fprintf(fh, "gsave %mi setlinewidth %mi %mi translate %mi %mi scale\n", thick * 2, x, y, dx, dy); - pcb_fprintf(fh, "%mi %mi moveto %mi %mi %mi 0 90 arc %mi %mi lineto\n", len, thick, thick, thick, len2 + thick, thick, len); - if (dx < 0 && dy < 0) - pcb_fprintf(fh, "%mi %mi moveto 0 %mi rlineto\n", len2 * 2 + thick, thick, -len2); - fprintf(fh, "stroke grestore\n"); -} - -static int ps_set_layer(const char *name, int group, int empty) -{ - static int lastgroup = -1; - time_t currenttime; - int idx = (group >= 0 && group < max_group) - ? PCB->LayerGroups.Entries[group][0] - : group; - if (name == 0) - name = PCB->Data->Layer[idx].Name; - - if (empty == -1) - lastgroup = -1; - if (empty) - return 0; - - if (idx >= 0 && idx < max_copper_layer && !global.print_layer[idx]) - return 0; - - if (strcmp(name, "invisible") == 0) - return 0; - - global.is_drill = (SL_TYPE(idx) == SL_PDRILL || SL_TYPE(idx) == SL_UDRILL); - global.is_mask = (SL_TYPE(idx) == SL_MASK); - global.is_assy = (SL_TYPE(idx) == SL_ASSY); - global.is_copper = (SL_TYPE(idx) == 0); - global.is_paste = (SL_TYPE(idx) == SL_PASTE); -#if 0 - printf("Layer %s group %d drill %d mask %d\n", name, group, global.is_drill, global.is_mask); -#endif - - if (global.doing_toc) { - if (group < 0 || group != lastgroup) { - if (global.pagecount == 1) { - currenttime = time(NULL); - fprintf(global.f, "30 30 moveto (%s) show\n", PCB->Filename); - - fprintf(global.f, "(%d.) tocp\n", global.pagecount); - fprintf(global.f, "(Table of Contents \\(This Page\\)) toc\n"); - - fprintf(global.f, "(Created on %s) toc\n", asctime(localtime(¤ttime))); - fprintf(global.f, "( ) tocp\n"); - } - - global.pagecount++; - lastgroup = group; - fprintf(global.f, "(%d.) tocp\n", global.pagecount); - } - fprintf(global.f, "(%s) toc\n", name); - return 0; - } - - if (group < 0 || group != lastgroup) { - double boffset; - int mirror_this = 0; - lastgroup = group; - - if (global.pagecount != 0) { - pcb_fprintf(global.f, "showpage\n"); - } - global.pagecount++; - if (global.multi_file) { - if (global.f) { - ps_end_file(global.f); - fclose(global.f); - } - global.f = psopen(global.filename, layer_type_to_file_name(idx, FNS_fixed)); - if (!global.f) { - perror(global.filename); - return 0; - } - - ps_start_file(global.f); - } - - /* - * %%Page DSC comment marks the beginning of the PostScript - * language instructions that describe a particular - * page. %%Page: requires two arguments: a page label and a - * sequential page number. The label may be anything, but the - * ordinal page number must reflect the position of that page in - * the body of the PostScript file and must start with 1, not 0. - */ - fprintf(global.f, "%%%%Page: %s %d\n", layer_type_to_file_name(idx, FNS_fixed), global.pagecount); - - if (global.mirror) - mirror_this = !mirror_this; - if (global.automirror && ((idx >= 0 && group == GetLayerGroupNumberByNumber(solder_silk_layer)) - || (idx < 0 && SL_SIDE(idx) == SL_BOTTOM_SIDE))) - mirror_this = !mirror_this; - - fprintf(global.f, "/Helvetica findfont 10 scalefont setfont\n"); - if (global.legend) { - fprintf(global.f, "30 30 moveto (%s) show\n", PCB->Filename); - if (PCB->Name) - fprintf(global.f, "30 41 moveto (%s, %s) show\n", PCB->Name, layer_type_to_file_name(idx, FNS_fixed)); - else - fprintf(global.f, "30 41 moveto (%s) show\n", layer_type_to_file_name(idx, FNS_fixed)); - if (mirror_this) - fprintf(global.f, "( \\(mirrored\\)) show\n"); - - if (global.fillpage) - fprintf(global.f, "(, not to scale) show\n"); - else - fprintf(global.f, "(, scale = 1:%.3f) show\n", global.scale_factor); - } - fprintf(global.f, "newpath\n"); - - pcb_fprintf(global.f, "72 72 scale %mi %mi translate\n", global.media_width / 2, global.media_height / 2); - - boffset = global.media_height / 2; - if (PCB->MaxWidth > PCB->MaxHeight) { - fprintf(global.f, "90 rotate\n"); - boffset = global.media_width / 2; - fprintf(global.f, "%g %g scale %% calibration\n", global.calibration_y, global.calibration_x); - } - else - fprintf(global.f, "%g %g scale %% calibration\n", global.calibration_x, global.calibration_y); - - if (mirror_this) - fprintf(global.f, "1 -1 scale\n"); - - fprintf(global.f, "%g dup neg scale\n", (SL_TYPE(idx) == SL_FAB) ? 1.0 : global.scale_factor); - pcb_fprintf(global.f, "%mi %mi translate\n", -PCB->MaxWidth / 2, -PCB->MaxHeight / 2); - - /* Keep the drill list from falling off the left edge of the paper, - * even if it means some of the board falls off the right edge. - * If users don't want to make smaller boards, or use fewer drill - * sizes, they can always ignore this sheet. */ - if (SL_TYPE(idx) == SL_FAB) { - Coord natural = boffset - PCB_MIL_TO_COORD(500) - PCB->MaxHeight / 2; - Coord needed = DrawFab_overhang(); - pcb_fprintf(global.f, "%% PrintFab overhang natural %mi, needed %mi\n", natural, needed); - if (needed > natural) - pcb_fprintf(global.f, "0 %mi translate\n", needed - natural); - } - - if (global.invert) { - fprintf(global.f, "/gray { 1 exch sub setgray } bind def\n"); - fprintf(global.f, "/rgb { 1 1 3 { pop 1 exch sub 3 1 roll } for setrgbcolor } bind def\n"); - } - else { - fprintf(global.f, "/gray { setgray } bind def\n"); - fprintf(global.f, "/rgb { setrgbcolor } bind def\n"); - } - - if ((global.outline && !global.outline_layer) ||global.invert) { - pcb_fprintf(global.f, - "0 setgray 0 setlinewidth 0 0 moveto 0 " - "%mi lineto %mi %mi lineto %mi 0 lineto closepath %s\n", - PCB->MaxHeight, PCB->MaxWidth, PCB->MaxHeight, PCB->MaxWidth, global.invert ? "fill" : "stroke"); - } - - if (global.align_marks) { - corner(global.f, 0, 0, -1, -1); - corner(global.f, PCB->MaxWidth, 0, 1, -1); - corner(global.f, PCB->MaxWidth, PCB->MaxHeight, 1, 1); - corner(global.f, 0, PCB->MaxHeight, -1, 1); - } - - global.linewidth = -1; - use_gc(NULL); /* reset static vars */ - - fprintf(global.f, - "/ts 1 def\n" - "/ty ts neg def /tx 0 def /Helvetica findfont ts scalefont setfont\n" - "/t { moveto lineto stroke } bind def\n" - "/dr { /y2 exch def /x2 exch def /y1 exch def /x1 exch def\n" - " x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto closepath stroke } bind def\n"); - fprintf(global.f,"/r { /y2 exch def /x2 exch def /y1 exch def /x1 exch def\n" - " x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto closepath fill } bind def\n" - "/c { 0 360 arc fill } bind def\n" - "/a { gsave setlinewidth translate scale 0 0 1 5 3 roll arc stroke grestore} bind def\n"); - if (global.drill_helper) - pcb_fprintf(global.f, - "/dh { gsave %mi setlinewidth 0 gray %mi 0 360 arc stroke grestore} bind def\n", - (Coord) MIN_PINORVIAHOLE, (Coord) (MIN_PINORVIAHOLE * 3 / 2)); - } -#if 0 - /* Try to outsmart ps2pdf's heuristics for page rotation, by putting - * text on all pages -- even if that text is blank */ - if (SL_TYPE(idx) != SL_FAB) - fprintf(global.f, "gsave tx ty translate 1 -1 scale 0 0 moveto (Layer %s) show grestore newpath /ty ty ts sub def\n", name); - else - fprintf(global.f, "gsave tx ty translate 1 -1 scale 0 0 moveto ( ) show grestore newpath /ty ty ts sub def\n"); -#endif - - /* If we're printing a layer other than the outline layer, and - we want to "print outlines", and we have an outline layer, - print the outline layer on this layer also. */ - if (global.outline && - global.outline_layer != NULL && - global.outline_layer != PCB->Data->Layer + idx && strcmp(name, "outline") != 0 && strcmp(name, "route") != 0) { - DrawLayer(global.outline_layer, &global.region); - } - - return 1; -} - -static hidGC ps_make_gc(void) -{ - hidGC rv = (hidGC) calloc(1, sizeof(hid_gc_struct)); - rv->me_pointer = &ps_hid; - rv->cap = Trace_Cap; - return rv; -} - -static void ps_destroy_gc(hidGC gc) -{ - free(gc); -} - -static void ps_use_mask(int use_it) -{ - /* does nothing */ -} - -static void ps_set_color(hidGC gc, const char *name) -{ - if (strcmp(name, "erase") == 0 || strcmp(name, "drill") == 0) { - gc->r = gc->g = gc->b = 255; - gc->erase = 1; - } - else if (global.incolor) { - unsigned int r, g, b; - sscanf(name + 1, "%02x%02x%02x", &r, &g, &b); - gc->r = r; - gc->g = g; - gc->b = b; - gc->erase = 0; - } - else { - gc->r = gc->g = gc->b = 0; - gc->erase = 0; - } -} - -static void ps_set_line_cap(hidGC gc, EndCapStyle style) -{ - gc->cap = style; -} - -static void ps_set_line_width(hidGC gc, Coord width) -{ - gc->width = width; -} - -static void ps_set_draw_xor(hidGC gc, int xor_) -{ - ; -} - -static void ps_set_draw_faded(hidGC gc, int faded) -{ - gc->faded = faded; -} - -static void use_gc(hidGC gc) -{ - static int lastcap = -1; - static int lastcolor = -1; - - if (gc == NULL) { - lastcap = lastcolor = -1; - return; - } - if (gc->me_pointer != &ps_hid) { - fprintf(stderr, "Fatal: GC from another HID passed to ps HID\n"); - abort(); - } - if (global.linewidth != gc->width) { - pcb_fprintf(global.f, "%mi setlinewidth\n", gc->width + (gc->erase ? -2 : 2) * global.bloat); - global.linewidth = gc->width; - } - if (lastcap != gc->cap) { - int c; - switch (gc->cap) { - case Round_Cap: - case Trace_Cap: - c = 1; - break; - default: - case Square_Cap: - c = 2; - break; - } - fprintf(global.f, "%d setlinecap %d setlinejoin\n", c, c); - lastcap = gc->cap; - } -#define CBLEND(gc) (((gc->r)<<24)|((gc->g)<<16)|((gc->b)<<8)|(gc->faded)) - if (lastcolor != CBLEND(gc)) { - if (global.is_drill || global.is_mask) { - fprintf(global.f, "%d gray\n", gc->erase ? 0 : 1); - lastcolor = 0; - } - else { - double r, g, b; - r = gc->r; - g = gc->g; - b = gc->b; - if (gc->faded) { - r = (1 - global.fade_ratio) *255 + global.fade_ratio * r; - g = (1 - global.fade_ratio) *255 + global.fade_ratio * g; - b = (1 - global.fade_ratio) *255 + global.fade_ratio * b; - } - if (gc->r == gc->g && gc->g == gc->b) - fprintf(global.f, "%g gray\n", r / 255.0); - else - fprintf(global.f, "%g %g %g rgb\n", r / 255.0, g / 255.0, b / 255.0); - lastcolor = CBLEND(gc); - } - } -} - -static void ps_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - use_gc(gc); - pcb_fprintf(global.f, "%mi %mi %mi %mi dr\n", x1, y1, x2, y2); -} - -static void ps_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); -static void ps_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius); - -static void ps_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ -#if 0 - /* If you're etching your own paste mask, this will reduce the - amount of brass you need to etch by drawing outlines for large - pads. See also ps_fill_rect. */ - if (is_paste && gc->width > 2500 && gc->cap == Square_Cap && (x1 == x2 || y1 == y2)) { - Coord t, w; - if (x1 > x2) { - t = x1; - x1 = x2; - x2 = t; - } - if (y1 > y2) { - t = y1; - y1 = y2; - y2 = t; - } - w = gc->width / 2; - ps_fill_rect(gc, x1 - w, y1 - w, x2 + w, y2 + w); - return; - } -#endif - if (x1 == x2 && y1 == y2) { - Coord w = gc->width / 2; - if (gc->cap == Square_Cap) - ps_fill_rect(gc, x1 - w, y1 - w, x1 + w, y1 + w); - else - ps_fill_circle(gc, x1, y1, w); - return; - } - use_gc(gc); - pcb_fprintf(global.f, "%mi %mi %mi %mi t\n", x1, y1, x2, y2); -} - -static void ps_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle) -{ - Angle sa, ea; - if (delta_angle > 0) { - sa = start_angle; - ea = start_angle + delta_angle; - } - else { - sa = start_angle + delta_angle; - ea = start_angle; - } -#if 0 - printf("draw_arc %d,%d %dx%d %d..%d %d..%d\n", cx, cy, width, height, start_angle, delta_angle, sa, ea); -#endif - use_gc(gc); - pcb_fprintf(global.f, "%ma %ma %mi %mi %mi %mi %g a\n", - sa, ea, -width, height, cx, cy, (double) (global.linewidth + 2 * global.bloat) /(double) width); -} - -static void ps_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) -{ - use_gc(gc); - if (!gc->erase || !global.is_copper || global.drillcopper) { - if (gc->erase && global.is_copper && global.drill_helper && radius >= PCB->minDrill / 4) - radius = PCB->minDrill / 4; - pcb_fprintf(global.f, "%mi %mi %mi c\n", cx, cy, radius + (gc->erase ? -1 : 1) * global.bloat); - } -} - -static void ps_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) -{ - int i; - const char *op = "moveto"; - use_gc(gc); - for (i = 0; i < n_coords; i++) { - pcb_fprintf(global.f, "%mi %mi %s\n", x[i], y[i], op); - op = "lineto"; - } - fprintf(global.f, "fill\n"); -} - -typedef struct { - Coord x1, y1, x2, y2; -} lseg_t; - -typedef struct { - Coord x, y; -} lpoint_t; - -#define minmax(val, min, max) \ -do { \ - if (val < min) min = val; \ - if (val > max) max = val; \ -} while(0) - -#define lsegs_append(x1_, y1_, x2_, y2_) \ -do { \ - if (y1_ < y2_) { \ - lsegs[lsegs_used].x1 = x1_; \ - lsegs[lsegs_used].y1 = y1_; \ - lsegs[lsegs_used].x2 = x2_; \ - lsegs[lsegs_used].y2 = y2_; \ - } \ - else { \ - lsegs[lsegs_used].x2 = x1_; \ - lsegs[lsegs_used].y2 = y1_; \ - lsegs[lsegs_used].x1 = x2_; \ - lsegs[lsegs_used].y1 = y2_; \ - } \ - lsegs_used++; \ - minmax(y1_, lsegs_ymin, lsegs_ymax); \ - minmax(y2_, lsegs_ymin, lsegs_ymax); \ - minmax(x1_, lsegs_xmin, lsegs_xmax); \ - minmax(x2_, lsegs_xmin, lsegs_xmax); \ -} while(0) - -#define lseg_line(x1_, y1_, x2_, y2_) \ - do { \ - fprintf(global.f, "newpath\n"); \ - pcb_fprintf(global.f, "%mi %mi moveto\n", x1_, y1_); \ - pcb_fprintf(global.f, "%mi %mi lineto\n", x2_, y2_); \ - fprintf (global.f, "stroke\n"); \ - } while(0) - -int coord_comp(const void *c1_, const void *c2_) -{ - const Coord *c1 = c1_, *c2 = c2_; - return *c1 < *c2; -} - -static void ps_fill_pcb_polygon(hidGC gc, PolygonType * poly, const BoxType * clip_box) -{ - /* Ignore clip_box, just draw everything */ - - VNODE *v; - PLINE *pl; - const char *op; - int len; - double POLYGRID = ps_attribute_list[HA_polygrid].default_val.real_value; - - use_gc(gc); - - pl = poly->Clipped->contours; - len = 0; - if (POLYGRID > 0.1) - POLYGRID *= 1000000.0; - - do { - v = pl->head.next; - if (POLYGRID > 0.1) - fprintf(global.f, "closepath\n"); - op = "moveto"; - do { - pcb_fprintf(global.f, "%mi %mi %s\n", v->point[0], v->point[1], op); - op = "lineto"; - len++; - } - while ((v = v->next) != pl->head.next); - len++; - } - while ((pl = pl->next) != NULL); - - if (POLYGRID > 0.1) { - Coord y, x, lx, ly, fx, fy, lsegs_xmin, lsegs_xmax, lsegs_ymin, lsegs_ymax; - lseg_t *lsegs = malloc(sizeof(lseg_t) * len); - Coord *lpoints = malloc(sizeof(Coord) * len); - int lsegs_used = 0; - - lsegs_xmin = -1000000000; - lsegs_ymin = -1000000000; - lsegs_xmax = +1000000000; - lsegs_ymax = +1000000000; - - /* save all line segs in an array */ - pl = poly->Clipped->contours; - do { - v = pl->head.next; - fx = v->point[0]; - fy = v->point[1]; - goto start1; - do { - lsegs_append(lx, ly, v->point[0], v->point[1]); - start1:; - lx = v->point[0]; - ly = v->point[1]; - } while ((v = v->next) != pl->head.next); - lsegs_append(lx, ly, fx, fy); - } while ((pl = pl->next) != NULL); - - - - - fprintf(global.f, "%% POLYGRID2\n"); - fprintf(global.f, "gsave\n"); - fprintf(global.f, "0.0015 setlinewidth\n"); - fprintf(global.f, "closepath\n"); - fprintf(global.f, "stroke\n"); - - for (y = lsegs_ymin; y < lsegs_ymax; y += POLYGRID) { - int pts, n; -/* pcb_fprintf(global.f, "%% gridline at y %mi\n", y);*/ - retry1:; - if (y > lsegs_ymax) - break; - pts = 0; - for (n = 0; n < lsegs_used; n++) { - if ((lsegs[n].y1 <= y) && (lsegs[n].y2 >= y)) { - if ((lsegs[n].y2 == lsegs[n].y1) || (lsegs[n].y1 == y) || (lsegs[n].y2 == y)) { - y += POLYGRID / 100.0; - goto retry1; - } - x = lsegs[n].x1 + (lsegs[n].x2 - lsegs[n].x1) * (y - lsegs[n].y1) / (lsegs[n].y2 - lsegs[n].y1); - lpoints[pts] = x; - pts++; - } - } - if ((pts % 2) != 0) { - y += POLYGRID / 100.0; - goto retry1; - } - if (pts > 1) { - qsort(lpoints, pts, sizeof(Coord), coord_comp); - for (n = 0; n < pts; n += 2) - lseg_line(lpoints[n], y, lpoints[n + 1], y); - } - } - - for (x = lsegs_xmin; x < lsegs_xmax; x += POLYGRID) { - int pts, n; -/* pcb_fprintf(global.f, "%% gridline at y %mi\n", y); */ - retry2:; - if (x > lsegs_xmax) - break; - pts = 0; - for (n = 0; n < lsegs_used; n++) { - if (((lsegs[n].x1 <= x) && (lsegs[n].x2 >= x)) || ((lsegs[n].x1 >= x) && (lsegs[n].x2 <= x))) { - if ((lsegs[n].x2 == lsegs[n].x1) || (lsegs[n].x1 == x) || (lsegs[n].x2 == x)) { - x += POLYGRID / 100.0; - goto retry2; - } - y = lsegs[n].y1 + (lsegs[n].y2 - lsegs[n].y1) * (x - lsegs[n].x1) / (lsegs[n].x2 - lsegs[n].x1); - lpoints[pts] = y; - pts++; - } - } - if ((pts % 2) != 0) { - x += POLYGRID / 100.0; - goto retry2; - } - if ((pts > 1)) { - qsort(lpoints, pts, sizeof(Coord), coord_comp); - for (n = 0; n < pts; n += 2) - lseg_line(x, lpoints[n], x, lpoints[n + 1]); - } - } - - - fprintf(global.f, "grestore\nnewpath\n"); - free(lsegs); - free(lpoints); - } - else - fprintf(global.f, "fill\n"); -} - -static void ps_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - use_gc(gc); - if (x1 > x2) { - Coord t = x1; - x1 = x2; - x2 = t; - } - if (y1 > y2) { - Coord t = y1; - y1 = y2; - y2 = t; - } -#if 0 - /* See comment in ps_draw_line. */ - if (is_paste && (x2 - x1) > 2500 && (y2 - y1) > 2500) { - linewidth = 1000; - lastcap = Round_Cap; - fprintf(f, "1000 setlinewidth 1 setlinecap 1 setlinejoin\n"); - fprintf(f, "%d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath stroke\n", - x1 + 500 - bloat, y1 + 500 - bloat, - x1 + 500 - bloat, y2 - 500 + bloat, x2 - 500 + bloat, y2 - 500 + bloat, x2 - 500 + bloat, y1 + 500 - bloat); - return; - } -#endif - pcb_fprintf(global.f, "%mi %mi %mi %mi r\n", x1 - global.bloat, y1 - global.bloat, x2 + global.bloat, y2 + global.bloat); -} - -HID_Attribute ps_calib_attribute_list[] = { - {"lprcommand", "Command to print", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -}; - -static const char *const calib_lines[] = { - "%!PS-Adobe-3.0\n", - "%%Title: Calibration Page\n", - "%%PageOrder: Ascend\n", - "%%Pages: 1\n", - "%%EndComments\n", - "\n", - "%%Page: Calibrate 1\n", - "72 72 scale\n", - "\n", - "0 setlinewidth\n", - "0.375 0.375 moveto\n", - "8.125 0.375 lineto\n", - "8.125 10.625 lineto\n", - "0.375 10.625 lineto\n", - "closepath stroke\n", - "\n", - "0.5 0.5 translate\n", - "0.001 setlinewidth\n", - "\n", - "/Times-Roman findfont 0.2 scalefont setfont\n", - "\n", - "/sign {\n", - " 0 lt { -1 } { 1 } ifelse\n", - "} def\n", - "\n", - "/cbar {\n", - " /units exch def\n", - " /x exch def\n", - " /y exch def \n", - "\n", - " /x x sign 0.5 mul def\n", - "\n", - " 0 setlinewidth\n", - " newpath x y 0.25 0 180 arc gsave 0.85 setgray fill grestore closepath stroke\n", - " newpath x 0 0.25 180 360 arc gsave 0.85 setgray fill grestore closepath stroke\n", - " 0.001 setlinewidth\n", - "\n", - " x 0 moveto\n", - " x y lineto\n", - "% -0.07 -0.2 rlineto 0.14 0 rmoveto -0.07 0.2 rlineto\n", - " x y lineto\n", - " -0.1 0 rlineto 0.2 0 rlineto\n", - " stroke\n", - " x 0 moveto\n", - "% -0.07 0.2 rlineto 0.14 0 rmoveto -0.07 -0.2 rlineto\n", - " x 0 moveto\n", - " -0.1 0 rlineto 0.2 0 rlineto\n", - " stroke\n", - "\n", - " x 0.1 add\n", - " y 0.2 sub moveto\n", - " units show\n", - "} bind def\n", - "\n", - "/y 9 def\n", - "/t {\n", - " /str exch def\n", - " 1.5 y moveto str show\n", - " /y y 0.25 sub def\n", - "} bind def\n", - "\n", - "(Please measure ONE of the horizontal lines, in the units indicated for)t\n", - "(that line, and enter that value as X. Similarly, measure ONE of the)t\n", - "(vertical lines and enter that value as Y. Measurements should be)t\n", - "(between the flat faces of the semicircles.)t\n", - "()t\n", - "(The large box is 10.25 by 7.75 inches)t\n", - "\n", - "/in { } bind def\n", - "/cm { 2.54 div } bind def\n", - "/mm { 25.4 div } bind def\n", - "\n", - 0 -}; - -static int guess(double val, double close_to, double *calib) -{ - if (val >= close_to * 0.9 && val <= close_to * 1.1) { - *calib = close_to / val; - return 0; - } - return 1; -} - -void ps_calibrate_1(double xval, double yval, int use_command) -{ - HID_Attr_Val vals[3]; - FILE *ps_cal_file; - int used_popen = 0, c; - - if (xval > 0 && yval > 0) { - if (guess(xval, 4, &global.calibration_x)) - if (guess(xval, 15, &global.calibration_x)) - if (guess(xval, 7.5, &global.calibration_x)) { - if (xval < 2) - ps_attribute_list[HA_xcalib].default_val.real_value = global.calibration_x = xval; - else - Message(PCB_MSG_DEFAULT, "X value of %g is too far off.\n" "Expecting it near: 1.0, 4.0, 15.0, 7.5\n", xval); - } - if (guess(yval, 4, &global.calibration_y)) - if (guess(yval, 20, &global.calibration_y)) - if (guess(yval, 10, &global.calibration_y)) { - if (yval < 2) - ps_attribute_list[HA_ycalib].default_val.real_value = global.calibration_y = yval; - else - Message(PCB_MSG_DEFAULT, "Y value of %g is too far off.\n" "Expecting it near: 1.0, 4.0, 20.0, 10.0\n", yval); - } - return; - } - - if (ps_calib_attribute_list[0].default_val.str_value == NULL) { - ps_calib_attribute_list[0].default_val.str_value = pcb_strdup("lpr"); - } - - if (gui-> - attribute_dialog(ps_calib_attribute_list, 1, vals, _("Print Calibration Page"), - _("Generates a printer calibration page"))) - return; - - if (use_command || strchr(vals[0].str_value, '|')) { - const char *cmd = vals[0].str_value; - while (*cmd == ' ' || *cmd == '|') - cmd++; - ps_cal_file = popen(cmd, "w"); - used_popen = 1; - } - else - ps_cal_file = fopen(vals[0].str_value, "w"); - - for (c = 0; calib_lines[c]; c++) - fputs(calib_lines[c], ps_cal_file); - - fprintf(ps_cal_file, "4 in 0.5 (Y in) cbar\n"); - fprintf(ps_cal_file, "20 cm 1.5 (Y cm) cbar\n"); - fprintf(ps_cal_file, "10 in 2.5 (Y in) cbar\n"); - fprintf(ps_cal_file, "-90 rotate\n"); - fprintf(ps_cal_file, "4 in -0.5 (X in) cbar\n"); - fprintf(ps_cal_file, "15 cm -1.5 (X cm) cbar\n"); - fprintf(ps_cal_file, "7.5 in -2.5 (X in) cbar\n"); - - fprintf(ps_cal_file, "showpage\n"); - - fprintf(ps_cal_file, "%%%%EOF\n"); - - if (used_popen) - pclose(ps_cal_file); - else - fclose(ps_cal_file); -} - -static void ps_calibrate(double xval, double yval) -{ - ps_calibrate_1(xval, yval, 0); -} - -static void ps_set_crosshair(int x, int y, int action) -{ -} - -static int ActionPSCalib(int argc, const char **argv, Coord x, Coord y) -{ - ps_calibrate(0.0, 0.0); - return 0; -} - -HID_Action hidps_action_list[] = { - {"pscalib", 0, ActionPSCalib} -}; - -REGISTER_ACTIONS(hidps_action_list, ps_cookie) - - -#include "dolists.h" - -HID ps_hid; -static int ps_inited = 0; -void ps_ps_init(HID * hid) -{ - if (ps_inited) - return; - - hid->get_export_options = ps_get_export_options; - hid->do_export = ps_do_export; - hid->parse_arguments = ps_parse_arguments; - hid->set_layer = ps_set_layer; - hid->make_gc = ps_make_gc; - hid->destroy_gc = ps_destroy_gc; - hid->use_mask = ps_use_mask; - hid->set_color = ps_set_color; - hid->set_line_cap = ps_set_line_cap; - hid->set_line_width = ps_set_line_width; - hid->set_draw_xor = ps_set_draw_xor; - hid->set_draw_faded = ps_set_draw_faded; - hid->draw_line = ps_draw_line; - hid->draw_arc = ps_draw_arc; - hid->draw_rect = ps_draw_rect; - hid->fill_circle = ps_fill_circle; - hid->fill_polygon = ps_fill_polygon; - hid->fill_pcb_polygon = ps_fill_pcb_polygon; - hid->fill_rect = ps_fill_rect; - hid->calibrate = ps_calibrate; - hid->set_crosshair = ps_set_crosshair; - - REGISTER_ACTIONS(hidps_action_list, ps_cookie) - - ps_inited = 1; -} - -static int ps_usage(const char *topic) -{ - fprintf(stderr, "\nps exporter command line arguments:\n\n"); - hid_usage(ps_attribute_list, sizeof(ps_attribute_list) / sizeof(ps_attribute_list[0])); - fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x ps foo.pcb [ps options]\n\n"); - return 0; -} - -static void plugin_ps_uninit(void) -{ - hid_remove_actions_by_cookie(ps_cookie); - ps_inited = 0; -} - - -pcb_uninit_t hid_export_ps_init() -{ - memset(&ps_hid, 0, sizeof(HID)); - - common_nogui_init(&ps_hid); - common_draw_helpers_init(&ps_hid); - ps_ps_init(&ps_hid); - - ps_hid.struct_size = sizeof(HID); - ps_hid.name = "ps"; - ps_hid.description = "Postscript export"; - ps_hid.exporter = 1; - ps_hid.poly_before = 1; - - ps_hid.usage = ps_usage; - - hid_register_hid(&ps_hid); - - hid_eps_init(); - return plugin_ps_uninit; -} Index: 1.1.4/src_plugins/export_ps/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/export_ps/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/export_ps/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {export_ps} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_ps/ps.o $(PLUGDIR)/export_ps/eps.o @] - -switch /local/pcb/export_ps/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/export_ps/eps.c =================================================================== --- 1.1.4/src_plugins/export_ps/eps.c (revision 10776) +++ 1.1.4/src_plugins/export_ps/eps.c (nonexistent) @@ -1,638 +0,0 @@ -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include -#include - -#include "global.h" -#include "data.h" -#include "layer.h" -#include "misc.h" -#include "pcb-printf.h" - -#include "hid.h" -#include "hid_nogui.h" -#include "hid_draw_helpers.h" -#include "ps.h" -#include "hid_init.h" -#include "hid_attrib.h" -#include "hid_helper.h" -#include "hid_flags.h" -#include "hid_color.h" - -#define CRASH(func) fprintf(stderr, "HID error: pcb called unimplemented EPS function %s.\n", func); abort() - -/*----------------------------------------------------------------------------*/ -/* Function prototypes */ -/*----------------------------------------------------------------------------*/ -static HID_Attribute *eps_get_export_options(int *n); -static void eps_do_export(HID_Attr_Val * options); -static void eps_parse_arguments(int *argc, char ***argv); -static int eps_set_layer(const char *name, int group, int empty); -static hidGC eps_make_gc(void); -static void eps_destroy_gc(hidGC gc); -static void eps_use_mask(int use_it); -static void eps_set_color(hidGC gc, const char *name); -static void eps_set_line_cap(hidGC gc, EndCapStyle style); -static void eps_set_line_width(hidGC gc, Coord width); -static void eps_set_draw_xor(hidGC gc, int _xor); -static void eps_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); -static void eps_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); -static void eps_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle); -static void eps_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); -static void eps_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius); -static void eps_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y); -static void eps_calibrate(double xval, double yval); -static void eps_set_crosshair(int x, int y, int action); -/*----------------------------------------------------------------------------*/ - -typedef struct hid_gc_struct { - EndCapStyle cap; - Coord width; - int color; - int erase; -} hid_gc_struct; - -static HID eps_hid; - -static FILE *f = 0; -static Coord linewidth = -1; -static int lastcap = -1; -static int lastcolor = -1; -static int print_group[MAX_LAYER]; -static int print_layer[MAX_LAYER]; -static int fast_erase = -1; - -static HID_Attribute eps_attribute_list[] = { - /* other HIDs expect this to be first. */ - -/* %start-doc options "92 Encapsulated Postscript Export" -@ftable @code -@item --eps-file -Name of the encapsulated postscript output file. Can contain a path. -@end ftable -%end-doc -*/ - {"eps-file", "Encapsulated Postscript output file", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_psfile 0 - -/* %start-doc options "92 Encapsulated Postscript Export" -@ftable @code -@item --eps-scale -Scale EPS output by the parameter @samp{num}. -@end ftable -%end-doc -*/ - {"eps-scale", "EPS scale", - HID_Real, 0, 100, {0, 0, 1.0}, 0, 0}, -#define HA_scale 1 - -/* %start-doc options "92 Encapsulated Postscript Export" -@ftable @code -@cindex as-shown (EPS) -@item --as-shown -Export layers as shown on screen. -@end ftable -%end-doc -*/ - {"as-shown", "Export layers as shown on screen", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_as_shown 2 - -/* %start-doc options "92 Encapsulated Postscript Export" -@ftable @code -@item --monochrome -Convert output to monochrome. -@end ftable -%end-doc -*/ - {"monochrome", "Convert to monochrome", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_mono 3 - -/* %start-doc options "92 Encapsulated Postscript Export" -@ftable @code -@cindex only-visible -@item --only-visible -Limit the bounds of the EPS file to the visible items. -@end ftable -%end-doc -*/ - {"only-visible", "Limit the bounds of the EPS file to the visible items", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_only_visible 4 -}; - -#define NUM_OPTIONS (sizeof(eps_attribute_list)/sizeof(eps_attribute_list[0])) - -REGISTER_ATTRIBUTES(eps_attribute_list, ps_cookie) - - static HID_Attr_Val eps_values[NUM_OPTIONS]; - - static HID_Attribute *eps_get_export_options(int *n) -{ - static char *last_made_filename = 0; - - if (PCB) - derive_default_filename(PCB->Filename, &eps_attribute_list[HA_psfile], ".eps", &last_made_filename); - - if (n) - *n = NUM_OPTIONS; - return eps_attribute_list; -} - -static int comp_layer, solder_layer; - -static int group_for_layer(int l) -{ - if (l < max_copper_layer + 2 && l >= 0) - return GetLayerGroupNumberByNumber(l); - /* else something unique */ - return max_group + 3 + l; -} - -static int layer_sort(const void *va, const void *vb) -{ - int a = *(int *) va; - int b = *(int *) vb; - int al = group_for_layer(a); - int bl = group_for_layer(b); - int d = bl - al; - - if (a >= 0 && a <= max_copper_layer + 1) { - int aside = (al == solder_layer ? 0 : al == comp_layer ? 2 : 1); - int bside = (bl == solder_layer ? 0 : bl == comp_layer ? 2 : 1); - if (bside != aside) - return bside - aside; - } - if (d) - return d; - return b - a; -} - -static const char *filename; -static BoxType *bounds; -static int in_mono, as_shown; - -void eps_hid_export_to_file(FILE * the_file, HID_Attr_Val * options) -{ - int i; - static int saved_layer_stack[MAX_LAYER]; - BoxType region; - - conf_force_set_bool(conf_core.editor.thin_draw, 0); - conf_force_set_bool(conf_core.editor.thin_draw_poly, 0); - conf_force_set_bool(conf_core.editor.check_planes, 0); - - f = the_file; - - region.X1 = 0; - region.Y1 = 0; - region.X2 = PCB->MaxWidth; - region.Y2 = PCB->MaxHeight; - - if (options[HA_only_visible].int_value) - bounds = GetDataBoundingBox(PCB->Data); - else - bounds = ®ion; - - memset(print_group, 0, sizeof(print_group)); - memset(print_layer, 0, sizeof(print_layer)); - - /* Figure out which layers actually have stuff on them. */ - for (i = 0; i < max_copper_layer; i++) { - LayerType *layer = PCB->Data->Layer + i; - if (layer->On) - if (!LAYER_IS_EMPTY(layer)) - print_group[GetLayerGroupNumberByNumber(i)] = 1; - } - - /* Now, if only one layer has real stuff on it, we can use the fast - erase logic. Otherwise, we have to use the expensive multi-mask - erase. */ - fast_erase = 0; - for (i = 0; i < max_group; i++) - if (print_group[i]) - fast_erase++; - - /* If NO layers had anything on them, at least print the component - layer to get the pins. */ - if (fast_erase == 0) { - print_group[GetLayerGroupNumberByNumber(component_silk_layer)] = 1; - fast_erase = 1; - } - - /* "fast_erase" is 1 if we can just paint white to erase. */ - fast_erase = fast_erase == 1 ? 1 : 0; - - /* Now, for each group we're printing, mark its layers for - printing. */ - for (i = 0; i < max_copper_layer; i++) - if (print_group[GetLayerGroupNumberByNumber(i)]) - print_layer[i] = 1; - - if (fast_erase) { - eps_hid.poly_before = 1; - eps_hid.poly_after = 0; - } - else { - eps_hid.poly_before = 0; - eps_hid.poly_after = 1; - } - - memcpy(saved_layer_stack, LayerStack, sizeof(LayerStack)); - as_shown = options[HA_as_shown].int_value; - if (!options[HA_as_shown].int_value) { - comp_layer = GetLayerGroupNumberByNumber(component_silk_layer); - solder_layer = GetLayerGroupNumberByNumber(solder_silk_layer); - qsort(LayerStack, max_copper_layer, sizeof(LayerStack[0]), layer_sort); - } - fprintf(f, "%%!PS-Adobe-3.0 EPSF-3.0\n"); - linewidth = -1; - lastcap = -1; - lastcolor = -1; - - in_mono = options[HA_mono].int_value; - -#define pcb2em(x) 1 + PCB_COORD_TO_INCH (x) * 72.0 * options[HA_scale].real_value - fprintf(f, "%%%%BoundingBox: 0 0 %f %f\n", pcb2em(bounds->X2 - bounds->X1), pcb2em(bounds->Y2 - bounds->Y1)); -#undef pcb2em - fprintf(f, "%%%%Pages: 1\n"); - fprintf(f, "save countdictstack mark newpath /showpage {} def /setpagedevice {pop} def\n"); - fprintf(f, "%%%%EndProlog\n"); - fprintf(f, "%%%%Page: 1 1\n"); - fprintf(f, "%%%%BeginDocument: %s\n\n", filename); - - fprintf(f, "72 72 scale\n"); - fprintf(f, "1 dup neg scale\n"); - fprintf(f, "%g dup scale\n", options[HA_scale].real_value); - pcb_fprintf(f, "%mi %mi translate\n", -bounds->X1, -bounds->Y2); - if (options[HA_as_shown].int_value && conf_core.editor.show_solder_side) - pcb_fprintf(f, "-1 1 scale %mi 0 translate\n", bounds->X1 - bounds->X2); - linewidth = -1; - lastcap = -1; - lastcolor = -1; -#define Q (Coord) PCB_MIL_TO_COORD(10) - pcb_fprintf(f, - "/nclip { %mi %mi moveto %mi %mi lineto %mi %mi lineto %mi %mi lineto %mi %mi lineto eoclip newpath } def\n", - bounds->X1 - Q, bounds->Y1 - Q, bounds->X1 - Q, bounds->Y2 + Q, - bounds->X2 + Q, bounds->Y2 + Q, bounds->X2 + Q, bounds->Y1 - Q, bounds->X1 - Q, bounds->Y1 - Q); -#undef Q - fprintf(f, "/t { moveto lineto stroke } bind def\n"); - fprintf(f, "/tc { moveto lineto strokepath nclip } bind def\n"); - fprintf(f, "/r { /y2 exch def /x2 exch def /y1 exch def /x1 exch def\n"); - fprintf(f, " x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto closepath fill } bind def\n"); - fprintf(f, "/c { 0 360 arc fill } bind def\n"); - fprintf(f, "/cc { 0 360 arc nclip } bind def\n"); - fprintf(f, "/a { gsave setlinewidth translate scale 0 0 1 5 3 roll arc stroke grestore} bind def\n"); - - hid_expose_callback(&eps_hid, bounds, 0); - - fprintf(f, "showpage\n"); - - fprintf(f, "%%%%EndDocument\n"); - fprintf(f, "%%%%Trailer\n"); - fprintf(f, "cleartomark countdictstack exch sub { end } repeat restore\n"); - fprintf(f, "%%%%EOF\n"); - - memcpy(LayerStack, saved_layer_stack, sizeof(LayerStack)); - conf_update(NULL); /* restore forced sets */ -} - -static void eps_do_export(HID_Attr_Val * options) -{ - int i; - int save_ons[MAX_LAYER + 2]; - - if (!options) { - eps_get_export_options(0); - for (i = 0; i < NUM_OPTIONS; i++) - eps_values[i] = eps_attribute_list[i].default_val; - options = eps_values; - } - - filename = options[HA_psfile].str_value; - if (!filename) - filename = "pcb-out.eps"; - - f = fopen(filename, "w"); - if (!f) { - perror(filename); - return; - } - - if (!options[HA_as_shown].int_value) - hid_save_and_show_layer_ons(save_ons); - eps_hid_export_to_file(f, options); - if (!options[HA_as_shown].int_value) - hid_restore_layer_ons(save_ons); - - fclose(f); -} - -static void eps_parse_arguments(int *argc, char ***argv) -{ - hid_register_attributes(eps_attribute_list, sizeof(eps_attribute_list) / sizeof(eps_attribute_list[0]), ps_cookie, 0); - hid_parse_command_line(argc, argv); -} - -static int is_mask; -static int is_paste; -static int is_drill; - -static int eps_set_layer(const char *name, int group, int empty) -{ - int idx = (group >= 0 && group < max_group) ? PCB->LayerGroups.Entries[group][0] : group; - if (name == 0) - name = PCB->Data->Layer[idx].Name; - - if (idx >= 0 && idx < max_copper_layer && !print_layer[idx]) - return 0; - if (SL_TYPE(idx) == SL_ASSY || SL_TYPE(idx) == SL_FAB) - return 0; - - if (strcmp(name, "invisible") == 0) - return 0; - - is_drill = (SL_TYPE(idx) == SL_PDRILL || SL_TYPE(idx) == SL_UDRILL); - is_mask = (SL_TYPE(idx) == SL_MASK); - is_paste = (SL_TYPE(idx) == SL_PASTE); - - if (is_mask || is_paste) - return 0; -#if 0 - printf("Layer %s group %d drill %d mask %d\n", name, group, is_drill, is_mask); -#endif - fprintf(f, "%% Layer %s group %d drill %d mask %d\n", name, group, is_drill, is_mask); - - if (as_shown) { - switch (idx) { - case SL(SILK, TOP): - case SL(SILK, BOTTOM): - if (SL_MYSIDE(idx)) - return PCB->ElementOn; - else - return 0; - } - } - else { - switch (idx) { - case SL(SILK, TOP): - return 1; - case SL(SILK, BOTTOM): - return 0; - } - } - - return 1; -} - -static hidGC eps_make_gc(void) -{ - hidGC rv = (hidGC) malloc(sizeof(hid_gc_struct)); - rv->cap = Trace_Cap; - rv->width = 0; - rv->color = 0; - return rv; -} - -static void eps_destroy_gc(hidGC gc) -{ - free(gc); -} - -static void eps_use_mask(int use_it) -{ - static int mask_pending = 0; - switch (use_it) { - case HID_MASK_CLEAR: - if (!mask_pending) { - mask_pending = 1; - fprintf(f, "gsave\n"); - } - break; - case HID_MASK_AFTER: - break; - case HID_MASK_OFF: - if (mask_pending) { - mask_pending = 0; - fprintf(f, "grestore\n"); - lastcolor = -1; - } - break; - } -} - -static void eps_set_color(hidGC gc, const char *name) -{ - static void *cache = 0; - hidval cval; - - if (strcmp(name, "erase") == 0) { - gc->color = 0xffffff; - gc->erase = fast_erase ? 0 : 1; - return; - } - if (strcmp(name, "drill") == 0) { - gc->color = 0xffffff; - gc->erase = 0; - return; - } - gc->erase = 0; - if (hid_cache_color(0, name, &cval, &cache)) { - gc->color = cval.lval; - } - else if (in_mono) { - gc->color = 0; - } - else if (name[0] == '#') { - unsigned int r, g, b; - sscanf(name + 1, "%2x%2x%2x", &r, &g, &b); - gc->color = (r << 16) + (g << 8) + b; - } - else - gc->color = 0; -} - -static void eps_set_line_cap(hidGC gc, EndCapStyle style) -{ - gc->cap = style; -} - -static void eps_set_line_width(hidGC gc, Coord width) -{ - gc->width = width; -} - -static void eps_set_draw_xor(hidGC gc, int xor_) -{ - ; -} - -static void use_gc(hidGC gc) -{ - if (linewidth != gc->width) { - pcb_fprintf(f, "%mi setlinewidth\n", gc->width); - linewidth = gc->width; - } - if (lastcap != gc->cap) { - int c; - switch (gc->cap) { - case Round_Cap: - case Trace_Cap: - c = 1; - break; - default: - case Square_Cap: - c = 2; - break; - } - fprintf(f, "%d setlinecap\n", c); - lastcap = gc->cap; - } - if (lastcolor != gc->color) { - int c = gc->color; -#define CV(x,b) (((x>>b)&0xff)/255.0) - fprintf(f, "%g %g %g setrgbcolor\n", CV(c, 16), CV(c, 8), CV(c, 0)); - lastcolor = gc->color; - } -} - -static void eps_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); -static void eps_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius); - -static void eps_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - use_gc(gc); - pcb_fprintf(f, "%mi %mi %mi %mi r\n", x1, y1, x2, y2); -} - -static void eps_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - Coord w = gc->width / 2; - if (x1 == x2 && y1 == y2) { - if (gc->cap == Square_Cap) - eps_fill_rect(gc, x1 - w, y1 - w, x1 + w, y1 + w); - else - eps_fill_circle(gc, x1, y1, w); - return; - } - use_gc(gc); - if (gc->erase && gc->cap != Square_Cap) { - double ang = atan2(y2 - y1, x2 - x1); - double dx = w * sin(ang); - double dy = -w * cos(ang); - double deg = ang * 180.0 / M_PI; - Coord vx1 = x1 + dx; - Coord vy1 = y1 + dy; - - pcb_fprintf(f, "%mi %mi moveto ", vx1, vy1); - pcb_fprintf(f, "%mi %mi %mi %g %g arc\n", x2, y2, w, deg - 90, deg + 90); - pcb_fprintf(f, "%mi %mi %mi %g %g arc\n", x1, y1, w, deg + 90, deg + 270); - fprintf(f, "nclip\n"); - - return; - } - pcb_fprintf(f, "%mi %mi %mi %mi %s\n", x1, y1, x2, y2, gc->erase ? "tc" : "t"); -} - -static void eps_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle) -{ - Angle sa, ea; - if (delta_angle > 0) { - sa = start_angle; - ea = start_angle + delta_angle; - } - else { - sa = start_angle + delta_angle; - ea = start_angle; - } -#if 0 - printf("draw_arc %d,%d %dx%d %d..%d %d..%d\n", cx, cy, width, height, start_angle, delta_angle, sa, ea); -#endif - use_gc(gc); - pcb_fprintf(f, "%ma %ma %mi %mi %mi %mi %g a\n", sa, ea, -width, height, cx, cy, (double) linewidth / width); -} - -static void eps_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) -{ - use_gc(gc); - pcb_fprintf(f, "%mi %mi %mi %s\n", cx, cy, radius, gc->erase ? "cc" : "c"); -} - -static void eps_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) -{ - int i; - const char *op = "moveto"; - use_gc(gc); - for (i = 0; i < n_coords; i++) { - pcb_fprintf(f, "%mi %mi %s\n", x[i], y[i], op); - op = "lineto"; - } - fprintf(f, "fill\n"); -} - -static void eps_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - use_gc(gc); - pcb_fprintf(f, "%mi %mi %mi %mi r\n", x1, y1, x2, y2); -} - -static void eps_calibrate(double xval, double yval) -{ - CRASH("eps_calibrate"); -} - -static void eps_set_crosshair(int x, int y, int action) -{ -} - -static int eps_usage(const char *topic) -{ - fprintf(stderr, "\neps exporter command line arguments:\n\n"); - hid_usage(eps_attribute_list, sizeof(eps_attribute_list) / sizeof(eps_attribute_list[0])); - fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x eps foo.pcb [eps options]\n\n"); - return 0; -} - -void hid_eps_init() -{ - memset(&eps_hid, 0, sizeof(HID)); - - common_nogui_init(&eps_hid); - common_draw_helpers_init(&eps_hid); - - eps_hid.struct_size = sizeof(HID); - eps_hid.name = "eps"; - eps_hid.description = "Encapsulated Postscript"; - eps_hid.exporter = 1; - eps_hid.poly_after = 1; - - eps_hid.get_export_options = eps_get_export_options; - eps_hid.do_export = eps_do_export; - eps_hid.parse_arguments = eps_parse_arguments; - eps_hid.set_layer = eps_set_layer; - eps_hid.make_gc = eps_make_gc; - eps_hid.destroy_gc = eps_destroy_gc; - eps_hid.use_mask = eps_use_mask; - eps_hid.set_color = eps_set_color; - eps_hid.set_line_cap = eps_set_line_cap; - eps_hid.set_line_width = eps_set_line_width; - eps_hid.set_draw_xor = eps_set_draw_xor; - eps_hid.draw_line = eps_draw_line; - eps_hid.draw_arc = eps_draw_arc; - eps_hid.draw_rect = eps_draw_rect; - eps_hid.fill_circle = eps_fill_circle; - eps_hid.fill_polygon = eps_fill_polygon; - eps_hid.fill_rect = eps_fill_rect; - eps_hid.calibrate = eps_calibrate; - eps_hid.set_crosshair = eps_set_crosshair; - - eps_hid.usage = eps_usage; - - hid_register_hid(&eps_hid); -} Index: 1.1.4/src_plugins/export_ps/ps.h =================================================================== --- 1.1.4/src_plugins/export_ps/ps.h (revision 10776) +++ 1.1.4/src_plugins/export_ps/ps.h (nonexistent) @@ -1,7 +0,0 @@ -extern const char *ps_cookie; -extern HID ps_hid; -extern void ps_hid_export_to_file(FILE *, HID_Attr_Val *); -extern void ps_start_file(FILE *); -extern void ps_calibrate_1(double, double, int); -extern void hid_eps_init(); -void ps_ps_init(HID * hid); Index: 1.1.4/src_plugins/export_ps/README =================================================================== --- 1.1.4/src_plugins/export_ps/README (revision 10776) +++ 1.1.4/src_plugins/export_ps/README (nonexistent) @@ -1,5 +0,0 @@ -Export postscript or embedded postscript. - -#state: works -#default: buildin -#implements: export Index: 1.1.4/src_plugins/export_ps/Makefile =================================================================== --- 1.1.4/src_plugins/export_ps/Makefile (revision 10776) +++ 1.1.4/src_plugins/export_ps/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_export_ps - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/distaligntext/distaligntext.c =================================================================== --- 1.1.4/src_plugins/distaligntext/distaligntext.c (revision 10776) +++ 1.1.4/src_plugins/distaligntext/distaligntext.c (nonexistent) @@ -1,637 +0,0 @@ -/*! - * \file distaligntext.c - * - * \brief distaligntext plug-in for PCB. - * - * \author Copyright (C) 2012 Dan White - * Functions to distribute (evenly spread out) and align PCB text. - * - * \copyright Licensed under the terms of the GNU General Public - * License, version 2 or later. - * - * Substantially from distalign.c - * Copyright (C) 2007 Ben Jackson - * - * Ported to pcb-rnd by Tibor 'Igor2' Palinkas in 2016. - * - * - * Modifications and internal differences are significant enough warrant - * a new related plugin. - */ - -#include -#include - -#include "config.h" -#include "global.h" -#include "data.h" -#include "hid.h" -#include "misc.h" -#include "create.h" -#include "rtree.h" -#include "undo.h" -#include "rats.h" -#include "error.h" -#include "move.h" -#include "draw.h" -#include "set.h" -#include "plugins.h" -#include "hid_actions.h" -#include "conf_core.h" - -#define ARG(n) (argc > (n) ? argv[n] : 0) - -static const char aligntext_syntax[] = - "AlignText(X/Y, [Lefts/Rights/Tops/Bottoms/Centers, [First/Last/Crosshair/Average[, Gridless]]])"; - -static const char distributetext_syntax[] = - "DistributeText(Y, [Lefts/Rights/Tops/Bottoms/Centers/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]])"; - -enum { - K_X, - K_Y, - K_Lefts, - K_Rights, - K_Tops, - K_Bottoms, - K_Centers, - K_Gaps, - K_First, - K_Last, - K_Average, - K_Crosshair, - K_Gridless, - K_none, - K_aligntext, - K_distributetext -}; - -static const char *keywords[] = { - /* [K_X] */ "X", - /* [K_Y] */ "Y", - /* [K_Lefts] */ "Lefts", - /* [K_Rights] */ "Rights", - /* [K_Tops] */ "Tops", - /* [K_Bottoms] */ "Bottoms", - /* [K_Centers] */ "Centers", - /* [K_Gaps] */ "Gaps", - /* [K_First] */ "First", - /* [K_Last] */ "Last", - /* [K_Average] */ "Average", - /* [K_Crosshair] */ "Crosshair", - /* [K_Gridless] */ "Gridless", -}; - -static int keyword(const char *s) -{ - int i; - - if (!s) { - return K_none; - } - for (i = 0; i < ENTRIES(keywords); ++i) { - if (keywords[i] && strcasecmp(s, keywords[i]) == 0) - return i; - } - return -1; -} - - -/* this macro produces a function in X or Y that switches on 'point' */ -#define COORD(DIR) \ -static inline Coord \ -coord ## DIR(TextType *text, int point) \ -{ \ - switch (point) { \ - case K_Lefts: \ - case K_Tops: \ - return text->BoundingBox.DIR ## 1; \ - case K_Rights: \ - case K_Bottoms: \ - return text->BoundingBox.DIR ## 2; \ - case K_Centers: \ - case K_Gaps: \ - return (text->BoundingBox.DIR ## 1 + \ - text->BoundingBox.DIR ## 2) / 2; \ - } \ - return 0; \ -} - -COORD(X) - COORD(Y) - -/*! - * Return the text coordinate associated with the given internal point. - */ - static Coord coord(TextType * text, int dir, int point) -{ - if (dir == K_X) - return coordX(text, point); - else - return coordY(text, point); -} - -static struct text_by_pos { - TextType *text; - Coord pos; - Coord width; - int type; -} *texts_by_pos; - -static int ntexts_by_pos; - -static int cmp_tbp(const void *a, const void *b) -{ - const struct text_by_pos *ta = a; - const struct text_by_pos *tb = b; - - return ta->pos - tb->pos; -} - -/*! - * Find all selected text objects, then order them in order by coordinate in - * the 'dir' axis. This is used to find the "First" and "Last" elements - * and also to choose the distribution order. - * - * For alignment, first and last are in the orthogonal axis (imagine if - * you were lining up letters in a sentence, aligning *vertically* to the - * first letter means selecting the first letter *horizontally*). - * - * For distribution, first and last are in the distribution axis. - */ -static int sort_texts_by_pos(int op, int dir, int point) -{ - int nsel = 0; - - if (ntexts_by_pos) - return ntexts_by_pos; - if (op == K_aligntext) - dir = dir == K_X ? K_Y : K_X; /* see above */ - ELEMENT_LOOP(PCB->Data); - { - TextType *text; - text = &(element)->Name[NAME_INDEX()]; - if (!TEST_FLAG(PCB_FLAG_SELECTED, text)) - continue; - nsel++; - } - END_LOOP; - ALLTEXT_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_SELECTED, text)) - continue; - nsel++; - } - ENDALL_LOOP; - if (!nsel) - return 0; - texts_by_pos = malloc(nsel * sizeof(*texts_by_pos)); - ntexts_by_pos = nsel; - nsel = 0; - ELEMENT_LOOP(PCB->Data); - { - TextType *text; - text = &(element)->Name[NAME_INDEX()]; - if (!TEST_FLAG(PCB_FLAG_SELECTED, text)) - continue; - texts_by_pos[nsel].text = text; - texts_by_pos[nsel].type = PCB_TYPE_ELEMENT_NAME; - texts_by_pos[nsel++].pos = coord(text, dir, point); - } - END_LOOP; - ALLTEXT_LOOP(PCB->Data); - { - if (!TEST_FLAG(PCB_FLAG_SELECTED, text)) - continue; - texts_by_pos[nsel].text = text; - texts_by_pos[nsel].type = PCB_TYPE_TEXT; - texts_by_pos[nsel++].pos = coord(text, dir, point); - } - ENDALL_LOOP; - qsort(texts_by_pos, ntexts_by_pos, sizeof(*texts_by_pos), cmp_tbp); - return ntexts_by_pos; -} - -static void free_texts_by_pos(void) -{ - if (ntexts_by_pos) { - free(texts_by_pos); - texts_by_pos = NULL; - ntexts_by_pos = 0; - } -} - - -/*! - * Find the reference coordinate from the specified points of all - * selected text. - */ -static Coord reference_coord(int op, int x, int y, int dir, int point, int reference) -{ - Coord q; - int i, nsel; - - q = 0; - switch (reference) { - case K_Crosshair: - if (dir == K_X) - q = x; - else - q = y; - break; - case K_Average: /* the average among selected text */ - nsel = ntexts_by_pos; - for (i = 0; i < ntexts_by_pos; ++i) { - q += coord(texts_by_pos[i].text, dir, point); - } - if (nsel) - q /= nsel; - break; - case K_First: /* first or last in the orthogonal direction */ - case K_Last: - if (!sort_texts_by_pos(op, dir, point)) { - q = 0; - break; - } - if (reference == K_First) { - q = coord(texts_by_pos[0].text, dir, point); - } - else { - q = coord(texts_by_pos[ntexts_by_pos - 1].text, dir, point); - } - break; - } - return q; -} - - -/*! - * AlignText(X, [Lefts/Rights/Centers, [First/Last/Crosshair/Average[, Gridless]]])\n - * AlignText(Y, [Tops/Bottoms/Centers, [First/Last/Crosshair/Average[, Gridless]]]) - * - * X or Y - Select which axis will move, other is untouched. \n - * Lefts, Rights, \n - * Tops, Bottoms, \n - * Centers - Pick alignment point within each element. \n - * NB: text objects have no Mark. \n - * First, Last, \n - * Crosshair, \n - * Average - Alignment reference, First=Topmost/Leftmost, \n - * Last=Bottommost/Rightmost, Average or Crosshair point \n - * Gridless - Do not force results to align to prevailing grid. \n - * - * Defaults are Lefts/Tops, First - */ -static int aligntext(int argc, const char **argv, Coord x, Coord y) -{ - int dir; - int point; - int reference; - int gridless; - Coord q; - Coord p, dp, dx, dy; - int changed = 0; - - if (argc < 1 || argc > 4) { - AFAIL(aligntext); - } - /* parse direction arg */ - switch ((dir = keyword(ARG(0)))) { - case K_X: - case K_Y: - break; - default: - AFAIL(aligntext); - } - /* parse point (within each element) which will be aligned */ - switch ((point = keyword(ARG(1)))) { - case K_Centers: - break; - case K_Lefts: - case K_Rights: - if (dir == K_Y) { - AFAIL(aligntext); - } - break; - case K_Tops: - case K_Bottoms: - if (dir == K_X) { - AFAIL(aligntext); - } - break; - case K_none: /* default value */ - if (dir == K_X) { - point = K_Lefts; - } - else { - point = K_Tops; - } - break; - default: - AFAIL(aligntext); - } - /* parse reference which will determine alignment coordinates */ - switch ((reference = keyword(ARG(2)))) { - case K_First: - case K_Last: - case K_Average: - case K_Crosshair: - break; - case K_none: - reference = K_First; /* default value */ - break; - default: - AFAIL(aligntext); - } - /* optionally work off the grid (solar cells!) */ - switch (keyword(ARG(3))) { - case K_Gridless: - gridless = 1; - break; - case K_none: - gridless = 0; - break; - default: - AFAIL(aligntext); - } - SaveUndoSerialNumber(); - /* find the final alignment coordinate using the above options */ - q = reference_coord(K_aligntext, Crosshair.X, Crosshair.Y, dir, point, reference); - /* move all selected elements to the new coordinate */ - /* selected text part of an element */ - ELEMENT_LOOP(PCB->Data); - { - TextType *text; - text = &(element)->Name[NAME_INDEX()]; - if (!TEST_FLAG(PCB_FLAG_SELECTED, text)) - continue; - /* find delta from reference point to reference point */ - p = coord(text, dir, point); - dp = q - p; - /* ...but if we're gridful, keep the mark on the grid */ - /* TODO re-enable for text, need textcoord() - if (!gridless) - { - dp -= (coord (text, dir, K_Marks) + dp) % (long) (PCB->Grid); - } - */ - if (dp) { - /* move from generic to X or Y */ - dx = dy = dp; - if (dir == K_X) - dy = 0; - else - dx = 0; - MoveObject(PCB_TYPE_ELEMENT_NAME, element, text, text, dx, dy); - changed = 1; - } - } - END_LOOP; - /* Selected bare text objects */ - ALLTEXT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, text)) { - /* find delta from reference point to reference point */ - p = coord(text, dir, point); - dp = q - p; - /* ...but if we're gridful, keep the mark on the grid */ - /* TODO re-enable for text, need textcoord() - if (!gridless) - { - dp -= (coord (text, dir, K_Marks) + dp) % (long) (PCB->Grid); - } - */ - if (dp) { - /* move from generic to X or Y */ - dx = dy = dp; - if (dir == K_X) - dy = 0; - else - dx = 0; - MoveObject(PCB_TYPE_TEXT, layer, text, text, dx, dy); - changed = 1; - } - } - } - ENDALL_LOOP; - if (changed) { - RestoreUndoSerialNumber(); - IncrementUndoSerialNumber(); - Redraw(); - SetChangedFlag(pcb_true); - } - free_texts_by_pos(); - return 0; -} - -/*! - * DistributeText(X, [Lefts/Rights/Centers/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]]) \n - * DistributeText(Y, [Tops/Bottoms/Centers/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]]) \n - * \n - * As with align, plus: \n - * \n - * Gaps - Make gaps even rather than spreading points evenly. \n - * First, Last, \n - * Crosshair - Two arguments specifying both ends of the distribution, - * they can't both be the same. \n - * \n - * Defaults are Lefts/Tops, First, Last \n - * \n - * Distributed texts always retain the same relative order they had - * before they were distributed. \n - */ -static int distributetext(int argc, const char **argv, Coord x, Coord y) -{ - int dir; - int point; - int refa, refb; - int gridless; - Coord s, e, slack; - int divisor; - int changed = 0; - int i; - - if (argc < 1 || argc == 3 || argc > 4) { - AFAIL(distributetext); - } - /* parse direction arg */ - switch ((dir = keyword(ARG(0)))) { - case K_X: - case K_Y: - break; - default: - AFAIL(distributetext); - } - /* parse point (within each element) which will be distributed */ - switch ((point = keyword(ARG(1)))) { - case K_Centers: - case K_Gaps: - break; - case K_Lefts: - case K_Rights: - if (dir == K_Y) { - AFAIL(distributetext); - } - break; - case K_Tops: - case K_Bottoms: - if (dir == K_X) { - AFAIL(distributetext); - } - break; - case K_none: /* default value */ - if (dir == K_X) { - point = K_Lefts; - } - else { - point = K_Tops; - } - break; - default: - AFAIL(distributetext); - } - /* parse reference which will determine first distribution coordinate */ - switch ((refa = keyword(ARG(2)))) { - case K_First: - case K_Last: - case K_Average: - case K_Crosshair: - break; - case K_none: - refa = K_First; /* default value */ - break; - default: - AFAIL(distributetext); - } - /* parse reference which will determine final distribution coordinate */ - switch ((refb = keyword(ARG(3)))) { - case K_First: - case K_Last: - case K_Average: - case K_Crosshair: - break; - case K_none: - refb = K_Last; /* default value */ - break; - default: - AFAIL(distributetext); - } - if (refa == refb) { - AFAIL(distributetext); - } - /* optionally work off the grid (solar cells!) */ - switch (keyword(ARG(4))) { - case K_Gridless: - gridless = 1; - break; - case K_none: - gridless = 0; - break; - default: - AFAIL(distributetext); - } - SaveUndoSerialNumber(); - /* build list of texts in orthogonal axis order */ - sort_texts_by_pos(K_distributetext, dir, point); - /* find the endpoints given the above options */ - s = reference_coord(K_distributetext, x, y, dir, point, refa); - e = reference_coord(K_distributetext, x, y, dir, point, refb); - slack = e - s; - /* use this divisor to calculate spacing (for 1 elt, avoid 1/0) */ - divisor = (ntexts_by_pos > 1) ? (ntexts_by_pos - 1) : 1; - /* even the gaps instead of the edges or whatnot */ - /* find the "slack" in the row */ - if (point == K_Gaps) { - Coord w; - - /* subtract all the "widths" from the slack */ - for (i = 0; i < ntexts_by_pos; ++i) { - TextType *text = texts_by_pos[i].text; - - /* coord doesn't care if I mix Lefts/Tops */ - w = texts_by_pos[i].width = coord(text, dir, K_Rights) - coord(text, dir, K_Lefts); - /* Gaps distribution is on centers, so half of - * first and last text don't count */ - if (i == 0 || i == ntexts_by_pos - 1) { - w /= 2; - } - slack -= w; - } - /* slack could be negative */ - } - /* move all selected texts to the new coordinate */ - for (i = 0; i < ntexts_by_pos; ++i) { - TextType *text = texts_by_pos[i].text; - int type = texts_by_pos[i].type; - Coord p, q, dp, dx, dy; - - /* find reference point for this text */ - q = s + slack * i / divisor; - /* find delta from reference point to reference point */ - p = coord(text, dir, point); - dp = q - p; - /* ...but if we're gridful, keep the mark on the grid */ - /* TODO re-enable grid - if (! gridless) - { - dp -= (coord (text, dir, K_Marks) + dp) % (long) (PCB->Grid); - } - */ - if (dp) { - /* move from generic to X or Y */ - dx = dy = dp; - if (dir == K_X) - dy = 0; - else - dx = 0; - /* need to know if the text is part of an element, - * all are PCB_TYPE_TEXT, but text associated with an - * element is also PCB_TYPE_ELEMENT_NAME. For undo, this is - * significant in search.c: SearchObjectByID. - * - * MoveObject() is better as in aligntext(), but we - * didn't keep the element reference when sorting. - */ - MOVE_TEXT_LOWLEVEL(text, dx, dy); - AddObjectToMoveUndoList(type, NULL, NULL, text, dx, dy); - changed = 1; - } - /* in gaps mode, accumulate part widths */ - if (point == K_Gaps) { - /* move remaining half of our text */ - s += texts_by_pos[i].width / 2; - /* move half of next text */ - if (i < ntexts_by_pos - 1) - s += texts_by_pos[i + 1].width / 2; - } - } - if (changed) { - RestoreUndoSerialNumber(); - IncrementUndoSerialNumber(); - Redraw(); - SetChangedFlag(pcb_true); - } - free_texts_by_pos(); - return 0; -} - -static HID_Action distaligntext_action_list[] = { - {"distributetext", NULL, distributetext, "Distribute Text Elements", distributetext_syntax}, - {"aligntext", NULL, aligntext, "Align Text Elements", aligntext_syntax} -}; - -char *distaligntext_cookie = "distaligntext plugin"; - -REGISTER_ACTIONS(distaligntext_action_list, distaligntext_cookie) - -static void hid_distaligntext_uninit(void) -{ - hid_remove_actions_by_cookie(distaligntext_cookie); -} - -#include "dolists.h" -pcb_uninit_t hid_distaligntext_init() -{ - REGISTER_ACTIONS(distaligntext_action_list, distaligntext_cookie); - return hid_distaligntext_uninit; -} Index: 1.1.4/src_plugins/distaligntext/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/distaligntext/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/distaligntext/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {distaligntext} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/distaligntext/distaligntext.o @] - -switch /local/pcb/distaligntext/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/distaligntext/README =================================================================== --- 1.1.4/src_plugins/distaligntext/README (revision 10776) +++ 1.1.4/src_plugins/distaligntext/README (nonexistent) @@ -1,5 +0,0 @@ -Same as distalign, operates on text objects. - -#state: works -#default: buildin -#implements: (feature) Index: 1.1.4/src_plugins/distaligntext/Makefile =================================================================== --- 1.1.4/src_plugins/distaligntext/Makefile (revision 10776) +++ 1.1.4/src_plugins/distaligntext/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_distaligntext - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/Buildin.tmpasm =================================================================== --- 1.1.4/src_plugins/Buildin.tmpasm (revision 10776) +++ 1.1.4/src_plugins/Buildin.tmpasm (nonexistent) @@ -1,25 +0,0 @@ -# tmpasm script for compiling a plugin_src/ module as a buildin -# Requires variables before the include: -# /local/pcb/mod basename of the module (e.g. autoplace) -# /local/pcb/mod/OBJS full path of all object files -# /local/pcb/mod/OBJS_C99 full path of all object files for non-c89 -# /local/pcb/mod/CONF config file name - -append /local/pcb/buildin_init_extern [@extern pcb_uninit_t hid_@/local/pcb/mod@_init();@] {\n} - -append /local/pcb/buildin_init_code [@ - uninit_func = hid_@/local/pcb/mod@_init(); - plugin_register("@/local/pcb/mod@", "<@/local/pcb/mod@>", NULL, 0, uninit_func); -@] {\n} - -append /local/pcb/OBJS ?/local/pcb/mod/OBJS -append /local/pcb/OBJS_C99 ?/local/pcb/mod/OBJS_C99 -append /local/pcb/LDFLAGS /local/pcb/mod/LDFLAGS -append /local/pcb/CFLAGS /local/pcb/mod/CFLAGS -append /local/pcb/RULES [@ - -mod_@/local/pcb/mod@: all - -@] - -include /local/pcb/tmpasm/common_enabled Index: 1.1.4/src_plugins/autoroute/mtspace.h =================================================================== --- 1.1.4/src_plugins/autoroute/mtspace.h (revision 10776) +++ 1.1.4/src_plugins/autoroute/mtspace.h (nonexistent) @@ -1,77 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, mtspace.h, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* prototypes for "empty space" routines (needed for via-space tracking - * in the auto-router. - */ - -#ifndef PCB_MTSPACE_H -#define PCB_MTSPACE_H - -/* mtspace data structures are built on r-trees. */ - -#include "global.h" -#include "vector.h" /* for vector_t in mtspace_query_rect prototype */ - -typedef struct mtspace mtspace_t; -typedef enum { FIXED, ODD, EVEN } mtspace_type_t; -typedef struct vetting vetting_t; - -/* create an "empty space" representation with a shrunken boundary */ -mtspace_t *mtspace_create(void); -/* destroy an "empty space" representation. */ -void mtspace_destroy(mtspace_t ** mtspacep); - -/* -- mutation -- */ - -/* add a space-filler to the empty space representation. The given box - * should *not* be bloated; it should be "true". The feature will fill - * *at least* a radius of clearance around it; - */ -void mtspace_add(mtspace_t * mtspace, const BoxType * box, mtspace_type_t which, Coord clearance); -/* remove a space-filler from the empty space representation. The given box - * should *not* be bloated; it should be "true". The feature will fill - * *at least* a radius of clearance around it; - */ -void mtspace_remove(mtspace_t * mtspace, const BoxType * box, mtspace_type_t which, Coord clearance); - - -vetting_t *mtspace_query_rect(mtspace_t * mtspace, const BoxType * region, - Coord radius, Coord clearance, - vetting_t * work, - vector_t * free_space_vec, - vector_t * lo_conflict_space_vec, - vector_t * hi_conflict_space_vec, pcb_bool is_odd, pcb_bool with_conflicts, CheapPointType * desired); - -void mtsFreeWork(vetting_t **); -int mtsBoxCount(vetting_t *); - -#endif /* ! PCB_MTSPACE_H */ Index: 1.1.4/src_plugins/autoroute/vector.c =================================================================== --- 1.1.4/src_plugins/autoroute/vector.c (revision 10776) +++ 1.1.4/src_plugins/autoroute/vector.c (nonexistent) @@ -1,213 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, vector.c, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* operations on vectors. */ - -#include "config.h" - -#include -#include -#include - -#include "global.h" -#include "vector.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ - -/* --------------------------------------------------------------------------- - * some local types - */ -struct vector_struct { - vector_element_t *element; - int size, max; -}; - -/* --------------------------------------------------------------------------- - * some local identifiers - */ - -/* --------------------------------------------------------------------------- - * functions. - */ - -/* helper function for assertions */ -#ifndef NDEBUG -static int __vector_is_good(vector_t * vector) -{ - return vector && (vector->max == 0 || vector->element) && - (vector->max >= 0) && (vector->size >= 0) && (vector->size <= vector->max) && 1; -} -#endif /* !NDEBUG */ - -/* create an empty vector */ -vector_t *vector_create() -{ - vector_t *vector; - /* okay, create empty vector */ - vector = (vector_t *) calloc(1, sizeof(*vector)); - assert(vector); - assert(__vector_is_good(vector)); - return vector; -} - -/* destroy a vector */ -void vector_destroy(vector_t ** vector) -{ - assert(vector && *vector); - assert(__vector_is_good(*vector)); - if ((*vector)->element) - free((*vector)->element); - free(*vector); - *vector = NULL; -} - -/* -- interrogation -- */ -int vector_is_empty(vector_t * vector) -{ - assert(__vector_is_good(vector)); - return (vector->size == 0); -} - -int vector_size(vector_t * vector) -{ - assert(__vector_is_good(vector)); - return (vector->size); -} - -vector_element_t vector_element(vector_t * vector, int N) -{ - assert(__vector_is_good(vector)); - assert(N < vector->size); - return vector->element[N]; -} - -/* return the first element of the vector. */ -vector_element_t vector_element_first(vector_t * vector) -{ - assert(__vector_is_good(vector)); - assert(vector->size > 0); - return vector_element(vector, 0); -} - -/* return the last element of the vector. */ -vector_element_t vector_element_last(vector_t * vector) -{ - assert(__vector_is_good(vector)); - assert(vector->size > 0); - return vector_element(vector, vector->size - 1); -} - -/* -- mutation -- */ -/* add data to end of vector */ -void vector_append(vector_t * vector, vector_element_t data) -{ - vector_insert_many(vector, vector->size, &data, 1); -} - -void vector_append_many(vector_t * vector, vector_element_t data[], int count) -{ - vector_insert_many(vector, vector->size, data, count); -} - -void vector_append_vector(vector_t * vector, vector_t * other_vector) -{ - vector_append_many(vector, other_vector->element, other_vector->size); -} - -void vector_insert(vector_t * vector, int N, vector_element_t data) -{ - vector_insert_many(vector, N, &data, 1); -} - -/* add data at specified position of vector */ -void vector_insert_many(vector_t * vector, int N, vector_element_t data[], int count) -{ - assert(__vector_is_good(vector)); - assert(N <= vector->size); - if (count == 0) - return; - assert(data && count > 0); - if (vector->size + count > vector->max) { - vector->max = MAX(32, MAX(vector->size + count, vector->max * 2)); - vector->element = (void **) realloc(vector->element, vector->max * sizeof(*vector->element)); - } - memmove(vector->element + N + count, vector->element + N, (vector->size - N) * sizeof(*vector->element)); - memmove(vector->element + N, data, count * sizeof(*data)); - vector->size += count; - assert(__vector_is_good(vector)); -} - -vector_t *vector_duplicate(vector_t * orig) -{ - vector_t *newone = vector_create(); - if (!orig) - return newone; - newone->element = (void **) malloc(orig->max * sizeof(*orig->element)); - newone->max = orig->max; - newone->size = orig->size; - memcpy(newone->element, orig->element, orig->size * sizeof(vector_element_t)); - assert(__vector_is_good(newone)); - return newone; -} - -/* return and delete the *last* element of vector */ -vector_element_t vector_remove_last(vector_t * vector) -{ - assert(vector->size > 0); - return vector_remove(vector, vector->size - 1); -} - -/* return and delete data at specified position of vector */ -vector_element_t vector_remove(vector_t * vector, int N) -{ - vector_element_t old; - assert(__vector_is_good(vector)); - assert(N < vector->size); - old = vector->element[N]; - memmove(vector->element + N, vector->element + N + 1, (vector->size - (N + 1)) * sizeof(*vector->element)); - vector->size--; - assert(__vector_is_good(vector)); - return old; -} - -/* replace the data at the specified position with the given data. - * returns the old data. */ -vector_element_t vector_replace(vector_t * vector, vector_element_t data, int N) -{ - vector_element_t old; - assert(__vector_is_good(vector)); - assert(N < vector->size); - old = vector->element[N]; - vector->element[N] = data; - assert(__vector_is_good(vector)); - return old; -} Index: 1.1.4/src_plugins/autoroute/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/autoroute/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/autoroute/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {autoroute} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/autoroute/autoroute.o $(PLUGDIR)/autoroute/mtspace.o $(PLUGDIR)/autoroute/action.o $(PLUGDIR)/autoroute/vector.o @] - -switch /local/pcb/autoroute/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/autoroute/autoroute.c =================================================================== --- 1.1.4/src_plugins/autoroute/autoroute.c (revision 10776) +++ 1.1.4/src_plugins/autoroute/autoroute.c (nonexistent) @@ -1,4720 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, autoroute.c, was written and is - * Copyright (c) 2001 C. Scott Ananian - * Copyright (c) 2006 harry eaton - * Copyright (c) 2009 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ -/* functions used to autoroute nets. - */ -/* - *------------------------------------------------------------------- - * This file implements a rectangle-expansion router, based on - * "A Method for Gridless Routing of Printed Circuit Boards" by - * A. C. Finch, K. J. Mackenzie, G. J. Balsdon, and G. Symonds in the - * 1985 Proceedings of the 22nd ACM/IEEE Design Automation Conference. - * This reference is available from the ACM Digital Library at - * http://www.acm.org/dl for those with institutional or personal - * access to it. It's also available from your local engineering - * library. - * - * The code is much closer to what is described in the paper now, - * in that expansion areas can grow from corners and in all directions - * at once. Previously, these were emulated with discrete boxes moving - * in the cardinal directions. With the new method, there are fewer but - * larger expansion boxes that one might do a better job of routing in. - *-------------------------------------------------------------------- - */ -#define NET_HEAP 1 -#include "config.h" -#include "conf_core.h" - -#include "global.h" - -#include -#include - -#include "data.h" -#include "macro.h" -#include "autoroute.h" -#include "box.h" -#include "create.h" -#include "draw.h" -#include "error.h" -#include "find.h" -#include "heap.h" -#include "rtree.h" -#include "misc.h" -#include "mtspace.h" -#include "mymem.h" -#include "polygon.h" -#include "rats.h" -#include "remove.h" -#include "thermal.h" -#include "undo.h" -#include "vector.h" -#include "pcb-printf.h" -#include "set.h" -#include "layer.h" - -/* #defines to enable some debugging output */ -/* -#define ROUTE_VERBOSE -*/ - -/* -#define ROUTE_DEBUG -//#define DEBUG_SHOW_ROUTE_BOXES -#define DEBUG_SHOW_EXPANSION_BOXES -//#define DEBUG_SHOW_EDGES -//#define DEBUG_SHOW_VIA_BOXES -#define DEBUG_SHOW_TARGETS -#define DEBUG_SHOW_SOURCES -//#define DEBUG_SHOW_ZIGZAG -*/ - -static direction_t directionIncrement(direction_t dir) -{ - switch (dir) { - case NORTH: - dir = EAST; - break; - case EAST: - dir = SOUTH; - break; - case SOUTH: - dir = WEST; - break; - case WEST: - dir = NE; - break; - case NE: - dir = SE; - break; - case SE: - dir = SW; - break; - case SW: - dir = NW; - break; - case NW: - dir = ALL; - break; - case ALL: - dir = NORTH; - break; - } - return dir; -} - -#ifdef ROUTE_DEBUG -HID *ddraw = NULL; -static hidGC ar_gc = 0; -#endif - -#define EXPENSIVE 3e28 -/* round up "half" thicknesses */ -#define HALF_THICK(x) (((x)+1)/2) -/* a styles maximum bloat is its clearance plus the larger of its via radius - * or line half-thickness. */ -#define BLOAT(style)\ - ((style)->Clearance + HALF_THICK((style)->Thick)) -/* conflict penalty is less for traces laid down during previous pass than - * it is for traces already laid down in this pass. */ -#define CONFLICT_LEVEL(rb)\ - (((rb)->flags.is_odd==AutoRouteParameters.is_odd) ?\ - HI_CONFLICT : LO_CONFLICT ) -#define CONFLICT_PENALTY(rb)\ - ((CONFLICT_LEVEL(rb)==HI_CONFLICT ? \ - AutoRouteParameters.ConflictPenalty : \ - CONFLICT_LEVEL(rb)==LO_CONFLICT ? \ - AutoRouteParameters.LastConflictPenalty : 1) * (rb)->pass) - -#define _NORTH 1 -#define _EAST 2 -#define _SOUTH 4 -#define _WEST 8 - -#define LIST_LOOP(init, which, x) do {\ - routebox_t *__next_one__ = (init);\ - x = NULL;\ - if (!__next_one__)\ - assert(__next_one__);\ - else\ - while (!x || __next_one__ != (init)) {\ - x = __next_one__;\ - /* save next one first in case the command modifies or frees it */\ - __next_one__ = x->which.next -#define FOREACH_SUBNET(net, p) do {\ - routebox_t *_pp_;\ - /* fail-fast: check subnet_processed flags */\ - LIST_LOOP(net, same_net, p); \ - assert(!p->flags.subnet_processed);\ - END_LOOP;\ - /* iterate through *distinct* subnets */\ - LIST_LOOP(net, same_net, p); \ - if (!p->flags.subnet_processed) {\ - LIST_LOOP(p, same_subnet, _pp_);\ - _pp_->flags.subnet_processed=1;\ - END_LOOP -#define END_FOREACH(net, p) \ - }; \ - END_LOOP;\ - /* reset subnet_processed flags */\ - LIST_LOOP(net, same_net, p); \ - p->flags.subnet_processed=0;\ - END_LOOP;\ -} while (0) -#define SWAP(t, f, s) do { t a=s; s=f; f=a; } while (0) -/* notes: - * all rectangles are assumed to be closed on the top and left and - * open on the bottom and right. That is, they include their top-left - * corner but don't include their bottom and right edges. - * - * expansion regions are always half-closed. This means that when - * tracing paths, you must steer clear of the bottom and right edges., - * because these are not actually in the allowed box. - * - * All routeboxes *except* EXPANSION_AREAS now have their "box" bloated by - * their particular required clearance. This simplifies the tree searching. - * the "sbox" contains the unbloated box. - */ -/* --------------------------------------------------------------------------- - * some local types - */ - -/* enumerated type for conflict levels */ -typedef enum { NO_CONFLICT = 0, LO_CONFLICT = 1, HI_CONFLICT = 2 } conflict_t; - -typedef struct routebox_list { - struct routebox *next, *prev; -} routebox_list; - -typedef enum etype { PAD, PIN, VIA, VIA_SHADOW, LINE, OTHER, EXPANSION_AREA, PLANE, THERMAL } etype; - -typedef struct routebox { - BoxType box, sbox; - union { - PadTypePtr pad; - PinTypePtr pin; - PinTypePtr via; - struct routebox *via_shadow; /* points to the via in r-tree which - * points to the PinType in the PCB. */ - LineTypePtr line; - void *generic; /* 'other' is polygon, arc, text */ - struct routebox *expansion_area; /* previous expansion area in search */ - } parent; - unsigned short group; - unsigned short layer; - etype type; - struct { - unsigned nonstraight:1; - unsigned fixed:1; - /* for searches */ - unsigned source:1; - unsigned target:1; - /* rects on same net as source and target don't need clearance areas */ - unsigned nobloat:1; - /* mark circular pins, so that we be sure to connect them up properly */ - unsigned circular:1; - /* we sometimes create routeboxen that don't actually belong to a - * r-tree yet -- make sure refcount of homelesss is set properly */ - unsigned homeless:1; - /* was this nonfixed obstacle generated on an odd or even pass? */ - unsigned is_odd:1; - /* fixed route boxes that have already been "routed through" in this - * search have their "touched" flag set. */ - unsigned touched:1; - /* this is a status bit for iterating through *different* subnets */ - unsigned subnet_processed:1; - /* some expansion_areas represent via candidates */ - unsigned is_via:1; - /* mark non-straight lines which go from bottom-left to upper-right, - * instead of from upper-left to bottom-right. */ - unsigned bl_to_ur:1; - /* mark polygons which are "transparent" for via-placement; that is, - * vias through the polygon will automatically be given a clearance - * and will not electrically connect to the polygon. */ - unsigned clear_poly:1; - /* this marks "conflicting" routes that must be torn up to obtain - * a correct routing. This flag allows us to return a correct routing - * even if the user cancels auto-route after a non-final pass. */ - unsigned is_bad:1; - /* for assertion that 'box' is never changed after creation */ - unsigned inited:1; - /* indicate this expansion ares is a thermal between the pin and plane */ - unsigned is_thermal; - } flags; - /* indicate the direction an expansion box came from */ - cost_t cost; - CheapPointType cost_point; - /* reference count for homeless routeboxes; free when refcount==0 */ - int refcount; - /* when routing with conflicts, we keep a record of what we're - * conflicting with. - */ - vector_t *conflicts_with; - /* route style of the net associated with this routebox */ - RouteStyleType *style; - /* congestion values for the edges of an expansion box */ - unsigned char n, e, s, w; - /* what pass this this track was laid down on */ - unsigned char pass; - /* the direction this came from, if any */ - direction_t came_from; - /* circular lists with connectivity information. */ - routebox_list same_net, same_subnet, original_subnet, different_net; - union { - PinType *via; - LineType *line; - } livedraw_obj; -} routebox_t; - -typedef struct routedata { - int max_styles; - /* one rtree per layer *group */ - rtree_t *layergrouptree[MAX_LAYER]; /* no silkscreen layers here =) */ - /* root pointer into connectivity information */ - routebox_t *first_net; - /* default routing style */ - RouteStyleType defaultstyle; - /* style structures */ - RouteStyleType **styles; /* [max_styles+1] */ - /* what is the maximum bloat (clearance+line half-width or - * clearance+via_radius) for any style we've seen? */ - Coord max_bloat; - Coord max_keep; - mtspace_t *mtspace; -} routedata_t; - -typedef struct edge_struct { - routebox_t *rb; /* path expansion edges are real routeboxen. */ - CheapPointType cost_point; - cost_t cost_to_point; /* from source */ - cost_t cost; /* cached edge cost */ - routebox_t *mincost_target; /* minimum cost from cost_point to any target */ - vetting_t *work; /* for via search edges */ - direction_t expand_dir; - struct { - /* this indicates that this 'edge' is a via candidate. */ - unsigned is_via:1; - /* record "conflict level" of via candidates, in case we need to split - * them later. */ - conflict_t via_conflict_level:2; - /* when "routing with conflicts", sometimes edge is interior. */ - unsigned is_interior:1; - /* this is a fake edge used to defer searching for via spaces */ - unsigned via_search:1; - /* this is a via edge in a plane where the cost point moves for free */ - unsigned in_plane:1; - } flags; -} edge_t; - -static struct { - /* net style parameters */ - RouteStyleType *style; - /* the present bloat */ - Coord bloat; - /* cost parameters */ - cost_t ViaCost, /* additional "length" cost for using a via */ - LastConflictPenalty, /* length mult. for routing over last pass' trace */ - ConflictPenalty, /* length multiplier for routing over another trace */ - JogPenalty, /* additional "length" cost for changing direction */ - CongestionPenalty, /* (rational) length multiplier for routing in */ - NewLayerPenalty, /* penalty for routing on a previously unused layer */ - MinPenalty; /* smallest Direction Penalty */ - /* maximum conflict incidence before calling it "no path found" */ - int hi_conflict; - /* are vias allowed? */ - pcb_bool use_vias; - /* is this an odd or even pass? */ - pcb_bool is_odd; - /* permit conflicts? */ - pcb_bool with_conflicts; - /* is this a final "smoothing" pass? */ - pcb_bool is_smoothing; - /* rip up nets regardless of conflicts? */ - pcb_bool rip_always; - pcb_bool last_smooth; - unsigned char pass; -} AutoRouteParameters; - -struct routeone_state { - /* heap of all candidate expansion edges */ - heap_t *workheap; - /* information about the best path found so far. */ - routebox_t *best_path, *best_target; - cost_t best_cost; -}; - - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static routebox_t *CreateExpansionArea(const BoxType * area, pcb_cardinal_t group, - routebox_t * parent, pcb_bool relax_edge_requirements, edge_t * edge); - -static cost_t edge_cost(const edge_t * e, const cost_t too_big); -static void best_path_candidate(struct routeone_state *s, edge_t * e, routebox_t * best_target); - -static BoxType edge_to_box(const routebox_t * rb, direction_t expand_dir); - -static void add_or_destroy_edge(struct routeone_state *s, edge_t * e); - -static void -RD_DrawThermal(routedata_t * rd, Coord X, Coord Y, pcb_cardinal_t group, pcb_cardinal_t layer, routebox_t * subnet, pcb_bool is_bad); -static void ResetSubnet(routebox_t * net); -#ifdef ROUTE_DEBUG -static int showboxen = -2; -static int aabort = 0; -static void showroutebox(routebox_t * rb); -#endif - -/* --------------------------------------------------------------------------- - * some local identifiers - */ -/* group number of groups that hold surface mount pads */ -static pcb_cardinal_t front, back; -static pcb_bool usedGroup[MAX_LAYER]; -static int x_cost[MAX_LAYER], y_cost[MAX_LAYER]; -static pcb_bool is_layer_group_active[MAX_LAYER]; -static int ro = 0; -static int smoothes = 1; -static int passes = 12; -static int routing_layers = 0; -static float total_wire_length = 0; -static int total_via_count = 0; - -/* assertion helper for routeboxen */ -#ifndef NDEBUG -static int __routebox_is_good(routebox_t * rb) -{ - assert(rb && (rb->group < max_group) && - (rb->box.X1 <= rb->box.X2) && (rb->box.Y1 <= rb->box.Y2) && - (rb->flags.homeless ? - (rb->box.X1 != rb->box.X2) || (rb->box.Y1 != rb->box.Y2) : (rb->box.X1 != rb->box.X2) && (rb->box.Y1 != rb->box.Y2))); - assert((rb->flags.source ? rb->flags.nobloat : 1) && - (rb->flags.target ? rb->flags.nobloat : 1) && - (rb->flags.homeless ? !rb->flags.touched : rb->refcount == 0) && (rb->flags.touched ? rb->type != EXPANSION_AREA : 1)); - assert((rb->flags.is_odd ? (!rb->flags.fixed) && - (rb->type == VIA || rb->type == VIA_SHADOW || rb->type == LINE || rb->type == PLANE) : 1)); - assert(rb->flags.clear_poly ? ((rb->type == OTHER || rb->type == PLANE) && rb->flags.fixed && !rb->flags.homeless) : 1); - assert(rb->flags.inited); -/* run through conflict list showing none are homeless, targets or sources */ - if (rb->conflicts_with) { - int i; - for (i = 0; i < vector_size(rb->conflicts_with); i++) { - routebox_t *c = vector_element(rb->conflicts_with, i); - assert(!c->flags.homeless && !c->flags.source && !c->flags.target && !c->flags.fixed); - } - } - assert(rb->style != NULL && rb->style != NULL); - assert(rb->type == EXPANSION_AREA - || (rb->same_net.next && rb->same_net.prev && rb->same_subnet.next - && rb->same_subnet.prev && rb->original_subnet.next - && rb->original_subnet.prev && rb->different_net.next && rb->different_net.prev)); - return 1; -} - -static int __edge_is_good(edge_t * e) -{ - assert(e && e->rb && __routebox_is_good(e->rb)); - assert((e->rb->flags.homeless ? e->rb->refcount > 0 : 1)); - assert((0 <= e->expand_dir) && (e->expand_dir < 9) - && (e->flags.is_interior ? (e->expand_dir == ALL && e->rb->conflicts_with) : 1)); - assert((e->flags.is_via ? e->rb->flags.is_via : 1) - && (e->flags.via_conflict_level >= 0 && e->flags.via_conflict_level <= 2) - && (e->flags.via_conflict_level != 0 ? e->flags.is_via : 1)); - assert((e->cost_to_point >= 0) && e->cost >= 0); - return 1; -} - -int no_planes(const BoxType * b, void *cl) -{ - routebox_t *rb = (routebox_t *) b; - if (rb->type == PLANE) - return 0; - return 1; -} -#endif /* !NDEBUG */ - -/*--------------------------------------------------------------------- - * route utility functions. - */ - -enum boxlist { NET, SUBNET, ORIGINAL, DIFFERENT_NET }; -static struct routebox_list *__select_list(routebox_t * r, enum boxlist which) -{ - assert(r); - switch (which) { - default: - assert(0); - case NET: - return &(r->same_net); - case SUBNET: - return &(r->same_subnet); - case ORIGINAL: - return &(r->original_subnet); - case DIFFERENT_NET: - return &(r->different_net); - } -} - -static void InitLists(routebox_t * r) -{ - static enum boxlist all[] = { NET, SUBNET, ORIGINAL, DIFFERENT_NET } - , *p; - for (p = all; p < all + (sizeof(all) / sizeof(*p)); p++) { - struct routebox_list *rl = __select_list(r, *p); - rl->prev = rl->next = r; - } -} - -static void MergeNets(routebox_t * a, routebox_t * b, enum boxlist which) -{ - struct routebox_list *al, *bl, *anl, *bnl; - routebox_t *an, *bn; - assert(a && b); - assert(a != b); - assert(a->type != EXPANSION_AREA); - assert(b->type != EXPANSION_AREA); - al = __select_list(a, which); - bl = __select_list(b, which); - assert(al && bl); - an = al->next; - bn = bl->next; - assert(an && bn); - anl = __select_list(an, which); - bnl = __select_list(bn, which); - assert(anl && bnl); - bl->next = an; - anl->prev = b; - al->next = bn; - bnl->prev = a; -} - -static void RemoveFromNet(routebox_t * a, enum boxlist which) -{ - struct routebox_list *al, *anl, *apl; - routebox_t *an, *ap; - assert(a); - al = __select_list(a, which); - assert(al); - an = al->next; - ap = al->prev; - if (an == a || ap == a) - return; /* not on any list */ - assert(an && ap); - anl = __select_list(an, which); - apl = __select_list(ap, which); - assert(anl && apl); - anl->prev = ap; - apl->next = an; - al->next = al->prev = a; - return; -} - -static void init_const_box(routebox_t * rb, Coord X1, Coord Y1, Coord X2, Coord Y2, Coord clearance) -{ - BoxType *bp = (BoxType *) & rb->box; /* note discarding const! */ - assert(!rb->flags.inited); - assert(X1 <= X2 && Y1 <= Y2); - bp->X1 = X1 - clearance; - bp->Y1 = Y1 - clearance; - bp->X2 = X2 + clearance; - bp->Y2 = Y2 + clearance; - bp = (BoxType *) & rb->sbox; - bp->X1 = X1; - bp->Y1 = Y1; - bp->X2 = X2; - bp->Y2 = Y2; - rb->flags.inited = 1; -} - -static inline BoxType shrink_routebox(const routebox_t * rb) -{ - return rb->sbox; -} - -static inline cost_t box_area(const BoxType b) -{ - cost_t ans = b.X2 - b.X1; - return ans * (b.Y2 - b.Y1); -} - -static inline CheapPointType closest_point_in_routebox(const CheapPointType * from, const routebox_t * rb) -{ - return closest_point_in_box(from, &rb->sbox); -} - -static inline pcb_bool point_in_shrunk_box(const routebox_t * box, Coord X, Coord Y) -{ - BoxType b = shrink_routebox(box); - return point_in_box(&b, X, Y); -} - -/*--------------------------------------------------------------------- - * routedata initialization functions. - */ - -static routebox_t *AddPin(PointerListType layergroupboxes[], PinTypePtr pin, pcb_bool is_via, RouteStyleType * style) -{ - routebox_t **rbpp, *lastrb = NULL; - int i, ht; - /* a pin cuts through every layer group */ - for (i = 0; i < max_group; i++) { - rbpp = (routebox_t **) GetPointerMemory(&layergroupboxes[i]); - *rbpp = (routebox_t *) malloc(sizeof(**rbpp)); - memset((void *) *rbpp, 0, sizeof(**rbpp)); - (*rbpp)->group = i; - ht = HALF_THICK(MAX(pin->Thickness, pin->DrillingHole)); - init_const_box(*rbpp, - /*X1 */ pin->X - ht, - /*Y1 */ pin->Y - ht, - /*X2 */ pin->X + ht, - /*Y2 */ pin->Y + ht, style->Clearance); - /* set aux. properties */ - if (is_via) { - (*rbpp)->type = VIA; - (*rbpp)->parent.via = pin; - } - else { - (*rbpp)->type = PIN; - (*rbpp)->parent.pin = pin; - } - (*rbpp)->flags.fixed = 1; - (*rbpp)->came_from = ALL; - (*rbpp)->style = style; - (*rbpp)->flags.circular = !TEST_FLAG(PCB_FLAG_SQUARE, pin); - /* circular lists */ - InitLists(*rbpp); - /* link together */ - if (lastrb) { - MergeNets(*rbpp, lastrb, NET); - MergeNets(*rbpp, lastrb, SUBNET); - MergeNets(*rbpp, lastrb, ORIGINAL); - } - lastrb = *rbpp; - } - return lastrb; -} - -static routebox_t *AddPad(PointerListType layergroupboxes[], ElementTypePtr element, PadTypePtr pad, RouteStyleType * style) -{ - Coord halfthick; - routebox_t **rbpp; - int layergroup = (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? back : front); - assert(0 <= layergroup && layergroup < max_group); - assert(PCB->LayerGroups.Number[layergroup] > 0); - rbpp = (routebox_t **) GetPointerMemory(&layergroupboxes[layergroup]); - assert(rbpp); - *rbpp = (routebox_t *) malloc(sizeof(**rbpp)); - assert(*rbpp); - memset(*rbpp, 0, sizeof(**rbpp)); - (*rbpp)->group = layergroup; - halfthick = HALF_THICK(pad->Thickness); - init_const_box(*rbpp, - /*X1 */ MIN(pad->Point1.X, pad->Point2.X) - halfthick, - /*Y1 */ MIN(pad->Point1.Y, pad->Point2.Y) - halfthick, - /*X2 */ MAX(pad->Point1.X, pad->Point2.X) + halfthick, - /*Y2 */ MAX(pad->Point1.Y, pad->Point2.Y) + halfthick, - style->Clearance); - /* kludge for non-manhattan pads (which are not allowed at present) */ - if (pad->Point1.X != pad->Point2.X && pad->Point1.Y != pad->Point2.Y) - (*rbpp)->flags.nonstraight = 1; - /* set aux. properties */ - (*rbpp)->type = PAD; - (*rbpp)->parent.pad = pad; - (*rbpp)->flags.fixed = 1; - (*rbpp)->came_from = ALL; - (*rbpp)->style = style; - /* circular lists */ - InitLists(*rbpp); - return *rbpp; -} - -static routebox_t *AddLine(PointerListType layergroupboxes[], int layergroup, LineTypePtr line, - LineTypePtr ptr, RouteStyleType * style) -{ - routebox_t **rbpp; - assert(layergroupboxes && line); - assert(0 <= layergroup && layergroup < max_group); - assert(PCB->LayerGroups.Number[layergroup] > 0); - - rbpp = (routebox_t **) GetPointerMemory(&layergroupboxes[layergroup]); - *rbpp = (routebox_t *) malloc(sizeof(**rbpp)); - memset(*rbpp, 0, sizeof(**rbpp)); - (*rbpp)->group = layergroup; - init_const_box(*rbpp, - /*X1 */ MIN(line->Point1.X, - line->Point2.X) - HALF_THICK(line->Thickness), - /*Y1 */ MIN(line->Point1.Y, - line->Point2.Y) - HALF_THICK(line->Thickness), - /*X2 */ MAX(line->Point1.X, - line->Point2.X) + HALF_THICK(line->Thickness), - /*Y2 */ MAX(line->Point1.Y, - line->Point2.Y) + HALF_THICK(line->Thickness), style->Clearance); - /* kludge for non-manhattan lines */ - if (line->Point1.X != line->Point2.X && line->Point1.Y != line->Point2.Y) { - (*rbpp)->flags.nonstraight = 1; - (*rbpp)->flags.bl_to_ur = - (MIN(line->Point1.X, line->Point2.X) == line->Point1.X) != (MIN(line->Point1.Y, line->Point2.Y) == line->Point1.Y); -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_ZIGZAG) - showroutebox(*rbpp); -#endif - } - /* set aux. properties */ - (*rbpp)->type = LINE; - (*rbpp)->parent.line = ptr; - (*rbpp)->flags.fixed = 1; - (*rbpp)->came_from = ALL; - (*rbpp)->style = style; - /* circular lists */ - InitLists(*rbpp); - return *rbpp; -} - -static routebox_t *AddIrregularObstacle(PointerListType layergroupboxes[], - Coord X1, Coord Y1, - Coord X2, Coord Y2, pcb_cardinal_t layergroup, void *parent, RouteStyleType * style) -{ - routebox_t **rbpp; - Coord keep = style->Clearance; - assert(layergroupboxes && parent); - assert(X1 <= X2 && Y1 <= Y2); - assert(0 <= layergroup && layergroup < max_group); - assert(PCB->LayerGroups.Number[layergroup] > 0); - - rbpp = (routebox_t **) GetPointerMemory(&layergroupboxes[layergroup]); - *rbpp = (routebox_t *) malloc(sizeof(**rbpp)); - memset(*rbpp, 0, sizeof(**rbpp)); - (*rbpp)->group = layergroup; - init_const_box(*rbpp, X1, Y1, X2, Y2, keep); - (*rbpp)->flags.nonstraight = 1; - (*rbpp)->type = OTHER; - (*rbpp)->parent.generic = parent; - (*rbpp)->flags.fixed = 1; - (*rbpp)->style = style; - /* circular lists */ - InitLists(*rbpp); - return *rbpp; -} - -static routebox_t *AddPolygon(PointerListType layergroupboxes[], pcb_cardinal_t layer, PolygonTypePtr polygon, RouteStyleType * style) -{ - int is_not_rectangle = 1; - int layergroup = GetLayerGroupNumberByNumber(layer); - routebox_t *rb; - assert(0 <= layergroup && layergroup < max_group); - rb = AddIrregularObstacle(layergroupboxes, - polygon->BoundingBox.X1, - polygon->BoundingBox.Y1, - polygon->BoundingBox.X2, polygon->BoundingBox.Y2, layergroup, polygon, style); - if (polygon->PointN == 4 && - polygon->HoleIndexN == 0 && - (polygon->Points[0].X == polygon->Points[1].X || - polygon->Points[0].Y == polygon->Points[1].Y) && - (polygon->Points[1].X == polygon->Points[2].X || - polygon->Points[1].Y == polygon->Points[2].Y) && - (polygon->Points[2].X == polygon->Points[3].X || - polygon->Points[2].Y == polygon->Points[3].Y) && - (polygon->Points[3].X == polygon->Points[0].X || polygon->Points[3].Y == polygon->Points[0].Y)) - is_not_rectangle = 0; - rb->flags.nonstraight = is_not_rectangle; - rb->layer = layer; - rb->came_from = ALL; - if (TEST_FLAG(PCB_FLAG_CLEARPOLY, polygon)) { - rb->flags.clear_poly = 1; - if (!is_not_rectangle) - rb->type = PLANE; - } - return rb; -} - -static void AddText(PointerListType layergroupboxes[], pcb_cardinal_t layergroup, TextTypePtr text, RouteStyleType * style) -{ - AddIrregularObstacle(layergroupboxes, - text->BoundingBox.X1, text->BoundingBox.Y1, - text->BoundingBox.X2, text->BoundingBox.Y2, layergroup, text, style); -} - -static routebox_t *AddArc(PointerListType layergroupboxes[], pcb_cardinal_t layergroup, ArcTypePtr arc, RouteStyleType * style) -{ - return AddIrregularObstacle(layergroupboxes, - arc->BoundingBox.X1, arc->BoundingBox.Y1, - arc->BoundingBox.X2, arc->BoundingBox.Y2, layergroup, arc, style); -} - -struct rb_info { - BoxType query; - routebox_t *winner; - jmp_buf env; -}; - -static r_dir_t __found_one_on_lg(const BoxType * box, void *cl) -{ - struct rb_info *inf = (struct rb_info *) cl; - routebox_t *rb = (routebox_t *) box; - BoxType sb; - - if (rb->flags.nonstraight) - return R_DIR_NOT_FOUND; - sb = shrink_box(&rb->box, rb->style->Clearance); - if (inf->query.X1 >= sb.X2 || inf->query.X2 <= sb.X1 || inf->query.Y1 >= sb.Y2 || inf->query.Y2 <= sb.Y1) - return R_DIR_NOT_FOUND; - inf->winner = rb; - if (rb->type == PLANE) - return R_DIR_FOUND_CONTINUE; /* keep looking for something smaller if a plane was found */ - longjmp(inf->env, 1); - return R_DIR_NOT_FOUND; -} - -static routebox_t *FindRouteBoxOnLayerGroup(routedata_t * rd, Coord X, Coord Y, pcb_cardinal_t layergroup) -{ - struct rb_info info; - info.winner = NULL; - info.query = point_box(X, Y); - if (setjmp(info.env) == 0) - r_search(rd->layergrouptree[layergroup], &info.query, NULL, __found_one_on_lg, &info, NULL); - return info.winner; -} - -#ifdef ROUTE_DEBUG_VERBOSE -static void DumpRouteBox(routebox_t * rb) -{ - pcb_printf("RB: %#mD-%#mD l%d; ", rb->box.X1, rb->box.Y1, rb->box.X2, rb->box.Y2, (int) rb->group); - switch (rb->type) { - case PAD: - printf("PAD[%s %s] ", rb->parent.pad->Name, rb->parent.pad->Number); - break; - case PIN: - printf("PIN[%s %s] ", rb->parent.pin->Name, rb->parent.pin->Number); - break; - case VIA: - if (!rb->parent.via) - break; - printf("VIA[%s %s] ", rb->parent.via->Name, rb->parent.via->Number); - break; - case LINE: - printf("LINE "); - break; - case OTHER: - printf("OTHER "); - break; - case EXPANSION_AREA: - printf("EXPAREA "); - break; - default: - printf("UNKNOWN "); - break; - } - if (rb->flags.nonstraight) - printf("(nonstraight) "); - if (rb->flags.fixed) - printf("(fixed) "); - if (rb->flags.source) - printf("(source) "); - if (rb->flags.target) - printf("(target) "); - if (rb->flags.homeless) - printf("(homeless) "); - printf("\n"); -} -#endif - -static routedata_t *CreateRouteData() -{ - NetListListType Nets; - PointerListType layergroupboxes[MAX_LAYER]; - BoxType bbox; - routedata_t *rd; - int group, i; - - /* check which layers are active first */ - routing_layers = 0; - for (group = 0; group < max_group; group++) { - for (i = 0; i < PCB->LayerGroups.Number[group]; i++) - /* layer must be 1) not silk (ie, < max_copper_layer) and 2) on */ - if ((PCB->LayerGroups.Entries[group][i] < max_copper_layer) && PCB->Data->Layer[PCB->LayerGroups.Entries[group][i]].On) { - routing_layers++; - is_layer_group_active[group] = pcb_true; - break; - } - else - is_layer_group_active[group] = pcb_false; - } - /* if via visibility is turned off, don't use them */ - AutoRouteParameters.use_vias = routing_layers > 1 && PCB->ViaOn; - front = GetLayerGroupNumberByNumber(component_silk_layer); - back = GetLayerGroupNumberByNumber(solder_silk_layer); - /* determine preferred routing direction on each group */ - for (i = 0; i < max_group; i++) { - if (i != back && i != front) { - x_cost[i] = (i & 1) ? 2 : 1; - y_cost[i] = (i & 1) ? 1 : 2; - } - else if (i == back) { - x_cost[i] = 4; - y_cost[i] = 2; - } - else { - x_cost[i] = 2; - y_cost[i] = 2; - } - } - /* create routedata */ - rd = (routedata_t *) malloc(sizeof(*rd)); - memset((void *) rd, 0, sizeof(*rd)); - - rd->max_styles = vtroutestyle_len(&PCB->RouteStyle); -/* rd->layergrouptree = calloc(sizeof(rd->layergrouptree[0]), rd->max_layers);*/ - rd->styles = calloc(sizeof(rd->styles[0]), rd->max_styles); - - /* create default style */ - rd->defaultstyle.Thick = conf_core.design.line_thickness; - rd->defaultstyle.Diameter = conf_core.design.via_thickness; - rd->defaultstyle.Hole = conf_core.design.via_drilling_hole; - rd->defaultstyle.Clearance = conf_core.design.clearance; - rd->max_bloat = BLOAT(&rd->defaultstyle); - rd->max_keep = conf_core.design.clearance; - /* create styles structures */ - bbox.X1 = bbox.Y1 = 0; - bbox.X2 = PCB->MaxWidth; - bbox.Y2 = PCB->MaxHeight; - for (i = 0; i < rd->max_styles + 1; i++) { - RouteStyleType *style = (i < rd->max_styles) ? &PCB->RouteStyle.array[i] : &rd->defaultstyle; - rd->styles[i] = style; - } - - /* initialize pointerlisttype */ - for (i = 0; i < max_group; i++) { - layergroupboxes[i].Ptr = NULL; - layergroupboxes[i].PtrN = 0; - layergroupboxes[i].PtrMax = 0; - GROUP_LOOP(PCB->Data, i); - { - if (linelist_length(&layer->Line) || arclist_length(&layer->Arc)) - usedGroup[i] = pcb_true; - else - usedGroup[i] = pcb_false; - } - END_LOOP; - } - usedGroup[front] = pcb_true; - usedGroup[back] = pcb_true; - /* add the objects in the netlist first. - * then go and add all other objects that weren't already added - * - * this saves on searching the trees to find the nets - */ - /* use the PCB_FLAG_DRC to mark objects as they are entered */ - ResetConnections(pcb_false); - Nets = CollectSubnets(pcb_false); - { - routebox_t *last_net = NULL; - NETLIST_LOOP(&Nets); - { - routebox_t *last_in_net = NULL; - NET_LOOP(netlist); - { - routebox_t *last_in_subnet = NULL; - int j; - - for (j = 0; j < rd->max_styles; j++) - if (net->Style == rd->styles[j]) - break; - CONNECTION_LOOP(net); - { - routebox_t *rb = NULL; - SET_FLAG(PCB_FLAG_DRC, (PinTypePtr) connection->ptr2); - if (connection->type == PCB_TYPE_LINE) { - LineType *line = (LineType *) connection->ptr2; - - /* lines are listed at each end, so skip one */ - /* this should probably by a macro named "BUMP_LOOP" */ - n--; - - /* dice up non-straight lines into many tiny obstacles */ - if (line->Point1.X != line->Point2.X && line->Point1.Y != line->Point2.Y) { - LineType fake_line = *line; - Coord dx = (line->Point2.X - line->Point1.X); - Coord dy = (line->Point2.Y - line->Point1.Y); - int segs = MAX(PCB_ABS(dx), - PCB_ABS(dy)) / (4 * BLOAT(rd->styles[j]) + 1); - int qq; - segs = PCB_CLAMP(segs, 1, 32); /* don't go too crazy */ - dx /= segs; - dy /= segs; - for (qq = 0; qq < segs - 1; qq++) { - fake_line.Point2.X = fake_line.Point1.X + dx; - fake_line.Point2.Y = fake_line.Point1.Y + dy; - if (fake_line.Point2.X == line->Point2.X && fake_line.Point2.Y == line->Point2.Y) - break; - rb = AddLine(layergroupboxes, connection->group, &fake_line, line, rd->styles[j]); - if (last_in_subnet && rb != last_in_subnet) - MergeNets(last_in_subnet, rb, ORIGINAL); - if (last_in_net && rb != last_in_net) - MergeNets(last_in_net, rb, NET); - last_in_subnet = last_in_net = rb; - fake_line.Point1 = fake_line.Point2; - } - fake_line.Point2 = line->Point2; - rb = AddLine(layergroupboxes, connection->group, &fake_line, line, rd->styles[j]); - } - else { - rb = AddLine(layergroupboxes, connection->group, line, line, rd->styles[j]); - } - } - else - switch (connection->type) { - case PCB_TYPE_PAD: - rb = AddPad(layergroupboxes, (ElementType *) connection->ptr1, (PadType *) connection->ptr2, rd->styles[j]); - break; - case PCB_TYPE_PIN: - rb = AddPin(layergroupboxes, (PinType *) connection->ptr2, pcb_false, rd->styles[j]); - break; - case PCB_TYPE_VIA: - rb = AddPin(layergroupboxes, (PinType *) connection->ptr2, pcb_true, rd->styles[j]); - break; - case PCB_TYPE_POLYGON: - rb = - AddPolygon(layergroupboxes, - GetLayerNumber(PCB->Data, (LayerType *) connection->ptr1), - (struct polygon_st *) connection->ptr2, rd->styles[j]); - break; - } - assert(rb); - /* update circular connectivity lists */ - if (last_in_subnet && rb != last_in_subnet) - MergeNets(last_in_subnet, rb, ORIGINAL); - if (last_in_net && rb != last_in_net) - MergeNets(last_in_net, rb, NET); - last_in_subnet = last_in_net = rb; - rd->max_bloat = MAX(rd->max_bloat, BLOAT(rb->style)); - rd->max_keep = MAX(rd->max_keep, rb->style->Clearance); - } - END_LOOP; - } - END_LOOP; - if (last_net && last_in_net) - MergeNets(last_net, last_in_net, DIFFERENT_NET); - last_net = last_in_net; - } - END_LOOP; - rd->first_net = last_net; - } - FreeNetListListMemory(&Nets); - - /* reset all nets to "original" connectivity (which we just set) */ - { - routebox_t *net; - LIST_LOOP(rd->first_net, different_net, net); - ResetSubnet(net); - END_LOOP; - } - - /* add pins and pads of elements */ - ALLPIN_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_DRC, pin)) - CLEAR_FLAG(PCB_FLAG_DRC, pin); - else - AddPin(layergroupboxes, pin, pcb_false, rd->styles[rd->max_styles]); - } - ENDALL_LOOP; - ALLPAD_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_DRC, pad)) - CLEAR_FLAG(PCB_FLAG_DRC, pad); - else - AddPad(layergroupboxes, element, pad, rd->styles[rd->max_styles]); - } - ENDALL_LOOP; - /* add all vias */ - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_DRC, via)) - CLEAR_FLAG(PCB_FLAG_DRC, via); - else - AddPin(layergroupboxes, via, pcb_true, rd->styles[rd->max_styles]); - } - END_LOOP; - - for (i = 0; i < max_copper_layer; i++) { - int layergroup = GetLayerGroupNumberByNumber(i); - /* add all (non-rat) lines */ - LINE_LOOP(LAYER_PTR(i)); - { - if (TEST_FLAG(PCB_FLAG_DRC, line)) { - CLEAR_FLAG(PCB_FLAG_DRC, line); - continue; - } - /* dice up non-straight lines into many tiny obstacles */ - if (line->Point1.X != line->Point2.X && line->Point1.Y != line->Point2.Y) { - LineType fake_line = *line; - Coord dx = (line->Point2.X - line->Point1.X); - Coord dy = (line->Point2.Y - line->Point1.Y); - int segs = MAX(PCB_ABS(dx), PCB_ABS(dy)) / (4 * rd->max_bloat + 1); - int qq; - segs = PCB_CLAMP(segs, 1, 32); /* don't go too crazy */ - dx /= segs; - dy /= segs; - for (qq = 0; qq < segs - 1; qq++) { - fake_line.Point2.X = fake_line.Point1.X + dx; - fake_line.Point2.Y = fake_line.Point1.Y + dy; - if (fake_line.Point2.X == line->Point2.X && fake_line.Point2.Y == line->Point2.Y) - break; - AddLine(layergroupboxes, layergroup, &fake_line, line, rd->styles[rd->max_styles]); - fake_line.Point1 = fake_line.Point2; - } - fake_line.Point2 = line->Point2; - AddLine(layergroupboxes, layergroup, &fake_line, line, rd->styles[rd->max_styles]); - } - else { - AddLine(layergroupboxes, layergroup, line, line, rd->styles[rd->max_styles]); - } - } - END_LOOP; - /* add all polygons */ - POLYGON_LOOP(LAYER_PTR(i)); - { - if (TEST_FLAG(PCB_FLAG_DRC, polygon)) - CLEAR_FLAG(PCB_FLAG_DRC, polygon); - else - AddPolygon(layergroupboxes, i, polygon, rd->styles[rd->max_styles]); - } - END_LOOP; - /* add all copper text */ - TEXT_LOOP(LAYER_PTR(i)); - { - AddText(layergroupboxes, layergroup, text, rd->styles[rd->max_styles]); - } - END_LOOP; - /* add all arcs */ - ARC_LOOP(LAYER_PTR(i)); - { - AddArc(layergroupboxes, layergroup, arc, rd->styles[rd->max_styles]); - } - END_LOOP; - } - - /* create r-trees from pointer lists */ - for (i = 0; i < max_group; i++) { - /* create the r-tree */ - rd->layergrouptree[i] = r_create_tree((const BoxType **) layergroupboxes[i].Ptr, layergroupboxes[i].PtrN, 1); - } - - if (AutoRouteParameters.use_vias) { - rd->mtspace = mtspace_create(); - - /* create "empty-space" structures for via placement (now that we know - * appropriate clearances for all the fixed elements) */ - for (i = 0; i < max_group; i++) { - POINTER_LOOP(&layergroupboxes[i]); - { - routebox_t *rb = (routebox_t *) * ptr; - if (!rb->flags.clear_poly) - mtspace_add(rd->mtspace, &rb->box, FIXED, rb->style->Clearance); - } - END_LOOP; - } - } - /* free pointer lists */ - for (i = 0; i < max_group; i++) - FreePointerListMemory(&layergroupboxes[i]); - /* done! */ - return rd; -} - -void DestroyRouteData(routedata_t ** rd) -{ - int i; - for (i = 0; i < max_group; i++) - r_destroy_tree(&(*rd)->layergrouptree[i]); - if (AutoRouteParameters.use_vias) - mtspace_destroy(&(*rd)->mtspace); -/* free((*rd)->layergrouptree);*/ - free((*rd)->styles); - free(*rd); - *rd = NULL; -} - -/*----------------------------------------------------------------- - * routebox reference counting. - */ - -/* increment the reference count on a routebox. */ -static void RB_up_count(routebox_t * rb) -{ - assert(rb->flags.homeless); - rb->refcount++; -} - -/* decrement the reference count on a routebox, freeing if this box becomes - * unused. */ -static void RB_down_count(routebox_t * rb) -{ - assert(rb->type == EXPANSION_AREA); - assert(rb->flags.homeless); - assert(rb->refcount > 0); - if (--rb->refcount == 0) { - if (rb->parent.expansion_area->flags.homeless) - RB_down_count(rb->parent.expansion_area); - free(rb); - } -} - -/*----------------------------------------------------------------- - * Rectangle-expansion routing code. - */ - -static void ResetSubnet(routebox_t * net) -{ - routebox_t *rb; - /* reset connectivity of everything on this net */ - LIST_LOOP(net, same_net, rb); - rb->same_subnet = rb->original_subnet; - END_LOOP; -} - -static inline cost_t cost_to_point_on_layer(const CheapPointType * p1, const CheapPointType * p2, pcb_cardinal_t point_layer) -{ - cost_t x_dist = p1->X - p2->X, y_dist = p1->Y - p2->Y, r; - x_dist *= x_cost[point_layer]; - y_dist *= y_cost[point_layer]; - /* cost is proportional to orthogonal distance. */ - r = PCB_ABS(x_dist) + PCB_ABS(y_dist); - if (p1->X != p2->X && p1->Y != p2->Y) - r += AutoRouteParameters.JogPenalty; - return r; -} - -static cost_t cost_to_point(const CheapPointType * p1, pcb_cardinal_t point_layer1, const CheapPointType * p2, pcb_cardinal_t point_layer2) -{ - cost_t r = cost_to_point_on_layer(p1, p2, point_layer1); - /* apply via cost penalty if layers differ */ - if (point_layer1 != point_layer2) - r += AutoRouteParameters.ViaCost; - return r; -} - -/* return the minimum *cost* from a point to a box on any layer. - * It's safe to return a smaller than minimum cost - */ -static cost_t cost_to_layerless_box(const CheapPointType * p, pcb_cardinal_t point_layer, const BoxType * b) -{ - CheapPointType p2 = closest_point_in_box(p, b); - register cost_t c1, c2; - - c1 = p2.X - p->X; - c2 = p2.Y - p->Y; - - c1 = PCB_ABS(c1); - c2 = PCB_ABS(c2); - if (c1 < c2) - return c1 * AutoRouteParameters.MinPenalty + c2; - else - return c2 * AutoRouteParameters.MinPenalty + c1; -} - -/* get to actual pins/pad target coordinates */ -pcb_bool TargetPoint(CheapPointType * nextpoint, const routebox_t * target) -{ - if (target->type == PIN) { - nextpoint->X = target->parent.pin->X; - nextpoint->Y = target->parent.pin->Y; - return pcb_true; - } - else if (target->type == PAD) { - if (labs(target->parent.pad->Point1.X - nextpoint->X) < labs(target->parent.pad->Point2.X - nextpoint->X)) - nextpoint->X = target->parent.pad->Point1.X; - else - nextpoint->X = target->parent.pad->Point2.X; - if (labs(target->parent.pad->Point1.Y - nextpoint->Y) < labs(target->parent.pad->Point2.Y - nextpoint->Y)) - nextpoint->Y = target->parent.pad->Point1.Y; - else - nextpoint->Y = target->parent.pad->Point2.Y; - return pcb_true; - } - else { - nextpoint->X = CENTER_X(target->sbox); - nextpoint->Y = CENTER_Y(target->sbox); - } - return pcb_false; -} - -/* return the *minimum cost* from a point to a route box, including possible - * via costs if the route box is on a different layer. - * assume routbox is bloated unless it is an expansion area - */ -static cost_t cost_to_routebox(const CheapPointType * p, pcb_cardinal_t point_layer, const routebox_t * rb) -{ - register cost_t trial = 0; - CheapPointType p2 = closest_point_in_routebox(p, rb); - if (!usedGroup[point_layer] || !usedGroup[rb->group]) - trial = AutoRouteParameters.NewLayerPenalty; - if ((p2.X - p->X) * (p2.Y - p->Y) != 0) - trial += AutoRouteParameters.JogPenalty; - /* special case for defered via searching */ - if (point_layer > max_group || point_layer == rb->group) - return trial + PCB_ABS(p2.X - p->X) + PCB_ABS(p2.Y - p->Y); - /* if this target is only a via away, then the via is cheaper than the congestion */ - if (p->X == p2.X && p->Y == p2.Y) - return trial + 1; - trial += AutoRouteParameters.ViaCost; - trial += PCB_ABS(p2.X - p->X) + PCB_ABS(p2.Y - p->Y); - return trial; -} - - -static BoxType bloat_routebox(routebox_t * rb) -{ - BoxType r; - Coord clearance; - assert(__routebox_is_good(rb)); - - if (rb->flags.nobloat) - return rb->sbox; - - /* Obstacle exclusion zones get bloated by the larger of - * the two required clearances plus half the track width. - */ - clearance = MAX(AutoRouteParameters.style->Clearance, rb->style->Clearance); - r = bloat_box(&rb->sbox, clearance + HALF_THICK(AutoRouteParameters.style->Thick)); - return r; -} - - -#ifdef ROUTE_DEBUG /* only for debugging expansion areas */ - - typedef short pcb_dimension_t; -/* makes a line on the solder layer silk surrounding the box */ -static void showbox(BoxType b, pcb_dimension_t thickness, int group) -{ - LineTypePtr line; - LayerTypePtr SLayer = LAYER_PTR(group); - if (showboxen < -1) - return; - if (showboxen != -1 && showboxen != group) - return; - - if (ddraw != NULL) { - ddraw->set_line_width(ar_gc, thickness); - ddraw->set_line_cap(ar_gc, Trace_Cap); - ddraw->set_color(ar_gc, SLayer->Color); - - ddraw->draw_line(ar_gc, b.X1, b.Y1, b.X2, b.Y1); - ddraw->draw_line(ar_gc, b.X1, b.Y2, b.X2, b.Y2); - ddraw->draw_line(ar_gc, b.X1, b.Y1, b.X1, b.Y2); - ddraw->draw_line(ar_gc, b.X2, b.Y1, b.X2, b.Y2); - } - -#if 1 - if (b.Y1 == b.Y2 || b.X1 == b.X2) - thickness = 5; - line = CreateNewLineOnLayer(LAYER_PTR(component_silk_layer), b.X1, b.Y1, b.X2, b.Y1, thickness, 0, MakeFlags(0)); - AddObjectToCreateUndoList(PCB_TYPE_LINE, LAYER_PTR(component_silk_layer), line, line); - if (b.Y1 != b.Y2) { - line = CreateNewLineOnLayer(LAYER_PTR(component_silk_layer), b.X1, b.Y2, b.X2, b.Y2, thickness, 0, MakeFlags(0)); - AddObjectToCreateUndoList(PCB_TYPE_LINE, LAYER_PTR(component_silk_layer), line, line); - } - line = CreateNewLineOnLayer(LAYER_PTR(component_silk_layer), b.X1, b.Y1, b.X1, b.Y2, thickness, 0, MakeFlags(0)); - AddObjectToCreateUndoList(PCB_TYPE_LINE, LAYER_PTR(component_silk_layer), line, line); - if (b.X1 != b.X2) { - line = CreateNewLineOnLayer(LAYER_PTR(component_silk_layer), b.X2, b.Y1, b.X2, b.Y2, thickness, 0, MakeFlags(0)); - AddObjectToCreateUndoList(PCB_TYPE_LINE, LAYER_PTR(component_silk_layer), line, line); - } -#endif -} -#endif - -#if defined(ROUTE_DEBUG) -static void showedge(edge_t * e) -{ - BoxType *b = (BoxType *) e->rb; - - if (ddraw == NULL) - return; - - ddraw->set_line_cap(ar_gc, Trace_Cap); - ddraw->set_line_width(ar_gc, 1); - ddraw->set_color(ar_gc, Settings.MaskColor); - - switch (e->expand_dir) { - case NORTH: - ddraw->draw_line(ar_gc, b->X1, b->Y1, b->X2, b->Y1); - break; - case SOUTH: - ddraw->draw_line(ar_gc, b->X1, b->Y2, b->X2, b->Y2); - break; - case WEST: - ddraw->draw_line(ar_gc, b->X1, b->Y1, b->X1, b->Y2); - break; - case EAST: - ddraw->draw_line(ar_gc, b->X2, b->Y1, b->X2, b->Y2); - break; - default: - break; - } -} -#endif - -#if defined(ROUTE_DEBUG) -static void showroutebox(routebox_t * rb) -{ - showbox(rb->sbox, rb->flags.source ? 20 : (rb->flags.target ? 10 : 1), rb->flags.is_via ? component_silk_layer : rb->group); -} -#endif - -/* return a "parent" of this edge which immediately precedes it in the route.*/ -static routebox_t *route_parent(routebox_t * rb) -{ - while (rb->flags.homeless && !rb->flags.is_via && !rb->flags.is_thermal) { - assert(rb->type == EXPANSION_AREA); - rb = rb->parent.expansion_area; - assert(rb); - } - return rb; -} - -static vector_t *path_conflicts(routebox_t * rb, routebox_t * conflictor, pcb_bool branch) -{ - if (branch) - rb->conflicts_with = vector_duplicate(rb->conflicts_with); - else if (!rb->conflicts_with) - rb->conflicts_with = vector_create(); - vector_append(rb->conflicts_with, conflictor); - return rb->conflicts_with; -} - -/* Touch everything (except fixed) on each net found - * in the conflicts vector. If the vector is different - * from the last one touched, untouch the last batch - * and touch the new one. Always call with touch=1 - * (except for recursive call). Call with NULL, 1 to - * clear the last batch touched. - * - * touched items become invisible to current path - * so we don't encounter the same conflictor more - * than once - */ - -static void touch_conflicts(vector_t * conflicts, int touch) -{ - static vector_t *last = NULL; - static int last_size = 0; - int i, n; - i = 0; - if (touch) { - if (last && conflicts != last) - touch_conflicts(last, 0); - if (!conflicts) - return; - last = conflicts; - i = last_size; - } - n = vector_size(conflicts); - for (; i < n; i++) { - routebox_t *rb = (routebox_t *) vector_element(conflicts, i); - routebox_t *p; - LIST_LOOP(rb, same_net, p); - if (!p->flags.fixed) - p->flags.touched = touch; - END_LOOP; - } - if (!touch) { - last = NULL; - last_size = 0; - } - else - last_size = n; -} - -/* return a "parent" of this edge which resides in a r-tree somewhere */ -/* -- actually, this "parent" *may* be a via box, which doesn't live in - * a r-tree. -- */ -static routebox_t *nonhomeless_parent(routebox_t * rb) -{ - return route_parent(rb); -} - -/* some routines to find the minimum *cost* from a cost point to - * a target (any target) */ -struct mincost_target_closure { - const CheapPointType *CostPoint; - pcb_cardinal_t CostPointLayer; - routebox_t *nearest; - cost_t nearest_cost; -}; -static r_dir_t __region_within_guess(const BoxType * region, void *cl) -{ - struct mincost_target_closure *mtc = (struct mincost_target_closure *) cl; - cost_t cost_to_region; - if (mtc->nearest == NULL) - return R_DIR_FOUND_CONTINUE; - cost_to_region = cost_to_layerless_box(mtc->CostPoint, mtc->CostPointLayer, region); - assert(cost_to_region >= 0); - /* if no guess yet, all regions are "close enough" */ - /* note that cost is *strictly more* than minimum distance, so we'll - * always search a region large enough. */ - return (cost_to_region < mtc->nearest_cost) ? R_DIR_FOUND_CONTINUE : R_DIR_NOT_FOUND; -} - -static r_dir_t __found_new_guess(const BoxType * box, void *cl) -{ - struct mincost_target_closure *mtc = (struct mincost_target_closure *) cl; - routebox_t *guess = (routebox_t *) box; - cost_t cost_to_guess = cost_to_routebox(mtc->CostPoint, mtc->CostPointLayer, guess); - assert(cost_to_guess >= 0); - /* if this is cheaper than previous guess... */ - if (cost_to_guess < mtc->nearest_cost) { - mtc->nearest = guess; - mtc->nearest_cost = cost_to_guess; /* this is our new guess! */ - return R_DIR_FOUND_CONTINUE; - } - else - return R_DIR_NOT_FOUND; /* not less expensive than our last guess */ -} - -/* target_guess is our guess at what the nearest target is, or NULL if we - * just plum don't have a clue. */ -static routebox_t *mincost_target_to_point(const CheapPointType * CostPoint, - pcb_cardinal_t CostPointLayer, rtree_t * targets, routebox_t * target_guess) -{ - struct mincost_target_closure mtc; - assert(target_guess == NULL || target_guess->flags.target); /* this is a target, right? */ - mtc.CostPoint = CostPoint; - mtc.CostPointLayer = CostPointLayer; - mtc.nearest = target_guess; - if (mtc.nearest) - mtc.nearest_cost = cost_to_routebox(mtc.CostPoint, mtc.CostPointLayer, mtc.nearest); - else - mtc.nearest_cost = EXPENSIVE; - r_search(targets, NULL, __region_within_guess, __found_new_guess, &mtc, NULL); - assert(mtc.nearest != NULL && mtc.nearest_cost >= 0); - assert(mtc.nearest->flags.target); /* this is a target, right? */ - return mtc.nearest; -} - -/* create edge from field values */ -/* mincost_target_guess can be NULL */ -static edge_t *CreateEdge(routebox_t * rb, - Coord CostPointX, Coord CostPointY, - cost_t cost_to_point, routebox_t * mincost_target_guess, direction_t expand_dir, rtree_t * targets) -{ - edge_t *e; - assert(__routebox_is_good(rb)); - e = (edge_t *) malloc(sizeof(*e)); - memset((void *) e, 0, sizeof(*e)); - assert(e); - e->rb = rb; - if (rb->flags.homeless) - RB_up_count(rb); - e->cost_point.X = CostPointX; - e->cost_point.Y = CostPointY; - e->cost_to_point = cost_to_point; - e->flags.via_search = 0; - /* if this edge is created in response to a target, use it */ - if (targets) - e->mincost_target = mincost_target_to_point(&e->cost_point, rb->group, targets, mincost_target_guess); - else - e->mincost_target = mincost_target_guess; - e->expand_dir = expand_dir; - assert(e->rb && e->mincost_target); /* valid edge? */ - assert(!e->flags.is_via || e->expand_dir == ALL); - /* cost point should be on edge (unless this is a plane/via/conflict edge) */ -#if 0 - assert(rb->type == PLANE || rb->conflicts_with != NULL || rb->flags.is_via - || rb->flags.is_thermal - || ((expand_dir == NORTH || expand_dir == SOUTH) ? rb->sbox.X1 <= - CostPointX && CostPointX < rb->sbox.X2 && CostPointY == (expand_dir == NORTH ? rb->sbox.Y1 : rb->sbox.Y2 - 1) : - /* expand_dir==EAST || expand_dir==WEST */ - rb->sbox.Y1 <= CostPointY && CostPointY < rb->sbox.Y2 && - CostPointX == (expand_dir == EAST ? rb->sbox.X2 - 1 : rb->sbox.X1))); -#endif - assert(__edge_is_good(e)); - /* done */ - return e; -} - -/* create edge, using previous edge to fill in defaults. */ -/* most of the work here is in determining a new cost point */ -static edge_t *CreateEdge2(routebox_t * rb, direction_t expand_dir, - edge_t * previous_edge, rtree_t * targets, routebox_t * guess) -{ - BoxType thisbox; - CheapPointType thiscost, prevcost; - cost_t d; - - assert(rb && previous_edge); - /* okay, find cheapest costpoint to costpoint of previous edge */ - thisbox = edge_to_box(rb, expand_dir); - prevcost = previous_edge->cost_point; - /* find point closest to target */ - thiscost = closest_point_in_box(&prevcost, &thisbox); - /* compute cost-to-point */ - d = cost_to_point_on_layer(&prevcost, &thiscost, rb->group); - /* add in jog penalty */ - if (previous_edge->expand_dir != expand_dir) - d += AutoRouteParameters.JogPenalty; - /* okay, new edge! */ - return CreateEdge(rb, thiscost.X, thiscost.Y, - previous_edge->cost_to_point + d, guess ? guess : previous_edge->mincost_target, expand_dir, targets); -} - -/* create via edge, using previous edge to fill in defaults. */ -static edge_t *CreateViaEdge(const BoxType * area, pcb_cardinal_t group, - routebox_t * parent, edge_t * previous_edge, - conflict_t to_site_conflict, conflict_t through_site_conflict, rtree_t * targets) -{ - routebox_t *rb; - CheapPointType costpoint; - cost_t d; - edge_t *ne; - cost_t scale[3]; - - scale[0] = 1; - scale[1] = AutoRouteParameters.LastConflictPenalty; - scale[2] = AutoRouteParameters.ConflictPenalty; - - assert(box_is_good(area)); - assert(AutoRouteParameters.with_conflicts || (to_site_conflict == NO_CONFLICT && through_site_conflict == NO_CONFLICT)); - rb = CreateExpansionArea(area, group, parent, pcb_true, previous_edge); - rb->flags.is_via = 1; - rb->came_from = ALL; -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_VIA_BOXES) - showroutebox(rb); -#endif /* ROUTE_DEBUG && DEBUG_SHOW_VIA_BOXES */ - /* for planes, choose a point near the target */ - if (previous_edge->flags.in_plane) { - routebox_t *target; - CheapPointType pnt; - /* find a target near this via box */ - pnt.X = CENTER_X(*area); - pnt.Y = CENTER_Y(*area); - target = mincost_target_to_point(&pnt, rb->group, targets, previous_edge->mincost_target); - /* now find point near the target */ - pnt.X = CENTER_X(target->box); - pnt.Y = CENTER_Y(target->box); - costpoint = closest_point_in_routebox(&pnt, rb); - /* we moved from the previous cost point through the plane which is free travel */ - d = (scale[through_site_conflict] * cost_to_point(&costpoint, group, &costpoint, previous_edge->rb->group)); - ne = CreateEdge(rb, costpoint.X, costpoint.Y, previous_edge->cost_to_point + d, target, ALL, NULL); - ne->mincost_target = target; - } - else { - routebox_t *target; - target = previous_edge->mincost_target; - costpoint = closest_point_in_routebox(&previous_edge->cost_point, rb); - d = - (scale[to_site_conflict] * - cost_to_point_on_layer(&costpoint, &previous_edge->cost_point, - previous_edge->rb->group)) + - (scale[through_site_conflict] * cost_to_point(&costpoint, group, &costpoint, previous_edge->rb->group)); - /* if the target is just this via away, then this via is cheaper */ - if (target->group == group && point_in_shrunk_box(target, costpoint.X, costpoint.Y)) - d -= AutoRouteParameters.ViaCost / 2; - ne = - CreateEdge(rb, costpoint.X, costpoint.Y, previous_edge->cost_to_point + d, previous_edge->mincost_target, ALL, targets); - } - ne->flags.is_via = 1; - ne->flags.via_conflict_level = to_site_conflict; - assert(__edge_is_good(ne)); - return ne; -} - -/* create "interior" edge for routing with conflicts */ -/* Presently once we "jump inside" the conflicting object - * we consider it a routing highway to travel inside since - * it will become available if the conflict is elliminated. - * That is why we ignore the interior_edge argument. - */ -static edge_t *CreateEdgeWithConflicts(const BoxType * interior_edge, - routebox_t * container, edge_t * previous_edge, - cost_t cost_penalty_to_box, rtree_t * targets) -{ - routebox_t *rb; - CheapPointType costpoint; - cost_t d; - edge_t *ne; - assert(interior_edge && container && previous_edge && targets); - assert(!container->flags.homeless); - assert(AutoRouteParameters.with_conflicts); - assert(container->flags.touched == 0); - assert(previous_edge->rb->group == container->group); - /* use the caller's idea of what this box should be */ - rb = CreateExpansionArea(interior_edge, previous_edge->rb->group, previous_edge->rb, pcb_true, previous_edge); - path_conflicts(rb, container, pcb_true); /* crucial! */ - costpoint = closest_point_in_box(&previous_edge->cost_point, interior_edge); - d = cost_to_point_on_layer(&costpoint, &previous_edge->cost_point, previous_edge->rb->group); - d *= cost_penalty_to_box; - d += previous_edge->cost_to_point; - ne = CreateEdge(rb, costpoint.X, costpoint.Y, d, NULL, ALL, targets); - ne->flags.is_interior = 1; - assert(__edge_is_good(ne)); - return ne; -} - -static void KillEdge(void *edge) -{ - edge_t *e = (edge_t *) edge; - assert(e); - if (e->rb->flags.homeless) - RB_down_count(e->rb); - if (e->flags.via_search) - mtsFreeWork(&e->work); - free(e); -} - -static void DestroyEdge(edge_t ** e) -{ - assert(e && *e); - KillEdge(*e); - *e = NULL; -} - -/* cost function for an edge. */ -static cost_t edge_cost(const edge_t * e, const cost_t too_big) -{ - cost_t penalty = e->cost_to_point; - if (e->rb->flags.is_thermal || e->rb->type == PLANE) - return penalty; /* thermals are cheap */ - if (penalty > too_big) - return penalty; - - /* cost_to_routebox adds in our via correction, too. */ - return penalty + cost_to_routebox(&e->cost_point, e->rb->group, e->mincost_target); -} - -/* given an edge of a box, return a box containing exactly the points on that - * edge. Note that the return box is treated as closed; that is, the bottom and - * right "edges" consist of points (just barely) not in the (half-open) box. */ -static BoxType edge_to_box(const routebox_t * rb, direction_t expand_dir) -{ - BoxType b = shrink_routebox(rb); - /* narrow box down to just the appropriate edge */ - switch (expand_dir) { - case NORTH: - b.Y2 = b.Y1 + 1; - break; - case EAST: - b.X1 = b.X2 - 1; - break; - case SOUTH: - b.Y1 = b.Y2 - 1; - break; - case WEST: - b.X2 = b.X1 + 1; - break; - default: - assert(0); - } - /* done! */ - return b; -} - -struct broken_boxes { - BoxType left, center, right; - pcb_bool is_valid_left, is_valid_center, is_valid_right; -}; - -static struct broken_boxes break_box_edge(const BoxType * original, direction_t which_edge, routebox_t * breaker) -{ - BoxType origbox, breakbox; - struct broken_boxes result; - - assert(original && breaker); - - origbox = *original; - breakbox = bloat_routebox(breaker); - ROTATEBOX_TO_NORTH(origbox, which_edge); - ROTATEBOX_TO_NORTH(breakbox, which_edge); - result.right.Y1 = result.center.Y1 = result.left.Y1 = origbox.Y1; - result.right.Y2 = result.center.Y2 = result.left.Y2 = origbox.Y1 + 1; - /* validity of breaker is not important because the boxes are marked invalid */ - /*assert (breakbox.X1 <= origbox.X2 && breakbox.X2 >= origbox.X1); */ - /* left edge piece */ - result.left.X1 = origbox.X1; - result.left.X2 = breakbox.X1; - /* center (ie blocked) edge piece */ - result.center.X1 = MAX(breakbox.X1, origbox.X1); - result.center.X2 = MIN(breakbox.X2, origbox.X2); - /* right edge piece */ - result.right.X1 = breakbox.X2; - result.right.X2 = origbox.X2; - /* validity: */ - result.is_valid_left = (result.left.X1 < result.left.X2); - result.is_valid_center = (result.center.X1 < result.center.X2); - result.is_valid_right = (result.right.X1 < result.right.X2); - /* rotate back */ - ROTATEBOX_FROM_NORTH(result.left, which_edge); - ROTATEBOX_FROM_NORTH(result.center, which_edge); - ROTATEBOX_FROM_NORTH(result.right, which_edge); - /* done */ - return result; -} - -#ifndef NDEBUG -static int share_edge(const BoxType * child, const BoxType * parent) -{ - return - (child->X1 == parent->X2 || child->X2 == parent->X1 || - child->Y1 == parent->Y2 || child->Y2 == parent->Y1) && - ((parent->X1 <= child->X1 && child->X2 <= parent->X2) || (parent->Y1 <= child->Y1 && child->Y2 <= parent->Y2)); -} - -static int edge_intersect(const BoxType * child, const BoxType * parent) -{ - return (child->X1 <= parent->X2) && (child->X2 >= parent->X1) && (child->Y1 <= parent->Y2) && (child->Y2 >= parent->Y1); -} -#endif - -/* area is the expansion area, on layer group 'group'. 'parent' is the - * immediately preceding expansion area, for backtracing. 'lastarea' is - * the last expansion area created, we string these together in a loop - * so we can remove them all easily at the end. */ -static routebox_t *CreateExpansionArea(const BoxType * area, pcb_cardinal_t group, - routebox_t * parent, pcb_bool relax_edge_requirements, edge_t * src_edge) -{ - routebox_t *rb = (routebox_t *) malloc(sizeof(*rb)); - memset((void *) rb, 0, sizeof(*rb)); - assert(area && parent); - init_const_box(rb, area->X1, area->Y1, area->X2, area->Y2, 0); - rb->group = group; - rb->type = EXPANSION_AREA; - /* should always share edge or overlap with parent */ - assert(relax_edge_requirements ? box_intersect(&rb->sbox, &parent->sbox) - : share_edge(&rb->sbox, &parent->sbox)); - rb->parent.expansion_area = route_parent(parent); - rb->cost_point = closest_point_in_box(&rb->parent.expansion_area->cost_point, area); - rb->cost = - rb->parent.expansion_area->cost + - cost_to_point_on_layer(&rb->parent.expansion_area->cost_point, &rb->cost_point, rb->group); - assert(relax_edge_requirements ? edge_intersect(&rb->sbox, &parent->sbox) - : share_edge(&rb->sbox, &parent->sbox)); - if (rb->parent.expansion_area->flags.homeless) - RB_up_count(rb->parent.expansion_area); - rb->flags.homeless = 1; - rb->flags.nobloat = 1; - rb->style = AutoRouteParameters.style; - rb->conflicts_with = parent->conflicts_with; -/* we will never link an EXPANSION_AREA into the nets because they - * are *ONLY* used for path searching. No need to call InitLists () - */ - rb->came_from = src_edge->expand_dir; -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_EXPANSION_BOXES) - showroutebox(rb); -#endif /* ROUTE_DEBUG && DEBUG_SHOW_EXPANSION_BOXES */ - return rb; -} - -/*------ Expand ------*/ -struct E_result { - routebox_t *parent; - routebox_t *n, *e, *s, *w; - Coord keep, bloat; - BoxType inflated, orig; - int done; -}; - -/* test method for Expand() - * this routebox potentially is a blocker limiting expansion - * if this is so, we limit the inflate box so another exactly - * like it wouldn't be seen. We do this while keep the inflated - * box as large as possible. - */ -static r_dir_t __Expand_this_rect(const BoxType * box, void *cl) -{ - struct E_result *res = (struct E_result *) cl; - routebox_t *rb = (routebox_t *) box; - BoxType rbox; - Coord dn, de, ds, dw, bloat; - - /* we don't see conflicts already encountered */ - if (rb->flags.touched) - return R_DIR_NOT_FOUND; - - /* The inflated box outer edges include its own - * track width plus its own clearance. - * - * To check for intersection, we need to expand - * anything with greater clearance by its excess - * clearance. - * - * If something has nobloat then we need to shrink - * the inflated box back and see if it still touches. - */ - - if (rb->flags.nobloat) { - rbox = rb->sbox; - bloat = res->bloat; - if (rbox.X2 <= res->inflated.X1 + bloat || - rbox.X1 >= res->inflated.X2 - bloat || rbox.Y1 >= res->inflated.Y2 - bloat || rbox.Y2 <= res->inflated.Y1 + bloat) - return R_DIR_NOT_FOUND; /* doesn't touch */ - } - else { - if (rb->style->Clearance > res->keep) - rbox = bloat_box(&rb->sbox, rb->style->Clearance - res->keep); - else - rbox = rb->sbox; - - if (rbox.X2 <= res->inflated.X1 || rbox.X1 >= res->inflated.X2 - || rbox.Y1 >= res->inflated.Y2 || rbox.Y2 <= res->inflated.Y1) - return R_DIR_NOT_FOUND; /* doesn't touch */ - bloat = 0; - } - - /* this is an intersecting box; it has to jump through a few more hoops */ - if (rb == res->parent || rb->parent.expansion_area == res->parent) - return R_DIR_NOT_FOUND; /* don't see what we came from */ - - /* if we are expanding a source edge, don't let other sources - * or their expansions stop us. - */ -#if 1 - if (res->parent->flags.source) - if (rb->flags.source || (rb->type == EXPANSION_AREA && rb->parent.expansion_area->flags.source)) - return R_DIR_NOT_FOUND; -#endif - - /* we ignore via expansion boxes because maybe its - * cheaper to get there without the via through - * the path we're exploring now. - */ - if (rb->flags.is_via && rb->type == EXPANSION_AREA) - return R_DIR_NOT_FOUND; - - if (rb->type == PLANE) { /* expanding inside a plane is not good */ - if (rbox.X1 < res->orig.X1 && rbox.X2 > res->orig.X2 && rbox.Y1 < res->orig.Y1 && rbox.Y2 > res->orig.Y2) { - res->inflated = bloat_box(&res->orig, res->bloat); - return R_DIR_FOUND_CONTINUE; - } - } - /* calculate the distances from original box to this blocker */ - dn = de = ds = dw = 0; - if (!(res->done & _NORTH) && rbox.Y1 <= res->orig.Y1 && rbox.Y2 > res->inflated.Y1) - dn = res->orig.Y1 - rbox.Y2; - if (!(res->done & _EAST) && rbox.X2 >= res->orig.X2 && rbox.X1 < res->inflated.X2) - de = rbox.X1 - res->orig.X2; - if (!(res->done & _SOUTH) && rbox.Y2 >= res->orig.Y2 && rbox.Y1 < res->inflated.Y2) - ds = rbox.Y1 - res->orig.Y2; - if (!(res->done & _WEST) && rbox.X1 <= res->orig.X1 && rbox.X2 > res->inflated.X1) - dw = res->orig.X1 - rbox.X2; - if (dn <= 0 && de <= 0 && ds <= 0 && dw <= 0) - return R_DIR_FOUND_CONTINUE; - /* now shrink the inflated box to the largest blocking direction */ - if (dn >= de && dn >= ds && dn >= dw) { - res->inflated.Y1 = rbox.Y2 - bloat; - res->n = rb; - } - else if (de >= ds && de >= dw) { - res->inflated.X2 = rbox.X1 + bloat; - res->e = rb; - } - else if (ds >= dw) { - res->inflated.Y2 = rbox.Y1 + bloat; - res->s = rb; - } - else { - res->inflated.X1 = rbox.X2 - bloat; - res->w = rb; - } - return R_DIR_FOUND_CONTINUE; -} - -static pcb_bool boink_box(routebox_t * rb, struct E_result *res, direction_t dir) -{ - Coord bloat; - if (rb->style->Clearance > res->keep) - bloat = res->keep - rb->style->Clearance; - else - bloat = 0; - if (rb->flags.nobloat) - bloat = res->bloat; - switch (dir) { - case NORTH: - case SOUTH: - if (rb->sbox.X2 <= res->inflated.X1 + bloat || rb->sbox.X1 >= res->inflated.X2 - bloat) - return pcb_false; - return pcb_true; - case EAST: - case WEST: - if (rb->sbox.Y1 >= res->inflated.Y2 - bloat || rb->sbox.Y2 <= res->inflated.Y1 + bloat) - return pcb_false; - return pcb_true; - break; - default: - assert(0); - } - return pcb_false; -} - -/* main Expand routine. - * - * The expansion probe edge includes the clearance and half thickness - * as the search is performed in order to see everything relevant. - * The result is backed off by this amount before being returned. - * Targets (and other no-bloat routeboxes) go all the way to touching. - * This is accomplished by backing off the probe edge when checking - * for touch against such an object. Usually the expanding edge - * bumps into neighboring pins on the same device that require a - * clearance, preventing seeing a target immediately. Rather than await - * another expansion to actually touch the target, the edge breaker code - * looks past the clearance to see these targets even though they - * weren't actually touched in the expansion. - */ -struct E_result *Expand(rtree_t * rtree, edge_t * e, const BoxType * box) -{ - static struct E_result ans; - int noshrink; /* bit field of which edges to not shrink */ - - ans.bloat = AutoRouteParameters.bloat; - ans.orig = *box; - ans.n = ans.e = ans.s = ans.w = NULL; - - /* the inflated box must be bloated in all directions that it might - * hit something in order to guarantee that we see object in the - * tree it might hit. The tree holds objects bloated by their own - * clearance so we are guaranteed to honor that. - */ - switch (e->expand_dir) { - case ALL: - ans.inflated.X1 = (e->rb->came_from == EAST ? ans.orig.X1 : 0); - ans.inflated.Y1 = (e->rb->came_from == SOUTH ? ans.orig.Y1 : 0); - ans.inflated.X2 = (e->rb->came_from == WEST ? ans.orig.X2 : PCB->MaxWidth); - ans.inflated.Y2 = (e->rb->came_from == NORTH ? ans.orig.Y2 : PCB->MaxHeight); - if (e->rb->came_from == NORTH) - ans.done = noshrink = _SOUTH; - else if (e->rb->came_from == EAST) - ans.done = noshrink = _WEST; - else if (e->rb->came_from == SOUTH) - ans.done = noshrink = _NORTH; - else if (e->rb->came_from == WEST) - ans.done = noshrink = _EAST; - else - ans.done = noshrink = 0; - break; - case NORTH: - ans.done = _SOUTH + _EAST + _WEST; - noshrink = _SOUTH; - ans.inflated.X1 = box->X1 - ans.bloat; - ans.inflated.X2 = box->X2 + ans.bloat; - ans.inflated.Y2 = box->Y2; - ans.inflated.Y1 = 0; /* far north */ - break; - case NE: - ans.done = _SOUTH + _WEST; - noshrink = 0; - ans.inflated.X1 = box->X1 - ans.bloat; - ans.inflated.X2 = PCB->MaxWidth; - ans.inflated.Y2 = box->Y2 + ans.bloat; - ans.inflated.Y1 = 0; - break; - case EAST: - ans.done = _NORTH + _SOUTH + _WEST; - noshrink = _WEST; - ans.inflated.Y1 = box->Y1 - ans.bloat; - ans.inflated.Y2 = box->Y2 + ans.bloat; - ans.inflated.X1 = box->X1; - ans.inflated.X2 = PCB->MaxWidth; - break; - case SE: - ans.done = _NORTH + _WEST; - noshrink = 0; - ans.inflated.X1 = box->X1 - ans.bloat; - ans.inflated.X2 = PCB->MaxWidth; - ans.inflated.Y2 = PCB->MaxHeight; - ans.inflated.Y1 = box->Y1 - ans.bloat; - break; - case SOUTH: - ans.done = _NORTH + _EAST + _WEST; - noshrink = _NORTH; - ans.inflated.X1 = box->X1 - ans.bloat; - ans.inflated.X2 = box->X2 + ans.bloat; - ans.inflated.Y1 = box->Y1; - ans.inflated.Y2 = PCB->MaxHeight; - break; - case SW: - ans.done = _NORTH + _EAST; - noshrink = 0; - ans.inflated.X1 = 0; - ans.inflated.X2 = box->X2 + ans.bloat; - ans.inflated.Y2 = PCB->MaxHeight; - ans.inflated.Y1 = box->Y1 - ans.bloat; - break; - case WEST: - ans.done = _NORTH + _SOUTH + _EAST; - noshrink = _EAST; - ans.inflated.Y1 = box->Y1 - ans.bloat; - ans.inflated.Y2 = box->Y2 + ans.bloat; - ans.inflated.X1 = 0; - ans.inflated.X2 = box->X2; - break; - case NW: - ans.done = _SOUTH + _EAST; - noshrink = 0; - ans.inflated.X1 = 0; - ans.inflated.X2 = box->X2 + ans.bloat; - ans.inflated.Y2 = box->Y2 + ans.bloat; - ans.inflated.Y1 = 0; - break; - default: - noshrink = ans.done = 0; - assert(0); - } - ans.keep = e->rb->style->Clearance; - ans.parent = nonhomeless_parent(e->rb); - r_search(rtree, &ans.inflated, NULL, __Expand_this_rect, &ans, NULL); -/* because the overlaping boxes are found in random order, some blockers - * may have limited edges prematurely, so we check if the blockers realy - * are blocking, and make another try if not - */ - if (ans.n && !boink_box(ans.n, &ans, NORTH)) - ans.inflated.Y1 = 0; - else - ans.done |= _NORTH; - if (ans.e && !boink_box(ans.e, &ans, EAST)) - ans.inflated.X2 = PCB->MaxWidth; - else - ans.done |= _EAST; - if (ans.s && !boink_box(ans.s, &ans, SOUTH)) - ans.inflated.Y2 = PCB->MaxHeight; - else - ans.done |= _SOUTH; - if (ans.w && !boink_box(ans.w, &ans, WEST)) - ans.inflated.X1 = 0; - else - ans.done |= _WEST; - if (ans.done != _NORTH + _EAST + _SOUTH + _WEST) { - r_search(rtree, &ans.inflated, NULL, __Expand_this_rect, &ans, NULL); - } - if ((noshrink & _NORTH) == 0) - ans.inflated.Y1 += ans.bloat; - if ((noshrink & _EAST) == 0) - ans.inflated.X2 -= ans.bloat; - if ((noshrink & _SOUTH) == 0) - ans.inflated.Y2 -= ans.bloat; - if ((noshrink & _WEST) == 0) - ans.inflated.X1 += ans.bloat; - return &ans; -} - -/* blocker_to_heap puts the blockers into a heap so they - * can be retrieved in clockwise order. If a blocker - * is also a target, it gets put into the vector too. - * It returns 1 for any fixed blocker that is not part - * of this net and zero otherwise. - */ -static int blocker_to_heap(heap_t * heap, routebox_t * rb, BoxType * box, direction_t dir) -{ - BoxType b = rb->sbox; - if (rb->style->Clearance > AutoRouteParameters.style->Clearance) - b = bloat_box(&b, rb->style->Clearance - AutoRouteParameters.style->Clearance); - b = clip_box(&b, box); - assert(box_is_good(&b)); - /* we want to look at the blockers clockwise around the box */ - switch (dir) { - /* we need to use the other coordinate fraction to resolve - * ties since we want the shorter of the furthest - * first. - */ - case NORTH: - heap_insert(heap, b.X1 - b.X1 / (b.X2 + 1.0), rb); - break; - case EAST: - heap_insert(heap, b.Y1 - b.Y1 / (b.Y2 + 1.0), rb); - break; - case SOUTH: - heap_insert(heap, -(b.X2 + b.X1 / (b.X2 + 1.0)), rb); - break; - case WEST: - heap_insert(heap, -(b.Y2 + b.Y1 / (b.Y2 + 1.0)), rb); - break; - default: - assert(0); - } - if (rb->flags.fixed && !rb->flags.target && !rb->flags.source) - return 1; - return 0; -} - -/* this creates an EXPANSION_AREA to bridge small gaps or, - * (more commonly) create a supper-thin box to provide a - * home for an expansion edge. - */ -static routebox_t *CreateBridge(const BoxType * area, routebox_t * parent, direction_t dir) -{ - routebox_t *rb = (routebox_t *) malloc(sizeof(*rb)); - memset((void *) rb, 0, sizeof(*rb)); - assert(area && parent); - init_const_box(rb, area->X1, area->Y1, area->X2, area->Y2, 0); - rb->group = parent->group; - rb->type = EXPANSION_AREA; - rb->came_from = dir; - rb->cost_point = closest_point_in_box(&parent->cost_point, area); - rb->cost = parent->cost + cost_to_point_on_layer(&parent->cost_point, &rb->cost_point, rb->group); - rb->parent.expansion_area = route_parent(parent); - if (rb->parent.expansion_area->flags.homeless) - RB_up_count(rb->parent.expansion_area); - rb->flags.homeless = 1; - rb->flags.nobloat = 1; - rb->style = parent->style; - rb->conflicts_with = parent->conflicts_with; -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_EDGES) - showroutebox(rb); -#endif - return rb; -} - -/* moveable_edge prepares the new search edges based on the - * starting box, direction and blocker if any. - */ -void -moveable_edge(vector_t * result, const BoxType * box, direction_t dir, - routebox_t * rb, - routebox_t * blocker, edge_t * e, rtree_t * targets, - struct routeone_state *s, rtree_t * tree, vector_t * area_vec) -{ - BoxType b; - assert(box_is_good(box)); - b = *box; - /* for the cardinal directions, move the box to overlap the - * the parent by 1 unit. Corner expansions overlap more - * and their starting boxes are pre-prepared. - * Check if anything is headed off the board edges - */ - switch (dir) { - default: - break; - case NORTH: - b.Y2 = b.Y1; - b.Y1--; - if (b.Y1 <= AutoRouteParameters.bloat) - return; /* off board edge */ - break; - case EAST: - b.X1 = b.X2; - b.X2++; - if (b.X2 >= PCB->MaxWidth - AutoRouteParameters.bloat) - return; /* off board edge */ - break; - case SOUTH: - b.Y1 = b.Y2; - b.Y2++; - if (b.Y2 >= PCB->MaxHeight - AutoRouteParameters.bloat) - return; /* off board edge */ - break; - case WEST: - b.X2 = b.X1; - b.X1--; - if (b.X1 <= AutoRouteParameters.bloat) - return; /* off board edge */ - break; - case NE: - if (b.Y1 <= AutoRouteParameters.bloat + 1 && b.X2 >= PCB->MaxWidth - AutoRouteParameters.bloat - 1) - return; /* off board edge */ - if (b.Y1 <= AutoRouteParameters.bloat + 1) - dir = EAST; /* north off board edge */ - if (b.X2 >= PCB->MaxWidth - AutoRouteParameters.bloat - 1) - dir = NORTH; /* east off board edge */ - break; - case SE: - if (b.Y2 >= PCB->MaxHeight - AutoRouteParameters.bloat - 1 && b.X2 >= PCB->MaxWidth - AutoRouteParameters.bloat - 1) - return; /* off board edge */ - if (b.Y2 >= PCB->MaxHeight - AutoRouteParameters.bloat - 1) - dir = EAST; /* south off board edge */ - if (b.X2 >= PCB->MaxWidth - AutoRouteParameters.bloat - 1) - dir = SOUTH; /* east off board edge */ - break; - case SW: - if (b.Y2 >= PCB->MaxHeight - AutoRouteParameters.bloat - 1 && b.X1 <= AutoRouteParameters.bloat + 1) - return; /* off board edge */ - if (b.Y2 >= PCB->MaxHeight - AutoRouteParameters.bloat - 1) - dir = WEST; /* south off board edge */ - if (b.X1 <= AutoRouteParameters.bloat + 1) - dir = SOUTH; /* west off board edge */ - break; - case NW: - if (b.Y1 <= AutoRouteParameters.bloat + 1 && b.X1 <= AutoRouteParameters.bloat + 1) - return; /* off board edge */ - if (b.Y1 <= AutoRouteParameters.bloat + 1) - dir = WEST; /* north off board edge */ - if (b.X1 <= AutoRouteParameters.bloat + 1) - dir = NORTH; /* west off board edge */ - break; - } - - if (!blocker) { - edge_t *ne; - routebox_t *nrb = CreateBridge(&b, rb, dir); - /* move the cost point in corner expansions - * these boxes are bigger, so move close to the target - */ - if (dir == NE || dir == SE || dir == SW || dir == NW) { - CheapPointType p; - p = closest_point_in_box(&nrb->cost_point, &e->mincost_target->sbox); - p = closest_point_in_box(&p, &b); - nrb->cost += cost_to_point_on_layer(&p, &nrb->cost_point, nrb->group); - nrb->cost_point = p; - } - ne = CreateEdge(nrb, nrb->cost_point.X, nrb->cost_point.Y, nrb->cost, NULL, dir, targets); - vector_append(result, ne); - } - else if (AutoRouteParameters.with_conflicts && !blocker->flags.target - && !blocker->flags.fixed && !blocker->flags.touched && !blocker->flags.source && blocker->type != EXPANSION_AREA) { - edge_t *ne; - routebox_t *nrb; - /* make a bridge to the edge of the blocker - * in all directions from there - */ - switch (dir) { - case NORTH: - b.Y1 = blocker->sbox.Y2 - 1; - break; - case EAST: - b.X2 = blocker->sbox.X1 + 1; - break; - case SOUTH: - b.Y2 = blocker->sbox.Y1 + 1; - break; - case WEST: - b.X1 = blocker->sbox.X2 - 1; - break; - default: - assert(0); - } - if (!box_is_good(&b)) - return; /* how did this happen ? */ - nrb = CreateBridge(&b, rb, dir); - r_insert_entry(tree, &nrb->box, 1); - vector_append(area_vec, nrb); - nrb->flags.homeless = 0; /* not homeless any more */ - /* mark this one as conflicted */ - path_conflicts(nrb, blocker, pcb_true); - /* and make an expansion edge */ - nrb->cost_point = closest_point_in_box(&nrb->cost_point, &blocker->sbox); - nrb->cost += - cost_to_point_on_layer(&nrb->parent.expansion_area->cost_point, &nrb->cost_point, nrb->group) * CONFLICT_PENALTY(blocker); - - ne = CreateEdge(nrb, nrb->cost_point.X, nrb->cost_point.Y, nrb->cost, NULL, ALL, targets); - ne->flags.is_interior = 1; - vector_append(result, ne); - } -#if 1 - else if (blocker->type == EXPANSION_AREA) { - if (blocker->cost < rb->cost || blocker->cost <= rb->cost + - cost_to_point_on_layer(&blocker->cost_point, &rb->cost_point, rb->group)) - return; - if (blocker->conflicts_with || rb->conflicts_with) - return; - /* does the blocker overlap this routebox ?? */ - /* does this re-parenting operation leave a memory leak? */ - if (blocker->parent.expansion_area->flags.homeless) - RB_down_count(blocker->parent.expansion_area); - blocker->parent.expansion_area = rb; - return; - } -#endif - else if (blocker->flags.target) { - routebox_t *nrb; - edge_t *ne; - b = bloat_box(&b, 1); - if (!box_intersect(&b, &blocker->sbox)) { - /* if the expansion edge stopped before touching, expand the bridge */ - switch (dir) { - case NORTH: - b.Y1 -= AutoRouteParameters.bloat + 1; - break; - case EAST: - b.X2 += AutoRouteParameters.bloat + 1; - break; - case SOUTH: - b.Y2 += AutoRouteParameters.bloat + 1; - break; - case WEST: - b.X1 -= AutoRouteParameters.bloat + 1; - break; - default: - assert(0); - } - } - assert(box_intersect(&b, &blocker->sbox)); - b = shrink_box(&b, 1); - nrb = CreateBridge(&b, rb, dir); - r_insert_entry(tree, &nrb->box, 1); - vector_append(area_vec, nrb); - nrb->flags.homeless = 0; /* not homeless any more */ - ne = CreateEdge(nrb, nrb->cost_point.X, nrb->cost_point.Y, nrb->cost, blocker, dir, NULL); - best_path_candidate(s, ne, blocker); - DestroyEdge(&ne); - } -} - -struct break_info { - heap_t *heap; - routebox_t *parent; - BoxType box; - direction_t dir; - pcb_bool ignore_source; -}; - -static r_dir_t __GatherBlockers(const BoxType * box, void *cl) -{ - routebox_t *rb = (routebox_t *) box; - struct break_info *bi = (struct break_info *) cl; - BoxType b; - - if (bi->parent == rb || rb->flags.touched || bi->parent->parent.expansion_area == rb) - return R_DIR_NOT_FOUND; - if (rb->flags.source && bi->ignore_source) - return R_DIR_NOT_FOUND; - b = rb->sbox; - if (rb->style->Clearance > AutoRouteParameters.style->Clearance) - b = bloat_box(&b, rb->style->Clearance - AutoRouteParameters.style->Clearance); - if (b.X2 <= bi->box.X1 || b.X1 >= bi->box.X2 || b.Y1 >= bi->box.Y2 || b.Y2 <= bi->box.Y1) - return R_DIR_NOT_FOUND; - if (blocker_to_heap(bi->heap, rb, &bi->box, bi->dir)) - return R_DIR_FOUND_CONTINUE; - return R_DIR_NOT_FOUND; -} - -/* shrink the box to the last limit for the previous direction, - * i.e. if dir is SOUTH, then this means fixing up an EAST leftover - * edge, which would be the southern most edge for that example. - */ -static inline BoxType previous_edge(Coord last, direction_t i, const BoxType * b) -{ - BoxType db = *b; - switch (i) { - case EAST: - db.X1 = last; - break; - case SOUTH: - db.Y1 = last; - break; - case WEST: - db.X2 = last; - break; - default: - Message(PCB_MSG_DEFAULT, "previous edge bogus direction!"); - assert(0); - } - return db; -} - -/* Break all the edges of the box that need breaking, handling - * targets as they are found, and putting any moveable edges - * in the return vector. - */ -vector_t *BreakManyEdges(struct routeone_state * s, rtree_t * targets, rtree_t * tree, - vector_t * area_vec, struct E_result * ans, routebox_t * rb, edge_t * e) -{ - struct break_info bi; - vector_t *edges; - heap_t *heap[4]; - Coord first, last; - Coord bloat; - direction_t dir; - routebox_t fake; - - edges = vector_create(); - bi.ignore_source = rb->parent.expansion_area->flags.source; - bi.parent = rb; - /* we add 2 to the bloat. - * 1 will get us to the actual blocker that Expand() hit - * but 1 more is needed because the new expansion edges - * move out by 1 so they don't overlap their parents - * this extra expansion could "trap" the edge if - * there is a blocker 2 units from the original rb, - * it is 1 unit from the new expansion edge which - * would prevent expansion. So we want to break the - * edge on it now to avoid the trap. - */ - - bloat = AutoRouteParameters.bloat + 2; - /* for corner expansion, we need to have a fake blocker - * to prevent expansion back where we came from since - * we still need to break portions of all 4 edges - */ - if (e->expand_dir == NE || e->expand_dir == SE || e->expand_dir == SW || e->expand_dir == NW) { - BoxType *fb = (BoxType *) & fake.sbox; - memset(&fake, 0, sizeof(fake)); - *fb = e->rb->sbox; - fake.flags.fixed = 1; /* this stops expansion there */ - fake.type = LINE; - fake.style = AutoRouteParameters.style; -#ifndef NDEBUG - /* the routbox_is_good checker wants a lot more! */ - fake.flags.inited = 1; - fb = (BoxType *) & fake.box; - *fb = e->rb->sbox; - fake.same_net.next = fake.same_net.prev = &fake; - fake.same_subnet.next = fake.same_subnet.prev = &fake; - fake.original_subnet.next = fake.original_subnet.prev = &fake; - fake.different_net.next = fake.different_net.prev = &fake; -#endif - } - /* gather all of the blockers in heaps so they can be accessed - * in clockwise order, which allows finding corners that can - * be expanded. - */ - for (dir = NORTH; dir <= WEST; dir = directionIncrement(dir)) { - int tmp; - /* don't break the edge we came from */ - if (e->expand_dir != ((dir + 2) % 4)) { - heap[dir] = heap_create(); - bi.box = bloat_box(&rb->sbox, bloat); - bi.heap = heap[dir]; - bi.dir = dir; - /* convert to edge */ - switch (dir) { - case NORTH: - bi.box.Y2 = bi.box.Y1 + bloat + 1; - /* for corner expansion, block the start edges and - * limit the blocker search to only the new edge segment - */ - if (e->expand_dir == SE || e->expand_dir == SW) - blocker_to_heap(heap[dir], &fake, &bi.box, dir); - if (e->expand_dir == SE) - bi.box.X1 = e->rb->sbox.X2; - if (e->expand_dir == SW) - bi.box.X2 = e->rb->sbox.X1; - r_search(tree, &bi.box, NULL, __GatherBlockers, &bi, &tmp); - rb->n = tmp; - break; - case EAST: - bi.box.X1 = bi.box.X2 - bloat - 1; - /* corner, same as above */ - if (e->expand_dir == SW || e->expand_dir == NW) - blocker_to_heap(heap[dir], &fake, &bi.box, dir); - if (e->expand_dir == SW) - bi.box.Y1 = e->rb->sbox.Y2; - if (e->expand_dir == NW) - bi.box.Y2 = e->rb->sbox.Y1; - r_search(tree, &bi.box, NULL, __GatherBlockers, &bi, &tmp); - rb->e = tmp; - break; - case SOUTH: - bi.box.Y1 = bi.box.Y2 - bloat - 1; - /* corner, same as above */ - if (e->expand_dir == NE || e->expand_dir == NW) - blocker_to_heap(heap[dir], &fake, &bi.box, dir); - if (e->expand_dir == NE) - bi.box.X1 = e->rb->sbox.X2; - if (e->expand_dir == NW) - bi.box.X2 = e->rb->sbox.X1; - r_search(tree, &bi.box, NULL, __GatherBlockers, &bi, &tmp); - rb->s = tmp; - break; - case WEST: - bi.box.X2 = bi.box.X1 + bloat + 1; - /* corner, same as above */ - if (e->expand_dir == NE || e->expand_dir == SE) - blocker_to_heap(heap[dir], &fake, &bi.box, dir); - if (e->expand_dir == SE) - bi.box.Y1 = e->rb->sbox.Y2; - if (e->expand_dir == NE) - bi.box.Y2 = e->rb->sbox.Y1; - r_search(tree, &bi.box, NULL, __GatherBlockers, &bi, &tmp); - rb->w = tmp; - break; - default: - assert(0); - } - } - else - heap[dir] = NULL; - } -#if 1 - rb->cost += (rb->n + rb->e + rb->s + rb->w) * AutoRouteParameters.CongestionPenalty / box_area(rb->sbox); -#endif -/* now handle the blockers: - * Go around the expansion area clockwise (North->East->South->West) - * pulling blockers from the heap (which makes them come out in the right - * order). Break the edges on the blocker and make the segments and corners - * moveable as possible. - */ - first = last = -1; - for (dir = NORTH; dir <= WEST; dir = directionIncrement(dir)) { - if (heap[dir] && !heap_is_empty(heap[dir])) { - /* pull the very first one out of the heap outside of the - * heap loop because it is special; it can be part of a corner - */ - routebox_t *blk = (routebox_t *) heap_remove_smallest(heap[dir]); - BoxType b = rb->sbox; - struct broken_boxes broke = break_box_edge(&b, dir, blk); - if (broke.is_valid_left) { - /* if last > 0, then the previous edge had a segment - * joining this one, so it forms a valid corner expansion - */ - if (last > 0) { - /* make a corner expansion */ - BoxType db = b; - switch (dir) { - case EAST: - /* possible NE expansion */ - db.X1 = last; - db.Y2 = MIN(db.Y2, broke.left.Y2); - break; - case SOUTH: - /* possible SE expansion */ - db.Y1 = last; - db.X1 = MAX(db.X1, broke.left.X1); - break; - case WEST: - /* possible SW expansion */ - db.X2 = last; - db.Y1 = MAX(db.Y1, broke.left.Y1); - break; - default: - assert(0); - break; - } - moveable_edge(edges, &db, (direction_t) (dir + 3), rb, NULL, e, targets, s, NULL, NULL); - } - else if (dir == NORTH) { /* north is start, so nothing "before" it */ - /* save for a possible corner once we've - * finished circling the box - */ - first = MAX(b.X1, broke.left.X2); - } - else { - /* this is just a boring straight expansion - * since the orthogonal segment was blocked - */ - moveable_edge(edges, &broke.left, dir, rb, NULL, e, targets, s, NULL, NULL); - } - } /* broke.is_valid_left */ - else if (last > 0) { - /* if the last one didn't become a corner, - * we still want to expand it straight out - * in the direction of the previous edge, - * which it belongs to. - */ - BoxType db = previous_edge(last, dir, &rb->sbox); - moveable_edge(edges, &db, (direction_t) (dir - 1), rb, NULL, e, targets, s, NULL, NULL); - } - if (broke.is_valid_center && !blk->flags.source) - moveable_edge(edges, &broke.center, dir, rb, blk, e, targets, s, tree, area_vec); - /* this is the heap extraction loop. We break out - * if there's nothing left in the heap, but if we * are blocked all the way to the far edge, we can - * just leave stuff in the heap when it is destroyed - */ - while (broke.is_valid_right) { - /* move the box edge to the next potential free point */ - switch (dir) { - case NORTH: - last = b.X1 = MAX(broke.right.X1, b.X1); - break; - case EAST: - last = b.Y1 = MAX(broke.right.Y1, b.Y1); - break; - case SOUTH: - last = b.X2 = MIN(broke.right.X2, b.X2); - break; - case WEST: - last = b.Y2 = MIN(broke.right.Y2, b.Y2); - break; - default: - assert(0); - } - if (heap_is_empty(heap[dir])) - break; - blk = (routebox_t *) heap_remove_smallest(heap[dir]); - broke = break_box_edge(&b, dir, blk); - if (broke.is_valid_left) - moveable_edge(edges, &broke.left, dir, rb, NULL, e, targets, s, NULL, NULL); - if (broke.is_valid_center && !blk->flags.source) - moveable_edge(edges, &broke.center, dir, rb, blk, e, targets, s, tree, area_vec); - } - if (!broke.is_valid_right) - last = -1; - } - else { /* if (heap[dir]) */ - - /* nothing touched this edge! Expand the whole edge unless - * (1) it hit the board edge or (2) was the source of our expansion - * - * for this case (of hitting nothing) we give up trying for corner - * expansions because it is likely that they're not possible anyway - */ - if ((e->expand_dir == ALL ? e->rb->came_from : e->expand_dir) != ((dir + 2) % 4)) { - /* ok, we are not going back on ourselves, and the whole edge seems free */ - moveable_edge(edges, &rb->sbox, dir, rb, NULL, e, targets, s, NULL, NULL); - } - - if (last > 0) { - /* expand the leftover from the prior direction */ - BoxType db = previous_edge(last, dir, &rb->sbox); - moveable_edge(edges, &db, (direction_t) (dir - 1), rb, NULL, e, targets, s, NULL, NULL); - } - last = -1; - } - } /* for loop */ - /* finally, check for the NW corner now that we've come full circle */ - if (first > 0 && last > 0) { - BoxType db = rb->sbox; - db.X2 = first; - db.Y2 = last; - moveable_edge(edges, &db, NW, rb, NULL, e, targets, s, NULL, NULL); - } - else { - if (first > 0) { - BoxType db = rb->sbox; - db.X2 = first; - moveable_edge(edges, &db, NORTH, rb, NULL, e, targets, s, NULL, NULL); - } - else if (last > 0) { - BoxType db = rb->sbox; - db.Y2 = last; - moveable_edge(edges, &db, WEST, rb, NULL, e, targets, s, NULL, NULL); - } - } - /* done with all expansion edges of this box */ - for (dir = NORTH; dir <= WEST; dir = directionIncrement(dir)) { - if (heap[dir]) - heap_destroy(&heap[dir]); - } - return edges; -} - -static routebox_t *rb_source(routebox_t * rb) -{ - while (rb && !rb->flags.source) { - assert(rb->type == EXPANSION_AREA); - rb = rb->parent.expansion_area; - } - assert(rb); - return rb; -} - -/* ------------ */ - -struct foib_info { - const BoxType *box; - routebox_t *intersect; - jmp_buf env; -}; - -static r_dir_t foib_rect_in_reg(const BoxType * box, void *cl) -{ - struct foib_info *foib = (struct foib_info *) cl; - BoxType rbox; - routebox_t *rb = (routebox_t *) box; - if (rb->flags.touched) - return R_DIR_NOT_FOUND; -/* if (rb->type == EXPANSION_AREA && !rb->flags.is_via)*/ - /* return R_DIR_NOT_FOUND; */ - rbox = bloat_routebox(rb); - if (!box_intersect(&rbox, foib->box)) - return R_DIR_NOT_FOUND; - /* this is an intersector! */ - foib->intersect = (routebox_t *) box; - longjmp(foib->env, 1); /* skip to the end! */ - return R_DIR_FOUND_CONTINUE; -} - -static routebox_t *FindOneInBox(rtree_t * rtree, routebox_t * rb) -{ - struct foib_info foib; - BoxType r; - - r = rb->sbox; - foib.box = &r; - foib.intersect = NULL; - - if (setjmp(foib.env) == 0) - r_search(rtree, &r, NULL, foib_rect_in_reg, &foib, NULL); - return foib.intersect; -} - -struct therm_info { - routebox_t *plane; - BoxType query; - jmp_buf env; -}; -static r_dir_t ftherm_rect_in_reg(const BoxType * box, void *cl) -{ - routebox_t *rbox = (routebox_t *) box; - struct therm_info *ti = (struct therm_info *) cl; - BoxType sq, sb; - - if (rbox->type != PIN && rbox->type != VIA && rbox->type != VIA_SHADOW) - return R_DIR_NOT_FOUND; - if (rbox->group != ti->plane->group) - return R_DIR_NOT_FOUND; - - sb = shrink_routebox(rbox); - switch (rbox->type) { - case PIN: - sq = shrink_box(&ti->query, rbox->parent.pin->Thickness); - if (!box_intersect(&sb, &sq)) - return R_DIR_NOT_FOUND; - sb.X1 = rbox->parent.pin->X; - sb.Y1 = rbox->parent.pin->Y; - break; - case VIA: - if (rbox->flags.fixed) { - sq = shrink_box(&ti->query, rbox->parent.via->Thickness); - sb.X1 = rbox->parent.pin->X; - sb.Y1 = rbox->parent.pin->Y; - } - else { - sq = shrink_box(&ti->query, rbox->style->Diameter); - sb.X1 = CENTER_X(sb); - sb.Y1 = CENTER_Y(sb); - } - if (!box_intersect(&sb, &sq)) - return R_DIR_NOT_FOUND; - break; - case VIA_SHADOW: - sq = shrink_box(&ti->query, rbox->style->Diameter); - if (!box_intersect(&sb, &sq)) - return R_DIR_NOT_FOUND; - sb.X1 = CENTER_X(sb); - sb.Y1 = CENTER_Y(sb); - break; - default: - assert(0); - } - ti->plane = rbox; - longjmp(ti->env, 1); - return R_DIR_FOUND_CONTINUE; -} - -/* check for a pin or via target that a polygon can just use a thermal to connect to */ -routebox_t *FindThermable(rtree_t * rtree, routebox_t * rb) -{ - struct therm_info info; - - info.plane = rb; - info.query = shrink_routebox(rb); - - if (setjmp(info.env) == 0) { - r_search(rtree, &info.query, NULL, ftherm_rect_in_reg, &info, NULL); - return NULL; - } - return info.plane; -} - -/*-------------------------------------------------------------------- - * Route-tracing code: once we've got a path of expansion boxes, trace - * a line through them to actually create the connection. - */ -static void RD_DrawThermal(routedata_t * rd, Coord X, Coord Y, pcb_cardinal_t group, pcb_cardinal_t layer, routebox_t * subnet, pcb_bool is_bad) -{ - routebox_t *rb; - rb = (routebox_t *) malloc(sizeof(*rb)); - memset((void *) rb, 0, sizeof(*rb)); - init_const_box(rb, X, Y, X + 1, Y + 1, 0); - rb->group = group; - rb->layer = layer; - rb->flags.fixed = 0; - rb->flags.is_bad = is_bad; - rb->flags.is_odd = AutoRouteParameters.is_odd; - rb->flags.circular = 0; - rb->style = AutoRouteParameters.style; - rb->type = THERMAL; - InitLists(rb); - MergeNets(rb, subnet, NET); - MergeNets(rb, subnet, SUBNET); - /* add it to the r-tree, this may be the whole route! */ - r_insert_entry(rd->layergrouptree[rb->group], &rb->box, 1); - rb->flags.homeless = 0; -} - -static void RD_DrawVia(routedata_t * rd, Coord X, Coord Y, Coord radius, routebox_t * subnet, pcb_bool is_bad) -{ - routebox_t *rb, *first_via = NULL; - int i; - int ka = AutoRouteParameters.style->Clearance; - PinType *live_via = NULL; - - if (conf_core.editor.live_routing) { - live_via = CreateNewVia(PCB->Data, X, Y, radius * 2, - 2 * AutoRouteParameters.style->Clearance, 0, AutoRouteParameters.style->Hole, NULL, MakeFlags(0)); - if (live_via != NULL) - DrawVia(live_via); - } - - /* a via cuts through every layer group */ - for (i = 0; i < max_group; i++) { - if (!is_layer_group_active[i]) - continue; - rb = (routebox_t *) malloc(sizeof(*rb)); - memset((void *) rb, 0, sizeof(*rb)); - init_const_box(rb, - /*X1 */ X - radius, /*Y1 */ Y - radius, - /*X2 */ X + radius + 1, /*Y2 */ Y + radius + 1, ka); - rb->group = i; - rb->flags.fixed = 0; /* indicates that not on PCB yet */ - rb->flags.is_odd = AutoRouteParameters.is_odd; - rb->flags.is_bad = is_bad; - rb->came_from = ALL; - rb->flags.circular = pcb_true; - rb->style = AutoRouteParameters.style; - rb->pass = AutoRouteParameters.pass; - if (first_via == NULL) { - rb->type = VIA; - rb->parent.via = NULL; /* indicates that not on PCB yet */ - first_via = rb; - /* only add the first via to mtspace, not the shadows too */ - mtspace_add(rd->mtspace, &rb->box, rb->flags.is_odd ? ODD : EVEN, rb->style->Clearance); - } - else { - rb->type = VIA_SHADOW; - rb->parent.via_shadow = first_via; - } - InitLists(rb); - /* add these to proper subnet. */ - MergeNets(rb, subnet, NET); - MergeNets(rb, subnet, SUBNET); - assert(__routebox_is_good(rb)); - /* and add it to the r-tree! */ - r_insert_entry(rd->layergrouptree[rb->group], &rb->box, 1); - rb->flags.homeless = 0; /* not homeless anymore */ - rb->livedraw_obj.via = live_via; - } -} - -static void -RD_DrawLine(routedata_t * rd, - Coord X1, Coord Y1, Coord X2, - Coord Y2, Coord halfthick, pcb_cardinal_t group, routebox_t * subnet, pcb_bool is_bad, pcb_bool is_45) -{ - /* we hold the line in a queue to concatenate segments that - * ajoin one another. That reduces the number of things in - * the trees and allows conflict boxes to be larger, both of - * which are really useful. - */ - static Coord qX1 = -1, qY1, qX2, qY2; - static Coord qhthick; - static pcb_cardinal_t qgroup; - static pcb_bool qis_45, qis_bad; - static routebox_t *qsn; - - routebox_t *rb; - Coord ka = AutoRouteParameters.style->Clearance; - - /* don't draw zero-length segments. */ - if (X1 == X2 && Y1 == Y2) - return; - if (qX1 == -1) { /* first ever */ - qX1 = X1; - qY1 = Y1; - qX2 = X2; - qY2 = Y2; - qhthick = halfthick; - qgroup = group; - qis_45 = is_45; - qis_bad = is_bad; - qsn = subnet; - return; - } - /* Check if the lines concatenat. We only check the - * normal expected nextpoint=lastpoint condition - */ - if (X1 == qX2 && Y1 == qY2 && qhthick == halfthick && qgroup == group) { - if (qX1 == qX2 && X1 == X2) { /* everybody on the same X here */ - qY2 = Y2; - return; - } - if (qY1 == qY2 && Y1 == Y2) { /* same Y all around */ - qX2 = X2; - return; - } - } - /* dump the queue, no match here */ - if (qX1 == -1) - return; /* but not this! */ - rb = (routebox_t *) malloc(sizeof(*rb)); - memset((void *) rb, 0, sizeof(*rb)); - assert(is_45 ? (PCB_ABS(qX2 - qX1) == PCB_ABS(qY2 - qY1)) /* line must be 45-degrees */ - : (qX1 == qX2 || qY1 == qY2) /* line must be ortho */ ); - init_const_box(rb, - /*X1 */ MIN(qX1, qX2) - qhthick, - /*Y1 */ MIN(qY1, qY2) - qhthick, - /*X2 */ MAX(qX1, qX2) + qhthick + 1, - /*Y2 */ MAX(qY1, qY2) + qhthick + 1, ka); - rb->group = qgroup; - rb->type = LINE; - rb->parent.line = NULL; /* indicates that not on PCB yet */ - rb->flags.fixed = 0; /* indicates that not on PCB yet */ - rb->flags.is_odd = AutoRouteParameters.is_odd; - rb->flags.is_bad = qis_bad; - rb->came_from = ALL; - rb->flags.homeless = 0; /* we're putting this in the tree */ - rb->flags.nonstraight = qis_45; - rb->flags.bl_to_ur = ((qX2 >= qX1 && qY2 <= qY1) - || (qX2 <= qX1 && qY2 >= qY1)); - rb->style = AutoRouteParameters.style; - rb->pass = AutoRouteParameters.pass; - InitLists(rb); - /* add these to proper subnet. */ - MergeNets(rb, qsn, NET); - MergeNets(rb, qsn, SUBNET); - assert(__routebox_is_good(rb)); - /* and add it to the r-tree! */ - r_insert_entry(rd->layergrouptree[rb->group], &rb->box, 1); - - if (conf_core.editor.live_routing) { - LayerType *layer = LAYER_PTR(PCB->LayerGroups.Entries[rb->group][0]); - LineType *line = CreateNewLineOnLayer(layer, qX1, qY1, qX2, qY2, - 2 * qhthick, 0, MakeFlags(0)); - rb->livedraw_obj.line = line; - if (line != NULL) - DrawLine(layer, line); - } - - /* and to the via space structures */ - if (AutoRouteParameters.use_vias) - mtspace_add(rd->mtspace, &rb->box, rb->flags.is_odd ? ODD : EVEN, rb->style->Clearance); - usedGroup[rb->group] = pcb_true; - /* and queue this one */ - qX1 = X1; - qY1 = Y1; - qX2 = X2; - qY2 = Y2; - qhthick = halfthick; - qgroup = group; - qis_45 = is_45; - qis_bad = is_bad; - qsn = subnet; -} - -static pcb_bool -RD_DrawManhattanLine(routedata_t * rd, - const BoxType * box1, const BoxType * box2, - CheapPointType start, CheapPointType end, - Coord halfthick, pcb_cardinal_t group, routebox_t * subnet, pcb_bool is_bad, pcb_bool last_was_x) -{ - CheapPointType knee = start; - if (end.X == start.X) { - RD_DrawLine(rd, start.X, start.Y, end.X, end.Y, halfthick, group, subnet, is_bad, pcb_false); - return pcb_false; - } - else if (end.Y == start.Y) { - RD_DrawLine(rd, start.X, start.Y, end.X, end.Y, halfthick, group, subnet, is_bad, pcb_false); - return pcb_true; - } - /* find where knee belongs */ - if (point_in_box(box1, end.X, start.Y) - || point_in_box(box2, end.X, start.Y)) { - knee.X = end.X; - knee.Y = start.Y; - } - else { - knee.X = start.X; - knee.Y = end.Y; - } - if ((knee.X == end.X && !last_was_x) && (point_in_box(box1, start.X, end.Y) - || point_in_box(box2, start.X, end.Y))) { - knee.X = start.X; - knee.Y = end.Y; - } - assert(AutoRouteParameters.is_smoothing || point_in_closed_box(box1, knee.X, knee.Y) - || point_in_closed_box(box2, knee.X, knee.Y)); - - if (1 || !AutoRouteParameters.is_smoothing) { - /* draw standard manhattan paths */ - RD_DrawLine(rd, start.X, start.Y, knee.X, knee.Y, halfthick, group, subnet, is_bad, pcb_false); - RD_DrawLine(rd, knee.X, knee.Y, end.X, end.Y, halfthick, group, subnet, is_bad, pcb_false); - } - else { - /* draw 45-degree path across knee */ - Coord len45 = MIN(PCB_ABS(start.X - end.X), PCB_ABS(start.Y - end.Y)); - CheapPointType kneestart = knee, kneeend = knee; - if (kneestart.X == start.X) - kneestart.Y += (kneestart.Y > start.Y) ? -len45 : len45; - else - kneestart.X += (kneestart.X > start.X) ? -len45 : len45; - if (kneeend.X == end.X) - kneeend.Y += (kneeend.Y > end.Y) ? -len45 : len45; - else - kneeend.X += (kneeend.X > end.X) ? -len45 : len45; - RD_DrawLine(rd, start.X, start.Y, kneestart.X, kneestart.Y, halfthick, group, subnet, is_bad, pcb_false); - RD_DrawLine(rd, kneestart.X, kneestart.Y, kneeend.X, kneeend.Y, halfthick, group, subnet, is_bad, pcb_true); - RD_DrawLine(rd, kneeend.X, kneeend.Y, end.X, end.Y, halfthick, group, subnet, is_bad, pcb_false); - } - return (knee.X != end.X); -} - -/* for smoothing, don't pack traces to min clearance gratuitously */ -#if 0 -static void add_clearance(CheapPointType * nextpoint, const BoxType * b) -{ - if (nextpoint->X == b->X1) { - if (nextpoint->X + AutoRouteParameters.style->Clearance < (b->X1 + b->X2) / 2) - nextpoint->X += AutoRouteParameters.style->Clearance; - else - nextpoint->X = (b->X1 + b->X2) / 2; - } - else if (nextpoint->X == b->X2) { - if (nextpoint->X - AutoRouteParameters.style->Clearance > (b->X1 + b->X2) / 2) - nextpoint->X -= AutoRouteParameters.style->Clearance; - else - nextpoint->X = (b->X1 + b->X2) / 2; - } - else if (nextpoint->Y == b->Y1) { - if (nextpoint->Y + AutoRouteParameters.style->Clearance < (b->Y1 + b->Y2) / 2) - nextpoint->Y += AutoRouteParameters.style->Clearance; - else - nextpoint->Y = (b->Y1 + b->Y2) / 2; - } - else if (nextpoint->Y == b->Y2) { - if (nextpoint->Y - AutoRouteParameters.style->Clearance > (b->Y1 + b->Y2) / 2) - nextpoint->Y -= AutoRouteParameters.style->Clearance; - else - nextpoint->Y = (b->Y1 + b->Y2) / 2; - } -} -#endif - -/* This back-traces the expansion boxes along the best path - * it draws the lines that will make the actual path. - * during refinement passes, it should try to maximize the area - * for other tracks so routing completion is easier. - * - * during smoothing passes, it should try to make a better path, - * possibly using diagonals, etc. The path boxes are larger on - * average now so there is more possiblity to decide on a nice - * path. Any combination of lines and arcs is possible, so long - * as they don't poke more than half thick outside the path box. - */ - -static void TracePath(routedata_t * rd, routebox_t * path, const routebox_t * target, routebox_t * subnet, pcb_bool is_bad) -{ - pcb_bool last_x = pcb_false; - Coord halfwidth = HALF_THICK(AutoRouteParameters.style->Thick); - Coord radius = HALF_THICK(AutoRouteParameters.style->Diameter); - CheapPointType lastpoint, nextpoint; - routebox_t *lastpath; - BoxType b; - - assert(subnet->style == AutoRouteParameters.style); - /*XXX: because we round up odd thicknesses, there's the possibility that - * a connecting line end-point might be 0.005 mil off the "real" edge. - * don't worry about this because line *thicknesses* are always >= 0.01 mil. */ - - /* if we start with a thermal the target was a plane - * or the target was a pin and the source a plane - * in which case this thermal is the whole path - */ - if (path->flags.is_thermal) { - /* the target was a plane, so we need to find a good spot for the via - * now. It's logical to place it close to the source box which - * is where we're utlimately headed on this path. However, it - * must reside in the plane as well as the via area too. - */ - nextpoint.X = CENTER_X(path->sbox); - nextpoint.Y = CENTER_Y(path->sbox); - if (path->parent.expansion_area->flags.is_via) { - TargetPoint(&nextpoint, rb_source(path)); - /* nextpoint is the middle of the source terminal now */ - b = clip_box(&path->sbox, &path->parent.expansion_area->sbox); - nextpoint = closest_point_in_box(&nextpoint, &b); - /* now it's in the via and plane near the source */ - } - else { /* no via coming, target must have been a pin */ - - assert(target->type == PIN); - TargetPoint(&nextpoint, target); - } - assert(point_in_box(&path->sbox, nextpoint.X, nextpoint.Y)); - RD_DrawThermal(rd, nextpoint.X, nextpoint.Y, path->group, path->layer, subnet, is_bad); - } - else { - /* start from best place of target box */ - lastpoint.X = CENTER_X(target->sbox); - lastpoint.Y = CENTER_Y(target->sbox); - TargetPoint(&lastpoint, target); - if (AutoRouteParameters.last_smooth && box_in_box(&path->sbox, &target->sbox)) - path = path->parent.expansion_area; - b = path->sbox; - if (path->flags.circular) - b = shrink_box(&b, MIN(b.X2 - b.X1, b.Y2 - b.Y1) / 5); - nextpoint = closest_point_in_box(&lastpoint, &b); - if (AutoRouteParameters.last_smooth) - RD_DrawLine(rd, lastpoint.X, lastpoint.Y, nextpoint.X, nextpoint.Y, halfwidth, path->group, subnet, is_bad, TRUE); - else - last_x = RD_DrawManhattanLine(rd, &target->sbox, &path->sbox, - lastpoint, nextpoint, halfwidth, path->group, subnet, is_bad, last_x); - } -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_ROUTE_BOXES) - showroutebox(path); -#if defined(ROUTE_VERBOSE) - pcb_printf("TRACEPOINT start %#mD\n", nextpoint.X, nextpoint.Y); -#endif -#endif - - do { - lastpoint = nextpoint; - lastpath = path; - assert(path->type == EXPANSION_AREA); - path = path->parent.expansion_area; - b = path->sbox; - if (path->flags.circular) - b = shrink_box(&b, MIN(b.X2 - b.X1, b.Y2 - b.Y1) / 5); - assert(b.X1 != b.X2 && b.Y1 != b.Y2); /* need someplace to put line! */ - /* find point on path perimeter closest to last point */ - /* if source terminal, try to hit a good place */ - nextpoint = closest_point_in_box(&lastpoint, &b); -#if 0 - /* leave more clearance if this is a smoothing pass */ - if (AutoRouteParameters.is_smoothing && (nextpoint.X != lastpoint.X || nextpoint.Y != lastpoint.Y)) - add_clearance(&nextpoint, &b); -#endif - if (path->flags.source && path->type != PLANE) - TargetPoint(&nextpoint, path); - assert(point_in_box(&lastpath->box, lastpoint.X, lastpoint.Y)); - assert(point_in_box(&path->box, nextpoint.X, nextpoint.Y)); -#if defined(ROUTE_DEBUG_VERBOSE) - printf("TRACEPATH: "); - DumpRouteBox(path); - pcb_printf("TRACEPATH: point %#mD to point %#mD layer %d\n", - lastpoint.X, lastpoint.Y, nextpoint.X, nextpoint.Y, path->group); -#endif - - /* draw orthogonal lines from lastpoint to nextpoint */ - /* knee is placed in lastpath box */ - /* should never cause line to leave union of lastpath/path boxes */ - if (AutoRouteParameters.last_smooth) - RD_DrawLine(rd, lastpoint.X, lastpoint.Y, nextpoint.X, nextpoint.Y, halfwidth, path->group, subnet, is_bad, TRUE); - else - last_x = RD_DrawManhattanLine(rd, &lastpath->sbox, &path->sbox, - lastpoint, nextpoint, halfwidth, path->group, subnet, is_bad, last_x); - if (path->flags.is_via) { /* if via, then add via */ -#ifdef ROUTE_VERBOSE - printf(" (vias)"); -#endif - assert(point_in_box(&path->box, nextpoint.X, nextpoint.Y)); - RD_DrawVia(rd, nextpoint.X, nextpoint.Y, radius, subnet, is_bad); - } - - assert(lastpath->flags.is_via || path->group == lastpath->group); - -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_ROUTE_BOXES) - showroutebox(path); -#endif /* ROUTE_DEBUG && DEBUG_SHOW_ROUTE_BOXES */ - /* if this is connected to a plane, draw the thermal */ - if (path->flags.is_thermal || path->type == PLANE) - RD_DrawThermal(rd, lastpoint.X, lastpoint.Y, path->group, path->layer, subnet, is_bad); - /* when one hop from the source, make an extra path in *this* box */ - if (path->type == EXPANSION_AREA && path->parent.expansion_area->flags.source && path->parent.expansion_area->type != PLANE) { - /* find special point on source (if it exists) */ - if (TargetPoint(&lastpoint, path->parent.expansion_area)) { - lastpoint = closest_point_in_routebox(&lastpoint, path); - b = shrink_routebox(path); -#if 0 - if (AutoRouteParameters.is_smoothing) - add_clearance(&lastpoint, &b); -#else - if (AutoRouteParameters.last_smooth) - RD_DrawLine(rd, lastpoint.X, lastpoint.Y, nextpoint.X, nextpoint.Y, halfwidth, path->group, subnet, is_bad, TRUE); - else -#endif - last_x = RD_DrawManhattanLine(rd, &b, &b, nextpoint, lastpoint, halfwidth, path->group, subnet, is_bad, last_x); -#if defined(ROUTE_DEBUG_VERBOSE) - printf("TRACEPATH: "); - DumpRouteBox(path); - pcb_printf - ("TRACEPATH: (to source) point %#mD to point %#mD layer %d\n", - nextpoint.X, nextpoint.Y, lastpoint.X, lastpoint.Y, path->group); -#endif - - nextpoint = lastpoint; - } - } - } - while (!path->flags.source); - /* flush the line queue */ - RD_DrawLine(rd, -1, 0, 0, 0, 0, 0, NULL, pcb_false, pcb_false); - - if (conf_core.editor.live_routing) - Draw(); - -#ifdef ROUTE_DEBUG - if (ddraw != NULL) - ddraw->flush_debug_draw(); -#endif -} - -/* create a fake "edge" used to defer via site searching. */ -static void -CreateSearchEdge(struct routeone_state *s, vetting_t * work, edge_t * parent, - routebox_t * rb, conflict_t conflict, rtree_t * targets, pcb_bool in_plane) -{ - routebox_t *target; - BoxType b; - cost_t cost; - assert(__routebox_is_good(rb)); - /* find the cheapest target */ -#if 0 - target = mincost_target_to_point(&parent->cost_point, max_group + 1, targets, parent->mincost_target); -#else - target = parent->mincost_target; -#endif - b = shrink_routebox(target); - cost = parent->cost_to_point + AutoRouteParameters.ViaCost + cost_to_layerless_box(&rb->cost_point, 0, &b); - if (cost < s->best_cost) { - edge_t *ne; - ne = (edge_t *) malloc(sizeof(*ne)); - memset((void *) ne, 0, sizeof(*ne)); - assert(ne); - ne->flags.via_search = 1; - ne->flags.in_plane = in_plane; - ne->rb = rb; - if (rb->flags.homeless) - RB_up_count(rb); - ne->work = work; - ne->mincost_target = target; - ne->flags.via_conflict_level = conflict; - ne->cost_to_point = parent->cost_to_point; - ne->cost_point = parent->cost_point; - ne->cost = cost; - heap_insert(s->workheap, ne->cost, ne); - } - else { - mtsFreeWork(&work); - } -} - -static void add_or_destroy_edge(struct routeone_state *s, edge_t * e) -{ - e->cost = edge_cost(e, s->best_cost); - assert(__edge_is_good(e)); - assert(is_layer_group_active[e->rb->group]); - if (e->cost < s->best_cost) - heap_insert(s->workheap, e->cost, e); - else - DestroyEdge(&e); -} - -static void best_path_candidate(struct routeone_state *s, edge_t * e, routebox_t * best_target) -{ - e->cost = edge_cost(e, EXPENSIVE); - if (s->best_path == NULL || e->cost < s->best_cost) { -#if defined(ROUTE_DEBUG) && defined (ROUTE_VERBOSE) - printf("New best path seen! cost = %f\n", e->cost); -#endif - /* new best path! */ - if (s->best_path && s->best_path->flags.homeless) - RB_down_count(s->best_path); - s->best_path = e->rb; - s->best_target = best_target; - s->best_cost = e->cost; - assert(s->best_cost >= 0); - /* don't free this when we destroy edge! */ - if (s->best_path->flags.homeless) - RB_up_count(s->best_path); - } -} - - -/* vectors for via site candidates (see mtspace.h) */ -struct routeone_via_site_state { - vector_t *free_space_vec; - vector_t *lo_conflict_space_vec; - vector_t *hi_conflict_space_vec; -}; - -void -add_via_sites(struct routeone_state *s, - struct routeone_via_site_state *vss, - mtspace_t * mtspace, routebox_t * within, - conflict_t within_conflict_level, edge_t * parent_edge, rtree_t * targets, Coord shrink, pcb_bool in_plane) -{ - Coord radius, clearance; - vetting_t *work; - BoxType region = shrink_routebox(within); - shrink_box(®ion, shrink); - - radius = HALF_THICK(AutoRouteParameters.style->Diameter); - clearance = AutoRouteParameters.style->Clearance; - assert(AutoRouteParameters.use_vias); - /* XXX: need to clip 'within' to shrunk_pcb_bounds, because when - XXX: routing with conflicts may poke over edge. */ - - /* ask for a via box near our cost_point first */ - work = mtspace_query_rect(mtspace, ®ion, radius, clearance, - NULL, vss->free_space_vec, - vss->lo_conflict_space_vec, - vss->hi_conflict_space_vec, - AutoRouteParameters.is_odd, AutoRouteParameters.with_conflicts, &parent_edge->cost_point); - if (!work) - return; - CreateSearchEdge(s, work, parent_edge, within, within_conflict_level, targets, in_plane); -} - -void -do_via_search(edge_t * search, struct routeone_state *s, - struct routeone_via_site_state *vss, mtspace_t * mtspace, rtree_t * targets) -{ - int i, j, count = 0; - Coord radius, clearance; - vetting_t *work; - routebox_t *within; - conflict_t within_conflict_level; - - radius = HALF_THICK(AutoRouteParameters.style->Diameter); - clearance = AutoRouteParameters.style->Clearance; - work = mtspace_query_rect(mtspace, NULL, 0, 0, - search->work, vss->free_space_vec, - vss->lo_conflict_space_vec, - vss->hi_conflict_space_vec, AutoRouteParameters.is_odd, AutoRouteParameters.with_conflicts, NULL); - within = search->rb; - within_conflict_level = search->flags.via_conflict_level; - for (i = 0; i < 3; i++) { - vector_t *v = - (i == NO_CONFLICT ? vss->free_space_vec : - i == LO_CONFLICT ? vss->lo_conflict_space_vec : i == HI_CONFLICT ? vss->hi_conflict_space_vec : NULL); - assert(v); - while (!vector_is_empty(v)) { - BoxType cliparea; - BoxType *area = (BoxType *) vector_remove_last(v); - if (!(i == NO_CONFLICT || AutoRouteParameters.with_conflicts)) { - free(area); - continue; - } - /* answers are bloated by radius + clearance */ - cliparea = shrink_box(area, radius + clearance); - close_box(&cliparea); - free(area); - assert(box_is_good(&cliparea)); - count++; - for (j = 0; j < max_group; j++) { - edge_t *ne; - if (j == within->group || !is_layer_group_active[j]) - continue; - ne = CreateViaEdge(&cliparea, j, within, search, within_conflict_level, (conflict_t) i, targets); - add_or_destroy_edge(s, ne); - } - } - } - /* prevent freeing of work when this edge is destroyed */ - search->flags.via_search = 0; - if (!work) - return; - CreateSearchEdge(s, work, search, within, within_conflict_level, targets, search->flags.in_plane); - assert(vector_is_empty(vss->free_space_vec)); - assert(vector_is_empty(vss->lo_conflict_space_vec)); - assert(vector_is_empty(vss->hi_conflict_space_vec)); -} - -/* vector of expansion areas to be eventually removed from r-tree - * this is a global for troubleshooting - */ -vector_t *area_vec; - -/* some routines for use in gdb while debugging */ -#if defined(ROUTE_DEBUG) -static void list_conflicts(routebox_t * rb) -{ - int i, n; - if (!rb->conflicts_with) - return; - n = vector_size(rb->conflicts_with); - for (i = 0; i < n; i++) - printf("%p, ", (void *)vector_element(rb->conflicts_with, i)); -} - -static void show_area_vec(int lay) -{ - int n, save; - - if (!area_vec) - return; - save = showboxen; - showboxen = lay; - for (n = 0; n < vector_size(area_vec); n++) { - routebox_t *rb = (routebox_t *) vector_element(area_vec, n); - showroutebox(rb); - } - showboxen = save; -} - -static pcb_bool net_id(routebox_t * rb, long int id) -{ - routebox_t *p; - LIST_LOOP(rb, same_net, p); - if (p->flags.source && p->parent.pad->ID == id) - return pcb_true; - END_LOOP; - return pcb_false; -} - -static void trace_parents(routebox_t * rb) -{ - while (rb && rb->type == EXPANSION_AREA) { - printf(" %p ->", (void *)rb); - rb = rb->parent.expansion_area; - } - if (rb) - printf(" %p is source\n", (void *)rb); - else - printf("NULL!\n"); -} - -static void show_one(routebox_t * rb) -{ - int save = showboxen; - showboxen = -1; - showroutebox(rb); - showboxen = save; -} - -static void show_path(routebox_t * rb) -{ - while (rb && rb->type == EXPANSION_AREA) { - show_one(rb); - rb = rb->parent.expansion_area; - } - show_one(rb); -} - -static void show_sources(routebox_t * rb) -{ - routebox_t *p; - if (!rb->flags.source && !rb->flags.target) { - printf("start with a source or target please\n"); - return; - } - LIST_LOOP(rb, same_net, p); - if (p->flags.source) - show_one(p); - END_LOOP; -} - -#endif - -static r_dir_t __conflict_source(const BoxType * box, void *cl) -{ - routebox_t *rb = (routebox_t *) box; - if (rb->flags.touched || rb->flags.fixed) - return R_DIR_NOT_FOUND; - else { - routebox_t *dis = (routebox_t *) cl; - path_conflicts(dis, rb, pcb_false); - touch_conflicts(dis->conflicts_with, 1); - } - return R_DIR_FOUND_CONTINUE; -} - -static void source_conflicts(rtree_t * tree, routebox_t * rb) -{ - if (!AutoRouteParameters.with_conflicts) - return; - r_search(tree, &rb->sbox, NULL, __conflict_source, rb, NULL); - touch_conflicts(NULL, 1); -} - -struct routeone_status { - pcb_bool found_route; - int route_had_conflicts; - cost_t best_route_cost; - pcb_bool net_completely_routed; -}; - - -static struct routeone_status RouteOne(routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges) -{ - struct routeone_status result; - routebox_t *p; - int seen, i; - const BoxType **target_list; - int num_targets; - rtree_t *targets; - /* vector of source edges for filtering */ - vector_t *source_vec; - /* working vector */ - vector_t *edge_vec; - - struct routeone_state s; - struct routeone_via_site_state vss; - - assert(rd && from); - result.route_had_conflicts = 0; - /* no targets on to/from net need clearance areas */ - LIST_LOOP(from, same_net, p); - p->flags.nobloat = 1; - END_LOOP; - /* set 'source' flags */ - LIST_LOOP(from, same_subnet, p); - if (!p->flags.nonstraight) - p->flags.source = 1; - END_LOOP; - - /* count up the targets */ - num_targets = 0; - seen = 0; - /* remove source/target flags from non-straight obstacles, because they - * don't fill their bounding boxes and so connecting to them - * after we've routed is problematic. Better solution? */ - if (to) { /* if we're routing to a specific target */ - if (!to->flags.source) { /* not already connected */ - /* check that 'to' and 'from' are on the same net */ - seen = 0; -#ifndef NDEBUG - LIST_LOOP(from, same_net, p); - if (p == to) - seen = 1; - END_LOOP; -#endif - assert(seen); /* otherwise from and to are on different nets! */ - /* set target flags only on 'to's subnet */ - LIST_LOOP(to, same_subnet, p); - if (!p->flags.nonstraight && is_layer_group_active[p->group]) { - p->flags.target = 1; - num_targets++; - } - END_LOOP; - } - } - else { - /* all nodes on the net but not connected to from are targets */ - LIST_LOOP(from, same_net, p); - if (!p->flags.source && is_layer_group_active[p->group] - && !p->flags.nonstraight) { - p->flags.target = 1; - num_targets++; - } - END_LOOP; - } - - /* if no targets, then net is done! reset flags and return. */ - if (num_targets == 0) { - LIST_LOOP(from, same_net, p); - p->flags.source = p->flags.target = p->flags.nobloat = 0; - END_LOOP; - result.found_route = pcb_false; - result.net_completely_routed = pcb_true; - result.best_route_cost = 0; - result.route_had_conflicts = 0; - - return result; - } - result.net_completely_routed = pcb_false; - - /* okay, there's stuff to route */ - assert(!from->flags.target); - assert(num_targets > 0); - /* create list of target pointers and from that a r-tree of targets */ - target_list = (const BoxType **) malloc(num_targets * sizeof(*target_list)); - i = 0; - LIST_LOOP(from, same_net, p); - if (p->flags.target) { - target_list[i++] = &p->box; -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_TARGETS) - showroutebox(p); -#endif - } - END_LOOP; - targets = r_create_tree((const BoxType **) target_list, i, 0); - assert(i <= num_targets); - free(target_list); - - source_vec = vector_create(); - /* touch the source subnet to prepare check for conflictors */ - LIST_LOOP(from, same_subnet, p); - p->flags.touched = 1; - END_LOOP; - LIST_LOOP(from, same_subnet, p); - { - /* we need the test for 'source' because this box may be nonstraight */ - if (p->flags.source && is_layer_group_active[p->group]) { - CheapPointType cp; - edge_t *e; - BoxType b = shrink_routebox(p); - -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_SOURCES) - showroutebox(p); -#endif - /* may expand in all directions from source; center edge cost point. */ - /* note that planes shouldn't really expand, but we need an edge */ - - cp.X = CENTER_X(b); - cp.Y = CENTER_Y(b); - e = CreateEdge(p, cp.X, cp.Y, 0, NULL, ALL, targets); - cp = closest_point_in_box(&cp, &e->mincost_target->sbox); - cp = closest_point_in_box(&cp, &b); - e->cost_point = cp; - p->cost_point = cp; - source_conflicts(rd->layergrouptree[p->group], p); - vector_append(source_vec, e); - } - } - END_LOOP; - LIST_LOOP(from, same_subnet, p); - p->flags.touched = 0; - END_LOOP; - /* break source edges; some edges may be too near obstacles to be able - * to exit from. */ - - /* okay, main expansion-search routing loop. */ - /* set up the initial activity heap */ - s.workheap = heap_create(); - assert(s.workheap); - while (!vector_is_empty(source_vec)) { - edge_t *e = (edge_t *) vector_remove_last(source_vec); - assert(is_layer_group_active[e->rb->group]); - e->cost = edge_cost(e, EXPENSIVE); - heap_insert(s.workheap, e->cost, e); - } - vector_destroy(&source_vec); - /* okay, process items from heap until it is empty! */ - s.best_path = NULL; - s.best_cost = EXPENSIVE; - area_vec = vector_create(); - edge_vec = vector_create(); - vss.free_space_vec = vector_create(); - vss.lo_conflict_space_vec = vector_create(); - vss.hi_conflict_space_vec = vector_create(); - while (!heap_is_empty(s.workheap)) { - edge_t *e = (edge_t *) heap_remove_smallest(s.workheap); -#ifdef ROUTE_DEBUG - if (aabort) - goto dontexpand; -#endif - /* don't bother expanding this edge if the minimum possible edge cost - * is already larger than the best edge cost we've found. */ - if (s.best_path && e->cost >= s.best_cost) { - heap_free(s.workheap, KillEdge); - goto dontexpand; /* skip this edge */ - } - /* surprisingly it helps to give up and not try too hard to find - * a route! This is not only faster, but results in better routing. - * who would have guessed? - */ - if (seen++ > max_edges) - goto dontexpand; - assert(__edge_is_good(e)); - /* mark or unmark conflictors as needed */ - touch_conflicts(e->rb->conflicts_with, 1); - if (e->flags.via_search) { - do_via_search(e, &s, &vss, rd->mtspace, targets); - goto dontexpand; - } - /* we should never add edges on inactive layer groups to the heap. */ - assert(is_layer_group_active[e->rb->group]); -#if defined(ROUTE_DEBUG) && defined(DEBUG_SHOW_EXPANSION_BOXES) - /*showedge (e); */ -#endif - if (e->rb->flags.is_thermal) { - best_path_candidate(&s, e, e->mincost_target); - goto dontexpand; - } - /* for a plane, look for quick connections with thermals or vias */ - if (e->rb->type == PLANE) { - routebox_t *pin = FindThermable(targets, e->rb); - if (pin) { - BoxType b = shrink_routebox(pin); - edge_t *ne; - routebox_t *nrb; - assert(pin->flags.target); - nrb = CreateExpansionArea(&b, e->rb->group, e->rb, pcb_true, e); - nrb->flags.is_thermal = 1; - /* moving through the plane is free */ - e->cost_point.X = b.X1; - e->cost_point.Y = b.Y1; - ne = CreateEdge2(nrb, e->expand_dir, e, NULL, pin); - best_path_candidate(&s, ne, pin); - DestroyEdge(&ne); - } - else { - /* add in possible via sites in plane */ - if (AutoRouteParameters.use_vias && e->cost + AutoRouteParameters.ViaCost < s.best_cost) { - /* we need a giant thermal */ - routebox_t *nrb = CreateExpansionArea(&e->rb->sbox, e->rb->group, e->rb, - pcb_true, e); - edge_t *ne = CreateEdge2(nrb, e->expand_dir, e, NULL, - e->mincost_target); - nrb->flags.is_thermal = 1; - add_via_sites(&s, &vss, rd->mtspace, nrb, NO_CONFLICT, ne, targets, e->rb->style->Diameter, pcb_true); - } - } - goto dontexpand; /* planes only connect via thermals */ - } - if (e->flags.is_via) { /* special case via */ - routebox_t *intersecting; - assert(AutoRouteParameters.use_vias); - assert(e->expand_dir == ALL); - assert(vector_is_empty(edge_vec)); - /* if there is already something here on this layer (like an - * EXPANSION_AREA), then we don't want to expand from here - * at least not inside the expansion area. A PLANE on the - * other hand may be a target, or not. - */ - intersecting = FindOneInBox(rd->layergrouptree[e->rb->group], e->rb); - - if (intersecting && intersecting->flags.target && intersecting->type == PLANE) { - /* we have hit a plane */ - edge_t *ne; - routebox_t *nrb; - BoxType b = shrink_routebox(e->rb); - /* limit via region to that inside the plane */ - clip_box(&b, &intersecting->sbox); - nrb = CreateExpansionArea(&b, e->rb->group, e->rb, pcb_true, e); - nrb->flags.is_thermal = 1; - ne = CreateEdge2(nrb, e->expand_dir, e, NULL, intersecting); - best_path_candidate(&s, ne, intersecting); - DestroyEdge(&ne); - goto dontexpand; - } - else if (intersecting == NULL) { - /* this via candidate is in an open area; add it to r-tree as - * an expansion area */ - assert(e->rb->type == EXPANSION_AREA && e->rb->flags.is_via); - /*assert (!r_search (rd->layergrouptree[e->rb->group], - &e->rb->box, NULL, no_planes,0)); - */ - r_insert_entry(rd->layergrouptree[e->rb->group], &e->rb->box, 1); - e->rb->flags.homeless = 0; /* not homeless any more */ - /* add to vector of all expansion areas in r-tree */ - vector_append(area_vec, e->rb); - /* mark reset refcount to 0, since this is not homeless any more. */ - e->rb->refcount = 0; - /* go ahead and expand this edge! */ - } - else if (1) - goto dontexpand; - else if (0) { /* XXX: disabling this causes no via - collisions. */ - BoxType a = bloat_routebox(intersecting), b; - edge_t *ne; - int i, j; - /* something intersects this via candidate. split via candidate - * into pieces and add these pieces to the workheap. */ - for (i = 0; i < 3; i++) { - for (j = 0; j < 3; j++) { - b = shrink_routebox(e->rb); - switch (i) { - case 0: - b.X2 = MIN(b.X2, a.X1); - break; /* left */ - case 1: - b.X1 = MAX(b.X1, a.X1); - b.X2 = MIN(b.X2, a.X2); - break; /*c */ - case 2: - b.X1 = MAX(b.X1, a.X2); - break; /* right */ - default: - assert(0); - } - switch (j) { - case 0: - b.Y2 = MIN(b.Y2, a.Y1); - break; /* top */ - case 1: - b.Y1 = MAX(b.Y1, a.Y1); - b.Y2 = MIN(b.Y2, a.Y2); - break; /*c */ - case 2: - b.Y1 = MAX(b.Y1, a.Y2); - break; /* bottom */ - default: - assert(0); - } - /* skip if this box is not valid */ - if (!(b.X1 < b.X2 && b.Y1 < b.Y2)) - continue; - if (i == 1 && j == 1) { - /* this bit of the via space is obstructed. */ - if (intersecting->type == EXPANSION_AREA || intersecting->flags.fixed) - continue; /* skip this bit, it's already been done. */ - /* create an edge with conflicts, if enabled */ - if (!AutoRouteParameters.with_conflicts) - continue; - ne = CreateEdgeWithConflicts(&b, intersecting, e, 1 - /*cost penalty to box */ - , targets); - add_or_destroy_edge(&s, ne); - } - else { - /* if this is not the intersecting piece, create a new - * (hopefully unobstructed) via edge and add it back to the - * workheap. */ - ne = CreateViaEdge(&b, e->rb->group, e->rb->parent.expansion_area, e, e->flags.via_conflict_level, NO_CONFLICT - /* value here doesn't matter */ - , targets); - add_or_destroy_edge(&s, ne); - } - } - } - goto dontexpand; - } - /* between the time these edges are inserted and the - * time they are processed, new expansion boxes (which - * conflict with these edges) may be added to the graph! - * w.o vias this isn't a problem because the broken box - * is not homeless. */ - } - if (1) { - routebox_t *nrb; - struct E_result *ans; - BoxType b; - vector_t *broken; - if (e->flags.is_interior) { - assert(AutoRouteParameters.with_conflicts); /* no interior edges unless - routing with conflicts! */ - assert(e->rb->conflicts_with); - b = e->rb->sbox; - switch (e->rb->came_from) { - case NORTH: - b.Y2 = b.Y1 + 1; - b.X1 = CENTER_X(b); - b.X2 = b.X1 + 1; - break; - case EAST: - b.X1 = b.X2 - 1; - b.Y1 = CENTER_Y(b); - b.Y2 = b.Y1 + 1; - break; - case SOUTH: - b.Y1 = b.Y2 - 1; - b.X1 = CENTER_X(b); - b.X2 = b.X1 + 1; - break; - case WEST: - b.X2 = b.X1 + 1; - b.Y1 = CENTER_Y(b); - b.Y2 = b.Y1 + 1; - break; - default: - assert(0); - } - } - /* sources may not expand to their own edges because of - * adjacent blockers. - */ - else if (e->rb->flags.source) - b = box_center(&e->rb->sbox); - else - b = e->rb->sbox; - ans = Expand(rd->layergrouptree[e->rb->group], e, &b); - if (!box_intersect(&ans->inflated, &ans->orig)) - goto dontexpand; -#if 0 - /* skip if it didn't actually expand */ - if (ans->inflated.X1 >= e->rb->sbox.X1 && - ans->inflated.X2 <= e->rb->sbox.X2 && ans->inflated.Y1 >= e->rb->sbox.Y1 && ans->inflated.Y2 <= e->rb->sbox.Y2) - goto dontexpand; -#endif - - if (!box_is_good(&ans->inflated)) - goto dontexpand; - nrb = CreateExpansionArea(&ans->inflated, e->rb->group, e->rb, pcb_true, e); - r_insert_entry(rd->layergrouptree[nrb->group], &nrb->box, 1); - vector_append(area_vec, nrb); - nrb->flags.homeless = 0; /* not homeless any more */ - broken = BreakManyEdges(&s, targets, rd->layergrouptree[nrb->group], area_vec, ans, nrb, e); - while (!vector_is_empty(broken)) { - edge_t *ne = (edge_t *) vector_remove_last(broken); - add_or_destroy_edge(&s, ne); - } - vector_destroy(&broken); - - /* add in possible via sites in nrb */ - if (AutoRouteParameters.use_vias && !e->rb->flags.is_via && e->cost + AutoRouteParameters.ViaCost < s.best_cost) - add_via_sites(&s, &vss, rd->mtspace, nrb, NO_CONFLICT, e, targets, 0, pcb_false); - goto dontexpand; - } - dontexpand: - DestroyEdge(&e); - } - touch_conflicts(NULL, 1); - heap_destroy(&s.workheap); - r_destroy_tree(&targets); - assert(vector_is_empty(edge_vec)); - vector_destroy(&edge_vec); - - /* we should have a path in best_path now */ - if (s.best_path) { - routebox_t *rb; -#ifdef ROUTE_VERBOSE - printf("%d:%d RC %.0f", ro++, seen, s.best_cost); -#endif - result.found_route = pcb_true; - result.best_route_cost = s.best_cost; - /* determine if the best path had conflicts */ - result.route_had_conflicts = 0; - if (AutoRouteParameters.with_conflicts && s.best_path->conflicts_with) { - while (!vector_is_empty(s.best_path->conflicts_with)) { - rb = (routebox_t *) vector_remove_last(s.best_path->conflicts_with); - rb->flags.is_bad = 1; - result.route_had_conflicts++; - } - } -#ifdef ROUTE_VERBOSE - if (result.route_had_conflicts) - printf(" (%d conflicts)", result.route_had_conflicts); -#endif - if (result.route_had_conflicts < AutoRouteParameters.hi_conflict) { - /* back-trace the path and add lines/vias to r-tree */ - TracePath(rd, s.best_path, s.best_target, from, result.route_had_conflicts); - MergeNets(from, s.best_target, SUBNET); - } - else { -#ifdef ROUTE_VERBOSE - printf(" (too many in fact)"); -#endif - result.found_route = pcb_false; - } -#ifdef ROUTE_VERBOSE - printf("\n"); -#endif - } - else { -#ifdef ROUTE_VERBOSE - printf("%d:%d NO PATH FOUND.\n", ro++, seen); -#endif - result.best_route_cost = s.best_cost; - result.found_route = pcb_false; - } - /* now remove all expansion areas from the r-tree. */ - while (!vector_is_empty(area_vec)) { - routebox_t *rb = (routebox_t *) vector_remove_last(area_vec); - assert(!rb->flags.homeless); - if (rb->conflicts_with && rb->parent.expansion_area->conflicts_with != rb->conflicts_with) - vector_destroy(&rb->conflicts_with); - r_delete_entry(rd->layergrouptree[rb->group], &rb->box); - } - vector_destroy(&area_vec); - /* clean up; remove all 'source', 'target', and 'nobloat' flags */ - LIST_LOOP(from, same_net, p); - if (p->flags.source && p->conflicts_with) - vector_destroy(&p->conflicts_with); - p->flags.touched = p->flags.source = p->flags.target = p->flags.nobloat = 0; - END_LOOP; - - vector_destroy(&vss.free_space_vec); - vector_destroy(&vss.lo_conflict_space_vec); - vector_destroy(&vss.hi_conflict_space_vec); - - return result; -} - -static void InitAutoRouteParameters(int pass, RouteStyleType * style, pcb_bool with_conflicts, pcb_bool is_smoothing, pcb_bool lastpass) -{ - int i; - /* routing style */ - AutoRouteParameters.style = style; - AutoRouteParameters.bloat = style->Clearance + HALF_THICK(style->Thick); - /* costs */ - AutoRouteParameters.ViaCost = PCB_INCH_TO_COORD(3.5) + style->Diameter * (is_smoothing ? 80 : 30); - AutoRouteParameters.LastConflictPenalty = (400 * pass / passes + 2) / (pass + 1); - AutoRouteParameters.ConflictPenalty = 4 * AutoRouteParameters.LastConflictPenalty; - AutoRouteParameters.JogPenalty = 1000 * (is_smoothing ? 20 : 4); - AutoRouteParameters.CongestionPenalty = 1e6; - AutoRouteParameters.MinPenalty = EXPENSIVE; - for (i = 0; i < max_group; i++) { - if (is_layer_group_active[i]) { - AutoRouteParameters.MinPenalty = MIN(x_cost[i], AutoRouteParameters.MinPenalty); - AutoRouteParameters.MinPenalty = MIN(y_cost[i], AutoRouteParameters.MinPenalty); - } - } - AutoRouteParameters.NewLayerPenalty = is_smoothing ? 0.5 * EXPENSIVE : 10 * AutoRouteParameters.ViaCost; - /* other */ - AutoRouteParameters.hi_conflict = MAX(8 * (passes - pass + 1), 6); - AutoRouteParameters.is_odd = (pass & 1); - AutoRouteParameters.with_conflicts = with_conflicts; - AutoRouteParameters.is_smoothing = is_smoothing; - AutoRouteParameters.rip_always = is_smoothing; - AutoRouteParameters.last_smooth = 0; /*lastpass; */ - AutoRouteParameters.pass = pass + 1; -} - -#ifndef NDEBUG -r_dir_t bad_boy(const BoxType * b, void *cl) -{ - routebox_t *box = (routebox_t *) b; - if (box->type == EXPANSION_AREA) - return R_DIR_FOUND_CONTINUE; - return R_DIR_NOT_FOUND; -} - -pcb_bool no_expansion_boxes(routedata_t * rd) -{ - int i; - BoxType big; - big.X1 = 0; - big.X2 = MAX_COORD; - big.Y1 = 0; - big.Y2 = MAX_COORD; - for (i = 0; i < max_group; i++) { - if (r_search(rd->layergrouptree[i], &big, NULL, bad_boy, NULL, NULL)) - return pcb_false; - } - return pcb_true; -} -#endif - -static void ripout_livedraw_obj(routebox_t * rb) -{ - if (rb->type == LINE && rb->livedraw_obj.line) { - LayerType *layer = LAYER_PTR(PCB->LayerGroups.Entries[rb->group][0]); - EraseLine(rb->livedraw_obj.line); - DestroyObject(PCB->Data, PCB_TYPE_LINE, layer, rb->livedraw_obj.line, NULL); - rb->livedraw_obj.line = NULL; - } - if (rb->type == VIA && rb->livedraw_obj.via) { - EraseVia(rb->livedraw_obj.via); - DestroyObject(PCB->Data, PCB_TYPE_VIA, rb->livedraw_obj.via, NULL, NULL); - rb->livedraw_obj.via = NULL; - } -} - -static r_dir_t ripout_livedraw_obj_cb(const BoxType * b, void *cl) -{ - routebox_t *box = (routebox_t *) b; - ripout_livedraw_obj(box); - return R_DIR_NOT_FOUND; -} - -struct routeall_status { - /* --- for completion rate statistics ---- */ - int total_subnets; - /* total subnets routed without conflicts */ - int routed_subnets; - /* total subnets routed with conflicts */ - int conflict_subnets; - /* net failted entirely */ - int failed; - /* net was ripped */ - int ripped; - int total_nets_routed; -}; - -static double calculate_progress(double this_heap_item, double this_heap_size, struct routeall_status *ras) -{ - double total_passes = passes + smoothes + 1; /* + 1 is the refinement pass */ - double this_pass = AutoRouteParameters.pass - 1; /* Number passes from zero */ - double heap_fraction = (double) (ras->routed_subnets + ras->conflict_subnets + ras->failed) / (double) ras->total_subnets; - double pass_fraction = (this_heap_item + heap_fraction) / this_heap_size; - double process_fraction = (this_pass + pass_fraction) / total_passes; - - return process_fraction; -} - -struct routeall_status RouteAll(routedata_t * rd) -{ - struct routeall_status ras; - struct routeone_status ros; - pcb_bool rip; - int request_cancel; -#ifdef NET_HEAP - heap_t *net_heap; -#endif - heap_t *this_pass, *next_pass, *tmp; - routebox_t *net, *p, *pp; - cost_t total_net_cost, last_cost = 0, this_cost = 0; - int i; - int this_heap_size; - int this_heap_item; - - /* initialize heap for first pass; - * do smallest area first; that makes - * the subsequent costs more representative */ - this_pass = heap_create(); - next_pass = heap_create(); -#ifdef NET_HEAP - net_heap = heap_create(); -#endif - LIST_LOOP(rd->first_net, different_net, net); - { - double area; - BoxType bb = shrink_routebox(net); - LIST_LOOP(net, same_net, p); - { - MAKEMIN(bb.X1, p->sbox.X1); - MAKEMIN(bb.Y1, p->sbox.Y1); - MAKEMAX(bb.X2, p->sbox.X2); - MAKEMAX(bb.Y2, p->sbox.Y2); - } - END_LOOP; - area = (double) (bb.X2 - bb.X1) * (bb.Y2 - bb.Y1); - heap_insert(this_pass, area, net); - } - END_LOOP; - - ras.total_nets_routed = 0; - /* refinement/finishing passes */ - for (i = 0; i <= passes + smoothes; i++) { -#ifdef ROUTE_VERBOSE - if (i > 0 && i <= passes) - printf("--------- STARTING REFINEMENT PASS %d ------------\n", i); - else if (i > passes) - printf("--------- STARTING SMOOTHING PASS %d -------------\n", i - passes); -#endif - ras.total_subnets = ras.routed_subnets = ras.conflict_subnets = ras.failed = ras.ripped = 0; - assert(heap_is_empty(next_pass)); - - this_heap_size = heap_size(this_pass); - for (this_heap_item = 0; !heap_is_empty(this_pass); this_heap_item++) { -#ifdef ROUTE_DEBUG - if (aabort) - break; -#endif - net = (routebox_t *) heap_remove_smallest(this_pass); - InitAutoRouteParameters(i, net->style, i < passes, i > passes, i == passes + smoothes); - if (i > 0) { - /* rip up all unfixed traces in this net ? */ - if (AutoRouteParameters.rip_always) - rip = pcb_true; - else { - rip = pcb_false; - LIST_LOOP(net, same_net, p); - if (p->flags.is_bad) { - rip = pcb_true; - break; - } - END_LOOP; - } - - LIST_LOOP(net, same_net, p); - p->flags.is_bad = 0; - if (!p->flags.fixed) { -#ifndef NDEBUG - pcb_bool del; -#endif - assert(!p->flags.homeless); - if (rip) { - RemoveFromNet(p, NET); - RemoveFromNet(p, SUBNET); - } - if (AutoRouteParameters.use_vias && p->type != VIA_SHADOW && p->type != PLANE) { - mtspace_remove(rd->mtspace, &p->box, p->flags.is_odd ? ODD : EVEN, p->style->Clearance); - if (!rip) - mtspace_add(rd->mtspace, &p->box, p->flags.is_odd ? EVEN : ODD, p->style->Clearance); - } - if (rip) { - if (conf_core.editor.live_routing) - ripout_livedraw_obj(p); -#ifndef NDEBUG - del = -#endif - r_delete_entry(rd->layergrouptree[p->group], &p->box); -#ifndef NDEBUG - assert(del); -#endif - } - else { - p->flags.is_odd = AutoRouteParameters.is_odd; - } - } - END_LOOP; - if (conf_core.editor.live_routing) - Draw(); - /* reset to original connectivity */ - if (rip) { - ras.ripped++; - ResetSubnet(net); - } - else { - heap_insert(next_pass, 0, net); - continue; - } - } - /* count number of subnets */ - FOREACH_SUBNET(net, p); - ras.total_subnets++; - END_FOREACH(net, p); - /* the first subnet doesn't require routing. */ - ras.total_subnets--; - /* and re-route! */ - total_net_cost = 0; - /* only route that which isn't fully routed */ -#ifdef ROUTE_DEBUG - if (ras.total_subnets == 0 || aabort) -#else - if (ras.total_subnets == 0) -#endif - { - heap_insert(next_pass, 0, net); - continue; - } - - /* the loop here ensures that we get to all subnets even if - * some of them are unreachable from the first subnet. */ - LIST_LOOP(net, same_net, p); - { -#ifdef NET_HEAP - BoxType b = shrink_routebox(p); - /* using a heap allows us to start from smaller objects and - * end at bigger ones. also prefer to start at planes, then pads */ - heap_insert(net_heap, (float) (b.X2 - b.X1) * -#if defined(ROUTE_RANDOMIZED) - (0.3 + pcb_rand() / (RAND_MAX + 1.0)) * -#endif - (b.Y2 - b.Y1) * (p->type == PLANE ? -1 : (p->type == PAD ? 1 : 10)), p); - } - END_LOOP; - ros.net_completely_routed = 0; - while (!heap_is_empty(net_heap)) { - p = (routebox_t *) heap_remove_smallest(net_heap); -#endif - if (!p->flags.fixed || p->flags.subnet_processed || p->type == OTHER) - continue; - - while (!ros.net_completely_routed) { - double percent; - - assert(no_expansion_boxes(rd)); - /* FIX ME: the number of edges to examine should be in autoroute parameters - * i.e. the 2000 and 800 hard-coded below should be controllable by the user - */ - ros = RouteOne(rd, p, NULL, ((AutoRouteParameters.is_smoothing ? 2000 : 800) * (i + 1)) * routing_layers); - total_net_cost += ros.best_route_cost; - if (ros.found_route) { - if (ros.route_had_conflicts) - ras.conflict_subnets++; - else { - ras.routed_subnets++; - ras.total_nets_routed++; - } - } - else { - if (!ros.net_completely_routed) - ras.failed++; - /* don't bother trying any other source in this subnet */ - LIST_LOOP(p, same_subnet, pp); - pp->flags.subnet_processed = 1; - END_LOOP; - break; - } - /* note that we can infer nothing about ras.total_subnets based - * on the number of calls to RouteOne, because we may be unable - * to route a net from a particular starting point, but perfectly - * able to route it from some other. */ - percent = calculate_progress(this_heap_item, this_heap_size, &ras); - request_cancel = gui->progress(percent * 100., 100, _("Autorouting tracks")); - if (request_cancel) { - ras.total_nets_routed = 0; - ras.conflict_subnets = 0; - Message(PCB_MSG_DEFAULT, "Autorouting cancelled\n"); - goto out; - } - } - } -#ifndef NET_HEAP - END_LOOP; -#endif - if (!ros.net_completely_routed) - net->flags.is_bad = 1; /* don't skip this the next round */ - - /* Route easiest nets from this pass first on next pass. - * This works best because it's likely that the hardest - * is the last one routed (since it has the most obstacles) - * but it will do no good to rip it up and try it again - * without first changing any of the other routes - */ - heap_insert(next_pass, total_net_cost, net); - if (total_net_cost < EXPENSIVE) - this_cost += total_net_cost; - /* reset subnet_processed flags */ - LIST_LOOP(net, same_net, p); - { - p->flags.subnet_processed = 0; - } - END_LOOP; - } - /* swap this_pass and next_pass and do it all over again! */ - ro = 0; - assert(heap_is_empty(this_pass)); - tmp = this_pass; - this_pass = next_pass; - next_pass = tmp; -#if defined(ROUTE_DEBUG) || defined (ROUTE_VERBOSE) - printf - ("END OF PASS %d: %d/%d subnets routed without conflicts at cost %.0f, %d conflicts, %d failed %d ripped\n", - i, ras.routed_subnets, ras.total_subnets, this_cost, ras.conflict_subnets, ras.failed, ras.ripped); -#endif -#ifdef ROUTE_DEBUG - if (aabort) - break; -#endif - /* if no conflicts found, skip directly to smoothing pass! */ - if (ras.conflict_subnets == 0 && ras.routed_subnets == ras.total_subnets && i <= passes) - i = passes - (smoothes ? 0 : 1); - /* if no changes in a smoothing round, then we're done */ - if (this_cost == last_cost && i > passes && i < passes + smoothes) - i = passes + smoothes - 1; - last_cost = this_cost; - this_cost = 0; - } - - Message(PCB_MSG_DEFAULT, "%d of %d nets successfully routed.\n", ras.routed_subnets, ras.total_subnets); - -out: - heap_destroy(&this_pass); - heap_destroy(&next_pass); -#ifdef NET_HEAP - heap_destroy(&net_heap); -#endif - - /* no conflicts should be left at the end of the process. */ - assert(ras.conflict_subnets == 0); - - return ras; -} - -struct fpin_info { - PinTypePtr pin; - Coord X, Y; - jmp_buf env; -}; - -static r_dir_t fpin_rect(const BoxType * b, void *cl) -{ - PinTypePtr pin = (PinTypePtr) b; - struct fpin_info *info = (struct fpin_info *) cl; - if (pin->X == info->X && pin->Y == info->Y) { - info->pin = (PinTypePtr) b; - longjmp(info->env, 1); - } - return R_DIR_NOT_FOUND; -} - -static int FindPin(const BoxType * box, PinTypePtr * pin) -{ - struct fpin_info info; - - info.pin = NULL; - info.X = box->X1; - info.Y = box->Y1; - if (setjmp(info.env) == 0) - r_search(PCB->Data->pin_tree, box, NULL, fpin_rect, &info, NULL); - else { - *pin = info.pin; - return PCB_TYPE_PIN; - } - if (setjmp(info.env) == 0) - r_search(PCB->Data->via_tree, box, NULL, fpin_rect, &info, NULL); - else { - *pin = info.pin; - return PCB_TYPE_VIA; - } - *pin = NULL; - return PCB_TYPE_NONE; -} - - -/* paths go on first 'on' layer in group */ -/* returns 'pcb_true' if any paths were added. */ -pcb_bool IronDownAllUnfixedPaths(routedata_t * rd) -{ - pcb_bool changed = pcb_false; - LayerTypePtr layer; - routebox_t *net, *p; - int i; - LIST_LOOP(rd->first_net, different_net, net); - { - LIST_LOOP(net, same_net, p); - { - if (!p->flags.fixed) { - /* find first on layer in this group */ - assert(PCB->LayerGroups.Number[p->group] > 0); - assert(is_layer_group_active[p->group]); - for (i = 0, layer = NULL; i < PCB->LayerGroups.Number[p->group]; i++) { - layer = LAYER_PTR(PCB->LayerGroups.Entries[p->group][i]); - if (layer->On) - break; - } - assert(layer && layer->On); /*at least one layer must be on in this group! */ - assert(p->type != EXPANSION_AREA); - if (p->type == LINE) { - Coord halfwidth = HALF_THICK(p->style->Thick); - double th = halfwidth * 2 + 1; - BoxType b; - assert(p->parent.line == NULL); - /* orthogonal; thickness is 2*halfwidth */ - /* flip coordinates, if bl_to_ur */ - b = p->sbox; - total_wire_length += sqrt((b.X2 - b.X1 - th) * (b.X2 - b.X1 - th) + (b.Y2 - b.Y1 - th) * (b.Y2 - b.Y1 - th)); - b = shrink_box(&b, halfwidth); - if (b.X2 == b.X1 + 1) - b.X2 = b.X1; - if (b.Y2 == b.Y1 + 1) - b.Y2 = b.Y1; - if (p->flags.bl_to_ur) { - Coord t; - t = b.X1; - b.X1 = b.X2; - b.X2 = t; - } - /* using CreateDrawn instead of CreateNew concatenates sequential lines */ - p->parent.line = CreateDrawnLineOnLayer - (layer, b.X1, b.Y1, b.X2, b.Y2, - p->style->Thick, p->style->Clearance * 2, MakeFlags(PCB_FLAG_AUTO | (conf_core.editor.clear_line ? PCB_FLAG_CLEARLINE : 0))); - - if (p->parent.line) { - AddObjectToCreateUndoList(PCB_TYPE_LINE, layer, p->parent.line, p->parent.line); - changed = pcb_true; - } - } - else if (p->type == VIA || p->type == VIA_SHADOW) { - routebox_t *pp = (p->type == VIA_SHADOW) ? p->parent.via_shadow : p; - Coord radius = HALF_THICK(pp->style->Diameter); - BoxType b = shrink_routebox(p); - total_via_count++; - assert(pp->type == VIA); - if (pp->parent.via == NULL) { - assert(b.X1 + radius == b.X2 - radius); - assert(b.Y1 + radius == b.Y2 - radius); - pp->parent.via = - CreateNewVia(PCB->Data, b.X1 + radius, - b.Y1 + radius, - pp->style->Diameter, 2 * pp->style->Clearance, 0, pp->style->Hole, NULL, MakeFlags(PCB_FLAG_AUTO)); - assert(pp->parent.via); - if (pp->parent.via) { - AddObjectToCreateUndoList(PCB_TYPE_VIA, pp->parent.via, pp->parent.via, pp->parent.via); - changed = pcb_true; - } - } - assert(pp->parent.via); - if (p->type == VIA_SHADOW) { - p->type = VIA; - p->parent.via = pp->parent.via; - } - } - else if (p->type == THERMAL) - /* nothing to do because, the via might not be there yet */ ; - else - assert(0); - } - } - END_LOOP; - /* loop again to place all the thermals now that the vias are down */ - LIST_LOOP(net, same_net, p); - { - if (p->type == THERMAL) { - PinTypePtr pin = NULL; - /* thermals are alread a single point search, no need to shrink */ - int type = FindPin(&p->box, &pin); - if (pin) { - AddObjectToClearPolyUndoList(type, pin->Element ? pin->Element : pin, pin, pin, pcb_false); - RestoreToPolygon(PCB->Data, PCB_TYPE_VIA, LAYER_PTR(p->layer), pin); - AddObjectToFlagUndoList(type, pin->Element ? pin->Element : pin, pin, pin); - ASSIGN_THERM(p->layer, PCB->ThermStyle, pin); - AddObjectToClearPolyUndoList(type, pin->Element ? pin->Element : pin, pin, pin, pcb_true); - ClearFromPolygon(PCB->Data, PCB_TYPE_VIA, LAYER_PTR(p->layer), pin); - changed = pcb_true; - } - } - } - END_LOOP; - } - END_LOOP; - return changed; -} - -pcb_bool AutoRoute(pcb_bool selected) -{ - pcb_bool changed = pcb_false; - routedata_t *rd; - int i; - - total_wire_length = 0; - total_via_count = 0; - -#ifdef ROUTE_DEBUG - ddraw = gui->request_debug_draw(); - if (ddraw != NULL) { - ar_gc = ddraw->make_gc(); - ddraw->set_line_cap(ar_gc, Round_Cap); - } -#endif - - for (i = 0; i < vtroutestyle_len(&PCB->RouteStyle); i++) { - if (PCB->RouteStyle.array[i].Thick == 0 || - PCB->RouteStyle.array[i].Diameter == 0 || PCB->RouteStyle.array[i].Hole == 0 || PCB->RouteStyle.array[i].Clearance == 0) { - Message(PCB_MSG_DEFAULT, "You must define proper routing styles\n" "before auto-routing.\n"); - return (pcb_false); - } - } - if (ratlist_length(&PCB->Data->Rat) == 0) - return (pcb_false); - SaveFindFlag(PCB_FLAG_DRC); - rd = CreateRouteData(); - - if (1) { - routebox_t *net, *rb, *last; - int i = 0; - /* count number of rats selected */ - RAT_LOOP(PCB->Data); - { - if (!selected || TEST_FLAG(PCB_FLAG_SELECTED, line)) - i++; - } - END_LOOP; -#ifdef ROUTE_VERBOSE - printf("%d nets!\n", i); -#endif - if (i == 0) - goto donerouting; /* nothing to do here */ - /* if only one rat selected, do things the quick way. =) */ - if (i == 1) { - RAT_LOOP(PCB->Data); - if (!selected || TEST_FLAG(PCB_FLAG_SELECTED, line)) { - /* look up the end points of this rat line */ - routebox_t *a; - routebox_t *b; - a = FindRouteBoxOnLayerGroup(rd, line->Point1.X, line->Point1.Y, line->group1); - b = FindRouteBoxOnLayerGroup(rd, line->Point2.X, line->Point2.Y, line->group2); - assert(a != NULL && b != NULL); - assert(a->style == b->style); -/* - if (a->type != PAD && b->type == PAD) - { - routebox_t *t = a; - a = b; - b = t; - } -*/ - /* route exactly one net, without allowing conflicts */ - InitAutoRouteParameters(0, a->style, pcb_false, pcb_true, pcb_true); - /* hace planes work better as sources than targets */ - changed = RouteOne(rd, a, b, 150000).found_route || changed; - goto donerouting; - } - END_LOOP; - } - /* otherwise, munge the netlists so that only the selected rats - * get connected. */ - /* first, separate all sub nets into separate nets */ - /* note that this code works because LIST_LOOP is clever enough not to - * be fooled when the list is changing out from under it. */ - last = NULL; - LIST_LOOP(rd->first_net, different_net, net); - { - FOREACH_SUBNET(net, rb); - { - if (last) { - last->different_net.next = rb; - rb->different_net.prev = last; - } - last = rb; - } - END_FOREACH(net, rb); - LIST_LOOP(net, same_net, rb); - { - rb->same_net = rb->same_subnet; - } - END_LOOP; - /* at this point all nets are equal to their subnets */ - } - END_LOOP; - if (last) { - last->different_net.next = rd->first_net; - rd->first_net->different_net.prev = last; - } - - /* now merge only those subnets connected by a rat line */ - RAT_LOOP(PCB->Data); - if (!selected || TEST_FLAG(PCB_FLAG_SELECTED, line)) { - /* look up the end points of this rat line */ - routebox_t *a; - routebox_t *b; - a = FindRouteBoxOnLayerGroup(rd, line->Point1.X, line->Point1.Y, line->group1); - b = FindRouteBoxOnLayerGroup(rd, line->Point2.X, line->Point2.Y, line->group2); - if (!a || !b) { -#ifdef DEBUG_STALE_RATS - AddObjectToFlagUndoList(PCB_TYPE_RATLINE, line, line, line); - ASSIGN_FLAG(PCB_FLAG_SELECTED, pcb_true, line); - DrawRat(line, 0); -#endif /* DEBUG_STALE_RATS */ - Message(PCB_MSG_DEFAULT, "The rats nest is stale! Aborting autoroute...\n"); - goto donerouting; - } - /* merge subnets into a net! */ - MergeNets(a, b, NET); - } - END_LOOP; - /* now 'different_net' may point to too many different nets. Reset. */ - LIST_LOOP(rd->first_net, different_net, net); - { - if (!net->flags.touched) { - LIST_LOOP(net, same_net, rb); - rb->flags.touched = 1; - END_LOOP; - } - else /* this is not a "different net"! */ - RemoveFromNet(net, DIFFERENT_NET); - } - END_LOOP; - /* reset "touched" flag */ - LIST_LOOP(rd->first_net, different_net, net); - { - LIST_LOOP(net, same_net, rb); - { - assert(rb->flags.touched); - rb->flags.touched = 0; - } - END_LOOP; - } - END_LOOP; - } - /* okay, rd's idea of netlist now corresponds to what we want routed */ - /* auto-route all nets */ - changed = (RouteAll(rd).total_nets_routed > 0) || changed; -donerouting: - gui->progress(0, 0, NULL); - if (conf_core.editor.live_routing) { - int i; - BoxType big = { 0, 0, MAX_COORD, MAX_COORD }; - for (i = 0; i < max_group; i++) { - r_search(rd->layergrouptree[i], &big, NULL, ripout_livedraw_obj_cb, NULL, NULL); - } - } -#ifdef ROUTE_DEBUG - if (ddraw != NULL) - ddraw->finish_debug_draw(); -#endif - - if (changed) - changed = IronDownAllUnfixedPaths(rd); - Message(PCB_MSG_DEFAULT, "Total added wire length = %$mS, %d vias added\n", (Coord) total_wire_length, total_via_count); - DestroyRouteData(&rd); - if (changed) { - SaveUndoSerialNumber(); - - /* optimize rats, we've changed connectivity a lot. */ - DeleteRats(pcb_false /*all rats */ ); - RestoreUndoSerialNumber(); - AddAllRats(pcb_false /*all rats */ , NULL); - RestoreUndoSerialNumber(); - - IncrementUndoSerialNumber(); - - Redraw(); - } - RestoreFindFlag(); -#if defined (ROUTE_DEBUG) - aabort = 0; -#endif - return (changed); -} Index: 1.1.4/src_plugins/autoroute/vector.h =================================================================== --- 1.1.4/src_plugins/autoroute/vector.h (revision 10776) +++ 1.1.4/src_plugins/autoroute/vector.h (nonexistent) @@ -1,76 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, vector.h, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* prototypes for vector routines. - */ - -#ifndef PCB_VECTOR_H -#define PCB_VECTOR_H - -/* what a vector looks like */ -typedef struct vector_struct vector_t; -/* what data in a vector looks like */ -typedef void *vector_element_t; - -/* create an empty vector */ -vector_t *vector_create(); -/* destroy a vector */ -void vector_destroy(vector_t ** vector); -/* copy a vector */ -vector_t *vector_duplicate(vector_t * vector); - -/* -- interrogation -- */ -int vector_is_empty(vector_t * vector); -int vector_size(vector_t * vector); -vector_element_t vector_element(vector_t * vector, int N); -vector_element_t vector_element_first(vector_t * vector); -vector_element_t vector_element_last(vector_t * vector); - -/* -- mutation -- */ -/* add data to end of vector */ -void vector_append(vector_t * vector, vector_element_t data); -/* add multiple elements to end of vector */ -void vector_append_many(vector_t * vector, vector_element_t data[], int count); -/* add a vector of elements to the end of vector */ -void vector_append_vector(vector_t * vector, vector_t * other_vector); -/* add data at specified position of vector */ -void vector_insert(vector_t * vector, int N, vector_element_t data); -/* add multiple elements at specified position of vector */ -void vector_insert_many(vector_t * vector, int N, vector_element_t data[], int count); -/* return and delete the *last* element of vector */ -vector_element_t vector_remove_last(vector_t * vector); -/* return and delete data at specified position of vector */ -vector_element_t vector_remove(vector_t * vector, int N); -/* replace the data at the specified position with the given data. - * returns the old data. */ -vector_element_t vector_replace(vector_t * vector, vector_element_t data, int N); - -#endif /* PCB_VECTOR_H */ Index: 1.1.4/src_plugins/autoroute/autoroute.h =================================================================== --- 1.1.4/src_plugins/autoroute/autoroute.h (revision 10776) +++ 1.1.4/src_plugins/autoroute/autoroute.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, autoroute.h, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* prototypes for autoroute routines - */ - -#ifndef PCB_AUTOROUTE_H -#define PCB_AUTOROUTE_H - -#include "global.h" - -pcb_bool AutoRoute(pcb_bool); - -#endif Index: 1.1.4/src_plugins/autoroute/README =================================================================== --- 1.1.4/src_plugins/autoroute/README (revision 10776) +++ 1.1.4/src_plugins/autoroute/README (nonexistent) @@ -1,5 +0,0 @@ -Automatically route selected or all rats. This is the original autorouter. - -#state: works -#default: buildin -#implements: (feature) Index: 1.1.4/src_plugins/autoroute/mtspace.c =================================================================== --- 1.1.4/src_plugins/autoroute/mtspace.c (revision 10776) +++ 1.1.4/src_plugins/autoroute/mtspace.c (nonexistent) @@ -1,510 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, mtspace.c, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * Copyright (c) 2006 harry eaton. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - - -/* implementation for "empty space" routines (needed for via-space tracking - * in the auto-router. - */ - -#include "config.h" - -#include "global.h" - -#include -#include - -#include "box.h" -#include "heap.h" -#include "rtree.h" -#include "mtspace.h" -#include "vector.h" - -/* mtspace data structures are built on r-trees. */ - -/* --------------------------------------------------------------------------- - * some local types - */ - -typedef struct mtspacebox { - const BoxType box; - Coord clearance; /* the smallest clearance around this box */ -} mtspacebox_t; - -/* this is an mtspace_t */ -struct mtspace { - /* rtrees keeping track of regions expanded by their required clearance. */ - /* one for fixed, even, and odd */ - rtree_t *ftree, *etree, *otree; -}; - -typedef union { - vector_t *v; - heap_t *h; -} heap_or_vector; - -/* this is a vetting_t */ -struct vetting { - heap_or_vector untested; - heap_or_vector no_fix; - heap_or_vector no_hi; - heap_or_vector hi_candidate; - Coord radius; - Coord clearance; - CheapPointType desired; -}; - -#define SPECIAL 823157 - -mtspacebox_t *mtspace_create_box(const BoxType * box, Coord clearance) -{ - mtspacebox_t *mtsb; - assert(box_is_good(box)); - mtsb = (mtspacebox_t *) malloc(sizeof(*mtsb)); - /* the box was sent to us pre-bloated by the clearance amount */ - *((BoxTypePtr) & mtsb->box) = *box; - mtsb->clearance = clearance; - assert(box_is_good(&mtsb->box)); - return mtsb; -} - -/* create an "empty space" representation */ -mtspace_t *mtspace_create(void) -{ - mtspace_t *mtspace; - - /* create mtspace data structure */ - mtspace = (mtspace_t *) malloc(sizeof(*mtspace)); - mtspace->ftree = r_create_tree(NULL, 0, 0); - mtspace->etree = r_create_tree(NULL, 0, 0); - mtspace->otree = r_create_tree(NULL, 0, 0); - /* done! */ - return mtspace; -} - -/* destroy an "empty space" representation. */ -void mtspace_destroy(mtspace_t ** mtspacep) -{ - assert(mtspacep); - r_destroy_tree(&(*mtspacep)->ftree); - r_destroy_tree(&(*mtspacep)->etree); - r_destroy_tree(&(*mtspacep)->otree); - free(*mtspacep); - *mtspacep = NULL; -} - -struct mts_info { - Coord clearance; - BoxType box; - rtree_t *tree; - jmp_buf env; -}; - -static r_dir_t mts_remove_one(const BoxType * b, void *cl) -{ - struct mts_info *info = (struct mts_info *) cl; - mtspacebox_t *box = (mtspacebox_t *) b; - - /* there can be duplicate boxes, we just remove one */ - /* the info box is pre-bloated, so just check equality */ - if (b->X1 == info->box.X1 && b->X2 == info->box.X2 && - b->Y1 == info->box.Y1 && b->Y2 == info->box.Y2 && box->clearance == info->clearance) { - r_delete_entry(info->tree, b); - longjmp(info->env, 1); - } - return R_DIR_NOT_FOUND; -} - -rtree_t *which_tree(mtspace_t * mtspace, mtspace_type_t which) -{ - switch (which) { - case FIXED: - return mtspace->ftree; - case EVEN: - return mtspace->etree; - default: - return mtspace->otree; - } -} - -/* add a space-filler to the empty space representation. */ -void mtspace_add(mtspace_t * mtspace, const BoxType * box, mtspace_type_t which, Coord clearance) -{ - mtspacebox_t *filler = mtspace_create_box(box, clearance); - r_insert_entry(which_tree(mtspace, which), (const BoxType *) filler, 1); -} - -/* remove a space-filler from the empty space representation. */ -void mtspace_remove(mtspace_t * mtspace, const BoxType * box, mtspace_type_t which, Coord clearance) -{ - struct mts_info cl; - BoxType small_search; - - cl.clearance = clearance; - cl.box = *box; - cl.tree = which_tree(mtspace, which); - small_search = box_center(box); - if (setjmp(cl.env) == 0) { - r_search(cl.tree, &small_search, NULL, mts_remove_one, &cl, NULL); - assert(0); /* didn't find it?? */ - } -} - -struct query_closure { - BoxType *cbox; - heap_or_vector checking; - heap_or_vector touching; - CheapPointType *desired; - Coord radius, clearance; - jmp_buf env; - pcb_bool touch_is_vec; -}; - -static inline void heap_append(heap_t * heap, CheapPointType * desired, BoxType * newone) -{ - CheapPointType p = *desired; - assert(desired); - closest_point_in_box(&p, newone); - heap_insert(heap, PCB_ABS(p.X - desired->X) + (p.Y - desired->Y), newone); -} - -static inline void append(struct query_closure *qc, BoxType * newone) -{ - if (qc->desired) - heap_append(qc->checking.h, qc->desired, newone); - else - vector_append(qc->checking.v, newone); -} - -/* we found some space filler that may intersect this query. - * First check if it does intersect, then break it into - * overlaping regions that don't intersect this box. - */ -static r_dir_t query_one(const BoxType * box, void *cl) -{ - struct query_closure *qc = (struct query_closure *) cl; - mtspacebox_t *mtsb = (mtspacebox_t *) box; - Coord shrink; - assert(box_intersect(qc->cbox, &mtsb->box)); - /* we need to satisfy the larger of the two clearances */ - if (qc->clearance > mtsb->clearance) - shrink = mtsb->clearance; - else - shrink = qc->clearance; - /* if we shrink qc->box by this amount and it doesn't intersect - * then we didn't actually touch this box */ - if (qc->cbox->X1 + shrink >= mtsb->box.X2 || - qc->cbox->X2 - shrink <= mtsb->box.X1 || qc->cbox->Y1 + shrink >= mtsb->box.Y2 || qc->cbox->Y2 - shrink <= mtsb->box.Y1) - return R_DIR_NOT_FOUND; - /* ok, we do touch this box, now create up to 4 boxes that don't */ - if (mtsb->box.Y1 > qc->cbox->Y1 + shrink) { /* top region exists */ - Coord Y1 = qc->cbox->Y1; - Coord Y2 = mtsb->box.Y1 + shrink; - if (Y2 - Y1 >= 2 * (qc->radius + qc->clearance)) { - BoxType *newone = (BoxType *) malloc(sizeof(BoxType)); - newone->X1 = qc->cbox->X1; - newone->X2 = qc->cbox->X2; - newone->Y1 = Y1; - newone->Y2 = Y2; - assert(newone->Y2 < qc->cbox->Y2); - append(qc, newone); - } - } - if (mtsb->box.Y2 < qc->cbox->Y2 - shrink) { /* bottom region exists */ - Coord Y1 = mtsb->box.Y2 - shrink; - Coord Y2 = qc->cbox->Y2; - if (Y2 - Y1 >= 2 * (qc->radius + qc->clearance)) { - BoxType *newone = (BoxType *) malloc(sizeof(BoxType)); - newone->X1 = qc->cbox->X1; - newone->X2 = qc->cbox->X2; - newone->Y2 = qc->cbox->Y2; - newone->Y1 = Y1; - assert(newone->Y1 > qc->cbox->Y1); - append(qc, newone); - } - } - if (mtsb->box.X1 > qc->cbox->X1 + shrink) { /* left region exists */ - Coord X1 = qc->cbox->X1; - Coord X2 = mtsb->box.X1 + shrink; - if (X2 - X1 >= 2 * (qc->radius + qc->clearance)) { - BoxType *newone; - newone = (BoxType *) malloc(sizeof(BoxType)); - newone->Y1 = qc->cbox->Y1; - newone->Y2 = qc->cbox->Y2; - newone->X1 = qc->cbox->X1; - newone->X2 = X2; - assert(newone->X2 < qc->cbox->X2); - append(qc, newone); - } - } - if (mtsb->box.X2 < qc->cbox->X2 - shrink) { /* right region exists */ - Coord X1 = mtsb->box.X2 - shrink; - Coord X2 = qc->cbox->X2; - if (X2 - X1 >= 2 * (qc->radius + qc->clearance)) { - BoxType *newone = (BoxType *) malloc(sizeof(BoxType)); - newone->Y1 = qc->cbox->Y1; - newone->Y2 = qc->cbox->Y2; - newone->X2 = qc->cbox->X2; - newone->X1 = X1; - assert(newone->X1 > qc->cbox->X1); - append(qc, newone); - } - } - if (qc->touching.v) { - if (qc->touch_is_vec || !qc->desired) - vector_append(qc->touching.v, qc->cbox); - else - heap_append(qc->touching.h, qc->desired, qc->cbox); - } - else - free(qc->cbox); /* done with this one */ - longjmp(qc->env, 1); - return R_DIR_FOUND_CONTINUE; /* never reached */ -} - -/* qloop takes a vector (or heap) of regions to check (checking) if they don't intersect - * anything. If a region does intersect something, it is broken into - * pieces that don't intersect that thing (if possible) which are - * put back into the vector/heap of regions to check. - * qloop returns pcb_false when it finds the first empty region - * it returns pcb_true if it has exhausted the region vector/heap and never - * found an empty area. - */ -static void qloop(struct query_closure *qc, rtree_t * tree, heap_or_vector res, pcb_bool is_vec) -{ - BoxType *cbox; - int n; - - while (!(qc->desired ? heap_is_empty(qc->checking.h) : vector_is_empty(qc->checking.v))) { - cbox = qc->desired ? (BoxTypePtr) heap_remove_smallest(qc->checking.h) : (BoxTypePtr) vector_remove_last(qc->checking.v); - if (setjmp(qc->env) == 0) { - assert(box_is_good(cbox)); - qc->cbox = cbox; - r_search(tree, cbox, NULL, query_one, qc, &n); - assert(n == 0); - /* nothing intersected with this tree, put it in the result vector */ - if (is_vec) - vector_append(res.v, cbox); - else { - if (qc->desired) - heap_append(res.h, qc->desired, cbox); - else - vector_append(res.v, cbox); - } - return; /* found one - perhaps one answer is good enough */ - } - } -} - -/* free the memory used by the vetting structure */ -void mtsFreeWork(vetting_t ** w) -{ - vetting_t *work = (*w); - if (work->desired.X != -SPECIAL || work->desired.Y != -SPECIAL) { - heap_free(work->untested.h, free); - heap_destroy(&work->untested.h); - heap_free(work->no_fix.h, free); - heap_destroy(&work->no_fix.h); - heap_free(work->no_hi.h, free); - heap_destroy(&work->no_hi.h); - heap_free(work->hi_candidate.h, free); - heap_destroy(&work->hi_candidate.h); - } - else { - while (!vector_is_empty(work->untested.v)) - free(vector_remove_last(work->untested.v)); - vector_destroy(&work->untested.v); - while (!vector_is_empty(work->no_fix.v)) - free(vector_remove_last(work->no_fix.v)); - vector_destroy(&work->no_fix.v); - while (!vector_is_empty(work->no_hi.v)) - free(vector_remove_last(work->no_hi.v)); - vector_destroy(&work->no_hi.v); - while (!vector_is_empty(work->hi_candidate.v)) - free(vector_remove_last(work->hi_candidate.v)); - vector_destroy(&work->hi_candidate.v); - } - free(work); - (*w) = NULL; -} - - -/* returns some empty spaces in 'region' (or former narrowed regions) - * that may hold a feature with the specified radius and clearance - * It tries first to find Completely empty regions (which are appended - * to the free_space_vec vector). If that fails, it looks for regions - * filled only by objects generated by the previous pass (which are - * appended to the lo_conflict_space_vec vector). Then it looks for - * regions that are filled by objects generated during *this* pass - * (which are appended to the hi_conflict_space_vec vector). The - * current pass identity is given by 'is_odd'. As soon as one completely - * free region is found, it returns with that answer. It saves partially - * searched regions in vectors "untested", "no_fix", "no_hi", and - * "hi_candidate" which can be passed to future calls of this function - * to search harder for such regions if the computation becomes - * necessary. - */ -vetting_t *mtspace_query_rect(mtspace_t * mtspace, const BoxType * region, - Coord radius, Coord clearance, - vetting_t * work, - vector_t * free_space_vec, - vector_t * lo_conflict_space_vec, - vector_t * hi_conflict_space_vec, pcb_bool is_odd, pcb_bool with_conflicts, CheapPointType * desired) -{ - struct query_closure qc; - - /* pre-assertions */ - assert(free_space_vec); - assert(lo_conflict_space_vec); - assert(hi_conflict_space_vec); - /* search out to anything that might matter */ - if (region) { - BoxType *cbox; - assert(work == NULL); - assert(box_is_good(region)); - assert(vector_is_empty(free_space_vec)); - assert(vector_is_empty(lo_conflict_space_vec)); - assert(vector_is_empty(hi_conflict_space_vec)); - work = (vetting_t *) malloc(sizeof(vetting_t)); - work->clearance = clearance; - work->radius = radius; - cbox = (BoxType *) malloc(sizeof(BoxType)); - *cbox = bloat_box(region, clearance + radius); - if (desired) { - work->untested.h = heap_create(); - work->no_fix.h = heap_create(); - work->hi_candidate.h = heap_create(); - work->no_hi.h = heap_create(); - assert(work->untested.h && work->no_fix.h && work->no_hi.h && work->hi_candidate.h); - heap_insert(work->untested.h, 0, cbox); - work->desired = *desired; - } - else { - work->untested.v = vector_create(); - work->no_fix.v = vector_create(); - work->hi_candidate.v = vector_create(); - work->no_hi.v = vector_create(); - assert(work->untested.v && work->no_fix.v && work->no_hi.v && work->hi_candidate.v); - vector_append(work->untested.v, cbox); - work->desired.X = work->desired.Y = -SPECIAL; - } - return work; - } - qc.clearance = work->clearance; - qc.radius = work->radius; - if (work->desired.X == -SPECIAL && work->desired.Y == -SPECIAL) - qc.desired = NULL; - else - qc.desired = &work->desired; - /* do the query */ - do { - heap_or_vector temporary; - temporary.v = free_space_vec; - - /* search the fixed object tree discarding any intersections - * and placing empty regions in the no_fix vector. - */ - qc.checking = work->untested; - qc.touching.v = NULL; - qloop(&qc, mtspace->ftree, work->no_fix, pcb_false); - /* search the hi-conflict tree placing intersectors in the - * hi_candidate vector (if conflicts are allowed) and - * placing empty regions in the no_hi vector. - */ - qc.checking.v = work->no_fix.v; - qc.touching.v = with_conflicts ? work->hi_candidate.v : NULL; - qc.touch_is_vec = pcb_false; - qloop(&qc, is_odd ? mtspace->otree : mtspace->etree, work->no_hi, pcb_false); - /* search the lo-conflict tree placing intersectors in the - * lo-conflict answer vector (if conflicts allowed) and - * placing emptry regions in the free-space answer vector. - */ - qc.checking = work->no_hi; -/* XXX lo_conflict_space_vec will be treated like a heap! */ - qc.touching.v = (with_conflicts ? lo_conflict_space_vec : NULL); - qc.touch_is_vec = pcb_true; - qloop(&qc, is_odd ? mtspace->etree : mtspace->otree, temporary, pcb_true); - - /* qloop (&qc, is_odd ? mtspace->etree : mtspace->otree, (heap_or_vector)free_space_vec, pcb_true); */ - if (!vector_is_empty(free_space_vec)) { - if (qc.desired) { - if (heap_is_empty(work->untested.h)) - break; - } - else { - if (vector_is_empty(work->untested.v)) - break; - } - return work; - } - /* finally check the hi-conflict intersectors against the - * lo-conflict tree discarding intersectors (two types of conflict is real bad) - * and placing empty regions in the hi-conflict answer vector. - */ - if (with_conflicts) { - heap_or_vector temporary; - temporary.v = hi_conflict_space_vec; - - qc.checking = work->hi_candidate; - qc.touching.v = NULL; - qloop(&qc, is_odd ? mtspace->etree : mtspace->otree, temporary, pcb_true); - - /* qloop (&qc, is_odd ? mtspace->etree : mtspace->otree, */ - /* (heap_or_vector)hi_conflict_space_vec, pcb_true); */ - } - } - while (!(qc.desired ? heap_is_empty(work->untested.h) : vector_is_empty(work->untested.v))); - if (qc.desired) { - if (heap_is_empty(work->no_fix.h) && heap_is_empty(work->no_hi.h) && heap_is_empty(work->hi_candidate.h)) { - mtsFreeWork(&work); - return NULL; - } - } - else { - if (vector_is_empty(work->no_fix.v) && vector_is_empty(work->no_hi.v) && vector_is_empty(work->hi_candidate.v)) { - mtsFreeWork(&work); - return NULL; - } - } - return work; -} - -int mtsBoxCount(vetting_t * w) -{ -#if 0 - int ans; - ans = 3 * vector_size(w->untested); - ans += 2 * vector_size(w->no_fix); - ans += vector_size(w->no_hi); - ans += vector_size(w->hi_candidate); - return ans; -#endif - return 100; -} Index: 1.1.4/src_plugins/autoroute/Makefile =================================================================== --- 1.1.4/src_plugins/autoroute/Makefile (revision 10776) +++ 1.1.4/src_plugins/autoroute/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_autoroute - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/autoroute/action.c =================================================================== --- 1.1.4/src_plugins/autoroute/action.c (revision 10776) +++ 1.1.4/src_plugins/autoroute/action.c (nonexistent) @@ -1,103 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -#include "config.h" -#include "global.h" -#include "autoroute.h" -#include "action_helper.h" -#include "plugins.h" -#include "set.h" -#include "hid_actions.h" - -/* action routines for the autorouter - */ - -static const char autoroute_syntax[] = "AutoRoute(AllRats|SelectedRats)"; - -static const char autoroute_help[] = "Auto-route some or all rat lines."; - -/* %start-doc actions AutoRoute - -@table @code - -@item AllRats -Attempt to autoroute all rats. - -@item SelectedRats -Attempt to autoroute the selected rats. - -@end table - -Before autorouting, it's important to set up a few things. First, -make sure any layers you aren't using are disabled, else the -autorouter may use them. Next, make sure the current line and via -styles are set accordingly. Last, make sure "new lines clear -polygons" is set, in case you eventually want to add a copper pour. - -Autorouting takes a while. During this time, the program may not be -responsive. - -%end-doc */ - -static int ActionAutoRoute(int argc, const char **argv, Coord x, Coord y) -{ - const char *function = ACTION_ARG(0); - hid_action("Busy"); - if (function) { /* one parameter */ - if (strcmp(function, "AllRats") == 0) { - if (AutoRoute(pcb_false)) - SetChangedFlag(pcb_true); - } - else if ((strcmp(function, "SelectedRats") == 0) || (strcmp(function, "Selected") == 0)) { - if (AutoRoute(pcb_true)) - SetChangedFlag(pcb_true); - } - } - return 0; -} - -static const char *autoroute_cookie = "autoroute plugin"; - -HID_Action autoroute_action_list[] = { - {"AutoRoute", 0, ActionAutoRoute, - autoroute_help, autoroute_syntax} - , -}; - -REGISTER_ACTIONS(autoroute_action_list, autoroute_cookie) - -static void hid_autoroute_uninit(void) -{ - hid_remove_actions_by_cookie(autoroute_cookie); -} - -#include "dolists.h" -pcb_uninit_t hid_autoroute_init(void) -{ - REGISTER_ACTIONS(autoroute_action_list, autoroute_cookie) - return hid_autoroute_uninit; -} Index: 1.1.4/src_plugins/io_pcb/parse_l.l =================================================================== --- 1.1.4/src_plugins/io_pcb/parse_l.l (revision 10776) +++ 1.1.4/src_plugins/io_pcb/parse_l.l (nonexistent) @@ -1,466 +0,0 @@ - - -%{ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* lexical definitions to parse ASCII input of PCB and Element description - */ - -/* for popen() */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include - -#if defined(_POSIX_SOURCE) || defined(_HPUX_SOURCE) -#include -#endif - -#include "global.h" -#include "flags.h" - -#ifdef HAVE_LIBDMALLOC -# include /* see http://dmalloc.com */ -#endif - - - - -#include "global.h" -#include "crosshair.h" -#include "data.h" -#include "error.h" -#include "file.h" -#include "mymem.h" -#include "misc.h" -#include "strflags.h" -#include "parse_common.h" -#include "parse_y.h" -#include "create.h" -#include "plug_footprint.h" -#include "attribs.h" -#include "compat_misc.h" - -#define YY_NO_INPUT - -/* --------------------------------------------------------------------------- - * some shared parser identifiers - */ -#ifdef FLEX_SCANNER - -#define yyunput ATTRIBUTE_UNUSED yyunput -#endif - -const char *yyfilename; /* in this file */ -PCBTypePtr yyPCB; /* used by parser */ -DataTypePtr yyData; -ElementTypePtr yyElement; -FontTypePtr yyFont; -conf_role_t yy_settings_dest; -FlagType yy_pcb_flags; - -static int parse_number (void); - -/* --------------------------------------------------------------------------- - * an external prototypes - */ -int yyparse(void); - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static int Parse(FILE *Pipe, const char *Executable, const char *Path, const char *Filename, const char *Parse_parameter); - -%} - -%option prefix="pcb_" - - -HEX 0x[0-9a-fA-F]+ -INTEGER [+-]?([1-9][0-9]*|0) -FLOATING {INTEGER}"."[0-9]* -STRINGCHAR ([^"\n\r\\]|\\.) - -%option yylineno - -%% - -FileVersion { return(T_FILEVERSION); } -PCB { return(T_PCB); } -Grid { return(T_GRID); } -Cursor { return(T_CURSOR); } -Thermal { return(T_THERMAL); } -PolyArea { return(T_AREA); } -DRC { return(T_DRC); } -Flags { return(T_FLAGS); } -Layer { return(T_LAYER); } -Pin { return(T_PIN); } -Pad { return(T_PAD); } -Via { return(T_VIA); } -Line { return(T_LINE); } -Rat { return(T_RAT); } -Rectangle { return(T_RECTANGLE); } -Text { return(T_TEXT); } -ElementLine { return(T_ELEMENTLINE); } -ElementArc { return(T_ELEMENTARC); } -Element { return(T_ELEMENT); } -SymbolLine { return(T_SYMBOLLINE); } -Symbol { return(T_SYMBOL); } -Mark { return(T_MARK); } -Groups { return(T_GROUPS); } -Styles { return(T_STYLES); } -Polygon { return(T_POLYGON); } -Hole { return(T_POLYGON_HOLE); } -Arc { return(T_ARC); } -NetList { return(T_NETLIST); } -Net { return(T_NET); } -Connect { return(T_CONN); } -NetListPatch { return(T_NETLISTPATCH); } -add_conn { return(T_ADD_CONN); } -del_conn { return(T_DEL_CONN); } -change_attrib { return(T_CHANGE_ATTRIB); } -Attribute { return(T_ATTRIBUTE); } - -nm { return T_NM; } -um { return T_UM; } -mm { return T_MM; } -m { return T_M; } -km { return T_KM; } -umil { return T_UMIL; } -cmil { return T_CMIL; } -mil { return T_MIL; } -in { return T_IN; } - -\'.\' { - pcb_lval.integer = (unsigned) *(yytext+1); - return(CHAR_CONST); - } -{FLOATING} { return parse_number(); } -{INTEGER} { pcb_lval.integer = pcb_round (strtod (yytext, NULL)); return INTEGER; } - -{HEX} { unsigned n; - sscanf((char *) yytext, "%x", &n); - pcb_lval.integer = n; - return INTEGER; - } -\"{STRINGCHAR}*\" { - char *p1, *p2; - - /* return NULL on empty string */ - if (yyleng == 2) - { - pcb_lval.string = NULL; - return(STRING); - } - - /* allocate memory and copy string; - * stringlength is counted and copied without - * leading and trailing '"' - */ - yyleng -= 2; - pcb_lval.string = (char *)calloc (yyleng+1, sizeof (char)); - p1 = (char *) (yytext +1); - p2 = pcb_lval.string; - while(yyleng--) - { - /* check for special character */ - if (*p1 == '\\') - { - yyleng--; - p1++; - - } - *p2++ = *p1++; - } - *p2 = '\0'; - return(STRING); - } -#.* {} -[ \t]+ {} -[\n] { -#ifndef FLEX_SCANNER - yylineno++; -#endif - } -[\r] {} -. { return(*yytext); } - -%% - -/* --------------------------------------------------------------------------- - * sets up the preprocessor command - */ -static int Parse(FILE *Pipe, const char *Executable, const char *Path, const char *Filename, const char *Parse_parameter) -{ - static char *command = NULL; - int returncode; - int used_popen = 0; - char *tmps; - size_t l; -#ifdef FLEX_SCANNER - static pcb_bool firsttime = pcb_true; -#endif - - if (Pipe == NULL) { - if (EMPTY_STRING_P (Executable)) - { - l = 2; - if ( Path != NULL ) - l += strlen (Path); - - l += strlen (Filename); - - if ( (tmps = (char *) malloc ( l * sizeof (char))) == NULL) - { - fprintf (stderr, "Parse(): malloc failed\n"); - exit (1); - } - - if ( Path != NULL && *Path != '\0') - sprintf (tmps, "%s%s%s", Path, PCB_DIR_SEPARATOR_S, Filename); - else - sprintf (tmps, "%s", Filename); - - yyin = fopen (tmps, "r"); - if (!yyin) - { - return(1); - } - free (tmps); - } - else - { - used_popen = 1; - - command = EvaluateFilename(Executable, Path, Filename, Parse_parameter); - - /* open pipe to stdout of command */ - if (*command == '\0' || (yyin = popen(command, "r")) == NULL) - { - PopenErrorMessage(command); - free(command); - return(1); - } - free(command); - } - } - else { - yyin = Pipe; - } - -#ifdef FLEX_SCANNER - /* reset parser if not called the first time */ - if (!firsttime) - yyrestart(yyin); - firsttime = pcb_false; -#endif - - /* init linenumber and filename for yyerror() */ - yylineno = 1; - yyfilename = Filename; - - /* We need to save the data temporarily because lex-yacc are able - * to break the application if the input file has an illegal format. - * It's not necessary if the system supports the call of functions - * on termination. - */ - - CreateBeLenient (pcb_true); - -#if !defined(HAS_ATEXIT) - if (PCB && PCB->Data) - SaveTMPData(); - returncode = pcb_parse(); - RemoveTMPData(); -#else - returncode = pcb_parse(); -#endif - /* clean up parse buffer */ - yy_delete_buffer(YY_CURRENT_BUFFER); - - CreateBeLenient (pcb_false); - - if (Pipe != NULL) - return returncode; - - if (used_popen) - return(pclose(yyin) ? 1 : returncode); - return(fclose(yyin) ? 1 : returncode); -} - -/* --------------------------------------------------------------------------- - * initializes LEX and calls parser for a single element file - */ -int io_pcb_ParseElement(plug_io_t *ctx, DataTypePtr Ptr, const char *name) -{ - FILE *f; - int ret; - fp_fopen_ctx_t st; - - yy_settings_dest = CFR_invalid; - yyPCB = NULL; - yyData = Ptr; - yyFont = &PCB->Font; - yyElement = NULL; - - f = fp_fopen(fp_default_search_path(), name, &st); - - if (f == NULL) - return -1; - - ret = Parse(f, NULL,NULL,NULL,NULL); - - fp_fclose(f, &st); - - return(ret); -} - -/* --------------------------------------------------------------------------- - * initializes LEX and calls parser for a complete board - */ -#define TEST_FLAG_LOCAL(F,FLG) (((FLG) & (F)) ? 1 : 0) -#define CONF_BOOL_FLAG(F,FLG) (TEST_FLAG_LOCAL(F,FLG.f) ? "true" : "false") - -/* Hack: set a no-save-attribute flag while loading some fields from the file; - because we have all these flags set we won't need to list the paths that - have hardwired flags again in a "don't save these in attributes" list. */ -#define CONF_NO_ATTRIB(path) \ -do { \ - conf_native_t *n = conf_get_field(path); \ - if (n != NULL) \ - n->random_flags.io_pcb_no_attrib = 1; \ -} while(0) \ - -#define CONF_SET(target, path, arr_idx, new_val, pol) \ -do { \ - CONF_NO_ATTRIB(path); \ - conf_set(target, path, arr_idx, new_val, pol); \ -} while(0) \ - -int io_pcb_ParsePCB(plug_io_t *ctx, PCBTypePtr Ptr, const char *Filename, conf_role_t settings_dest) -{ - int retval; - yyPCB = Ptr; - yyData = NULL; - yyFont = NULL; - yyElement = NULL; - yy_settings_dest = settings_dest; - if (settings_dest != CFR_invalid) - conf_reset(settings_dest, Filename); - setlocale(LC_ALL, "C"); /* make sure numerics are read predictably */ - retval = Parse(NULL, conf_core.rc.file_command, conf_core.rc.file_path, Filename, NULL); - setlocale(LC_ALL, ""); - if ((settings_dest != CFR_invalid) && (retval == 0)) { - /* overwrite settings from the flags, mark them not-to-save */ - CONF_SET(settings_dest, "plugins/mincut/enable", -1, CONF_BOOL_FLAG(ENABLEPCB_FLAG_MINCUT, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/show_number", -1, CONF_BOOL_FLAG(SHOWNUMBERFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/show_drc", -1, CONF_BOOL_FLAG(SHOWPCB_FLAG_DRC, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/rubber_band_mode", -1, CONF_BOOL_FLAG(RUBBERBANDFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/auto_drc", -1, CONF_BOOL_FLAG(AUTOPCB_FLAG_DRC, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/all_direction_lines", -1, CONF_BOOL_FLAG(ALLDIRECTIONFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/swap_start_direction", -1, CONF_BOOL_FLAG(SWAPSTARTDIRFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/unique_names", -1, CONF_BOOL_FLAG(UNIQUENAMEFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/clear_line", -1, CONF_BOOL_FLAG(CLEARNEWFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/full_poly", -1, CONF_BOOL_FLAG(NEWPCB_FLAG_FULLPOLY, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/snap_pin", -1, CONF_BOOL_FLAG(SNAPPCB_FLAG_PIN, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/orthogonal_moves", -1, CONF_BOOL_FLAG(ORTHOMOVEFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/live_routing", -1, CONF_BOOL_FLAG(LIVEROUTEFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/lock_names", -1, CONF_BOOL_FLAG(LOCKNAMESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/only_names", -1, CONF_BOOL_FLAG(ONLYNAMESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/hide_names", -1, CONF_BOOL_FLAG(HIDENAMESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/thin_draw", -1, CONF_BOOL_FLAG(THINDRAWFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/thin_draw_poly", -1, CONF_BOOL_FLAG(THINDRAWPOLYFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/local_ref", -1, CONF_BOOL_FLAG(LOCALREFFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/check_planes", -1, CONF_BOOL_FLAG(CHECKPLANESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/description", -1, CONF_BOOL_FLAG(DESCRIPTIONFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/name_on_pcb", -1, CONF_BOOL_FLAG(NAMEONPCBFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/show_mask", -1, CONF_BOOL_FLAG(SHOWMASKFLAG, yy_pcb_flags), POL_OVERWRITE); - - /* don't save this because it is saved manually as PCB::grid::unit */ - CONF_NO_ATTRIB("editor/grid_unit"); - - /* don't save these to reduce noise - they are reset by the GUI anyway */ - CONF_NO_ATTRIB("editor/mode"); - - /* it's saved in [styles] */ - CONF_NO_ATTRIB("design/routes"); - - /* load config nodes not disabled above, from optional attributes */ - io_pcb_attrib_a2c(Ptr); - - conf_update(NULL); - } - if (retval == 0) { - /* restore loader so the next save will use the same units */ - const char *loader = AttributeGetFromList(&PCB->Attributes, "PCB::loader"); - if (loader != NULL) { - pcb_find_io_t f; - int len; - - len = pcb_find_io(&f, 1, PCB_IOT_PCB, 1, loader); -/* printf("PCB::loader: %s -> %d\n", loader, len);*/ - if (len > 0) { -/* printf(" ::loader: '%s'\n", f.plug->description);*/ - PCB->Data->loader = f.plug; - } - } - } - return retval; -} - -/* --------------------------------------------------------------------------- - * initializes LEX and calls parser for a font - */ -int io_pcb_ParseFont(plug_io_t *ctx, FontTypePtr Ptr, const char *Filename) -{ - int r = 0; - yyPCB = NULL; - yyFont = Ptr; - yyElement = NULL; - - yy_settings_dest = CFR_invalid; - r = Parse(NULL, conf_core.rc.font_command, NULL, Filename, NULL); - if (r == 0) { -#ifdef DEBUG - Message (PCB_MSG_DEBUG, "Found %s in %s\n", Filename, conf_core.rc.font_command); -#endif - } - return r; -} - -static int -parse_number () -{ - pcb_lval.number = strtod ((char *) yytext, NULL); - return FLOATING; -} Index: 1.1.4/src_plugins/io_pcb/flags.h =================================================================== --- 1.1.4/src_plugins/io_pcb/flags.h (revision 10776) +++ 1.1.4/src_plugins/io_pcb/flags.h (nonexistent) @@ -1,117 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -char *pcbflags_to_string(FlagType flags); -FlagType string_to_pcbflags(const char *flagstring, int (*error) (const char *msg)); - -/* --------------------------------------------------------------------------- - * PCB flags - kept only for file format compatibility reasons; these bits - should be a mirror of booleans from the conf. - */ - -/* %start-doc pcbfile ~pcbflags -@node PCBFlags -@section PCBFlags -@table @code -@item 0x00001 -Pinout displays pin numbers instead of pin names. -@item 0x00002 -Use local reference for moves, by setting the mark at the beginning of -each move. -@item 0x00004 -When set, only polygons and their clearances are drawn, to see if -polygons have isolated regions. -@item 0x00008 -Display DRC region on crosshair. -@item 0x00010 -Do all move, mirror, rotate with rubberband connections. -@item 0x00020 -Display descriptions of elements, instead of refdes. -@item 0x00040 -Display names of elements, instead of refdes. -@item 0x00080 -Auto-DRC flag. When set, PCB doesn't let you place copper that -violates DRC. -@item 0x00100 -Enable 'all-direction' lines. -@item 0x00200 -Switch starting angle after each click. -@item 0x00400 -Force unique names on board. -@item 0x00800 -New lines/arc clear polygons. -@item 0x01000 -Crosshair snaps to pins and pads. -@item 0x02000 -Show the solder mask layer. -@item 0x04000 -Draw with thin lines. -@item 0x08000 -Move items orthogonally. -@item 0x10000 -Draw autoroute paths real-time. -@item 0x20000 -New polygons are full ones. -@item 0x40000 -Names are locked, the mouse cannot select them. -@item 0x80000 -Everything but names are locked, the mouse cannot select anything else. -@item 0x100000 -New polygons are full polygons. -@item 0x200000 -When set, element names are not drawn. -+@item 0x800000 -+snap to certain off-grid points. -+@item 0x1000000 -+highlight lines and arcs when the crosshair is on one of their endpoints. -@end table -%end-doc */ - -#define PCB_FLAGS 0x01ffffff /* all used flags */ - -#define SHOWNUMBERFLAG 0x00000001 -#define LOCALREFFLAG 0x00000002 -#define CHECKPLANESFLAG 0x00000004 -#define SHOWPCB_FLAG_DRC 0x00000008 -#define RUBBERBANDFLAG 0x00000010 -#define DESCRIPTIONFLAG 0x00000020 -#define NAMEONPCBFLAG 0x00000040 -#define AUTOPCB_FLAG_DRC 0x00000080 -#define ALLDIRECTIONFLAG 0x00000100 -#define SWAPSTARTDIRFLAG 0x00000200 -#define UNIQUENAMEFLAG 0x00000400 -#define CLEARNEWFLAG 0x00000800 -#define SNAPPCB_FLAG_PIN 0x00001000 -#define SHOWMASKFLAG 0x00002000 -#define THINDRAWFLAG 0x00004000 -#define ORTHOMOVEFLAG 0x00008000 -#define LIVEROUTEFLAG 0x00010000 -#define THINDRAWPOLYFLAG 0x00020000 -#define LOCKNAMESFLAG 0x00040000 -#define ONLYNAMESFLAG 0x00080000 -#define NEWPCB_FLAG_FULLPOLY 0x00100000 -#define HIDENAMESFLAG 0x00200000 -#define ENABLEPCB_FLAG_MINCUT 0x00400000 Index: 1.1.4/src_plugins/io_pcb/parse_y.c =================================================================== --- 1.1.4/src_plugins/io_pcb/parse_y.c (revision 10776) +++ 1.1.4/src_plugins/io_pcb/parse_y.c (nonexistent) @@ -1,3258 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - 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 3 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0.2" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - -/* Substitute the variable and function names. */ -#define yyparse pcb_parse -#define yylex pcb_lex -#define yyerror pcb_error -#define yydebug pcb_debug -#define yynerrs pcb_nerrs - -#define yylval pcb_lval -#define yychar pcb_char - -/* Copy the first part of user declarations. */ -#line 11 "parse_y.y" /* yacc.c:339 */ - -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* grammar to parse ASCII input of PCB description - */ - -#include "config.h" -#include "conf_core.h" -#include "global.h" -#include "layer.h" -#include "create.h" -#include "data.h" -#include "error.h" -#include "file.h" -#include "mymem.h" -#include "misc.h" -#include "parse_l.h" -#include "polygon.h" -#include "remove.h" -#include "rtree.h" -#include "strflags.h" -#include "thermal.h" -#include "rats_patch.h" -#include "flags.h" -#include "route_style.h" -#include "compat_misc.h" - -#ifdef HAVE_LIBDMALLOC -# include /* see http://dmalloc.com */ -#endif - - - -static LayerTypePtr Layer; -static PolygonTypePtr Polygon; -static SymbolTypePtr Symbol; -static int pin_num; -static LibraryMenuTypePtr Menu; -static pcb_bool LayerFlag[MAX_LAYER + 2]; - -extern char *yytext; /* defined by LEX */ -extern PCBTypePtr yyPCB; -extern DataTypePtr yyData; -extern ElementTypePtr yyElement; -extern FontTypePtr yyFont; -extern int pcb_lineno; /* linenumber */ -extern char *yyfilename; /* in this file */ -extern conf_role_t yy_settings_dest; -extern FlagType yy_pcb_flags; - -static char *layer_group_string; - -static AttributeListTypePtr attr_list; - -int yyerror(const char *s); -int yylex(); -static int check_file_version (int); - -static void do_measure (PLMeasure *m, Coord i, double d, int u); -#define M(r,f,d) do_measure (&(r), f, d, 1) - -/* Macros for interpreting what "measure" means - integer value only, - old units (mil), or new units (cmil). */ -#define IV(m) integer_value (m) -#define OU(m) old_units (m) -#define NU(m) new_units (m) - -static int integer_value (PLMeasure m); -static Coord old_units (PLMeasure m); -static Coord new_units (PLMeasure m); - -#define YYDEBUG 1 -#define YYERROR_VERBOSE 1 - -#include "parse_y.h" - - -#line 176 "parse_y.c" /* yacc.c:339 */ - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "parse_y.h". */ -#ifndef YY_PCB_PARSE_Y_H_INCLUDED -# define YY_PCB_PARSE_Y_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int pcb_debug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - FLOATING = 258, - INTEGER = 259, - CHAR_CONST = 260, - STRING = 261, - T_FILEVERSION = 262, - T_PCB = 263, - T_LAYER = 264, - T_VIA = 265, - T_RAT = 266, - T_LINE = 267, - T_ARC = 268, - T_RECTANGLE = 269, - T_TEXT = 270, - T_ELEMENTLINE = 271, - T_ELEMENT = 272, - T_PIN = 273, - T_PAD = 274, - T_GRID = 275, - T_FLAGS = 276, - T_SYMBOL = 277, - T_SYMBOLLINE = 278, - T_CURSOR = 279, - T_ELEMENTARC = 280, - T_MARK = 281, - T_GROUPS = 282, - T_STYLES = 283, - T_POLYGON = 284, - T_POLYGON_HOLE = 285, - T_NETLIST = 286, - T_NET = 287, - T_CONN = 288, - T_NETLISTPATCH = 289, - T_ADD_CONN = 290, - T_DEL_CONN = 291, - T_CHANGE_ATTRIB = 292, - T_AREA = 293, - T_THERMAL = 294, - T_DRC = 295, - T_ATTRIBUTE = 296, - T_UMIL = 297, - T_CMIL = 298, - T_MIL = 299, - T_IN = 300, - T_NM = 301, - T_UM = 302, - T_MM = 303, - T_M = 304, - T_KM = 305 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 118 "parse_y.y" /* yacc.c:355 */ - - int integer; - double number; - char *string; - FlagType flagtype; - PLMeasure measure; - -#line 275 "parse_y.c" /* yacc.c:355 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE pcb_lval; - -int pcb_parse (void); - -#endif /* !YY_PCB_PARSE_Y_H_INCLUDED */ - -/* Copy the second part of user declarations. */ - -#line 290 "parse_y.c" /* yacc.c:358 */ - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 10 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 608 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 55 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 112 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 214 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 643 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 305 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 53, 54, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 51, 2, 52, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 145, 145, 146, 147, 148, 172, 172, 229, 229, - 240, 240, 259, 260, 265, 265, 305, 307, 337, 343, - 349, 378, 379, 380, 383, 391, 406, 440, 446, 452, - 468, 470, 495, 497, 528, 530, 531, 532, 536, 546, - 557, 584, 588, 593, 621, 625, 669, 678, 687, 691, - 692, 696, 697, 701, 702, 702, 703, 704, 706, 706, - 713, 717, 718, 719, 720, 721, 757, 767, 778, 788, - 798, 834, 839, 871, 870, 898, 899, 903, 904, 908, - 909, 910, 911, 912, 913, 915, 920, 921, 922, 923, - 923, 924, 954, 963, 972, 1020, 1029, 1038, 1075, 1085, - 1103, 1153, 1152, 1191, 1193, 1198, 1197, 1204, 1206, 1211, - 1215, 1275, 1276, 1277, 1278, 1279, 1287, 1286, 1305, 1304, - 1323, 1322, 1343, 1341, 1365, 1363, 1444, 1445, 1449, 1450, - 1451, 1452, 1453, 1455, 1460, 1465, 1470, 1475, 1480, 1485, - 1485, 1489, 1490, 1494, 1495, 1496, 1497, 1499, 1505, 1512, - 1517, 1522, 1522, 1563, 1575, 1587, 1598, 1614, 1668, 1682, - 1695, 1706, 1717, 1718, 1722, 1723, 1745, 1747, 1763, 1782, - 1783, 1786, 1788, 1789, 1810, 1817, 1833, 1834, 1838, 1843, - 1844, 1848, 1849, 1873, 1872, 1882, 1883, 1887, 1888, 1907, - 1924, 1925, 1929, 1934, 1935, 1939, 1940, 1955, 1956, 1957, - 1984, 1992, 1993, 1997, 1998, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011, 2012 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "FLOATING", "INTEGER", "CHAR_CONST", - "STRING", "T_FILEVERSION", "T_PCB", "T_LAYER", "T_VIA", "T_RAT", - "T_LINE", "T_ARC", "T_RECTANGLE", "T_TEXT", "T_ELEMENTLINE", "T_ELEMENT", - "T_PIN", "T_PAD", "T_GRID", "T_FLAGS", "T_SYMBOL", "T_SYMBOLLINE", - "T_CURSOR", "T_ELEMENTARC", "T_MARK", "T_GROUPS", "T_STYLES", - "T_POLYGON", "T_POLYGON_HOLE", "T_NETLIST", "T_NET", "T_CONN", - "T_NETLISTPATCH", "T_ADD_CONN", "T_DEL_CONN", "T_CHANGE_ATTRIB", - "T_AREA", "T_THERMAL", "T_DRC", "T_ATTRIBUTE", "T_UMIL", "T_CMIL", - "T_MIL", "T_IN", "T_NM", "T_UM", "T_MM", "T_M", "T_KM", "'['", "']'", - "'('", "')'", "$accept", "parse", "parsepcb", "$@1", "$@2", "parsedata", - "$@3", "pcbfont", "parsefont", "$@4", "pcbfileversion", "pcbname", - "pcbgrid", "pcbgridold", "pcbgridnew", "pcbhigrid", "pcbcursor", - "polyarea", "pcbthermal", "pcbdrc", "pcbdrc1", "pcbdrc2", "pcbdrc3", - "pcbflags", "pcbgroups", "pcbstyles", "pcbdata", "pcbdefinitions", - "pcbdefinition", "$@5", "$@6", "via", "via_hi_format", "via_2.0_format", - "via_1.7_format", "via_newformat", "via_oldformat", "rats", "layer", - "$@7", "layerdata", "layerdefinitions", "layerdefinition", "$@8", - "line_hi_format", "line_1.7_format", "line_oldformat", "arc_hi_format", - "arc_1.7_format", "arc_oldformat", "text_oldformat", "text_newformat", - "text_hi_format", "polygon_format", "$@9", "polygonholes", "polygonhole", - "$@10", "polygonpoints", "polygonpoint", "element", "element_oldformat", - "$@11", "element_1.3.4_format", "$@12", "element_newformat", "$@13", - "element_1.7_format", "$@14", "element_hi_format", "$@15", - "elementdefinitions", "elementdefinition", "$@16", "relementdefs", - "relementdef", "$@17", "pin_hi_format", "pin_1.7_format", - "pin_1.6.3_format", "pin_newformat", "pin_oldformat", "pad_hi_format", - "pad_1.7_format", "pad_newformat", "pad", "flags", "symbols", "symbol", - "symbolhead", "symbolid", "symboldata", "symboldefinition", - "hiressymbol", "pcbnetlist", "pcbnetdef", "nets", "netdefs", "net", - "$@18", "connections", "conndefs", "conn", "pcbnetlistpatch", - "pcbnetpatchdef", "netpatches", "netpatchdefs", "netpatch", "attribute", - "opt_string", "number", "measure", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 91, 93, 40, 41 -}; -# endif - -#define YYPACT_NINF -449 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-449))) - -#define YYTABLE_NINF -90 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 151, -449, 39, -449, 4, 30, -449, 23, -449, 56, - -449, 32, 97, -31, -449, -449, -449, -449, -449, -449, - -449, 73, -5, 26, -449, 169, -449, 88, 30, -449, - -449, -449, -449, -449, -449, -449, -449, 48, 56, -449, - -449, 129, 55, 116, 49, 113, 140, 63, 63, 63, - 63, -449, 95, -449, -449, 84, 84, -449, -16, 105, - 143, 157, 92, 147, -449, -449, -449, -449, -449, 158, - 161, 168, 176, -449, -449, 305, 63, 63, 63, 63, - 187, -449, -449, 63, 63, 134, -449, -449, -449, -449, - 63, 6, 63, 63, 160, 156, 191, 192, 63, 210, - -449, -449, -449, -449, -449, -449, -449, -449, -449, 63, - 63, 224, 229, 233, 196, 197, 63, 63, 63, -449, - 63, 63, 63, 63, 63, 218, 257, 272, 185, 63, - -449, 236, 63, 221, 63, 63, 245, 255, 270, 63, - 63, 274, 287, 63, 63, 63, 63, 63, 283, 302, - 63, 63, 63, 353, 312, 63, 362, 239, 63, 63, - -449, -449, -449, 63, 63, -449, -449, 378, 0, 63, - 63, 334, 63, 341, 372, -449, -449, -449, 63, 63, - 63, 342, -449, 63, 343, 394, 251, 397, 398, 63, - 63, 351, 350, -449, 354, 355, -449, 356, 63, 357, - 380, 63, 63, 63, 358, 260, 399, -449, 359, 408, - 409, 49, 410, 63, 63, -449, -449, -449, -449, -449, - 63, 228, 363, 389, 63, 63, 414, -449, 205, 226, - 366, 253, 367, 368, 260, -449, 88, -449, -449, -449, - -449, -449, -449, -449, -449, -449, -449, 49, -449, 369, - 417, 373, 370, 376, 375, 63, 379, 381, 424, 256, - 412, 63, 90, 384, 33, 63, 63, 63, 63, 63, - 63, 63, 49, -449, -449, -449, 385, -449, 386, -449, - -449, -449, -449, 11, -449, -449, 387, 433, 436, 195, - -449, 63, 390, 63, 393, 276, 403, 404, 279, 280, - 102, -449, 88, -449, -449, -449, -449, -449, 63, 63, - 63, 63, 63, 63, 63, 405, -449, -449, -449, 13, - -449, 391, 406, 416, 49, 411, 454, -449, 63, 63, - 63, 63, 63, 63, 63, 63, -449, -449, -449, 63, - 63, 63, 63, 63, 63, 63, 415, -449, 63, -449, - -449, 418, 427, -449, 413, -449, 419, 33, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 264, -449, 420, 421, 423, -449, -449, 425, - 33, 426, 121, 63, 63, 63, 63, 63, 63, 422, - 437, 63, 63, 63, 63, 458, 457, 465, 464, 320, - -449, 428, 438, -449, 183, -449, -449, 63, 63, 299, - 63, 63, 63, -449, -449, 63, 63, 63, 63, 439, - 49, 440, 473, 63, 63, -449, 320, 448, 442, 165, - -449, 165, 63, 63, 486, 490, 63, 63, 63, 49, - 2, 63, 63, -449, 445, -449, 444, 63, 63, -17, - -449, 446, 447, 448, -449, -10, 321, 326, 327, 330, - 222, -449, 88, -449, -449, -449, -449, 234, 450, 449, - 459, 352, 494, 63, 63, 460, 461, -449, 63, 110, - -449, -449, 462, 463, 466, -449, -449, 510, -449, -449, - 467, 468, 469, 478, -10, -449, 63, 63, 63, 63, - 63, 63, 63, 63, -449, -449, -449, -449, -449, -449, - -449, 479, 514, 383, 63, 63, -449, -449, 49, 480, - 519, -449, -449, -449, 529, 530, 531, 538, -449, -449, - 63, 63, 63, 63, 63, 63, 63, 63, -449, 493, - 495, 544, 502, 503, 506, -449, 505, 320, 507, 554, - 556, 557, 63, 63, 63, 63, 63, 63, 63, 63, - -449, -449, 515, -449, -449, -449, -449, 516, 518, 520, - 521, 562, 63, 63, 63, 63, 63, 63, 63, 63, - -449, -449, -449, -449, -449, 522, 63, 63, 63, 63, - 63, 63, 63, 63, 539, -449, 525, 524, 63, 63, - 63, 63, 63, 63, 526, 527, 539, -449, -449, -449, - 567, 574, 63, 63, 63, 63, 576, -449, -449, 577, - 578, 579, 580, 535, 534, 536, 49, 585, 586, 587, - -449, -449, -449, 542, 537, 49, 591, -449, -449, 545, - 546, -449, -449 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 5, 0, 2, 16, 0, 3, 0, 4, 0, - 1, 0, 0, 0, 9, 111, 112, 113, 114, 115, - 60, 0, 0, 0, 11, 0, 51, 0, 0, 53, - 61, 62, 63, 64, 65, 56, 57, 0, 15, 164, - 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 52, 0, 55, 59, 0, 0, 165, 0, 0, - 0, 0, 0, 29, 21, 22, 23, 162, 163, 0, - 0, 0, 0, 203, 204, 205, 0, 0, 0, 0, - 0, 169, 170, 0, 0, 0, 166, 172, 173, 17, - 0, 0, 0, 0, 0, 30, 0, 0, 0, 202, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, - 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, - 201, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 200, 167, 168, 0, 0, 20, 19, 0, 0, 0, - 0, 0, 0, 0, 43, 35, 36, 37, 0, 0, - 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 24, 0, 0, 31, 0, 0, 0, - 45, 0, 0, 0, 0, 76, 0, 70, 0, 0, - 0, 0, 0, 0, 0, 26, 25, 28, 27, 33, - 0, 0, 0, 48, 0, 0, 0, 116, 0, 0, - 0, 0, 0, 0, 75, 77, 0, 79, 80, 81, - 82, 83, 84, 88, 87, 86, 91, 0, 69, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 13, 0, 0, 0, 139, 0, 0, 0, 0, 0, - 0, 0, 0, 74, 78, 90, 0, 68, 0, 71, - 72, 175, 174, 0, 41, 42, 0, 0, 0, 0, - 12, 0, 204, 0, 0, 0, 0, 0, 0, 0, - 139, 126, 0, 128, 129, 130, 131, 132, 0, 0, - 0, 0, 0, 0, 0, 0, 66, 67, 38, 0, - 44, 0, 0, 177, 0, 0, 0, 118, 0, 0, - 0, 0, 0, 0, 0, 0, 117, 127, 140, 0, - 0, 0, 0, 0, 0, 0, 0, 39, 0, 47, - 46, 0, 191, 176, 0, 120, 0, 139, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 101, 0, 0, 0, 7, 190, 0, - 139, 0, 139, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, - 40, 0, 0, 124, 139, 122, 119, 0, 0, 0, - 0, 0, 0, 137, 138, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 103, 107, 180, 0, 151, - 121, 151, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 85, 0, 98, 0, 0, 0, 0, - 108, 0, 0, 179, 181, 194, 0, 0, 0, 0, - 151, 141, 0, 144, 143, 146, 145, 151, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 94, 0, 0, - 100, 99, 0, 0, 0, 102, 104, 0, 178, 182, - 0, 0, 0, 0, 193, 195, 0, 0, 0, 0, - 0, 0, 0, 0, 125, 142, 152, 123, 133, 134, - 157, 0, 0, 0, 0, 0, 92, 93, 0, 204, - 0, 110, 109, 105, 0, 0, 0, 0, 192, 196, - 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, - 0, 0, 0, 0, 0, 97, 0, 107, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 155, 161, 0, 135, 136, 95, 96, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 160, 106, 183, 197, 198, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 186, 199, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 185, 187, 147, 148, - 0, 0, 0, 0, 0, 0, 0, 184, 188, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 149, 150, 189, 0, 0, 0, 0, 153, 154, 0, - 0, 158, 159 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -449, -449, -449, -449, -449, -449, -449, -449, 336, -449, - -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, - -449, -449, -449, -449, -449, -449, 309, -449, 581, -449, - -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, - -449, -449, 365, -449, -449, -449, -449, -449, -449, -449, - -449, -449, -449, -449, -449, -449, -449, -449, -423, -449, - 573, -449, -449, -449, -449, -449, -449, -449, -449, -449, - -449, -339, -292, -449, 171, -448, -449, -449, -449, -449, - -449, -449, -449, -449, -449, -449, -190, -449, 565, -449, - 548, -449, -449, -449, -449, -449, -449, -449, 152, -449, - -449, -449, 1, -449, -449, -449, -449, 114, -231, -449, - -47, -48 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 2, 3, 4, 5, 6, 7, 289, 8, 9, - 12, 43, 63, 64, 65, 66, 95, 126, 149, 174, - 175, 176, 177, 200, 223, 260, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 205, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 399, 449, 486, 547, 425, 426, - 14, 15, 264, 16, 357, 17, 380, 18, 431, 19, - 429, 300, 301, 302, 460, 461, 462, 463, 464, 303, - 304, 305, 465, 466, 306, 307, 69, 38, 39, 40, - 83, 58, 87, 88, 352, 353, 452, 453, 454, 594, - 605, 606, 607, 377, 378, 493, 494, 495, 53, 131, - 75, 76 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int16 yytable[] = -{ - 77, 78, 79, 450, 192, 275, 476, 85, 337, 73, - 74, 11, 505, 484, 73, 74, 73, 74, 382, 505, - 44, 251, 45, -50, 20, 490, 491, 492, 109, 110, - 111, 112, 21, 22, 23, 114, 115, 485, 86, 10, - -58, 404, 118, 120, 121, 122, 47, 13, 48, 295, - 129, 296, 297, 67, 193, 68, 477, 276, 298, 299, - 119, 132, 133, 318, -54, 347, 73, 74, 139, 140, - 141, 338, 142, 143, 144, 145, 146, 49, 37, 50, - 152, 153, 315, 41, 155, 157, 158, 159, 81, 82, - 337, 163, 164, 73, 292, 167, 168, 169, 170, 55, - 171, 56, 178, 179, 180, 42, 60, 183, 61, 186, - 187, 188, 337, 73, 519, 189, 190, 70, 295, 71, - 296, 297, 194, 195, 567, 197, 46, 298, 299, 52, - 201, 202, 203, 59, 354, 206, 62, 295, 210, 296, - 297, 213, 214, 92, 72, 93, 298, 299, 80, 90, - 220, -10, 1, 224, 225, 226, 336, 89, -6, -6, - -10, -10, -10, 91, 96, 253, 254, 97, -8, -49, - 20, 94, 255, -14, 98, 406, 261, 262, 21, 22, - 23, 456, 99, 457, 458, 116, -58, 117, 73, 74, - 459, 151, -10, 113, 125, -50, 20, 127, 128, 295, - -49, 296, 297, -49, 21, 22, 23, 283, 298, 299, - -54, 123, -58, 124, 291, 293, 130, 308, 309, 310, - 311, 312, 313, 314, 73, 74, -50, 156, 134, -50, - 444, 506, 256, 135, 257, 319, -54, 430, 456, 136, - 457, 458, 73, 74, 324, 185, 326, 459, 137, 475, - 456, 138, 457, 458, 73, 74, 265, 209, 266, 459, - 339, 340, 341, 342, 343, 344, 345, 73, 74, 147, - 397, 348, 228, 229, 230, 231, 504, 267, 150, 268, - 358, 359, 360, 361, 362, 363, 364, 365, 507, 232, - 154, 366, 367, 368, 369, 370, 148, 371, 372, 160, - 374, -89, 73, 74, 270, 434, 271, 287, 161, 288, - 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 162, 396, 398, 165, 328, 544, 329, - 332, 334, 333, 335, 172, 407, 408, 409, 410, 411, - 412, 166, 173, 415, 416, 417, 418, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 511, 181, 512, 432, - 433, 435, 436, 437, 438, 182, 184, 439, 440, 441, - 442, 423, 496, 424, 497, 447, 448, 498, 500, 499, - 501, 502, 191, 503, 468, 469, 196, 540, 472, 541, - 473, 474, 198, 199, 478, 479, 204, 207, 208, 482, - 483, 211, 212, 215, 216, 247, 217, 222, 219, 218, - 221, 227, 249, 248, 252, 250, 258, 259, 263, 269, - 272, 278, 273, 277, 280, 279, 514, 515, 281, 282, - 286, 518, 520, 284, -14, 285, 633, 316, 294, 321, - 317, 320, 322, 349, 325, 639, 327, 351, 530, 531, - 532, 533, 534, 535, 536, 537, 330, 331, 356, 346, - 350, 376, 419, 420, 355, 379, 542, 543, 373, 421, - 422, 375, 400, 381, 413, 401, 402, 446, 403, 405, - 451, 427, 552, 553, 554, 555, 556, 557, 558, 559, - 470, 414, 428, 443, 445, 455, 471, 480, 481, 487, - 513, 488, 508, 509, 572, 573, 574, 575, 576, 577, - 578, 579, 516, 510, 521, 517, 524, 522, 539, 523, - 525, 526, 527, 546, 586, 587, 588, 589, 590, 591, - 592, 593, 528, 538, 545, 548, 549, 550, 596, 597, - 598, 599, 600, 601, 551, 602, 603, 560, 562, 561, - 610, 611, 612, 613, 563, 614, 615, 564, 565, 566, - 569, 568, 570, 571, 621, 622, 623, 624, 585, 580, - 581, 582, 604, 619, 583, 584, 595, 608, 609, 616, - 620, 617, 625, 626, 627, 628, 629, 630, 631, 634, - 632, 638, 635, 636, 637, 640, 290, 641, 323, 274, - 642, 54, 467, 57, 84, 489, 51, 618, 529 -}; - -static const yytype_uint16 yycheck[] = -{ - 48, 49, 50, 426, 4, 236, 4, 23, 300, 3, - 4, 7, 460, 30, 3, 4, 3, 4, 357, 467, - 51, 211, 53, 0, 1, 35, 36, 37, 76, 77, - 78, 79, 9, 10, 11, 83, 84, 54, 54, 0, - 17, 380, 90, 91, 92, 93, 51, 17, 53, 16, - 98, 18, 19, 4, 54, 6, 54, 247, 25, 26, - 54, 109, 110, 52, 41, 52, 3, 4, 116, 117, - 118, 302, 120, 121, 122, 123, 124, 51, 22, 53, - 128, 129, 272, 51, 132, 133, 134, 135, 4, 5, - 382, 139, 140, 3, 4, 143, 144, 145, 146, 51, - 147, 53, 150, 151, 152, 8, 51, 155, 53, 157, - 158, 159, 404, 3, 4, 163, 164, 4, 16, 6, - 18, 19, 169, 170, 547, 172, 53, 25, 26, 41, - 178, 179, 180, 4, 324, 183, 20, 16, 186, 18, - 19, 189, 190, 51, 4, 53, 25, 26, 53, 6, - 198, 0, 1, 201, 202, 203, 54, 52, 7, 8, - 9, 10, 11, 6, 6, 213, 214, 6, 17, 0, - 1, 24, 220, 22, 6, 54, 224, 225, 9, 10, - 11, 16, 6, 18, 19, 51, 17, 53, 3, 4, - 25, 6, 41, 6, 38, 0, 1, 6, 6, 16, - 31, 18, 19, 34, 9, 10, 11, 255, 25, 26, - 41, 51, 17, 53, 261, 262, 6, 265, 266, 267, - 268, 269, 270, 271, 3, 4, 31, 6, 4, 34, - 420, 462, 4, 4, 6, 283, 41, 54, 16, 6, - 18, 19, 3, 4, 291, 6, 293, 25, 52, 439, - 16, 54, 18, 19, 3, 4, 51, 6, 53, 25, - 308, 309, 310, 311, 312, 313, 314, 3, 4, 51, - 6, 319, 12, 13, 14, 15, 54, 51, 6, 53, - 328, 329, 330, 331, 332, 333, 334, 335, 54, 29, - 54, 339, 340, 341, 342, 343, 39, 344, 345, 54, - 348, 41, 3, 4, 51, 6, 53, 51, 53, 53, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 370, 53, 371, 372, 52, 51, 518, 53, - 51, 51, 53, 53, 51, 383, 384, 385, 386, 387, - 388, 54, 40, 391, 392, 393, 394, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 4, 4, 6, 407, - 408, 409, 410, 411, 412, 53, 4, 415, 416, 417, - 418, 51, 51, 53, 53, 423, 424, 51, 51, 53, - 53, 51, 4, 53, 432, 433, 52, 4, 436, 6, - 437, 438, 51, 21, 441, 442, 54, 54, 4, 447, - 448, 4, 4, 52, 54, 6, 52, 27, 52, 54, - 53, 53, 4, 54, 4, 6, 53, 28, 4, 53, - 53, 4, 54, 54, 54, 52, 473, 474, 52, 54, - 6, 478, 479, 54, 22, 54, 626, 52, 54, 6, - 54, 54, 6, 52, 54, 635, 53, 31, 496, 497, - 498, 499, 500, 501, 502, 503, 53, 53, 4, 54, - 54, 34, 4, 6, 53, 52, 514, 515, 53, 4, - 6, 53, 52, 54, 52, 54, 53, 4, 53, 53, - 32, 53, 530, 531, 532, 533, 534, 535, 536, 537, - 4, 54, 54, 54, 54, 53, 6, 52, 54, 53, - 6, 54, 52, 54, 552, 553, 554, 555, 556, 557, - 558, 559, 52, 54, 52, 54, 6, 54, 4, 53, - 53, 53, 53, 4, 572, 573, 574, 575, 576, 577, - 578, 579, 54, 54, 54, 6, 6, 6, 586, 587, - 588, 589, 590, 591, 6, 592, 593, 54, 4, 54, - 598, 599, 600, 601, 52, 602, 603, 54, 52, 54, - 6, 54, 6, 6, 612, 613, 614, 615, 6, 54, - 54, 53, 33, 6, 54, 54, 54, 52, 54, 53, - 6, 54, 6, 6, 6, 6, 6, 52, 54, 4, - 54, 54, 6, 6, 52, 4, 260, 52, 289, 234, - 54, 28, 431, 38, 56, 453, 25, 606, 494 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 1, 56, 57, 58, 59, 60, 61, 63, 64, - 0, 7, 65, 17, 115, 116, 118, 120, 122, 124, - 1, 9, 10, 11, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 22, 142, 143, - 144, 51, 8, 66, 51, 53, 53, 51, 53, 51, - 53, 83, 41, 163, 115, 51, 53, 143, 146, 4, - 51, 53, 20, 67, 68, 69, 70, 4, 6, 141, - 4, 6, 4, 3, 4, 165, 166, 166, 166, 166, - 53, 4, 5, 145, 145, 23, 54, 147, 148, 52, - 6, 6, 51, 53, 24, 71, 6, 6, 6, 6, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 166, - 166, 166, 166, 6, 166, 166, 51, 53, 166, 54, - 166, 166, 166, 51, 53, 38, 72, 6, 6, 166, - 6, 164, 166, 166, 4, 4, 6, 52, 54, 166, - 166, 166, 166, 166, 166, 166, 166, 51, 39, 73, - 6, 6, 166, 166, 54, 166, 6, 166, 166, 166, - 54, 53, 53, 166, 166, 52, 54, 166, 166, 166, - 166, 165, 51, 40, 74, 75, 76, 77, 166, 166, - 166, 4, 53, 166, 4, 6, 166, 166, 166, 166, - 166, 4, 4, 54, 165, 165, 52, 165, 51, 21, - 78, 166, 166, 166, 54, 94, 166, 54, 4, 6, - 166, 4, 4, 166, 166, 52, 54, 52, 54, 52, - 166, 53, 27, 79, 166, 166, 166, 53, 12, 13, - 14, 15, 29, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 6, 54, 4, - 6, 141, 4, 166, 166, 166, 4, 6, 53, 28, - 80, 166, 166, 4, 117, 51, 53, 51, 53, 53, - 51, 53, 53, 54, 97, 163, 141, 54, 4, 52, - 54, 52, 54, 166, 54, 54, 6, 51, 53, 62, - 63, 165, 4, 165, 54, 16, 18, 19, 25, 26, - 126, 127, 128, 134, 135, 136, 139, 140, 166, 166, - 166, 166, 166, 166, 166, 141, 52, 54, 52, 166, - 54, 6, 6, 81, 165, 54, 165, 53, 51, 53, - 53, 53, 51, 53, 51, 53, 54, 127, 163, 166, - 166, 166, 166, 166, 166, 166, 54, 52, 166, 52, - 54, 31, 149, 150, 141, 53, 4, 119, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 165, 165, 53, 166, 53, 34, 158, 159, 52, - 121, 54, 126, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 165, 6, 165, 109, - 52, 54, 53, 53, 126, 53, 54, 166, 166, 166, - 166, 166, 166, 52, 54, 166, 166, 166, 166, 4, - 6, 4, 6, 51, 53, 113, 114, 53, 54, 125, - 54, 123, 166, 166, 6, 166, 166, 166, 166, 166, - 166, 166, 166, 54, 141, 54, 4, 166, 166, 110, - 113, 32, 151, 152, 153, 53, 16, 18, 19, 25, - 129, 130, 131, 132, 133, 137, 138, 129, 166, 166, - 4, 6, 166, 165, 165, 141, 4, 54, 165, 165, - 52, 54, 166, 166, 30, 54, 111, 53, 54, 153, - 35, 36, 37, 160, 161, 162, 51, 53, 51, 53, - 51, 53, 51, 53, 54, 130, 163, 54, 52, 54, - 54, 4, 6, 6, 165, 165, 52, 54, 165, 4, - 165, 52, 54, 53, 6, 53, 53, 53, 54, 162, - 166, 166, 166, 166, 166, 166, 166, 166, 54, 4, - 4, 6, 166, 166, 141, 54, 4, 112, 6, 6, - 6, 6, 166, 166, 166, 166, 166, 166, 166, 166, - 54, 54, 4, 52, 54, 52, 54, 113, 54, 6, - 6, 6, 166, 166, 166, 166, 166, 166, 166, 166, - 54, 54, 53, 54, 54, 6, 166, 166, 166, 166, - 166, 166, 166, 166, 154, 54, 166, 166, 166, 166, - 166, 166, 165, 165, 33, 155, 156, 157, 52, 54, - 166, 166, 166, 166, 165, 165, 53, 54, 157, 6, - 6, 166, 166, 166, 166, 6, 6, 6, 6, 6, - 52, 54, 54, 141, 4, 6, 6, 52, 54, 141, - 4, 52, 54 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 55, 56, 56, 56, 56, 58, 57, 59, 57, - 61, 60, 62, 62, 64, 63, 65, 65, 66, 66, - 66, 67, 67, 67, 68, 69, 70, 71, 71, 71, - 72, 72, 73, 73, 74, 74, 74, 74, 75, 76, - 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, - 81, 82, 82, 83, 84, 83, 83, 83, 85, 83, - 83, 86, 86, 86, 86, 86, 87, 88, 89, 90, - 91, 92, 92, 94, 93, 95, 95, 96, 96, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, - 97, 97, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 109, 108, 110, 110, 112, 111, 113, 113, 114, - 114, 115, 115, 115, 115, 115, 117, 116, 119, 118, - 121, 120, 123, 122, 125, 124, 126, 126, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, - 127, 129, 129, 130, 130, 130, 130, 130, 130, 130, - 130, 131, 130, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 141, 142, 142, 143, 144, 144, 145, - 145, 146, 146, 146, 147, 148, 149, 149, 150, 151, - 151, 152, 152, 154, 153, 155, 155, 156, 156, 157, - 158, 158, 159, 160, 160, 161, 161, 162, 162, 162, - 163, 164, 164, 165, 165, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 1, 0, 15, 0, 2, - 0, 2, 1, 0, 0, 2, 0, 4, 4, 6, - 6, 1, 1, 1, 6, 7, 7, 6, 6, 0, - 0, 4, 0, 4, 0, 1, 1, 1, 6, 7, - 9, 4, 4, 0, 4, 0, 4, 4, 0, 1, - 0, 1, 2, 1, 0, 2, 1, 1, 0, 2, - 1, 1, 1, 1, 1, 1, 11, 11, 10, 9, - 8, 10, 10, 0, 10, 1, 0, 1, 2, 1, - 1, 1, 1, 1, 1, 8, 1, 1, 1, 0, - 2, 1, 10, 10, 9, 12, 12, 11, 8, 9, - 9, 0, 9, 0, 2, 0, 5, 0, 2, 4, - 4, 1, 1, 1, 1, 1, 0, 12, 0, 15, - 0, 16, 0, 18, 0, 18, 1, 2, 1, 1, - 1, 1, 1, 8, 8, 10, 10, 5, 5, 0, - 2, 1, 2, 1, 1, 1, 1, 8, 8, 10, - 10, 0, 2, 12, 12, 10, 9, 8, 13, 13, - 11, 10, 1, 1, 1, 2, 3, 6, 6, 1, - 1, 0, 2, 2, 8, 8, 1, 0, 6, 1, - 0, 1, 2, 0, 9, 1, 0, 1, 2, 4, - 1, 0, 6, 1, 0, 1, 2, 5, 5, 6, - 5, 1, 0, 1, 1, 1, 2, 2, 2, 2, - 2, 2, 2, 2, 2 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -{ - YYUSE (yyvaluep); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (void) -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 5: -#line 148 "parse_y.y" /* yacc.c:1646 */ - { YYABORT; } -#line 1792 "parse_y.c" /* yacc.c:1646 */ - break; - - case 6: -#line 172 "parse_y.y" /* yacc.c:1646 */ - { - /* reset flags for 'used layers'; - * init font and data pointers - */ - int i; - - if (!yyPCB) - { - Message(PCB_MSG_ERROR, "illegal fileformat\n"); - YYABORT; - } - for (i = 0; i < MAX_LAYER + 2; i++) - LayerFlag[i] = pcb_false; - yyFont = &yyPCB->Font; - yyData = yyPCB->Data; - yyData->pcb = yyPCB; - yyData->LayerN = 0; - yyPCB->NetlistPatches = yyPCB->NetlistPatchLast = NULL; - layer_group_string = NULL; - } -#line 1817 "parse_y.c" /* yacc.c:1646 */ - break; - - case 7: -#line 206 "parse_y.y" /* yacc.c:1646 */ - { - PCBTypePtr pcb_save = PCB; - if ((yy_settings_dest != CFR_invalid) && (layer_group_string != NULL)) - conf_set(yy_settings_dest, "design/groups", -1, layer_group_string, POL_OVERWRITE); - CreateNewPCBPost (yyPCB, 0); - if (ParseGroupString(layer_group_string, &yyPCB->LayerGroups, yyData->LayerN)) - { - Message(PCB_MSG_ERROR, "illegal layer-group string\n"); - YYABORT; - } - /* initialize the polygon clipping now since - * we didn't know the layer grouping before. - */ - free(layer_group_string); - PCB = yyPCB; - ALLPOLYGON_LOOP (yyData); - { - InitClip (yyData, layer, polygon); - } - ENDALL_LOOP; - PCB = pcb_save; - } -#line 1844 "parse_y.c" /* yacc.c:1646 */ - break; - - case 8: -#line 229 "parse_y.y" /* yacc.c:1646 */ - { PreLoadElementPCB (); - layer_group_string = NULL; } -#line 1851 "parse_y.c" /* yacc.c:1646 */ - break; - - case 9: -#line 232 "parse_y.y" /* yacc.c:1646 */ - { LayerFlag[0] = pcb_true; - LayerFlag[1] = pcb_true; - yyData->LayerN = 2; - PostLoadElementPCB (); - } -#line 1861 "parse_y.c" /* yacc.c:1646 */ - break; - - case 10: -#line 240 "parse_y.y" /* yacc.c:1646 */ - { - /* reset flags for 'used layers'; - * init font and data pointers - */ - int i; - - if (!yyData || !yyFont) - { - Message(PCB_MSG_ERROR, "illegal fileformat\n"); - YYABORT; - } - for (i = 0; i < MAX_LAYER + 2; i++) - LayerFlag[i] = pcb_false; - yyData->LayerN = 0; - } -#line 1881 "parse_y.c" /* yacc.c:1646 */ - break; - - case 14: -#line 265 "parse_y.y" /* yacc.c:1646 */ - { - /* mark all symbols invalid */ - int i; - - if (!yyFont) - { - Message(PCB_MSG_ERROR, "illegal fileformat\n"); - YYABORT; - } - yyFont->Valid = pcb_false; - for (i = 0; i <= MAX_FONTPOSITION; i++) - free (yyFont->Symbol[i].Line); - memset(yyFont->Symbol, 0, sizeof(yyFont->Symbol)); - } -#line 1900 "parse_y.c" /* yacc.c:1646 */ - break; - - case 15: -#line 280 "parse_y.y" /* yacc.c:1646 */ - { - yyFont->Valid = pcb_true; - SetFontInfo(yyFont); - } -#line 1909 "parse_y.c" /* yacc.c:1646 */ - break; - - case 17: -#line 308 "parse_y.y" /* yacc.c:1646 */ - { - if (check_file_version ((yyvsp[-1].integer)) != 0) - { - YYABORT; - } -} -#line 1920 "parse_y.c" /* yacc.c:1646 */ - break; - - case 18: -#line 338 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Name = (yyvsp[-1].string); - yyPCB->MaxWidth = MAX_COORD; - yyPCB->MaxHeight = MAX_COORD; - } -#line 1930 "parse_y.c" /* yacc.c:1646 */ - break; - - case 19: -#line 344 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Name = (yyvsp[-3].string); - yyPCB->MaxWidth = OU ((yyvsp[-2].measure)); - yyPCB->MaxHeight = OU ((yyvsp[-1].measure)); - } -#line 1940 "parse_y.c" /* yacc.c:1646 */ - break; - - case 20: -#line 350 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Name = (yyvsp[-3].string); - yyPCB->MaxWidth = NU ((yyvsp[-2].measure)); - yyPCB->MaxHeight = NU ((yyvsp[-1].measure)); - } -#line 1950 "parse_y.c" /* yacc.c:1646 */ - break; - - case 24: -#line 384 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Grid = OU ((yyvsp[-3].measure)); - yyPCB->GridOffsetX = OU ((yyvsp[-2].measure)); - yyPCB->GridOffsetY = OU ((yyvsp[-1].measure)); - } -#line 1960 "parse_y.c" /* yacc.c:1646 */ - break; - - case 25: -#line 392 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Grid = OU ((yyvsp[-4].measure)); - yyPCB->GridOffsetX = OU ((yyvsp[-3].measure)); - yyPCB->GridOffsetY = OU ((yyvsp[-2].measure)); - if (yy_settings_dest != CFR_invalid) { - if ((yyvsp[-1].integer)) - conf_set(yy_settings_dest, "editor/draw_grid", -1, "true", POL_OVERWRITE); - else - conf_set(yy_settings_dest, "editor/draw_grid", -1, "false", POL_OVERWRITE); - } - } -#line 1976 "parse_y.c" /* yacc.c:1646 */ - break; - - case 26: -#line 407 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Grid = NU ((yyvsp[-4].measure)); - yyPCB->GridOffsetX = NU ((yyvsp[-3].measure)); - yyPCB->GridOffsetY = NU ((yyvsp[-2].measure)); - if (yy_settings_dest != CFR_invalid) { - if ((yyvsp[-1].integer)) - conf_set(yy_settings_dest, "editor/draw_grid", -1, "true", POL_OVERWRITE); - else - conf_set(yy_settings_dest, "editor/draw_grid", -1, "false", POL_OVERWRITE); - } - } -#line 1992 "parse_y.c" /* yacc.c:1646 */ - break; - - case 27: -#line 441 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->CursorX = OU ((yyvsp[-3].measure)); - yyPCB->CursorY = OU ((yyvsp[-2].measure)); - yyPCB->Zoom = (yyvsp[-1].number)*2; - } -#line 2002 "parse_y.c" /* yacc.c:1646 */ - break; - - case 28: -#line 447 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->CursorX = NU ((yyvsp[-3].measure)); - yyPCB->CursorY = NU ((yyvsp[-2].measure)); - yyPCB->Zoom = (yyvsp[-1].number); - } -#line 2012 "parse_y.c" /* yacc.c:1646 */ - break; - - case 31: -#line 471 "parse_y.y" /* yacc.c:1646 */ - { - /* Read in cmil^2 for now; in future this should be a noop. */ - yyPCB->IsleArea = PCB_MIL_TO_COORD (PCB_MIL_TO_COORD ((yyvsp[-1].number)) / 100.0) / 100.0; - } -#line 2021 "parse_y.c" /* yacc.c:1646 */ - break; - - case 33: -#line 498 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->ThermScale = (yyvsp[-1].number); - } -#line 2029 "parse_y.c" /* yacc.c:1646 */ - break; - - case 38: -#line 537 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Bloat = NU ((yyvsp[-3].measure)); - yyPCB->Shrink = NU ((yyvsp[-2].measure)); - yyPCB->minWid = NU ((yyvsp[-1].measure)); - yyPCB->minRing = NU ((yyvsp[-1].measure)); - } -#line 2040 "parse_y.c" /* yacc.c:1646 */ - break; - - case 39: -#line 547 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Bloat = NU ((yyvsp[-4].measure)); - yyPCB->Shrink = NU ((yyvsp[-3].measure)); - yyPCB->minWid = NU ((yyvsp[-2].measure)); - yyPCB->minSlk = NU ((yyvsp[-1].measure)); - yyPCB->minRing = NU ((yyvsp[-2].measure)); - } -#line 2052 "parse_y.c" /* yacc.c:1646 */ - break; - - case 40: -#line 558 "parse_y.y" /* yacc.c:1646 */ - { - yyPCB->Bloat = NU ((yyvsp[-6].measure)); - yyPCB->Shrink = NU ((yyvsp[-5].measure)); - yyPCB->minWid = NU ((yyvsp[-4].measure)); - yyPCB->minSlk = NU ((yyvsp[-3].measure)); - yyPCB->minDrill = NU ((yyvsp[-2].measure)); - yyPCB->minRing = NU ((yyvsp[-1].measure)); - } -#line 2065 "parse_y.c" /* yacc.c:1646 */ - break; - - case 41: -#line 585 "parse_y.y" /* yacc.c:1646 */ - { - yy_pcb_flags = MakeFlags ((yyvsp[-1].integer) & PCB_FLAGS); - } -#line 2073 "parse_y.c" /* yacc.c:1646 */ - break; - - case 42: -#line 589 "parse_y.y" /* yacc.c:1646 */ - { - yy_pcb_flags = string_to_pcbflags ((yyvsp[-1].string), yyerror); - free((yyvsp[-1].string)); - } -#line 2082 "parse_y.c" /* yacc.c:1646 */ - break; - - case 44: -#line 622 "parse_y.y" /* yacc.c:1646 */ - { - layer_group_string = (yyvsp[-1].string); - } -#line 2090 "parse_y.c" /* yacc.c:1646 */ - break; - - case 46: -#line 670 "parse_y.y" /* yacc.c:1646 */ - { - if (ParseRouteString((yyvsp[-1].string), &yyPCB->RouteStyle, "mil")) - { - Message(PCB_MSG_ERROR, "illegal route-style string\n"); - YYABORT; - } - free((yyvsp[-1].string)); - } -#line 2103 "parse_y.c" /* yacc.c:1646 */ - break; - - case 47: -#line 679 "parse_y.y" /* yacc.c:1646 */ - { - if (ParseRouteString(((yyvsp[-1].string) == NULL ? "" : (yyvsp[-1].string)), &yyPCB->RouteStyle, "cmil")) - { - Message(PCB_MSG_ERROR, "illegal route-style string\n"); - YYABORT; - } - free((yyvsp[-1].string)); - } -#line 2116 "parse_y.c" /* yacc.c:1646 */ - break; - - case 54: -#line 702 "parse_y.y" /* yacc.c:1646 */ - { attr_list = & yyPCB->Attributes; } -#line 2122 "parse_y.c" /* yacc.c:1646 */ - break; - - case 58: -#line 706 "parse_y.y" /* yacc.c:1646 */ - { - /* clear pointer to force memory allocation by - * the appropriate subroutine - */ - yyElement = NULL; - } -#line 2133 "parse_y.c" /* yacc.c:1646 */ - break; - - case 60: -#line 713 "parse_y.y" /* yacc.c:1646 */ - { YYABORT; } -#line 2139 "parse_y.c" /* yacc.c:1646 */ - break; - - case 66: -#line 758 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewVia(yyData, NU ((yyvsp[-8].measure)), NU ((yyvsp[-7].measure)), NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), - NU ((yyvsp[-3].measure)), (yyvsp[-2].string), (yyvsp[-1].flagtype)); - free ((yyvsp[-2].string)); - } -#line 2149 "parse_y.c" /* yacc.c:1646 */ - break; - - case 67: -#line 768 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewVia(yyData, OU ((yyvsp[-8].measure)), OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), (yyvsp[-2].string), - OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2159 "parse_y.c" /* yacc.c:1646 */ - break; - - case 68: -#line 779 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewVia(yyData, OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), - OU ((yyvsp[-5].measure)) + OU((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2169 "parse_y.c" /* yacc.c:1646 */ - break; - - case 69: -#line 789 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewVia(yyData, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), 2*GROUNDPLANEFRAME, - OU((yyvsp[-4].measure)) + 2*MASKFRAME, OU ((yyvsp[-3].measure)), (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2179 "parse_y.c" /* yacc.c:1646 */ - break; - - case 70: -#line 799 "parse_y.y" /* yacc.c:1646 */ - { - Coord hole = (OU((yyvsp[-3].measure)) * DEFAULT_DRILLINGHOLE); - - /* make sure that there's enough copper left */ - if (OU((yyvsp[-3].measure)) - hole < MIN_PINORVIACOPPER && - OU((yyvsp[-3].measure)) > MIN_PINORVIACOPPER) - hole = OU((yyvsp[-3].measure)) - MIN_PINORVIACOPPER; - - CreateNewVia(yyData, OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), 2*GROUNDPLANEFRAME, - OU((yyvsp[-3].measure)) + 2*MASKFRAME, hole, (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2196 "parse_y.c" /* yacc.c:1646 */ - break; - - case 71: -#line 835 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewRat(yyData, NU ((yyvsp[-7].measure)), NU ((yyvsp[-6].measure)), NU ((yyvsp[-4].measure)), NU ((yyvsp[-3].measure)), (yyvsp[-5].integer), (yyvsp[-2].integer), - conf_core.appearance.rat_thickness, (yyvsp[-1].flagtype)); - } -#line 2205 "parse_y.c" /* yacc.c:1646 */ - break; - - case 72: -#line 840 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewRat(yyData, OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), (yyvsp[-5].integer), (yyvsp[-2].integer), - conf_core.appearance.rat_thickness, OldFlags((yyvsp[-1].integer))); - } -#line 2214 "parse_y.c" /* yacc.c:1646 */ - break; - - case 73: -#line 871 "parse_y.y" /* yacc.c:1646 */ - { - if ((yyvsp[-4].integer) <= 0 || (yyvsp[-4].integer) > MAX_LAYER + 2) - { - yyerror("Layernumber out of range"); - YYABORT; - } - if (LayerFlag[(yyvsp[-4].integer)-1]) - { - yyerror("Layernumber used twice"); - YYABORT; - } - Layer = &yyData->Layer[(yyvsp[-4].integer)-1]; - - /* memory for name is already allocated */ - if (Layer->Name != NULL) - free((char*)Layer->Name); - Layer->Name = (yyvsp[-3].string); /* shouldn't this be strdup()'ed ? */ - LayerFlag[(yyvsp[-4].integer)-1] = pcb_true; - if (yyData->LayerN + 2 < (yyvsp[-4].integer)) - yyData->LayerN = (yyvsp[-4].integer) - 2; - if ((yyvsp[-2].string) != NULL) - free((yyvsp[-2].string)); - } -#line 2242 "parse_y.c" /* yacc.c:1646 */ - break; - - case 85: -#line 916 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPolygonFromRectangle(Layer, - OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-5].measure)) + OU ((yyvsp[-3].measure)), OU ((yyvsp[-4].measure)) + OU ((yyvsp[-2].measure)), OldFlags((yyvsp[-1].integer))); - } -#line 2251 "parse_y.c" /* yacc.c:1646 */ - break; - - case 89: -#line 923 "parse_y.y" /* yacc.c:1646 */ - { attr_list = & Layer->Attributes; } -#line 2257 "parse_y.c" /* yacc.c:1646 */ - break; - - case 92: -#line 955 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineOnLayer(Layer, NU ((yyvsp[-7].measure)), NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), - NU ((yyvsp[-3].measure)), NU ((yyvsp[-2].measure)), (yyvsp[-1].flagtype)); - } -#line 2266 "parse_y.c" /* yacc.c:1646 */ - break; - - case 93: -#line 964 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineOnLayer(Layer, OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), - OU ((yyvsp[-3].measure)), OU ((yyvsp[-2].measure)), OldFlags((yyvsp[-1].integer))); - } -#line 2275 "parse_y.c" /* yacc.c:1646 */ - break; - - case 94: -#line 973 "parse_y.y" /* yacc.c:1646 */ - { - /* eliminate old-style rat-lines */ - if ((IV ((yyvsp[-1].measure)) & PCB_FLAG_RAT) == 0) - CreateNewLineOnLayer(Layer, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), OU ((yyvsp[-2].measure)), - 200*GROUNDPLANEFRAME, OldFlags(IV ((yyvsp[-1].measure)))); - } -#line 2286 "parse_y.c" /* yacc.c:1646 */ - break; - - case 95: -#line 1021 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewArcOnLayer(Layer, NU ((yyvsp[-9].measure)), NU ((yyvsp[-8].measure)), NU ((yyvsp[-7].measure)), NU ((yyvsp[-6].measure)), (yyvsp[-3].number), (yyvsp[-2].number), - NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), (yyvsp[-1].flagtype)); - } -#line 2295 "parse_y.c" /* yacc.c:1646 */ - break; - - case 96: -#line 1030 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewArcOnLayer(Layer, OU ((yyvsp[-9].measure)), OU ((yyvsp[-8].measure)), OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), (yyvsp[-3].number), (yyvsp[-2].number), - OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OldFlags((yyvsp[-1].integer))); - } -#line 2304 "parse_y.c" /* yacc.c:1646 */ - break; - - case 97: -#line 1039 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewArcOnLayer(Layer, OU ((yyvsp[-8].measure)), OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-6].measure)), IV ((yyvsp[-3].measure)), (yyvsp[-2].number), - OU ((yyvsp[-4].measure)), 200*GROUNDPLANEFRAME, OldFlags((yyvsp[-1].integer))); - } -#line 2313 "parse_y.c" /* yacc.c:1646 */ - break; - - case 98: -#line 1076 "parse_y.y" /* yacc.c:1646 */ - { - /* use a default scale of 100% */ - CreateNewText(Layer,yyFont,OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), (yyvsp[-3].number), 100, (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2323 "parse_y.c" /* yacc.c:1646 */ - break; - - case 99: -#line 1086 "parse_y.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].integer) & PCB_FLAG_ONSILK) - { - LayerTypePtr lay = &yyData->Layer[yyData->LayerN + - (((yyvsp[-1].integer) & PCB_FLAG_ONSOLDER) ? SOLDER_LAYER : COMPONENT_LAYER)]; - - CreateNewText(lay ,yyFont, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), (yyvsp[-2].string), - OldFlags((yyvsp[-1].integer))); - } - else - CreateNewText(Layer, yyFont, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), (yyvsp[-2].string), - OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2342 "parse_y.c" /* yacc.c:1646 */ - break; - - case 100: -#line 1104 "parse_y.y" /* yacc.c:1646 */ - { - /* FIXME: shouldn't know about .f */ - /* I don't think this matters because anything with hi_format - * will have the silk on its own layer in the file rather - * than using the PCB_FLAG_ONSILK and having it in a copper layer. - * Thus there is no need for anything besides the 'else' - * part of this code. - */ - if ((yyvsp[-1].flagtype).f & PCB_FLAG_ONSILK) - { - LayerTypePtr lay = &yyData->Layer[yyData->LayerN + - (((yyvsp[-1].flagtype).f & PCB_FLAG_ONSOLDER) ? SOLDER_LAYER : COMPONENT_LAYER)]; - - CreateNewText(lay, yyFont, NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), (yyvsp[-2].string), (yyvsp[-1].flagtype)); - } - else - CreateNewText(Layer, yyFont, NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), (yyvsp[-2].string), (yyvsp[-1].flagtype)); - free ((yyvsp[-2].string)); - } -#line 2366 "parse_y.c" /* yacc.c:1646 */ - break; - - case 101: -#line 1153 "parse_y.y" /* yacc.c:1646 */ - { - Polygon = CreateNewPolygon(Layer, (yyvsp[-2].flagtype)); - } -#line 2374 "parse_y.c" /* yacc.c:1646 */ - break; - - case 102: -#line 1158 "parse_y.y" /* yacc.c:1646 */ - { - pcb_cardinal_t contour, contour_start, contour_end; - pcb_bool bad_contour_found = pcb_false; - /* ignore junk */ - for (contour = 0; contour <= Polygon->HoleIndexN; contour++) - { - contour_start = (contour == 0) ? - 0 : Polygon->HoleIndex[contour - 1]; - contour_end = (contour == Polygon->HoleIndexN) ? - Polygon->PointN : - Polygon->HoleIndex[contour]; - if (contour_end - contour_start < 3) - bad_contour_found = pcb_true; - } - - if (bad_contour_found) - { - Message(PCB_MSG_WARNING, "WARNING parsing file '%s'\n" - " line: %i\n" - " description: 'ignored polygon (< 3 points in a contour)'\n", - yyfilename, pcb_lineno); - DestroyObject(yyData, PCB_TYPE_POLYGON, Layer, Polygon, Polygon); - } - else - { - SetPolygonBoundingBox (Polygon); - if (!Layer->polygon_tree) - Layer->polygon_tree = r_create_tree (NULL, 0, 0); - r_insert_entry (Layer->polygon_tree, (BoxType *) Polygon, 0); - } - } -#line 2410 "parse_y.c" /* yacc.c:1646 */ - break; - - case 105: -#line 1198 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewHoleInPolygon (Polygon); - } -#line 2418 "parse_y.c" /* yacc.c:1646 */ - break; - - case 109: -#line 1212 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPointInPolygon(Polygon, OU ((yyvsp[-2].measure)), OU ((yyvsp[-1].measure))); - } -#line 2426 "parse_y.c" /* yacc.c:1646 */ - break; - - case 110: -#line 1216 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPointInPolygon(Polygon, NU ((yyvsp[-2].measure)), NU ((yyvsp[-1].measure))); - } -#line 2434 "parse_y.c" /* yacc.c:1646 */ - break; - - case 116: -#line 1287 "parse_y.y" /* yacc.c:1646 */ - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, NoFlags(), - (yyvsp[-6].string), (yyvsp[-5].string), NULL, OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), (yyvsp[-2].integer), 100, NoFlags(), pcb_false); - free ((yyvsp[-6].string)); - free ((yyvsp[-5].string)); - pin_num = 1; - } -#line 2446 "parse_y.c" /* yacc.c:1646 */ - break; - - case 117: -#line 1295 "parse_y.y" /* yacc.c:1646 */ - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } -#line 2454 "parse_y.c" /* yacc.c:1646 */ - break; - - case 118: -#line 1305 "parse_y.y" /* yacc.c:1646 */ - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags((yyvsp[-9].integer)), - (yyvsp[-8].string), (yyvsp[-7].string), NULL, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), IV ((yyvsp[-4].measure)), IV ((yyvsp[-3].measure)), OldFlags((yyvsp[-2].integer)), pcb_false); - free ((yyvsp[-8].string)); - free ((yyvsp[-7].string)); - pin_num = 1; - } -#line 2466 "parse_y.c" /* yacc.c:1646 */ - break; - - case 119: -#line 1313 "parse_y.y" /* yacc.c:1646 */ - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } -#line 2474 "parse_y.c" /* yacc.c:1646 */ - break; - - case 120: -#line 1323 "parse_y.y" /* yacc.c:1646 */ - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags((yyvsp[-10].integer)), - (yyvsp[-9].string), (yyvsp[-8].string), (yyvsp[-7].string), OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), IV ((yyvsp[-4].measure)), IV ((yyvsp[-3].measure)), OldFlags((yyvsp[-2].integer)), pcb_false); - free ((yyvsp[-9].string)); - free ((yyvsp[-8].string)); - free ((yyvsp[-7].string)); - pin_num = 1; - } -#line 2487 "parse_y.c" /* yacc.c:1646 */ - break; - - case 121: -#line 1332 "parse_y.y" /* yacc.c:1646 */ - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } -#line 2495 "parse_y.c" /* yacc.c:1646 */ - break; - - case 122: -#line 1343 "parse_y.y" /* yacc.c:1646 */ - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags((yyvsp[-12].integer)), - (yyvsp[-11].string), (yyvsp[-10].string), (yyvsp[-9].string), OU ((yyvsp[-8].measure)) + OU ((yyvsp[-6].measure)), OU ((yyvsp[-7].measure)) + OU ((yyvsp[-5].measure)), - (yyvsp[-4].number), (yyvsp[-3].number), OldFlags((yyvsp[-2].integer)), pcb_false); - yyElement->MarkX = OU ((yyvsp[-8].measure)); - yyElement->MarkY = OU ((yyvsp[-7].measure)); - free ((yyvsp[-11].string)); - free ((yyvsp[-10].string)); - free ((yyvsp[-9].string)); - } -#line 2510 "parse_y.c" /* yacc.c:1646 */ - break; - - case 123: -#line 1354 "parse_y.y" /* yacc.c:1646 */ - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } -#line 2518 "parse_y.c" /* yacc.c:1646 */ - break; - - case 124: -#line 1365 "parse_y.y" /* yacc.c:1646 */ - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, (yyvsp[-12].flagtype), - (yyvsp[-11].string), (yyvsp[-10].string), (yyvsp[-9].string), NU ((yyvsp[-8].measure)) + NU ((yyvsp[-6].measure)), NU ((yyvsp[-7].measure)) + NU ((yyvsp[-5].measure)), - (yyvsp[-4].number), (yyvsp[-3].number), (yyvsp[-2].flagtype), pcb_false); - yyElement->MarkX = NU ((yyvsp[-8].measure)); - yyElement->MarkY = NU ((yyvsp[-7].measure)); - free ((yyvsp[-11].string)); - free ((yyvsp[-10].string)); - free ((yyvsp[-9].string)); - } -#line 2533 "parse_y.c" /* yacc.c:1646 */ - break; - - case 125: -#line 1376 "parse_y.y" /* yacc.c:1646 */ - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } -#line 2541 "parse_y.c" /* yacc.c:1646 */ - break; - - case 133: -#line 1456 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineInElement(yyElement, NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), NU ((yyvsp[-3].measure)), NU ((yyvsp[-2].measure)), NU ((yyvsp[-1].measure))); - } -#line 2549 "parse_y.c" /* yacc.c:1646 */ - break; - - case 134: -#line 1461 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineInElement(yyElement, OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), OU ((yyvsp[-2].measure)), OU ((yyvsp[-1].measure))); - } -#line 2557 "parse_y.c" /* yacc.c:1646 */ - break; - - case 135: -#line 1466 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewArcInElement(yyElement, NU ((yyvsp[-7].measure)), NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), (yyvsp[-3].number), (yyvsp[-2].number), NU ((yyvsp[-1].measure))); - } -#line 2565 "parse_y.c" /* yacc.c:1646 */ - break; - - case 136: -#line 1471 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewArcInElement(yyElement, OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), (yyvsp[-3].number), (yyvsp[-2].number), OU ((yyvsp[-1].measure))); - } -#line 2573 "parse_y.c" /* yacc.c:1646 */ - break; - - case 137: -#line 1476 "parse_y.y" /* yacc.c:1646 */ - { - yyElement->MarkX = NU ((yyvsp[-2].measure)); - yyElement->MarkY = NU ((yyvsp[-1].measure)); - } -#line 2582 "parse_y.c" /* yacc.c:1646 */ - break; - - case 138: -#line 1481 "parse_y.y" /* yacc.c:1646 */ - { - yyElement->MarkX = OU ((yyvsp[-2].measure)); - yyElement->MarkY = OU ((yyvsp[-1].measure)); - } -#line 2591 "parse_y.c" /* yacc.c:1646 */ - break; - - case 139: -#line 1485 "parse_y.y" /* yacc.c:1646 */ - { attr_list = & yyElement->Attributes; } -#line 2597 "parse_y.c" /* yacc.c:1646 */ - break; - - case 147: -#line 1500 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineInElement(yyElement, NU ((yyvsp[-5].measure)) + yyElement->MarkX, - NU ((yyvsp[-4].measure)) + yyElement->MarkY, NU ((yyvsp[-3].measure)) + yyElement->MarkX, - NU ((yyvsp[-2].measure)) + yyElement->MarkY, NU ((yyvsp[-1].measure))); - } -#line 2607 "parse_y.c" /* yacc.c:1646 */ - break; - - case 148: -#line 1506 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineInElement(yyElement, OU ((yyvsp[-5].measure)) + yyElement->MarkX, - OU ((yyvsp[-4].measure)) + yyElement->MarkY, OU ((yyvsp[-3].measure)) + yyElement->MarkX, - OU ((yyvsp[-2].measure)) + yyElement->MarkY, OU ((yyvsp[-1].measure))); - } -#line 2617 "parse_y.c" /* yacc.c:1646 */ - break; - - case 149: -#line 1513 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewArcInElement(yyElement, NU ((yyvsp[-7].measure)) + yyElement->MarkX, - NU ((yyvsp[-6].measure)) + yyElement->MarkY, NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), (yyvsp[-3].number), (yyvsp[-2].number), NU ((yyvsp[-1].measure))); - } -#line 2626 "parse_y.c" /* yacc.c:1646 */ - break; - - case 150: -#line 1518 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewArcInElement(yyElement, OU ((yyvsp[-7].measure)) + yyElement->MarkX, - OU ((yyvsp[-6].measure)) + yyElement->MarkY, OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), (yyvsp[-3].number), (yyvsp[-2].number), OU ((yyvsp[-1].measure))); - } -#line 2635 "parse_y.c" /* yacc.c:1646 */ - break; - - case 151: -#line 1522 "parse_y.y" /* yacc.c:1646 */ - { attr_list = & yyElement->Attributes; } -#line 2641 "parse_y.c" /* yacc.c:1646 */ - break; - - case 153: -#line 1564 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPin(yyElement, NU ((yyvsp[-9].measure)) + yyElement->MarkX, - NU ((yyvsp[-8].measure)) + yyElement->MarkY, NU ((yyvsp[-7].measure)), NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), (yyvsp[-3].string), - (yyvsp[-2].string), (yyvsp[-1].flagtype)); - free ((yyvsp[-3].string)); - free ((yyvsp[-2].string)); - } -#line 2653 "parse_y.c" /* yacc.c:1646 */ - break; - - case 154: -#line 1576 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPin(yyElement, OU ((yyvsp[-9].measure)) + yyElement->MarkX, - OU ((yyvsp[-8].measure)) + yyElement->MarkY, OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), (yyvsp[-3].string), - (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-3].string)); - free ((yyvsp[-2].string)); - } -#line 2665 "parse_y.c" /* yacc.c:1646 */ - break; - - case 155: -#line 1588 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPin(yyElement, OU ((yyvsp[-7].measure)), OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), 2*GROUNDPLANEFRAME, - OU ((yyvsp[-5].measure)) + 2*MASKFRAME, OU ((yyvsp[-4].measure)), (yyvsp[-3].string), (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-3].string)); - free ((yyvsp[-2].string)); - } -#line 2676 "parse_y.c" /* yacc.c:1646 */ - break; - - case 156: -#line 1599 "parse_y.y" /* yacc.c:1646 */ - { - char p_number[8]; - - sprintf(p_number, "%d", pin_num++); - CreateNewPin(yyElement, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), 2*GROUNDPLANEFRAME, - OU ((yyvsp[-4].measure)) + 2*MASKFRAME, OU ((yyvsp[-3].measure)), (yyvsp[-2].string), p_number, OldFlags((yyvsp[-1].integer))); - - free ((yyvsp[-2].string)); - } -#line 2690 "parse_y.c" /* yacc.c:1646 */ - break; - - case 157: -#line 1615 "parse_y.y" /* yacc.c:1646 */ - { - Coord hole = OU ((yyvsp[-3].measure)) * DEFAULT_DRILLINGHOLE; - char p_number[8]; - - /* make sure that there's enough copper left */ - if (OU ((yyvsp[-3].measure)) - hole < MIN_PINORVIACOPPER && - OU ((yyvsp[-3].measure)) > MIN_PINORVIACOPPER) - hole = OU ((yyvsp[-3].measure)) - MIN_PINORVIACOPPER; - - sprintf(p_number, "%d", pin_num++); - CreateNewPin(yyElement, OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), 2*GROUNDPLANEFRAME, - OU ((yyvsp[-3].measure)) + 2*MASKFRAME, hole, (yyvsp[-2].string), p_number, OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2709 "parse_y.c" /* yacc.c:1646 */ - break; - - case 158: -#line 1669 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPad(yyElement, NU ((yyvsp[-10].measure)) + yyElement->MarkX, - NU ((yyvsp[-9].measure)) + yyElement->MarkY, - NU ((yyvsp[-8].measure)) + yyElement->MarkX, - NU ((yyvsp[-7].measure)) + yyElement->MarkY, NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), - (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].flagtype)); - free ((yyvsp[-3].string)); - free ((yyvsp[-2].string)); - } -#line 2723 "parse_y.c" /* yacc.c:1646 */ - break; - - case 159: -#line 1683 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPad(yyElement,OU ((yyvsp[-10].measure)) + yyElement->MarkX, - OU ((yyvsp[-9].measure)) + yyElement->MarkY, OU ((yyvsp[-8].measure)) + yyElement->MarkX, - OU ((yyvsp[-7].measure)) + yyElement->MarkY, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), - (yyvsp[-3].string), (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-3].string)); - free ((yyvsp[-2].string)); - } -#line 2736 "parse_y.c" /* yacc.c:1646 */ - break; - - case 160: -#line 1696 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewPad(yyElement,OU ((yyvsp[-8].measure)),OU ((yyvsp[-7].measure)),OU ((yyvsp[-6].measure)),OU ((yyvsp[-5].measure)),OU ((yyvsp[-4].measure)), 2*GROUNDPLANEFRAME, - OU ((yyvsp[-4].measure)) + 2*MASKFRAME, (yyvsp[-3].string), (yyvsp[-2].string), OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-3].string)); - free ((yyvsp[-2].string)); - } -#line 2747 "parse_y.c" /* yacc.c:1646 */ - break; - - case 161: -#line 1707 "parse_y.y" /* yacc.c:1646 */ - { - char p_number[8]; - - sprintf(p_number, "%d", pin_num++); - CreateNewPad(yyElement,OU ((yyvsp[-7].measure)),OU ((yyvsp[-6].measure)),OU ((yyvsp[-5].measure)),OU ((yyvsp[-4].measure)),OU ((yyvsp[-3].measure)), 2*GROUNDPLANEFRAME, - OU ((yyvsp[-3].measure)) + 2*MASKFRAME, (yyvsp[-2].string),p_number, OldFlags((yyvsp[-1].integer))); - free ((yyvsp[-2].string)); - } -#line 2760 "parse_y.c" /* yacc.c:1646 */ - break; - - case 162: -#line 1717 "parse_y.y" /* yacc.c:1646 */ - { (yyval.flagtype) = OldFlags((yyvsp[0].integer)); } -#line 2766 "parse_y.c" /* yacc.c:1646 */ - break; - - case 163: -#line 1718 "parse_y.y" /* yacc.c:1646 */ - { (yyval.flagtype) = string_to_flags ((yyvsp[0].string), yyerror); free((yyvsp[0].string)); } -#line 2772 "parse_y.c" /* yacc.c:1646 */ - break; - - case 167: -#line 1748 "parse_y.y" /* yacc.c:1646 */ - { - if ((yyvsp[-3].integer) <= 0 || (yyvsp[-3].integer) > MAX_FONTPOSITION) - { - yyerror("fontposition out of range"); - YYABORT; - } - Symbol = &yyFont->Symbol[(yyvsp[-3].integer)]; - if (Symbol->Valid) - { - yyerror("symbol ID used twice"); - YYABORT; - } - Symbol->Valid = pcb_true; - Symbol->Delta = NU ((yyvsp[-2].measure)); - } -#line 2792 "parse_y.c" /* yacc.c:1646 */ - break; - - case 168: -#line 1764 "parse_y.y" /* yacc.c:1646 */ - { - if ((yyvsp[-3].integer) <= 0 || (yyvsp[-3].integer) > MAX_FONTPOSITION) - { - yyerror("fontposition out of range"); - YYABORT; - } - Symbol = &yyFont->Symbol[(yyvsp[-3].integer)]; - if (Symbol->Valid) - { - yyerror("symbol ID used twice"); - YYABORT; - } - Symbol->Valid = pcb_true; - Symbol->Delta = OU ((yyvsp[-2].measure)); - } -#line 2812 "parse_y.c" /* yacc.c:1646 */ - break; - - case 174: -#line 1811 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineInSymbol(Symbol, OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), OU ((yyvsp[-3].measure)), OU ((yyvsp[-2].measure)), OU ((yyvsp[-1].measure))); - } -#line 2820 "parse_y.c" /* yacc.c:1646 */ - break; - - case 175: -#line 1818 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewLineInSymbol(Symbol, NU ((yyvsp[-5].measure)), NU ((yyvsp[-4].measure)), NU ((yyvsp[-3].measure)), NU ((yyvsp[-2].measure)), NU ((yyvsp[-1].measure))); - } -#line 2828 "parse_y.c" /* yacc.c:1646 */ - break; - - case 183: -#line 1873 "parse_y.y" /* yacc.c:1646 */ - { - Menu = CreateNewNet((LibraryTypePtr)&yyPCB->NetlistLib, (yyvsp[-3].string), (yyvsp[-2].string)); - free ((yyvsp[-3].string)); - free ((yyvsp[-2].string)); - } -#line 2838 "parse_y.c" /* yacc.c:1646 */ - break; - - case 189: -#line 1908 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewConnection(Menu, (yyvsp[-1].string)); - free ((yyvsp[-1].string)); - } -#line 2847 "parse_y.c" /* yacc.c:1646 */ - break; - - case 197: -#line 1955 "parse_y.y" /* yacc.c:1646 */ - { rats_patch_append(yyPCB, RATP_ADD_CONN, (yyvsp[-2].string), (yyvsp[-1].string), NULL); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } -#line 2853 "parse_y.c" /* yacc.c:1646 */ - break; - - case 198: -#line 1956 "parse_y.y" /* yacc.c:1646 */ - { rats_patch_append(yyPCB, RATP_DEL_CONN, (yyvsp[-2].string), (yyvsp[-1].string), NULL); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } -#line 2859 "parse_y.c" /* yacc.c:1646 */ - break; - - case 199: -#line 1957 "parse_y.y" /* yacc.c:1646 */ - { rats_patch_append(yyPCB, RATP_CHANGE_ATTRIB, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string)); free((yyvsp[-3].string)); free((yyvsp[-2].string)); free((yyvsp[-1].string)); } -#line 2865 "parse_y.c" /* yacc.c:1646 */ - break; - - case 200: -#line 1985 "parse_y.y" /* yacc.c:1646 */ - { - CreateNewAttribute (attr_list, (yyvsp[-2].string), (yyvsp[-1].string) ? (yyvsp[-1].string) : (char *)""); - free ((yyvsp[-2].string)); - free ((yyvsp[-1].string)); - } -#line 2875 "parse_y.c" /* yacc.c:1646 */ - break; - - case 201: -#line 1992 "parse_y.y" /* yacc.c:1646 */ - { (yyval.string) = (yyvsp[0].string); } -#line 2881 "parse_y.c" /* yacc.c:1646 */ - break; - - case 202: -#line 1993 "parse_y.y" /* yacc.c:1646 */ - { (yyval.string) = 0; } -#line 2887 "parse_y.c" /* yacc.c:1646 */ - break; - - case 203: -#line 1997 "parse_y.y" /* yacc.c:1646 */ - { (yyval.number) = (yyvsp[0].number); } -#line 2893 "parse_y.c" /* yacc.c:1646 */ - break; - - case 204: -#line 1998 "parse_y.y" /* yacc.c:1646 */ - { (yyval.number) = (yyvsp[0].integer); } -#line 2899 "parse_y.c" /* yacc.c:1646 */ - break; - - case 205: -#line 2003 "parse_y.y" /* yacc.c:1646 */ - { do_measure(&(yyval.measure), (yyvsp[0].number), PCB_MIL_TO_COORD ((yyvsp[0].number)) / 100.0, 0); } -#line 2905 "parse_y.c" /* yacc.c:1646 */ - break; - - case 206: -#line 2004 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MIL_TO_COORD ((yyvsp[-1].number)) / 100000.0); } -#line 2911 "parse_y.c" /* yacc.c:1646 */ - break; - - case 207: -#line 2005 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MIL_TO_COORD ((yyvsp[-1].number)) / 100.0); } -#line 2917 "parse_y.c" /* yacc.c:1646 */ - break; - - case 208: -#line 2006 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MIL_TO_COORD ((yyvsp[-1].number))); } -#line 2923 "parse_y.c" /* yacc.c:1646 */ - break; - - case 209: -#line 2007 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_INCH_TO_COORD ((yyvsp[-1].number))); } -#line 2929 "parse_y.c" /* yacc.c:1646 */ - break; - - case 210: -#line 2008 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MM_TO_COORD ((yyvsp[-1].number)) / 1000000.0); } -#line 2935 "parse_y.c" /* yacc.c:1646 */ - break; - - case 211: -#line 2009 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MM_TO_COORD ((yyvsp[-1].number)) / 1000.0); } -#line 2941 "parse_y.c" /* yacc.c:1646 */ - break; - - case 212: -#line 2010 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MM_TO_COORD ((yyvsp[-1].number))); } -#line 2947 "parse_y.c" /* yacc.c:1646 */ - break; - - case 213: -#line 2011 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MM_TO_COORD ((yyvsp[-1].number)) * 1000.0); } -#line 2953 "parse_y.c" /* yacc.c:1646 */ - break; - - case 214: -#line 2012 "parse_y.y" /* yacc.c:1646 */ - { M ((yyval.measure), (yyvsp[-1].number), PCB_MM_TO_COORD ((yyvsp[-1].number)) * 1000000.0); } -#line 2959 "parse_y.c" /* yacc.c:1646 */ - break; - - -#line 2963 "parse_y.c" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} -#line 2015 "parse_y.y" /* yacc.c:1906 */ - - -/* --------------------------------------------------------------------------- - * error routine called by parser library - */ -int yyerror(const char * s) -{ - Message(PCB_MSG_ERROR, "ERROR parsing file '%s'\n" - " line: %i\n" - " description: '%s'\n", - yyfilename, pcb_lineno, s); - return(0); -} - -int pcb_wrap() -{ - return 1; -} - -static int -check_file_version (int ver) -{ - if ( ver > PCB_FILE_VERSION ) { - Message (PCB_MSG_DEFAULT, "ERROR: The file you are attempting to load is in a format\n" - "which is too new for this version of pcb. To load this file\n" - "you need a version of pcb which is >= %d. If you are\n" - "using a version built from git source, the source date\n" - "must be >= %d. This copy of pcb can only read files\n" - "up to file version %d.\n", ver, ver, PCB_FILE_VERSION); - return 1; - } - - return 0; -} - -static void -do_measure (PLMeasure *m, Coord i, double d, int u) -{ - m->ival = i; - m->bval = pcb_round (d); - m->dval = d; - m->has_units = u; -} - -static int -integer_value (PLMeasure m) -{ - if (m.has_units) - yyerror("units ignored here"); - return m.ival; -} - -static Coord -old_units (PLMeasure m) -{ - if (m.has_units) - return m.bval; - return pcb_round (PCB_MIL_TO_COORD (m.ival)); -} - -static Coord -new_units (PLMeasure m) -{ - if (m.has_units) - return m.bval; - /* if there's no unit m.dval already contains the converted value */ - return pcb_round (m.dval); -} Index: 1.1.4/src_plugins/io_pcb/parse_y.h =================================================================== --- 1.1.4/src_plugins/io_pcb/parse_y.h (revision 10776) +++ 1.1.4/src_plugins/io_pcb/parse_y.h (nonexistent) @@ -1,123 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - 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 3 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_PCB_PARSE_Y_H_INCLUDED -# define YY_PCB_PARSE_Y_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int pcb_debug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - FLOATING = 258, - INTEGER = 259, - CHAR_CONST = 260, - STRING = 261, - T_FILEVERSION = 262, - T_PCB = 263, - T_LAYER = 264, - T_VIA = 265, - T_RAT = 266, - T_LINE = 267, - T_ARC = 268, - T_RECTANGLE = 269, - T_TEXT = 270, - T_ELEMENTLINE = 271, - T_ELEMENT = 272, - T_PIN = 273, - T_PAD = 274, - T_GRID = 275, - T_FLAGS = 276, - T_SYMBOL = 277, - T_SYMBOLLINE = 278, - T_CURSOR = 279, - T_ELEMENTARC = 280, - T_MARK = 281, - T_GROUPS = 282, - T_STYLES = 283, - T_POLYGON = 284, - T_POLYGON_HOLE = 285, - T_NETLIST = 286, - T_NET = 287, - T_CONN = 288, - T_NETLISTPATCH = 289, - T_ADD_CONN = 290, - T_DEL_CONN = 291, - T_CHANGE_ATTRIB = 292, - T_AREA = 293, - T_THERMAL = 294, - T_DRC = 295, - T_ATTRIBUTE = 296, - T_UMIL = 297, - T_CMIL = 298, - T_MIL = 299, - T_IN = 300, - T_NM = 301, - T_UM = 302, - T_MM = 303, - T_M = 304, - T_KM = 305 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 118 "parse_y.y" /* yacc.c:1909 */ - - int integer; - double number; - char *string; - FlagType flagtype; - PLMeasure measure; - -#line 113 "parse_y.h" /* yacc.c:1909 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE pcb_lval; - -int pcb_parse (void); - -#endif /* !YY_PCB_PARSE_Y_H_INCLUDED */ Index: 1.1.4/src_plugins/io_pcb/attribs.c =================================================================== --- 1.1.4/src_plugins/io_pcb/attribs.c (revision 10776) +++ 1.1.4/src_plugins/io_pcb/attribs.c (nonexistent) @@ -1,127 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "conf.h" -#include "misc.h" -#include "compat_misc.h" - -#define LISTSEP " [[pcb-rnd]] " - -/* Save and load pcb conf attributes, but do not save ::design:: (because they have flags) */ -static const char *conf_attr_prefix = "PCB::conf::"; -static const char *conf_attr_prefix_inhibit = "design::"; -/* The optimizer will fix this */ -#define conf_attr_prefix_len strlen(conf_attr_prefix) -#define conf_attr_prefix_inhibit_len strlen(conf_attr_prefix_inhibit) - -static int path_ok(const char *path) -{ - if (strncmp(path, conf_attr_prefix, conf_attr_prefix_len) != 0) - return 0; - if (strncmp(path + conf_attr_prefix_len, conf_attr_prefix_inhibit, conf_attr_prefix_inhibit_len) == 0) - return 0; - return 1; -} - -static void c2a(PCBType *pcb, lht_node_t *tree, const char *path1) -{ - lht_dom_iterator_t it; - lht_node_t *n; - char apath[512], *path, *pe; - int path1l = strlen(path1); - - memcpy(apath, conf_attr_prefix, conf_attr_prefix_len); - path = apath + conf_attr_prefix_len; - - if (path1l != 0) { - memcpy(path, path1, path1l); - path[path1l] = '/'; - pe = path+path1l+1; - } - else - pe = path; - - /* a depth-first-search and save config items from the tree */ - for(n = lht_dom_first(&it, tree); n != NULL; n = lht_dom_next(&it)) { - strcpy(pe, n->name); - if (n->type == LHT_HASH) - c2a(pcb, n, path); - if (strncmp(path, "design/",7) == 0) { - continue; - } - if (n->type == LHT_TEXT) { - conf_native_t *nv = conf_get_field(path); - if ((nv != NULL) && (!nv->random_flags.io_pcb_no_attrib)) - AttributePutToList(&pcb->Attributes, apath, n->data.text.value, 1); - } - else if (n->type == LHT_LIST) { - lht_node_t *i; - conf_native_t *nv = conf_get_field(path); - if ((nv != NULL) && (!nv->random_flags.io_pcb_no_attrib)) { - gds_t conc; - gds_init(&conc); - for(i = n->data.list.first; i != NULL; i = i->next) { - if (i != n->data.list.first) - gds_append_str(&conc, LISTSEP); - gds_append_str(&conc, i->data.text.value); - } - AttributePutToList(&pcb->Attributes, apath, conc.array, 1); - gds_uninit(&conc); - } - } - } -} - -void io_pcb_attrib_c2a(PCBType *pcb) -{ - lht_node_t *nmain = conf_lht_get_first(CFR_DESIGN); - - c2a(pcb, nmain, ""); -} - -void io_pcb_attrib_a2c(PCBType *pcb) -{ - int n; - - for (n = 0; n < pcb->Attributes.Number; n++) { - if (path_ok(pcb->Attributes.List[n].name)) { - conf_native_t *nv = conf_get_field(pcb->Attributes.List[n].name + conf_attr_prefix_len); - if (nv == NULL) - continue; - if (nv->type == CFN_LIST) { - char *tmp = pcb_strdup(pcb->Attributes.List[n].value); - char *next, *curr; - for(curr = tmp; curr != NULL; curr = next) { - next = strstr(curr, LISTSEP); - if (next != NULL) { - *next = '\0'; - next += strlen(LISTSEP); - } - conf_set(CFR_DESIGN, pcb->Attributes.List[n].name + conf_attr_prefix_len, -1, curr, POL_APPEND); - } - free(tmp); - } - else /* assume plain string */ - conf_set(CFR_DESIGN, pcb->Attributes.List[n].name + conf_attr_prefix_len, -1, pcb->Attributes.List[n].value, POL_OVERWRITE); - } - } -} Index: 1.1.4/src_plugins/io_pcb/README =================================================================== --- 1.1.4/src_plugins/io_pcb/README (revision 10776) +++ 1.1.4/src_plugins/io_pcb/README (nonexistent) @@ -1,5 +0,0 @@ -Load and save the design and elements in the original pcb text format. - -#state: works -#default: buildin -#implements: io Index: 1.1.4/src_plugins/io_pcb/attribs.h =================================================================== --- 1.1.4/src_plugins/io_pcb/attribs.h (revision 10776) +++ 1.1.4/src_plugins/io_pcb/attribs.h (nonexistent) @@ -1,2 +0,0 @@ -void io_pcb_attrib_c2a(PCBType *pcb); -void io_pcb_attrib_a2c(PCBType *pcb); Index: 1.1.4/src_plugins/io_pcb/file.c =================================================================== --- 1.1.4/src_plugins/io_pcb/file.c (revision 10776) +++ 1.1.4/src_plugins/io_pcb/file.c (nonexistent) @@ -1,581 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,1997,1998,2005,2006 Thomas Nau - * Copyright (C) 2015 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* file save, load, merge ... routines */ - -#include "config.h" -#include "conf_core.h" - -#include -#include "global.h" - -#include - -#include -#include -#include - -#include "buffer.h" -#include "change.h" -#include "create.h" -#include "crosshair.h" -#include "data.h" -#include "error.h" -#include "file.h" -#include "plug_io.h" -#include "hid.h" -#include "layer.h" -#include "misc.h" -#include "move.h" -#include "mymem.h" -#include "parse_common.h" -#include "pcb-printf.h" -#include "polygon.h" -#include "rats.h" -#include "remove.h" -#include "set.h" -#include "strflags.h" -#include "compat_fs.h" -#include "paths.h" -#include "rats_patch.h" -#include "hid_actions.h" -#include "hid_flags.h" -#include "flags.h" -#include "attribs.h" -#include "route_style.h" - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static void WritePCBInfoHeader(FILE *); -static void WritePCBDataHeader(FILE *); -static void WritePCBFontData(FILE *); -static void WriteViaData(FILE *, DataTypePtr); -static void WritePCBRatData(FILE *); -static void WriteLayerData(FILE *, pcb_cardinal_t, LayerTypePtr); - -/* --------------------------------------------------------------------------- - * Flag helper functions - */ - -#define F2S(OBJ, TYPE) flags_to_string ((OBJ)->Flags, TYPE) - -/* --------------------------------------------------------------------------- */ - -/* The idea here is to avoid gratuitously breaking backwards - compatibility due to a new but rarely used feature. The first such - case, for example, was the polygon Hole - if your design included - polygon holes, you needed a newer PCB to read it, but if your - design didn't include holes, PCB would produce a file that older - PCBs could read, if only it had the correct version number in it. - - If, however, you have to add or change a feature that really does - require a new PCB version all the time, it's time to remove all the - tests below and just always output the new version. - - Note: Best practices here is to add support for a feature *first* - (and bump PCB_FILE_VERSION in file.h), and note the version that - added that support below, and *later* update the file format to - need that version (which may then be older than PCB_FILE_VERSION). - Hopefully, that allows for one release between adding support and - needing it, which should minimize breakage. Of course, that's not - *always* possible, practical, or desirable. - -*/ - -/* Hole[] in Polygon. */ -#define PCB_FILE_VERSION_HOLES 20100606 -/* First version ever saved. */ -#define PCB_FILE_VERSION_BASELINE 20070407 - -int PCBFileVersionNeeded(void) -{ - ALLPOLYGON_LOOP(PCB->Data); - { - if (polygon->HoleIndexN > 0) - return PCB_FILE_VERSION_HOLES; - } - ENDALL_LOOP; - - return PCB_FILE_VERSION_BASELINE; -} - -/* In future all use of this should be supplanted by - * pcb-printf and %mr/%m# spec */ -static const char *c_dtostr(double d) -{ - static char buf[100]; - int i, f; - char *bufp = buf; - - if (d < 0) { - *bufp++ = '-'; - d = -d; - } - d += 0.0000005; /* rounding */ - i = floor(d); - d -= i; - sprintf(bufp, "%d", i); - bufp += strlen(bufp); - *bufp++ = '.'; - - f = floor(d * 1000000.0); - sprintf(bufp, "%06d", f); - return buf; -} - - -/* --------------------------------------------------------------------------- - * writes out an attribute list - */ -static void WriteAttributeList(FILE * FP, AttributeListTypePtr list, const char *prefix) -{ - int i; - - for (i = 0; i < list->Number; i++) - fprintf(FP, "%sAttribute(\"%s\" \"%s\")\n", prefix, list->List[i].name, list->List[i].value); -} - -/* --------------------------------------------------------------------------- - * writes layout header information - */ -static void WritePCBInfoHeader(FILE * FP) -{ - /* write some useful comments */ - fprintf(FP, "# release: pcb-rnd " VERSION "\n"); - - /* avoid writing things like user name or date, as these cause merge - * conflicts in collaborative environments using version control systems - */ -} - -static void conf_update_pcb_flag(FlagType *dest, const char *hash_path, int binflag) -{ - conf_native_t *n = conf_get_field(hash_path); - struct { - FlagType Flags; - } *tmp = (void *)dest; - - if ((n == NULL) || (n->type != CFN_BOOLEAN) || (n->used < 0) || (!n->val.boolean[0])) - CLEAR_FLAG(binflag, tmp); - else - SET_FLAG(binflag, tmp); -} - -/* --------------------------------------------------------------------------- - * writes data header - * the name of the PCB, cursor location, zoom and grid - * layergroups and some flags - */ -static void WritePCBDataHeader(FILE * FP) -{ - int group; - FlagType pcb_flags; - - memset(&pcb_flags, 0, sizeof(pcb_flags)); - - /* - * ************************** README ******************* - * ************************** README ******************* - * - * If the file format is modified in any way, update - * PCB_FILE_VERSION in file.h as well as PCBFileVersionNeeded() - * at the top of this file. - * - * ************************** README ******************* - * ************************** README ******************* - */ - - io_pcb_attrib_c2a(PCB); - - /* set binary flags from conf hash; these flags used to be checked - with TEST_FLAG() but got moved to the conf system */ - conf_update_pcb_flag(&pcb_flags, "plugins/mincut/enable", ENABLEPCB_FLAG_MINCUT); - conf_update_pcb_flag(&pcb_flags, "editor/show_number", SHOWNUMBERFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/show_drc", SHOWPCB_FLAG_DRC); - conf_update_pcb_flag(&pcb_flags, "editor/rubber_band_mode", RUBBERBANDFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/auto_drc", AUTOPCB_FLAG_DRC); - conf_update_pcb_flag(&pcb_flags, "editor/all_direction_lines", ALLDIRECTIONFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/swap_start_direction", SWAPSTARTDIRFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/unique_names", UNIQUENAMEFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/clear_line", CLEARNEWFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/full_poly", NEWPCB_FLAG_FULLPOLY); - conf_update_pcb_flag(&pcb_flags, "editor/snap_pin", SNAPPCB_FLAG_PIN); - conf_update_pcb_flag(&pcb_flags, "editor/orthogonal_moves", ORTHOMOVEFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/live_routing", LIVEROUTEFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/lock_names", LOCKNAMESFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/only_names", ONLYNAMESFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/hide_names", HIDENAMESFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/thin_draw", THINDRAWFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/thin_draw_poly", THINDRAWPOLYFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/local_ref", LOCALREFFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/check_planes",CHECKPLANESFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/description", DESCRIPTIONFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/name_on_pcb", NAMEONPCBFLAG); - conf_update_pcb_flag(&pcb_flags, "editor/show_mask", SHOWMASKFLAG); - - fprintf(FP, "\n# To read pcb files, the pcb version (or the git source date) must be >= the file version\n"); - fprintf(FP, "FileVersion[%i]\n", PCBFileVersionNeeded()); - - fputs("\nPCB[", FP); - PrintQuotedString(FP, (char *) EMPTY(PCB->Name)); - pcb_fprintf(FP, " %[0] %[0]]\n\n", PCB->MaxWidth, PCB->MaxHeight); - pcb_fprintf(FP, "Grid[%[0] %[0] %[0] %d]\n", PCB->Grid, PCB->GridOffsetX, PCB->GridOffsetY, conf_core.editor.draw_grid); - pcb_fprintf(FP, "Cursor[%[0] %[0] %s]\n", Crosshair.X, Crosshair.Y, c_dtostr(PCB->Zoom)); - /* PolyArea should be output in square cmils, no suffix */ - fprintf(FP, "PolyArea[%s]\n", c_dtostr(PCB_COORD_TO_MIL(PCB_COORD_TO_MIL(PCB->IsleArea) * 100) * 100)); - pcb_fprintf(FP, "Thermal[%s]\n", c_dtostr(PCB->ThermScale)); - pcb_fprintf(FP, "DRC[%[0] %[0] %[0] %[0] %[0] %[0]]\n", PCB->Bloat, PCB->Shrink, - PCB->minWid, PCB->minSlk, PCB->minDrill, PCB->minRing); - fprintf(FP, "Flags(%s)\n", pcbflags_to_string(pcb_flags)); - fprintf(FP, "Groups(\"%s\")\n", LayerGroupsToString(&PCB->LayerGroups)); - fputs("Styles[\"", FP); - - if (vtroutestyle_len(&PCB->RouteStyle) > 0) { - for (group = 0; group < vtroutestyle_len(&PCB->RouteStyle) - 1; group++) - pcb_fprintf(FP, "%s,%[0],%[0],%[0],%[0]:", PCB->RouteStyle.array[group].name, - PCB->RouteStyle.array[group].Thick, - PCB->RouteStyle.array[group].Diameter, PCB->RouteStyle.array[group].Hole, PCB->RouteStyle.array[group].Clearance); - pcb_fprintf(FP, "%s,%[0],%[0],%[0],%[0]\"]\n\n", PCB->RouteStyle.array[group].name, - PCB->RouteStyle.array[group].Thick, - PCB->RouteStyle.array[group].Diameter, PCB->RouteStyle.array[group].Hole, PCB->RouteStyle.array[group].Clearance); - } - else - fprintf(FP, "\"]\n\n"); -} - -/* --------------------------------------------------------------------------- - * writes font data of non empty symbols - */ -static void WritePCBFontData(FILE * FP) -{ - pcb_cardinal_t i, j; - LineTypePtr line; - FontTypePtr font; - - for (font = &PCB->Font, i = 0; i <= MAX_FONTPOSITION; i++) { - if (!font->Symbol[i].Valid) - continue; - - if (isprint(i)) - pcb_fprintf(FP, "Symbol['%c' %[0]]\n(\n", i, font->Symbol[i].Delta); - else - pcb_fprintf(FP, "Symbol[%i %[0]]\n(\n", i, font->Symbol[i].Delta); - - line = font->Symbol[i].Line; - for (j = font->Symbol[i].LineN; j; j--, line++) - pcb_fprintf(FP, "\tSymbolLine[%[0] %[0] %[0] %[0] %[0]]\n", - line->Point1.X, line->Point1.Y, line->Point2.X, line->Point2.Y, line->Thickness); - fputs(")\n", FP); - } -} - -/* --------------------------------------------------------------------------- - * writes via data - */ -static void WriteViaData(FILE * FP, DataTypePtr Data) -{ - gdl_iterator_t it; - PinType *via; - - /* write information about vias */ - pinlist_foreach(&Data->Via, &it, via) { - pcb_fprintf(FP, "Via[%[0] %[0] %[0] %[0] %[0] %[0] ", via->X, via->Y, - via->Thickness, via->Clearance, via->Mask, via->DrillingHole); - PrintQuotedString(FP, (char *) EMPTY(via->Name)); - fprintf(FP, " %s]\n", F2S(via, PCB_TYPE_VIA)); - } -} - -/* --------------------------------------------------------------------------- - * writes rat-line data - */ -static void WritePCBRatData(FILE * FP) -{ - gdl_iterator_t it; - RatType *line; - - /* write information about rats */ - ratlist_foreach(&PCB->Data->Rat, &it, line) { - pcb_fprintf(FP, "Rat[%[0] %[0] %d %[0] %[0] %d ", - line->Point1.X, line->Point1.Y, line->group1, line->Point2.X, line->Point2.Y, line->group2); - fprintf(FP, " %s]\n", F2S(line, PCB_TYPE_RATLINE)); - } -} - -/* --------------------------------------------------------------------------- - * writes netlist data - */ -static void WritePCBNetlistData(FILE * FP) -{ - /* write out the netlist if it exists */ - if (PCB->NetlistLib[NETLIST_INPUT].MenuN) { - int n, p; - fprintf(FP, "NetList()\n(\n"); - - for (n = 0; n < PCB->NetlistLib[NETLIST_INPUT].MenuN; n++) { - LibraryMenuTypePtr menu = &PCB->NetlistLib[NETLIST_INPUT].Menu[n]; - fprintf(FP, "\tNet("); - PrintQuotedString(FP, &menu->Name[2]); - fprintf(FP, " "); - PrintQuotedString(FP, (char *) UNKNOWN(menu->Style)); - fprintf(FP, ")\n\t(\n"); - for (p = 0; p < menu->EntryN; p++) { - LibraryEntryTypePtr entry = &menu->Entry[p]; - fprintf(FP, "\t\tConnect("); - PrintQuotedString(FP, entry->ListEntry); - fprintf(FP, ")\n"); - } - fprintf(FP, "\t)\n"); - } - fprintf(FP, ")\n"); - } -} - -/* --------------------------------------------------------------------------- - * writes netlist patch data - */ -static void WritePCBNetlistPatchData(FILE * FP) -{ - if (PCB->NetlistPatches != NULL) { - fprintf(FP, "NetListPatch()\n(\n"); - rats_patch_fexport(PCB, FP, 1); - fprintf(FP, ")\n"); - } -} - -/* --------------------------------------------------------------------------- - * writes element data - */ -int io_pcb_WriteElementData(plug_io_t *ctx, FILE * FP, DataTypePtr Data) -{ - gdl_iterator_t eit; - LineType *line; - ArcType *arc; - ElementType *element; - - pcb_printf_slot[0] = ((io_pcb_ctx_t *)(ctx->plugin_data))->write_coord_fmt; - elementlist_foreach(&Data->Element, &eit, element) { - gdl_iterator_t it; - PinType *pin; - PadType *pad; - - /* only non empty elements */ - if (!linelist_length(&element->Line) && !pinlist_length(&element->Pin) && !arclist_length(&element->Arc) && !padlist_length(&element->Pad)) - continue; - /* the coordinates and text-flags are the same for - * both names of an element - */ - fprintf(FP, "\nElement[%s ", F2S(element, PCB_TYPE_ELEMENT)); - PrintQuotedString(FP, (char *) EMPTY(DESCRIPTION_NAME(element))); - fputc(' ', FP); - PrintQuotedString(FP, (char *) EMPTY(NAMEONPCB_NAME(element))); - fputc(' ', FP); - PrintQuotedString(FP, (char *) EMPTY(VALUE_NAME(element))); - pcb_fprintf(FP, " %[0] %[0] %[0] %[0] %d %d %s]\n(\n", - element->MarkX, element->MarkY, - DESCRIPTION_TEXT(element).X - element->MarkX, - DESCRIPTION_TEXT(element).Y - element->MarkY, - DESCRIPTION_TEXT(element).Direction, - DESCRIPTION_TEXT(element).Scale, F2S(&(DESCRIPTION_TEXT(element)), PCB_TYPE_ELEMENT_NAME)); - WriteAttributeList(FP, &element->Attributes, "\t"); - pinlist_foreach(&element->Pin, &it, pin) { - pcb_fprintf(FP, "\tPin[%[0] %[0] %[0] %[0] %[0] %[0] ", - pin->X - element->MarkX, - pin->Y - element->MarkY, pin->Thickness, pin->Clearance, pin->Mask, pin->DrillingHole); - PrintQuotedString(FP, (char *) EMPTY(pin->Name)); - fprintf(FP, " "); - PrintQuotedString(FP, (char *) EMPTY(pin->Number)); - fprintf(FP, " %s]\n", F2S(pin, PCB_TYPE_PIN)); - } - pinlist_foreach(&element->Pad, &it, pad) { - pcb_fprintf(FP, "\tPad[%[0] %[0] %[0] %[0] %[0] %[0] %[0] ", - pad->Point1.X - element->MarkX, - pad->Point1.Y - element->MarkY, - pad->Point2.X - element->MarkX, pad->Point2.Y - element->MarkY, pad->Thickness, pad->Clearance, pad->Mask); - PrintQuotedString(FP, (char *) EMPTY(pad->Name)); - fprintf(FP, " "); - PrintQuotedString(FP, (char *) EMPTY(pad->Number)); - fprintf(FP, " %s]\n", F2S(pad, PCB_TYPE_PAD)); - } - linelist_foreach(&element->Line, &it, line) { - pcb_fprintf(FP, "\tElementLine [%[0] %[0] %[0] %[0] %[0]]\n", - line->Point1.X - element->MarkX, - line->Point1.Y - element->MarkY, - line->Point2.X - element->MarkX, line->Point2.Y - element->MarkY, line->Thickness); - } - linelist_foreach(&element->Arc, &it, arc) { - pcb_fprintf(FP, "\tElementArc [%[0] %[0] %[0] %[0] %ma %ma %[0]]\n", - arc->X - element->MarkX, - arc->Y - element->MarkY, arc->Width, arc->Height, arc->StartAngle, arc->Delta, arc->Thickness); - } - fputs("\n\t)\n", FP); - } - return 0; -} - -/* --------------------------------------------------------------------------- - * writes layer data - */ -static void WriteLayerData(FILE * FP, pcb_cardinal_t Number, LayerTypePtr layer) -{ - gdl_iterator_t it; - LineType *line; - ArcType *arc; - TextType *text; - PolygonType *polygon; - - /* write information about non empty layers */ - if (!LAYER_IS_EMPTY(layer) || (layer->Name && *layer->Name)) { - fprintf(FP, "Layer(%i ", (int) Number + 1); - PrintQuotedString(FP, (char *) EMPTY(layer->Name)); - fputs(")\n(\n", FP); - WriteAttributeList(FP, &layer->Attributes, "\t"); - - linelist_foreach(&layer->Line, &it, line) { - pcb_fprintf(FP, "\tLine[%[0] %[0] %[0] %[0] %[0] %[0] %s]\n", - line->Point1.X, line->Point1.Y, - line->Point2.X, line->Point2.Y, line->Thickness, line->Clearance, F2S(line, PCB_TYPE_LINE)); - } - arclist_foreach(&layer->Arc, &it, arc) { - pcb_fprintf(FP, "\tArc[%[0] %[0] %[0] %[0] %[0] %[0] %ma %ma %s]\n", - arc->X, arc->Y, arc->Width, - arc->Height, arc->Thickness, arc->Clearance, arc->StartAngle, arc->Delta, F2S(arc, PCB_TYPE_ARC)); - } - textlist_foreach(&layer->Text, &it, text) { - pcb_fprintf(FP, "\tText[%[0] %[0] %d %d ", text->X, text->Y, text->Direction, text->Scale); - PrintQuotedString(FP, (char *) EMPTY(text->TextString)); - fprintf(FP, " %s]\n", F2S(text, PCB_TYPE_TEXT)); - } - textlist_foreach(&layer->Polygon, &it, polygon) { - int p, i = 0; - pcb_cardinal_t hole = 0; - fprintf(FP, "\tPolygon(%s)\n\t(", F2S(polygon, PCB_TYPE_POLYGON)); - for (p = 0; p < polygon->PointN; p++) { - PointTypePtr point = &polygon->Points[p]; - - if (hole < polygon->HoleIndexN && p == polygon->HoleIndex[hole]) { - if (hole > 0) - fputs("\n\t\t)", FP); - fputs("\n\t\tHole (", FP); - hole++; - i = 0; - } - - if (i++ % 5 == 0) { - fputs("\n\t\t", FP); - if (hole) - fputs("\t", FP); - } - pcb_fprintf(FP, "[%[0] %[0]] ", point->X, point->Y); - } - if (hole > 0) - fputs("\n\t\t)", FP); - fputs("\n\t)\n", FP); - } - fputs(")\n", FP); - } -} - -/* --------------------------------------------------------------------------- - * writes the buffer to file - */ -int io_pcb_WriteBuffer(plug_io_t *ctx, FILE * FP, BufferType *buff) -{ - pcb_cardinal_t i; - - pcb_printf_slot[0] = ((io_pcb_ctx_t *)(ctx->plugin_data))->write_coord_fmt; - WriteViaData(FP, buff->Data); - io_pcb_WriteElementData(ctx, FP, buff->Data); - for (i = 0; i < max_copper_layer + 2; i++) - WriteLayerData(FP, i, &(buff->Data->Layer[i])); - return (STATUS_OK); -} - -/* --------------------------------------------------------------------------- - * writes PCB to file - */ -int io_pcb_WritePCB(plug_io_t *ctx, FILE * FP, const char *old_filename, const char *new_filename, pcb_bool emergency) -{ - pcb_cardinal_t i; - - AttributePutToList(&PCB->Attributes, "PCB::loader", ctx->description, 1); - - pcb_printf_slot[0] = ((io_pcb_ctx_t *)(ctx->plugin_data))->write_coord_fmt; - WritePCBInfoHeader(FP); - WritePCBDataHeader(FP); - WritePCBFontData(FP); - WriteAttributeList(FP, &PCB->Attributes, ""); - WriteViaData(FP, PCB->Data); - io_pcb_WriteElementData(ctx, FP, PCB->Data); - WritePCBRatData(FP); - for (i = 0; i < max_copper_layer + 2; i++) - WriteLayerData(FP, i, &(PCB->Data->Layer[i])); - WritePCBNetlistData(FP); - WritePCBNetlistPatchData(FP); - - return (STATUS_OK); -} - -/* --------------------------------------------------------------------------- - * functions for loading elements-as-pcb - */ - -extern PCBTypePtr yyPCB; -extern DataTypePtr yyData; -extern FontTypePtr yyFont; - -void PreLoadElementPCB() -{ - - if (!yyPCB) - return; - - yyFont = &yyPCB->Font; - yyData = yyPCB->Data; - yyData->pcb = yyPCB; - yyData->LayerN = 0; -} - -void PostLoadElementPCB() -{ - PCBTypePtr pcb_save = PCB; - ElementTypePtr e; - - if (!yyPCB) - return; - - CreateNewPCBPost(yyPCB, 0); - ParseGroupString("1,c:2,s", &yyPCB->LayerGroups, yyData->LayerN); - e = elementlist_first(&yyPCB->Data->Element); /* we know there's only one */ - PCB = yyPCB; - MoveElementLowLevel(yyPCB->Data, e, -e->BoundingBox.X1, -e->BoundingBox.Y1); - PCB = pcb_save; - yyPCB->MaxWidth = e->BoundingBox.X2; - yyPCB->MaxHeight = e->BoundingBox.Y2; - yyPCB->is_footprint = 1; -} Index: 1.1.4/src_plugins/io_pcb/file.h =================================================================== --- 1.1.4/src_plugins/io_pcb/file.h (revision 10776) +++ 1.1.4/src_plugins/io_pcb/file.h (nonexistent) @@ -1,62 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for file routines - */ - -#ifndef PCB_FILE_H -#define PCB_FILE_H - -#include /* needed to define 'FILE *' */ -#include "global.h" -#include "plug_io.h" - -typedef struct { - const char *write_coord_fmt; -} io_pcb_ctx_t; - -int io_pcb_WriteBuffer(plug_io_t *ctx, FILE *f, BufferType *buff); -int io_pcb_WriteElementData(plug_io_t *ctx, FILE *f, DataTypePtr); -int io_pcb_WritePCB(plug_io_t *ctx, FILE *f, const char *old_filename, const char *new_filename, pcb_bool emergency); - -void PreLoadElementPCB(void); -void PostLoadElementPCB(void); - -/* - * Whenever the pcb file format is modified, this version number - * should be updated to the date when the new code is committed. - * It will be written out to the file and also used by pcb to give - * guidance to the user as to what the minimum version of pcb required - * is. - */ - -/* This is the version needed by the file we're saving. */ -int PCBFileVersionNeeded(void); - -/* This is the version we support. */ -#define PCB_FILE_VERSION 20110603 - -#endif Index: 1.1.4/src_plugins/io_pcb/parse_l.c =================================================================== --- 1.1.4/src_plugins/io_pcb/parse_l.c (revision 10776) +++ 1.1.4/src_plugins/io_pcb/parse_l.c (nonexistent) @@ -1,2602 +0,0 @@ -#line 2 "parse_l.c" - -#line 4 "parse_l.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define yy_create_buffer pcb__create_buffer -#define yy_delete_buffer pcb__delete_buffer -#define yy_flex_debug pcb__flex_debug -#define yy_init_buffer pcb__init_buffer -#define yy_flush_buffer pcb__flush_buffer -#define yy_load_buffer_state pcb__load_buffer_state -#define yy_switch_to_buffer pcb__switch_to_buffer -#define yyin pcb_in -#define yyleng pcb_leng -#define yylex pcb_lex -#define yylineno pcb_lineno -#define yyout pcb_out -#define yyrestart pcb_restart -#define yytext pcb_text -#define yywrap pcb_wrap -#define yyalloc pcb_alloc -#define yyrealloc pcb_realloc -#define yyfree pcb_free - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE pcb_restart(pcb_in ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int pcb_leng; - -extern FILE *pcb_in, *pcb_out; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE pcb_lex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-pcb_lineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < pcb_leng; ++yyl )\ - if ( pcb_text[yyl] == '\n' )\ - --pcb_lineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up pcb_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up pcb_text again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via pcb_restart()), so that the user can continue scanning by - * just pointing pcb_in at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when pcb_text is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int pcb_leng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow pcb_wrap()'s to do buffer switches - * instead of setting up a fresh pcb_in. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void pcb_restart (FILE *input_file ); -void pcb__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE pcb__create_buffer (FILE *file,int size ); -void pcb__delete_buffer (YY_BUFFER_STATE b ); -void pcb__flush_buffer (YY_BUFFER_STATE b ); -void pcb_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void pcb_pop_buffer_state (void ); - -static void pcb_ensure_buffer_stack (void ); -static void pcb__load_buffer_state (void ); -static void pcb__init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER pcb__flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE pcb__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE pcb__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE pcb__scan_bytes (yyconst char *bytes,int len ); - -void *pcb_alloc (yy_size_t ); -void *pcb_realloc (void *,yy_size_t ); -void pcb_free (void * ); - -#define yy_new_buffer pcb__create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - pcb_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - pcb__create_buffer(pcb_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - pcb_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - pcb__create_buffer(pcb_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *pcb_in = (FILE *) 0, *pcb_out = (FILE *) 0; - -typedef int yy_state_type; - -extern int pcb_lineno; - -int pcb_lineno = 1; - -extern char *pcb_text; -#define yytext_ptr pcb_text - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up pcb_text. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - pcb_leng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 55 -#define YY_END_OF_BUFFER 56 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[222] = - { 0, - 0, 0, 56, 54, 51, 52, 53, 54, 50, 54, - 54, 47, 47, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 39, 54, 54, 51, 0, 49, 0, - 50, 0, 47, 47, 46, 0, 47, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 44, 40, 0, 38, - 36, 37, 45, 46, 48, 27, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, - - 2, 11, 10, 0, 14, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 0, 43, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 26, 0, 13, 22, 0, - 0, 0, 0, 0, 16, 0, 0, 0, 42, 0, - 41, 0, 0, 0, 0, 0, 8, 0, 9, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 23, 0, 0, 0, 0, 24, - 21, 0, 0, 0, 0, 0, 30, 19, 0, 28, - 0, 25, 0, 0, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 6, 0, 0, 32, 0, 33, 35, - - 0, 0, 0, 0, 15, 0, 0, 18, 0, 0, - 0, 20, 0, 17, 1, 0, 0, 31, 0, 34, - 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 5, 6, 1, 1, 1, 7, 1, - 1, 1, 8, 1, 8, 9, 1, 10, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, - 1, 1, 1, 1, 12, 13, 14, 15, 16, 17, - 18, 19, 1, 1, 1, 20, 21, 22, 1, 23, - 1, 24, 25, 26, 1, 27, 1, 1, 1, 1, - 1, 28, 1, 1, 29, 1, 30, 31, 32, 33, - - 34, 35, 36, 37, 38, 1, 39, 40, 41, 42, - 43, 44, 1, 45, 46, 47, 48, 1, 1, 49, - 50, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[51] = - { 0, - 1, 1, 2, 3, 1, 1, 1, 1, 1, 4, - 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int16_t yy_base[226] = - { 0, - 0, 0, 256, 257, 253, 257, 257, 46, 0, 0, - 42, 45, 46, 13, 16, 230, 213, 23, 207, 208, - 32, 220, 215, 52, 35, 21, 38, 210, 214, 36, - 212, 203, 203, 38, 202, 201, 239, 73, 257, 236, - 0, 232, 229, 74, 70, 0, 77, 205, 189, 193, - 189, 219, 198, 191, 200, 53, 189, 178, 185, 181, - 178, 211, 190, 180, 181, 173, 187, 168, 176, 167, - 181, 184, 180, 182, 173, 170, 257, 257, 169, 257, - 257, 170, 257, 82, 0, 257, 162, 164, 159, 257, - 163, 169, 166, 168, 152, 165, 164, 163, 157, 175, - - 257, 257, 257, 144, 257, 146, 152, 160, 143, 144, - 257, 159, 145, 146, 156, 257, 144, 145, 148, 138, - 146, 152, 132, 257, 133, 257, 131, 257, 257, 137, - 77, 144, 139, 129, 257, 130, 138, 133, 257, 136, - 257, 136, 134, 120, 122, 129, 257, 116, 257, 115, - 115, 116, 116, 111, 116, 125, 111, 119, 109, 103, - 103, 257, 102, 103, 257, 100, 112, 103, 108, 257, - 123, 102, 99, 111, 97, 91, 257, 85, 91, 113, - 105, 257, 94, 95, 257, 90, 101, 88, 95, 83, - 89, 88, 93, 257, 85, 74, 257, 68, 257, 257, - - 80, 69, 67, 62, 257, 74, 60, 257, 72, 62, - 71, 257, 57, 257, 257, 63, 61, 257, 67, 257, - 257, 113, 117, 121, 63 - } ; - -static yyconst flex_int16_t yy_def[226] = - { 0, - 221, 1, 221, 221, 221, 221, 221, 222, 223, 224, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 222, 221, 222, - 223, 221, 221, 221, 221, 225, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 225, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 0, 221, 221, 221, 221 - } ; - -static yyconst flex_int16_t yy_nxt[308] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, - 13, 14, 4, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 4, 4, 29, - 4, 30, 31, 4, 4, 4, 4, 32, 33, 4, - 34, 35, 4, 4, 4, 4, 4, 36, 4, 4, - 39, 43, 44, 45, 45, 47, 47, 48, 50, 49, - 54, 58, 55, 51, 66, 62, 85, 68, 67, 59, - 69, 70, 74, 40, 71, 79, 75, 39, 80, 84, - 84, 63, 45, 47, 47, 45, 47, 47, 151, 64, - 94, 84, 84, 46, 65, 95, 190, 220, 219, 218, - - 40, 217, 216, 215, 191, 214, 213, 212, 211, 210, - 209, 208, 152, 38, 207, 206, 38, 41, 205, 41, - 41, 42, 204, 42, 42, 203, 202, 201, 200, 199, - 198, 197, 196, 195, 194, 193, 192, 189, 188, 187, - 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, - 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, - 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, - 156, 155, 154, 153, 150, 149, 148, 147, 146, 145, - 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, - 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, - - 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, - 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, - 104, 103, 102, 101, 100, 99, 98, 97, 96, 93, - 92, 91, 90, 89, 88, 87, 86, 45, 83, 38, - 37, 82, 81, 78, 77, 76, 73, 72, 61, 60, - 57, 56, 53, 52, 37, 221, 3, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - - 221, 221, 221, 221, 221, 221, 221 - } ; - -static yyconst flex_int16_t yy_chk[308] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 8, 11, 11, 12, 13, 13, 13, 14, 15, 14, - 18, 21, 18, 15, 25, 24, 225, 26, 25, 21, - 26, 27, 30, 8, 27, 34, 30, 38, 34, 45, - 45, 24, 44, 44, 44, 47, 47, 47, 131, 24, - 56, 84, 84, 12, 24, 56, 178, 219, 217, 216, - - 38, 213, 211, 210, 178, 209, 207, 206, 204, 203, - 202, 201, 131, 222, 198, 196, 222, 223, 195, 223, - 223, 224, 193, 224, 224, 192, 191, 190, 189, 188, - 187, 186, 184, 183, 181, 180, 179, 176, 175, 174, - 173, 172, 171, 169, 168, 167, 166, 164, 163, 161, - 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, - 150, 148, 146, 145, 144, 143, 142, 140, 138, 137, - 136, 134, 133, 132, 130, 127, 125, 123, 122, 121, - 120, 119, 118, 117, 115, 114, 113, 112, 110, 109, - 108, 107, 106, 104, 100, 99, 98, 97, 96, 95, - - 94, 93, 92, 91, 89, 88, 87, 82, 79, 76, - 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, - 65, 64, 63, 62, 61, 60, 59, 58, 57, 55, - 54, 53, 52, 51, 50, 49, 48, 43, 42, 40, - 37, 36, 35, 33, 32, 31, 29, 28, 23, 22, - 20, 19, 17, 16, 5, 3, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - - 221, 221, 221, 221, 221, 221, 221 - } ; - -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[56] = - { 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, }; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int pcb__flex_debug; -int pcb__flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *pcb_text; -#line 1 "parse_l.l" -#line 4 "parse_l.l" -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996,2006 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* lexical definitions to parse ASCII input of PCB and Element description - */ - -/* for popen() */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include - -#if defined(_POSIX_SOURCE) || defined(_HPUX_SOURCE) -#include -#endif - -#include "global.h" -#include "flags.h" - -#ifdef HAVE_LIBDMALLOC -# include /* see http://dmalloc.com */ -#endif - - - - -#include "global.h" -#include "crosshair.h" -#include "data.h" -#include "error.h" -#include "file.h" -#include "mymem.h" -#include "misc.h" -#include "strflags.h" -#include "parse_common.h" -#include "parse_y.h" -#include "create.h" -#include "plug_footprint.h" -#include "attribs.h" -#include "compat_misc.h" - -#define YY_NO_INPUT - -/* --------------------------------------------------------------------------- - * some shared parser identifiers - */ -#ifdef FLEX_SCANNER - -#define yyunput ATTRIBUTE_UNUSED yyunput -#endif - -const char *yyfilename; /* in this file */ -PCBTypePtr yyPCB; /* used by parser */ -DataTypePtr yyData; -ElementTypePtr yyElement; -FontTypePtr yyFont; -conf_role_t yy_settings_dest; -FlagType yy_pcb_flags; - -static int parse_number (void); - -/* --------------------------------------------------------------------------- - * an external prototypes - */ -int yyparse(void); - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static int Parse(FILE *Pipe, const char *Executable, const char *Path, const char *Filename, const char *Parse_parameter); - -#line 741 "parse_l.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int pcb_lex_destroy (void ); - -int pcb_get_debug (void ); - -void pcb_set_debug (int debug_flag ); - -YY_EXTRA_TYPE pcb_get_extra (void ); - -void pcb_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *pcb_get_in (void ); - -void pcb_set_in (FILE * in_str ); - -FILE *pcb_get_out (void ); - -void pcb_set_out (FILE * out_str ); - -int pcb_get_leng (void ); - -char *pcb_get_text (void ); - -int pcb_get_lineno (void ); - -void pcb_set_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int pcb_wrap (void ); -#else -extern int pcb_wrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( pcb_text, pcb_leng, 1, pcb_out )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( pcb_in )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( pcb_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, pcb_in))==0 && ferror(pcb_in)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(pcb_in); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int pcb_lex (void); - -#define YY_DECL int pcb_lex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after pcb_text and pcb_leng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 116 "parse_l.l" - - -#line 931 "parse_l.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! pcb_in ) - pcb_in = stdin; - - if ( ! pcb_out ) - pcb_out = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - pcb_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - pcb__create_buffer(pcb_in,YY_BUF_SIZE ); - } - - pcb__load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of pcb_text. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 222 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 257 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = 0; yyl < pcb_leng; ++yyl ) - if ( pcb_text[yyl] == '\n' ) - - pcb_lineno++; -; - } - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 118 "parse_l.l" -{ return(T_FILEVERSION); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 119 "parse_l.l" -{ return(T_PCB); } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 120 "parse_l.l" -{ return(T_GRID); } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 121 "parse_l.l" -{ return(T_CURSOR); } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 122 "parse_l.l" -{ return(T_THERMAL); } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 123 "parse_l.l" -{ return(T_AREA); } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 124 "parse_l.l" -{ return(T_DRC); } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 125 "parse_l.l" -{ return(T_FLAGS); } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 126 "parse_l.l" -{ return(T_LAYER); } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 127 "parse_l.l" -{ return(T_PIN); } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 128 "parse_l.l" -{ return(T_PAD); } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 129 "parse_l.l" -{ return(T_VIA); } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 130 "parse_l.l" -{ return(T_LINE); } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 131 "parse_l.l" -{ return(T_RAT); } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 132 "parse_l.l" -{ return(T_RECTANGLE); } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 133 "parse_l.l" -{ return(T_TEXT); } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 134 "parse_l.l" -{ return(T_ELEMENTLINE); } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 135 "parse_l.l" -{ return(T_ELEMENTARC); } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 136 "parse_l.l" -{ return(T_ELEMENT); } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 137 "parse_l.l" -{ return(T_SYMBOLLINE); } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 138 "parse_l.l" -{ return(T_SYMBOL); } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 139 "parse_l.l" -{ return(T_MARK); } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 140 "parse_l.l" -{ return(T_GROUPS); } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 141 "parse_l.l" -{ return(T_STYLES); } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 142 "parse_l.l" -{ return(T_POLYGON); } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 143 "parse_l.l" -{ return(T_POLYGON_HOLE); } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 144 "parse_l.l" -{ return(T_ARC); } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 145 "parse_l.l" -{ return(T_NETLIST); } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 146 "parse_l.l" -{ return(T_NET); } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 147 "parse_l.l" -{ return(T_CONN); } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 148 "parse_l.l" -{ return(T_NETLISTPATCH); } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 149 "parse_l.l" -{ return(T_ADD_CONN); } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 150 "parse_l.l" -{ return(T_DEL_CONN); } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 151 "parse_l.l" -{ return(T_CHANGE_ATTRIB); } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 152 "parse_l.l" -{ return(T_ATTRIBUTE); } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 154 "parse_l.l" -{ return T_NM; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 155 "parse_l.l" -{ return T_UM; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 156 "parse_l.l" -{ return T_MM; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 157 "parse_l.l" -{ return T_M; } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 158 "parse_l.l" -{ return T_KM; } - YY_BREAK -case 41: -YY_RULE_SETUP -#line 159 "parse_l.l" -{ return T_UMIL; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 160 "parse_l.l" -{ return T_CMIL; } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 161 "parse_l.l" -{ return T_MIL; } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 162 "parse_l.l" -{ return T_IN; } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 164 "parse_l.l" -{ - pcb_lval.integer = (unsigned) *(pcb_text+1); - return(CHAR_CONST); - } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 168 "parse_l.l" -{ return parse_number(); } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 169 "parse_l.l" -{ pcb_lval.integer = pcb_round (strtod (pcb_text, NULL)); return INTEGER; } - YY_BREAK -case 48: -YY_RULE_SETUP -#line 171 "parse_l.l" -{ unsigned n; - sscanf((char *) pcb_text, "%x", &n); - pcb_lval.integer = n; - return INTEGER; - } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 176 "parse_l.l" -{ - char *p1, *p2; - - /* return NULL on empty string */ - if (pcb_leng == 2) - { - pcb_lval.string = NULL; - return(STRING); - } - - /* allocate memory and copy string; - * stringlength is counted and copied without - * leading and trailing '"' - */ - pcb_leng -= 2; - pcb_lval.string = (char *)calloc (pcb_leng+1, sizeof (char)); - p1 = (char *) (pcb_text +1); - p2 = pcb_lval.string; - while(pcb_leng--) - { - /* check for special character */ - if (*p1 == '\\') - { - pcb_leng--; - p1++; - - } - *p2++ = *p1++; - } - *p2 = '\0'; - return(STRING); - } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 208 "parse_l.l" -{} - YY_BREAK -case 51: -YY_RULE_SETUP -#line 209 "parse_l.l" -{} - YY_BREAK -case 52: -/* rule 52 can match eol */ -YY_RULE_SETUP -#line 210 "parse_l.l" -{ -#ifndef FLEX_SCANNER - pcb_lineno++; -#endif - } - YY_BREAK -case 53: -YY_RULE_SETUP -#line 215 "parse_l.l" -{} - YY_BREAK -case 54: -YY_RULE_SETUP -#line 216 "parse_l.l" -{ return(*pcb_text); } - YY_BREAK -case 55: -YY_RULE_SETUP -#line 218 "parse_l.l" -ECHO; - YY_BREAK -#line 1342 "parse_l.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed pcb_in at a new source and called - * pcb_lex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = pcb_in; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( pcb_wrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * pcb_text, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of pcb_lex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - pcb_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - pcb_restart(pcb_in ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pcb_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 222 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 222 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 221); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up pcb_text */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --pcb_lineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - pcb_restart(pcb_in ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( pcb_wrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve pcb_text */ - (yy_hold_char) = *++(yy_c_buf_p); - - if ( c == '\n' ) - - pcb_lineno++; -; - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void pcb_restart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - pcb_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - pcb__create_buffer(pcb_in,YY_BUF_SIZE ); - } - - pcb__init_buffer(YY_CURRENT_BUFFER,input_file ); - pcb__load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void pcb__switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * pcb_pop_buffer_state(); - * pcb_push_buffer_state(new_buffer); - */ - pcb_ensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - pcb__load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (pcb_wrap()) processing, but the only time this flag - * is looked at is after pcb_wrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void pcb__load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - pcb_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE pcb__create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) pcb_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in pcb__create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) pcb_alloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in pcb__create_buffer()" ); - - b->yy_is_our_buffer = 1; - - pcb__init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with pcb__create_buffer() - * - */ - void pcb__delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - pcb_free((void *) b->yy_ch_buf ); - - pcb_free((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a pcb_restart() or at EOF. - */ - static void pcb__init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - pcb__flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then pcb__init_buffer was _probably_ - * called from pcb_restart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void pcb__flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - pcb__load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void pcb_push_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - pcb_ensure_buffer_stack(); - - /* This block is copied from pcb__switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from pcb__switch_to_buffer. */ - pcb__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void pcb_pop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - pcb__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - pcb__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void pcb_ensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)pcb_alloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in pcb_ensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)pcb_realloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in pcb_ensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE pcb__scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) pcb_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in pcb__scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - pcb__switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to pcb_lex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * pcb__scan_bytes() instead. - */ -YY_BUFFER_STATE pcb__scan_string (yyconst char * yystr ) -{ - - return pcb__scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to pcb_lex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE pcb__scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) pcb_alloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in pcb__scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = pcb__scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in pcb__scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up pcb_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - pcb_text[pcb_leng] = (yy_hold_char); \ - (yy_c_buf_p) = pcb_text + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - pcb_leng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int pcb_get_lineno (void) -{ - - return pcb_lineno; -} - -/** Get the input stream. - * - */ -FILE *pcb_get_in (void) -{ - return pcb_in; -} - -/** Get the output stream. - * - */ -FILE *pcb_get_out (void) -{ - return pcb_out; -} - -/** Get the length of the current token. - * - */ -int pcb_get_leng (void) -{ - return pcb_leng; -} - -/** Get the current token. - * - */ - -char *pcb_get_text (void) -{ - return pcb_text; -} - -/** Set the current line number. - * @param line_number - * - */ -void pcb_set_lineno (int line_number ) -{ - - pcb_lineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see pcb__switch_to_buffer - */ -void pcb_set_in (FILE * in_str ) -{ - pcb_in = in_str ; -} - -void pcb_set_out (FILE * out_str ) -{ - pcb_out = out_str ; -} - -int pcb_get_debug (void) -{ - return pcb__flex_debug; -} - -void pcb_set_debug (int bdebug ) -{ - pcb__flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from pcb_lex_destroy(), so don't allocate here. - */ - - /* We do not touch pcb_lineno unless the option is enabled. */ - pcb_lineno = 1; - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - pcb_in = stdin; - pcb_out = stdout; -#else - pcb_in = (FILE *) 0; - pcb_out = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * pcb_lex_init() - */ - return 0; -} - -/* pcb_lex_destroy is for both reentrant and non-reentrant scanners. */ -int pcb_lex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - pcb__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - pcb_pop_buffer_state(); - } - - /* Destroy the stack itself. */ - pcb_free((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * pcb_lex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *pcb_alloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *pcb_realloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void pcb_free (void * ptr ) -{ - free( (char *) ptr ); /* see pcb_realloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 218 "parse_l.l" - - - -/* --------------------------------------------------------------------------- - * sets up the preprocessor command - */ -static int Parse(FILE *Pipe, const char *Executable, const char *Path, const char *Filename, const char *Parse_parameter) -{ - static char *command = NULL; - int returncode; - int used_popen = 0; - char *tmps; - size_t l; -#ifdef FLEX_SCANNER - static pcb_bool firsttime = pcb_true; -#endif - - if (Pipe == NULL) { - if (EMPTY_STRING_P (Executable)) - { - l = 2; - if ( Path != NULL ) - l += strlen (Path); - - l += strlen (Filename); - - if ( (tmps = (char *) malloc ( l * sizeof (char))) == NULL) - { - fprintf (stderr, "Parse(): malloc failed\n"); - exit (1); - } - - if ( Path != NULL && *Path != '\0') - sprintf (tmps, "%s%s%s", Path, PCB_DIR_SEPARATOR_S, Filename); - else - sprintf (tmps, "%s", Filename); - - pcb_in = fopen (tmps, "r"); - if (!pcb_in) - { - return(1); - } - free (tmps); - } - else - { - used_popen = 1; - - command = EvaluateFilename(Executable, Path, Filename, Parse_parameter); - - /* open pipe to stdout of command */ - if (*command == '\0' || (pcb_in = popen(command, "r")) == NULL) - { - PopenErrorMessage(command); - free(command); - return(1); - } - free(command); - } - } - else { - pcb_in = Pipe; - } - -#ifdef FLEX_SCANNER - /* reset parser if not called the first time */ - if (!firsttime) - pcb_restart(pcb_in); - firsttime = pcb_false; -#endif - - /* init linenumber and filename for yyerror() */ - pcb_lineno = 1; - yyfilename = Filename; - - /* We need to save the data temporarily because lex-yacc are able - * to break the application if the input file has an illegal format. - * It's not necessary if the system supports the call of functions - * on termination. - */ - - CreateBeLenient (pcb_true); - -#if !defined(HAS_ATEXIT) - if (PCB && PCB->Data) - SaveTMPData(); - returncode = pcb_parse(); - RemoveTMPData(); -#else - returncode = pcb_parse(); -#endif - /* clean up parse buffer */ - pcb__delete_buffer(YY_CURRENT_BUFFER); - - CreateBeLenient (pcb_false); - - if (Pipe != NULL) - return returncode; - - if (used_popen) - return(pclose(pcb_in) ? 1 : returncode); - return(fclose(pcb_in) ? 1 : returncode); -} - -/* --------------------------------------------------------------------------- - * initializes LEX and calls parser for a single element file - */ -int io_pcb_ParseElement(plug_io_t *ctx, DataTypePtr Ptr, const char *name) -{ - FILE *f; - int ret; - fp_fopen_ctx_t st; - - yy_settings_dest = CFR_invalid; - yyPCB = NULL; - yyData = Ptr; - yyFont = &PCB->Font; - yyElement = NULL; - - f = fp_fopen(fp_default_search_path(), name, &st); - - if (f == NULL) - return -1; - - ret = Parse(f, NULL,NULL,NULL,NULL); - - fp_fclose(f, &st); - - return(ret); -} - -/* --------------------------------------------------------------------------- - * initializes LEX and calls parser for a complete board - */ -#define TEST_FLAG_LOCAL(F,FLG) (((FLG) & (F)) ? 1 : 0) -#define CONF_BOOL_FLAG(F,FLG) (TEST_FLAG_LOCAL(F,FLG.f) ? "true" : "false") - -/* Hack: set a no-save-attribute flag while loading some fields from the file; - because we have all these flags set we won't need to list the paths that - have hardwired flags again in a "don't save these in attributes" list. */ -#define CONF_NO_ATTRIB(path) \ -do { \ - conf_native_t *n = conf_get_field(path); \ - if (n != NULL) \ - n->random_flags.io_pcb_no_attrib = 1; \ -} while(0) \ - -#define CONF_SET(target, path, arr_idx, new_val, pol) \ -do { \ - CONF_NO_ATTRIB(path); \ - conf_set(target, path, arr_idx, new_val, pol); \ -} while(0) \ - -int io_pcb_ParsePCB(plug_io_t *ctx, PCBTypePtr Ptr, const char *Filename, conf_role_t settings_dest) -{ - int retval; - yyPCB = Ptr; - yyData = NULL; - yyFont = NULL; - yyElement = NULL; - yy_settings_dest = settings_dest; - if (settings_dest != CFR_invalid) - conf_reset(settings_dest, Filename); - setlocale(LC_ALL, "C"); /* make sure numerics are read predictably */ - retval = Parse(NULL, conf_core.rc.file_command, conf_core.rc.file_path, Filename, NULL); - setlocale(LC_ALL, ""); - if ((settings_dest != CFR_invalid) && (retval == 0)) { - /* overwrite settings from the flags, mark them not-to-save */ - CONF_SET(settings_dest, "plugins/mincut/enable", -1, CONF_BOOL_FLAG(ENABLEPCB_FLAG_MINCUT, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/show_number", -1, CONF_BOOL_FLAG(SHOWNUMBERFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/show_drc", -1, CONF_BOOL_FLAG(SHOWPCB_FLAG_DRC, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/rubber_band_mode", -1, CONF_BOOL_FLAG(RUBBERBANDFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/auto_drc", -1, CONF_BOOL_FLAG(AUTOPCB_FLAG_DRC, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/all_direction_lines", -1, CONF_BOOL_FLAG(ALLDIRECTIONFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/swap_start_direction", -1, CONF_BOOL_FLAG(SWAPSTARTDIRFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/unique_names", -1, CONF_BOOL_FLAG(UNIQUENAMEFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/clear_line", -1, CONF_BOOL_FLAG(CLEARNEWFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/full_poly", -1, CONF_BOOL_FLAG(NEWPCB_FLAG_FULLPOLY, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/snap_pin", -1, CONF_BOOL_FLAG(SNAPPCB_FLAG_PIN, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/orthogonal_moves", -1, CONF_BOOL_FLAG(ORTHOMOVEFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/live_routing", -1, CONF_BOOL_FLAG(LIVEROUTEFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/lock_names", -1, CONF_BOOL_FLAG(LOCKNAMESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/only_names", -1, CONF_BOOL_FLAG(ONLYNAMESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/hide_names", -1, CONF_BOOL_FLAG(HIDENAMESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/thin_draw", -1, CONF_BOOL_FLAG(THINDRAWFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/thin_draw_poly", -1, CONF_BOOL_FLAG(THINDRAWPOLYFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/local_ref", -1, CONF_BOOL_FLAG(LOCALREFFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/check_planes", -1, CONF_BOOL_FLAG(CHECKPLANESFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/description", -1, CONF_BOOL_FLAG(DESCRIPTIONFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/name_on_pcb", -1, CONF_BOOL_FLAG(NAMEONPCBFLAG, yy_pcb_flags), POL_OVERWRITE); - CONF_SET(settings_dest, "editor/show_mask", -1, CONF_BOOL_FLAG(SHOWMASKFLAG, yy_pcb_flags), POL_OVERWRITE); - - /* don't save this because it is saved manually as PCB::grid::unit */ - CONF_NO_ATTRIB("editor/grid_unit"); - - /* don't save these to reduce noise - they are reset by the GUI anyway */ - CONF_NO_ATTRIB("editor/mode"); - - /* it's saved in [styles] */ - CONF_NO_ATTRIB("design/routes"); - - /* load config nodes not disabled above, from optional attributes */ - io_pcb_attrib_a2c(Ptr); - - conf_update(NULL); - } - if (retval == 0) { - /* restore loader so the next save will use the same units */ - const char *loader = AttributeGetFromList(&PCB->Attributes, "PCB::loader"); - if (loader != NULL) { - pcb_find_io_t f; - int len; - - len = pcb_find_io(&f, 1, PCB_IOT_PCB, 1, loader); -/* printf("PCB::loader: %s -> %d\n", loader, len);*/ - if (len > 0) { -/* printf(" ::loader: '%s'\n", f.plug->description);*/ - PCB->Data->loader = f.plug; - } - } - } - return retval; -} - -/* --------------------------------------------------------------------------- - * initializes LEX and calls parser for a font - */ -int io_pcb_ParseFont(plug_io_t *ctx, FontTypePtr Ptr, const char *Filename) -{ - int r = 0; - yyPCB = NULL; - yyFont = Ptr; - yyElement = NULL; - - yy_settings_dest = CFR_invalid; - r = Parse(NULL, conf_core.rc.font_command, NULL, Filename, NULL); - if (r == 0) { -#ifdef DEBUG - Message (PCB_MSG_DEBUG, "Found %s in %s\n", Filename, conf_core.rc.font_command); -#endif - } - return r; -} - -static int -parse_number () -{ - pcb_lval.number = strtod ((char *) pcb_text, NULL); - return FLOATING; -} - Index: 1.1.4/src_plugins/io_pcb/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/io_pcb/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/io_pcb/Plug.tmpasm (nonexistent) @@ -1,10 +0,0 @@ -put /local/pcb/mod {io_pcb} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/io_pcb/io_pcb.o $(PLUGDIR)/io_pcb/file.o $(PLUGDIR)/io_pcb/parse_y.o $(PLUGDIR)/io_pcb/parse_l.o $(PLUGDIR)/io_pcb/flags.o $(PLUGDIR)/io_pcb/attribs.o @] -put /local/pcb/mod/YACC {$(PLUGDIR)/io_pcb/parse_y} -put /local/pcb/mod/LEX {$(PLUGDIR)/io_pcb/parse_l} - -switch /local/pcb/io_pcb/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/io_pcb/parse_common.h =================================================================== --- 1.1.4/src_plugins/io_pcb/parse_common.h (revision 10776) +++ 1.1.4/src_plugins/io_pcb/parse_common.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - * RCS: $Id$ - */ - -/* just defines common parser identifiers - */ - -#ifndef PCB_LEX_H -#define PCB_LEX_H - -#include "global.h" -#include "plug_io.h" - -int io_pcb_ParsePCB(plug_io_t *ctx, PCBTypePtr Ptr, const char *Filename, conf_role_t settings_dest); -int io_pcb_ParseElement(plug_io_t *ctx, DataTypePtr, const char *); -int io_pcb_ParseFont(plug_io_t *ctx, FontTypePtr, const char *); - -#endif Index: 1.1.4/src_plugins/io_pcb/parse_y.y =================================================================== --- 1.1.4/src_plugins/io_pcb/parse_y.y (revision 10776) +++ 1.1.4/src_plugins/io_pcb/parse_y.y (nonexistent) @@ -1,2082 +0,0 @@ - -/* - * ************************** README ******************* - * - * If the file format is modified in any way, update - * PCB_FILE_VERSION in file.h - * - * ************************** README ******************* - */ - -%{ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* grammar to parse ASCII input of PCB description - */ - -#include "config.h" -#include "conf_core.h" -#include "global.h" -#include "layer.h" -#include "create.h" -#include "data.h" -#include "error.h" -#include "file.h" -#include "mymem.h" -#include "misc.h" -#include "parse_l.h" -#include "polygon.h" -#include "remove.h" -#include "rtree.h" -#include "strflags.h" -#include "thermal.h" -#include "rats_patch.h" -#include "flags.h" -#include "route_style.h" -#include "compat_misc.h" - -#ifdef HAVE_LIBDMALLOC -# include /* see http://dmalloc.com */ -#endif - - - -static LayerTypePtr Layer; -static PolygonTypePtr Polygon; -static SymbolTypePtr Symbol; -static int pin_num; -static LibraryMenuTypePtr Menu; -static pcb_bool LayerFlag[MAX_LAYER + 2]; - -extern char *yytext; /* defined by LEX */ -extern PCBTypePtr yyPCB; -extern DataTypePtr yyData; -extern ElementTypePtr yyElement; -extern FontTypePtr yyFont; -extern int pcb_lineno; /* linenumber */ -extern char *yyfilename; /* in this file */ -extern conf_role_t yy_settings_dest; -extern FlagType yy_pcb_flags; - -static char *layer_group_string; - -static AttributeListTypePtr attr_list; - -int yyerror(const char *s); -int yylex(); -static int check_file_version (int); - -static void do_measure (PLMeasure *m, Coord i, double d, int u); -#define M(r,f,d) do_measure (&(r), f, d, 1) - -/* Macros for interpreting what "measure" means - integer value only, - old units (mil), or new units (cmil). */ -#define IV(m) integer_value (m) -#define OU(m) old_units (m) -#define NU(m) new_units (m) - -static int integer_value (PLMeasure m); -static Coord old_units (PLMeasure m); -static Coord new_units (PLMeasure m); - -#define YYDEBUG 1 -#define YYERROR_VERBOSE 1 - -#include "parse_y.h" - -%} - -%name-prefix "pcb_" - -%verbose - -%union /* define YYSTACK type */ -{ - int integer; - double number; - char *string; - FlagType flagtype; - PLMeasure measure; -} - -%token FLOATING /* line thickness, coordinates ... */ -%token INTEGER CHAR_CONST /* flags ... */ -%token STRING /* element names ... */ - -%token T_FILEVERSION T_PCB T_LAYER T_VIA T_RAT T_LINE T_ARC T_RECTANGLE T_TEXT T_ELEMENTLINE -%token T_ELEMENT T_PIN T_PAD T_GRID T_FLAGS T_SYMBOL T_SYMBOLLINE T_CURSOR -%token T_ELEMENTARC T_MARK T_GROUPS T_STYLES T_POLYGON T_POLYGON_HOLE T_NETLIST T_NET T_CONN -%token T_NETLISTPATCH T_ADD_CONN T_DEL_CONN T_CHANGE_ATTRIB -%token T_AREA T_THERMAL T_DRC T_ATTRIBUTE -%token T_UMIL T_CMIL T_MIL T_IN T_NM T_UM T_MM T_M T_KM -%type symbolid -%type opt_string -%type flags -%type number -%type measure - -%% - -parse - : parsepcb - | parsedata - | parsefont - | error { YYABORT; } - ; - -/* %start-doc pcbfile 00pcb -@nodetype subsection -@nodename %s syntax - -A special note about units: Older versions of @code{pcb} used mils -(1/1000 inch) as the base unit; a value of 500 in the file meant -half an inch. Newer versions uses a "high resolution" syntax, -where the base unit is 1/100 of a mil (0.000010 inch); a value of 500 in -the file means 5 mils. As a general rule, the variants of each entry -listed below which use square brackets are the high resolution formats -and use the 1/100 mil units, and the ones with parentheses are the older -variants and use 1 mil units. Note that when multiple variants -are listed, the most recent (and most preferred) format is the first -listed. - -Symbolic and numeric flags (SFlags and NFlags) are described in -@ref{Object Flags}. - -%end-doc */ - -parsepcb - : { - /* reset flags for 'used layers'; - * init font and data pointers - */ - int i; - - if (!yyPCB) - { - Message(PCB_MSG_ERROR, "illegal fileformat\n"); - YYABORT; - } - for (i = 0; i < MAX_LAYER + 2; i++) - LayerFlag[i] = pcb_false; - yyFont = &yyPCB->Font; - yyData = yyPCB->Data; - yyData->pcb = yyPCB; - yyData->LayerN = 0; - yyPCB->NetlistPatches = yyPCB->NetlistPatchLast = NULL; - layer_group_string = NULL; - } - pcbfileversion - pcbname - pcbgrid - pcbcursor - polyarea - pcbthermal - pcbdrc - pcbflags - pcbgroups - pcbstyles - pcbfont - pcbdata - pcbnetlist - pcbnetlistpatch - { - PCBTypePtr pcb_save = PCB; - if ((yy_settings_dest != CFR_invalid) && (layer_group_string != NULL)) - conf_set(yy_settings_dest, "design/groups", -1, layer_group_string, POL_OVERWRITE); - CreateNewPCBPost (yyPCB, 0); - if (ParseGroupString(layer_group_string, &yyPCB->LayerGroups, yyData->LayerN)) - { - Message(PCB_MSG_ERROR, "illegal layer-group string\n"); - YYABORT; - } - /* initialize the polygon clipping now since - * we didn't know the layer grouping before. - */ - free(layer_group_string); - PCB = yyPCB; - ALLPOLYGON_LOOP (yyData); - { - InitClip (yyData, layer, polygon); - } - ENDALL_LOOP; - PCB = pcb_save; - } - - | { PreLoadElementPCB (); - layer_group_string = NULL; } - element - { LayerFlag[0] = pcb_true; - LayerFlag[1] = pcb_true; - yyData->LayerN = 2; - PostLoadElementPCB (); - } - ; - -parsedata - : { - /* reset flags for 'used layers'; - * init font and data pointers - */ - int i; - - if (!yyData || !yyFont) - { - Message(PCB_MSG_ERROR, "illegal fileformat\n"); - YYABORT; - } - for (i = 0; i < MAX_LAYER + 2; i++) - LayerFlag[i] = pcb_false; - yyData->LayerN = 0; - } - pcbdata - ; - -pcbfont - : parsefont - | - ; - -parsefont - : - { - /* mark all symbols invalid */ - int i; - - if (!yyFont) - { - Message(PCB_MSG_ERROR, "illegal fileformat\n"); - YYABORT; - } - yyFont->Valid = pcb_false; - for (i = 0; i <= MAX_FONTPOSITION; i++) - free (yyFont->Symbol[i].Line); - memset(yyFont->Symbol, 0, sizeof(yyFont->Symbol)); - } - symbols - { - yyFont->Valid = pcb_true; - SetFontInfo(yyFont); - } - ; - -/* %start-doc pcbfile FileVersion - -@syntax -FileVersion[Version] -@end syntax - -@table @var -@item Version -File format version. This version number represents the date when the pcb file -format was last changed. -@end table - -Any version of pcb build from sources equal to or newer -than this number should be able to read the file. If this line is not present -in the input file then file format compatibility is not checked. - - -%end-doc */ - -pcbfileversion -: | -T_FILEVERSION '[' INTEGER ']' -{ - if (check_file_version ($3) != 0) - { - YYABORT; - } -} -; - -/* %start-doc pcbfile PCB - -@syntax -PCB ["Name" Width Height] -PCB ("Name" Width Height] -PCB ("Name") -@end syntax - -@table @var -@item Name -Name of the PCB project -@item Width Height -Size of the board -@end table - -If you don't specify the size of the board, a very large default is -chosen. - -%end-doc */ - -pcbname - : T_PCB '(' STRING ')' - { - yyPCB->Name = $3; - yyPCB->MaxWidth = MAX_COORD; - yyPCB->MaxHeight = MAX_COORD; - } - | T_PCB '(' STRING measure measure ')' - { - yyPCB->Name = $3; - yyPCB->MaxWidth = OU ($4); - yyPCB->MaxHeight = OU ($5); - } - | T_PCB '[' STRING measure measure ']' - { - yyPCB->Name = $3; - yyPCB->MaxWidth = NU ($4); - yyPCB->MaxHeight = NU ($5); - } - ; - -/* %start-doc pcbfile Grid - -@syntax -Grid [Step OffsetX OffsetY Visible] -Grid (Step OffsetX OffsetY Visible) -Grid (Step OffsetX OffsetY) -@end syntax - -@table @var -@item Step -Distance from one grid point to adjacent points. This value may be a -floating point number for the first two variants. -@item OffsetX OffsetY -The "origin" of the grid. Normally zero. -@item Visible -If non-zero, the grid will be visible on the screen. -@end table - -%end-doc */ - -pcbgrid - : pcbgridold - | pcbgridnew - | pcbhigrid - ; -pcbgridold - : T_GRID '(' measure measure measure ')' - { - yyPCB->Grid = OU ($3); - yyPCB->GridOffsetX = OU ($4); - yyPCB->GridOffsetY = OU ($5); - } - ; -pcbgridnew - : T_GRID '(' measure measure measure INTEGER ')' - { - yyPCB->Grid = OU ($3); - yyPCB->GridOffsetX = OU ($4); - yyPCB->GridOffsetY = OU ($5); - if (yy_settings_dest != CFR_invalid) { - if ($6) - conf_set(yy_settings_dest, "editor/draw_grid", -1, "true", POL_OVERWRITE); - else - conf_set(yy_settings_dest, "editor/draw_grid", -1, "false", POL_OVERWRITE); - } - } - ; - -pcbhigrid - : T_GRID '[' measure measure measure INTEGER ']' - { - yyPCB->Grid = NU ($3); - yyPCB->GridOffsetX = NU ($4); - yyPCB->GridOffsetY = NU ($5); - if (yy_settings_dest != CFR_invalid) { - if ($6) - conf_set(yy_settings_dest, "editor/draw_grid", -1, "true", POL_OVERWRITE); - else - conf_set(yy_settings_dest, "editor/draw_grid", -1, "false", POL_OVERWRITE); - } - } - ; - -/* %start-doc pcbfile Cursor - -@syntax -Cursor [X Y Zoom] -Cursor (X Y Zoom) -@end syntax - -@table @var -@item X Y -Location of the cursor when the board was saved. -@item Zoom -The current zoom factor. Note that a zoom factor of "0" means 1 mil -per screen pixel, N means @math{2^N} mils per screen pixel, etc. The -first variant accepts floating point numbers. The special value -"1000" means "zoom to fit" -@end table - -%end-doc */ - -pcbcursor - : T_CURSOR '(' measure measure number ')' - { - yyPCB->CursorX = OU ($3); - yyPCB->CursorY = OU ($4); - yyPCB->Zoom = $5*2; - } - | T_CURSOR '[' measure measure number ']' - { - yyPCB->CursorX = NU ($3); - yyPCB->CursorY = NU ($4); - yyPCB->Zoom = $5; - } - | - ; - -/* %start-doc pcbfile PolyArea - -@syntax -PolyArea [Area] -@end syntax - -@table @var -@item Area -Minimum area of polygon island to retain. If a polygon has clearances that cause an isolated island to be created, then will only be retained if the area exceeds this minimum area. -@end table - -%end-doc */ - -polyarea - : - | T_AREA '[' number ']' - { - /* Read in cmil^2 for now; in future this should be a noop. */ - yyPCB->IsleArea = PCB_MIL_TO_COORD (PCB_MIL_TO_COORD ($3) / 100.0) / 100.0; - } - ; - - -/* %start-doc pcbfile Thermal - -@syntax -Thermal [Scale] -@end syntax - -@table @var -@item Scale -Relative size of thermal fingers. A value of 1.0 makes the finger -width twice the clearance gap width (measured across the gap, not -diameter). The normal value is 0.5, which results in a finger width -the same as the clearance gap width. -@end table - -%end-doc */ - - -pcbthermal - : - | T_THERMAL '[' number ']' - { - yyPCB->ThermScale = $3; - } - ; - -/* %start-doc pcbfile DRC - -@syntax -DRC [Bloat Shrink Line Silk Drill Ring] -DRC [Bloat Shrink Line Silk] -DRC [Bloat Shrink Line] -@end syntax - -@table @var -@item Bloat -Minimum spacing between copper. -@item Shrink -Minimum copper overlap to guarantee connectivity. -@item Line -Minimum line thickness. -@item Silk -Minimum silk thickness. -@item Drill -Minimum drill size. -@item Ring -Minimum width of the annular ring around pins and vias. -@end table - -%end-doc */ - -pcbdrc - : - | pcbdrc1 - | pcbdrc2 - | pcbdrc3 - ; - -pcbdrc1 - : T_DRC '[' measure measure measure ']' - { - yyPCB->Bloat = NU ($3); - yyPCB->Shrink = NU ($4); - yyPCB->minWid = NU ($5); - yyPCB->minRing = NU ($5); - } - ; - -pcbdrc2 - : T_DRC '[' measure measure measure measure ']' - { - yyPCB->Bloat = NU ($3); - yyPCB->Shrink = NU ($4); - yyPCB->minWid = NU ($5); - yyPCB->minSlk = NU ($6); - yyPCB->minRing = NU ($5); - } - ; - -pcbdrc3 - : T_DRC '[' measure measure measure measure measure measure ']' - { - yyPCB->Bloat = NU ($3); - yyPCB->Shrink = NU ($4); - yyPCB->minWid = NU ($5); - yyPCB->minSlk = NU ($6); - yyPCB->minDrill = NU ($7); - yyPCB->minRing = NU ($8); - } - ; - -/* %start-doc pcbfile Flags - -@syntax -Flags(Number) -@end syntax - -@table @var -@item Number -A number, whose value is normally given in hex, individual bits of which -represent pcb-wide flags as defined in @ref{PCBFlags}. - -@end table - -%end-doc */ - -pcbflags - : T_FLAGS '(' INTEGER ')' - { - yy_pcb_flags = MakeFlags ($3 & PCB_FLAGS); - } - | T_FLAGS '(' STRING ')' - { - yy_pcb_flags = string_to_pcbflags ($3, yyerror); - free($3); - } - | - ; - -/* %start-doc pcbfile Groups - -@syntax -Groups("String") -@end syntax - -@table @var -@item String - -Encodes the layer grouping information. Each group is separated by a -colon, each member of each group is separated by a comma. Group -members are either numbers from @code{1}..@var{N} for each layer, and -the letters @code{c} or @code{s} representing the component side and -solder side of the board. Including @code{c} or @code{s} marks that -group as being the top or bottom side of the board. - -@example -Groups("1,2,c:3:4:5,6,s:7,8") -@end example - -@end table - -%end-doc */ - -pcbgroups - : T_GROUPS '(' STRING ')' - { - layer_group_string = $3; - } - | - ; - -/* %start-doc pcbfile Styles - -@syntax -Styles("String") -@end syntax - -@table @var -@item String - -Encodes the four routing styles @code{pcb} knows about. The four styles -are separated by colons. Each style consists of five parameters as follows: - -@table @var -@item Name -The name of the style. -@item Thickness -Width of lines and arcs. -@item Diameter -Copper diameter of pins and vias. -@item Drill -Drill diameter of pins and vias. -@item Keepaway -Minimum spacing to other nets. If omitted, 10 mils is the default. - -@end table - -@end table - -@example -Styles("Signal,10,40,20:Power,25,60,35:Fat,40,60,35:Skinny,8,36,20") -Styles["Logic,1000,3600,2000,1000:Power,2500,6000,3500,1000: -@ @ @ Line,4000,6000,3500,1000:Breakout,600,2402,1181,600"] -@end example - -@noindent -Note that strings in actual files cannot span lines; the above example -is split across lines only to make it readable. - -%end-doc */ - -pcbstyles - : T_STYLES '(' STRING ')' - { - if (ParseRouteString($3, &yyPCB->RouteStyle, "mil")) - { - Message(PCB_MSG_ERROR, "illegal route-style string\n"); - YYABORT; - } - free($3); - } - | T_STYLES '[' STRING ']' - { - if (ParseRouteString(($3 == NULL ? "" : $3), &yyPCB->RouteStyle, "cmil")) - { - Message(PCB_MSG_ERROR, "illegal route-style string\n"); - YYABORT; - } - free($3); - } - | - ; - -pcbdata - : pcbdefinitions - | - ; - -pcbdefinitions - : pcbdefinition - | pcbdefinitions pcbdefinition - ; - -pcbdefinition - : via - | { attr_list = & yyPCB->Attributes; } attribute - | rats - | layer - | - { - /* clear pointer to force memory allocation by - * the appropriate subroutine - */ - yyElement = NULL; - } - element - | error { YYABORT; } - ; - -via - : via_hi_format - | via_2.0_format - | via_1.7_format - | via_newformat - | via_oldformat - ; - -/* %start-doc pcbfile Via - -@syntax -Via [X Y Thickness Clearance Mask Drill "Name" SFlags] -Via (X Y Thickness Clearance Mask Drill "Name" NFlags) -Via (X Y Thickness Clearance Drill "Name" NFlags) -Via (X Y Thickness Drill "Name" NFlags) -Via (X Y Thickness "Name" NFlags) -@end syntax - -@table @var -@item X Y -coordinates of center -@item Thickness -outer diameter of copper annulus -@item Clearance -add to thickness to get clearance diameter -@item Mask -diameter of solder mask opening -@item Drill -diameter of drill -@item Name -string, name of via (vias have names?) -@item SFlags -symbolic or numerical flags -@item NFlags -numerical flags only -@end table - -%end-doc */ - -via_hi_format - /* x, y, thickness, clearance, mask, drilling-hole, name, flags */ - : T_VIA '[' measure measure measure measure measure measure STRING flags ']' - { - CreateNewVia(yyData, NU ($3), NU ($4), NU ($5), NU ($6), NU ($7), - NU ($8), $9, $10); - free ($9); - } - ; - -via_2.0_format - /* x, y, thickness, clearance, mask, drilling-hole, name, flags */ - : T_VIA '(' measure measure measure measure measure measure STRING INTEGER ')' - { - CreateNewVia(yyData, OU ($3), OU ($4), OU ($5), OU ($6), OU ($7), OU ($8), $9, - OldFlags($10)); - free ($9); - } - ; - - -via_1.7_format - /* x, y, thickness, clearance, drilling-hole, name, flags */ - : T_VIA '(' measure measure measure measure measure STRING INTEGER ')' - { - CreateNewVia(yyData, OU ($3), OU ($4), OU ($5), OU ($6), - OU ($5) + OU($6), OU ($7), $8, OldFlags($9)); - free ($8); - } - ; - -via_newformat - /* x, y, thickness, drilling-hole, name, flags */ - : T_VIA '(' measure measure measure measure STRING INTEGER ')' - { - CreateNewVia(yyData, OU ($3), OU ($4), OU ($5), 2*GROUNDPLANEFRAME, - OU($5) + 2*MASKFRAME, OU ($6), $7, OldFlags($8)); - free ($7); - } - ; - -via_oldformat - /* old format: x, y, thickness, name, flags */ - : T_VIA '(' measure measure measure STRING INTEGER ')' - { - Coord hole = (OU($5) * DEFAULT_DRILLINGHOLE); - - /* make sure that there's enough copper left */ - if (OU($5) - hole < MIN_PINORVIACOPPER && - OU($5) > MIN_PINORVIACOPPER) - hole = OU($5) - MIN_PINORVIACOPPER; - - CreateNewVia(yyData, OU ($3), OU ($4), OU ($5), 2*GROUNDPLANEFRAME, - OU($5) + 2*MASKFRAME, hole, $6, OldFlags($7)); - free ($6); - } - ; - -/* %start-doc pcbfile Rat - -@syntax -Rat [X1 Y1 Group1 X2 Y2 Group2 SFlags] -Rat (X1 Y1 Group1 X2 Y2 Group2 NFlags) -@end syntax - -@table @var -@item X1 Y1 X2 Y2 -The endpoints of the rat line. -@item Group1 Group2 -The layer group each end is connected on. -@item SFlags -Symbolic or numeric flags. -@item NFlags -Numeric flags. -@end table - -%end-doc */ - -rats - : T_RAT '[' measure measure INTEGER measure measure INTEGER flags ']' - { - CreateNewRat(yyData, NU ($3), NU ($4), NU ($6), NU ($7), $5, $8, - conf_core.appearance.rat_thickness, $9); - } - | T_RAT '(' measure measure INTEGER measure measure INTEGER INTEGER ')' - { - CreateNewRat(yyData, OU ($3), OU ($4), OU ($6), OU ($7), $5, $8, - conf_core.appearance.rat_thickness, OldFlags($9)); - } - ; - -/* %start-doc pcbfile Layer - -@syntax -Layer (LayerNum "Name") ( -@ @ @ @dots{} contents @dots{} -) -@end syntax - -@table @var -@item LayerNum -The layer number. Layers are numbered sequentially, starting with 1. -The last two layers (9 and 10 by default) are solder-side silk and -component-side silk, in that order. -@item Name -The layer name. -@item contents -The contents of the layer, which may include attributes, lines, arcs, rectangles, -text, and polygons. -@end table - -%end-doc */ - -layer - /* name */ - : T_LAYER '(' INTEGER STRING opt_string ')' '(' - { - if ($3 <= 0 || $3 > MAX_LAYER + 2) - { - yyerror("Layernumber out of range"); - YYABORT; - } - if (LayerFlag[$3-1]) - { - yyerror("Layernumber used twice"); - YYABORT; - } - Layer = &yyData->Layer[$3-1]; - - /* memory for name is already allocated */ - if (Layer->Name != NULL) - free((char*)Layer->Name); - Layer->Name = $4; /* shouldn't this be strdup()'ed ? */ - LayerFlag[$3-1] = pcb_true; - if (yyData->LayerN + 2 < $3) - yyData->LayerN = $3 - 2; - if ($5 != NULL) - free($5); - } - layerdata ')' - ; - -layerdata - : layerdefinitions - | - ; - -layerdefinitions - : layerdefinition - | layerdefinitions layerdefinition - ; - -layerdefinition - : line_hi_format - | line_1.7_format - | line_oldformat - | arc_hi_format - | arc_1.7_format - | arc_oldformat - /* x1, y1, x2, y2, flags */ - | T_RECTANGLE '(' measure measure measure measure INTEGER ')' - { - CreateNewPolygonFromRectangle(Layer, - OU ($3), OU ($4), OU ($3) + OU ($5), OU ($4) + OU ($6), OldFlags($7)); - } - | text_hi_format - | text_newformat - | text_oldformat - | { attr_list = & Layer->Attributes; } attribute - | polygon_format - -/* %start-doc pcbfile Line - -@syntax -Line [X1 Y1 X2 Y2 Thickness Clearance SFlags] -Line (X1 Y1 X2 Y2 Thickness Clearance NFlags) -Line (X1 Y1 X2 Y2 Thickness NFlags) -@end syntax - -@table @var -@item X1 Y1 X2 Y2 -The end points of the line -@item Thickness -The width of the line -@item Clearance -The amount of space cleared around the line when the line passes -through a polygon. The clearance is added to the thickness to get the -thickness of the clear; thus the space between the line and the -polygon is @math{Clearance/2} wide. -@item SFlags -Symbolic or numeric flags -@item NFlags -Numeric flags. -@end table - -%end-doc */ - -line_hi_format - /* x1, y1, x2, y2, thickness, clearance, flags */ - : T_LINE '[' measure measure measure measure measure measure flags ']' - { - CreateNewLineOnLayer(Layer, NU ($3), NU ($4), NU ($5), NU ($6), - NU ($7), NU ($8), $9); - } - ; - -line_1.7_format - /* x1, y1, x2, y2, thickness, clearance, flags */ - : T_LINE '(' measure measure measure measure measure measure INTEGER ')' - { - CreateNewLineOnLayer(Layer, OU ($3), OU ($4), OU ($5), OU ($6), - OU ($7), OU ($8), OldFlags($9)); - } - ; - -line_oldformat - /* x1, y1, x2, y2, thickness, flags */ - : T_LINE '(' measure measure measure measure measure measure ')' - { - /* eliminate old-style rat-lines */ - if ((IV ($8) & PCB_FLAG_RAT) == 0) - CreateNewLineOnLayer(Layer, OU ($3), OU ($4), OU ($5), OU ($6), OU ($7), - 200*GROUNDPLANEFRAME, OldFlags(IV ($8))); - } - ; - -/* %start-doc pcbfile Arc - -@syntax -Arc [X Y Width Height Thickness Clearance StartAngle DeltaAngle SFlags] -Arc (X Y Width Height Thickness Clearance StartAngle DeltaAngle NFlags) -Arc (X Y Width Height Thickness StartAngle DeltaAngle NFlags) -@end syntax - -@table @var -@item X Y -Coordinates of the center of the arc. -@item Width Height -The width and height, from the center to the edge. The bounds of the -circle of which this arc is a segment, is thus @math{2*Width} by -@math{2*Height}. -@item Thickness -The width of the copper trace which forms the arc. -@item Clearance -The amount of space cleared around the arc when the line passes -through a polygon. The clearance is added to the thickness to get the -thickness of the clear; thus the space between the arc and the polygon -is @math{Clearance/2} wide. -@item StartAngle -The angle of one end of the arc, in degrees. In PCB, an angle of zero -points left (negative X direction), and 90 degrees points down -(positive Y direction). -@item DeltaAngle -The sweep of the arc. This may be negative. Positive angles sweep -counterclockwise. -@item SFlags -Symbolic or numeric flags. -@item NFlags -Numeric flags. -@end table - -%end-doc */ - -arc_hi_format - /* x, y, width, height, thickness, clearance, startangle, delta, flags */ - : T_ARC '[' measure measure measure measure measure measure number number flags ']' - { - CreateNewArcOnLayer(Layer, NU ($3), NU ($4), NU ($5), NU ($6), $9, $10, - NU ($7), NU ($8), $11); - } - ; - -arc_1.7_format - /* x, y, width, height, thickness, clearance, startangle, delta, flags */ - : T_ARC '(' measure measure measure measure measure measure number number INTEGER ')' - { - CreateNewArcOnLayer(Layer, OU ($3), OU ($4), OU ($5), OU ($6), $9, $10, - OU ($7), OU ($8), OldFlags($11)); - } - ; - -arc_oldformat - /* x, y, width, height, thickness, startangle, delta, flags */ - : T_ARC '(' measure measure measure measure measure measure number INTEGER ')' - { - CreateNewArcOnLayer(Layer, OU ($3), OU ($4), OU ($5), OU ($5), IV ($8), $9, - OU ($7), 200*GROUNDPLANEFRAME, OldFlags($10)); - } - ; - -/* %start-doc pcbfile Text - -@syntax -Text [X Y Direction Scale "String" SFlags] -Text (X Y Direction Scale "String" NFlags) -Text (X Y Direction "String" NFlags) -@end syntax - -@table @var -@item X Y -The location of the upper left corner of the text. -@item Direction -0 means text is drawn left to right, 1 means up, 2 means right to left -(i.e. upside down), and 3 means down. -@item Scale -Size of the text, as a percentage of the ``default'' size of of the -font (the default font is about 40 mils high). Default is 100 (40 -mils). -@item String -The string to draw. -@item SFlags -Symbolic or numeric flags. -@item NFlags -Numeric flags. -@end table - -%end-doc */ - -text_oldformat - /* x, y, direction, text, flags */ - : T_TEXT '(' measure measure number STRING INTEGER ')' - { - /* use a default scale of 100% */ - CreateNewText(Layer,yyFont,OU ($3), OU ($4), $5, 100, $6, OldFlags($7)); - free ($6); - } - ; - -text_newformat - /* x, y, direction, scale, text, flags */ - : T_TEXT '(' measure measure number number STRING INTEGER ')' - { - if ($8 & PCB_FLAG_ONSILK) - { - LayerTypePtr lay = &yyData->Layer[yyData->LayerN + - (($8 & PCB_FLAG_ONSOLDER) ? SOLDER_LAYER : COMPONENT_LAYER)]; - - CreateNewText(lay ,yyFont, OU ($3), OU ($4), $5, $6, $7, - OldFlags($8)); - } - else - CreateNewText(Layer, yyFont, OU ($3), OU ($4), $5, $6, $7, - OldFlags($8)); - free ($7); - } - ; -text_hi_format - /* x, y, direction, scale, text, flags */ - : T_TEXT '[' measure measure number number STRING flags ']' - { - /* FIXME: shouldn't know about .f */ - /* I don't think this matters because anything with hi_format - * will have the silk on its own layer in the file rather - * than using the PCB_FLAG_ONSILK and having it in a copper layer. - * Thus there is no need for anything besides the 'else' - * part of this code. - */ - if ($8.f & PCB_FLAG_ONSILK) - { - LayerTypePtr lay = &yyData->Layer[yyData->LayerN + - (($8.f & PCB_FLAG_ONSOLDER) ? SOLDER_LAYER : COMPONENT_LAYER)]; - - CreateNewText(lay, yyFont, NU ($3), NU ($4), $5, $6, $7, $8); - } - else - CreateNewText(Layer, yyFont, NU ($3), NU ($4), $5, $6, $7, $8); - free ($7); - } - ; - -/* %start-doc pcbfile Polygon - -@syntax -Polygon (SFlags) ( -@ @ @ @dots{} (X Y) @dots{} -@ @ @ @dots{} [X Y] @dots{} -@ @ @ Hole ( -@ @ @ @ @ @ @dots{} (X Y) @dots{} -@ @ @ @ @ @ @dots{} [X Y] @dots{} -@ @ @ ) -@ @ @ @dots{} -) -@end syntax - -@table @var -@item SFlags -Symbolic or numeric flags. -@item X Y -Coordinates of each vertex. You must list at least three coordinates. -@item Hole (...) -Defines a hole within the polygon's outer contour. There may be zero or more such sections. -@end table - -%end-doc */ - -polygon_format - : /* flags are passed in */ - T_POLYGON '(' flags ')' '(' - { - Polygon = CreateNewPolygon(Layer, $3); - } - polygonpoints - polygonholes ')' - { - pcb_cardinal_t contour, contour_start, contour_end; - pcb_bool bad_contour_found = pcb_false; - /* ignore junk */ - for (contour = 0; contour <= Polygon->HoleIndexN; contour++) - { - contour_start = (contour == 0) ? - 0 : Polygon->HoleIndex[contour - 1]; - contour_end = (contour == Polygon->HoleIndexN) ? - Polygon->PointN : - Polygon->HoleIndex[contour]; - if (contour_end - contour_start < 3) - bad_contour_found = pcb_true; - } - - if (bad_contour_found) - { - Message(PCB_MSG_WARNING, "WARNING parsing file '%s'\n" - " line: %i\n" - " description: 'ignored polygon (< 3 points in a contour)'\n", - yyfilename, pcb_lineno); - DestroyObject(yyData, PCB_TYPE_POLYGON, Layer, Polygon, Polygon); - } - else - { - SetPolygonBoundingBox (Polygon); - if (!Layer->polygon_tree) - Layer->polygon_tree = r_create_tree (NULL, 0, 0); - r_insert_entry (Layer->polygon_tree, (BoxType *) Polygon, 0); - } - } - ; - -polygonholes - : /* empty */ - | polygonholes polygonhole - ; - -polygonhole - : T_POLYGON_HOLE '(' - { - CreateNewHoleInPolygon (Polygon); - } - polygonpoints ')' - ; - -polygonpoints - : /* empty */ - | polygonpoint polygonpoints - ; - -polygonpoint - /* xcoord ycoord */ - : '(' measure measure ')' - { - CreateNewPointInPolygon(Polygon, OU ($2), OU ($3)); - } - | '[' measure measure ']' - { - CreateNewPointInPolygon(Polygon, NU ($2), NU ($3)); - } - ; - -/* %start-doc pcbfile Element - -@syntax -Element [SFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TSFlags] ( -Element (NFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TNFlags) ( -Element (NFlags "Desc" "Name" "Value" TX TY TDir TScale TNFlags) ( -Element (NFlags "Desc" "Name" TX TY TDir TScale TNFlags) ( -Element ("Desc" "Name" TX TY TDir TScale TNFlags) ( -@ @ @ @dots{} contents @dots{} -) -@end syntax - -@table @var -@item SFlags -Symbolic or numeric flags, for the element as a whole. -@item NFlags -Numeric flags, for the element as a whole. -@item Desc -The description of the element. This is one of the three strings -which can be displayed on the screen. -@item Name -The name of the element, usually the reference designator. -@item Value -The value of the element. -@item MX MY -The location of the element's mark. This is the reference point -for placing the element and its pins and pads. -@item TX TY -The upper left corner of the text (one of the three strings). -@item TDir -The relative direction of the text. 0 means left to right for -an unrotated element, 1 means up, 2 left, 3 down. -@item TScale -Size of the text, as a percentage of the ``default'' size of of the -font (the default font is about 40 mils high). Default is 100 (40 -mils). -@item TSFlags -Symbolic or numeric flags, for the text. -@item TNFlags -Numeric flags, for the text. -@end table - -Elements may contain pins, pads, element lines, element arcs, -attributes, and (for older elements) an optional mark. Note that -element definitions that have the mark coordinates in the element -line, only support pins and pads which use relative coordinates. The -pin and pad coordinates are relative to the mark. Element definitions -which do not include the mark coordinates in the element line, may -have a Mark definition in their contents, and only use pin and pad -definitions which use absolute coordinates. - -%end-doc */ - -element - : element_oldformat - | element_1.3.4_format - | element_newformat - | element_1.7_format - | element_hi_format - ; - -element_oldformat - /* element_flags, description, pcb-name, - * text_x, text_y, text_direction, text_scale, text_flags - */ - : T_ELEMENT '(' STRING STRING measure measure INTEGER ')' '(' - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, NoFlags(), - $3, $4, NULL, OU ($5), OU ($6), $7, 100, NoFlags(), pcb_false); - free ($3); - free ($4); - pin_num = 1; - } - elementdefinitions ')' - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } - ; - -element_1.3.4_format - /* element_flags, description, pcb-name, - * text_x, text_y, text_direction, text_scale, text_flags - */ - : T_ELEMENT '(' INTEGER STRING STRING measure measure measure measure INTEGER ')' '(' - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3), - $4, $5, NULL, OU ($6), OU ($7), IV ($8), IV ($9), OldFlags($10), pcb_false); - free ($4); - free ($5); - pin_num = 1; - } - elementdefinitions ')' - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } - ; - -element_newformat - /* element_flags, description, pcb-name, value, - * text_x, text_y, text_direction, text_scale, text_flags - */ - : T_ELEMENT '(' INTEGER STRING STRING STRING measure measure measure measure INTEGER ')' '(' - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3), - $4, $5, $6, OU ($7), OU ($8), IV ($9), IV ($10), OldFlags($11), pcb_false); - free ($4); - free ($5); - free ($6); - pin_num = 1; - } - elementdefinitions ')' - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } - ; - -element_1.7_format - /* element_flags, description, pcb-name, value, mark_x, mark_y, - * text_x, text_y, text_direction, text_scale, text_flags - */ - : T_ELEMENT '(' INTEGER STRING STRING STRING measure measure - measure measure number number INTEGER ')' '(' - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, OldFlags($3), - $4, $5, $6, OU ($7) + OU ($9), OU ($8) + OU ($10), - $11, $12, OldFlags($13), pcb_false); - yyElement->MarkX = OU ($7); - yyElement->MarkY = OU ($8); - free ($4); - free ($5); - free ($6); - } - relementdefs ')' - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } - ; - -element_hi_format - /* element_flags, description, pcb-name, value, mark_x, mark_y, - * text_x, text_y, text_direction, text_scale, text_flags - */ - : T_ELEMENT '[' flags STRING STRING STRING measure measure - measure measure number number flags ']' '(' - { - yyElement = CreateNewElement(yyData, yyElement, yyFont, $3, - $4, $5, $6, NU ($7) + NU ($9), NU ($8) + NU ($10), - $11, $12, $13, pcb_false); - yyElement->MarkX = NU ($7); - yyElement->MarkY = NU ($8); - free ($4); - free ($5); - free ($6); - } - relementdefs ')' - { - SetElementBoundingBox(yyData, yyElement, yyFont); - } - ; - -/* %start-doc pcbfile ElementLine - -@syntax -ElementLine [X1 Y1 X2 Y2 Thickness] -ElementLine (X1 Y1 X2 Y2 Thickness) -@end syntax - -@table @var -@item X1 Y1 X2 Y2 -Coordinates of the endpoints of the line. These are relative to the -Element's mark point for new element formats, or absolute for older -formats. -@item Thickness -The width of the silk for this line. -@end table - -%end-doc */ - -/* %start-doc pcbfile ElementArc - -@syntax -ElementArc [X Y Width Height StartAngle DeltaAngle Thickness] -ElementArc (X Y Width Height StartAngle DeltaAngle Thickness) -@end syntax - -@table @var -@item X Y -Coordinates of the center of the arc. These are relative to the -Element's mark point for new element formats, or absolute for older -formats. -@item Width Height -The width and height, from the center to the edge. The bounds of the -circle of which this arc is a segment, is thus @math{2*Width} by -@math{2*Height}. -@item StartAngle -The angle of one end of the arc, in degrees. In PCB, an angle of zero -points left (negative X direction), and 90 degrees points down -(positive Y direction). -@item DeltaAngle -The sweep of the arc. This may be negative. Positive angles sweep -counterclockwise. -@item Thickness -The width of the silk line which forms the arc. -@end table - -%end-doc */ - -/* %start-doc pcbfile Mark - -@syntax -Mark [X Y] -Mark (X Y) -@end syntax - -@table @var -@item X Y -Coordinates of the Mark, for older element formats that don't have -the mark as part of the Element line. -@end table - -%end-doc */ - -elementdefinitions - : elementdefinition - | elementdefinitions elementdefinition - ; - -elementdefinition - : pin_1.6.3_format - | pin_newformat - | pin_oldformat - | pad_newformat - | pad - /* x1, y1, x2, y2, thickness */ - | T_ELEMENTLINE '[' measure measure measure measure measure ']' - { - CreateNewLineInElement(yyElement, NU ($3), NU ($4), NU ($5), NU ($6), NU ($7)); - } - /* x1, y1, x2, y2, thickness */ - | T_ELEMENTLINE '(' measure measure measure measure measure ')' - { - CreateNewLineInElement(yyElement, OU ($3), OU ($4), OU ($5), OU ($6), OU ($7)); - } - /* x, y, width, height, startangle, anglediff, thickness */ - | T_ELEMENTARC '[' measure measure measure measure number number measure ']' - { - CreateNewArcInElement(yyElement, NU ($3), NU ($4), NU ($5), NU ($6), $7, $8, NU ($9)); - } - /* x, y, width, height, startangle, anglediff, thickness */ - | T_ELEMENTARC '(' measure measure measure measure number number measure ')' - { - CreateNewArcInElement(yyElement, OU ($3), OU ($4), OU ($5), OU ($6), $7, $8, OU ($9)); - } - /* x, y position */ - | T_MARK '[' measure measure ']' - { - yyElement->MarkX = NU ($3); - yyElement->MarkY = NU ($4); - } - | T_MARK '(' measure measure ')' - { - yyElement->MarkX = OU ($3); - yyElement->MarkY = OU ($4); - } - | { attr_list = & yyElement->Attributes; } attribute - ; - -relementdefs - : relementdef - | relementdefs relementdef - ; - -relementdef - : pin_1.7_format - | pin_hi_format - | pad_1.7_format - | pad_hi_format - /* x1, y1, x2, y2, thickness */ - | T_ELEMENTLINE '[' measure measure measure measure measure ']' - { - CreateNewLineInElement(yyElement, NU ($3) + yyElement->MarkX, - NU ($4) + yyElement->MarkY, NU ($5) + yyElement->MarkX, - NU ($6) + yyElement->MarkY, NU ($7)); - } - | T_ELEMENTLINE '(' measure measure measure measure measure ')' - { - CreateNewLineInElement(yyElement, OU ($3) + yyElement->MarkX, - OU ($4) + yyElement->MarkY, OU ($5) + yyElement->MarkX, - OU ($6) + yyElement->MarkY, OU ($7)); - } - /* x, y, width, height, startangle, anglediff, thickness */ - | T_ELEMENTARC '[' measure measure measure measure number number measure ']' - { - CreateNewArcInElement(yyElement, NU ($3) + yyElement->MarkX, - NU ($4) + yyElement->MarkY, NU ($5), NU ($6), $7, $8, NU ($9)); - } - | T_ELEMENTARC '(' measure measure measure measure number number measure ')' - { - CreateNewArcInElement(yyElement, OU ($3) + yyElement->MarkX, - OU ($4) + yyElement->MarkY, OU ($5), OU ($6), $7, $8, OU ($9)); - } - | { attr_list = & yyElement->Attributes; } attribute - ; - -/* %start-doc pcbfile Pin - -@syntax -Pin [rX rY Thickness Clearance Mask Drill "Name" "Number" SFlags] -Pin (rX rY Thickness Clearance Mask Drill "Name" "Number" NFlags) -Pin (aX aY Thickness Drill "Name" "Number" NFlags) -Pin (aX aY Thickness Drill "Name" NFlags) -Pin (aX aY Thickness "Name" NFlags) -@end syntax - -@table @var -@item rX rY -coordinates of center, relative to the element's mark -@item aX aY -absolute coordinates of center. -@item Thickness -outer diameter of copper annulus -@item Clearance -add to thickness to get clearance diameter -@item Mask -diameter of solder mask opening -@item Drill -diameter of drill -@item Name -name of pin -@item Number -number of pin -@item SFlags -symbolic or numerical flags -@item NFlags -numerical flags only -@end table - -%end-doc */ - -pin_hi_format - /* x, y, thickness, clearance, mask, drilling hole, name, - number, flags */ - : T_PIN '[' measure measure measure measure measure measure STRING STRING flags ']' - { - CreateNewPin(yyElement, NU ($3) + yyElement->MarkX, - NU ($4) + yyElement->MarkY, NU ($5), NU ($6), NU ($7), NU ($8), $9, - $10, $11); - free ($9); - free ($10); - } - ; -pin_1.7_format - /* x, y, thickness, clearance, mask, drilling hole, name, - number, flags */ - : T_PIN '(' measure measure measure measure measure measure STRING STRING INTEGER ')' - { - CreateNewPin(yyElement, OU ($3) + yyElement->MarkX, - OU ($4) + yyElement->MarkY, OU ($5), OU ($6), OU ($7), OU ($8), $9, - $10, OldFlags($11)); - free ($9); - free ($10); - } - ; - -pin_1.6.3_format - /* x, y, thickness, drilling hole, name, number, flags */ - : T_PIN '(' measure measure measure measure STRING STRING INTEGER ')' - { - CreateNewPin(yyElement, OU ($3), OU ($4), OU ($5), 2*GROUNDPLANEFRAME, - OU ($5) + 2*MASKFRAME, OU ($6), $7, $8, OldFlags($9)); - free ($7); - free ($8); - } - ; - -pin_newformat - /* x, y, thickness, drilling hole, name, flags */ - : T_PIN '(' measure measure measure measure STRING INTEGER ')' - { - char p_number[8]; - - sprintf(p_number, "%d", pin_num++); - CreateNewPin(yyElement, OU ($3), OU ($4), OU ($5), 2*GROUNDPLANEFRAME, - OU ($5) + 2*MASKFRAME, OU ($6), $7, p_number, OldFlags($8)); - - free ($7); - } - ; - -pin_oldformat - /* old format: x, y, thickness, name, flags - * drilling hole is 40% of the diameter - */ - : T_PIN '(' measure measure measure STRING INTEGER ')' - { - Coord hole = OU ($5) * DEFAULT_DRILLINGHOLE; - char p_number[8]; - - /* make sure that there's enough copper left */ - if (OU ($5) - hole < MIN_PINORVIACOPPER && - OU ($5) > MIN_PINORVIACOPPER) - hole = OU ($5) - MIN_PINORVIACOPPER; - - sprintf(p_number, "%d", pin_num++); - CreateNewPin(yyElement, OU ($3), OU ($4), OU ($5), 2*GROUNDPLANEFRAME, - OU ($5) + 2*MASKFRAME, hole, $6, p_number, OldFlags($7)); - free ($6); - } - ; - -/* %start-doc pcbfile Pad - -@syntax -Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags] -Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags) -Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags) -Pad (aX1 aY1 aX2 aY2 Thickness "Name" NFlags) -@end syntax - -@table @var -@item rX1 rY1 rX2 rY2 -Coordinates of the endpoints of the pad, relative to the element's -mark. Note that the copper extends beyond these coordinates by half -the thickness. To make a square or round pad, specify the same -coordinate twice. -@item aX1 aY1 aX2 aY2 -Same, but absolute coordinates of the endpoints of the pad. -@item Thickness -width of the pad. -@item Clearance -add to thickness to get clearance width. -@item Mask -width of solder mask opening. -@item Name -name of pin -@item Number -number of pin -@item SFlags -symbolic or numerical flags -@item NFlags -numerical flags only -@end table - -%end-doc */ - -pad_hi_format - /* x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags */ - : T_PAD '[' measure measure measure measure measure measure measure STRING STRING flags ']' - { - CreateNewPad(yyElement, NU ($3) + yyElement->MarkX, - NU ($4) + yyElement->MarkY, - NU ($5) + yyElement->MarkX, - NU ($6) + yyElement->MarkY, NU ($7), NU ($8), NU ($9), - $10, $11, $12); - free ($10); - free ($11); - } - ; - -pad_1.7_format - /* x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags */ - : T_PAD '(' measure measure measure measure measure measure measure STRING STRING INTEGER ')' - { - CreateNewPad(yyElement,OU ($3) + yyElement->MarkX, - OU ($4) + yyElement->MarkY, OU ($5) + yyElement->MarkX, - OU ($6) + yyElement->MarkY, OU ($7), OU ($8), OU ($9), - $10, $11, OldFlags($12)); - free ($10); - free ($11); - } - ; - -pad_newformat - /* x1, y1, x2, y2, thickness, name , pad number, flags */ - : T_PAD '(' measure measure measure measure measure STRING STRING INTEGER ')' - { - CreateNewPad(yyElement,OU ($3),OU ($4),OU ($5),OU ($6),OU ($7), 2*GROUNDPLANEFRAME, - OU ($7) + 2*MASKFRAME, $8, $9, OldFlags($10)); - free ($8); - free ($9); - } - ; - -pad - /* x1, y1, x2, y2, thickness, name and flags */ - : T_PAD '(' measure measure measure measure measure STRING INTEGER ')' - { - char p_number[8]; - - sprintf(p_number, "%d", pin_num++); - CreateNewPad(yyElement,OU ($3),OU ($4),OU ($5),OU ($6),OU ($7), 2*GROUNDPLANEFRAME, - OU ($7) + 2*MASKFRAME, $8,p_number, OldFlags($9)); - free ($8); - } - ; - -flags : INTEGER { $$ = OldFlags($1); } - | STRING { $$ = string_to_flags ($1, yyerror); free($1); } - ; - -symbols - : symbol - | symbols symbol - ; - -/* %start-doc pcbfile Symbol - -@syntax -Symbol [Char Delta] ( -Symbol (Char Delta) ( -@ @ @ @dots{} symbol lines @dots{} -) -@end syntax - -@table @var -@item Char -The character or numerical character value this symbol represents. -Characters must be in single quotes. -@item Delta -Additional space to allow after this character. -@end table - -%end-doc */ - -symbol : symbolhead symboldata ')' - -symbolhead : T_SYMBOL '[' symbolid measure ']' '(' - { - if ($3 <= 0 || $3 > MAX_FONTPOSITION) - { - yyerror("fontposition out of range"); - YYABORT; - } - Symbol = &yyFont->Symbol[$3]; - if (Symbol->Valid) - { - yyerror("symbol ID used twice"); - YYABORT; - } - Symbol->Valid = pcb_true; - Symbol->Delta = NU ($4); - } - | T_SYMBOL '(' symbolid measure ')' '(' - { - if ($3 <= 0 || $3 > MAX_FONTPOSITION) - { - yyerror("fontposition out of range"); - YYABORT; - } - Symbol = &yyFont->Symbol[$3]; - if (Symbol->Valid) - { - yyerror("symbol ID used twice"); - YYABORT; - } - Symbol->Valid = pcb_true; - Symbol->Delta = OU ($4); - } - ; - -symbolid - : INTEGER - | CHAR_CONST - ; - -symboldata - : /* empty */ - | symboldata symboldefinition - | symboldata hiressymbol - ; - -/* %start-doc pcbfile SymbolLine - -@syntax -SymbolLine [X1 Y1 X2 Y1 Thickness] -SymbolLine (X1 Y1 X2 Y1 Thickness) -@end syntax - -@table @var -@item X1 Y1 X2 Y2 -The endpoints of this line. -@item Thickness -The width of this line. -@end table - -%end-doc */ - -symboldefinition - /* x1, y1, x2, y2, thickness */ - : T_SYMBOLLINE '(' measure measure measure measure measure ')' - { - CreateNewLineInSymbol(Symbol, OU ($3), OU ($4), OU ($5), OU ($6), OU ($7)); - } - ; -hiressymbol - /* x1, y1, x2, y2, thickness */ - : T_SYMBOLLINE '[' measure measure measure measure measure ']' - { - CreateNewLineInSymbol(Symbol, NU ($3), NU ($4), NU ($5), NU ($6), NU ($7)); - } - ; - -/* %start-doc pcbfile Netlist - -@syntax -Netlist ( ) ( -@ @ @ @dots{} nets @dots{} -) -@end syntax - -%end-doc */ - -pcbnetlist : pcbnetdef - | - ; -pcbnetdef - /* net(...) net(...) ... */ - : T_NETLIST '(' ')' '(' - nets ')' - ; - -nets - : netdefs - | - ; - -netdefs - : net - | netdefs net - ; - - -/* %start-doc pcbfile Net - -@syntax -Net ("Name" "Style") ( -@ @ @ @dots{} connects @dots{} -) -@end syntax - -@table @var -@item Name -The name of this net. -@item Style -The routing style that should be used when autorouting this net. -@end table - -%end-doc */ - -net - /* name style pin pin ... */ - : T_NET '(' STRING STRING ')' '(' - { - Menu = CreateNewNet((LibraryTypePtr)&yyPCB->NetlistLib, $3, $4); - free ($3); - free ($4); - } - connections ')' - ; - -connections - : conndefs - | - ; - -conndefs - : conn - | conndefs conn - ; - -/* %start-doc pcbfile Connect - -@syntax -Connect ("PinPad") -@end syntax - -@table @var -@item PinPad -The name of a pin or pad which is included in this net. Pin and Pad -names are named by the refdes and pin name, like @code{"U14-7"} for -pin 7 of U14, or @code{"T4-E"} for pin E of T4. -@end table - -%end-doc */ - -conn - : T_CONN '(' STRING ')' - { - CreateNewConnection(Menu, $3); - free ($3); - } - ; - -/* %start-doc pcbfile Netlistpatch - -@syntax -NetListPatch ( ) ( -@ @ @ @dots{} netpatch @dots{} -) -@end syntax - -%end-doc */ - -pcbnetlistpatch : pcbnetpatchdef - | - ; -pcbnetpatchdef - /* net(...) net(...) ... */ - : T_NETLISTPATCH '(' ')' '(' - netpatches ')' - ; - -netpatches - : netpatchdefs - | - ; - -netpatchdefs - : netpatch - | netpatchdefs netpatch - ; - -/* %start-doc pcbfile NetPatch - -@syntax -op (arg1 arg2 ...) ( -@ @ @ @dots{} netlist patch directive @dots{} -) -@end syntax - -%end-doc */ - -netpatch - /* name style pin pin ... */ - : T_ADD_CONN '(' STRING STRING ')' { rats_patch_append(yyPCB, RATP_ADD_CONN, $3, $4, NULL); free($3); free($4); } - | T_DEL_CONN '(' STRING STRING ')' { rats_patch_append(yyPCB, RATP_DEL_CONN, $3, $4, NULL); free($3); free($4); } - | T_CHANGE_ATTRIB '(' STRING STRING STRING ')' { rats_patch_append(yyPCB, RATP_CHANGE_ATTRIB, $3, $4, $5); free($3); free($4); free($5); } - ; - - -/* %start-doc pcbfile Attribute - -@syntax -Attribute ("Name" "Value") -@end syntax - -Attributes allow boards and elements to have arbitrary data attached -to them, which is not directly used by PCB itself but may be of use by -other programs or users. - -@table @var -@item Name -The name of the attribute - -@item Value -The value of the attribute. Values are always stored as strings, even -if the value is interpreted as, for example, a number. - -@end table - -%end-doc */ - -attribute - : T_ATTRIBUTE '(' STRING STRING ')' - { - CreateNewAttribute (attr_list, $3, $4 ? $4 : (char *)""); - free ($3); - free ($4); - } - ; - -opt_string : STRING { $$ = $1; } - | /* empty */ { $$ = 0; } - ; - -number - : FLOATING { $$ = $1; } - | INTEGER { $$ = $1; } - ; - -measure - /* Default unit (no suffix) is cmil */ - : number { do_measure(&$$, $1, PCB_MIL_TO_COORD ($1) / 100.0, 0); } - | number T_UMIL { M ($$, $1, PCB_MIL_TO_COORD ($1) / 100000.0); } - | number T_CMIL { M ($$, $1, PCB_MIL_TO_COORD ($1) / 100.0); } - | number T_MIL { M ($$, $1, PCB_MIL_TO_COORD ($1)); } - | number T_IN { M ($$, $1, PCB_INCH_TO_COORD ($1)); } - | number T_NM { M ($$, $1, PCB_MM_TO_COORD ($1) / 1000000.0); } - | number T_UM { M ($$, $1, PCB_MM_TO_COORD ($1) / 1000.0); } - | number T_MM { M ($$, $1, PCB_MM_TO_COORD ($1)); } - | number T_M { M ($$, $1, PCB_MM_TO_COORD ($1) * 1000.0); } - | number T_KM { M ($$, $1, PCB_MM_TO_COORD ($1) * 1000000.0); } - ; - -%% - -/* --------------------------------------------------------------------------- - * error routine called by parser library - */ -int yyerror(const char * s) -{ - Message(PCB_MSG_ERROR, "ERROR parsing file '%s'\n" - " line: %i\n" - " description: '%s'\n", - yyfilename, pcb_lineno, s); - return(0); -} - -int pcb_wrap() -{ - return 1; -} - -static int -check_file_version (int ver) -{ - if ( ver > PCB_FILE_VERSION ) { - Message (PCB_MSG_DEFAULT, "ERROR: The file you are attempting to load is in a format\n" - "which is too new for this version of pcb. To load this file\n" - "you need a version of pcb which is >= %d. If you are\n" - "using a version built from git source, the source date\n" - "must be >= %d. This copy of pcb can only read files\n" - "up to file version %d.\n", ver, ver, PCB_FILE_VERSION); - return 1; - } - - return 0; -} - -static void -do_measure (PLMeasure *m, Coord i, double d, int u) -{ - m->ival = i; - m->bval = pcb_round (d); - m->dval = d; - m->has_units = u; -} - -static int -integer_value (PLMeasure m) -{ - if (m.has_units) - yyerror("units ignored here"); - return m.ival; -} - -static Coord -old_units (PLMeasure m) -{ - if (m.has_units) - return m.bval; - return pcb_round (PCB_MIL_TO_COORD (m.ival)); -} - -static Coord -new_units (PLMeasure m) -{ - if (m.has_units) - return m.bval; - /* if there's no unit m.dval already contains the converted value */ - return pcb_round (m.dval); -} Index: 1.1.4/src_plugins/io_pcb/parse_l.h =================================================================== --- 1.1.4/src_plugins/io_pcb/parse_l.h (revision 10776) +++ 1.1.4/src_plugins/io_pcb/parse_l.h (nonexistent) @@ -1,332 +0,0 @@ -#ifndef pcb_HEADER_H -#define pcb_HEADER_H 1 -#define pcb_IN_HEADER 1 - -#line 6 "parse_l.h" - -#line 8 "parse_l.h" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int pcb_leng; - -extern FILE *pcb_in, *pcb_out; - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -void pcb_restart (FILE *input_file ); -void pcb__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE pcb__create_buffer (FILE *file,int size ); -void pcb__delete_buffer (YY_BUFFER_STATE b ); -void pcb__flush_buffer (YY_BUFFER_STATE b ); -void pcb_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void pcb_pop_buffer_state (void ); - -YY_BUFFER_STATE pcb__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE pcb__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE pcb__scan_bytes (yyconst char *bytes,int len ); - -void *pcb_alloc (yy_size_t ); -void *pcb_realloc (void *,yy_size_t ); -void pcb_free (void * ); - -/* Begin user sect3 */ - -extern int pcb_lineno; - -extern char *pcb_text; -#define yytext_ptr pcb_text - -#ifdef YY_HEADER_EXPORT_START_CONDITIONS -#define INITIAL 0 - -#endif - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int pcb_lex_destroy (void ); - -int pcb_get_debug (void ); - -void pcb_set_debug (int debug_flag ); - -YY_EXTRA_TYPE pcb_get_extra (void ); - -void pcb_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *pcb_get_in (void ); - -void pcb_set_in (FILE * in_str ); - -FILE *pcb_get_out (void ); - -void pcb_set_out (FILE * out_str ); - -int pcb_get_leng (void ); - -char *pcb_get_text (void ); - -int pcb_get_lineno (void ); - -void pcb_set_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int pcb_wrap (void ); -#else -extern int pcb_wrap (void ); -#endif -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int pcb_lex (void); - -#define YY_DECL int pcb_lex (void) -#endif /* !YY_DECL */ - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif - -#line 218 "parse_l.l" - - -#line 331 "parse_l.h" -#undef pcb_IN_HEADER -#endif /* pcb_HEADER_H */ Index: 1.1.4/src_plugins/io_pcb/io_pcb.c =================================================================== --- 1.1.4/src_plugins/io_pcb/io_pcb.c (revision 10776) +++ 1.1.4/src_plugins/io_pcb/io_pcb.c (nonexistent) @@ -1,100 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * This module, io_pcb, was written and is Copyright (C) 2016 by Tibor Palinkas - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "config.h" -#include "global.h" -#include "plugins.h" -#include "parse_common.h" -#include "file.h" - -static plug_io_t io_pcb[3]; -static io_pcb_ctx_t ctx[3]; - -int io_pcb_fmt(plug_io_t *ctx, plug_iot_t typ, int wr, const char *fmt) -{ - if (strcmp(ctx->description, fmt) == 0) - return 200; - - /* All types are supported. */ - if (strcmp(fmt, "pcb") != 0) - return 0; - return 100; /* read-write */ -} - -extern void pcb_lex_destroy(void); -static void hid_io_pcb_uninit(void) -{ - int n; - pcb_lex_destroy(); - - for(n = 0; n < 3; n++) - HOOK_UNREGISTER(plug_io_t, plug_io_chain, &(io_pcb[n])); -} - -pcb_uninit_t hid_io_pcb_init(void) -{ - - memset(&io_pcb, 0, sizeof(io_pcb)); - - - /* register the IO hook */ - ctx[0].write_coord_fmt = pcb_printf_slot[8]; - io_pcb[0].plugin_data = &ctx[0]; - io_pcb[0].fmt_support_prio = io_pcb_fmt; - io_pcb[0].parse_pcb = io_pcb_ParsePCB; - io_pcb[0].parse_element = io_pcb_ParseElement; - io_pcb[0].parse_font = io_pcb_ParseFont; - io_pcb[0].write_buffer = io_pcb_WriteBuffer; - io_pcb[0].write_element = io_pcb_WriteElementData; - io_pcb[0].write_pcb = io_pcb_WritePCB; - io_pcb[0].default_fmt = "pcb"; - io_pcb[0].description = "geda/pcb - mainline (centimils)"; - io_pcb[0].save_preference_prio = 100; - HOOK_REGISTER(plug_io_t, plug_io_chain, &(io_pcb[0])); - - ctx[1].write_coord_fmt = pcb_printf_slot[9]; - io_pcb[1].plugin_data = &ctx[1]; - io_pcb[1].fmt_support_prio = io_pcb_fmt; - io_pcb[1].write_buffer = io_pcb_WriteBuffer; - io_pcb[1].write_element = io_pcb_WriteElementData; - io_pcb[1].write_pcb = io_pcb_WritePCB; - io_pcb[1].default_fmt = "pcb"; - io_pcb[1].description = "geda/pcb - readable units"; - io_pcb[1].save_preference_prio = 99; - HOOK_REGISTER(plug_io_t, plug_io_chain, &(io_pcb[1])); - - ctx[2].write_coord_fmt = "%$$mn"; - io_pcb[2].plugin_data = &ctx[2]; - io_pcb[2].fmt_support_prio = io_pcb_fmt; - io_pcb[2].write_buffer = io_pcb_WriteBuffer; - io_pcb[2].write_element = io_pcb_WriteElementData; - io_pcb[2].write_pcb = io_pcb_WritePCB; - io_pcb[2].default_fmt = "pcb"; - io_pcb[2].description = "geda/pcb - nanometer"; - io_pcb[2].save_preference_prio = 98; - HOOK_REGISTER(plug_io_t, plug_io_chain, &(io_pcb[2])); - - return hid_io_pcb_uninit; -} Index: 1.1.4/src_plugins/io_pcb/Makefile =================================================================== --- 1.1.4/src_plugins/io_pcb/Makefile (revision 10776) +++ 1.1.4/src_plugins/io_pcb/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_io_pcb - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/io_pcb/flags.c =================================================================== --- 1.1.4/src_plugins/io_pcb/flags.c (revision 10776) +++ 1.1.4/src_plugins/io_pcb/flags.c (nonexistent) @@ -1,68 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2005 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * DJ Delorie, 334 North Road, Deerfield NH 03037-1110, USA - * dj@delorie.com - * - */ - -#include "strflags.h" -#include "flags.h" -#include "const.h" -#include "macro.h" - -#define N(x) x, sizeof(x)-1 -static FlagBitsType pcb_flagbits[] = { - {SHOWNUMBERFLAG, N("shownumber"), 1}, - {LOCALREFFLAG, N("localref"), 1}, - {CHECKPLANESFLAG, N("checkplanes"), 1}, - {SHOWPCB_FLAG_DRC, N("showdrc"), 1}, - {RUBBERBANDFLAG, N("rubberband"), 1}, - {DESCRIPTIONFLAG, N("description"), 1}, - {NAMEONPCBFLAG, N("nameonpcb"), 1}, - {AUTOPCB_FLAG_DRC, N("autodrc"), 1}, - {ALLDIRECTIONFLAG, N("alldirection"), 1}, - {SWAPSTARTDIRFLAG, N("swapstartdir"), 1}, - {UNIQUENAMEFLAG, N("uniquename"), 1}, - {CLEARNEWFLAG, N("clearnew"), 1}, - {NEWPCB_FLAG_FULLPOLY, N("newfullpoly"), 1}, - {SNAPPCB_FLAG_PIN, N("snappin"), 1}, - {SHOWMASKFLAG, N("showmask"), 1}, - {THINDRAWFLAG, N("thindraw"), 1}, - {ORTHOMOVEFLAG, N("orthomove"), 1}, - {LIVEROUTEFLAG, N("liveroute"), 1}, - {THINDRAWPOLYFLAG, N("thindrawpoly"), 1}, - {LOCKNAMESFLAG, N("locknames"), 1}, - {ONLYNAMESFLAG, N("onlynames"), 1}, - {HIDENAMESFLAG, N("hidenames"), 1}, - {ENABLEPCB_FLAG_MINCUT, N("enablemincut"), 1}, -}; -#undef N - -char *pcbflags_to_string(FlagType flags) -{ - return common_flags_to_string(flags, PCB_TYPEMASK_ALL, pcb_flagbits, ENTRIES(pcb_flagbits)); -} - -FlagType string_to_pcbflags(const char *flagstring, int (*error) (const char *msg)) -{ - return common_string_to_flags(flagstring, error, pcb_flagbits, ENTRIES(pcb_flagbits)); -} Index: 1.1.4/src_plugins/autocrop/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/autocrop/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/autocrop/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {autocrop} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/autocrop/autocrop.o @] - -switch /local/pcb/autocrop/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/autocrop/README =================================================================== --- 1.1.4/src_plugins/autocrop/README (revision 10776) +++ 1.1.4/src_plugins/autocrop/README (nonexistent) @@ -1,5 +0,0 @@ -Reduce the board dimensions to just enclose the elements. - -#state: works -#default: buildin -#implements: (feature) Index: 1.1.4/src_plugins/autocrop/autocrop.c =================================================================== --- 1.1.4/src_plugins/autocrop/autocrop.c (revision 10776) +++ 1.1.4/src_plugins/autocrop/autocrop.c (nonexistent) @@ -1,247 +0,0 @@ -/*! - * \file autocrop.c - * - * \brief Autocrop plug-in for PCB. - * Reduce the board dimensions to just enclose the elements. - * - * \author Copyright (C) 2007 Ben Jackson based on teardrops.c by - * Copyright (C) 2006 DJ Delorie - * - * \copyright Licensed under the terms of the GNU General Public - * License, version 2 or later. - * - * Ported to pcb-rnd by Tibor 'Igor2' Palinkas in 2016. - * - * From: Ben Jackson - * To: geda-user@moria.seul.org - * Date: Mon, 19 Feb 2007 13:30:58 -0800 - * Subject: Autocrop() plugin for PCB - * - * As a "learn PCB internals" project I've written an Autocrop() plugin. - * It finds the extents of your existing board and resizes the board to - * contain only your parts plus a margin. - * - * There are some issues that I can't resolve from a plugin: - * - *
      - *
    1. Board size has no Undo function, so while Undo will put your objects - * back where they started, the board size has to be replaced manually. - *
    2. There is no 'edge clearance' DRC paramater, so I used 5*line spacing. - *
    3. Moving a layout with lots of objects and polygons is slow due to the - * repeated clearing/unclearing of the polygons as things move. Undo is - * slower than moving because every individual move is drawn (instead of - * one redraw at the end). - *
    - * - * Original source was: http://ad7gd.net/geda/autocrop.c - * - * Run it by typing `:Autocrop()' in the gui, or by binding Autocrop() to a key. - * - * -- - * Ben Jackson AD7GD - * - * http://www.ben.com/ - */ - -#include -#include - -#include "config.h" -#include "global.h" -#include "data.h" -#include "hid.h" -#include "misc.h" -#include "create.h" -#include "rtree.h" -#include "undo.h" -#include "move.h" -#include "draw.h" -#include "set.h" -#include "polygon.h" -#include "plugins.h" -#include "hid_actions.h" - -static void *MyMoveViaLowLevel(DataType * Data, PinType * Via, Coord dx, Coord dy) -{ - if (Data) { - RestoreToPolygon(Data, PCB_TYPE_VIA, Via, Via); - r_delete_entry(Data->via_tree, (BoxType *) Via); - } - MOVE_VIA_LOWLEVEL(Via, dx, dy); - if (Data) { - r_insert_entry(Data->via_tree, (BoxType *) Via, 0); - ClearFromPolygon(Data, PCB_TYPE_VIA, Via, Via); - } - return Via; -} - -static void *MyMoveLineLowLevel(DataType * Data, LayerType * Layer, LineType * Line, Coord dx, Coord dy) -{ - if (Data) { - RestoreToPolygon(Data, PCB_TYPE_LINE, Layer, Line); - r_delete_entry(Layer->line_tree, (BoxType *) Line); - } - MOVE_LINE_LOWLEVEL(Line, dx, dy); - if (Data) { - r_insert_entry(Layer->line_tree, (BoxType *) Line, 0); - ClearFromPolygon(Data, PCB_TYPE_LINE, Layer, Line); - } - return Line; -} - -static void *MyMoveArcLowLevel(DataType * Data, LayerType * Layer, ArcType * Arc, Coord dx, Coord dy) -{ - if (Data) { - RestoreToPolygon(Data, PCB_TYPE_ARC, Layer, Arc); - r_delete_entry(Layer->arc_tree, (BoxType *) Arc); - } - MOVE_ARC_LOWLEVEL(Arc, dx, dy); - if (Data) { - r_insert_entry(Layer->arc_tree, (BoxType *) Arc, 0); - ClearFromPolygon(Data, PCB_TYPE_ARC, Layer, Arc); - } - return Arc; -} - -static void *MyMovePolygonLowLevel(DataType * Data, LayerType * Layer, PolygonType * Polygon, Coord dx, Coord dy) -{ - if (Data) { - r_delete_entry(Layer->polygon_tree, (BoxType *) Polygon); - } - /* move.c actually only moves points, note no Data/Layer args */ - MovePolygonLowLevel(Polygon, dx, dy); - if (Data) { - r_insert_entry(Layer->polygon_tree, (BoxType *) Polygon, 0); - InitClip(Data, Layer, Polygon); - } - return Polygon; -} - -static void *MyMoveTextLowLevel(LayerType * Layer, TextType * Text, Coord dx, Coord dy) -{ - if (Layer) - r_delete_entry(Layer->text_tree, (BoxType *) Text); - MOVE_TEXT_LOWLEVEL(Text, dx, dy); - if (Layer) - r_insert_entry(Layer->text_tree, (BoxType *) Text, 0); - return Text; -} - -/*! - * \brief Move everything. - * - * Call our own 'MyMove*LowLevel' where they don't exist in move.c. - * This gets very slow if there are large polygons present, since every - * element move re-clears the poly, followed by the polys moving and - * re-clearing everything again. - */ -static void MoveAll(Coord dx, Coord dy) -{ - ELEMENT_LOOP(PCB->Data); - { - MoveElementLowLevel(PCB->Data, element, dx, dy); - AddObjectToMoveUndoList(PCB_TYPE_ELEMENT, NULL, NULL, element, dx, dy); - } - END_LOOP; - VIA_LOOP(PCB->Data); - { - MyMoveViaLowLevel(PCB->Data, via, dx, dy); - AddObjectToMoveUndoList(PCB_TYPE_VIA, NULL, NULL, via, dx, dy); - } - END_LOOP; - ALLLINE_LOOP(PCB->Data); - { - MyMoveLineLowLevel(PCB->Data, layer, line, dx, dy); - AddObjectToMoveUndoList(PCB_TYPE_LINE, NULL, NULL, line, dx, dy); - } - ENDALL_LOOP; - ALLARC_LOOP(PCB->Data); - { - MyMoveArcLowLevel(PCB->Data, layer, arc, dx, dy); - AddObjectToMoveUndoList(PCB_TYPE_ARC, NULL, NULL, arc, dx, dy); - } - ENDALL_LOOP; - ALLTEXT_LOOP(PCB->Data); - { - MyMoveTextLowLevel(layer, text, dx, dy); - AddObjectToMoveUndoList(PCB_TYPE_TEXT, NULL, NULL, text, dx, dy); - } - ENDALL_LOOP; - ALLPOLYGON_LOOP(PCB->Data); - { - /* - * XXX MovePolygonLowLevel does not mean "no gui" like - * XXX MoveElementLowLevel, it doesn't even handle layer - * XXX tree activity. - */ - MyMovePolygonLowLevel(PCB->Data, layer, polygon, dx, dy); - AddObjectToMoveUndoList(PCB_TYPE_POLYGON, NULL, NULL, polygon, dx, dy); - } - ENDALL_LOOP; -} - -static int autocrop(int argc, const char **argv, Coord x, Coord y) -{ - Coord dx, dy, pad; - BoxType *box; - - box = GetDataBoundingBox(PCB->Data); /* handy! */ - if (!box || (box->X1 == box->X2 || box->Y1 == box->Y2)) { - /* board would become degenerate */ - return 0; - } - /* - * Now X1/Y1 are the distance to move the left/top edge - * (actually moving all components to the left/up) such that - * the exact edge of the leftmost/topmost component would touch - * the edge. Reduce the move by the edge relief requirement XXX - * and expand the board by the same amount. - */ - pad = PCB->minWid * 5; /* XXX real edge clearance */ - dx = -box->X1 + pad; - dy = -box->Y1 + pad; - box->X2 += pad; - box->Y2 += pad; - /* - * Round move to keep components grid-aligned, then translate the - * upper coordinates into the new space. - */ - dx -= dx % (long) PCB->Grid; - dy -= dy % (long) PCB->Grid; - box->X2 += dx; - box->Y2 += dy; - /* - * Avoid touching any data if there's nothing to do. - */ - if (dx == 0 && dy == 0 && PCB->MaxWidth == box->X2 && PCB->MaxHeight == box->Y2) { - return 0; - } - /* Resize -- XXX cannot be undone */ - PCB->MaxWidth = box->X2; - PCB->MaxHeight = box->Y2; - MoveAll(dx, dy); - IncrementUndoSerialNumber(); - Redraw(); - SetChangedFlag(1); - return 0; -} - -static HID_Action autocrop_action_list[] = { - {"autocrop", NULL, autocrop, NULL, NULL} -}; - -char *autocrop_cookie = "autocrop plugin"; - -REGISTER_ACTIONS(autocrop_action_list, autocrop_cookie) - -static void hid_autocrop_uninit(void) -{ - hid_remove_actions_by_cookie(autocrop_cookie); -} - -#include "dolists.h" -pcb_uninit_t hid_autocrop_init() -{ - REGISTER_ACTIONS(autocrop_action_list, autocrop_cookie); - return hid_autocrop_uninit; -} Index: 1.1.4/src_plugins/autocrop/Makefile =================================================================== --- 1.1.4/src_plugins/autocrop/Makefile (revision 10776) +++ 1.1.4/src_plugins/autocrop/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_autocrop - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/export_nelma/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/export_nelma/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/export_nelma/Plug.tmpasm (nonexistent) @@ -1,16 +0,0 @@ -put /local/pcb/mod {export_nelma} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_nelma/nelma.o @] - -switch /local/pcb/export_nelma/controls - case {disable} end; - default - put /local/pcb/mod/LDFLAGS libs/gui/gd/ldflags - put /local/pcb/mod/CFLAGS libs/gui/gd/cflags - end -end - -switch /local/pcb/export_nelma/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/export_nelma/README =================================================================== --- 1.1.4/src_plugins/export_nelma/README (revision 10776) +++ 1.1.4/src_plugins/export_nelma/README (nonexistent) @@ -1,5 +0,0 @@ -Export to nelma (Numerical capacitance calculator) - -#state: works -#default: buildin -#implements: export Index: 1.1.4/src_plugins/export_nelma/nelma.c =================================================================== --- 1.1.4/src_plugins/export_nelma/nelma.c (revision 10776) +++ 1.1.4/src_plugins/export_nelma/nelma.c (nonexistent) @@ -1,1026 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * - * NELMA (Numerical capacitance calculator) export HID - * Copyright (C) 2006 Tomaz Solc (tomaz.solc@tablix.org) - * - * PNG export code is based on the PNG export HID - * Copyright (C) 2006 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * This HID exports a PCB layout into: o One layer mask file (PNG format) per - * copper layer. o Nelma configuration file that contains netlist and pin - * information. - */ - -/* - * FIXME: - * - * If you have a section of a net that does not contain any pins then that - * section will be missing from the Nelma's copper geometry. - * - * For example: - * - * this section will be ignored by Nelma | | - * - * || ||=======|| || component layer || - * || || || ||=============|| ||============|| - * solder layer - * - * pin1 via via pin2 - * - * Single layer layouts are always exported correctly. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include - -#include "global.h" -#include "error.h" /* Message(PCB_MSG_DEFAULT, ) */ -#include "data.h" -#include "layer.h" -#include "misc.h" -#include "rats.h" -#include "plugins.h" -#include "hid_helper.h" - -#include "hid.h" -#include "hid_nogui.h" -#include "hid_draw_helpers.h" - -#include - -#include "hid_init.h" -#include "hid_attrib.h" -#include "hid_flags.h" -#include "hid_color.h" - -const char *nelma_cookie = "nelma HID"; - -#define CRASH(func) fprintf(stderr, "HID error: pcb called unimplemented PNG function %s.\n", func); abort() - -/* Needed for PNG export */ - -struct color_struct { - /* the descriptor used by the gd library */ - int c; - - /* so I can figure out what rgb value c refers to */ - unsigned int r, g, b; -}; - -struct hid_gc_struct { - HID *me_pointer; - EndCapStyle cap; - Coord width; - unsigned char r, g, b; - int erase; - int faded; - struct color_struct *color; - gdImagePtr brush; -}; - -static HID nelma_hid; - -static struct color_struct *black = NULL, *white = NULL; -static Coord linewidth = -1; -static gdImagePtr lastbrush = (gdImagePtr) ((void *) -1); -static int lastcolor = -1; - -/* gd image and file for PNG export */ -static gdImagePtr nelma_im = NULL; -static FILE *nelma_f = NULL; - -static int is_mask; -static int is_drill; - -/* - * Which groups of layers to export into PNG layer masks. 1 means export, 0 - * means do not export. - */ -static int nelma_export_group[MAX_LAYER]; - -/* Group that is currently exported. */ -static int nelma_cur_group; - -/* Filename prefix that will be used when saving files. */ -static const char *nelma_basename = NULL; - -/* Horizontal DPI (grid points per inch) */ -static int nelma_dpi = -1; - -/* Height of the copper layers in micrometers. */ - -/* - * The height of the copper layer is currently taken as the vertical grid - * step, since this is the smallest vertical feature in the layout. - */ -static int nelma_copperh = -1; -/* Height of the substrate layers in micrometers. */ -static int nelma_substrateh = -1; -/* Relative permittivity of the substrate. */ -static double nelma_substratee = -1; - -/* Permittivity of empty space (As/Vm) */ -static const double nelma_air_epsilon = 8.85e-12; - -HID_Attribute nelma_attribute_list[] = { - /* other HIDs expect this to be first. */ - -/* %start-doc options "nelma Options" -@ftable @code -@item -- basename -File name prefix. -@end ftable -%end-doc -*/ - {"basename", "File name prefix", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_basename 0 - -/* %start-doc options "nelma Options" -@ftable @code -@item --dpi -Horizontal scale factor (grid points/inch). -@end ftable -%end-doc -*/ - {"dpi", "Horizontal scale factor (grid points/inch)", - HID_Integer, 0, 1000, {100, 0, 0}, 0, 0}, -#define HA_dpi 1 - -/* %start-doc options "nelma Options" -@ftable @code -@item --copper-height -Copper layer height (um). -@end ftable -%end-doc -*/ - {"copper-height", "Copper layer height (um)", - HID_Integer, 0, 200, {100, 0, 0}, 0, 0}, -#define HA_copperh 2 - -/* %start-doc options "nelma Options" -@ftable @code -@item --substrate-height -Substrate layer height (um). -@end ftable -%end-doc -*/ - {"substrate-height", "Substrate layer height (um)", - HID_Integer, 0, 10000, {2000, 0, 0}, 0, 0}, -#define HA_substrateh 3 - -/* %start-doc options "nelma Options" -@ftable @code -@item --substrate-epsilon -Substrate relative epsilon. -@end ftable -%end-doc -*/ - {"substrate-epsilon", "Substrate relative epsilon", - HID_Real, 0, 100, {0, 0, 4.0}, 0, 0}, -#define HA_substratee 4 -}; - -#define NUM_OPTIONS (sizeof(nelma_attribute_list)/sizeof(nelma_attribute_list[0])) - -REGISTER_ATTRIBUTES(nelma_attribute_list, nelma_cookie) - static HID_Attr_Val nelma_values[NUM_OPTIONS]; - -/* *** Utility funcions **************************************************** */ - -/* convert from default PCB units to nelma units */ - static int pcb_to_nelma(Coord pcb) -{ - return PCB_COORD_TO_INCH(pcb) * nelma_dpi; -} - -static char *nelma_get_png_name(const char *basename, const char *suffix) -{ - char *buf; - int len; - - len = strlen(basename) + strlen(suffix) + 6; - buf = (char *) malloc(sizeof(*buf) * len); - - sprintf(buf, "%s.%s.png", basename, suffix); - - return buf; -} - -/* *** Exporting netlist data and geometry to the nelma config file ******** */ - -static void nelma_write_space(FILE * out) -{ - double xh, zh; - - int z; - int i, idx; - const char *ext; - - xh = 2.54e-2 / ((double) nelma_dpi); - zh = nelma_copperh * 1e-6; - - fprintf(out, "\n/* **** Space **** */\n\n"); - - fprintf(out, "space pcb {\n"); - fprintf(out, "\tstep = { %e, %e, %e }\n", xh, xh, zh); - fprintf(out, "\tlayers = {\n"); - - fprintf(out, "\t\t\"air-top\",\n"); - fprintf(out, "\t\t\"air-bottom\""); - - z = 10; - for (i = 0; i < MAX_LAYER; i++) - if (nelma_export_group[i]) { - idx = (i >= 0 && i < max_group) ? PCB->LayerGroups.Entries[i][0] : i; - ext = layer_type_to_file_name(idx, FNS_fixed); - - if (z != 10) { - fprintf(out, ",\n"); - fprintf(out, "\t\t\"substrate-%d\"", z); - z++; - } - fprintf(out, ",\n"); - fprintf(out, "\t\t\"%s\"", ext); - z++; - } - fprintf(out, "\n\t}\n"); - fprintf(out, "}\n"); -} - - -static void nelma_write_material(FILE * out, const char *name, const char *type, double e) -{ - fprintf(out, "material %s {\n", name); - fprintf(out, "\ttype = \"%s\"\n", type); - fprintf(out, "\tpermittivity = %e\n", e); - fprintf(out, "\tconductivity = 0.0\n"); - fprintf(out, "\tpermeability = 0.0\n"); - fprintf(out, "}\n"); -} - -static void nelma_write_materials(FILE * out) -{ - fprintf(out, "\n/* **** Materials **** */\n\n"); - - nelma_write_material(out, "copper", "metal", nelma_air_epsilon); - nelma_write_material(out, "air", "dielectric", nelma_air_epsilon); - nelma_write_material(out, "composite", "dielectric", nelma_air_epsilon * nelma_substratee); -} - -static void nelma_write_nets(FILE * out) -{ - LibraryType netlist; - LibraryMenuTypePtr net; - LibraryEntryTypePtr pin; - - int n, m, i, idx; - - const char *ext; - - netlist = PCB->NetlistLib[NETLIST_EDITED]; - - fprintf(out, "\n/* **** Nets **** */\n\n"); - - for (n = 0; n < netlist.MenuN; n++) { - net = &netlist.Menu[n]; - - /* Weird, but correct */ - fprintf(out, "net %s {\n", &net->Name[2]); - - fprintf(out, "\tobjects = {\n"); - - for (m = 0; m < net->EntryN; m++) { - pin = &net->Entry[m]; - - /* pcb_pin_name_to_xy(pin, &x, &y); */ - - for (i = 0; i < MAX_LAYER; i++) - if (nelma_export_group[i]) { - idx = (i >= 0 && i < max_group) ? PCB->LayerGroups.Entries[i][0] : i; - ext = layer_type_to_file_name(idx, FNS_fixed); - - if (m != 0 || i != 0) - fprintf(out, ",\n"); - fprintf(out, "\t\t\"%s-%s\"", pin->ListEntry, ext); - } - } - - fprintf(out, "\n"); - fprintf(out, "\t}\n"); - fprintf(out, "}\n"); - } -} - -static void nelma_write_layer(FILE * out, int z, int h, const char *name, int full, const char *mat) -{ - LibraryType netlist; - LibraryMenuTypePtr net; - LibraryEntryTypePtr pin; - - int n, m; - - fprintf(out, "layer %s {\n", name); - fprintf(out, "\theight = %d\n", h); - fprintf(out, "\tz-order = %d\n", z); - fprintf(out, "\tmaterial = \"%s\"\n", mat); - - if (full) { - fprintf(out, "\tobjects = {\n"); - netlist = PCB->NetlistLib[NETLIST_EDITED]; - - for (n = 0; n < netlist.MenuN; n++) { - net = &netlist.Menu[n]; - - for (m = 0; m < net->EntryN; m++) { - pin = &net->Entry[m]; - - if (m != 0 || n != 0) - fprintf(out, ",\n"); - fprintf(out, "\t\t\"%s-%s\"", pin->ListEntry, name); - } - - } - fprintf(out, "\n\t}\n"); - } - fprintf(out, "}\n"); -} - -static void nelma_write_layers(FILE * out) -{ - int i, idx; - int z; - - const char *ext; - char buf[100]; - - int subh; - - subh = nelma_substrateh / nelma_copperh; - - fprintf(out, "\n/* **** Layers **** */\n\n"); - - /* Air layers on top and bottom of the stack */ - /* Their height is double substrate height. */ - nelma_write_layer(out, 1, 2 * subh, "air-top", 0, "air"); - nelma_write_layer(out, 1000, 2 * subh, "air-bottom", 0, "air"); - - z = 10; - for (i = 0; i < MAX_LAYER; i++) - if (nelma_export_group[i]) { - idx = (i >= 0 && i < max_group) ? PCB->LayerGroups.Entries[i][0] : i; - ext = layer_type_to_file_name(idx, FNS_fixed); - - if (z != 10) { - sprintf(buf, "substrate-%d", z); - nelma_write_layer(out, z, subh, buf, 0, "composite"); - z++; - } - /* - * FIXME: for layers that are not on top or bottom, - * the material should be "composite" - */ - nelma_write_layer(out, z, 1, ext, 1, "air"); - - z++; - } -} - -static void nelma_write_object(FILE * out, LibraryEntryTypePtr pin) -{ - int i, idx; - Coord px = 0, py = 0; - int x, y; - - char *f; - const char *ext; - - pcb_pin_name_to_xy(pin, &px, &py); - - x = pcb_to_nelma(px); - y = pcb_to_nelma(py); - - for (i = 0; i < MAX_LAYER; i++) - if (nelma_export_group[i]) { - idx = (i >= 0 && i < max_group) ? PCB->LayerGroups.Entries[i][0] : i; - ext = layer_type_to_file_name(idx, FNS_fixed); - - fprintf(out, "object %s-%s {\n", pin->ListEntry, ext); - fprintf(out, "\tposition = { 0, 0 }\n"); - fprintf(out, "\tmaterial = \"copper\"\n"); - fprintf(out, "\ttype = \"image\"\n"); - fprintf(out, "\trole = \"net\"\n"); - - f = nelma_get_png_name(nelma_basename, ext); - - fprintf(out, "\tfile = \"%s\"\n", f); - - free(f); - - fprintf(out, "\tfile-pos = { %d, %d }\n", x, y); - fprintf(out, "}\n"); - } -} - -static void nelma_write_objects(FILE * out) -{ - LibraryType netlist; - LibraryMenuTypePtr net; - LibraryEntryTypePtr pin; - - int n, m; - - netlist = PCB->NetlistLib[NETLIST_EDITED]; - - fprintf(out, "\n/* **** Objects **** */\n\n"); - - for (n = 0; n < netlist.MenuN; n++) { - net = &netlist.Menu[n]; - - for (m = 0; m < net->EntryN; m++) { - pin = &net->Entry[m]; - - nelma_write_object(out, pin); - } - } -} - -/* *** Main export callback ************************************************ */ - -static void nelma_parse_arguments(int *argc, char ***argv) -{ - hid_register_attributes(nelma_attribute_list, sizeof(nelma_attribute_list) / sizeof(nelma_attribute_list[0]), nelma_cookie, 0); - hid_parse_command_line(argc, argv); -} - -static HID_Attribute *nelma_get_export_options(int *n) -{ - static char *last_made_filename = 0; - - if (PCB) { - derive_default_filename(PCB->Filename, &nelma_attribute_list[HA_basename], ".nelma", &last_made_filename); - } - if (n) { - *n = NUM_OPTIONS; - } - return nelma_attribute_list; -} - -/* Populates nelma_export_group array */ -void nelma_choose_groups() -{ - int n, m; - LayerType *layer; - - /* Set entire array to 0 (don't export any layer groups by default */ - memset(nelma_export_group, 0, sizeof(nelma_export_group)); - - for (n = 0; n < max_copper_layer; n++) { - layer = &PCB->Data->Layer[n]; - - if (!LAYER_IS_EMPTY(layer)) { - /* layer isn't empty */ - - /* - * is this check necessary? It seems that special - * layers have negative indexes? - */ - - if (SL_TYPE(n) == 0) { - /* layer is a copper layer */ - m = GetLayerGroupNumberByNumber(n); - - /* the export layer */ - nelma_export_group[m] = 1; - } - } - } -} - -static void nelma_alloc_colors() -{ - /* - * Allocate white and black -- the first color allocated becomes the - * background color - */ - - white = (struct color_struct *) malloc(sizeof(*white)); - white->r = white->g = white->b = 255; - white->c = gdImageColorAllocate(nelma_im, white->r, white->g, white->b); - - black = (struct color_struct *) malloc(sizeof(*black)); - black->r = black->g = black->b = 0; - black->c = gdImageColorAllocate(nelma_im, black->r, black->g, black->b); -} - -static void nelma_start_png(const char *basename, const char *suffix) -{ - int h, w; - char *buf; - - buf = nelma_get_png_name(basename, suffix); - - h = pcb_to_nelma(PCB->MaxHeight); - w = pcb_to_nelma(PCB->MaxWidth); - - /* nelma_im = gdImageCreate (w, h); */ - - /* Nelma only works with true color images */ - nelma_im = gdImageCreate(w, h); - nelma_f = fopen(buf, "wb"); - - nelma_alloc_colors(); - - free(buf); -} - -static void nelma_finish_png() -{ -#ifdef HAVE_GDIMAGEPNG - gdImagePng(nelma_im, nelma_f); -#else - Message(PCB_MSG_DEFAULT, "NELMA: PNG not supported by gd. Can't write layer mask.\n"); -#endif - gdImageDestroy(nelma_im); - fclose(nelma_f); - - free(white); - free(black); - - nelma_im = NULL; - nelma_f = NULL; -} - -void nelma_start_png_export() -{ - BoxType region; - - region.X1 = 0; - region.Y1 = 0; - region.X2 = PCB->MaxWidth; - region.Y2 = PCB->MaxHeight; - - linewidth = -1; - lastbrush = (gdImagePtr) ((void *) -1); - lastcolor = -1; - - hid_expose_callback(&nelma_hid, ®ion, 0); -} - -static void nelma_do_export(HID_Attr_Val * options) -{ - int save_ons[MAX_LAYER + 2]; - int i, idx; - FILE *nelma_config; - char *buf; - int len; - - time_t t; - - if (!options) { - nelma_get_export_options(0); - for (i = 0; i < NUM_OPTIONS; i++) { - nelma_values[i] = nelma_attribute_list[i].default_val; - } - options = nelma_values; - } - nelma_basename = options[HA_basename].str_value; - if (!nelma_basename) { - nelma_basename = "pcb-out"; - } - nelma_dpi = options[HA_dpi].int_value; - if (nelma_dpi < 0) { - fprintf(stderr, "ERROR: dpi may not be < 0\n"); - return; - } - nelma_copperh = options[HA_copperh].int_value; - nelma_substrateh = options[HA_substrateh].int_value; - nelma_substratee = options[HA_substratee].real_value; - - nelma_choose_groups(); - - for (i = 0; i < MAX_LAYER; i++) { - if (nelma_export_group[i]) { - - nelma_cur_group = i; - - /* magic */ - idx = (i >= 0 && i < max_group) ? PCB->LayerGroups.Entries[i][0] : i; - - nelma_start_png(nelma_basename, layer_type_to_file_name(idx, FNS_fixed)); - - hid_save_and_show_layer_ons(save_ons); - nelma_start_png_export(); - hid_restore_layer_ons(save_ons); - - nelma_finish_png(); - } - } - - len = strlen(nelma_basename) + 4; - buf = (char *) malloc(sizeof(*buf) * len); - - sprintf(buf, "%s.em", nelma_basename); - nelma_config = fopen(buf, "w"); - - free(buf); - - fprintf(nelma_config, "/* Made with PCB Nelma export HID */"); - t = time(NULL); - fprintf(nelma_config, "/* %s */", ctime(&t)); - - nelma_write_nets(nelma_config); - nelma_write_objects(nelma_config); - nelma_write_layers(nelma_config); - nelma_write_materials(nelma_config); - nelma_write_space(nelma_config); - - fclose(nelma_config); -} - -/* *** PNG export (slightly modified code from PNG export HID) ************* */ - -static int nelma_set_layer(const char *name, int group, int empty) -{ - int idx = (group >= 0 && group < max_group) ? PCB->LayerGroups.Entries[group][0] : group; - - if (name == 0) { - name = PCB->Data->Layer[idx].Name; - } - if (strcmp(name, "invisible") == 0) { - return 0; - } - is_drill = (SL_TYPE(idx) == SL_PDRILL || SL_TYPE(idx) == SL_UDRILL); - is_mask = (SL_TYPE(idx) == SL_MASK); - - if (is_mask) { - /* Don't print masks */ - return 0; - } - if (is_drill) { - /* - * Print 'holes', so that we can fill gaps in the copper - * layer - */ - return 1; - } - if (group == nelma_cur_group) { - return 1; - } - return 0; -} - -static hidGC nelma_make_gc(void) -{ - hidGC rv = (hidGC) malloc(sizeof(struct hid_gc_struct)); - rv->me_pointer = &nelma_hid; - rv->cap = Trace_Cap; - rv->width = 1; - rv->color = (struct color_struct *) malloc(sizeof(*rv->color)); - rv->color->r = rv->color->g = rv->color->b = 0; - rv->color->c = 0; - return rv; -} - -static void nelma_destroy_gc(hidGC gc) -{ - free(gc); -} - -static void nelma_use_mask(int use_it) -{ - /* does nothing */ -} - -static void nelma_set_color(hidGC gc, const char *name) -{ - if (nelma_im == NULL) { - return; - } - if (name == NULL) { - name = "#ff0000"; - } - if (!strcmp(name, "drill")) { - gc->color = black; - gc->erase = 0; - return; - } - if (!strcmp(name, "erase")) { - /* FIXME -- should be background, not white */ - gc->color = white; - gc->erase = 1; - return; - } - gc->color = black; - gc->erase = 0; - return; -} - -static void nelma_set_line_cap(hidGC gc, EndCapStyle style) -{ - gc->cap = style; -} - -static void nelma_set_line_width(hidGC gc, Coord width) -{ - gc->width = width; -} - -static void nelma_set_draw_xor(hidGC gc, int xor_) -{ - ; -} - -static void nelma_set_draw_faded(hidGC gc, int faded) -{ - gc->faded = faded; -} - -static void use_gc(hidGC gc) -{ - int need_brush = 0; - - if (gc->me_pointer != &nelma_hid) { - fprintf(stderr, "Fatal: GC from another HID passed to nelma HID\n"); - abort(); - } - if (linewidth != gc->width) { - /* Make sure the scaling doesn't erase lines completely */ - /* - if (SCALE (gc->width) == 0 && gc->width > 0) - gdImageSetThickness (im, 1); - else - */ - gdImageSetThickness(nelma_im, pcb_to_nelma(gc->width)); - linewidth = gc->width; - need_brush = 1; - } - if (lastbrush != gc->brush || need_brush) { - static void *bcache = 0; - hidval bval; - char name[256]; - char type; - int r; - - switch (gc->cap) { - case Round_Cap: - case Trace_Cap: - type = 'C'; - r = pcb_to_nelma(gc->width / 2); - break; - default: - case Square_Cap: - r = pcb_to_nelma(gc->width); - type = 'S'; - break; - } - sprintf(name, "#%.2x%.2x%.2x_%c_%d", gc->color->r, gc->color->g, gc->color->b, type, r); - - if (hid_cache_color(0, name, &bval, &bcache)) { - gc->brush = (gdImagePtr) bval.ptr; - } - else { - int bg, fg; - if (type == 'C') - gc->brush = gdImageCreate(2 * r + 1, 2 * r + 1); - else - gc->brush = gdImageCreate(r + 1, r + 1); - bg = gdImageColorAllocate(gc->brush, 255, 255, 255); - fg = gdImageColorAllocate(gc->brush, gc->color->r, gc->color->g, gc->color->b); - gdImageColorTransparent(gc->brush, bg); - - /* - * if we shrunk to a radius/box width of zero, then just use - * a single pixel to draw with. - */ - if (r == 0) - gdImageFilledRectangle(gc->brush, 0, 0, 0, 0, fg); - else { - if (type == 'C') - gdImageFilledEllipse(gc->brush, r, r, 2 * r, 2 * r, fg); - else - gdImageFilledRectangle(gc->brush, 0, 0, r, r, fg); - } - bval.ptr = gc->brush; - hid_cache_color(1, name, &bval, &bcache); - } - - gdImageSetBrush(nelma_im, gc->brush); - lastbrush = gc->brush; - - } -#define CBLEND(gc) (((gc->r)<<24)|((gc->g)<<16)|((gc->b)<<8)|(gc->faded)) - if (lastcolor != CBLEND(gc)) { - if (is_drill || is_mask) { -#ifdef FIXME - fprintf(f, "%d gray\n", gc->erase ? 0 : 1); -#endif - lastcolor = 0; - } - else { - double r, g, b; - r = gc->r; - g = gc->g; - b = gc->b; - if (gc->faded) { - r = 0.8 * 255 + 0.2 * r; - g = 0.8 * 255 + 0.2 * g; - b = 0.8 * 255 + 0.2 * b; - } -#ifdef FIXME - if (gc->r == gc->g && gc->g == gc->b) - fprintf(f, "%g gray\n", r / 255.0); - else - fprintf(f, "%g %g %g rgb\n", r / 255.0, g / 255.0, b / 255.0); -#endif - lastcolor = CBLEND(gc); - } - } -} - -static void nelma_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - use_gc(gc); - gdImageRectangle(nelma_im, pcb_to_nelma(x1), pcb_to_nelma(y1), pcb_to_nelma(x2), pcb_to_nelma(y2), gc->color->c); -} - -static void nelma_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - use_gc(gc); - gdImageSetThickness(nelma_im, 0); - linewidth = 0; - gdImageFilledRectangle(nelma_im, pcb_to_nelma(x1), pcb_to_nelma(y1), pcb_to_nelma(x2), pcb_to_nelma(y2), gc->color->c); -} - -static void nelma_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - if (x1 == x2 && y1 == y2) { - Coord w = gc->width / 2; - nelma_fill_rect(gc, x1 - w, y1 - w, x1 + w, y1 + w); - return; - } - use_gc(gc); - - gdImageSetThickness(nelma_im, 0); - linewidth = 0; - gdImageLine(nelma_im, pcb_to_nelma(x1), pcb_to_nelma(y1), pcb_to_nelma(x2), pcb_to_nelma(y2), gdBrushed); -} - -static void nelma_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle) -{ - Angle sa, ea; - - /* - * in gdImageArc, 0 degrees is to the right and +90 degrees is down - * in pcb, 0 degrees is to the left and +90 degrees is down - */ - start_angle = 180 - start_angle; - delta_angle = -delta_angle; - if (delta_angle > 0) { - sa = start_angle; - ea = start_angle + delta_angle; - } - else { - sa = start_angle + delta_angle; - ea = start_angle; - } - - /* - * make sure we start between 0 and 360 otherwise gd does strange - * things - */ - sa = NormalizeAngle(sa); - ea = NormalizeAngle(ea); - -#if 0 - printf("draw_arc %d,%d %dx%d %d..%d %d..%d\n", cx, cy, width, height, start_angle, delta_angle, sa, ea); - printf("gdImageArc (%p, %d, %d, %d, %d, %d, %d, %d)\n", - (void *)im, SCALE_X(cx), SCALE_Y(cy), SCALE(width), SCALE(height), sa, ea, gc->color->c); -#endif - use_gc(gc); - gdImageSetThickness(nelma_im, 0); - linewidth = 0; - gdImageArc(nelma_im, pcb_to_nelma(cx), pcb_to_nelma(cy), - pcb_to_nelma(2 * width), pcb_to_nelma(2 * height), sa, ea, gdBrushed); -} - -static void nelma_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) -{ - use_gc(gc); - - gdImageSetThickness(nelma_im, 0); - linewidth = 0; - gdImageFilledEllipse(nelma_im, pcb_to_nelma(cx), pcb_to_nelma(cy), - pcb_to_nelma(2 * radius), pcb_to_nelma(2 * radius), gc->color->c); - -} - -static void nelma_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) -{ - int i; - gdPoint *points; - - points = (gdPoint *) malloc(n_coords * sizeof(gdPoint)); - if (points == NULL) { - fprintf(stderr, "ERROR: nelma_fill_polygon(): malloc failed\n"); - exit(1); - } - use_gc(gc); - for (i = 0; i < n_coords; i++) { - points[i].x = pcb_to_nelma(x[i]); - points[i].y = pcb_to_nelma(y[i]); - } - gdImageSetThickness(nelma_im, 0); - linewidth = 0; - gdImageFilledPolygon(nelma_im, points, n_coords, gc->color->c); - free(points); -} - -static void nelma_calibrate(double xval, double yval) -{ - CRASH("nelma_calibrate"); -} - -static void nelma_set_crosshair(int x, int y, int a) -{ -} - -static int nelma_usage(const char *topic) -{ - fprintf(stderr, "\nnelma exporter command line arguments:\n\n"); - hid_usage(nelma_attribute_list, sizeof(nelma_attribute_list) / sizeof(nelma_attribute_list[0])); - fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x nelma foo.pcb [nelma options]\n\n"); - return 0; -} - -/* *** Miscellaneous ******************************************************* */ - -#include "dolists.h" - -pcb_uninit_t hid_export_nelma_init() -{ - memset(&nelma_hid, 0, sizeof(HID)); - - common_nogui_init(&nelma_hid); - common_draw_helpers_init(&nelma_hid); - - nelma_hid.struct_size = sizeof(HID); - nelma_hid.name = "nelma"; - nelma_hid.description = "Numerical analysis package export"; - nelma_hid.exporter = 1; - nelma_hid.poly_before = 1; - - nelma_hid.get_export_options = nelma_get_export_options; - nelma_hid.do_export = nelma_do_export; - nelma_hid.parse_arguments = nelma_parse_arguments; - nelma_hid.set_layer = nelma_set_layer; - nelma_hid.make_gc = nelma_make_gc; - nelma_hid.destroy_gc = nelma_destroy_gc; - nelma_hid.use_mask = nelma_use_mask; - nelma_hid.set_color = nelma_set_color; - nelma_hid.set_line_cap = nelma_set_line_cap; - nelma_hid.set_line_width = nelma_set_line_width; - nelma_hid.set_draw_xor = nelma_set_draw_xor; - nelma_hid.set_draw_faded = nelma_set_draw_faded; - nelma_hid.draw_line = nelma_draw_line; - nelma_hid.draw_arc = nelma_draw_arc; - nelma_hid.draw_rect = nelma_draw_rect; - nelma_hid.fill_circle = nelma_fill_circle; - nelma_hid.fill_polygon = nelma_fill_polygon; - nelma_hid.fill_rect = nelma_fill_rect; - nelma_hid.calibrate = nelma_calibrate; - nelma_hid.set_crosshair = nelma_set_crosshair; - - nelma_hid.usage = nelma_usage; - - hid_register_hid(&nelma_hid); - return NULL; -} Index: 1.1.4/src_plugins/export_nelma/Makefile =================================================================== --- 1.1.4/src_plugins/export_nelma/Makefile (revision 10776) +++ 1.1.4/src_plugins/export_nelma/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_export_nelma - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/fp_fs/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/fp_fs/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/fp_fs/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {fp_fs} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/fp_fs/fp_fs.o @] - -switch /local/pcb/fp_fs/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/fp_fs/README =================================================================== --- 1.1.4/src_plugins/fp_fs/README (revision 10776) +++ 1.1.4/src_plugins/fp_fs/README (nonexistent) @@ -1,7 +0,0 @@ -Footprint: file system based implementation. Used to be called Newlib: load -footprints from directories. Run external processes for the parametric -footprints. - -#state: works -#default: buildin -#implements: fp Index: 1.1.4/src_plugins/fp_fs/Makefile =================================================================== --- 1.1.4/src_plugins/fp_fs/Makefile (revision 10776) +++ 1.1.4/src_plugins/fp_fs/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_fp_fs - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/fp_fs/fp_fs.c =================================================================== --- 1.1.4/src_plugins/fp_fs/fp_fs.c (revision 10776) +++ 1.1.4/src_plugins/fp_fs/fp_fs.c (nonexistent) @@ -1,513 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* for popen() */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - -#include "config.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include -#include - -#include "mymem.h" -#include "data.h" -#include "paths.h" -#include "plugins.h" -#include "plug_footprint.h" -#include "compat_fs.h" -#include "compat_misc.h" -#include "error.h" -#include "misc.h" -#include "conf.h" -#include "conf_core.h" - -/* opendir, readdir */ -#include "compat_inc.h" - -static fp_type_t pcb_fp_file_type(const char *fn, void ***tags); - -/* --------------------------------------------------------------------------- - * Parse the directory tree where newlib footprints are found - */ -typedef struct list_dir_s list_dir_t; - -struct list_dir_s { - char *parent; - char *subdir; - list_dir_t *next; -}; - -typedef struct { - library_t *menu; - list_dir_t *subdirs; - int children; -} list_st_t; - -static int list_cb(void *cookie, const char *subdir, const char *name, fp_type_t type, void *tags[]) -{ - list_st_t *l = (list_st_t *) cookie; - library_t *e; - - if (type == PCB_FP_DIR) { - list_dir_t *d; - /* can not recurse directly from here because that would ruin the menu - pointer: GetLibraryMenuMemory (&Library) calls realloc()! - Build a list of directories to be visited later, instead. */ - d = malloc(sizeof(list_dir_t)); - d->subdir = pcb_strdup(name); - d->parent = pcb_strdup(subdir); - d->next = l->subdirs; - l->subdirs = d; - return 0; - } - - l->children++; - e = fp_append_entry(l->menu, name, type, tags); - -/* Avoid using Concat() - would be a new dependency for gsch2pcb-rnd */ - { - int sl = strlen(subdir); - int nl = strlen(name); - char *end; - - end = e->data.fp.loc_info = malloc(sl+nl+3); - memcpy(end, subdir, sl); end += sl; - *end = '/'; end++; - memcpy(end, name, nl+1); end += nl; - } - - return 0; -} - -static int fp_fs_list(library_t *pl, const char *subdir, int recurse, - int (*cb) (void *cookie, const char *subdir, const char *name, fp_type_t type, void *tags[]), void *cookie, - int subdir_may_not_exist, int need_tags) -{ - char olddir[MAXPATHLEN + 1]; /* The directory we start out in (cwd) */ - char new_subdir[MAXPATHLEN + 1]; - char fn[MAXPATHLEN + 1], *fn_end; - DIR *subdirobj; /* Interable object holding all subdir entries */ - struct dirent *subdirentry; /* Individual subdir entry */ - struct stat buffer; /* Buffer used in stat */ - size_t l; - int n_footprints = 0; /* Running count of footprints found in this subdir */ - - /* Cache old dir, then cd into subdir because stat is given relative file names. */ - memset(olddir, 0, sizeof olddir); - if (GetWorkingDirectory(olddir) == NULL) { - Message(PCB_MSG_DEFAULT, _("fp_fs_list(): Could not determine initial working directory\n")); - return 0; - } - - if (strcmp(subdir, ".svn") == 0) - return 0; - - if (chdir(subdir)) { - if (!subdir_may_not_exist) - ChdirErrorMessage(subdir); - return 0; - } - - - /* Determine subdir's abs path */ - if (GetWorkingDirectory(new_subdir) == NULL) { - Message(PCB_MSG_DEFAULT, _("fp_fs_list(): Could not determine new working directory\n")); - if (chdir(olddir)) - ChdirErrorMessage(olddir); - return 0; - } - - l = strlen(new_subdir); - memcpy(fn, new_subdir, l); - fn[l] = PCB_DIR_SEPARATOR_C; - fn_end = fn + l + 1; - - /* First try opening the directory specified by path */ - if ((subdirobj = opendir(new_subdir)) == NULL) { - OpendirErrorMessage(new_subdir); - if (chdir(olddir)) - ChdirErrorMessage(olddir); - return 0; - } - - /* Now loop over files in this directory looking for files. - * We ignore certain files which are not footprints. - */ - while ((subdirentry = readdir(subdirobj)) != NULL) { -#ifdef DEBUG -/* printf("... Examining file %s ... \n", subdirentry->d_name); */ -#endif - - /* Ignore non-footprint files found in this directory - * We're skipping .png and .html because those - * may exist in a library tree to provide an html browsable - * index of the library. - */ - l = strlen(subdirentry->d_name); - if (!stat(subdirentry->d_name, &buffer) - && subdirentry->d_name[0] != '.' - && NSTRCMP(subdirentry->d_name, "CVS") != 0 - && NSTRCMP(subdirentry->d_name, "Makefile") != 0 - && NSTRCMP(subdirentry->d_name, "Makefile.am") != 0 - && NSTRCMP(subdirentry->d_name, "Makefile.in") != 0 && (l < 4 || NSTRCMP(subdirentry->d_name + (l - 4), ".png") != 0) - && (l < 5 || NSTRCMP(subdirentry->d_name + (l - 5), ".html") != 0) - && (l < 4 || NSTRCMP(subdirentry->d_name + (l - 4), ".pcb") != 0)) { - -#ifdef DEBUG -/* printf("... Found a footprint %s ... \n", subdirentry->d_name); */ -#endif - strcpy(fn_end, subdirentry->d_name); - if ((S_ISREG(buffer.st_mode)) || (WRAP_S_ISLNK(buffer.st_mode))) { - fp_type_t ty; - void **tags = NULL; - ty = pcb_fp_file_type(subdirentry->d_name, (need_tags ? &tags : NULL)); - if ((ty == PCB_FP_FILE) || (ty == PCB_FP_PARAMETRIC)) { - n_footprints++; - if (cb(cookie, new_subdir, subdirentry->d_name, ty, tags)) - break; - continue; - } - else - if (tags != NULL) - free(tags); - } - - if ((S_ISDIR(buffer.st_mode)) || (WRAP_S_ISLNK(buffer.st_mode))) { - cb(cookie, new_subdir, subdirentry->d_name, PCB_FP_DIR, NULL); - if (recurse) { - n_footprints += fp_fs_list(pl, fn, recurse, cb, cookie, 0, need_tags); - } - continue; - } - - } - } - /* Done. Clean up, cd back into old dir, and return */ - closedir(subdirobj); - if (chdir(olddir)) - ChdirErrorMessage(olddir); - return n_footprints; -} - -static int fp_fs_load_dir_(library_t *pl, const char *subdir, const char *toppath, int is_root) -{ - list_st_t l; - list_dir_t *d, *nextd; - char working_[MAXPATHLEN + 1]; - const char *visible_subdir; - char *working; /* String holding abs path to working dir */ - - sprintf(working_, "%s%c%s", toppath, PCB_DIR_SEPARATOR_C, subdir); - resolve_path(working_, &working, 0); - - if (strcmp(subdir, ".") == 0) - visible_subdir = "fs"; - else - visible_subdir = subdir; - - l.menu = fp_lib_search(pl, visible_subdir); - if (l.menu == NULL) - l.menu = fp_mkdir_len(pl, visible_subdir, -1); - l.subdirs = NULL; - l.children = 0; - - fp_fs_list(l.menu, working, 0, list_cb, &l, is_root, 1); - - /* now recurse to each subdirectory mapped in the previous call; - by now we don't care if menu is ruined by the realloc() in GetLibraryMenuMemory() */ - for (d = l.subdirs; d != NULL; d = nextd) { - l.children += fp_fs_load_dir_(l.menu, d->subdir, d->parent, 0); - nextd = d->next; - free(d->subdir); - free(d->parent); - free(d); - } - if ((l.children == 0) && (l.menu->data.dir.children.used == 0)) - fp_rmdir(l.menu); - free(working); - return l.children; -} - - -static int fp_fs_load_dir(plug_fp_t *ctx, const char *path) -{ - return fp_fs_load_dir_(&library, ".", path, 1); -} - -typedef struct { - const char *target; - int target_len; - int parametric; - char *path; - char *real_name; -} fp_search_t; - -static int fp_search_cb(void *cookie, const char *subdir, const char *name, fp_type_t type, void *tags[]) -{ - fp_search_t *ctx = (fp_search_t *) cookie; - if ((strncmp(ctx->target, name, ctx->target_len) == 0) && ((! !ctx->parametric) == (type == PCB_FP_PARAMETRIC))) { - const char *suffix = name + ctx->target_len; - /* ugly heuristics: footprint names may end in .fp or .ele */ - if ((*suffix == '\0') || (strcasecmp(suffix, ".fp") == 0) || (strcasecmp(suffix, ".ele") == 0)) { - ctx->path = pcb_strdup(subdir); - ctx->real_name = pcb_strdup(name); - return 1; - } - } - return 0; -} - -/* walk the search_path for finding the first footprint for basename (shall not contain "(") */ -static char *fp_fs_search(const char *search_path, const char *basename, int parametric) -{ - const char *p, *end; - char path[MAXPATHLEN + 1]; - fp_search_t ctx; - - if ((*basename == '/') || (*basename == PCB_DIR_SEPARATOR_C)) - return pcb_strdup(basename); - - ctx.target = basename; - ctx.target_len = strlen(ctx.target); - ctx.parametric = parametric; - ctx.path = NULL; - -/* fprintf("Looking for %s\n", ctx.target);*/ - - for (p = search_path; *p != '\0'; p = end + 1) { - char *fpath; - end = strchr(p, ':'); - if (end == NULL) - end = p + strlen(p); - memcpy(path, p, end - p); - path[end - p] = '\0'; - - resolve_path(path, &fpath, 0); -/* fprintf(stderr, " in '%s'\n", fpath);*/ - - fp_fs_list(&library, fpath, 1, fp_search_cb, &ctx, 1, 0); - if (ctx.path != NULL) { - sprintf(path, "%s%c%s", ctx.path, PCB_DIR_SEPARATOR_C, ctx.real_name); - free(ctx.path); - free(ctx.real_name); -/* fprintf(" found '%s'\n", path);*/ - free(fpath); - return pcb_strdup(path); - } - free(fpath); - if (end == NULL) - break; - } - return NULL; -} - -/* Decide about the type of a footprint file: - - it is a file element if the first non-comment is "Element(" or "Element[" - - else it is a parametric element (footprint generator) if it contains - "@@" "purpose" - - else it's not an element. - - if a line of a file element starts with ## and doesn't contain @, it's a tag - - if tags is not NULL, it's a pointer to a void *tags[] - an array of tag IDs -*/ -static fp_type_t pcb_fp_file_type(const char *fn, void ***tags) -{ - int c, comment_len; - int first_element = 1; - FILE *f; - enum { - ST_WS, - ST_COMMENT, - ST_ELEMENT, - ST_TAG - } state = ST_WS; - char *tag = NULL; - int talloced = 0, tused = 0; - int Talloced = 0, Tused = 0; - fp_type_t ret = PCB_FP_INVALID; - - if (tags != NULL) - *tags = NULL; - - f = fopen(fn, "r"); - if (f == NULL) - return PCB_FP_INVALID; - - while ((c = fgetc(f)) != EOF) { - switch (state) { - case ST_ELEMENT: - if (isspace(c)) - break; - if ((c == '(') || (c == '[')) { - ret = PCB_FP_FILE; - goto out; - } - case ST_WS: - if (isspace(c)) - break; - if (c == '#') { - comment_len = 0; - state = ST_COMMENT; - break; - } - else if ((first_element) && (c == 'E')) { - char s[8]; - /* Element */ - fgets(s, 7, f); - s[6] = '\0'; - if (strcmp(s, "lement") == 0) { - state = ST_ELEMENT; - break; - } - } - first_element = 0; - /* fall-thru for detecting @ */ - case ST_COMMENT: - comment_len++; - if ((c == '#') && (comment_len == 1)) { - state = ST_TAG; - break; - } - if ((c == '\r') || (c == '\n')) - state = ST_WS; - if (c == '@') { - char s[10]; - maybe_purpose:; - /* "@@" "purpose" */ - fgets(s, 9, f); - s[8] = '\0'; - if (strcmp(s, "@purpose") == 0) { - ret = PCB_FP_PARAMETRIC; - goto out; - } - } - break; - case ST_TAG: - if ((c == '\r') || (c == '\n')) { /* end of a tag */ - if (tags != NULL) { - tag[tused] = '\0'; - if (Tused >= Talloced) { - Talloced += 8; - *tags = realloc(*tags, (Talloced + 1) * sizeof(void *)); - } - (*tags)[Tused] = (void *) fp_tag(tag, 1); - Tused++; - (*tags)[Tused] = NULL; - } - - tused = 0; - state = ST_WS; - break; - } - if (c == '@') - goto maybe_purpose; - if (tused >= talloced) { - talloced += 64; - tag = realloc(tag, talloced + 1); /* always make room for an extra \0 */ - } - tag[tused] = c; - tused++; - } - } - -out:; - if (tag != NULL) - free(tag); - fclose(f); - return ret; -} - -#define F_IS_PARAMETRIC 0 -static FILE *fp_fs_fopen(plug_fp_t *ctx, const char *path, const char *name, fp_fopen_ctx_t *fctx) -{ - char *basename, *params, *fullname; - FILE *f = NULL; - const char *libshell = conf_core.rc.library_shell; - - fctx->field[F_IS_PARAMETRIC].i = fp_dupname(name, &basename, ¶ms); - if (basename == NULL) - return NULL; - - fctx->backend = ctx; - - fullname = fp_fs_search(path, basename, fctx->field[F_IS_PARAMETRIC].i); -/* fprintf(stderr, "basename=%s fullname=%s\n", basename, fullname);*/ -/* printf("pcb_fp_fopen: %d '%s' '%s' fullname='%s'\n", fctx->field[F_IS_PARAMETRIC].i, basename, params, fullname);*/ - - - if (fullname != NULL) { -/*fprintf(stderr, "fullname=%s param=%d\n", fullname, fctx->field[F_IS_PARAMETRIC].i);*/ - if (fctx->field[F_IS_PARAMETRIC].i) { - char *cmd; - const char *sep = " "; - if (libshell == NULL) { - libshell = ""; - sep = ""; - } - cmd = malloc(strlen(libshell) + strlen(fullname) + strlen(params) + 16); - sprintf(cmd, "%s%s%s %s", libshell, sep, fullname, params); -/*fprintf(stderr, " cmd=%s\n", cmd);*/ - f = popen(cmd, "r"); - free(cmd); - } - else - f = fopen(fullname, "r"); - free(fullname); - } - - free(basename); - return f; -} - -static void fp_fs_fclose(plug_fp_t *ctx, FILE * f, fp_fopen_ctx_t *fctx) -{ - if (fctx->field[F_IS_PARAMETRIC].i) - pclose(f); - else - fclose(f); -} - - -static plug_fp_t fp_fs; - -void hid_fp_fs_uninit(void) -{ - HOOK_UNREGISTER(plug_fp_t, plug_fp_chain, &fp_fs); -} - -pcb_uninit_t hid_fp_fs_init(void) -{ - fp_fs.plugin_data = NULL; - fp_fs.load_dir = fp_fs_load_dir; - fp_fs.fopen = fp_fs_fopen; - fp_fs.fclose = fp_fs_fclose; - HOOK_REGISTER(plug_fp_t, plug_fp_chain, &fp_fs); - return hid_fp_fs_uninit; -} Index: 1.1.4/src_plugins/export_lpr/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/export_lpr/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/export_lpr/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {export_lpr} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_lpr/lpr.o @] - -switch /local/pcb/export_lpr/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/export_lpr/README =================================================================== --- 1.1.4/src_plugins/export_lpr/README (revision 10776) +++ 1.1.4/src_plugins/export_lpr/README (nonexistent) @@ -1,5 +0,0 @@ -Export to lpr (using export_ps to generate postscript) - -#state: works -#default: buildin -#implements: export Index: 1.1.4/src_plugins/export_lpr/Makefile =================================================================== --- 1.1.4/src_plugins/export_lpr/Makefile (revision 10776) +++ 1.1.4/src_plugins/export_lpr/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_export_lpr - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/export_lpr/lpr.c =================================================================== --- 1.1.4/src_plugins/export_lpr/lpr.c (revision 10776) +++ 1.1.4/src_plugins/export_lpr/lpr.c (nonexistent) @@ -1,151 +0,0 @@ -/* for popen() */ -#define _DEFAULT_SOURCE -#define _BSD_SOURCE - -#include "config.h" - -#include -#include -#include -#include -#include - -#include "global.h" -#include "data.h" -#include "misc.h" -#include "plugins.h" -#include "compat_misc.h" - -#include "hid.h" -#include "../export_ps/ps.h" -#include "hid_nogui.h" -#include "hid_init.h" -#include "hid_attrib.h" -#include "hid_actions.h" - -const char *lpr_cookie = "lpr HID"; - -static HID_Attribute base_lpr_options[] = { - -/* %start-doc options "98 lpr Printing Options" -@ftable @code -@item --lprcommand -Command to use for printing. Defaults to @code{lpr}. This can be used to produce -PDF output with a virtual PDF printer. Example: @* -@code{--lprcommand "lp -d CUPS-PDF-Printer"}. -@end ftable -@noindent In addition, all @ref{Postscript Export} options are valid. -%end-doc -*/ - {"lprcommand", "Command to use for printing", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_lprcommand 0 -}; - -#define NUM_OPTIONS (sizeof(lpr_options)/sizeof(lpr_options[0])) - -static HID_Attribute *lpr_options = 0; -static int num_lpr_options = 0; -static HID_Attr_Val *lpr_values; - -static HID_Attribute *lpr_get_export_options(int *n) -{ - /* - * We initialize the default value in this manner because the GUI - * HID's may want to free() this string value and replace it with a - * new one based on how a user fills out a print dialog. - */ - if (base_lpr_options[HA_lprcommand].default_val.str_value == NULL) { - base_lpr_options[HA_lprcommand].default_val.str_value = pcb_strdup("lpr"); - } - - if (lpr_options == 0) { - HID_Attribute *ps_opts = ps_hid.get_export_options(&num_lpr_options); - lpr_options = (HID_Attribute *) calloc(num_lpr_options, sizeof(HID_Attribute)); - memcpy(lpr_options, ps_opts, num_lpr_options * sizeof(HID_Attribute)); - memcpy(lpr_options, base_lpr_options, sizeof(base_lpr_options)); - lpr_values = (HID_Attr_Val *) calloc(num_lpr_options, sizeof(HID_Attr_Val)); - } - if (n) - *n = num_lpr_options; - return lpr_options; -} - -static void lpr_do_export(HID_Attr_Val * options) -{ - FILE *f; - int i; - const char *filename; - - if (!options) { - lpr_get_export_options(0); - for (i = 0; i < num_lpr_options; i++) - lpr_values[i] = lpr_options[i].default_val; - options = lpr_values; - } - - filename = options[HA_lprcommand].str_value; - - printf("LPR: open %s\n", filename); - f = popen(filename, "w"); - if (!f) { - perror(filename); - return; - } - - ps_hid_export_to_file(f, options); - - fclose(f); -} - -static void lpr_parse_arguments(int *argc, char ***argv) -{ - lpr_get_export_options(0); - hid_register_attributes(lpr_options, num_lpr_options, lpr_cookie, 0); - hid_parse_command_line(argc, argv); -} - -static void lpr_calibrate(double xval, double yval) -{ - ps_calibrate_1(xval, yval, 1); -} - -static HID lpr_hid; - -static int lpr_usage(const char *topic) -{ - fprintf(stderr, "\nlpr exporter command line arguments:\n\n"); - hid_usage(base_lpr_options, sizeof(base_lpr_options) / sizeof(base_lpr_options[0])); - fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x lpr foo.pcb [lpr options]\n\n"); - return 0; -} - -static void plugin_lpr_uninit(void) -{ - hid_remove_actions_by_cookie(lpr_cookie); -} - -pcb_uninit_t hid_export_lpr_init() -{ - memset(&lpr_hid, 0, sizeof(HID)); - - common_nogui_init(&lpr_hid); - ps_ps_init(&lpr_hid); - - lpr_hid.struct_size = sizeof(HID); - lpr_hid.name = "lpr"; - lpr_hid.description = "Postscript print"; - lpr_hid.printer = 1; - lpr_hid.poly_before = 1; - - lpr_hid.get_export_options = lpr_get_export_options; - lpr_hid.do_export = lpr_do_export; - lpr_hid.parse_arguments = lpr_parse_arguments; - lpr_hid.calibrate = lpr_calibrate; - - lpr_hid.usage = lpr_usage; - - hid_register_hid(&lpr_hid); - - return plugin_lpr_uninit; -} Index: 1.1.4/src_plugins/oldactions/oldactions.c =================================================================== --- 1.1.4/src_plugins/oldactions/oldactions.c (revision 10776) +++ 1.1.4/src_plugins/oldactions/oldactions.c (nonexistent) @@ -1,320 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "global.h" -#include "conf.h" -#include "data.h" -#include "action_helper.h" -#include "change.h" -#include "error.h" -#include "undo.h" -#include "plugins.h" -#include "hid_actions.h" -#include "plug_footprint.h" - - -static void conf_toggle(conf_role_t role, const char *path) -{ - conf_native_t *n = conf_get_field(path); - if (n == NULL) { - Message(PCB_MSG_DEFAULT, "Error: can't find config node %s to toggle\n", path); - return; - } - if (n->type != CFN_BOOLEAN) { - Message(PCB_MSG_DEFAULT, "Error: config node %s is not a boolean, can't toggle\n", path); - return; - } - - conf_set(role, path, -1, n->val.boolean[0] ? "0" : "1", POL_OVERWRITE); -} - -/* -------------------------------------------------------------------------- */ - -static const char dumplibrary_syntax[] = "DumpLibrary()"; - -static const char dumplibrary_help[] = "Display the entire contents of the libraries."; - -/* %start-doc actions DumpLibrary - - -%end-doc */ -static void ind(int level) -{ - static char inds[] = " "; - - if (level > sizeof(inds)-1) - return; - inds[level] = '\0'; - printf("%s", inds); - inds[level] = ' '; -} - -static void dump_lib_any(int level, library_t *l); - -static void dump_lib_dir(int level, library_t *l) -{ - pcb_cardinal_t n; - - ind(level); - printf("%s/\n", l->name); - for(n = 0; n < vtlib_len(&l->data.dir.children); n++) - dump_lib_any(level+1, l->data.dir.children.array+n); -} - -static void dump_lib_fp(int level, library_t *l) -{ - ind(level); - printf("%s", l->name); - switch(l->data.fp.type) { - case PCB_FP_INVALID: printf(" type(??)"); break; - case PCB_FP_DIR: printf(" type(DIR)"); break; - case PCB_FP_FILE: printf(" type(file)"); break; - case PCB_FP_PARAMETRIC: printf(" type(parametric)"); break; - } - printf(" loc_info(%s)\n", l->data.fp.loc_info); -} - -static void dump_lib_any(int level, library_t *l) -{ - switch(l->type) { - case LIB_INVALID: printf("??\n"); break; - case LIB_DIR: dump_lib_dir(level, l); break; - case LIB_FOOTPRINT: dump_lib_fp(level, l); break; - } -} - - -static int ActionDumpLibrary(int argc, const char **argv, Coord x, Coord y) -{ - dump_lib_any(0, &library); - - return 0; -} - -/* --------------------------------------------------------------------------- - * no operation, just for testing purposes - * syntax: Bell(volume) - */ -static const char bell_syntax[] = "Bell()"; - -static const char bell_help[] = "Attempt to produce audible notification (e.g. beep the speaker)."; - -static int ActionBell(int argc, const char **argv, Coord x, Coord y) -{ - gui->beep(); - return 0; -} - -/* --------------------------------------------------------------------------- */ - -static const char debug_syntax[] = "Debug(...)"; - -static const char debug_help[] = "Debug action."; - -/* %start-doc actions Debug - -This action exists to help debug scripts; it simply prints all its -arguments to stdout. - -%end-doc */ - -static const char debugxy_syntax[] = "DebugXY(...)"; - -static const char debugxy_help[] = "Debug action, with coordinates"; - -/* %start-doc actions DebugXY - -Like @code{Debug}, but requires a coordinate. If the user hasn't yet -indicated a location on the board, the user will be prompted to click -on one. - -%end-doc */ - -static int Debug(int argc, const char **argv, Coord x, Coord y) -{ - int i; - printf("Debug:"); - for (i = 0; i < argc; i++) - printf(" [%d] `%s'", i, argv[i]); - pcb_printf(" x,y %$mD\n", x, y); - return 0; -} - -static const char return_syntax[] = "Return(0|1)"; - -static const char return_help[] = "Simulate a passing or failing action."; - -/* %start-doc actions Return - -This is for testing. If passed a 0, does nothing and succeeds. If -passed a 1, does nothing but pretends to fail. - -%end-doc */ - -static int Return(int argc, const char **argv, Coord x, Coord y) -{ - return atoi(argv[0]); -} - - -static const char djopt_sao_syntax[] = "OptAutoOnly()"; - -static const char djopt_sao_help[] = "Toggles the optimize-only-autorouted flag."; - -/* %start-doc actions OptAutoOnly - -The original purpose of the trace optimizer was to clean up the traces -created by the various autorouters that have been used with PCB. When -a board has a mix of autorouted and carefully hand-routed traces, you -don't normally want the optimizer to move your hand-routed traces. -But, sometimes you do. By default, the optimizer only optimizes -autorouted traces. This action toggles that setting, so that you can -optimize hand-routed traces also. - -%end-doc */ - - - -int djopt_set_auto_only(int argc, const char **argv, Coord x, Coord y) -{ - conf_toggle(CFR_DESIGN, "plugins/djopt/auto_only"); - return 0; -} - -/* ************************************************************ */ - -static const char toggle_vendor_syntax[] = "ToggleVendor()"; - -static const char toggle_vendor_help[] = "Toggles the state of automatic drill size mapping."; - -/* %start-doc actions ToggleVendor - -@cindex vendor map -@cindex vendor drill table -@findex ToggleVendor() - -When drill mapping is enabled, new instances of pins and vias will -have their drill holes mapped to one of the allowed drill sizes -specified in the currently loaded vendor drill table. To enable drill -mapping, a vendor lihata file containing a drill table must be -loaded first. - -%end-doc */ - -int ActionToggleVendor(int argc, const char **argv, Coord x, Coord y) -{ - conf_toggle(CFR_DESIGN, "plugins/vendor/enable"); - return 0; -} - -/* ************************************************************ */ - -static const char enable_vendor_syntax[] = "EnableVendor()"; - -static const char enable_vendor_help[] = "Enables automatic drill size mapping."; - -/* %start-doc actions EnableVendor - -@cindex vendor map -@cindex vendor drill table -@findex EnableVendor() - -When drill mapping is enabled, new instances of pins and vias will -have their drill holes mapped to one of the allowed drill sizes -specified in the currently loaded vendor drill table. To enable drill -mapping, a vendor lihata file containing a drill table must be -loaded first. - -%end-doc */ - -int ActionEnableVendor(int argc, const char **argv, Coord x, Coord y) -{ - conf_set(CFR_DESIGN, "plugins/vendor/enable", -1, "1", POL_OVERWRITE); - return 0; -} - -/* ************************************************************ */ - -static const char disable_vendor_syntax[] = "DisableVendor()"; - -static const char disable_vendor_help[] = "Disables automatic drill size mapping."; - -/* %start-doc actions DisableVendor - -@cindex vendor map -@cindex vendor drill table -@findex DisableVendor() - -When drill mapping is enabled, new instances of pins and vias will -have their drill holes mapped to one of the allowed drill sizes -specified in the currently loaded vendor drill table. - -%end-doc */ - -int ActionDisableVendor(int argc, const char **argv, Coord x, Coord y) -{ - conf_set(CFR_DESIGN, "plugins/vendor/enable", -1, "0", POL_OVERWRITE); - return 0; -} - - -HID_Action oldactions_action_list[] = { - {"DumpLibrary", 0, ActionDumpLibrary, - dumplibrary_help, dumplibrary_syntax}, - {"Bell", 0, ActionBell, - bell_help, bell_syntax}, - {"Debug", 0, Debug, - debug_help, debug_syntax}, - {"DebugXY", "Click X,Y for Debug", Debug, - debugxy_help, debugxy_syntax}, - {"Return", 0, Return, - return_help, return_syntax}, - {"OptAutoOnly", 0, djopt_set_auto_only, - djopt_sao_help, djopt_sao_syntax}, - {"ToggleVendor", 0, ActionToggleVendor, - toggle_vendor_help, toggle_vendor_syntax}, - {"EnableVendor", 0, ActionEnableVendor, - enable_vendor_help, enable_vendor_syntax}, - {"DisableVendor", 0, ActionDisableVendor, - disable_vendor_help, disable_vendor_syntax} -}; - -static const char *oldactions_cookie = "oldactions plugin"; - -REGISTER_ACTIONS(oldactions_action_list, oldactions_cookie) - -static void hid_oldactions_uninit(void) -{ - hid_remove_actions_by_cookie(oldactions_cookie); -} - -#include "dolists.h" -pcb_uninit_t hid_oldactions_init(void) -{ - REGISTER_ACTIONS(oldactions_action_list, oldactions_cookie) - return hid_oldactions_uninit; -} Index: 1.1.4/src_plugins/oldactions/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/oldactions/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/oldactions/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {oldactions} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/oldactions/oldactions.o @] - -switch /local/pcb/oldactions/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/oldactions/README =================================================================== --- 1.1.4/src_plugins/oldactions/README (revision 10776) +++ 1.1.4/src_plugins/oldactions/README (nonexistent) @@ -1,9 +0,0 @@ -Random collection of old/obsolete actions. Bell(): audible feedback; -DumpLibrary(): print footprint library on stdout; a set of debug actions -useful for writing pcb scripts: Debug(), DebugXY(), Return(). Old -plugin actions to toggle or set settings that are now accessible via -the unified config system (vendordrill, djopt) - -#state: works -#default: disabled -#implements: (feature) Index: 1.1.4/src_plugins/oldactions/Makefile =================================================================== --- 1.1.4/src_plugins/oldactions/Makefile (revision 10776) +++ 1.1.4/src_plugins/oldactions/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_oldactions - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/export_svg/svg.c =================================================================== --- 1.1.4/src_plugins/export_svg/svg.c (revision 10776) +++ 1.1.4/src_plugins/export_svg/svg.c (nonexistent) @@ -1,735 +0,0 @@ - /* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 2006 Dan McMahill - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * Based on the png exporter by Dan McMahill - */ - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "global.h" -#include "data.h" -#include "error.h" -#include "misc.h" -#include "layer.h" -#include "misc_util.h" -#include "compat_misc.h" -#include "plugins.h" - -#include "hid.h" -#include "hid_nogui.h" -#include "hid_draw_helpers.h" - -#include "hid_init.h" -#include "hid_attrib.h" -#include "hid_color.h" -#include "hid_helper.h" -#include "hid_flags.h" - - -static HID svg_hid; - -const char *svg_cookie = "svg HID"; - - -typedef struct hid_gc_struct { - HID *me_pointer; - EndCapStyle cap; - int width; - char *color; - int erase, drill; -} hid_gc_struct; - -static const char *CAPS(EndCapStyle cap) -{ - switch (cap) { - case Trace_Cap: - case Round_Cap: - return "round"; - case Square_Cap: - return "square"; - case Beveled_Cap: - return "butt"; - } - return ""; -} - -static FILE *f = NULL; -static int group_open = 0; -static int opacity = 100, drawing_mask, drawing_hole, photo_mode, flip; - -gds_t sbright, sdark, snormal; - -/* Photo mode colors and hacks */ -const char *board_color = "#464646"; -const char *mask_color = "#00ff00"; -float mask_opacity_factor = 0.5; - -enum { - PHOTO_MASK, - PHOTO_SILK, - PHOTO_COPPER, - PHOTO_INNER -} photo_color; - -struct { - const char *bright; - const char *normal; - const char *dark; - Coord offs; -} photo_palette[] = { - /* MASK */ { "#00ff00", "#00ff00", "#00ff00", PCB_MM_TO_COORD(0) }, - /* SILK */ { "#ffffff", "#eeeeee", "#aaaaaa", PCB_MM_TO_COORD(0) }, - /* COPPER */ { "#bbbbbb", "#707090", "#555555", PCB_MM_TO_COORD(0.05) }, - /* INNER */ { "#222222", "#111111", "#000000", PCB_MM_TO_COORD(0.05) } -}; - -HID_Attribute svg_attribute_list[] = { - /* other HIDs expect this to be first. */ - -/* %start-doc options "93 SVG Options" -@ftable @code -@item --outfile -Name of the file to be exported to. Can contain a path. -@end ftable -%end-doc -*/ - {"outfile", "Graphics output file", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_svgfile 0 - -/* %start-doc options "93 SVG Options" -@ftable @code -@cindex photo-mode -@item --photo-mode -Export a photo realistic image of the layout. -@end ftable -%end-doc -*/ - {"photo-mode", "Photo-realistic export mode", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_photo_mode 1 - -/* %start-doc options "93 SVG Options" -@ftable @code -@cindex opacity -@item --opacity -Layer opacity -@end ftable -%end-doc -*/ - {"opacity", "Layer opacity", - HID_Integer, 0, 100, {100, 0, 0}, 0, 0}, -#define HA_opacity 2 - -/* %start-doc options "93 SVG Options" -@ftable @code -@cindex flip -@item --flip -Flip board, look at it from the bottom side -@end ftable -%end-doc -*/ - {"flip", "Flip board", - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0} -#define HA_flip 3 -}; - -#define NUM_OPTIONS (sizeof(svg_attribute_list)/sizeof(svg_attribute_list[0])) - -#define TRX(x) -#define TRY(y) \ -do { \ - if (flip) \ - y = PCB->MaxHeight - y; \ -} while(0) - - -REGISTER_ATTRIBUTES(svg_attribute_list, svg_cookie) - -static HID_Attr_Val svg_values[NUM_OPTIONS]; - -static HID_Attribute *svg_get_export_options(int *n) -{ - static char *last_made_filename = 0; - const char *suffix = ".svg"; - - if (PCB) - derive_default_filename(PCB->Filename, &svg_attribute_list[HA_svgfile], suffix, &last_made_filename); - - if (n) - *n = NUM_OPTIONS; - return svg_attribute_list; -} - -void svg_hid_export_to_file(FILE * the_file, HID_Attr_Val * options) -{ - static int saved_layer_stack[MAX_LAYER]; - BoxType region; - - region.X1 = 0; - region.Y1 = 0; - region.X2 = PCB->MaxWidth; - region.Y2 = PCB->MaxHeight; - - f = the_file; - - memcpy(saved_layer_stack, LayerStack, sizeof(LayerStack)); - - { - conf_force_set_bool(conf_core.editor.thin_draw, 0); - conf_force_set_bool(conf_core.editor.thin_draw_poly, 0); -/* conf_force_set_bool(conf_core.editor.check_planes, 0);*/ - conf_force_set_bool(conf_core.editor.show_solder_side, 0); - conf_force_set_bool(conf_core.editor.show_mask, 0); - - if (options[HA_photo_mode].int_value) { - photo_mode = 1; - conf_force_set_bool(conf_core.editor.show_mask, 1); - } - else - photo_mode = 0; - - if (options[HA_flip].int_value) { - flip = 1; - conf_force_set_bool(conf_core.editor.show_solder_side, 1); - } - else - flip = 0; - } - - if (photo_mode) { - pcb_fprintf(f, "\n", - 0, 0, PCB->MaxWidth, PCB->MaxHeight, board_color); - } - - opacity = options[HA_opacity].int_value; - - gds_init(&sbright); - gds_init(&sdark); - gds_init(&snormal); - hid_expose_callback(&svg_hid, ®ion, 0); - - conf_update(NULL); /* restore forced sets */ -} - -static void group_close() -{ - if (group_open == 1) { - if (gds_len(&sdark) > 0) { - fprintf(f, "\n"); - fprintf(f, "%s", sdark.array); - gds_truncate(&sdark, 0); - } - - if (gds_len(&sbright) > 0) { - fprintf(f, "\n"); - fprintf(f, "%s", sbright.array); - gds_truncate(&sbright, 0); - } - - if (gds_len(&snormal) > 0) { - fprintf(f, "\n"); - fprintf(f, "%s", snormal.array); - gds_truncate(&snormal, 0); - } - - } - fprintf(f, "\n"); -} - -static void svg_do_export(HID_Attr_Val * options) -{ - const char *filename; - int save_ons[MAX_LAYER + 2]; - int i; - Coord w, h, x1, y1, x2, y2; - - if (!options) { - svg_get_export_options(0); - for (i = 0; i < NUM_OPTIONS; i++) - svg_values[i] = svg_attribute_list[i].default_val; - options = svg_values; - } - - filename = options[HA_svgfile].str_value; - if (!filename) - filename = "pcb.svg"; - - f = fopen(filename, "wb"); - if (!f) { - perror(filename); - return; - } - - fprintf(f, "\n"); - w = PCB->MaxWidth; - h = PCB->MaxHeight; - while((w < PCB_MM_TO_COORD(1024)) && (h < PCB_MM_TO_COORD(1024))) { - w *= 2; - h *= 2; - } - - x1 = PCB_MM_TO_COORD(2); - y1 = PCB_MM_TO_COORD(2); - x2 = PCB->MaxWidth; - y2 = PCB->MaxHeight; - x2 += PCB_MM_TO_COORD(5); - y2 += PCB_MM_TO_COORD(5); - pcb_fprintf(f, "\n", w, h, x1, y1, x2, y2); - - hid_save_and_show_layer_ons(save_ons); - - svg_hid_export_to_file(f, options); - - hid_restore_layer_ons(save_ons); - - while(group_open) { - group_close(); - group_open--; - } - - fprintf(f, "\n"); - fclose(f); - f = NULL; -} - -static void svg_parse_arguments(int *argc, char ***argv) -{ - hid_register_attributes(svg_attribute_list, sizeof(svg_attribute_list) / sizeof(svg_attribute_list[0]), svg_cookie, 0); - hid_parse_command_line(argc, argv); -} - -static int svg_set_layer(const char *name, int group, int empty) -{ - int opa, our_mask, our_silk; - unsigned int our_side; - - if (flip) { - our_mask = SL(MASK, BOTTOM); - our_silk = SL(SILK, BOTTOM); - our_side = PCB_LYT_BOTTOM; - } - else { - our_mask = SL(MASK, TOP); - our_silk = SL(SILK, TOP); - our_side = PCB_LYT_TOP; - } - - /* don't draw the mask if we are not in the photo mode */ - if (!photo_mode && ((group == SL(MASK, TOP)) || (group == SL(MASK, BOTTOM)))) - return 0; - - if ((group < 0) && (group != our_silk) && (group != our_mask) && (group != SL(UDRILL, 0)) && (group != SL(PDRILL, 0))) - return 0; - while(group_open) { - group_close(); - group_open--; - } - if (name == NULL) - name = "copper"; - fprintf(f, "\n"); - group_open = 1; - - if (photo_mode) { - if (group == our_silk) - photo_color = PHOTO_SILK; - if (group == our_mask) - photo_color = PHOTO_MASK; - else if (group >= 0) { - int ly = PCB->LayerGroups.Entries[group][0]; - unsigned int fl; - fl = pcb_layer_flags(ly) & PCB_LYT_ANYWHERE; - if (fl == our_side) - photo_color = PHOTO_COPPER; - else - photo_color = PHOTO_INNER; - } - } - - drawing_hole = (group == SL(UDRILL, 0)) || (group == SL(PDRILL, 0)); - - return 1; -} - - -static hidGC svg_make_gc(void) -{ - hidGC rv = (hidGC) malloc(sizeof(hid_gc_struct)); - rv->me_pointer = &svg_hid; - rv->cap = Trace_Cap; - rv->width = 1; - rv->color = NULL; - return rv; -} - -static void svg_destroy_gc(hidGC gc) -{ - free(gc); -} - -static void svg_use_mask(int use_it) -{ - if (use_it == HID_MASK_CLEAR) { - return; - } - if (use_it) { - } -} - -static void svg_set_color(hidGC gc, const char *name) -{ - gc->drill = gc->erase = 0; - if (name == NULL) - name = "#ff0000"; - if (strcmp(name, "drill") == 0) { - name = "#ffffff"; - gc->drill = 1; - } - else if (strcmp(name, "erase") == 0) { - name = "#ffffff"; - gc->erase = 1; - } - else if (drawing_mask) - name = mask_color; - if ((gc->color != NULL) && (strcmp(gc->color, name) == 0)) - return; - free(gc->color); - gc->color = pcb_strdup(name); -} - -static void svg_set_line_cap(hidGC gc, EndCapStyle style) -{ - gc->cap = style; -} - -static void svg_set_line_width(hidGC gc, Coord width) -{ - gc->width = width; -} - -static void indent(gds_t *s) -{ - static char ind[] = " "; - if (group_open < sizeof(ind)-1) { - ind[group_open] = '\0'; - if (s == NULL) - pcb_fprintf(f, ind); - else - pcb_append_printf(s, ind); - ind[group_open] = ' '; - return; - } - - if (s == NULL) - pcb_fprintf(f, ind); - else - pcb_append_printf(s, ind); -} - -static void svg_set_draw_xor(hidGC gc, int xor_) -{ - ; -} - -#define fix_rect_coords() \ - if (x1 > x2) {\ - Coord t = x1; \ - x1 = x2; \ - x2 = t; \ - } \ - if (y1 > y2) { \ - Coord t = y1; \ - y1 = y2; \ - y2 = t; \ - } - -static void draw_rect(hidGC gc, Coord x1, Coord y1, Coord w, Coord h, Coord stroke) -{ - indent(&snormal); - pcb_append_printf(&snormal, "\n", - x1, y1, w, h, stroke, gc->color, CAPS(gc->cap)); -} - -static void svg_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - fix_rect_coords(); - draw_rect(gc, x1, y1, x2-x1, y2-y1, gc->width); -} - -static void draw_fill_rect(hidGC gc, Coord x1, Coord y1, Coord w, Coord h) -{ - if ((photo_mode) && (!gc->erase)) { - Coord photo_offs = photo_palette[photo_color].offs; - if (photo_offs != 0) { - indent(&sdark); - pcb_append_printf(&sdark, "\n", - x1+photo_offs, y1+photo_offs, w, h, photo_palette[photo_color].dark); - indent(&sbright); - pcb_append_printf(&sbright, "\n", - x1-photo_offs, y1-photo_offs, w, h, photo_palette[photo_color].bright); - } - indent(&snormal); - pcb_append_printf(&snormal, "\n", - x1, y1, w, h, photo_palette[photo_color].normal); - } - else { - indent(&snormal); - pcb_append_printf(&snormal, "\n", - x1, y1, w, h, gc->color); - } -} - -static void svg_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - TRX(x1); TRY(y1); TRX(x2); TRY(y2); - fix_rect_coords(); - draw_fill_rect(gc, x1, y1, x2-x1, y2-y1); -} - -static void draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - if ((photo_mode) && (!gc->erase)) { - Coord photo_offs = photo_palette[photo_color].offs; - if (photo_offs != 0) { - indent(&sbright); - pcb_append_printf(&sbright, "\n", - x1-photo_offs, y1-photo_offs, x2-photo_offs, y2-photo_offs, gc->width, photo_palette[photo_color].bright, CAPS(gc->cap)); - indent(&sdark); - pcb_append_printf(&sdark, "\n", - x1+photo_offs, y1+photo_offs, x2+photo_offs, y2+photo_offs, gc->width, photo_palette[photo_color].dark, CAPS(gc->cap)); - } - indent(&snormal); - pcb_append_printf(&snormal, "\n", - x1, y1, x2, y2, gc->width, photo_palette[photo_color].normal, CAPS(gc->cap)); - } - else { - indent(&snormal); - pcb_append_printf(&snormal, "\n", - x1, y1, x2, y2, gc->width, gc->color, CAPS(gc->cap)); - } -} - -static void svg_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ - TRX(x1); TRY(y1); TRX(x2); TRY(y2); - draw_line(gc, x1, y1, x2, y2); -} - -static void draw_arc(hidGC gc, Coord x1, Coord y1, Coord r, Coord x2, Coord y2, Coord stroke) -{ - if ((photo_mode) && (!gc->erase)) { - Coord photo_offs = photo_palette[photo_color].offs; - if (photo_offs != 0) { - indent(&sbright); - pcb_append_printf(&sbright, "\n", - x1-photo_offs, y1-photo_offs, r, r, x2-photo_offs, y2-photo_offs, gc->width, photo_palette[photo_color].bright, CAPS(gc->cap)); - indent(&sdark); - pcb_append_printf(&sdark, "\n", - x1+photo_offs, y1+photo_offs, r, r, x2+photo_offs, y2+photo_offs, gc->width, photo_palette[photo_color].dark, CAPS(gc->cap)); - } - indent(&snormal); - pcb_append_printf(&snormal, "\n", - x1, y1, r, r, x2, y2, gc->width, photo_palette[photo_color].normal, CAPS(gc->cap)); - } - else { - indent(&snormal); - pcb_append_printf(&snormal, "\n", - x1, y1, r, r, x2, y2, gc->width, gc->color, CAPS(gc->cap)); - } -} - -static void svg_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle) -{ - Coord x1, y1, x2, y2; - Angle sa, ea; - - TRX(cx); TRY(cy); - - /* calculate start and end angles considering flip */ - start_angle = 180 - start_angle; - delta_angle = -delta_angle; - if (flip) { - start_angle = -start_angle; - delta_angle = -delta_angle; - } - if (delta_angle > 0) { - sa = start_angle; - ea = start_angle + delta_angle; - } - else { - sa = start_angle + delta_angle; - ea = start_angle; - } - - /* calculate the endpoints */ - x2 = cx + (width * cos(sa * M_PI / 180)); - y2 = cy + (width * sin(sa * M_PI / 180)); - x1 = cx + (width * cos(ea * M_PI / 180)); - y1 = cy + (width * sin(ea * M_PI / 180)); - - draw_arc(gc, x1, y1, width, x2, y2, gc->width); -} - -static void draw_fill_circle(hidGC gc, Coord cx, Coord cy, Coord r, Coord stroke) -{ - if ((photo_mode) && (!gc->erase)) { - if (!drawing_hole) { - Coord photo_offs = photo_palette[photo_color].offs; - if ((!gc->drill) && (photo_offs != 0)) { - indent(&sbright); - pcb_append_printf(&sbright, "\n", - cx-photo_offs, cy-photo_offs, r, stroke, photo_palette[photo_color].bright); - - indent(&sdark); - pcb_append_printf(&sdark, "\n", - cx+photo_offs, cy+photo_offs, r, stroke, photo_palette[photo_color].dark); - } - indent(&snormal); - pcb_append_printf(&snormal, "\n", - cx, cy, r, stroke, photo_palette[photo_color].normal); - } - else { - indent(&snormal); - pcb_append_printf(&snormal, "\n", - cx, cy, r, stroke, "#000000"); - } - } - else{ - indent(&snormal); - pcb_append_printf(&snormal, "\n", - cx, cy, r, stroke, gc->color); - } -} - -static void svg_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) -{ - TRX(cx); TRY(cy); - draw_fill_circle(gc, cx, cy, radius, gc->width); -} - -static void draw_poly(gds_t *s, hidGC gc, int n_coords, Coord * x, Coord * y, Coord offs, const char *clr) -{ - int i; - float poly_bloat = 0.075; - - indent(s); - gds_append_str(s, "\n", poly_bloat, clr, clr); -} - -static void svg_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) -{ - if ((photo_mode) && (!gc->erase)) { - Coord photo_offs = photo_palette[photo_color].offs; - if (photo_offs != 0) { - draw_poly(&sbright, gc, n_coords, x, y, -photo_offs, photo_palette[photo_color].bright); - draw_poly(&sdark, gc, n_coords, x, y, +photo_offs, photo_palette[photo_color].dark); - } - draw_poly(&snormal, gc, n_coords, x, y, 0, photo_palette[photo_color].normal); - } - else - draw_poly(&snormal, gc, n_coords, x, y, 0, gc->color); -} - -static void svg_calibrate(double xval, double yval) -{ - Message(PCB_MSG_ERROR, "svg_calibrate() not implemented"); - return; -} - -static void svg_set_crosshair(int x, int y, int a) -{ -} - -static int svg_usage(const char *topic) -{ - fprintf(stderr, "\nsvg exporter command line arguments:\n\n"); - hid_usage(svg_attribute_list, sizeof(svg_attribute_list) / sizeof(svg_attribute_list[0])); - fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x svg foo.pcb [svg options]\n\n"); - return 0; -} - -#include "dolists.h" - -pcb_uninit_t hid_export_svg_init() -{ - memset(&svg_hid, 0, sizeof(HID)); - - common_nogui_init(&svg_hid); - common_draw_helpers_init(&svg_hid); - - svg_hid.struct_size = sizeof(HID); - svg_hid.name = "svg"; - svg_hid.description = "Scalable Vector Graphics export"; - svg_hid.exporter = 1; - svg_hid.poly_before = 1; - svg_hid.holes_after = 1; - - svg_hid.get_export_options = svg_get_export_options; - svg_hid.do_export = svg_do_export; - svg_hid.parse_arguments = svg_parse_arguments; - svg_hid.set_layer = svg_set_layer; - svg_hid.make_gc = svg_make_gc; - svg_hid.destroy_gc = svg_destroy_gc; - svg_hid.use_mask = svg_use_mask; - svg_hid.set_color = svg_set_color; - svg_hid.set_line_cap = svg_set_line_cap; - svg_hid.set_line_width = svg_set_line_width; - svg_hid.set_draw_xor = svg_set_draw_xor; - svg_hid.draw_line = svg_draw_line; - svg_hid.draw_arc = svg_draw_arc; - svg_hid.draw_rect = svg_draw_rect; - svg_hid.fill_circle = svg_fill_circle; - svg_hid.fill_polygon = svg_fill_polygon; - svg_hid.fill_rect = svg_fill_rect; - svg_hid.calibrate = svg_calibrate; - svg_hid.set_crosshair = svg_set_crosshair; - - svg_hid.usage = svg_usage; - - hid_register_hid(&svg_hid); - - return NULL; -} Index: 1.1.4/src_plugins/export_svg/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/export_svg/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/export_svg/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {export_svg} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_svg/svg.o @] - -switch /local/pcb/export_svg/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/export_svg/README =================================================================== --- 1.1.4/src_plugins/export_svg/README (revision 10776) +++ 1.1.4/src_plugins/export_svg/README (nonexistent) @@ -1,5 +0,0 @@ -Scalable Vector Graphics (SVG) exporter - -#state: works -#default: buildin -#implements: export Index: 1.1.4/src_plugins/export_svg/Makefile =================================================================== --- 1.1.4/src_plugins/export_svg/Makefile (revision 10776) +++ 1.1.4/src_plugins/export_svg/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_export_svg - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/import_edif/import_edif.c =================================================================== --- 1.1.4/src_plugins/import_edif/import_edif.c (revision 10776) +++ 1.1.4/src_plugins/import_edif/import_edif.c (nonexistent) @@ -1,93 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * This module, io_kicad_legacy, was written and is Copyright (C) 2016 by Tibor Palinkas - * this module is also subject to the GNU GPL as described below - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "config.h" -#include "global.h" -#include "data.h" -#include "plugins.h" -#include "plug_import.h" -#include "netlist.h" -#include "rats_patch.h" - -/* for pcb_sort_library only */ -#include "plug_io.h" - - -static plug_import_t import_edif; - -int edif_support_prio(plug_import_t *ctx, unsigned int aspects, FILE *fp, const char *filename) -{ - char buf[65]; - int len; - char *p; - - if (aspects != IMPORT_ASPECT_NETLIST) - return 0; /* only pure netlist import is supported */ - - if (fp == NULL) - return 0; /* only importing from a file is supported */ - - /* If the header contains "edif", it is supported */ - len = fread(buf, 1, sizeof(buf) - 1, fp); - buf[len] = '\0'; - for(p = buf; *p != '\0'; p++) - *p = tolower((int) *p); - if (strstr(buf, "edif") != NULL) - return 100; - - /* Else don't even attempt to load it */ - return 0; -} - - -extern int ReadEdifNetlist(char *filename); -static int edif_import(plug_import_t *ctx, unsigned int aspects, const char *fn) -{ - int ret = ReadEdifNetlist((char *)fn); - if (ret == 0) { - pcb_sort_netlist(); - rats_patch_make_edited(PCB); - } - return ret; -} - -static void hid_import_edif_uninit(void) -{ -} - -pcb_uninit_t hid_import_edif_init(void) -{ - - /* register the IO hook */ - import_edif.plugin_data = NULL; - - import_edif.fmt_support_prio = edif_support_prio; - import_edif.import = edif_import; - - HOOK_REGISTER(plug_import_t, plug_import_chain, &import_edif); - - return hid_import_edif_uninit; -} - Index: 1.1.4/src_plugins/import_edif/edif_parse.h =================================================================== --- 1.1.4/src_plugins/import_edif/edif_parse.h (revision 10776) +++ 1.1.4/src_plugins/import_edif/edif_parse.h (nonexistent) @@ -1,29 +0,0 @@ -/* - * COPYRIGHT - * - * Copyright (C) 2006 Jeffry C Bailey - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - -#ifndef PCB_EDIF_PARSE_H -#define PCB_EDIF_PARSE_H - -void ParseEDIF(char *filename, FILE * err); - - -#endif /* PCB_EDIF_PARSE_H */ Index: 1.1.4/src_plugins/import_edif/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/import_edif/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/import_edif/Plug.tmpasm (nonexistent) @@ -1,9 +0,0 @@ -put /local/pcb/mod {import_edif} -append /local/pcb/mod/OBJS [@ $(PLUGDIR)/import_edif/edif.o $(PLUGDIR)/import_edif/import_edif.o @] -append /local/pcb/mod/YACC {$(PLUGDIR)/import_edif/edif} - -switch /local/pcb/import_edif/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/import_edif/edif.c =================================================================== --- 1.1.4/src_plugins/import_edif/edif.c (revision 10776) +++ 1.1.4/src_plugins/import_edif/edif.c (nonexistent) @@ -1,6243 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - 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 3 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0.2" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - -/* Substitute the variable and function names. */ -#define yyparse edifparse -#define yylex ediflex -#define yyerror ediferror -#define yydebug edifdebug -#define yynerrs edifnerrs - -#define yylval ediflval -#define yychar edifchar - -/* Copy the first part of user declarations. */ -#line 1 "../../src_plugins/import_edif/edif.y" /* yacc.c:339 */ - -/* - * PCB Edif parser based heavily on: - * - * Header: edif.y,v 1.18 87/12/07 19:59:49 roger Locked - */ -/************************************************************************ - * * - * edif.y * - * * - * EDIF 2.0.0 parser, Level 0 * - * * - * You are free to copy, distribute, use it, abuse it, make it * - * write bad tracks all over the disk ... or anything else. * - * * - * Your friendly neighborhood Rogue Monster - roger@mips.com * - * * - ************************************************************************/ -#include - -/* for malloc, free, atoi */ -#include - -/* for strcpy */ -#include - -#include - -#include "global.h" -#include "data.h" -#include "error.h" -#include "plugins.h" -#include "compat_misc.h" - -/* from mymem.h, not include because of the malloc junk */ -LibraryMenuTypePtr GetLibraryMenuMemory(LibraryTypePtr, int *idx); -LibraryEntryTypePtr GetLibraryEntryMemory(LibraryMenuTypePtr); - - -/* - * Local definitions. - */ -#define IDENT_LENGTH 255 -#define Malloc(s) malloc(s) -#define Free(p) free(p) -#define Getc(s) getc(s) -#define Ungetc(c) ungetc(c,Input) - - typedef struct _str_pair - { - char* str1; - char* str2; - struct _str_pair* next; - } str_pair; - - typedef struct _pair_list - { - char* name; - str_pair* list; - } pair_list; - - str_pair* new_str_pair(char* s1, char* s2) - { - str_pair* ps = (str_pair *)malloc(sizeof(str_pair)); - ps->str1 = s1; - ps->str2 = s2; - ps->next = NULL; - return ps; - } - - pair_list* new_pair_list(str_pair* ps) - { - pair_list* pl = (pair_list *)malloc(sizeof(pair_list)); - pl->list = ps; - pl->name = NULL; - return pl; - } - - void str_pair_free(str_pair* ps) - { - str_pair* node; - while ( ps ) - { - free(ps->str1); - free(ps->str2); - node = ps; - ps = ps->next; - free(node); - } - } - - void pair_list_free(pair_list* pl) - { - str_pair_free(pl->list); - free(pl->name); - free(pl); - } - - void define_pcb_net(str_pair* name, pair_list* nodes) - { - int tl; - str_pair* done_node; - str_pair* node; - char* buf; - char* p; - LibraryEntryTypePtr entry; - LibraryMenuTypePtr menu = GetLibraryMenuMemory(&PCB->NetlistLib[NETLIST_INPUT], NULL); - - if ( !name->str1 ) - { - /* no net name given, stop now */ - /* if renamed str2 also exists and must be freed */ - if ( name->str2 ) free(name->str2); - free(name); - pair_list_free(nodes); - return; - } - menu->Name = pcb_strdup (name->str1); - free(name->str1); - /* if renamed str2 also exists and must be freed */ - if ( name->str2 ) free(name->str2); - free(name); - buf = (char *)malloc(256); - if ( !buf ) - { - /* no memory */ - pair_list_free(nodes); - return; - } - - node = nodes->list; - free(nodes->name); - free(nodes); - while ( node ) - { - /* check for node with no instance */ - if ( !node->str1 ) - { - /* toss it and move on */ - free(node->str2); - done_node = node; - node = node->next; - free(done_node); - continue; - } - tl = strlen(node->str1) + strlen(node->str2); - if ( tl + 3 > 256 ) - { - free(buf); - buf = (char *)malloc(tl+3); - if ( !buf ) - { - /* no memory */ - str_pair_free(node); - return; - } - } - strcpy(buf,node->str1); - /* make all upper case, because of PCB funky behaviour */ - p=buf; - while ( *p ) - { - *p = toupper( (int) *p); - p++; - } - /* add dash separating designator from node */ - *(buf+strlen(node->str1)) = '-'; - /* check for the edif number prefix */ - if ( node->str2[0] == '&' ) - { - /* skip number prefix */ - strcpy(buf+strlen(node->str1)+1,node->str2 +1); - } - else - { - strcpy(buf+strlen(node->str1)+1,node->str2); - } - /* free the strings */ - free(node->str1); - free(node->str2); - entry = GetLibraryEntryMemory (menu); - entry->ListEntry = pcb_strdup(buf); - done_node = node; - node = node->next; - free(done_node); - } - } - - -/* forward function declarations */ - static int yylex(void); - static void yyerror(const char *); - static void PopC(void); - -#line 269 "edif.tab.c" /* yacc.c:339 */ - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "edif.tab.h". */ -#ifndef YY_EDIF_EDIF_TAB_H_INCLUDED -# define YY_EDIF_EDIF_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int edifdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - EDIF_TOK_IDENT = 258, - EDIF_TOK_INT = 259, - EDIF_TOK_KEYWORD = 260, - EDIF_TOK_STR = 261, - EDIF_TOK_ANGLE = 262, - EDIF_TOK_BEHAVIOR = 263, - EDIF_TOK_CALCULATED = 264, - EDIF_TOK_CAPACITANCE = 265, - EDIF_TOK_CENTERCENTER = 266, - EDIF_TOK_CENTERLEFT = 267, - EDIF_TOK_CENTERRIGHT = 268, - EDIF_TOK_CHARGE = 269, - EDIF_TOK_CONDUCTANCE = 270, - EDIF_TOK_CURRENT = 271, - EDIF_TOK_DISTANCE = 272, - EDIF_TOK_DOCUMENT = 273, - EDIF_TOK_ENERGY = 274, - EDIF_TOK_EXTEND = 275, - EDIF_TOK_FLUX = 276, - EDIF_TOK_FREQUENCY = 277, - EDIF_TOK_GENERIC = 278, - EDIF_TOK_GRAPHIC = 279, - EDIF_TOK_INDUCTANCE = 280, - EDIF_TOK_INOUT = 281, - EDIF_TOK_INPUT = 282, - EDIF_TOK_LOGICMODEL = 283, - EDIF_TOK_LOWERCENTER = 284, - EDIF_TOK_LOWERLEFT = 285, - EDIF_TOK_LOWERRIGHT = 286, - EDIF_TOK_MASKLAYOUT = 287, - EDIF_TOK_MASS = 288, - EDIF_TOK_MEASURED = 289, - EDIF_TOK_MX = 290, - EDIF_TOK_MXR90 = 291, - EDIF_TOK_MY = 292, - EDIF_TOK_MYR90 = 293, - EDIF_TOK_NETLIST = 294, - EDIF_TOK_OUTPUT = 295, - EDIF_TOK_PCBLAYOUT = 296, - EDIF_TOK_POWER = 297, - EDIF_TOK_R0 = 298, - EDIF_TOK_R180 = 299, - EDIF_TOK_R270 = 300, - EDIF_TOK_R90 = 301, - EDIF_TOK_REQUIRED = 302, - EDIF_TOK_RESISTANCE = 303, - EDIF_TOK_RIPPER = 304, - EDIF_TOK_ROUND = 305, - EDIF_TOK_SCHEMATIC = 306, - EDIF_TOK_STRANGER = 307, - EDIF_TOK_SYMBOLIC = 308, - EDIF_TOK_TEMPERATURE = 309, - EDIF_TOK_TIE = 310, - EDIF_TOK_TIME = 311, - EDIF_TOK_TRUNCATE = 312, - EDIF_TOK_UPPERCENTER = 313, - EDIF_TOK_UPPERLEFT = 314, - EDIF_TOK_UPPERRIGHT = 315, - EDIF_TOK_VOLTAGE = 316, - EDIF_TOK_ACLOAD = 317, - EDIF_TOK_AFTER = 318, - EDIF_TOK_ANNOTATE = 319, - EDIF_TOK_APPLY = 320, - EDIF_TOK_ARC = 321, - EDIF_TOK_ARRAY = 322, - EDIF_TOK_ARRAYMACRO = 323, - EDIF_TOK_ARRAYRELATEDINFO = 324, - EDIF_TOK_ARRAYSITE = 325, - EDIF_TOK_ATLEAST = 326, - EDIF_TOK_ATMOST = 327, - EDIF_TOK_AUTHOR = 328, - EDIF_TOK_BASEARRAY = 329, - EDIF_TOK_BECOMES = 330, - EDIF_TOK_BETWEEN = 331, - EDIF_TOK_BOOLEAN = 332, - EDIF_TOK_BOOLEANDISPLAY = 333, - EDIF_TOK_BOOLEANMAP = 334, - EDIF_TOK_BORDERPATTERN = 335, - EDIF_TOK_BORDERWIDTH = 336, - EDIF_TOK_BOUNDINGBOX = 337, - EDIF_TOK_CELL = 338, - EDIF_TOK_CELLREF = 339, - EDIF_TOK_CELLTYPE = 340, - EDIF_TOK_CHANGE = 341, - EDIF_TOK_CIRCLE = 342, - EDIF_TOK_COLOR = 343, - EDIF_TOK_COMMENT = 344, - EDIF_TOK_COMMENTGRAPHICS = 345, - EDIF_TOK_COMPOUND = 346, - EDIF_TOK_CONNECTLOCATION = 347, - EDIF_TOK_CONTENTS = 348, - EDIF_TOK_CORNERTYPE = 349, - EDIF_TOK_CRITICALITY = 350, - EDIF_TOK_CURRENTMAP = 351, - EDIF_TOK_CURVE = 352, - EDIF_TOK_CYCLE = 353, - EDIF_TOK_DATAORIGIN = 354, - EDIF_TOK_DCFANINLOAD = 355, - EDIF_TOK_DCFANOUTLOAD = 356, - EDIF_TOK_DCMAXFANIN = 357, - EDIF_TOK_DCMAXFANOUT = 358, - EDIF_TOK_DELAY = 359, - EDIF_TOK_DELTA = 360, - EDIF_TOK_DERIVATION = 361, - EDIF_TOK_DESIGN = 362, - EDIF_TOK_DESIGNATOR = 363, - EDIF_TOK_DIFFERENCE = 364, - EDIF_TOK_DIRECTION = 365, - EDIF_TOK_DISPLAY = 366, - EDIF_TOK_DOMINATES = 367, - EDIF_TOK_DOT = 368, - EDIF_TOK_DURATION = 369, - EDIF_TOK_E = 370, - EDIF_TOK_EDIF = 371, - EDIF_TOK_EDIFLEVEL = 372, - EDIF_TOK_EDIFVERSION = 373, - EDIF_TOK_ENCLOSUREDISTANCE = 374, - EDIF_TOK_ENDTYPE = 375, - EDIF_TOK_ENTRY = 376, - EDIF_TOK_EVENT = 377, - EDIF_TOK_EXACTLY = 378, - EDIF_TOK_EXTERNAL = 379, - EDIF_TOK_FABRICATE = 380, - EDIF_TOK_FALSE = 381, - EDIF_TOK_FIGURE = 382, - EDIF_TOK_FIGUREAREA = 383, - EDIF_TOK_FIGUREGROUP = 384, - EDIF_TOK_FIGUREGROUPOBJECT = 385, - EDIF_TOK_FIGUREGROUPOVERRIDE = 386, - EDIF_TOK_FIGUREGROUPREF = 387, - EDIF_TOK_FIGUREPERIMETER = 388, - EDIF_TOK_FIGUREWIDTH = 389, - EDIF_TOK_FILLPATTERN = 390, - EDIF_TOK_FOLLOW = 391, - EDIF_TOK_FORBIDDENEVENT = 392, - EDIF_TOK_GLOBALPORTREF = 393, - EDIF_TOK_GREATERTHAN = 394, - EDIF_TOK_GRIDMAP = 395, - EDIF_TOK_IGNORE = 396, - EDIF_TOK_INCLUDEFIGUREGROUP = 397, - EDIF_TOK_INITIAL = 398, - EDIF_TOK_INSTANCE = 399, - EDIF_TOK_INSTANCEBACKANNOTATE = 400, - EDIF_TOK_INSTANCEGROUP = 401, - EDIF_TOK_INSTANCEMAP = 402, - EDIF_TOK_INSTANCEREF = 403, - EDIF_TOK_INTEGER = 404, - EDIF_TOK_INTEGERDISPLAY = 405, - EDIF_TOK_INTERFACE = 406, - EDIF_TOK_INTERFIGUREGROUPSPACING = 407, - EDIF_TOK_INTERSECTION = 408, - EDIF_TOK_INTRAFIGUREGROUPSPACING = 409, - EDIF_TOK_INVERSE = 410, - EDIF_TOK_ISOLATED = 411, - EDIF_TOK_JOINED = 412, - EDIF_TOK_JUSTIFY = 413, - EDIF_TOK_KEYWORDDISPLAY = 414, - EDIF_TOK_KEYWORDLEVEL = 415, - EDIF_TOK_KEYWORDMAP = 416, - EDIF_TOK_LESSTHAN = 417, - EDIF_TOK_LIBRARY = 418, - EDIF_TOK_LIBRARYREF = 419, - EDIF_TOK_LISTOFNETS = 420, - EDIF_TOK_LISTOFPORTS = 421, - EDIF_TOK_LOADDELAY = 422, - EDIF_TOK_LOGICASSIGN = 423, - EDIF_TOK_LOGICINPUT = 424, - EDIF_TOK_LOGICLIST = 425, - EDIF_TOK_LOGICMAPINPUT = 426, - EDIF_TOK_LOGICMAPOUTPUT = 427, - EDIF_TOK_LOGICONEOF = 428, - EDIF_TOK_LOGICOUTPUT = 429, - EDIF_TOK_LOGICPORT = 430, - EDIF_TOK_LOGICREF = 431, - EDIF_TOK_LOGICVALUE = 432, - EDIF_TOK_LOGICWAVEFORM = 433, - EDIF_TOK_MAINTAIN = 434, - EDIF_TOK_MATCH = 435, - EDIF_TOK_MEMBER = 436, - EDIF_TOK_MINOMAX = 437, - EDIF_TOK_MINOMAXDISPLAY = 438, - EDIF_TOK_MNM = 439, - EDIF_TOK_MULTIPLEVALUESET = 440, - EDIF_TOK_MUSTJOIN = 441, - EDIF_TOK_NAME = 442, - EDIF_TOK_NET = 443, - EDIF_TOK_NETBACKANNOTATE = 444, - EDIF_TOK_NETBUNDLE = 445, - EDIF_TOK_NETDELAY = 446, - EDIF_TOK_NETGROUP = 447, - EDIF_TOK_NETMAP = 448, - EDIF_TOK_NETREF = 449, - EDIF_TOK_NOCHANGE = 450, - EDIF_TOK_NONPERMUTABLE = 451, - EDIF_TOK_NOTALLOWED = 452, - EDIF_TOK_NOTCHSPACING = 453, - EDIF_TOK_NUMBER = 454, - EDIF_TOK_NUMBERDEFINITION = 455, - EDIF_TOK_NUMBERDISPLAY = 456, - EDIF_TOK_OFFPAGECONNECTOR = 457, - EDIF_TOK_OFFSETEVENT = 458, - EDIF_TOK_OPENSHAPE = 459, - EDIF_TOK_ORIENTATION = 460, - EDIF_TOK_ORIGIN = 461, - EDIF_TOK_OVERHANGDISTANCE = 462, - EDIF_TOK_OVERLAPDISTANCE = 463, - EDIF_TOK_OVERSIZE = 464, - EDIF_TOK_OWNER = 465, - EDIF_TOK_PAGE = 466, - EDIF_TOK_PAGESIZE = 467, - EDIF_TOK_PARAMETER = 468, - EDIF_TOK_PARAMETERASSIGN = 469, - EDIF_TOK_PARAMETERDISPLAY = 470, - EDIF_TOK_PATH = 471, - EDIF_TOK_PATHDELAY = 472, - EDIF_TOK_PATHWIDTH = 473, - EDIF_TOK_PERMUTABLE = 474, - EDIF_TOK_PHYSICALDESIGNRULE = 475, - EDIF_TOK_PLUG = 476, - EDIF_TOK_POINT = 477, - EDIF_TOK_POINTDISPLAY = 478, - EDIF_TOK_POINTLIST = 479, - EDIF_TOK_POLYGON = 480, - EDIF_TOK_PORT = 481, - EDIF_TOK_PORTBACKANNOTATE = 482, - EDIF_TOK_PORTBUNDLE = 483, - EDIF_TOK_PORTDELAY = 484, - EDIF_TOK_PORTGROUP = 485, - EDIF_TOK_PORTIMPLEMENTATION = 486, - EDIF_TOK_PORTINSTANCE = 487, - EDIF_TOK_PORTLIST = 488, - EDIF_TOK_PORTLISTALIAS = 489, - EDIF_TOK_PORTMAP = 490, - EDIF_TOK_PORTREF = 491, - EDIF_TOK_PROGRAM = 492, - EDIF_TOK_PROPERTY = 493, - EDIF_TOK_PROPERTYDISPLAY = 494, - EDIF_TOK_PROTECTIONFRAME = 495, - EDIF_TOK_PT = 496, - EDIF_TOK_RANGEVECTOR = 497, - EDIF_TOK_RECTANGLE = 498, - EDIF_TOK_RECTANGLESIZE = 499, - EDIF_TOK_RENAME = 500, - EDIF_TOK_RESOLVES = 501, - EDIF_TOK_SCALE = 502, - EDIF_TOK_SCALEX = 503, - EDIF_TOK_SCALEY = 504, - EDIF_TOK_SECTION = 505, - EDIF_TOK_SHAPE = 506, - EDIF_TOK_SIMULATE = 507, - EDIF_TOK_SIMULATIONINFO = 508, - EDIF_TOK_SINGLEVALUESET = 509, - EDIF_TOK_SITE = 510, - EDIF_TOK_SOCKET = 511, - EDIF_TOK_SOCKETSET = 512, - EDIF_TOK_STATUS = 513, - EDIF_TOK_STEADY = 514, - EDIF_TOK_STRING = 515, - EDIF_TOK_STRINGDISPLAY = 516, - EDIF_TOK_STRONG = 517, - EDIF_TOK_SYMBOL = 518, - EDIF_TOK_SYMMETRY = 519, - EDIF_TOK_TABLE = 520, - EDIF_TOK_TABLEDEFAULT = 521, - EDIF_TOK_TECHNOLOGY = 522, - EDIF_TOK_TEXTHEIGHT = 523, - EDIF_TOK_TIMEINTERVAL = 524, - EDIF_TOK_TIMESTAMP = 525, - EDIF_TOK_TIMING = 526, - EDIF_TOK_TRANSFORM = 527, - EDIF_TOK_TRANSITION = 528, - EDIF_TOK_TRIGGER = 529, - EDIF_TOK_TRUE = 530, - EDIF_TOK_UNCONSTRAINED = 531, - EDIF_TOK_UNDEFINED = 532, - EDIF_TOK_UNION = 533, - EDIF_TOK_UNIT = 534, - EDIF_TOK_UNUSED = 535, - EDIF_TOK_USERDATA = 536, - EDIF_TOK_VERSION = 537, - EDIF_TOK_VIEW = 538, - EDIF_TOK_VIEWLIST = 539, - EDIF_TOK_VIEWMAP = 540, - EDIF_TOK_VIEWREF = 541, - EDIF_TOK_VIEWTYPE = 542, - EDIF_TOK_VISIBLE = 543, - EDIF_TOK_VOLTAGEMAP = 544, - EDIF_TOK_WAVEVALUE = 545, - EDIF_TOK_WEAK = 546, - EDIF_TOK_WEAKJOINED = 547, - EDIF_TOK_WHEN = 548, - EDIF_TOK_WRITTEN = 549 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 198 "../../src_plugins/import_edif/edif.y" /* yacc.c:355 */ - - char* s; - pair_list* pl; - str_pair* ps; - -#line 610 "edif.tab.c" /* yacc.c:355 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE ediflval; - -int edifparse (void); - -#endif /* !YY_EDIF_EDIF_TAB_H_INCLUDED */ - -/* Copy the second part of user declarations. */ - -#line 625 "edif.tab.c" /* yacc.c:358 */ - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 11 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2619 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 296 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 472 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 1129 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 1626 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 549 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint16 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 295, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 510, 510, 513, 516, 517, 518, 519, 520, 521, - 522, 525, 528, 531, 535, 538, 539, 542, 545, 546, - 547, 548, 549, 550, 553, 556, 557, 560, 563, 564, - 565, 566, 567, 570, 573, 576, 577, 580, 583, 586, - 587, 588, 589, 590, 593, 596, 599, 602, 605, 608, - 611, 612, 613, 616, 619, 620, 623, 624, 627, 630, - 631, 632, 633, 636, 639, 640, 643, 646, 647, 650, - 653, 656, 659, 662, 663, 664, 665, 666, 667, 668, - 671, 674, 677, 678, 681, 684, 687, 688, 689, 692, - 695, 696, 697, 700, 701, 702, 705, 708, 709, 712, - 715, 718, 719, 722, 725, 726, 727, 728, 729, 730, - 731, 732, 735, 738, 741, 742, 743, 744, 745, 746, - 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, - 757, 758, 761, 764, 765, 768, 771, 772, 773, 776, - 779, 780, 783, 786, 789, 790, 791, 794, 797, 798, - 801, 804, 805, 808, 811, 812, 815, 818, 819, 822, - 825, 826, 829, 832, 833, 836, 839, 840, 843, 846, - 847, 850, 853, 854, 855, 858, 861, 862, 863, 864, - 865, 868, 871, 872, 875, 878, 881, 882, 883, 884, - 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, - 895, 898, 901, 902, 903, 904, 907, 910, 911, 912, - 915, 918, 919, 922, 923, 926, 927, 930, 931, 934, - 937, 938, 941, 944, 945, 948, 951, 955, 956, 957, - 958, 961, 964, 965, 966, 969, 973, 974, 975, 978, - 979, 980, 981, 984, 985, 986, 989, 992, 993, 994, - 995, 996, 997, 998, 1001, 1004, 1007, 1008, 1009, 1010, - 1011, 1014, 1017, 1020, 1023, 1024, 1025, 1026, 1027, 1028, - 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1039, 1042, - 1045, 1048, 1049, 1050, 1053, 1056, 1057, 1058, 1059, 1060, - 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1074, - 1075, 1078, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, - 1089, 1090, 1091, 1094, 1097, 1098, 1099, 1100, 1103, 1104, - 1105, 1106, 1107, 1110, 1113, 1114, 1115, 1116, 1119, 1122, - 1123, 1124, 1125, 1128, 1131, 1134, 1135, 1138, 1139, 1140, - 1141, 1144, 1147, 1148, 1151, 1154, 1155, 1156, 1157, 1158, - 1161, 1164, 1167, 1170, 1173, 1176, 1177, 1180, 1183, 1186, - 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1198, - 1201, 1202, 1203, 1206, 1209, 1210, 1211, 1212, 1213, 1216, - 1219, 1220, 1223, 1226, 1227, 1228, 1229, 1230, 1233, 1234, - 1237, 1238, 1241, 1244, 1245, 1248, 1251, 1252, 1253, 1254, - 1257, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, - 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1279, 1283, - 1284, 1285, 1286, 1289, 1292, 1293, 1294, 1295, 1298, 1301, - 1302, 1303, 1304, 1307, 1310, 1311, 1314, 1317, 1320, 1321, - 1322, 1323, 1326, 1329, 1330, 1331, 1332, 1333, 1334, 1335, - 1336, 1337, 1340, 1343, 1344, 1347, 1350, 1353, 1354, 1357, - 1360, 1363, 1366, 1369, 1372, 1375, 1376, 1377, 1378, 1379, - 1382, 1385, 1388, 1389, 1392, 1395, 1396, 1397, 1400, 1403, - 1404, 1407, 1410, 1411, 1414, 1415, 1416, 1419, 1420, 1421, - 1424, 1427, 1428, 1429, 1430, 1433, 1436, 1437, 1438, 1439, - 1442, 1445, 1446, 1449, 1452, 1453, 1456, 1459, 1462, 1465, - 1466, 1467, 1470, 1473, 1474, 1475, 1476, 1479, 1482, 1483, - 1484, 1485, 1488, 1491, 1492, 1495, 1498, 1499, 1500, 1501, - 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, - 1512, 1515, 1518, 1519, 1520, 1521, 1522, 1525, 1528, 1529, - 1532, 1533, 1534, 1537, 1540, 1541, 1542, 1545, 1546, 1547, - 1550, 1553, 1554, 1557, 1560, 1561, 1562, 1563, 1566, 1569, - 1570, 1573, 1574, 1577, 1580, 1581, 1582, 1585, 1588, 1589, - 1592, 1595, 1596, 1597, 1598, 1599, 1602, 1605, 1606, 1609, - 1610, 1611, 1614, 1615, 1618, 1621, 1622, 1623, 1624, 1625, - 1626, 1627, 1628, 1629, 1630, 1633, 1636, 1637, 1638, 1639, - 1640, 1643, 1646, 1647, 1648, 1649, 1650, 1651, 1654, 1657, - 1658, 1659, 1662, 1665, 1666, 1667, 1670, 1673, 1674, 1675, - 1676, 1677, 1680, 1681, 1685, 1686, 1689, 1692, 1693, 1694, - 1695, 1698, 1701, 1704, 1705, 1706, 1709, 1712, 1713, 1714, - 1717, 1720, 1721, 1722, 1723, 1726, 1729, 1730, 1731, 1732, - 1735, 1738, 1739, 1742, 1745, 1746, 1747, 1748, 1751, 1754, - 1755, 1756, 1757, 1758, 1761, 1764, 1767, 1768, 1771, 1774, - 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1784, 1787, 1791, - 1792, 1793, 1794, 1797, 1801, 1802, 1803, 1804, 1807, 1810, - 1811, 1814, 1817, 1820, 1821, 1822, 1823, 1824, 1825, 1826, - 1827, 1828, 1829, 1832, 1835, 1838, 1839, 1842, 1845, 1846, - 1849, 1852, 1855, 1856, 1859, 1862, 1863, 1866, 1869, 1872, - 1873, 1874, 1875, 1878, 1881, 1882, 1885, 1888, 1889, 1890, - 1891, 1894, 1897, 1898, 1901, 1904, 1905, 1908, 1911, 1914, - 1915, 1918, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, - 1929, 1930, 1931, 1932, 1933, 1936, 1939, 1940, 1941, 1942, - 1943, 1944, 1945, 1946, 1947, 1948, 1951, 1954, 1955, 1956, - 1957, 1960, 1963, 1964, 1965, 1966, 1969, 1972, 1973, 1974, - 1977, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, - 1989, 1990, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2014, 2015, 2016, - 2019, 2022, 2025, 2026, 2027, 2028, 2029, 2032, 2033, 2036, - 2037, 2040, 2055, 2056, 2057, 2058, 2061, 2064, 2065, 2068, - 2071, 2072, 2075, 2078, 2079, 2080, 2081, 2082, 2085, 2088, - 2091, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, - 2103, 2104, 2105, 2108, 2109, 2110, 2111, 2112, 2113, 2116, - 2119, 2120, 2121, 2124, 2127, 2128, 2131, 2134, 2135, 2136, - 2137, 2140, 2144, 2145, 2148, 2149, 2152, 2155, 2156, 2159, - 2162, 2165, 2166, 2169, 2172, 2175, 2178, 2179, 2180, 2181, - 2184, 2187, 2188, 2191, 2194, 2197, 2198, 2199, 2200, 2201, - 2202, 2205, 2208, 2209, 2210, 2211, 2214, 2217, 2218, 2221, - 2224, 2225, 2228, 2231, 2232, 2235, 2238, 2239, 2242, 2245, - 2246, 2247, 2248, 2251, 2254, 2255, 2256, 2259, 2260, 2261, - 2264, 2267, 2270, 2271, 2272, 2273, 2276, 2277, 2280, 2283, - 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, - 2296, 2297, 2298, 2299, 2302, 2305, 2306, 2309, 2312, 2313, - 2314, 2317, 2320, 2321, 2322, 2323, 2326, 2327, 2328, 2331, - 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2343, 2346, 2349, - 2350, 2353, 2354, 2355, 2358, 2362, 2365, 2366, 2367, 2368, - 2369, 2372, 2376, 2377, 2380, 2381, 2384, 2385, 2388, 2389, - 2392, 2393, 2396, 2399, 2400, 2401, 2404, 2407, 2408, 2409, - 2410, 2413, 2416, 2417, 2418, 2419, 2420, 2421, 2424, 2427, - 2430, 2433, 2434, 2435, 2436, 2439, 2442, 2443, 2444, 2445, - 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, - 2456, 2457, 2460, 2463, 2466, 2467, 2468, 2469, 2470, 2473, - 2474, 2477, 2478, 2481, 2484, 2487, 2488, 2489, 2490, 2491, - 2492, 2495, 2498, 2499, 2500, 2503, 2506, 2507, 2508, 2509, - 2510, 2511, 2512, 2513, 2514, 2517, 2520, 2523, 2526, 2527, - 2530, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, - 2542, 2545, 2548, 2551, 2554, 2557, 2560, 2561, 2562, 2563, - 2566, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2578, 2581, - 2582, 2583, 2584, 2585, 2586, 2587, 2590, 2593, 2596, 2599 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "EDIF_TOK_IDENT", "EDIF_TOK_INT", - "EDIF_TOK_KEYWORD", "EDIF_TOK_STR", "EDIF_TOK_ANGLE", - "EDIF_TOK_BEHAVIOR", "EDIF_TOK_CALCULATED", "EDIF_TOK_CAPACITANCE", - "EDIF_TOK_CENTERCENTER", "EDIF_TOK_CENTERLEFT", "EDIF_TOK_CENTERRIGHT", - "EDIF_TOK_CHARGE", "EDIF_TOK_CONDUCTANCE", "EDIF_TOK_CURRENT", - "EDIF_TOK_DISTANCE", "EDIF_TOK_DOCUMENT", "EDIF_TOK_ENERGY", - "EDIF_TOK_EXTEND", "EDIF_TOK_FLUX", "EDIF_TOK_FREQUENCY", - "EDIF_TOK_GENERIC", "EDIF_TOK_GRAPHIC", "EDIF_TOK_INDUCTANCE", - "EDIF_TOK_INOUT", "EDIF_TOK_INPUT", "EDIF_TOK_LOGICMODEL", - "EDIF_TOK_LOWERCENTER", "EDIF_TOK_LOWERLEFT", "EDIF_TOK_LOWERRIGHT", - "EDIF_TOK_MASKLAYOUT", "EDIF_TOK_MASS", "EDIF_TOK_MEASURED", - "EDIF_TOK_MX", "EDIF_TOK_MXR90", "EDIF_TOK_MY", "EDIF_TOK_MYR90", - "EDIF_TOK_NETLIST", "EDIF_TOK_OUTPUT", "EDIF_TOK_PCBLAYOUT", - "EDIF_TOK_POWER", "EDIF_TOK_R0", "EDIF_TOK_R180", "EDIF_TOK_R270", - "EDIF_TOK_R90", "EDIF_TOK_REQUIRED", "EDIF_TOK_RESISTANCE", - "EDIF_TOK_RIPPER", "EDIF_TOK_ROUND", "EDIF_TOK_SCHEMATIC", - "EDIF_TOK_STRANGER", "EDIF_TOK_SYMBOLIC", "EDIF_TOK_TEMPERATURE", - "EDIF_TOK_TIE", "EDIF_TOK_TIME", "EDIF_TOK_TRUNCATE", - "EDIF_TOK_UPPERCENTER", "EDIF_TOK_UPPERLEFT", "EDIF_TOK_UPPERRIGHT", - "EDIF_TOK_VOLTAGE", "EDIF_TOK_ACLOAD", "EDIF_TOK_AFTER", - "EDIF_TOK_ANNOTATE", "EDIF_TOK_APPLY", "EDIF_TOK_ARC", "EDIF_TOK_ARRAY", - "EDIF_TOK_ARRAYMACRO", "EDIF_TOK_ARRAYRELATEDINFO", "EDIF_TOK_ARRAYSITE", - "EDIF_TOK_ATLEAST", "EDIF_TOK_ATMOST", "EDIF_TOK_AUTHOR", - "EDIF_TOK_BASEARRAY", "EDIF_TOK_BECOMES", "EDIF_TOK_BETWEEN", - "EDIF_TOK_BOOLEAN", "EDIF_TOK_BOOLEANDISPLAY", "EDIF_TOK_BOOLEANMAP", - "EDIF_TOK_BORDERPATTERN", "EDIF_TOK_BORDERWIDTH", "EDIF_TOK_BOUNDINGBOX", - "EDIF_TOK_CELL", "EDIF_TOK_CELLREF", "EDIF_TOK_CELLTYPE", - "EDIF_TOK_CHANGE", "EDIF_TOK_CIRCLE", "EDIF_TOK_COLOR", - "EDIF_TOK_COMMENT", "EDIF_TOK_COMMENTGRAPHICS", "EDIF_TOK_COMPOUND", - "EDIF_TOK_CONNECTLOCATION", "EDIF_TOK_CONTENTS", "EDIF_TOK_CORNERTYPE", - "EDIF_TOK_CRITICALITY", "EDIF_TOK_CURRENTMAP", "EDIF_TOK_CURVE", - "EDIF_TOK_CYCLE", "EDIF_TOK_DATAORIGIN", "EDIF_TOK_DCFANINLOAD", - "EDIF_TOK_DCFANOUTLOAD", "EDIF_TOK_DCMAXFANIN", "EDIF_TOK_DCMAXFANOUT", - "EDIF_TOK_DELAY", "EDIF_TOK_DELTA", "EDIF_TOK_DERIVATION", - "EDIF_TOK_DESIGN", "EDIF_TOK_DESIGNATOR", "EDIF_TOK_DIFFERENCE", - "EDIF_TOK_DIRECTION", "EDIF_TOK_DISPLAY", "EDIF_TOK_DOMINATES", - "EDIF_TOK_DOT", "EDIF_TOK_DURATION", "EDIF_TOK_E", "EDIF_TOK_EDIF", - "EDIF_TOK_EDIFLEVEL", "EDIF_TOK_EDIFVERSION", - "EDIF_TOK_ENCLOSUREDISTANCE", "EDIF_TOK_ENDTYPE", "EDIF_TOK_ENTRY", - "EDIF_TOK_EVENT", "EDIF_TOK_EXACTLY", "EDIF_TOK_EXTERNAL", - "EDIF_TOK_FABRICATE", "EDIF_TOK_FALSE", "EDIF_TOK_FIGURE", - "EDIF_TOK_FIGUREAREA", "EDIF_TOK_FIGUREGROUP", - "EDIF_TOK_FIGUREGROUPOBJECT", "EDIF_TOK_FIGUREGROUPOVERRIDE", - "EDIF_TOK_FIGUREGROUPREF", "EDIF_TOK_FIGUREPERIMETER", - "EDIF_TOK_FIGUREWIDTH", "EDIF_TOK_FILLPATTERN", "EDIF_TOK_FOLLOW", - "EDIF_TOK_FORBIDDENEVENT", "EDIF_TOK_GLOBALPORTREF", - "EDIF_TOK_GREATERTHAN", "EDIF_TOK_GRIDMAP", "EDIF_TOK_IGNORE", - "EDIF_TOK_INCLUDEFIGUREGROUP", "EDIF_TOK_INITIAL", "EDIF_TOK_INSTANCE", - "EDIF_TOK_INSTANCEBACKANNOTATE", "EDIF_TOK_INSTANCEGROUP", - "EDIF_TOK_INSTANCEMAP", "EDIF_TOK_INSTANCEREF", "EDIF_TOK_INTEGER", - "EDIF_TOK_INTEGERDISPLAY", "EDIF_TOK_INTERFACE", - "EDIF_TOK_INTERFIGUREGROUPSPACING", "EDIF_TOK_INTERSECTION", - "EDIF_TOK_INTRAFIGUREGROUPSPACING", "EDIF_TOK_INVERSE", - "EDIF_TOK_ISOLATED", "EDIF_TOK_JOINED", "EDIF_TOK_JUSTIFY", - "EDIF_TOK_KEYWORDDISPLAY", "EDIF_TOK_KEYWORDLEVEL", - "EDIF_TOK_KEYWORDMAP", "EDIF_TOK_LESSTHAN", "EDIF_TOK_LIBRARY", - "EDIF_TOK_LIBRARYREF", "EDIF_TOK_LISTOFNETS", "EDIF_TOK_LISTOFPORTS", - "EDIF_TOK_LOADDELAY", "EDIF_TOK_LOGICASSIGN", "EDIF_TOK_LOGICINPUT", - "EDIF_TOK_LOGICLIST", "EDIF_TOK_LOGICMAPINPUT", - "EDIF_TOK_LOGICMAPOUTPUT", "EDIF_TOK_LOGICONEOF", "EDIF_TOK_LOGICOUTPUT", - "EDIF_TOK_LOGICPORT", "EDIF_TOK_LOGICREF", "EDIF_TOK_LOGICVALUE", - "EDIF_TOK_LOGICWAVEFORM", "EDIF_TOK_MAINTAIN", "EDIF_TOK_MATCH", - "EDIF_TOK_MEMBER", "EDIF_TOK_MINOMAX", "EDIF_TOK_MINOMAXDISPLAY", - "EDIF_TOK_MNM", "EDIF_TOK_MULTIPLEVALUESET", "EDIF_TOK_MUSTJOIN", - "EDIF_TOK_NAME", "EDIF_TOK_NET", "EDIF_TOK_NETBACKANNOTATE", - "EDIF_TOK_NETBUNDLE", "EDIF_TOK_NETDELAY", "EDIF_TOK_NETGROUP", - "EDIF_TOK_NETMAP", "EDIF_TOK_NETREF", "EDIF_TOK_NOCHANGE", - "EDIF_TOK_NONPERMUTABLE", "EDIF_TOK_NOTALLOWED", "EDIF_TOK_NOTCHSPACING", - "EDIF_TOK_NUMBER", "EDIF_TOK_NUMBERDEFINITION", "EDIF_TOK_NUMBERDISPLAY", - "EDIF_TOK_OFFPAGECONNECTOR", "EDIF_TOK_OFFSETEVENT", - "EDIF_TOK_OPENSHAPE", "EDIF_TOK_ORIENTATION", "EDIF_TOK_ORIGIN", - "EDIF_TOK_OVERHANGDISTANCE", "EDIF_TOK_OVERLAPDISTANCE", - "EDIF_TOK_OVERSIZE", "EDIF_TOK_OWNER", "EDIF_TOK_PAGE", - "EDIF_TOK_PAGESIZE", "EDIF_TOK_PARAMETER", "EDIF_TOK_PARAMETERASSIGN", - "EDIF_TOK_PARAMETERDISPLAY", "EDIF_TOK_PATH", "EDIF_TOK_PATHDELAY", - "EDIF_TOK_PATHWIDTH", "EDIF_TOK_PERMUTABLE", - "EDIF_TOK_PHYSICALDESIGNRULE", "EDIF_TOK_PLUG", "EDIF_TOK_POINT", - "EDIF_TOK_POINTDISPLAY", "EDIF_TOK_POINTLIST", "EDIF_TOK_POLYGON", - "EDIF_TOK_PORT", "EDIF_TOK_PORTBACKANNOTATE", "EDIF_TOK_PORTBUNDLE", - "EDIF_TOK_PORTDELAY", "EDIF_TOK_PORTGROUP", - "EDIF_TOK_PORTIMPLEMENTATION", "EDIF_TOK_PORTINSTANCE", - "EDIF_TOK_PORTLIST", "EDIF_TOK_PORTLISTALIAS", "EDIF_TOK_PORTMAP", - "EDIF_TOK_PORTREF", "EDIF_TOK_PROGRAM", "EDIF_TOK_PROPERTY", - "EDIF_TOK_PROPERTYDISPLAY", "EDIF_TOK_PROTECTIONFRAME", "EDIF_TOK_PT", - "EDIF_TOK_RANGEVECTOR", "EDIF_TOK_RECTANGLE", "EDIF_TOK_RECTANGLESIZE", - "EDIF_TOK_RENAME", "EDIF_TOK_RESOLVES", "EDIF_TOK_SCALE", - "EDIF_TOK_SCALEX", "EDIF_TOK_SCALEY", "EDIF_TOK_SECTION", - "EDIF_TOK_SHAPE", "EDIF_TOK_SIMULATE", "EDIF_TOK_SIMULATIONINFO", - "EDIF_TOK_SINGLEVALUESET", "EDIF_TOK_SITE", "EDIF_TOK_SOCKET", - "EDIF_TOK_SOCKETSET", "EDIF_TOK_STATUS", "EDIF_TOK_STEADY", - "EDIF_TOK_STRING", "EDIF_TOK_STRINGDISPLAY", "EDIF_TOK_STRONG", - "EDIF_TOK_SYMBOL", "EDIF_TOK_SYMMETRY", "EDIF_TOK_TABLE", - "EDIF_TOK_TABLEDEFAULT", "EDIF_TOK_TECHNOLOGY", "EDIF_TOK_TEXTHEIGHT", - "EDIF_TOK_TIMEINTERVAL", "EDIF_TOK_TIMESTAMP", "EDIF_TOK_TIMING", - "EDIF_TOK_TRANSFORM", "EDIF_TOK_TRANSITION", "EDIF_TOK_TRIGGER", - "EDIF_TOK_TRUE", "EDIF_TOK_UNCONSTRAINED", "EDIF_TOK_UNDEFINED", - "EDIF_TOK_UNION", "EDIF_TOK_UNIT", "EDIF_TOK_UNUSED", - "EDIF_TOK_USERDATA", "EDIF_TOK_VERSION", "EDIF_TOK_VIEW", - "EDIF_TOK_VIEWLIST", "EDIF_TOK_VIEWMAP", "EDIF_TOK_VIEWREF", - "EDIF_TOK_VIEWTYPE", "EDIF_TOK_VISIBLE", "EDIF_TOK_VOLTAGEMAP", - "EDIF_TOK_WAVEVALUE", "EDIF_TOK_WEAK", "EDIF_TOK_WEAKJOINED", - "EDIF_TOK_WHEN", "EDIF_TOK_WRITTEN", "')'", "$accept", "PopC", "Edif", - "_Edif", "EdifFileName", "EdifLevel", "EdifVersion", "AcLoad", "_AcLoad", - "After", "_After", "Annotate", "_Annotate", "Apply", "_Apply", "Arc", - "Array", "_Array", "ArrayMacro", "ArrayRelInfo", "_ArrayRelInfo", - "ArraySite", "AtLeast", "AtMost", "Author", "BaseArray", "Becomes", - "_Becomes", "Between", "__Between", "_Between", "Boolean", "_Boolean", - "BooleanDisp", "_BooleanDisp", "BooleanMap", "BooleanValue", "BorderPat", - "BorderWidth", "BoundBox", "Cell", "_Cell", "CellNameDef", "CellRef", - "_CellRef", "CellNameRef", "CellType", "_CellType", "Change", "__Change", - "_Change", "Circle", "_Circle", "Color", "Comment", "_Comment", - "CommGraph", "_CommGraph", "Compound", "Contents", "_Contents", - "ConnectLoc", "_ConnectLoc", "CornerType", "_CornerType", "Criticality", - "_Criticality", "CurrentMap", "Curve", "_Curve", "Cycle", "_Cycle", - "DataOrigin", "_DataOrigin", "DcFanInLoad", "_DcFanInLoad", - "DcFanOutLoad", "_DcFanOutLoad", "DcMaxFanIn", "_DcMaxFanIn", - "DcMaxFanOut", "_DcMaxFanOut", "Delay", "_Delay", "Delta", "_Delta", - "Derivation", "_Derivation", "Design", "_Design", "Designator", - "_Designator", "DesignNameDef", "DesignRule", "_DesignRule", - "Difference", "_Difference", "Direction", "_Direction", "Display", - "_Display", "_DisplayJust", "_DisplayOrien", "_DisplayOrg", "Dominates", - "_Dominates", "Dot", "_Dot", "Duration", "EncloseDist", "_EncloseDist", - "EndType", "_EndType", "Entry", "___Entry", "__Entry", "_Entry", "Event", - "_Event", "Exactly", "External", "_External", "Fabricate", "False", - "FigGrp", "_FigGrp", "FigGrpNameDef", "FigGrpNameRef", "FigGrpObj", - "_FigGrpObj", "FigGrpOver", "_FigGrpOver", "FigGrpRef", "_FigGrpRef", - "Figure", "_Figure", "FigureArea", "_FigureArea", "FigureOp", - "FigurePerim", "_FigurePerim", "FigureWidth", "_FigureWidth", - "FillPattern", "Follow", "__Follow", "_Follow", "Forbidden", - "_Forbidden", "Form", "_Form", "GlobPortRef", "GreaterThan", "GridMap", - "Ignore", "IncFigGrp", "_IncFigGrp", "Initial", "Instance", "_Instance", - "InstanceRef", "_InstanceRef", "InstBackAn", "_InstBackAn", "InstGroup", - "_InstGroup", "InstMap", "_InstMap", "InstNameDef", "InstNameRef", - "IntDisplay", "_IntDisplay", "Integer", "_Integer", "Interface", - "_Interface", "InterFigGrp", "_InterFigGrp", "Intersection", - "_Intersection", "IntraFigGrp", "_IntraFigGrp", "Inverse", "_Inverse", - "Isolated", "Joined", "_Joined", "Justify", "_Justify", "KeywordDisp", - "_KeywordDisp", "KeywordLevel", "KeywordMap", "_KeywordMap", - "KeywordName", "LayerNameDef", "LessThan", "LibNameDef", "LibNameRef", - "Library", "_Library", "LibraryRef", "ListOfNets", "_ListOfNets", - "ListOfPorts", "_ListOfPorts", "LoadDelay", "_LoadDelay", "LogicAssn", - "___LogicAssn", "__LogicAssn", "_LogicAssn", "LogicIn", "_LogicIn", - "LogicList", "_LogicList", "LogicMapIn", "_LogicMapIn", "LogicMapOut", - "_LogicMapOut", "LogicNameDef", "LogicNameRef", "LogicOneOf", - "_LogicOneOf", "LogicOut", "_LogicOut", "LogicPort", "_LogicPort", - "LogicRef", "_LogicRef", "LogicValue", "_LogicValue", "LogicWave", - "_LogicWave", "Maintain", "__Maintain", "_Maintain", "Match", "__Match", - "_Match", "Member", "_Member", "MiNoMa", "_MiNoMa", "MiNoMaDisp", - "_MiNoMaDisp", "MiNoMaValue", "Mnm", "_Mnm", "MultValSet", "_MultValSet", - "MustJoin", "_MustJoin", "Name", "_Name", "NameDef", "NameRef", "Net", - "_Net", "NetBackAn", "_NetBackAn", "NetBundle", "_NetBundle", "NetDelay", - "_NetDelay", "NetGroup", "_NetGroup", "NetMap", "_NetMap", "NetNameDef", - "NetNameRef", "NetRef", "_NetRef", "NoChange", "NonPermut", "_NonPermut", - "NotAllowed", "_NotAllowed", "NotchSpace", "_NotchSpace", "Number", - "_Number", "NumbDisplay", "_NumbDisplay", "NumberDefn", "_NumberDefn", - "OffPageConn", "_OffPageConn", "OffsetEvent", "OpenShape", "_OpenShape", - "Orientation", "_Orientation", "Origin", "OverhngDist", "_OverhngDist", - "OverlapDist", "_OverlapDist", "Oversize", "_Oversize", "Owner", "Page", - "_Page", "PageSize", "ParamDisp", "_ParamDisp", "Parameter", - "_Parameter", "ParamAssign", "Path", "_Path", "PathDelay", "_PathDelay", - "PathWidth", "Permutable", "_Permutable", "Plug", "_Plug", "Point", - "_Point", "PointDisp", "_PointDisp", "PointList", "_PointList", - "PointValue", "Polygon", "_Polygon", "Port", "_Port", "PortBackAn", - "_PortBackAn", "PortBundle", "_PortBundle", "PortDelay", "_PortDelay", - "PortGroup", "_PortGroup", "PortImpl", "_PortImpl", "PortInst", - "_PortInst", "PortList", "_PortList", "PortListAls", "PortMap", - "_PortMap", "PortNameDef", "PortNameRef", "PortRef", "_PortRef", - "Program", "_Program", "PropDisplay", "_PropDisplay", "Property", - "_Property", "PropNameDef", "PropNameRef", "ProtectFrame", - "_ProtectFrame", "Range", "RangeVector", "_RangeVector", "Rectangle", - "_Rectangle", "RectSize", "_RectSize", "Rename", "__Rename", "_Rename", - "Resolves", "_Resolves", "RuleNameDef", "Scale", "ScaledInt", "ScaleX", - "ScaleY", "Section", "_Section", "Shape", "_Shape", "SimNameDef", - "Simulate", "_Simulate", "SimulInfo", "_SimulInfo", "SingleValSet", - "_SingleValSet", "Site", "_Site", "Socket", "_Socket", "SocketSet", - "_SocketSet", "Status", "_Status", "Steady", "__Steady", "_Steady", - "StrDisplay", "String", "_String", "_StrDisplay", "Strong", "Symbol", - "_Symbol", "Symmetry", "_Symmetry", "Table", "_Table", "TableDeflt", - "__TableDeflt", "_TableDeflt", "Technology", "_Technology", "TextHeight", - "TimeIntval", "__TimeIntval", "_TimeIntval", "TimeStamp", "Timing", - "_Timing", "Transform", "_TransX", "_TransY", "_TransDelta", - "_TransOrien", "_TransOrg", "Transition", "_Transition", "Trigger", - "_Trigger", "True", "TypedValue", "Unconstrained", "Undefined", "Union", - "_Union", "Unit", "_Unit", "Unused", "UserData", "_UserData", - "ValueNameDef", "ValueNameRef", "Version", "View", "_View", "ViewList", - "_ViewList", "ViewMap", "_ViewMap", "ViewNameDef", "ViewNameRef", - "ViewRef", "_ViewRef", "ViewType", "_ViewType", "Visible", "VoltageMap", - "WaveValue", "Weak", "WeakJoined", "_WeakJoined", "When", "_When", - "Written", "_Written", "Ident", "Str", "Int", "Keyword", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, - 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, - 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, - 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, - 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, - 545, 546, 547, 548, 549, 41 -}; -# endif - -#define YYPACT_NINF -1333 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-1333))) - -#define YYTABLE_NINF -1 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 41, 152, 149, -1333, 176, 81, 305, -1333, -1333, -1333, - -1333, -1333, 33, -1333, -1333, 59, -1333, 148, 317, 101, - -1333, -1333, -1333, -1333, 437, 150, -1333, -1333, -1333, 148, - 148, 304, 81, 312, -1333, -1333, -1333, -1333, -1333, 33, - -1333, -1333, 148, 150, 316, -1333, -1333, 1508, 1780, 272, - -1333, -1333, -1333, 150, -1333, 148, -1333, 122, 715, 148, - 148, 111, -1333, 997, 1020, 148, 148, 152, 148, 176, - 300, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, 150, 1588, 280, -1333, -1333, 150, -1333, - -1333, 152, 152, 152, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, 148, 150, 148, 111, -1333, 36, -1333, -1333, - -1333, 150, -1333, -1333, -1333, 150, 148, 150, -1333, 1023, - 150, 66, -1333, 150, 150, 150, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, 150, 260, 150, - -1333, -1333, 424, -1333, 317, -1333, 317, 273, 439, -1333, - 148, 111, -1333, -1333, -1333, -1333, 439, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 310, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, 148, 150, -1333, 81, -1333, 441, - 254, 254, 266, -1333, -1333, -1333, -1333, 150, 150, 150, - 150, 416, 49, 115, 91, 801, 77, 437, 2006, -1333, - -1333, -1333, -1333, -1333, 71, 148, -1333, 376, -1333, -1333, - -1333, -1333, -1333, -1333, 343, 445, -1333, 445, -1333, 148, - -1333, 158, -1333, -1333, -1333, -1333, 300, -1333, -1333, -1333, - -1333, 148, -1333, -1333, -1333, -1333, 276, 144, -1333, -1333, - -1333, -1333, -1333, -1333, 111, -1333, -1333, -1333, -1333, 260, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 150, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, 150, -1333, -1333, -1333, -1333, - -1333, 150, 81, 150, -1333, -1333, -1333, 546, 152, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 148, - 437, 437, 437, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - 33, -1333, 33, -1333, 33, -1333, 150, 150, 144, -1333, - -1333, -1333, 33, -1333, 33, -1333, -1333, -1333, -1333, 150, - -1333, -1333, 132, 152, 152, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, 468, -1333, 148, 150, 306, 306, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 144, -1333, - -1333, -1333, -1333, -1333, 111, 111, -1333, -1333, -1333, -1333, - 81, -1333, 1442, -1333, -1333, 1794, 519, 832, 940, -1333, - 148, -1333, 437, 150, -1333, 150, -1333, 150, 111, 111, - 150, 1196, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, 152, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - 150, 152, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - 148, 150, -1333, -1333, -1333, 150, 321, -1333, 1196, 81, - 1196, 1196, 148, 1196, -1333, -1333, -1333, 150, -1333, -1333, - -1333, -1333, -1333, 461, 461, 461, 461, 461, 461, 461, - 461, 461, 461, 461, -1333, 1198, -1333, -1333, -1333, 322, - 867, 148, -1333, -1333, 150, 1263, -1333, -1333, 376, -1333, - -1333, 1263, -1333, -1333, 150, 1196, -1333, -1333, 1263, -1333, - 342, 461, 1545, 1545, 1545, 461, 1545, -1333, 130, 1545, - 461, 461, -29, 300, 81, 276, -1333, 150, -1333, -1333, - -1333, 81, 276, 81, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 1879, - 444, 466, -1333, 425, -1333, 382, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, 150, -1333, -1333, -1333, - -1333, 150, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 540, - -1333, -1333, -1333, -1333, 150, -1333, -1333, 1545, 111, 111, - 42, 111, 111, 111, 1276, -1333, -1333, -1333, -1333, 130, - -1333, -1333, -1333, -1333, 130, -1333, -1333, 130, -1333, -1333, - 1545, 130, -1333, -1333, -1333, -1333, -1333, 130, -1333, -1333, - 1545, 1545, -1333, -1333, -1333, -1333, 130, 150, 150, -1333, - 150, 63, -1333, 63, 63, 63, 150, 150, 150, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 150, - -1333, -1333, 186, 529, -1333, 653, 833, 529, 605, -1333, - 171, 529, 581, -1333, 783, -1333, -1333, 150, -1333, 130, - -1333, -1333, 150, 150, -1333, 53, -1333, 150, 150, 150, - -1333, 150, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, 130, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - 130, -1333, -1333, 130, -1333, -1333, -75, 361, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, 990, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, 81, -34, -1333, -1333, 59, 548, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, 442, 460, 548, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 539, - 523, 93, 93, 93, 93, 548, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 150, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 543, - -1333, -1333, 108, -1333, 108, 108, -1333, 152, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, 1584, 148, 81, - -1333, 150, -1333, 150, -1333, -1333, 894, -1333, 708, 252, - -1333, -1333, 150, -1333, 150, -1333, -1333, 561, 46, -1333, - -1333, 150, -1333, 150, -1333, -1333, 150, -1333, -1333, 150, - -1333, -1333, 150, -1333, -1333, 150, -1333, -1333, 26, 86, - -1333, 431, 421, 150, -1333, 130, -1333, -1333, 531, 281, - 152, -1333, -1333, 1023, -73, -1333, -1333, 631, -1333, 512, - 762, -1333, -1333, 481, 365, 588, 454, -1333, 76, 104, - 108, 108, 108, 108, 108, 108, 104, 437, 418, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, 51, -1333, -1333, - 424, -1333, -1333, -1333, -1333, -1333, 150, 436, 561, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 523, -1333, - -31, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - 523, -1333, -1333, -31, -1333, -1333, -1333, -1333, 150, 453, - 150, -1333, -1333, -1333, -1333, 529, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, 148, 321, -1333, -1333, - -1333, -1333, -1333, 711, 150, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - 726, 176, 529, 81, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, 620, 108, 152, -1333, - -1333, -1333, -1333, -1333, -1333, 59, 454, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, 260, 150, 691, -1333, -1333, - 751, -85, -1333, -1333, -1333, -115, -1333, 726, -1333, -1333, - -1333, 568, 562, 635, -1333, -1333, 449, 1253, -1333, -1333, - 97, -1333, -1333, -1333, 448, -1333, -1333, -1333, 150, -1333, - 384, -24, -1333, -1333, -24, 150, -1333, -1333, 950, 950, - -1333, -1333, -1333, 523, -1333, -1333, -1333, -1333, -1333, -122, - -1333, -1333, 150, -1333, -1333, 150, 86, 148, 150, -1333, - -77, -1333, -1333, -1333, 150, -1333, -90, -1333, -1333, -1333, - -1333, 33, -1333, -1333, -1333, -1333, 33, -1333, -1333, 33, - -1333, 148, 409, -1333, 530, 111, 150, -1333, -1333, 150, - 260, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - 260, 260, 675, 553, 553, 675, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, 99, -1333, -1333, - -1333, 812, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 679, - -1333, -1333, 946, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 651, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, 34, 276, 104, 104, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, 1014, 671, -1333, -1333, 634, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, 150, -1333, -1333, - -1333, -1333, -1333, -1333, 950, 150, 453, -1333, -1333, -119, - -1333, -1333, -1333, -1333, -1333, 150, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, 684, 255, 255, -1333, -1333, -1333, -1333, -1333, 150, - 624, -1333, -1333, -1333, -117, 260, -117, -1333, -1333, -1333, - -117, -1333, -117, -1333, -1333, -117, -1333, -117, 269, -1333, - -1333, -1333, 428, 529, 104, 560, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -98, -1333, -1333, -1333, -1333, - -1333, -1333, 150, -1333, 255, 150, 255, -1333, -1333, -1333, - -1333, 739, -1333, -64, -1333, -1333, 26, -1333, -1333, -31, - -1333, -1333, -1333, -1333, -1333, 111, 111, -1333, -1333, -1333, - 150, 114, 64, -1333, 150, -1333, -127, -1333, -1333, -1333, - -1333, 150, -1333, -52, -1333, -1333, -1333, -52, -1333, -1333, - -1333, -1333, -1333, 150, -1333, -1333, -1333, -1333, -1333, 28, - -1333, -1333, -46, -1333, -1333, -1333, -1333, -1333, -1333, 383, - 890, -1333, -1333, -1333, -1333, -1333, -1333, 1023, 657, -1333, - -1333, 148, -1333, 564, -1333, -1333, -1333, 11, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, 684, -1333, -1333, -1333, -1333, - -1333, -1333, 81, 26, -1333, -1333, -1333, -1333, -1333, 150, - -1333, -1333, -1333, 150, 150, -1333, 150, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, 534, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, 113, -1333, -117, 260, -1333, -1333, -1333, - -1333, -1333, 255, -1333, 890, -1333, -1333, 150, -1333, -1333, - -1333, -1333, 26, 150, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -1333, 148, 148, -1333, 725, - -1333, 150, -1333, -1333, -31, 376, -1333, -1333, 150, -1333, - -1333, -1333, -1333, 577, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, 260, 950, -1333, -1333, -1333, 26, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, 150, -1333, 150, 148, -1333, -1333, - 272, -1333, -1333, -1333, -1333, -1333, 150, -1333, 150, -1333, - 260, -1333, -1333, -1333, 150, -1333, 150, -1333, -1333, -1333, - 150, -46, -1333, 280, -1333, -1333, 150, -1333, -1333, -1333, - -1333, -1333, -1333, 150, -1333, -1333 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 0, 0, 0, 1126, 0, 0, 0, 590, 11, 591, - 589, 1, 0, 587, 883, 0, 882, 0, 0, 0, - 2, 586, 588, 1127, 0, 0, 885, 884, 1128, 0, - 0, 0, 0, 213, 211, 212, 593, 279, 592, 0, - 946, 881, 0, 0, 0, 4, 285, 0, 0, 215, - 214, 940, 947, 0, 12, 0, 457, 0, 0, 0, - 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, - 0, 284, 292, 289, 290, 295, 286, 287, 291, 288, - 296, 293, 297, 294, 443, 444, 445, 446, 447, 448, - 449, 450, 451, 0, 0, 217, 216, 13, 0, 456, - 458, 0, 0, 0, 929, 3, 9, 8, 6, 7, - 5, 10, 0, 0, 0, 0, 891, 0, 136, 137, - 138, 0, 232, 233, 234, 0, 0, 0, 848, 0, - 0, 0, 1054, 0, 0, 0, 68, 67, 442, 683, - 686, 684, 685, 679, 681, 682, 680, 0, 0, 0, - 218, 455, 0, 184, 0, 462, 0, 0, 0, 70, - 0, 0, 100, 102, 135, 231, 0, 727, 59, 396, - 564, 656, 737, 942, 1022, 1023, 1024, 1025, 1026, 0, - 1027, 843, 987, 1129, 1053, 1058, 1057, 1056, 1055, 345, - 262, 1021, 1101, 678, 0, 0, 210, 0, 176, 0, - 0, 0, 0, 928, 931, 932, 930, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 842, - 847, 844, 846, 845, 0, 0, 687, 82, 84, 175, - 178, 179, 177, 180, 0, 0, 256, 0, 465, 0, - 1119, 0, 69, 892, 99, 333, 0, 58, 62, 61, - 60, 0, 395, 398, 399, 397, 0, 0, 563, 567, - 566, 565, 571, 572, 0, 655, 659, 658, 657, 0, - 736, 740, 739, 738, 941, 944, 945, 943, 0, 1051, - 1037, 1048, 1049, 1038, 1036, 1046, 1050, 1044, 1045, 1043, - 1047, 1039, 1040, 1041, 1042, 0, 344, 349, 348, 347, - 346, 0, 0, 0, 83, 664, 980, 0, 0, 255, - 258, 259, 257, 260, 464, 467, 468, 466, 469, 0, - 0, 0, 0, 1118, 1120, 1124, 1122, 1121, 1123, 1125, - 0, 64, 0, 393, 0, 569, 0, 0, 0, 574, - 576, 575, 0, 661, 0, 742, 701, 1035, 747, 0, - 463, 81, 0, 0, 0, 186, 912, 979, 985, 984, - 982, 981, 983, 986, 0, 80, 0, 0, 151, 837, - 63, 65, 392, 394, 568, 570, 1028, 1029, 0, 660, - 662, 741, 743, 470, 0, 0, 663, 667, 666, 665, - 0, 460, 0, 264, 278, 0, 0, 0, 0, 73, - 0, 47, 0, 0, 152, 0, 838, 0, 0, 0, - 0, 0, 263, 271, 268, 269, 274, 265, 266, 270, - 277, 267, 275, 272, 276, 273, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 185, 199, 193, - 198, 188, 190, 187, 194, 195, 197, 196, 192, 191, - 189, 200, 0, 911, 914, 913, 915, 88, 87, 86, - 0, 0, 1076, 72, 77, 79, 74, 78, 76, 75, - 0, 0, 150, 836, 573, 0, 0, 261, 0, 0, - 0, 0, 0, 0, 320, 355, 356, 0, 318, 321, - 322, 319, 889, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 526, 0, 506, 85, 1085, 0, - 0, 0, 1063, 352, 0, 0, 202, 203, 299, 424, - 425, 0, 434, 435, 0, 0, 1031, 1032, 0, 354, - 0, 0, 0, 0, 0, 0, 0, 647, 0, 0, - 0, 0, 0, 0, 0, 0, 220, 0, 501, 504, - 887, 0, 0, 0, 525, 529, 539, 530, 528, 533, - 536, 535, 534, 538, 537, 532, 540, 527, 531, 0, - 0, 0, 383, 0, 627, 0, 822, 1075, 1083, 1080, - 1079, 1082, 1081, 1078, 1077, 1084, 0, 890, 201, 204, - 205, 0, 300, 423, 426, 427, 433, 699, 700, 0, - 1030, 1033, 1034, 281, 0, 282, 283, 0, 0, 0, - 0, 0, 0, 0, 917, 866, 865, 868, 867, 0, - 864, 863, 314, 315, 0, 324, 325, 0, 329, 330, - 0, 0, 429, 430, 646, 648, 649, 0, 651, 652, - 0, 0, 578, 870, 878, 877, 0, 0, 0, 507, - 0, 0, 436, 0, 0, 0, 0, 0, 0, 1096, - 1098, 1099, 1097, 1091, 1093, 1092, 1094, 1100, 1095, 0, - 401, 1065, 0, 0, 374, 0, 0, 0, 0, 606, - 0, 0, 0, 766, 0, 994, 298, 0, 280, 0, - 227, 228, 0, 0, 54, 0, 55, 0, 0, 0, - 918, 0, 313, 316, 317, 323, 326, 327, 328, 331, - 332, 0, 419, 420, 428, 431, 432, 650, 653, 654, - 0, 689, 690, 0, 694, 695, 0, 0, 876, 879, - 880, 66, 112, 142, 219, 221, 500, 502, 503, 505, - 886, 888, 948, 1102, 1104, 1090, 0, 114, 1064, 1068, - 1067, 1069, 1066, 1070, 0, 370, 391, 390, 0, 0, - 373, 378, 375, 377, 376, 380, 382, 386, 384, 385, - 387, 635, 634, 637, 0, 0, 605, 610, 608, 607, - 609, 623, 626, 630, 629, 628, 631, 830, 829, 832, - 0, 0, 0, 0, 0, 0, 765, 773, 775, 769, - 770, 771, 772, 767, 768, 774, 787, 821, 825, 824, - 823, 826, 698, 226, 229, 230, 45, 46, 56, 0, - 57, 254, 351, 461, 916, 418, 421, 422, 688, 691, - 692, 693, 696, 697, 577, 579, 869, 871, 872, 0, - 438, 581, 0, 729, 0, 0, 851, 0, 950, 1106, - 400, 406, 416, 414, 408, 409, 407, 411, 402, 403, - 415, 405, 413, 404, 412, 417, 410, 0, 0, 0, - 371, 0, 372, 0, 183, 182, 0, 996, 0, 0, - 639, 638, 0, 640, 0, 141, 140, 0, 0, 834, - 833, 0, 835, 0, 16, 15, 0, 155, 154, 0, - 158, 157, 0, 161, 160, 0, 164, 163, 0, 0, - 53, 0, 0, 0, 41, 0, 40, 39, 0, 0, - 0, 1060, 1059, 0, 0, 828, 827, 0, 752, 0, - 0, 903, 905, 0, 0, 0, 0, 104, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 113, - 129, 130, 122, 117, 127, 115, 128, 119, 120, 116, - 121, 123, 118, 125, 124, 131, 126, 0, 561, 1086, - 1088, 369, 181, 172, 173, 174, 0, 0, 0, 995, - 999, 998, 997, 1000, 379, 381, 636, 139, 0, 619, - 0, 622, 624, 625, 831, 14, 153, 156, 159, 162, - 0, 782, 783, 0, 786, 788, 789, 734, 0, 923, - 0, 48, 38, 42, 43, 0, 817, 437, 441, 440, - 439, 580, 585, 583, 582, 584, 0, 718, 643, 728, - 732, 731, 730, 0, 0, 751, 761, 763, 757, 758, - 759, 760, 756, 753, 755, 762, 754, 764, 475, 777, - 0, 0, 0, 0, 850, 856, 861, 855, 853, 854, - 858, 859, 852, 857, 860, 862, 0, 0, 0, 904, - 908, 909, 906, 910, 907, 0, 0, 949, 955, 957, - 962, 954, 952, 953, 959, 956, 960, 951, 958, 961, - 963, 1105, 1109, 1108, 1107, 0, 0, 0, 302, 303, - 0, 0, 335, 336, 389, 0, 388, 0, 518, 633, - 632, 0, 0, 0, 669, 703, 0, 0, 792, 791, - 0, 896, 1017, 1111, 0, 560, 562, 1089, 0, 171, - 0, 0, 342, 725, 0, 0, 167, 166, 0, 0, - 618, 621, 620, 0, 480, 479, 781, 785, 784, 0, - 37, 965, 0, 924, 44, 0, 0, 35, 0, 719, - 0, 207, 208, 209, 0, 1052, 0, 776, 779, 778, - 780, 0, 453, 459, 1062, 1061, 0, 715, 849, 0, - 840, 0, 0, 28, 0, 0, 0, 26, 25, 0, - 0, 71, 103, 105, 108, 110, 106, 107, 109, 111, - 0, 0, 0, 0, 0, 0, 301, 304, 311, 305, - 306, 307, 308, 309, 310, 312, 968, 0, 337, 338, - 1072, 0, 360, 359, 517, 520, 519, 521, 595, 0, - 472, 612, 0, 668, 672, 671, 670, 673, 702, 710, - 711, 707, 704, 705, 706, 709, 708, 712, 133, 790, - 801, 796, 793, 794, 795, 798, 797, 799, 800, 895, - 899, 897, 898, 0, 0, 0, 0, 1110, 1112, 1116, - 1113, 1115, 1114, 1117, 1087, 0, 0, 989, 990, 0, - 341, 343, 724, 726, 165, 496, 509, 0, 51, 50, - 52, 1014, 1013, 1015, 0, 0, 0, 733, 735, 0, - 922, 350, 816, 819, 818, 0, 36, 717, 642, 645, - 644, 206, 474, 476, 477, 452, 454, 714, 716, 839, - 841, 148, 0, 0, 27, 31, 29, 30, 32, 0, - 0, 24, 713, 874, 0, 0, 0, 223, 144, 676, - 0, 745, 0, 722, 749, 0, 901, 0, 0, 334, - 339, 340, 0, 0, 0, 1002, 358, 367, 365, 362, - 363, 366, 364, 361, 368, 594, 603, 601, 596, 598, - 600, 599, 597, 602, 604, 0, 611, 616, 614, 613, - 615, 617, 0, 134, 0, 0, 0, 1016, 1018, 1020, - 1019, 0, 18, 0, 482, 483, 550, 548, 549, 0, - 251, 250, 249, 248, 247, 0, 0, 993, 991, 992, - 0, 0, 0, 49, 0, 478, 0, 926, 964, 966, - 34, 0, 149, 0, 491, 493, 492, 0, 513, 515, - 514, 820, 542, 0, 873, 875, 97, 222, 224, 0, - 675, 677, 0, 721, 723, 748, 750, 900, 902, 0, - 0, 967, 969, 970, 1071, 1074, 1073, 0, 0, 804, - 803, 0, 1003, 1004, 471, 473, 132, 93, 92, 90, - 91, 357, 936, 934, 935, 0, 17, 22, 19, 21, - 20, 23, 0, 487, 485, 484, 486, 551, 552, 0, - 246, 253, 252, 0, 0, 988, 0, 495, 499, 497, - 498, 508, 511, 510, 1012, 0, 925, 927, 147, 490, - 494, 512, 516, 0, 1103, 0, 0, 143, 145, 146, - 744, 746, 0, 237, 0, 236, 238, 0, 972, 974, - 973, 975, 976, 0, 802, 812, 814, 808, 809, 810, - 811, 807, 806, 813, 805, 815, 0, 0, 1005, 1006, - 94, 0, 95, 937, 0, 523, 488, 489, 0, 547, - 674, 225, 353, 920, 541, 546, 544, 543, 545, 96, - 98, 0, 0, 556, 554, 555, 243, 239, 241, 240, - 242, 641, 977, 978, 0, 720, 0, 0, 169, 1007, - 1008, 89, 933, 939, 938, 524, 0, 481, 0, 921, - 0, 558, 557, 559, 0, 244, 0, 245, 971, 893, - 0, 0, 1009, 1010, 522, 919, 0, 553, 235, 894, - 168, 170, 1011, 0, 33, 1001 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -1333, -25, -1333, -1333, -1333, 8, -1333, -906, -1333, -1333, - -1333, -265, -1333, -1333, -1333, -1333, 173, -1333, -1333, -1333, - -1333, -1333, 223, 139, -1333, -1333, -996, -1333, -1333, -1333, - -1333, 645, -1333, -1333, -1333, -1333, -168, 470, 473, -285, - 599, -1333, -1333, -91, -1333, -1333, -1333, -1333, -557, -1333, - -1333, -1333, -1333, 504, 1011, -1333, -878, -1333, -1333, -1333, - -1333, -1333, -1333, -310, -1333, -316, -1333, -1333, -291, -1333, - -1333, -1333, -1333, -1333, -902, -1333, -901, -1333, -896, -1333, - -893, -1333, -891, -1333, -1333, -1333, -630, -1333, -1333, -1333, - -666, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -26, - -1333, -1333, -1333, -1333, -1333, -1333, -1333, -1333, -890, -1333, - -1333, 527, -1333, -1333, -1333, -1333, -1333, -284, -1333, -1333, - -1333, -1333, -1333, -1333, 528, -1333, -11, 3, 1663, -1333, - -7, -1333, 1085, -1333, -880, -1333, -1333, -1333, 1301, -1333, - -1333, -1333, -1333, 544, -1043, -1333, -1333, -1333, -1333, 716, - -1333, -1333, 329, -1333, -570, -1333, -1333, -1333, -872, -1333, - 308, -1333, -1333, -1333, -1333, -1333, -1333, -1333, 4, -1333, - 180, -1333, 745, -1333, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -1333, -834, -1333, -1333, -1333, -871, - -1333, -1333, -1333, -1333, -1333, -1333, 263, 858, -1333, -1333, - -1333, -517, -1333, -1333, -1333, -1333, -1202, -181, -428, -1333, - -1333, -1333, -1333, -1333, -1109, -1333, -1333, -1333, -1333, -1333, - -99, -514, -1097, -1333, -1333, -1333, -1333, -1333, -1332, -1333, - -1333, -1333, -1227, -1333, -420, -1333, -1333, -1333, -1333, -1333, - -665, -1333, 769, -1333, -193, -1333, -209, -1333, 90, -1333, - -1333, -1333, -1333, 355, -1333, 903, 128, -1025, -1333, -1333, - -1333, -141, -1333, -242, -1333, -287, -1333, -1333, -1333, 55, - 123, -674, -1333, -502, -1333, -1333, -1333, -1333, -1333, -1333, - 813, -1333, 472, -1333, -1333, -1333, -1333, -1333, -251, -1333, - -1333, -560, -1333, -582, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, -83, 105, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, -1333, 656, -864, -1333, -1333, -1333, 830, -1333, - -1333, -1333, -155, -1333, -210, -1333, -1333, -113, -1333, -1333, - -1333, -105, -1333, -889, -1333, -213, -1333, -803, -1333, -1333, - -1333, -874, -1333, -1333, -1333, -1333, -679, -882, 502, -1333, - -1333, -1333, -699, -1333, 767, -1333, -1333, -1333, -1333, -1333, - 845, 339, -1333, -942, -1333, -1333, -1333, -1333, -1333, -1333, - -1333, -1333, 902, -1333, 141, -1333, -1333, -44, -1333, -1333, - -1333, -1333, 213, -1333, -1333, -1333, 411, -1333, -1333, -1333, - -1333, -1333, -1333, -1333, -189, -1333, -363, -1333, -1333, -214, - 873, -1333, -1333, -1333, -1333, -1333, -195, -1333, -1300, -1333, - -1333, -1333, -1333, 904, -1333, 712, -1333, -1333, -1333, -1333, - -706, -1333, -1248, -1333, -1333, -1333, -1333, -1333, -980, -186, - -1333, -1333, -1333, -912, -1333, -1333, -1333, -1333, -467, -1333, - -1089, 1032, -1333, -1333, -241, 742, -1333, -1333, -235, -1333, - -1333, -1333, -1333, -1333, -770, -1333, -1333, -1333, 727, -1333, - -1333, -1333, 203, -1333, -1333, -1333, -1333, -1333, 1551, 12, - 347, -1333 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 21, 2, 58, 6, 31, 18, 797, 893, 1268, - 1391, 1078, 1186, 1070, 1182, 1518, 925, 1305, 914, 851, - 915, 916, 615, 616, 324, 917, 1141, 1287, 617, 695, - 819, 174, 211, 249, 330, 555, 135, 72, 73, 950, - 310, 398, 364, 198, 303, 227, 399, 460, 1388, 1467, - 1551, 1207, 1515, 74, 75, 117, 952, 1097, 557, 750, - 867, 1252, 1382, 76, 121, 778, 884, 558, 1339, 1439, - 1183, 1421, 326, 403, 799, 896, 800, 899, 801, 902, - 802, 905, 989, 1135, 1589, 1611, 877, 976, 107, 199, - 762, 873, 152, 359, 395, 484, 515, 1043, 1164, 22, - 33, 49, 95, 149, 559, 651, 1209, 1336, 1407, 439, - 689, 77, 125, 1452, 1524, 1576, 1606, 1277, 1399, 618, - 108, 235, 360, 136, 361, 392, 393, 34, 531, 604, - 35, 47, 485, 591, 953, 1100, 441, 619, 486, 442, - 624, 443, 627, 78, 954, 1101, 1217, 981, 1131, 185, - 224, 1018, 620, 388, 1498, 420, 487, 1389, 955, 1221, - 674, 871, 579, 675, 769, 879, 580, 676, 1105, 755, - 253, 332, 175, 212, 671, 746, 444, 711, 488, 521, - 445, 631, 489, 524, 560, 854, 918, 50, 93, 1060, - 1171, 56, 45, 57, 1172, 390, 621, 154, 349, 109, - 237, 304, 1231, 1375, 1049, 1166, 1002, 1143, 1271, 1393, - 1483, 1558, 1326, 1423, 1291, 1411, 561, 653, 562, 654, - 504, 1292, 1293, 1412, 1327, 1427, 956, 1107, 1484, 1596, - 455, 505, 1433, 1513, 1272, 1396, 1489, 1525, 1572, 1604, - 787, 967, 176, 213, 1144, 334, 1145, 262, 338, 644, - 726, 855, 919, 36, 12, 492, 649, 957, 1229, 581, - 678, 958, 1232, 779, 990, 784, 888, 582, 680, 1111, - 773, 679, 882, 1529, 1030, 1160, 446, 538, 447, 637, - 177, 214, 267, 342, 306, 352, 959, 1113, 1278, 1210, - 1340, 96, 147, 150, 448, 720, 449, 723, 490, 599, - 221, 960, 1116, 1085, 1061, 1176, 856, 1158, 1359, 1211, - 1342, 982, 1134, 79, 857, 924, 1008, 1149, 178, 215, - 272, 344, 1343, 1442, 195, 1212, 1345, 858, 927, 583, - 682, 859, 1050, 804, 1003, 809, 909, 961, 1117, 1360, - 1458, 1019, 1156, 1072, 584, 684, 928, 789, 683, 891, - 327, 405, 1063, 1179, 80, 179, 129, 1180, 861, 930, - 622, 645, 727, 1096, 1334, 450, 646, 9, 15, 25, - 564, 655, 493, 389, 263, 1462, 1548, 962, 1120, 1214, - 1347, 932, 862, 933, 362, 396, 623, 701, 1507, 1598, - 1010, 1152, 1298, 1416, 110, 157, 1390, 1475, 1554, 26, - 180, 216, 39, 565, 863, 934, 1153, 1299, 1219, 1348, - 1453, 1532, 1584, 236, 307, 81, 1132, 1279, 1410, 240, - 764, 878, 1363, 1463, 1549, 1590, 1613, 1623, 1142, 1294, - 1123, 1263, 137, 181, 340, 341, 491, 528, 223, 295, - 1046, 82, 131, 923, 1177, 404, 468, 672, 1222, 1352, - 469, 510, 509, 970, 872, 1128, 570, 669, 83, 567, - 1074, 568, 866, 935, 966, 1124, 206, 241, 38, 27, - 116, 189 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_uint16 yytable[] = -{ - 41, 592, 275, 883, 261, 273, 785, 1147, 756, 514, - 232, 1027, 771, 52, 51, 1351, 803, 1001, 54, 892, - 260, 1036, 71, 1148, 1236, 1038, 1039, 1005, 97, 1288, - 648, 1040, 99, 105, 1041, 46, 40, 656, 1044, 658, - 864, 1290, 23, 250, 1138, 1023, 312, 335, 317, 3, - 1058, 1419, 1057, 28, 1082, 28, 1081, 1102, 1059, 345, - 1031, 1093, 1083, 1084, 1118, 23, 3, 3, 138, 3, - 28, 183, 23, 151, 3, 28, 183, 23, 331, 3, - 853, 1270, 417, 23, 3, 1022, 1138, 1133, 159, 3, - 942, 1243, 162, 1486, 1516, 28, 164, 28, 1275, 881, - 165, 1092, 167, 23, 3, 182, 184, 3, 190, 191, - 192, 3, 1482, 608, 673, 28, 3, 3, 1528, 28, - 1384, 67, 193, 1028, 196, 609, 1432, 1062, 1505, 163, - 988, 1087, 203, 1155, 1189, 1296, 844, 735, 845, 737, - 739, 741, 843, 187, 19, 887, 843, 37, 28, 11, - 1531, 681, 28, 1355, 219, 3, 642, 1, 1213, 681, - 37, 964, 200, 681, 201, 908, 929, 643, 20, 1220, - 226, 869, 681, 20, 229, 920, 20, 1385, 20, 3, - 1216, 612, 242, 243, 244, 245, 247, 252, 258, 265, - 270, 274, 1577, 1000, 1488, 194, 1510, 20, 169, 251, - 1512, 1216, 115, 988, 1371, 20, 114, 32, 114, 466, - 309, 62, 314, 643, 993, 613, 323, 1196, 20, 62, - 20, 62, 20, 771, 1580, 1197, 114, 754, 277, 278, - 114, 320, 32, 4, 1285, 1088, 299, 1253, 1241, 1251, - 677, 940, 1139, 20, 1242, 1254, 1255, 62, 1260, 20, - 4, 4, 869, 346, 1496, 1496, 161, 321, 3, 114, - 62, 1042, 1108, 4, 20, 1114, 1000, 754, 4, 194, - 347, 20, 384, 4, 1303, 62, 348, 1228, 351, 747, - 28, 1557, 357, 1285, 1139, 754, 1286, 1286, 4, 687, - 171, 4, 264, 1386, 264, 4, 1309, 170, 256, 257, - 4, 4, 209, 1502, 371, 370, 373, 372, 375, 374, - 1329, 376, 377, 1246, 1500, 1599, 380, 379, 382, 381, - 24, 5, 681, 20, 383, 228, 1350, 386, 20, 20, - 1583, 20, 367, 368, 369, 1223, 650, 173, 24, 4, - 681, 20, 401, 657, 20, 3, 20, 947, 1478, 1369, - 1465, 1367, 1379, 5, 1378, 268, 7, 1370, 20, 20, - 14, 20, 62, 781, 29, 677, 296, 412, 1383, 1544, - 437, 453, 20, 463, 1607, 647, 42, 43, 472, 385, - 473, 20, 474, 1394, 1397, 477, 20, 1174, 1184, 53, - 1449, 114, 20, 410, 20, 322, 67, 5, 339, 62, - 673, 1403, 98, 1491, 1566, 343, 112, 113, 20, 20, - 20, 69, 126, 127, 471, 130, 1568, 20, 1256, 1492, - 336, 337, 7, 17, 67, 20, 133, 20, 378, 1075, - 350, 1422, 608, 609, 30, 507, 754, 610, 840, 69, - 1425, 1429, 4, 23, 104, 20, 512, 936, 1424, 1428, - 513, 478, 69, 20, 62, 937, 7, 7, 7, 158, - 257, 160, 529, 1601, 28, 44, 20, 69, 407, 1384, - 48, 1550, 1459, 166, 479, 1603, 55, 94, 188, 339, - 554, 20, 518, 752, 611, 577, 148, 1552, 1016, 587, - 588, 681, 938, 168, 246, 480, 593, 481, 62, 596, - 612, 194, 1469, 600, 1473, 1487, 1275, 208, 197, 940, - 1468, 1264, 1472, 634, 1016, 1362, 168, 681, 37, 339, - 217, 234, 652, 613, 1051, 408, 409, 28, 308, 4, - 62, 936, 3, 603, 62, 1450, 239, 62, 62, 937, - 302, 225, 133, 305, 874, 1533, 1066, 20, 67, 475, - 476, 482, 1535, 397, 69, 1358, 1537, 1538, 1593, 255, - 1159, 685, 1539, 1522, 20, 1540, 686, 202, 20, 1542, - 62, 300, 301, 849, 1594, 134, 20, 1076, 1322, 688, - 1052, 895, 1456, 1323, 939, 1553, 319, 1276, 402, 218, - 673, 530, 1556, 940, 702, 670, 946, 894, 333, 705, - 218, 1401, 708, 67, 1053, 20, 714, 37, 62, 569, - 251, 911, 717, 912, 673, 614, 1265, 913, 681, 677, - 483, 728, 731, 732, 1289, 733, 734, 1266, 736, 738, - 740, 742, 743, 744, 63, 62, 677, 942, 114, 943, - 1574, 1582, 1386, 790, 745, 1055, 69, 748, 1573, 1079, - 760, 766, 1007, 776, 876, 782, 20, 796, 37, 807, - 20, 1076, 812, 7, 813, 988, 366, 816, 817, 1015, - 62, 353, 821, 822, 823, 354, 824, 1009, 1048, 67, - 946, 791, 792, 793, 794, 1605, 825, 673, 1174, 758, - 69, 134, 1122, 790, 62, 828, 452, 1095, 831, 104, - 774, 834, 836, 104, 20, 1130, 256, 257, 7, 7, - 754, 20, 1220, 400, 869, 1067, 4, 1151, 1181, 790, - 62, 850, 69, 20, 62, 840, 69, 1230, 869, 69, - 69, 791, 792, 793, 794, 1563, 20, 1161, 1162, 758, - 20, 1033, 62, 20, 20, 840, 62, 470, 1406, 692, - 693, 1163, 697, 698, 699, 1075, 1275, 791, 792, 793, - 794, 758, 69, 1016, 1016, 758, 355, 681, 62, 937, - 875, 1068, 1338, 936, 774, 681, 20, 1341, 938, 1137, - 62, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 1541, 1275, 910, 1136, 775, 62, 1406, 356, - 69, 757, 1432, 207, 62, 772, 938, 7, 1461, 788, - 795, 210, 1194, 1547, 20, 62, 7, 511, 938, 67, - 869, 1016, 101, 940, 681, 869, 20, 69, 62, 525, - 1588, 1239, 1193, 694, 818, 940, 315, 1276, 1200, 102, - 62, 20, 949, 67, 936, 977, 971, 1281, 972, 1355, - 1283, 62, 937, 979, 984, 457, 248, 986, 586, 987, - 795, 1187, 413, 991, 1201, 414, 994, 942, 995, 67, - 775, 996, 62, 67, 997, 939, 20, 998, 103, 1127, - 999, 458, 868, 20, 1004, 1190, 795, 459, 1011, 938, - 1012, 67, 1523, 1017, 1021, 67, 415, 1499, 1503, 1029, - 20, 62, 1035, 973, 8, 1054, 940, 1265, 1069, 1077, - 1091, 1034, 69, 1368, 1346, 1034, 69, 67, 1266, 418, - 758, 1051, 62, 440, 759, 978, 20, 1098, 974, 67, - 20, 1099, 898, 901, 904, 907, 419, 1034, 69, 696, - 297, 975, 1125, 1565, 626, 629, 222, 633, 20, 1115, - 639, 1129, 20, 3, 885, 1202, 62, 254, 820, 1121, - 69, 156, 1295, 1479, 67, 1140, 231, 1203, 1555, 1185, - 128, 1480, 69, 104, 20, 1244, 1204, 1052, 1146, 765, - 1333, 673, 259, 1150, 768, 1154, 20, 1372, 1400, 69, - 1335, 1337, 1405, 946, 1095, 1408, 69, 969, 1112, 1567, - 67, 1053, 1205, 20, 153, 155, 155, 69, 328, 1165, - 20, 992, 571, 806, 572, 921, 772, 118, 691, 681, - 69, 20, 1578, 172, 269, 1167, 1353, 266, 1409, 62, - 1612, 1622, 69, 1245, 20, 62, 937, 788, 1595, 1086, - 122, 713, 194, 69, 1354, 271, 20, 119, 421, 1344, - 67, 722, 725, 1313, 120, 1392, 573, 20, 1602, 839, - 574, 1314, 1402, 870, 69, 835, 1482, 788, 100, 106, - 123, 1191, 1192, 938, 788, 1206, 1261, 124, 20, 62, - 963, 880, 1224, 759, 1355, 1527, 1526, 1188, 1233, 276, - 111, 1238, 1249, 69, 575, 1259, 20, 889, 758, 1267, - 168, 1417, 576, 1274, 423, 238, 1280, 20, 1414, 1282, - 1284, 406, 1457, 1104, 69, 1109, 1109, 1455, 1104, 425, - 1285, 886, 1025, 1286, 1297, 1436, 681, 1300, 20, 0, - 1301, 1302, 1262, 1307, 0, 1308, 0, 4, 838, 1311, - 0, 1312, 0, 788, 0, 1316, 1315, 840, 69, 0, - 1318, 1317, 0, 1320, 1319, 1216, 0, 1324, 0, 422, - 0, 1331, 20, 0, 1332, 465, 0, 0, 204, 0, - 0, 0, 169, 0, 0, 0, 841, 0, 67, 0, - 1175, 1178, 0, 0, 67, 0, 810, 985, 0, 205, - 220, 0, 1349, 0, 0, 0, 1356, 7, 104, 7, - 7, 0, 7, 842, 1365, 170, 781, 1376, 677, 843, - 230, 365, 0, 0, 0, 968, 844, 0, 845, 0, - 0, 69, 171, 461, 0, 462, 0, 69, 67, 1519, - 846, 233, 1521, 0, 0, 20, 0, 0, 1387, 0, - 0, 20, 847, 0, 806, 172, 311, 1016, 316, 0, - 681, 0, 325, 848, 0, 0, 391, 394, 0, 0, - 0, 759, 1413, 897, 900, 903, 906, 313, 0, 318, - 1415, 69, 563, 329, 1418, 7, 0, 543, 0, 0, - 1420, 0, 849, 173, 788, 20, 0, 62, 0, 544, - 0, 890, 0, 7, 545, 7, 7, 7, 7, 7, - 7, 0, 0, 0, 1431, 478, 1571, 0, 0, 1434, - 546, 1437, 0, 0, 1126, 1440, 0, 1443, 358, 0, - 1445, 0, 1447, 1451, 0, 0, 1330, 1454, 479, 494, - 495, 496, 497, 498, 499, 500, 501, 502, 503, 363, - 0, 0, 62, 937, 0, 1248, 0, 608, 609, 480, - 1464, 481, 610, 0, 547, 506, 0, 1466, 0, 0, - 1471, 1600, 0, 387, 508, 0, 1476, 0, 0, 548, - 549, 0, 478, 1157, 1490, 0, 0, 0, 625, 628, - 938, 632, 0, 0, 638, 1495, 1497, 1501, 0, 1504, - 1616, 1506, 0, 788, 788, 479, 1508, 940, 1509, 611, - 0, 1621, 1511, 416, 0, 482, 438, 454, 1514, 464, - 0, 1006, 1051, 0, 1517, 612, 480, 1520, 481, 0, - 1020, 1024, 7, 7, 424, 0, 1032, 451, 456, 0, - 467, 0, 0, 1534, 0, 0, 67, 1094, 613, 751, - 0, 1103, 763, 0, 550, 780, 0, 0, 1119, 805, - 788, 788, 690, 0, 0, 0, 0, 0, 0, 700, - 551, 0, 0, 0, 1559, 0, 0, 0, 1560, 1561, - 0, 1562, 482, 0, 483, 712, 0, 0, 0, 69, - 0, 1175, 788, 0, 0, 721, 724, 552, 1564, 553, - 1569, 67, 1053, 20, 0, 0, 0, 0, 0, 0, - 0, 0, 1581, 0, 1306, 0, 0, 0, 1585, 0, - 0, 0, 788, 860, 788, 0, 556, 0, 0, 0, - 0, 578, 59, 60, 0, 0, 1591, 0, 1321, 1592, - 61, 62, 0, 1597, 69, 0, 63, 566, 0, 0, - 0, 483, 585, 0, 0, 0, 1493, 1494, 20, 635, - 0, 0, 10, 0, 0, 13, 16, 0, 20, 1608, - 0, 1609, 64, 516, 0, 519, 522, 0, 526, 0, - 636, 1614, 837, 1615, 0, 0, 0, 65, 0, 1617, - 0, 1618, 0, 0, 411, 1619, 1620, 0, 59, 60, - 0, 1624, 0, 0, 0, 0, 61, 62, 1625, 0, - 589, 0, 63, 1218, 0, 0, 594, 0, 0, 0, - 597, 0, 0, 601, 0, 605, 608, 609, 10, 0, - 132, 610, 0, 139, 140, 141, 142, 0, 64, 0, - 703, 143, 144, 145, 146, 706, 0, 0, 709, 0, - 0, 0, 715, 65, 0, 0, 0, 0, 718, 0, - 788, 704, 10, 10, 10, 0, 707, 729, 1304, 710, - 66, 0, 1310, 716, 0, 0, 936, 0, 611, 719, - 0, 0, 0, 62, 937, 0, 0, 0, 730, 0, - 67, 0, 186, 749, 612, 0, 761, 767, 0, 777, - 0, 783, 0, 798, 1045, 808, 0, 1064, 0, 0, - 814, 1089, 0, 0, 753, 0, 0, 613, 770, 0, - 68, 938, 786, 0, 0, 0, 811, 0, 0, 0, - 939, 815, 826, 69, 0, 0, 66, 0, 940, 0, - 70, 829, 0, 0, 832, 0, 0, 20, 0, 0, - 0, 0, 0, 827, 0, 922, 67, 926, 926, 0, - 931, 0, 830, 0, 0, 833, 0, 852, 0, 941, - 0, 0, 0, 0, 0, 0, 0, 1395, 1398, 0, - 0, 0, 942, 0, 943, 298, 68, 1404, 865, 517, - 0, 520, 523, 0, 527, 0, 944, 0, 0, 69, - 0, 84, 85, 86, 0, 945, 70, 0, 0, 614, - 0, 0, 0, 20, 0, 0, 0, 0, 1546, 87, - 88, 89, 0, 0, 0, 946, 590, 1169, 0, 0, - 0, 0, 595, 1026, 1426, 1430, 598, 0, 0, 602, - 0, 606, 0, 0, 947, 0, 847, 0, 90, 91, - 92, 394, 0, 1106, 926, 1110, 1110, 926, 1106, 0, - 0, 0, 0, 0, 0, 759, 1460, 0, 0, 10, - 0, 0, 0, 0, 1198, 69, 0, 0, 0, 0, - 0, 0, 0, 0, 1226, 0, 0, 948, 951, 20, - 1235, 0, 0, 62, 1257, 0, 1470, 659, 1474, 980, - 0, 0, 0, 1586, 1587, 1485, 0, 660, 0, 965, - 0, 0, 0, 661, 10, 10, 0, 662, 0, 0, - 983, 663, 0, 426, 0, 0, 0, 0, 664, 0, - 665, 0, 427, 354, 0, 0, 1013, 428, 429, 0, - 666, 667, 668, 0, 1610, 0, 0, 0, 1037, 0, - 0, 1056, 0, 0, 1071, 1080, 430, 1014, 431, 0, - 0, 0, 1530, 0, 0, 0, 0, 0, 0, 1047, - 0, 0, 1065, 0, 0, 1073, 1090, 0, 0, 0, - 926, 506, 0, 0, 0, 0, 0, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 1361, 0, - 0, 432, 433, 0, 0, 0, 1373, 0, 0, 1380, - 0, 434, 435, 10, 0, 0, 0, 0, 0, 0, - 0, 0, 10, 279, 0, 0, 280, 0, 0, 0, - 281, 282, 283, 284, 1575, 285, 1579, 286, 287, 0, - 0, 288, 0, 0, 0, 0, 0, 0, 436, 289, - 0, 0, 0, 0, 0, 0, 0, 0, 290, 0, - 0, 0, 0, 0, 291, 0, 0, 0, 0, 0, - 292, 1168, 293, 0, 0, 0, 0, 294, 0, 0, - 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, - 0, 0, 1170, 0, 0, 0, 0, 0, 0, 20, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1435, 0, 1438, 0, 0, 0, 1441, 1195, 1444, - 0, 1208, 1446, 0, 1448, 0, 0, 0, 1225, 0, - 0, 0, 0, 0, 1234, 0, 0, 1240, 1250, 1199, - 0, 0, 1215, 0, 0, 1269, 0, 0, 0, 1227, - 0, 0, 0, 0, 0, 1237, 0, 0, 1247, 1258, - 0, 0, 0, 0, 0, 0, 1273, 532, 533, 534, - 535, 536, 537, 539, 540, 541, 542, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1325, 607, 0, 0, 0, 630, 0, - 0, 0, 0, 640, 641, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1328, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1543, 0, 0, 0, 0, - 0, 0, 1357, 0, 0, 0, 0, 0, 0, 0, - 1366, 0, 0, 1377, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1364, 0, 0, 0, 0, 0, 0, - 0, 1374, 0, 0, 1381, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1570, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 10, 0, 10, 10, 0, 10, 0, - 0, 0, 1477, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1481, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1536, - 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, - 1545, 10, 10, 10, 10, 10, 10, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1173, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 10, 10 -}; - -static const yytype_int16 yycheck[] = -{ - 25, 518, 216, 773, 213, 215, 680, 1003, 673, 476, - 199, 923, 677, 39, 39, 1217, 682, 908, 43, 789, - 213, 927, 47, 1003, 1113, 927, 927, 909, 53, 1138, - 544, 927, 57, 58, 927, 32, 24, 551, 927, 553, - 746, 1138, 6, 211, 75, 919, 235, 256, 237, 3, - 930, 1299, 930, 4, 934, 4, 934, 939, 930, 269, - 924, 935, 934, 934, 946, 6, 3, 3, 93, 3, - 4, 5, 6, 98, 3, 4, 5, 6, 246, 3, - 746, 1124, 392, 6, 3, 919, 75, 978, 113, 3, - 188, 1116, 117, 1393, 66, 4, 121, 4, 122, 773, - 125, 935, 127, 6, 3, 130, 131, 3, 133, 134, - 135, 3, 176, 71, 148, 4, 3, 3, 1450, 4, - 86, 238, 147, 196, 149, 72, 178, 930, 255, 117, - 104, 934, 157, 1015, 1076, 257, 226, 651, 228, 653, - 654, 655, 219, 131, 111, 775, 219, 19, 4, 0, - 1450, 236, 4, 272, 179, 3, 185, 116, 1100, 236, - 32, 867, 154, 236, 156, 795, 845, 242, 295, 284, - 195, 286, 236, 295, 199, 67, 295, 143, 295, 3, - 265, 139, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 1524, 167, 1396, 241, 1423, 295, 149, 150, - 1427, 265, 61, 104, 1229, 295, 115, 131, 115, 398, - 235, 89, 237, 242, 888, 162, 241, 1097, 295, 89, - 295, 89, 295, 888, 1524, 1097, 115, 181, 216, 217, - 115, 73, 131, 187, 170, 934, 224, 1117, 1116, 1117, - 194, 144, 273, 295, 1116, 1117, 1117, 89, 1120, 295, - 187, 187, 286, 278, 141, 141, 115, 99, 3, 115, - 89, 927, 941, 187, 295, 944, 167, 181, 187, 241, - 295, 295, 140, 187, 1156, 89, 301, 1111, 303, 93, - 4, 1483, 307, 170, 273, 181, 173, 173, 187, 599, - 199, 187, 201, 259, 201, 187, 1160, 182, 183, 184, - 187, 187, 161, 1412, 330, 330, 332, 332, 334, 334, - 1184, 336, 337, 1116, 1411, 1563, 342, 342, 344, 344, - 261, 245, 236, 295, 349, 197, 1217, 352, 295, 295, - 1532, 295, 320, 321, 322, 1105, 545, 260, 261, 187, - 236, 295, 367, 552, 295, 3, 295, 250, 1391, 1229, - 1375, 1229, 1232, 245, 1232, 214, 1, 1229, 295, 295, - 5, 295, 89, 192, 17, 194, 295, 392, 1248, 1458, - 395, 396, 295, 398, 1576, 543, 29, 30, 403, 247, - 405, 295, 407, 1265, 1266, 410, 295, 1052, 1067, 42, - 121, 115, 295, 390, 295, 237, 238, 245, 257, 89, - 148, 1275, 55, 1399, 1513, 264, 59, 60, 295, 295, - 295, 281, 65, 66, 402, 68, 1513, 295, 1117, 1399, - 276, 277, 67, 118, 238, 295, 126, 295, 338, 64, - 302, 1321, 71, 72, 117, 460, 181, 76, 157, 281, - 1322, 1323, 187, 6, 258, 295, 471, 82, 1322, 1323, - 475, 109, 281, 295, 89, 90, 101, 102, 103, 112, - 184, 114, 487, 1572, 4, 161, 295, 281, 378, 86, - 158, 1467, 1354, 126, 132, 1572, 160, 205, 131, 338, - 505, 295, 479, 672, 123, 510, 206, 1467, 233, 514, - 515, 236, 127, 77, 78, 153, 521, 155, 89, 524, - 139, 241, 1384, 528, 1386, 1396, 122, 160, 84, 144, - 1384, 63, 1386, 538, 233, 1221, 77, 236, 390, 378, - 210, 267, 547, 162, 159, 384, 385, 4, 83, 187, - 89, 82, 3, 530, 89, 266, 270, 89, 89, 90, - 164, 194, 126, 200, 758, 1457, 65, 295, 238, 408, - 409, 209, 1458, 85, 281, 1221, 1458, 1458, 1554, 212, - 1027, 586, 1458, 180, 295, 1458, 591, 294, 295, 1458, - 89, 224, 225, 292, 1554, 275, 295, 212, 169, 604, - 215, 790, 1352, 174, 136, 1475, 239, 203, 282, 279, - 148, 130, 1483, 144, 619, 151, 231, 790, 251, 624, - 279, 1275, 627, 238, 239, 295, 631, 479, 89, 287, - 150, 68, 637, 70, 148, 254, 168, 74, 236, 194, - 278, 646, 647, 648, 1138, 650, 651, 179, 653, 654, - 655, 656, 657, 658, 94, 89, 194, 188, 115, 190, - 1522, 1532, 259, 62, 669, 930, 281, 672, 1522, 934, - 675, 676, 221, 678, 106, 680, 295, 682, 530, 684, - 295, 212, 687, 308, 689, 104, 319, 692, 693, 138, - 89, 125, 697, 698, 699, 129, 701, 256, 166, 238, - 231, 100, 101, 102, 103, 1576, 711, 148, 1353, 108, - 281, 275, 274, 62, 89, 720, 177, 243, 723, 258, - 95, 726, 727, 258, 295, 269, 183, 184, 353, 354, - 181, 295, 284, 366, 286, 234, 187, 264, 98, 62, - 89, 746, 281, 295, 89, 157, 281, 165, 286, 281, - 281, 100, 101, 102, 103, 1505, 295, 26, 27, 108, - 295, 110, 89, 295, 295, 157, 89, 400, 114, 608, - 609, 40, 611, 612, 613, 64, 122, 100, 101, 102, - 103, 108, 281, 233, 233, 108, 220, 236, 89, 90, - 758, 290, 97, 82, 95, 236, 295, 224, 127, 988, - 89, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 1458, 122, 819, 988, 191, 89, 114, 253, - 281, 673, 178, 158, 89, 677, 127, 452, 248, 681, - 229, 166, 1097, 249, 295, 89, 461, 470, 127, 238, - 286, 233, 107, 144, 236, 286, 295, 281, 89, 482, - 105, 1116, 1097, 610, 695, 144, 237, 203, 87, 124, - 89, 295, 867, 238, 82, 137, 871, 1131, 873, 272, - 1134, 89, 90, 878, 879, 23, 211, 882, 511, 884, - 229, 1075, 392, 888, 113, 392, 891, 188, 893, 238, - 191, 896, 89, 238, 899, 136, 295, 902, 163, 970, - 905, 49, 754, 295, 909, 1095, 229, 55, 913, 127, - 915, 238, 1449, 918, 919, 238, 392, 1411, 1412, 924, - 295, 89, 927, 9, 1, 930, 144, 168, 933, 934, - 935, 280, 281, 1229, 1205, 280, 281, 238, 179, 392, - 108, 159, 89, 395, 271, 217, 295, 938, 34, 238, - 295, 938, 791, 792, 793, 794, 392, 280, 281, 610, - 224, 47, 967, 1513, 533, 534, 179, 536, 295, 945, - 539, 976, 295, 3, 774, 204, 89, 212, 695, 947, - 281, 103, 1143, 1391, 238, 990, 199, 216, 1482, 1068, - 67, 1391, 281, 258, 295, 1116, 225, 215, 1003, 146, - 1190, 148, 213, 1008, 676, 1010, 295, 1229, 1275, 281, - 1200, 1201, 1276, 231, 243, 1279, 281, 869, 943, 1513, - 238, 239, 251, 295, 101, 102, 103, 281, 241, 1034, - 295, 888, 145, 230, 147, 842, 888, 20, 607, 236, - 281, 295, 1524, 222, 223, 1050, 214, 214, 1279, 89, - 1590, 1613, 281, 1116, 295, 89, 90, 909, 1555, 934, - 20, 630, 241, 281, 232, 215, 295, 50, 392, 1204, - 238, 640, 641, 1166, 57, 1264, 189, 295, 1572, 69, - 193, 1166, 1275, 755, 281, 726, 176, 939, 57, 58, - 50, 1096, 1097, 127, 946, 1100, 1120, 57, 295, 89, - 867, 773, 1107, 271, 272, 195, 1449, 1075, 1113, 216, - 58, 1116, 1117, 281, 227, 1120, 295, 789, 108, 1124, - 77, 1296, 235, 1128, 392, 201, 1131, 295, 1294, 1134, - 1135, 369, 1353, 940, 281, 942, 943, 1352, 945, 392, - 170, 774, 919, 173, 1149, 1335, 236, 1152, 295, -1, - 1155, 1156, 1120, 1158, -1, 1160, -1, 187, 727, 1164, - -1, 1166, -1, 1015, -1, 1171, 1171, 157, 281, -1, - 1176, 1176, -1, 1179, 1179, 265, -1, 1182, -1, 392, - -1, 1186, 295, -1, 1189, 398, -1, -1, 157, -1, - -1, -1, 149, -1, -1, -1, 186, -1, 238, -1, - 1052, 1053, -1, -1, 238, -1, 684, 879, -1, 157, - 179, -1, 1217, -1, -1, -1, 1221, 842, 258, 844, - 845, -1, 847, 213, 1229, 182, 192, 1232, 194, 219, - 199, 308, -1, -1, -1, 868, 226, -1, 228, -1, - -1, 281, 199, 283, -1, 285, -1, 281, 238, 1439, - 240, 199, 1442, -1, -1, 295, -1, -1, 1263, -1, - -1, 295, 252, -1, 230, 222, 235, 233, 237, -1, - 236, -1, 241, 263, -1, -1, 353, 354, -1, -1, - -1, 271, 1287, 791, 792, 793, 794, 235, -1, 237, - 1295, 281, 505, 241, 1299, 920, -1, 79, -1, -1, - 1305, -1, 292, 260, 1156, 295, -1, 89, -1, 91, - -1, 789, -1, 938, 96, 940, 941, 942, 943, 944, - 945, -1, -1, -1, 1329, 109, 1516, -1, -1, 1334, - 112, 1336, -1, -1, 967, 1340, -1, 1342, 307, -1, - 1345, -1, 1347, 1348, -1, -1, 1185, 1352, 132, 427, - 428, 429, 430, 431, 432, 433, 434, 435, 436, 307, - -1, -1, 89, 90, -1, 92, -1, 71, 72, 153, - 1375, 155, 76, -1, 156, 452, -1, 1382, -1, -1, - 1385, 1571, -1, 352, 461, -1, 1391, -1, -1, 171, - 172, -1, 109, 1026, 1399, -1, -1, -1, 533, 534, - 127, 536, -1, -1, 539, 1410, 1411, 1412, -1, 1414, - 1600, 1416, -1, 1265, 1266, 132, 1421, 144, 1423, 123, - -1, 1611, 1427, 392, -1, 209, 395, 396, 1433, 398, - -1, 909, 159, -1, 1439, 139, 153, 1442, 155, -1, - 918, 919, 1067, 1068, 392, -1, 924, 395, 396, -1, - 398, -1, -1, 1458, -1, -1, 238, 935, 162, 672, - -1, 939, 675, -1, 246, 678, -1, -1, 946, 682, - 1322, 1323, 607, -1, -1, -1, -1, -1, -1, 614, - 262, -1, -1, -1, 1489, -1, -1, -1, 1493, 1494, - -1, 1496, 209, -1, 278, 630, -1, -1, -1, 281, - -1, 1353, 1354, -1, -1, 640, 641, 289, 1513, 291, - 1515, 238, 239, 295, -1, -1, -1, -1, -1, -1, - -1, -1, 1527, -1, 1157, -1, -1, -1, 1533, -1, - -1, -1, 1384, 746, 1386, -1, 505, -1, -1, -1, - -1, 510, 80, 81, -1, -1, 1551, -1, 1181, 1554, - 88, 89, -1, 1558, 281, -1, 94, 505, -1, -1, - -1, 278, 510, -1, -1, -1, 1405, 1406, 295, 538, - -1, -1, 1, -1, -1, 4, 5, -1, 295, 1584, - -1, 1586, 120, 478, -1, 480, 481, -1, 483, -1, - 538, 1596, 727, 1598, -1, -1, -1, 135, -1, 1604, - -1, 1606, -1, -1, 142, 1610, 1611, -1, 80, 81, - -1, 1616, -1, -1, -1, -1, 88, 89, 1623, -1, - 515, -1, 94, 1101, -1, -1, 521, -1, -1, -1, - 525, -1, -1, 528, -1, 530, 71, 72, 67, -1, - 69, 76, -1, 35, 36, 37, 38, -1, 120, -1, - 619, 43, 44, 45, 46, 624, -1, -1, 627, -1, - -1, -1, 631, 135, -1, -1, -1, -1, 637, -1, - 1522, 619, 101, 102, 103, -1, 624, 646, 1156, 627, - 218, -1, 1160, 631, -1, -1, 82, -1, 123, 637, - -1, -1, -1, 89, 90, -1, -1, -1, 646, -1, - 238, -1, 131, 672, 139, -1, 675, 676, -1, 678, - -1, 680, -1, 682, 927, 684, -1, 930, -1, -1, - 689, 934, -1, -1, 672, -1, -1, 162, 676, -1, - 268, 127, 680, -1, -1, -1, 684, -1, -1, -1, - 136, 689, 711, 281, -1, -1, 218, -1, 144, -1, - 288, 720, -1, -1, 723, -1, -1, 295, -1, -1, - -1, -1, -1, 711, -1, 842, 238, 844, 845, -1, - 847, -1, 720, -1, -1, 723, -1, 746, -1, 175, - -1, -1, -1, -1, -1, -1, -1, 1265, 1266, -1, - -1, -1, 188, -1, 190, 224, 268, 1275, 746, 478, - -1, 480, 481, -1, 483, -1, 202, -1, -1, 281, - -1, 11, 12, 13, -1, 211, 288, -1, -1, 254, - -1, -1, -1, 295, -1, -1, -1, -1, 1461, 29, - 30, 31, -1, -1, -1, 231, 515, 1050, -1, -1, - -1, -1, 521, 920, 1322, 1323, 525, -1, -1, 528, - -1, 530, -1, -1, 250, -1, 252, -1, 58, 59, - 60, 938, -1, 940, 941, 942, 943, 944, 945, -1, - -1, -1, -1, -1, -1, 271, 1354, -1, -1, 308, - -1, -1, -1, -1, 1097, 281, -1, -1, -1, -1, - -1, -1, -1, -1, 1107, -1, -1, 293, 867, 295, - 1113, -1, -1, 89, 1117, -1, 1384, 8, 1386, 878, - -1, -1, -1, 1546, 1547, 1393, -1, 18, -1, 867, - -1, -1, -1, 24, 353, 354, -1, 28, -1, -1, - 878, 32, -1, 119, -1, -1, -1, -1, 39, -1, - 41, -1, 128, 129, -1, -1, 915, 133, 134, -1, - 51, 52, 53, -1, 1587, -1, -1, -1, 927, -1, - -1, 930, -1, -1, 933, 934, 152, 915, 154, -1, - -1, -1, 1450, -1, -1, -1, -1, -1, -1, 927, - -1, -1, 930, -1, -1, 933, 934, -1, -1, -1, - 1067, 1068, -1, -1, -1, -1, -1, 426, 427, 428, - 429, 430, 431, 432, 433, 434, 435, 436, 1221, -1, - -1, 197, 198, -1, -1, -1, 1229, -1, -1, 1232, - -1, 207, 208, 452, -1, -1, -1, -1, -1, -1, - -1, -1, 461, 7, -1, -1, 10, -1, -1, -1, - 14, 15, 16, 17, 1522, 19, 1524, 21, 22, -1, - -1, 25, -1, -1, -1, -1, -1, -1, 244, 33, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, - 54, 1050, 56, -1, -1, -1, -1, 61, -1, -1, - -1, -1, -1, -1, -1, 281, -1, -1, -1, -1, - -1, -1, 1050, -1, -1, -1, -1, -1, -1, 295, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 1334, -1, 1336, -1, -1, -1, 1340, 1097, 1342, - -1, 1100, 1345, -1, 1347, -1, -1, -1, 1107, -1, - -1, -1, -1, -1, 1113, -1, -1, 1116, 1117, 1097, - -1, -1, 1100, -1, -1, 1124, -1, -1, -1, 1107, - -1, -1, -1, -1, -1, 1113, -1, -1, 1116, 1117, - -1, -1, -1, -1, -1, -1, 1124, 494, 495, 496, - 497, 498, 499, 500, 501, 502, 503, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 1182, 531, -1, -1, -1, 535, -1, - -1, -1, -1, 540, 541, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1182, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 1458, -1, -1, -1, -1, - -1, -1, 1221, -1, -1, -1, -1, -1, -1, -1, - 1229, -1, -1, 1232, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 1221, -1, -1, -1, -1, -1, -1, - -1, 1229, -1, -1, 1232, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 1515, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 842, -1, 844, 845, -1, 847, -1, - -1, -1, 1391, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 1391, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 1458, - -1, 920, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 938, - 1458, 940, 941, 942, 943, 944, 945, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 1051, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 1067, 1068 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint16 yystos[] = -{ - 0, 116, 298, 3, 187, 245, 300, 549, 551, 663, - 764, 0, 550, 764, 549, 664, 764, 118, 302, 111, - 295, 297, 395, 6, 261, 665, 695, 765, 4, 766, - 117, 301, 131, 396, 423, 426, 549, 552, 764, 698, - 765, 297, 766, 766, 161, 488, 423, 427, 158, 397, - 483, 297, 395, 766, 297, 160, 487, 489, 299, 80, - 81, 88, 89, 94, 120, 135, 218, 238, 268, 281, - 288, 297, 333, 334, 349, 350, 359, 407, 439, 609, - 650, 711, 737, 754, 11, 12, 13, 29, 30, 31, - 58, 59, 60, 484, 205, 398, 587, 297, 766, 297, - 350, 107, 124, 163, 258, 297, 350, 384, 416, 495, - 690, 737, 766, 766, 115, 670, 766, 351, 20, 50, - 57, 360, 20, 50, 57, 408, 766, 766, 551, 652, - 766, 738, 764, 126, 275, 332, 419, 728, 297, 35, - 36, 37, 38, 43, 44, 45, 46, 588, 206, 399, - 589, 297, 388, 551, 493, 551, 493, 691, 766, 297, - 766, 670, 297, 765, 297, 297, 766, 297, 77, 149, - 182, 199, 222, 260, 327, 468, 538, 576, 614, 651, - 696, 729, 297, 5, 297, 445, 764, 765, 766, 767, - 297, 297, 297, 297, 241, 620, 297, 84, 339, 385, - 301, 301, 294, 297, 350, 737, 762, 327, 766, 670, - 327, 328, 469, 539, 577, 615, 697, 210, 279, 297, - 350, 596, 650, 734, 446, 766, 297, 341, 552, 297, - 350, 650, 690, 737, 267, 417, 709, 496, 709, 270, - 715, 763, 297, 297, 297, 297, 78, 297, 327, 329, - 332, 150, 297, 466, 468, 766, 183, 184, 297, 538, - 540, 542, 543, 670, 201, 297, 576, 578, 670, 223, - 297, 614, 616, 620, 297, 695, 696, 765, 765, 7, - 10, 14, 15, 16, 17, 19, 21, 22, 25, 33, - 42, 48, 54, 56, 61, 735, 295, 445, 764, 765, - 766, 766, 164, 340, 497, 200, 580, 710, 83, 297, - 336, 350, 690, 737, 297, 336, 350, 690, 737, 766, - 73, 99, 237, 297, 320, 350, 368, 646, 650, 737, - 330, 332, 467, 766, 541, 542, 276, 277, 544, 670, - 730, 731, 579, 670, 617, 620, 297, 297, 297, 494, - 552, 297, 581, 125, 129, 220, 253, 297, 350, 389, - 418, 420, 680, 737, 338, 551, 766, 765, 765, 765, - 297, 395, 297, 395, 297, 395, 297, 297, 544, 297, - 395, 297, 395, 297, 140, 247, 297, 350, 449, 669, - 491, 551, 421, 422, 551, 390, 681, 85, 337, 342, - 766, 297, 282, 369, 741, 647, 741, 544, 670, 670, - 423, 142, 297, 333, 334, 349, 350, 359, 407, 439, - 451, 609, 650, 711, 737, 754, 119, 128, 133, 134, - 152, 154, 197, 198, 207, 208, 244, 297, 350, 405, - 420, 432, 435, 437, 472, 476, 572, 574, 590, 592, - 661, 737, 177, 297, 350, 526, 737, 23, 49, 55, - 343, 283, 285, 297, 350, 650, 690, 737, 742, 746, - 766, 765, 297, 297, 297, 670, 670, 297, 109, 132, - 153, 155, 209, 278, 391, 428, 434, 452, 474, 478, - 594, 732, 551, 668, 668, 668, 668, 668, 668, 668, - 668, 668, 668, 668, 516, 527, 551, 297, 551, 748, - 747, 766, 297, 297, 734, 392, 428, 434, 423, 428, - 434, 475, 428, 434, 479, 766, 428, 434, 733, 297, - 130, 424, 424, 424, 424, 424, 424, 424, 573, 424, - 424, 424, 424, 79, 91, 96, 112, 156, 171, 172, - 246, 262, 289, 291, 297, 331, 350, 354, 363, 400, - 480, 512, 514, 650, 666, 699, 737, 755, 757, 287, - 752, 145, 147, 189, 193, 227, 235, 297, 350, 458, - 462, 555, 563, 625, 640, 737, 766, 297, 297, 428, - 434, 429, 497, 297, 428, 434, 297, 428, 434, 595, - 297, 428, 434, 423, 425, 428, 434, 424, 71, 72, - 76, 123, 139, 162, 254, 318, 319, 324, 415, 433, - 448, 492, 656, 682, 436, 656, 682, 438, 656, 682, - 424, 477, 656, 682, 297, 350, 737, 575, 656, 682, - 424, 424, 185, 242, 545, 657, 662, 332, 517, 552, - 542, 401, 297, 513, 515, 667, 517, 542, 517, 8, - 18, 24, 28, 32, 39, 41, 51, 52, 53, 753, - 151, 470, 743, 148, 456, 459, 463, 194, 556, 567, - 564, 236, 626, 644, 641, 297, 297, 359, 297, 406, - 656, 682, 670, 670, 318, 325, 448, 670, 670, 670, - 656, 683, 297, 350, 737, 297, 350, 737, 297, 350, - 737, 473, 656, 682, 297, 350, 737, 297, 350, 737, - 591, 656, 682, 593, 656, 682, 546, 658, 297, 350, - 737, 297, 297, 297, 297, 517, 297, 517, 297, 517, - 297, 517, 297, 297, 297, 297, 471, 93, 297, 350, - 355, 650, 690, 737, 181, 465, 536, 552, 108, 271, - 297, 350, 386, 650, 716, 146, 297, 350, 456, 460, - 737, 536, 552, 566, 95, 191, 297, 350, 361, 559, - 650, 192, 297, 350, 561, 567, 737, 536, 552, 643, - 62, 100, 101, 102, 103, 229, 297, 303, 350, 370, - 372, 374, 376, 386, 629, 650, 230, 297, 350, 631, - 644, 737, 297, 297, 350, 737, 297, 297, 319, 326, - 492, 297, 297, 297, 297, 297, 350, 737, 297, 350, - 737, 297, 350, 737, 297, 657, 297, 656, 682, 69, - 157, 186, 213, 219, 226, 228, 240, 252, 263, 292, - 297, 315, 350, 386, 481, 547, 602, 610, 623, 627, - 650, 654, 678, 700, 716, 737, 758, 356, 552, 286, - 456, 457, 750, 387, 695, 765, 106, 382, 717, 461, - 456, 567, 568, 750, 362, 466, 766, 382, 562, 456, - 644, 645, 750, 304, 540, 542, 371, 578, 670, 373, - 578, 670, 375, 578, 670, 377, 578, 670, 382, 632, - 297, 68, 70, 74, 314, 316, 317, 321, 482, 548, - 67, 312, 551, 739, 611, 312, 551, 624, 642, 642, - 655, 551, 677, 679, 701, 759, 82, 90, 127, 136, - 144, 175, 188, 190, 202, 211, 231, 250, 293, 297, - 335, 350, 352, 430, 440, 454, 522, 553, 557, 582, - 597, 633, 673, 678, 716, 737, 760, 537, 766, 552, - 749, 297, 297, 9, 34, 47, 383, 137, 217, 297, - 350, 443, 607, 737, 297, 456, 297, 297, 104, 378, - 560, 297, 566, 567, 297, 297, 297, 297, 297, 297, - 167, 378, 502, 630, 297, 643, 644, 221, 612, 256, - 686, 297, 297, 350, 737, 138, 233, 297, 447, 637, - 644, 297, 481, 637, 644, 758, 551, 729, 196, 297, - 570, 610, 644, 110, 280, 297, 303, 350, 370, 372, - 374, 376, 386, 393, 629, 650, 736, 737, 166, 500, - 628, 159, 215, 239, 297, 335, 350, 352, 430, 454, - 485, 600, 633, 648, 650, 737, 65, 234, 290, 297, - 309, 350, 639, 737, 756, 64, 212, 297, 307, 335, - 350, 352, 430, 454, 485, 599, 600, 633, 648, 650, - 737, 297, 481, 637, 644, 243, 659, 353, 422, 426, - 431, 441, 643, 644, 312, 464, 551, 523, 642, 312, - 551, 565, 565, 583, 642, 464, 598, 634, 643, 644, - 674, 765, 274, 726, 761, 297, 766, 339, 751, 297, - 269, 444, 712, 378, 608, 379, 540, 542, 75, 273, - 297, 322, 724, 503, 540, 542, 297, 322, 724, 613, - 297, 264, 687, 702, 297, 643, 638, 766, 603, 734, - 571, 26, 27, 40, 394, 297, 501, 297, 350, 650, - 737, 486, 490, 764, 536, 552, 601, 740, 552, 649, - 653, 98, 310, 366, 642, 516, 308, 695, 765, 659, - 620, 297, 297, 307, 335, 350, 430, 454, 650, 737, - 87, 113, 204, 216, 225, 251, 297, 347, 350, 402, - 585, 605, 621, 659, 675, 737, 265, 442, 644, 704, - 284, 455, 744, 750, 297, 350, 650, 737, 481, 554, - 165, 498, 558, 297, 350, 650, 736, 737, 297, 335, - 350, 352, 454, 553, 557, 599, 633, 737, 92, 297, - 350, 352, 357, 430, 454, 485, 648, 650, 737, 297, - 454, 673, 765, 727, 63, 168, 179, 297, 305, 350, - 440, 504, 530, 737, 297, 122, 203, 413, 584, 713, - 297, 413, 297, 413, 297, 170, 173, 323, 510, 517, - 518, 510, 517, 518, 725, 503, 257, 297, 688, 703, - 297, 297, 297, 643, 644, 313, 766, 297, 297, 610, - 644, 297, 297, 623, 627, 297, 395, 297, 395, 297, - 395, 766, 169, 174, 297, 350, 508, 520, 737, 637, - 670, 297, 297, 620, 660, 620, 403, 620, 97, 364, - 586, 224, 606, 618, 618, 622, 364, 676, 705, 297, - 378, 502, 745, 214, 232, 272, 297, 350, 386, 604, - 635, 650, 716, 718, 737, 297, 350, 352, 361, 430, - 454, 553, 559, 650, 737, 499, 297, 350, 352, 430, - 650, 737, 358, 430, 86, 143, 259, 297, 344, 453, - 692, 306, 542, 505, 643, 644, 531, 643, 644, 414, - 561, 567, 631, 637, 644, 413, 114, 404, 413, 584, - 714, 511, 519, 297, 725, 297, 689, 702, 297, 718, - 297, 367, 404, 509, 637, 643, 644, 521, 637, 643, - 644, 297, 178, 528, 297, 650, 620, 297, 650, 365, - 297, 650, 619, 297, 650, 297, 650, 297, 650, 121, - 266, 297, 409, 706, 297, 744, 750, 740, 636, 643, - 644, 248, 671, 719, 297, 553, 297, 345, 637, 643, - 644, 297, 637, 643, 644, 693, 297, 350, 440, 504, - 530, 737, 176, 506, 524, 644, 704, 378, 502, 532, - 297, 322, 724, 670, 670, 297, 141, 297, 450, 517, - 518, 297, 510, 517, 297, 255, 297, 684, 297, 297, - 528, 297, 528, 529, 297, 348, 66, 297, 311, 620, - 297, 620, 180, 344, 410, 533, 692, 195, 524, 569, - 644, 704, 707, 729, 297, 303, 350, 370, 372, 374, - 376, 386, 629, 650, 736, 737, 766, 249, 672, 720, - 322, 346, 724, 404, 694, 517, 378, 502, 507, 297, - 297, 297, 297, 750, 297, 450, 510, 517, 518, 297, - 650, 620, 534, 637, 643, 644, 411, 524, 569, 644, - 704, 297, 378, 502, 708, 297, 766, 766, 105, 380, - 721, 297, 297, 322, 724, 497, 525, 297, 685, 718, - 620, 510, 517, 518, 535, 378, 412, 502, 297, 297, - 766, 381, 587, 722, 297, 297, 620, 297, 297, 297, - 297, 620, 589, 723, 297, 297 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint16 yyr1[] = -{ - 0, 296, 297, 298, 299, 299, 299, 299, 299, 299, - 299, 300, 301, 302, 303, 304, 304, 305, 306, 306, - 306, 306, 306, 306, 307, 308, 308, 309, 310, 310, - 310, 310, 310, 311, 312, 313, 313, 314, 315, 316, - 316, 316, 316, 316, 317, 318, 319, 320, 321, 322, - 323, 323, 323, 324, 325, 325, 326, 326, 327, 328, - 328, 328, 328, 329, 330, 330, 331, 332, 332, 333, - 334, 335, 336, 337, 337, 337, 337, 337, 337, 337, - 338, 339, 340, 340, 341, 342, 343, 343, 343, 344, - 345, 345, 345, 346, 346, 346, 347, 348, 348, 349, - 350, 351, 351, 352, 353, 353, 353, 353, 353, 353, - 353, 353, 354, 355, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 357, 358, 358, 359, 360, 360, 360, 361, - 362, 362, 363, 364, 365, 365, 365, 366, 367, 367, - 368, 369, 369, 370, 371, 371, 372, 373, 373, 374, - 375, 375, 376, 377, 377, 378, 379, 379, 380, 381, - 381, 382, 383, 383, 383, 384, 385, 385, 385, 385, - 385, 386, 387, 387, 388, 389, 390, 390, 390, 390, - 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, - 390, 391, 392, 392, 392, 392, 393, 394, 394, 394, - 395, 396, 396, 397, 397, 398, 398, 399, 399, 400, - 401, 401, 402, 403, 403, 404, 405, 406, 406, 406, - 406, 407, 408, 408, 408, 409, 410, 410, 410, 411, - 411, 411, 411, 412, 412, 412, 413, 414, 414, 414, - 414, 414, 414, 414, 415, 416, 417, 417, 417, 417, - 417, 418, 419, 420, 421, 421, 421, 421, 421, 421, - 421, 421, 421, 421, 421, 421, 421, 421, 422, 423, - 424, 425, 425, 425, 426, 427, 427, 427, 427, 427, - 427, 427, 427, 427, 427, 427, 427, 427, 428, 429, - 429, 430, 431, 431, 431, 431, 431, 431, 431, 431, - 431, 431, 431, 432, 433, 433, 433, 433, 434, 434, - 434, 434, 434, 435, 436, 436, 436, 436, 437, 438, - 438, 438, 438, 439, 440, 441, 441, 442, 442, 442, - 442, 443, 444, 444, 445, 446, 446, 446, 446, 446, - 447, 448, 449, 450, 451, 452, 452, 453, 454, 455, - 455, 455, 455, 455, 455, 455, 455, 455, 455, 456, - 457, 457, 457, 458, 459, 459, 459, 459, 459, 460, - 461, 461, 462, 463, 463, 463, 463, 463, 464, 464, - 465, 465, 466, 467, 467, 468, 469, 469, 469, 469, - 470, 471, 471, 471, 471, 471, 471, 471, 471, 471, - 471, 471, 471, 471, 471, 471, 471, 471, 472, 473, - 473, 473, 473, 474, 475, 475, 475, 475, 476, 477, - 477, 477, 477, 478, 479, 479, 480, 481, 482, 482, - 482, 482, 483, 484, 484, 484, 484, 484, 484, 484, - 484, 484, 485, 486, 486, 487, 488, 489, 489, 490, - 491, 492, 493, 494, 495, 496, 496, 496, 496, 496, - 497, 498, 499, 499, 500, 501, 501, 501, 502, 503, - 503, 504, 505, 505, 506, 506, 506, 507, 507, 507, - 508, 509, 509, 509, 509, 510, 511, 511, 511, 511, - 512, 513, 513, 514, 515, 515, 516, 517, 518, 519, - 519, 519, 520, 521, 521, 521, 521, 522, 523, 523, - 523, 523, 524, 525, 525, 526, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 528, 529, 529, 529, 529, 529, 530, 531, 531, - 532, 532, 532, 533, 534, 534, 534, 535, 535, 535, - 536, 537, 537, 538, 539, 539, 539, 539, 540, 541, - 541, 542, 542, 543, 544, 544, 544, 545, 546, 546, - 547, 548, 548, 548, 548, 548, 549, 550, 550, 551, - 551, 551, 552, 552, 553, 554, 554, 554, 554, 554, - 554, 554, 554, 554, 554, 555, 556, 556, 556, 556, - 556, 557, 558, 558, 558, 558, 558, 558, 559, 560, - 560, 560, 561, 562, 562, 562, 563, 564, 564, 564, - 564, 564, 565, 565, 566, 566, 567, 568, 568, 568, - 568, 569, 570, 571, 571, 571, 572, 573, 573, 573, - 574, 575, 575, 575, 575, 576, 577, 577, 577, 577, - 578, 579, 579, 580, 581, 581, 581, 581, 582, 583, - 583, 583, 583, 583, 584, 585, 586, 586, 587, 588, - 588, 588, 588, 588, 588, 588, 588, 589, 590, 591, - 591, 591, 591, 592, 593, 593, 593, 593, 594, 595, - 595, 596, 597, 598, 598, 598, 598, 598, 598, 598, - 598, 598, 598, 599, 600, 601, 601, 602, 603, 603, - 604, 605, 606, 606, 607, 608, 608, 609, 610, 611, - 611, 611, 611, 612, 613, 613, 614, 615, 615, 615, - 615, 616, 617, 617, 618, 619, 619, 620, 621, 622, - 622, 623, 624, 624, 624, 624, 624, 624, 624, 624, - 624, 624, 624, 624, 624, 625, 626, 626, 626, 626, - 626, 626, 626, 626, 626, 626, 627, 628, 628, 628, - 628, 629, 630, 630, 630, 630, 631, 632, 632, 632, - 633, 634, 634, 634, 634, 634, 634, 634, 634, 634, - 634, 634, 635, 636, 636, 636, 636, 636, 636, 636, - 636, 636, 636, 636, 636, 636, 637, 638, 638, 638, - 639, 640, 641, 641, 641, 641, 641, 642, 642, 643, - 643, 644, 645, 645, 645, 645, 646, 647, 647, 648, - 649, 649, 650, 651, 651, 651, 651, 651, 652, 653, - 654, 655, 655, 655, 655, 655, 655, 655, 655, 655, - 655, 655, 655, 656, 656, 656, 656, 656, 656, 657, - 658, 658, 658, 659, 660, 660, 661, 662, 662, 662, - 662, 663, 664, 664, 665, 665, 666, 667, 667, 668, - 669, 670, 670, 671, 672, 673, 674, 674, 674, 674, - 675, 676, 676, 677, 678, 679, 679, 679, 679, 679, - 679, 680, 681, 681, 681, 681, 682, 683, 683, 684, - 685, 685, 686, 687, 687, 688, 689, 689, 690, 691, - 691, 691, 691, 692, 693, 693, 693, 694, 694, 694, - 695, 696, 697, 697, 697, 697, 698, 698, 699, 700, - 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, - 701, 701, 701, 701, 702, 703, 703, 704, 705, 705, - 705, 706, 707, 707, 707, 707, 708, 708, 708, 709, - 710, 710, 710, 710, 710, 710, 710, 711, 712, 713, - 713, 714, 714, 714, 715, 716, 717, 717, 717, 717, - 717, 718, 719, 719, 720, 720, 721, 721, 722, 722, - 723, 723, 724, 725, 725, 725, 726, 727, 727, 727, - 727, 728, 729, 729, 729, 729, 729, 729, 730, 731, - 732, 733, 733, 733, 733, 734, 735, 735, 735, 735, - 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, - 735, 735, 736, 737, 738, 738, 738, 738, 738, 739, - 739, 740, 740, 741, 742, 743, 743, 743, 743, 743, - 743, 744, 745, 745, 745, 746, 747, 747, 747, 747, - 747, 747, 747, 747, 747, 748, 749, 750, 751, 751, - 752, 753, 753, 753, 753, 753, 753, 753, 753, 753, - 753, 754, 755, 756, 757, 758, 759, 759, 759, 759, - 760, 761, 761, 761, 761, 761, 761, 761, 762, 763, - 763, 763, 763, 763, 763, 763, 764, 765, 766, 767 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 7, 0, 2, 2, 2, 2, 2, - 2, 1, 3, 5, 3, 1, 1, 3, 1, 2, - 2, 2, 2, 2, 3, 1, 1, 3, 1, 2, - 2, 2, 2, 5, 5, 0, 1, 3, 3, 1, - 1, 1, 2, 2, 3, 3, 3, 3, 2, 3, - 1, 1, 1, 4, 1, 1, 1, 1, 3, 0, - 2, 2, 2, 3, 1, 2, 3, 1, 1, 5, - 3, 3, 4, 1, 2, 2, 2, 2, 2, 2, - 1, 4, 0, 1, 1, 3, 1, 1, 1, 4, - 1, 1, 1, 0, 1, 1, 5, 0, 2, 5, - 3, 0, 2, 3, 0, 2, 2, 2, 2, 2, - 2, 2, 3, 3, 0, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 3, 0, 1, 3, 1, 1, 1, 3, - 1, 1, 3, 3, 0, 2, 2, 4, 0, 1, - 4, 0, 1, 3, 1, 1, 3, 1, 1, 3, - 1, 1, 3, 1, 1, 3, 1, 1, 3, 0, - 2, 3, 1, 1, 1, 4, 1, 2, 2, 2, - 2, 3, 1, 1, 1, 3, 0, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 3, 1, 1, 2, 2, 3, 1, 1, 1, - 6, 1, 1, 0, 1, 0, 1, 0, 1, 3, - 0, 2, 3, 1, 2, 3, 6, 1, 1, 2, - 2, 3, 1, 1, 1, 5, 1, 1, 1, 1, - 1, 1, 1, 0, 1, 1, 3, 1, 1, 1, - 1, 1, 2, 2, 3, 5, 1, 2, 2, 2, - 2, 4, 2, 3, 1, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, - 3, 1, 1, 1, 3, 1, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 4, 0, - 1, 3, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 5, 1, 1, 2, 2, 1, 1, - 1, 1, 1, 5, 1, 1, 2, 2, 5, 1, - 1, 2, 2, 5, 4, 1, 1, 1, 1, 2, - 2, 3, 1, 2, 3, 0, 2, 2, 2, 2, - 3, 3, 4, 2, 3, 1, 1, 2, 4, 1, - 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, - 0, 1, 1, 3, 1, 2, 2, 2, 2, 3, - 0, 2, 3, 0, 2, 2, 2, 2, 1, 1, - 1, 1, 3, 1, 2, 3, 0, 2, 2, 2, - 3, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 6, 1, - 1, 2, 2, 3, 1, 1, 2, 2, 5, 1, - 1, 2, 2, 3, 1, 1, 2, 3, 0, 2, - 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 1, 2, 3, 3, 1, 2, 1, - 1, 3, 1, 1, 5, 1, 2, 2, 2, 2, - 3, 3, 0, 2, 3, 0, 2, 2, 4, 1, - 1, 5, 1, 1, 1, 1, 1, 0, 1, 1, - 3, 1, 1, 1, 2, 3, 0, 2, 2, 2, - 3, 0, 2, 3, 0, 2, 1, 1, 3, 0, - 2, 2, 3, 1, 1, 1, 2, 3, 1, 2, - 2, 2, 4, 0, 1, 3, 1, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 3, 0, 2, 2, 2, 2, 4, 1, 1, - 0, 1, 1, 4, 1, 1, 1, 1, 1, 1, - 4, 1, 2, 3, 0, 2, 2, 2, 3, 1, - 2, 1, 1, 5, 1, 1, 1, 3, 0, 2, - 3, 0, 2, 2, 2, 2, 3, 1, 2, 1, - 1, 1, 1, 1, 4, 1, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, - 2, 4, 1, 2, 2, 2, 2, 2, 4, 1, - 2, 2, 3, 0, 2, 2, 3, 0, 2, 2, - 2, 2, 1, 1, 1, 1, 4, 0, 1, 1, - 1, 2, 3, 0, 2, 2, 4, 1, 2, 2, - 5, 1, 1, 2, 2, 3, 0, 2, 2, 2, - 3, 1, 2, 3, 0, 2, 2, 2, 3, 1, - 2, 2, 2, 2, 4, 3, 1, 2, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 6, 1, - 1, 2, 2, 6, 1, 1, 2, 2, 5, 1, - 1, 3, 3, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 3, 1, 2, 5, 0, 1, - 4, 3, 1, 2, 3, 1, 2, 3, 3, 0, - 2, 2, 2, 3, 0, 2, 3, 0, 2, 2, - 2, 3, 1, 2, 3, 0, 2, 4, 3, 1, - 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 4, 1, 2, 2, - 2, 4, 1, 1, 2, 2, 3, 0, 2, 2, - 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 3, 0, 2, 2, - 4, 3, 0, 2, 2, 2, 2, 1, 1, 1, - 1, 4, 0, 1, 1, 1, 4, 0, 1, 3, - 1, 2, 4, 1, 2, 2, 2, 2, 1, 1, - 3, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 3, - 0, 2, 2, 4, 1, 2, 5, 1, 1, 2, - 2, 4, 1, 1, 1, 1, 3, 0, 2, 1, - 5, 1, 4, 4, 4, 3, 1, 2, 2, 2, - 3, 1, 2, 1, 3, 1, 2, 2, 2, 2, - 2, 3, 0, 2, 2, 2, 3, 0, 1, 4, - 0, 1, 3, 0, 1, 3, 1, 2, 3, 0, - 2, 2, 2, 4, 1, 1, 1, 1, 2, 2, - 3, 3, 0, 2, 2, 2, 1, 2, 3, 3, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 3, 0, 2, 3, 0, 2, - 2, 4, 1, 1, 1, 1, 0, 1, 1, 3, - 1, 2, 2, 2, 2, 2, 2, 3, 4, 1, - 1, 1, 1, 1, 8, 3, 1, 2, 2, 2, - 2, 7, 0, 1, 0, 1, 0, 1, 0, 1, - 0, 1, 4, 1, 1, 1, 3, 0, 2, 2, - 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, - 3, 1, 1, 2, 2, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 3, 1, 2, 2, 2, 2, 1, - 1, 1, 1, 3, 5, 1, 2, 2, 2, 2, - 2, 3, 0, 2, 2, 3, 0, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 1, 4, 0, 1, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 3, 5, 3, 3, 0, 2, 2, 2, - 3, 1, 2, 2, 2, 2, 2, 2, 3, 1, - 2, 2, 2, 2, 2, 2, 1, 1, 1, 1 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -{ - YYUSE (yyvaluep); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (void) -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 510 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { PopC(); } -#line 3373 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 11: -#line 525 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3379 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 12: -#line 528 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 3385 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 13: -#line 532 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-3].s)); free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 3391 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 25: -#line 556 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3397 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 34: -#line 573 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[-3].ps)); free((yyvsp[-2].s)); } -#line 3403 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 36: -#line 577 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3409 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 47: -#line 602 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 3415 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 69: -#line 650 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-3].s)); free((yyvsp[-2].s)); } -#line 3421 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 70: -#line 653 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 3427 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 80: -#line 671 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3433 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 84: -#line 681 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3439 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 91: -#line 696 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3445 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 102: -#line 719 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3451 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 140: -#line 779 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3457 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 147: -#line 794 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); } -#line 3463 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 150: -#line 801 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); } -#line 3469 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 182: -#line 871 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3475 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 184: -#line 875 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3481 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 240: -#line 979 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3487 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 247: -#line 992 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3493 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 278: -#line 1039 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3499 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 279: -#line 1042 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3505 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 333: -#line 1128 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-3].s)); free((yyvsp[-2].s)); } -#line 3511 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 336: -#line 1135 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3517 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 337: -#line 1138 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3523 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 344: -#line 1151 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); } -#line 3529 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 346: -#line 1155 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3535 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 347: -#line 1156 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3541 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 348: -#line 1157 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3547 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 369: -#line 1198 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[-2].s); } -#line 3553 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 371: -#line 1202 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3559 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 374: -#line 1209 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3565 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 381: -#line 1220 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3571 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 384: -#line 1227 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3577 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 388: -#line 1233 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3583 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 390: -#line 1237 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3589 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 393: -#line 1244 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3595 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 397: -#line 1252 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3601 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 408: -#line 1267 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { pair_list_free((yyvsp[0].pl)); } -#line 3607 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 437: -#line 1317 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.pl) = new_pair_list((yyvsp[-1].ps)); } -#line 3613 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 438: -#line 1320 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps)=NULL; } -#line 3619 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 439: -#line 1321 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyvsp[0].ps)->next = (yyvsp[-1].ps); (yyval.ps) = (yyvsp[0].ps); } -#line 3625 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 455: -#line 1347 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 3631 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 459: -#line 1357 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3637 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 460: -#line 1360 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3643 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 462: -#line 1366 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3649 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 463: -#line 1369 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3655 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 483: -#line 1411 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3661 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 484: -#line 1414 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3667 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 492: -#line 1428 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3673 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 506: -#line 1456 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3679 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 507: -#line 1459 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3685 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 514: -#line 1474 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3691 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 549: -#line 1529 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3697 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 555: -#line 1541 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3703 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 560: -#line 1550 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); } -#line 3709 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 561: -#line 1553 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3715 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 562: -#line 1554 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3721 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 582: -#line 1596 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3727 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 585: -#line 1599 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { pair_list_free((yyvsp[0].pl)); } -#line 3733 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 586: -#line 1602 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[-1].s); } -#line 3739 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 587: -#line 1605 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3745 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 589: -#line 1609 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps) = new_str_pair((yyvsp[0].s),NULL); } -#line 3751 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 590: -#line 1610 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps) = new_str_pair((yyvsp[0].s),NULL); } -#line 3757 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 591: -#line 1611 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps)=(yyvsp[0].ps); } -#line 3763 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 592: -#line 1614 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3769 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 593: -#line 1615 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3775 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 594: -#line 1618 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { define_pcb_net((yyvsp[-2].ps), (yyvsp[-1].pl)); } -#line 3781 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 595: -#line 1621 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.pl)=(yyvsp[0].pl); } -#line 3787 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 611: -#line 1643 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[-2].ps)); } -#line 3793 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 632: -#line 1680 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps)=(yyvsp[0].ps); } -#line 3799 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 633: -#line 1681 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps)=NULL; } -#line 3805 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 634: -#line 1685 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3811 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 639: -#line 1694 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3817 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 644: -#line 1705 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3823 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 698: -#line 1807 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-3].s)); } -#line 3829 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 701: -#line 1814 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 3835 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 727: -#line 1866 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 3841 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 730: -#line 1873 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3847 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 747: -#line 1908 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 3853 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 766: -#line 1939 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3859 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 789: -#line 1974 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3865 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 791: -#line 1980 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3871 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 803: -#line 1996 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3877 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 818: -#line 2015 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3883 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 823: -#line 2026 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3889 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 827: -#line 2032 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3895 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 829: -#line 2036 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3901 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 831: -#line 2041 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].ps)) - { - (yyval.ps) = new_str_pair((yyvsp[-1].ps)->str1,(yyvsp[-2].s)); - free((yyvsp[-1].ps)); - } - else - { - /* handle port with no instance by passing up the chain */ - (yyval.ps) = new_str_pair(NULL,(yyvsp[-2].s)); - } -} -#line 3918 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 832: -#line 2055 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps)=NULL; } -#line 3924 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 833: -#line 2056 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps)=(yyvsp[0].ps); } -#line 3930 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 834: -#line 2057 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps) = new_str_pair((yyvsp[0].s),NULL); } -#line 3936 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 835: -#line 2058 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps)=NULL; } -#line 3942 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 848: -#line 2085 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3948 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 849: -#line 2088 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3954 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 881: -#line 2141 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.ps) = new_str_pair((yyvsp[-2].s),(yyvsp[-1].s)); } -#line 3960 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 882: -#line 2144 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3966 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 883: -#line 2145 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3972 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 884: -#line 2148 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 3978 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 885: -#line 2149 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=NULL; } -#line 3984 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 889: -#line 2159 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 3990 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 891: -#line 2165 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 3996 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 892: -#line 2166 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4002 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 893: -#line 2169 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4008 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 894: -#line 2172 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4014 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 896: -#line 2178 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4020 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 898: -#line 2180 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4026 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 903: -#line 2191 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 4032 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 935: -#line 2255 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 4038 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 943: -#line 2271 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4044 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 946: -#line 2276 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4050 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 973: -#line 2321 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 4056 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 987: -#line 2343 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 4062 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 994: -#line 2359 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-6].s)); free((yyvsp[-5].s)); free((yyvsp[-4].s)); free((yyvsp[-3].s)); free((yyvsp[-2].s)); free((yyvsp[-1].s)); } -#line 4068 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1054: -#line 2466 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4074 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1055: -#line 2467 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4080 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1056: -#line 2468 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4086 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1057: -#line 2469 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4092 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1059: -#line 2473 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 4098 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1061: -#line 2477 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4104 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1063: -#line 2481 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[-1].s)); } -#line 4110 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1085: -#line 2517 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 4116 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1086: -#line 2520 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { free((yyvsp[0].s)); } -#line 4122 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1107: -#line 2561 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { str_pair_free((yyvsp[0].ps)); } -#line 4128 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1109: -#line 2563 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { pair_list_free((yyvsp[0].pl)); } -#line 4134 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1126: -#line 2590 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 4140 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1127: -#line 2593 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 4146 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1128: -#line 2596 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 4152 "edif.tab.c" /* yacc.c:1646 */ - break; - - case 1129: -#line 2599 "../../src_plugins/import_edif/edif.y" /* yacc.c:1646 */ - { (yyval.s)=(yyvsp[0].s); } -#line 4158 "edif.tab.c" /* yacc.c:1646 */ - break; - - -#line 4162 "edif.tab.c" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} -#line 2602 "../../src_plugins/import_edif/edif.y" /* yacc.c:1906 */ - -/* - * xmalloc: - * - * Garbage function for 'alloca()'. - */ -char *xmalloc(int siz) -{ - return ((char *)Malloc(siz)); -} -/* - * Token & context carriers: - * - * These are the linkage pointers for threading this context garbage - * for converting identifiers into parser tokens. - */ -typedef struct TokenCar { - struct TokenCar *Next; /* pointer to next carrier */ - struct Token *Token; /* associated token */ -} TokenCar; -typedef struct UsedCar { - struct UsedCar *Next; /* pointer to next carrier */ - short Code; /* used '%token' value */ -} UsedCar; -typedef struct ContextCar { - struct ContextCar *Next; /* pointer to next carrier */ - struct Context *Context; /* associated context */ - union { - int Single; /* single usage flag (context tree) */ - struct UsedCar *Used; /* single used list (context stack) */ - } u; -} ContextCar; -/* - * Token definitions: - * - * This associates the '%token' codings with strings which are to - * be free standing tokens. Doesn't have to be in sorted order but the - * strings must be in lower case. - */ -typedef struct Token { - const char *Name; /* token name */ - int Code; /* '%token' value */ - struct Token *Next; /* hash table linkage */ -} Token; -static Token TokenDef[] = { - {"angle", EDIF_TOK_ANGLE}, - {"behavior", EDIF_TOK_BEHAVIOR}, - {"calculated", EDIF_TOK_CALCULATED}, - {"capacitance", EDIF_TOK_CAPACITANCE}, - {"centercenter", EDIF_TOK_CENTERCENTER}, - {"centerleft", EDIF_TOK_CENTERLEFT}, - {"centerright", EDIF_TOK_CENTERRIGHT}, - {"charge", EDIF_TOK_CHARGE}, - {"conductance", EDIF_TOK_CONDUCTANCE}, - {"current", EDIF_TOK_CURRENT}, - {"distance", EDIF_TOK_DISTANCE}, - {"document", EDIF_TOK_DOCUMENT}, - {"energy", EDIF_TOK_ENERGY}, - {"extend", EDIF_TOK_EXTEND}, - {"flux", EDIF_TOK_FLUX}, - {"frequency", EDIF_TOK_FREQUENCY}, - {"generic", EDIF_TOK_GENERIC}, - {"graphic", EDIF_TOK_GRAPHIC}, - {"inductance", EDIF_TOK_INDUCTANCE}, - {"inout", EDIF_TOK_INOUT}, - {"input", EDIF_TOK_INPUT}, - {"logicmodel", EDIF_TOK_LOGICMODEL}, - {"lowercenter", EDIF_TOK_LOWERCENTER}, - {"lowerleft", EDIF_TOK_LOWERLEFT}, - {"lowerright", EDIF_TOK_LOWERRIGHT}, - {"masklayout", EDIF_TOK_MASKLAYOUT}, - {"mass", EDIF_TOK_MASS}, - {"measured", EDIF_TOK_MEASURED}, - {"mx", EDIF_TOK_MX}, - {"mxr90", EDIF_TOK_MXR90}, - {"my", EDIF_TOK_MY}, - {"myr90", EDIF_TOK_MYR90}, - {"netlist", EDIF_TOK_NETLIST}, - {"output", EDIF_TOK_OUTPUT}, - {"pcblayout", EDIF_TOK_PCBLAYOUT}, - {"power", EDIF_TOK_POWER}, - {"r0", EDIF_TOK_R0}, - {"r180", EDIF_TOK_R180}, - {"r270", EDIF_TOK_R270}, - {"r90", EDIF_TOK_R90}, - {"required", EDIF_TOK_REQUIRED}, - {"resistance", EDIF_TOK_RESISTANCE}, - {"ripper", EDIF_TOK_RIPPER}, - {"round", EDIF_TOK_ROUND}, - {"schematic", EDIF_TOK_SCHEMATIC}, - {"stranger", EDIF_TOK_STRANGER}, - {"symbolic", EDIF_TOK_SYMBOLIC}, - {"temperature", EDIF_TOK_TEMPERATURE}, - {"tie", EDIF_TOK_TIE}, - {"time", EDIF_TOK_TIME}, - {"truncate", EDIF_TOK_TRUNCATE}, - {"uppercenter", EDIF_TOK_UPPERCENTER}, - {"upperleft", EDIF_TOK_UPPERLEFT}, - {"upperright", EDIF_TOK_UPPERRIGHT}, - {"voltage", EDIF_TOK_VOLTAGE} -}; -static int TokenDefSize = sizeof(TokenDef) / sizeof(Token); -/* - * Token enable definitions: - * - * There is one array for each set of tokens enabled by a - * particular context (barf). Another array is used to bind - * these arrays to a context. - */ -static short e_CellType[] = {EDIF_TOK_TIE, EDIF_TOK_RIPPER, EDIF_TOK_GENERIC}; -static short e_CornerType[] = {EDIF_TOK_EXTEND, EDIF_TOK_TRUNCATE, - EDIF_TOK_ROUND}; -static short e_Derivation[] = {EDIF_TOK_CALCULATED, EDIF_TOK_MEASURED, - EDIF_TOK_REQUIRED}; -static short e_Direction[] = {EDIF_TOK_INPUT, EDIF_TOK_OUTPUT, - EDIF_TOK_INOUT}; -static short e_EndType[] = {EDIF_TOK_EXTEND, EDIF_TOK_TRUNCATE, - EDIF_TOK_ROUND}; -static short e_Justify[] = {EDIF_TOK_CENTERCENTER, EDIF_TOK_CENTERLEFT, - EDIF_TOK_CENTERRIGHT, EDIF_TOK_LOWERCENTER, - EDIF_TOK_LOWERLEFT, EDIF_TOK_LOWERRIGHT, - EDIF_TOK_UPPERCENTER, EDIF_TOK_UPPERLEFT, - EDIF_TOK_UPPERRIGHT}; -static short e_Orientation[] = {EDIF_TOK_R0, EDIF_TOK_R90, EDIF_TOK_R180, - EDIF_TOK_R270, EDIF_TOK_MX, EDIF_TOK_MY, - EDIF_TOK_MXR90, EDIF_TOK_MYR90}; -static short e_Unit[] = {EDIF_TOK_DISTANCE, EDIF_TOK_CAPACITANCE, - EDIF_TOK_CURRENT, EDIF_TOK_RESISTANCE, - EDIF_TOK_TEMPERATURE, EDIF_TOK_TIME, - EDIF_TOK_VOLTAGE, EDIF_TOK_MASS, EDIF_TOK_FREQUENCY, - EDIF_TOK_INDUCTANCE, EDIF_TOK_ENERGY, - EDIF_TOK_POWER, EDIF_TOK_CHARGE, - EDIF_TOK_CONDUCTANCE, EDIF_TOK_FLUX, EDIF_TOK_ANGLE}; -static short e_ViewType[] = {EDIF_TOK_MASKLAYOUT, EDIF_TOK_PCBLAYOUT, - EDIF_TOK_NETLIST, EDIF_TOK_SCHEMATIC, - EDIF_TOK_SYMBOLIC, EDIF_TOK_BEHAVIOR, - EDIF_TOK_LOGICMODEL, EDIF_TOK_DOCUMENT, - EDIF_TOK_GRAPHIC, EDIF_TOK_STRANGER}; -/* - * Token tying table: - * - * This binds enabled tokens to a context. - */ -typedef struct Tie { - short *Enable; /* pointer to enable array */ - short Origin; /* '%token' value of context */ - short EnableSize; /* size of enabled array */ -} Tie; -#define TE(e,o) {e,o,sizeof(e)/sizeof(short)} -static Tie TieDef[] = { - TE(e_CellType, EDIF_TOK_CELLTYPE), - TE(e_CornerType, EDIF_TOK_CORNERTYPE), - TE(e_Derivation, EDIF_TOK_DERIVATION), - TE(e_Direction, EDIF_TOK_DIRECTION), - TE(e_EndType, EDIF_TOK_ENDTYPE), - TE(e_Justify, EDIF_TOK_JUSTIFY), - TE(e_Orientation, EDIF_TOK_ORIENTATION), - TE(e_Unit, EDIF_TOK_UNIT), - TE(e_ViewType, EDIF_TOK_VIEWTYPE) -}; -static int TieDefSize = sizeof(TieDef) / sizeof(Tie); -/* - * Context definitions: - * - * This associates keyword strings with '%token' values. It - * also creates a pretty much empty header for later building of - * the context tree. Again they needn't be sorted, but strings - * must be lower case. - */ -typedef struct Context { - const char *Name; /* keyword name */ - short Code; /* '%token' value */ - short Flags; /* special operation flags */ - struct ContextCar *Context; /* contexts which can be moved to */ - struct TokenCar *Token; /* active tokens */ - struct Context *Next; /* hash table linkage */ -} Context; -static Context ContextDef[] = { - {"", 0}, /* start context */ - {"acload", EDIF_TOK_ACLOAD}, - {"after", EDIF_TOK_AFTER}, - {"annotate", EDIF_TOK_ANNOTATE}, - {"apply", EDIF_TOK_APPLY}, - {"arc", EDIF_TOK_ARC}, - {"array", EDIF_TOK_ARRAY}, - {"arraymacro", EDIF_TOK_ARRAYMACRO}, - {"arrayrelatedinfo", EDIF_TOK_ARRAYRELATEDINFO}, - {"arraysite", EDIF_TOK_ARRAYSITE}, - {"atleast", EDIF_TOK_ATLEAST}, - {"atmost", EDIF_TOK_ATMOST}, - {"author", EDIF_TOK_AUTHOR}, - {"basearray", EDIF_TOK_BASEARRAY}, - {"becomes", EDIF_TOK_BECOMES}, - {"between", EDIF_TOK_BETWEEN}, - {"boolean", EDIF_TOK_BOOLEAN}, - {"booleandisplay", EDIF_TOK_BOOLEANDISPLAY}, - {"booleanmap", EDIF_TOK_BOOLEANMAP}, - {"borderpattern", EDIF_TOK_BORDERPATTERN}, - {"borderwidth", EDIF_TOK_BORDERWIDTH}, - {"boundingbox", EDIF_TOK_BOUNDINGBOX}, - {"cell", EDIF_TOK_CELL}, - {"cellref", EDIF_TOK_CELLREF}, - {"celltype", EDIF_TOK_CELLTYPE}, - {"change", EDIF_TOK_CHANGE}, - {"circle", EDIF_TOK_CIRCLE}, - {"color", EDIF_TOK_COLOR}, - {"comment", EDIF_TOK_COMMENT}, - {"commentgraphics", EDIF_TOK_COMMENTGRAPHICS}, - {"compound", EDIF_TOK_COMPOUND}, - {"connectlocation", EDIF_TOK_CONNECTLOCATION}, - {"contents", EDIF_TOK_CONTENTS}, - {"cornertype", EDIF_TOK_CORNERTYPE}, - {"criticality", EDIF_TOK_CRITICALITY}, - {"currentmap", EDIF_TOK_CURRENTMAP}, - {"curve", EDIF_TOK_CURVE}, - {"cycle", EDIF_TOK_CYCLE}, - {"dataorigin", EDIF_TOK_DATAORIGIN}, - {"dcfaninload", EDIF_TOK_DCFANINLOAD}, - {"dcfanoutload", EDIF_TOK_DCFANOUTLOAD}, - {"dcmaxfanin", EDIF_TOK_DCMAXFANIN}, - {"dcmaxfanout", EDIF_TOK_DCMAXFANOUT}, - {"delay", EDIF_TOK_DELAY}, - {"delta", EDIF_TOK_DELTA}, - {"derivation", EDIF_TOK_DERIVATION}, - {"design", EDIF_TOK_DESIGN}, - {"designator", EDIF_TOK_DESIGNATOR}, - {"difference", EDIF_TOK_DIFFERENCE}, - {"direction", EDIF_TOK_DIRECTION}, - {"display", EDIF_TOK_DISPLAY}, - {"dominates", EDIF_TOK_DOMINATES}, - {"dot", EDIF_TOK_DOT}, - {"duration", EDIF_TOK_DURATION}, - {"e", EDIF_TOK_E}, - {"edif", EDIF_TOK_EDIF}, - {"ediflevel", EDIF_TOK_EDIFLEVEL}, - {"edifversion", EDIF_TOK_EDIFVERSION}, - {"enclosuredistance", EDIF_TOK_ENCLOSUREDISTANCE}, - {"endtype", EDIF_TOK_ENDTYPE}, - {"entry", EDIF_TOK_ENTRY}, - {"exactly", EDIF_TOK_EXACTLY}, - {"external", EDIF_TOK_EXTERNAL}, - {"fabricate", EDIF_TOK_FABRICATE}, - {"false", EDIF_TOK_FALSE}, - {"figure", EDIF_TOK_FIGURE}, - {"figurearea", EDIF_TOK_FIGUREAREA}, - {"figuregroup", EDIF_TOK_FIGUREGROUP}, - {"figuregroupobject", EDIF_TOK_FIGUREGROUPOBJECT}, - {"figuregroupoverride", EDIF_TOK_FIGUREGROUPOVERRIDE}, - {"figuregroupref", EDIF_TOK_FIGUREGROUPREF}, - {"figureperimeter", EDIF_TOK_FIGUREPERIMETER}, - {"figurewidth", EDIF_TOK_FIGUREWIDTH}, - {"fillpattern", EDIF_TOK_FILLPATTERN}, - {"follow", EDIF_TOK_FOLLOW}, - {"forbiddenevent", EDIF_TOK_FORBIDDENEVENT}, - {"globalportref", EDIF_TOK_GLOBALPORTREF}, - {"greaterthan", EDIF_TOK_GREATERTHAN}, - {"gridmap", EDIF_TOK_GRIDMAP}, - {"ignore", EDIF_TOK_IGNORE}, - {"includefiguregroup", EDIF_TOK_INCLUDEFIGUREGROUP}, - {"initial", EDIF_TOK_INITIAL}, - {"instance", EDIF_TOK_INSTANCE}, - {"instancebackannotate", EDIF_TOK_INSTANCEBACKANNOTATE}, - {"instancegroup", EDIF_TOK_INSTANCEGROUP}, - {"instancemap", EDIF_TOK_INSTANCEMAP}, - {"instanceref", EDIF_TOK_INSTANCEREF}, - {"integer", EDIF_TOK_INTEGER}, - {"integerdisplay", EDIF_TOK_INTEGERDISPLAY}, - {"interface", EDIF_TOK_INTERFACE}, - {"interfiguregroupspacing", EDIF_TOK_INTERFIGUREGROUPSPACING}, - {"intersection", EDIF_TOK_INTERSECTION}, - {"intrafiguregroupspacing", EDIF_TOK_INTRAFIGUREGROUPSPACING}, - {"inverse", EDIF_TOK_INVERSE}, - {"isolated", EDIF_TOK_ISOLATED}, - {"joined", EDIF_TOK_JOINED}, - {"justify", EDIF_TOK_JUSTIFY}, - {"keyworddisplay", EDIF_TOK_KEYWORDDISPLAY}, - {"keywordlevel", EDIF_TOK_KEYWORDLEVEL}, - {"keywordmap", EDIF_TOK_KEYWORDMAP}, - {"lessthan", EDIF_TOK_LESSTHAN}, - {"library", EDIF_TOK_LIBRARY}, - {"libraryref", EDIF_TOK_LIBRARYREF}, - {"listofnets", EDIF_TOK_LISTOFNETS}, - {"listofports", EDIF_TOK_LISTOFPORTS}, - {"loaddelay", EDIF_TOK_LOADDELAY}, - {"logicassign", EDIF_TOK_LOGICASSIGN}, - {"logicinput", EDIF_TOK_LOGICINPUT}, - {"logiclist", EDIF_TOK_LOGICLIST}, - {"logicmapinput", EDIF_TOK_LOGICMAPINPUT}, - {"logicmapoutput", EDIF_TOK_LOGICMAPOUTPUT}, - {"logiconeof", EDIF_TOK_LOGICONEOF}, - {"logicoutput", EDIF_TOK_LOGICOUTPUT}, - {"logicport", EDIF_TOK_LOGICPORT}, - {"logicref", EDIF_TOK_LOGICREF}, - {"logicvalue", EDIF_TOK_LOGICVALUE}, - {"logicwaveform", EDIF_TOK_LOGICWAVEFORM}, - {"maintain", EDIF_TOK_MAINTAIN}, - {"match", EDIF_TOK_MATCH}, - {"member", EDIF_TOK_MEMBER}, - {"minomax", EDIF_TOK_MINOMAX}, - {"minomaxdisplay", EDIF_TOK_MINOMAXDISPLAY}, - {"mnm", EDIF_TOK_MNM}, - {"multiplevalueset", EDIF_TOK_MULTIPLEVALUESET}, - {"mustjoin", EDIF_TOK_MUSTJOIN}, - {"name", EDIF_TOK_NAME}, - {"net", EDIF_TOK_NET}, - {"netbackannotate", EDIF_TOK_NETBACKANNOTATE}, - {"netbundle", EDIF_TOK_NETBUNDLE}, - {"netdelay", EDIF_TOK_NETDELAY}, - {"netgroup", EDIF_TOK_NETGROUP}, - {"netmap", EDIF_TOK_NETMAP}, - {"netref", EDIF_TOK_NETREF}, - {"nochange", EDIF_TOK_NOCHANGE}, - {"nonpermutable", EDIF_TOK_NONPERMUTABLE}, - {"notallowed", EDIF_TOK_NOTALLOWED}, - {"notchspacing", EDIF_TOK_NOTCHSPACING}, - {"number", EDIF_TOK_NUMBER}, - {"numberdefinition", EDIF_TOK_NUMBERDEFINITION}, - {"numberdisplay", EDIF_TOK_NUMBERDISPLAY}, - {"offpageconnector", EDIF_TOK_OFFPAGECONNECTOR}, - {"offsetevent", EDIF_TOK_OFFSETEVENT}, - {"openshape", EDIF_TOK_OPENSHAPE}, - {"orientation", EDIF_TOK_ORIENTATION}, - {"origin", EDIF_TOK_ORIGIN}, - {"overhangdistance", EDIF_TOK_OVERHANGDISTANCE}, - {"overlapdistance", EDIF_TOK_OVERLAPDISTANCE}, - {"oversize", EDIF_TOK_OVERSIZE}, - {"owner", EDIF_TOK_OWNER}, - {"page", EDIF_TOK_PAGE}, - {"pagesize", EDIF_TOK_PAGESIZE}, - {"parameter", EDIF_TOK_PARAMETER}, - {"parameterassign", EDIF_TOK_PARAMETERASSIGN}, - {"parameterdisplay", EDIF_TOK_PARAMETERDISPLAY}, - {"path", EDIF_TOK_PATH}, - {"pathdelay", EDIF_TOK_PATHDELAY}, - {"pathwidth", EDIF_TOK_PATHWIDTH}, - {"permutable", EDIF_TOK_PERMUTABLE}, - {"physicaldesignrule", EDIF_TOK_PHYSICALDESIGNRULE}, - {"plug", EDIF_TOK_PLUG}, - {"point", EDIF_TOK_POINT}, - {"pointdisplay", EDIF_TOK_POINTDISPLAY}, - {"pointlist", EDIF_TOK_POINTLIST}, - {"polygon", EDIF_TOK_POLYGON}, - {"port", EDIF_TOK_PORT}, - {"portbackannotate", EDIF_TOK_PORTBACKANNOTATE}, - {"portbundle", EDIF_TOK_PORTBUNDLE}, - {"portdelay", EDIF_TOK_PORTDELAY}, - {"portgroup", EDIF_TOK_PORTGROUP}, - {"portimplementation", EDIF_TOK_PORTIMPLEMENTATION}, - {"portinstance", EDIF_TOK_PORTINSTANCE}, - {"portlist", EDIF_TOK_PORTLIST}, - {"portlistalias", EDIF_TOK_PORTLISTALIAS}, - {"portmap", EDIF_TOK_PORTMAP}, - {"portref", EDIF_TOK_PORTREF}, - {"program", EDIF_TOK_PROGRAM}, - {"property", EDIF_TOK_PROPERTY}, - {"propertydisplay", EDIF_TOK_PROPERTYDISPLAY}, - {"protectionframe", EDIF_TOK_PROTECTIONFRAME}, - {"pt", EDIF_TOK_PT}, - {"rangevector", EDIF_TOK_RANGEVECTOR}, - {"rectangle", EDIF_TOK_RECTANGLE}, - {"rectanglesize", EDIF_TOK_RECTANGLESIZE}, - {"rename", EDIF_TOK_RENAME}, - {"resolves", EDIF_TOK_RESOLVES}, - {"scale", EDIF_TOK_SCALE}, - {"scalex", EDIF_TOK_SCALEX}, - {"scaley", EDIF_TOK_SCALEY}, - {"section", EDIF_TOK_SECTION}, - {"shape", EDIF_TOK_SHAPE}, - {"simulate", EDIF_TOK_SIMULATE}, - {"simulationinfo", EDIF_TOK_SIMULATIONINFO}, - {"singlevalueset", EDIF_TOK_SINGLEVALUESET}, - {"site", EDIF_TOK_SITE}, - {"socket", EDIF_TOK_SOCKET}, - {"socketset", EDIF_TOK_SOCKETSET}, - {"status", EDIF_TOK_STATUS}, - {"steady", EDIF_TOK_STEADY}, - {"string", EDIF_TOK_STRING}, - {"stringdisplay", EDIF_TOK_STRINGDISPLAY}, - {"strong", EDIF_TOK_STRONG}, - {"symbol", EDIF_TOK_SYMBOL}, - {"symmetry", EDIF_TOK_SYMMETRY}, - {"table", EDIF_TOK_TABLE}, - {"tabledefault", EDIF_TOK_TABLEDEFAULT}, - {"technology", EDIF_TOK_TECHNOLOGY}, - {"textheight", EDIF_TOK_TEXTHEIGHT}, - {"timeinterval", EDIF_TOK_TIMEINTERVAL}, - {"timestamp", EDIF_TOK_TIMESTAMP}, - {"timing", EDIF_TOK_TIMING}, - {"transform", EDIF_TOK_TRANSFORM}, - {"transition", EDIF_TOK_TRANSITION}, - {"trigger", EDIF_TOK_TRIGGER}, - {"true", EDIF_TOK_TRUE}, - {"unconstrained", EDIF_TOK_UNCONSTRAINED}, - {"undefined", EDIF_TOK_UNDEFINED}, - {"union", EDIF_TOK_UNION}, - {"unit", EDIF_TOK_UNIT}, - {"unused", EDIF_TOK_UNUSED}, - {"userdata", EDIF_TOK_USERDATA}, - {"version", EDIF_TOK_VERSION}, - {"view", EDIF_TOK_VIEW}, - {"viewlist", EDIF_TOK_VIEWLIST}, - {"viewmap", EDIF_TOK_VIEWMAP}, - {"viewref", EDIF_TOK_VIEWREF}, - {"viewtype", EDIF_TOK_VIEWTYPE}, - {"visible", EDIF_TOK_VISIBLE}, - {"voltagemap", EDIF_TOK_VOLTAGEMAP}, - {"wavevalue", EDIF_TOK_WAVEVALUE}, - {"weak", EDIF_TOK_WEAK}, - {"weakjoined", EDIF_TOK_WEAKJOINED}, - {"when", EDIF_TOK_WHEN}, - {"written", EDIF_TOK_WRITTEN} -}; -static int ContextDefSize = sizeof(ContextDef) / sizeof(Context); -/* - * Context follower tables: - * - * This is pretty ugly, an array is defined for each context - * which has following context levels. Yet another table is used - * to bind these arrays to the originating contexts. - * Arrays are declared as: - * - * static short f_[] = { ... }; - * - * The array entries are the '%token' values for all keywords which - * can be reached from the context. Like I said, ugly, - * but it works. - * A negative entry means that the follow can only occur once within - * the specified context. - */ -static short f_NULL[] = {EDIF_TOK_EDIF}; -static short f_Edif[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_EDIFVERSION, - EDIF_TOK_EDIFLEVEL, EDIF_TOK_KEYWORDMAP, - -EDIF_TOK_STATUS, EDIF_TOK_EXTERNAL, - EDIF_TOK_LIBRARY, EDIF_TOK_DESIGN, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_AcLoad[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY}; -static short f_After[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_FOLLOW, - EDIF_TOK_MAINTAIN, EDIF_TOK_LOGICASSIGN, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Annotate[] = {EDIF_TOK_STRINGDISPLAY}; -static short f_Apply[] = {EDIF_TOK_CYCLE, EDIF_TOK_LOGICINPUT, - EDIF_TOK_LOGICOUTPUT, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Arc[] = {EDIF_TOK_PT}; -static short f_Array[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME}; -static short f_ArrayMacro[] = {EDIF_TOK_PLUG}; -static short f_ArrayRelatedInfo[] = {EDIF_TOK_BASEARRAY, EDIF_TOK_ARRAYSITE, - EDIF_TOK_ARRAYMACRO, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_ArraySite[] = {EDIF_TOK_SOCKET}; -static short f_AtLeast[] = {EDIF_TOK_E}; -static short f_AtMost[] = {EDIF_TOK_E}; -static short f_Becomes[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST, - EDIF_TOK_LOGICONEOF}; -/* -static short f_Between[] = {EDIF_TOK_ATLEAST, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_LESSTHAN}; -*/ -static short f_Boolean[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE, - EDIF_TOK_BOOLEANDISPLAY, EDIF_TOK_BOOLEAN}; -static short f_BooleanDisplay[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE, - EDIF_TOK_DISPLAY}; -static short f_BooleanMap[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE}; -static short f_BorderPattern[] = {EDIF_TOK_BOOLEAN}; -static short f_BoundingBox[] = {EDIF_TOK_RECTANGLE}; -static short f_Cell[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_CELLTYPE, - -EDIF_TOK_STATUS, -EDIF_TOK_VIEWMAP, EDIF_TOK_VIEW, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA, - EDIF_TOK_PROPERTY}; -static short f_CellRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF}; -static short f_Change[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_BECOMES, EDIF_TOK_TRANSITION}; -static short f_Circle[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY}; -static short f_Color[] = {EDIF_TOK_E}; -static short f_CommentGraphics[] = {EDIF_TOK_ANNOTATE, EDIF_TOK_FIGURE, - EDIF_TOK_INSTANCE, -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Compound[] = {EDIF_TOK_NAME}; -static short f_ConnectLocation[] = {EDIF_TOK_FIGURE}; -static short f_Contents[] = {EDIF_TOK_INSTANCE, EDIF_TOK_OFFPAGECONNECTOR, - EDIF_TOK_FIGURE, EDIF_TOK_SECTION, EDIF_TOK_NET, - EDIF_TOK_NETBUNDLE, EDIF_TOK_PAGE, - EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_PORTIMPLEMENTATION, - EDIF_TOK_TIMING, EDIF_TOK_SIMULATE, - EDIF_TOK_WHEN, EDIF_TOK_FOLLOW, - EDIF_TOK_LOGICPORT, -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Criticality[] = {EDIF_TOK_INTEGERDISPLAY}; -static short f_CurrentMap[] = {EDIF_TOK_MNM, EDIF_TOK_E}; -static short f_Curve[] = {EDIF_TOK_ARC, EDIF_TOK_PT}; -static short f_Cycle[] = {EDIF_TOK_DURATION}; -static short f_DataOrigin[] = {EDIF_TOK_VERSION}; -static short f_DcFanInLoad[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_DcFanOutLoad[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_DcMaxFanIn[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_DcMaxFanOut[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_Delay[] = {EDIF_TOK_MNM, EDIF_TOK_E}; -static short f_Delta[] = {EDIF_TOK_PT}; -static short f_Design[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_CELLREF, - EDIF_TOK_STATUS, EDIF_TOK_COMMENT, - EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA}; -static short f_Designator[] = {EDIF_TOK_STRINGDISPLAY}; -static short f_Difference[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE}; -static short f_Display[] = {EDIF_TOK_NAME, EDIF_TOK_FIGUREGROUPOVERRIDE, - EDIF_TOK_JUSTIFY, EDIF_TOK_ORIENTATION, - EDIF_TOK_ORIGIN}; -static short f_Dominates[] = {EDIF_TOK_NAME}; -static short f_Dot[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY}; -static short f_Duration[] = {EDIF_TOK_E}; -static short f_EnclosureDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Entry[] = {EDIF_TOK_MATCH, EDIF_TOK_CHANGE, EDIF_TOK_STEADY, - EDIF_TOK_LOGICREF, EDIF_TOK_PORTREF, - EDIF_TOK_NOCHANGE, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_Exactly[] = {EDIF_TOK_E}; -static short f_External[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_EDIFLEVEL, EDIF_TOK_TECHNOLOGY, - -EDIF_TOK_STATUS, EDIF_TOK_CELL, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Fabricate[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME}; -static short f_Figure[] = {EDIF_TOK_NAME, EDIF_TOK_FIGUREGROUPOVERRIDE, - EDIF_TOK_CIRCLE, EDIF_TOK_DOT, EDIF_TOK_OPENSHAPE, - EDIF_TOK_PATH, EDIF_TOK_POLYGON, - EDIF_TOK_RECTANGLE, EDIF_TOK_SHAPE, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_FigureArea[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_FigureGroup[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - -EDIF_TOK_CORNERTYPE, -EDIF_TOK_ENDTYPE, - -EDIF_TOK_PATHWIDTH, -EDIF_TOK_BORDERWIDTH, - -EDIF_TOK_COLOR, -EDIF_TOK_FILLPATTERN, - -EDIF_TOK_BORDERPATTERN, -EDIF_TOK_TEXTHEIGHT, - -EDIF_TOK_VISIBLE, EDIF_TOK_INCLUDEFIGUREGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_PROPERTY, - EDIF_TOK_USERDATA}; -static short f_FigureGroupObject[] = {EDIF_TOK_NAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_INTERSECTION, EDIF_TOK_UNION, - EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE, - EDIF_TOK_OVERSIZE}; -static short f_FigureGroupOverride[] = {EDIF_TOK_NAME, -EDIF_TOK_CORNERTYPE, - -EDIF_TOK_ENDTYPE, -EDIF_TOK_PATHWIDTH, - -EDIF_TOK_BORDERWIDTH, -EDIF_TOK_COLOR, - -EDIF_TOK_FILLPATTERN, - -EDIF_TOK_TEXTHEIGHT, - -EDIF_TOK_BORDERPATTERN, - EDIF_TOK_VISIBLE, EDIF_TOK_COMMENT, - EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA}; -static short f_FigureGroupRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF}; -static short f_FigurePerimeter[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_FigureWidth[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_FillPattern[] = {EDIF_TOK_BOOLEAN}; -static short f_Follow[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_ForbiddenEvent[] = {EDIF_TOK_TIMEINTERVAL, EDIF_TOK_EVENT}; -static short f_GlobalPortRef[] = {EDIF_TOK_NAME}; -static short f_GreaterThan[] = {EDIF_TOK_E}; -static short f_GridMap[] = {EDIF_TOK_E}; -static short f_IncludeFigureGroup[] = {EDIF_TOK_FIGUREGROUPREF, - EDIF_TOK_INTERSECTION, EDIF_TOK_UNION, - EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE, - EDIF_TOK_OVERSIZE}; -static short f_Instance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_VIEWREF, EDIF_TOK_VIEWLIST, - -EDIF_TOK_TRANSFORM, EDIF_TOK_PARAMETERASSIGN, - EDIF_TOK_PORTINSTANCE, EDIF_TOK_TIMING, - -EDIF_TOK_DESIGNATOR, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_InstanceBackAnnotate[] = {EDIF_TOK_INSTANCEREF, - -EDIF_TOK_DESIGNATOR, EDIF_TOK_TIMING, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT}; -static short f_InstanceGroup[] = {EDIF_TOK_INSTANCEREF}; -static short f_InstanceMap[] = {EDIF_TOK_INSTANCEREF, EDIF_TOK_INSTANCEGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_InstanceRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_INSTANCEREF, EDIF_TOK_VIEWREF}; -static short f_Integer[] = {EDIF_TOK_INTEGERDISPLAY, EDIF_TOK_INTEGER}; -static short f_IntegerDisplay[] = {EDIF_TOK_DISPLAY}; -static short f_Interface[] = {EDIF_TOK_PORT, EDIF_TOK_PORTBUNDLE, - -EDIF_TOK_SYMBOL, -EDIF_TOK_PROTECTIONFRAME, - -EDIF_TOK_ARRAYRELATEDINFO, EDIF_TOK_PARAMETER, - EDIF_TOK_JOINED, EDIF_TOK_MUSTJOIN, - EDIF_TOK_WEAKJOINED, EDIF_TOK_PERMUTABLE, - EDIF_TOK_TIMING, EDIF_TOK_SIMULATE, - -EDIF_TOK_DESIGNATOR, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_InterFigureGroupSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Intersection[] = {EDIF_TOK_FIGUREGROUPREF, - EDIF_TOK_INTERSECTION, EDIF_TOK_UNION, - EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE, - EDIF_TOK_OVERSIZE}; -static short f_IntraFigureGroupSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Inverse[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE}; -static short f_Joined[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_GLOBALPORTREF}; -static short f_KeywordDisplay[] = {EDIF_TOK_DISPLAY}; -static short f_KeywordMap[] = {EDIF_TOK_KEYWORDLEVEL, EDIF_TOK_COMMENT}; -static short f_LessThan[] = {EDIF_TOK_E}; -static short f_Library[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_EDIFLEVEL, - EDIF_TOK_TECHNOLOGY, -EDIF_TOK_STATUS, - EDIF_TOK_CELL, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_LibraryRef[] = {EDIF_TOK_NAME}; -static short f_ListOfNets[] = {EDIF_TOK_NET}; -static short f_ListOfPorts[] = {EDIF_TOK_PORT, EDIF_TOK_PORTBUNDLE}; -static short f_LoadDelay[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY}; -static short f_LogicAssign[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, - EDIF_TOK_LOGICREF, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_LogicInput[] = {EDIF_TOK_PORTLIST, EDIF_TOK_PORTREF, - EDIF_TOK_NAME, EDIF_TOK_LOGICWAVEFORM}; -static short f_LogicList[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICONEOF, - EDIF_TOK_IGNORE}; -static short f_LogicMapInput[] = {EDIF_TOK_LOGICREF}; -static short f_LogicMapOutput[] = {EDIF_TOK_LOGICREF}; -static short f_LogicOneOf[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST}; -static short f_LogicOutput[] = {EDIF_TOK_PORTLIST, EDIF_TOK_PORTREF, - EDIF_TOK_NAME, EDIF_TOK_LOGICWAVEFORM}; -static short f_LogicPort[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_LogicRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF}; -static short f_LogicValue[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - -EDIF_TOK_VOLTAGEMAP, -EDIF_TOK_CURRENTMAP, - -EDIF_TOK_BOOLEANMAP, -EDIF_TOK_COMPOUND, - -EDIF_TOK_WEAK ,-EDIF_TOK_STRONG, - -EDIF_TOK_DOMINATES, -EDIF_TOK_LOGICMAPOUTPUT, - -EDIF_TOK_LOGICMAPINPUT, - -EDIF_TOK_ISOLATED, EDIF_TOK_RESOLVES, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_LogicWaveform[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST, - EDIF_TOK_LOGICONEOF, EDIF_TOK_IGNORE}; -static short f_Maintain[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_DELAY, - EDIF_TOK_LOADDELAY}; -static short f_Match[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_LOGICLIST, EDIF_TOK_LOGICONEOF}; -static short f_Member[] = {EDIF_TOK_NAME}; -static short f_MiNoMax[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY, - EDIF_TOK_MINOMAX}; -static short f_MiNoMaxDisplay[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_DISPLAY}; -static short f_Mnm[] = {EDIF_TOK_E, EDIF_TOK_UNDEFINED, - EDIF_TOK_UNCONSTRAINED}; -static short f_MultipleValueSet[] = {EDIF_TOK_RANGEVECTOR}; -static short f_MustJoin[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_WEAKJOINED, EDIF_TOK_JOINED}; -static short f_Name[] = {EDIF_TOK_DISPLAY}; -static short f_Net[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, -EDIF_TOK_CRITICALITY, - EDIF_TOK_NETDELAY, EDIF_TOK_FIGURE, EDIF_TOK_NET, - EDIF_TOK_INSTANCE, EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA, EDIF_TOK_JOINED, EDIF_TOK_ARRAY}; -static short f_NetBackAnnotate[] = {EDIF_TOK_NETREF, EDIF_TOK_NETDELAY, - -EDIF_TOK_CRITICALITY, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT}; -static short f_NetBundle[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_LISTOFNETS, EDIF_TOK_FIGURE, - EDIF_TOK_COMMENTGRAPHICS, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_NetDelay[] = {EDIF_TOK_DERIVATION, EDIF_TOK_DELAY, - EDIF_TOK_TRANSITION, EDIF_TOK_BECOMES}; -static short f_NetGroup[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_NETREF}; -static short f_NetMap[] = {EDIF_TOK_NETREF, EDIF_TOK_NETGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_NetRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_NETREF, - EDIF_TOK_INSTANCEREF, EDIF_TOK_VIEWREF}; -static short f_NonPermutable[] = {EDIF_TOK_PORTREF, EDIF_TOK_PERMUTABLE}; -static short f_NotAllowed[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_NotchSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Number[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY, EDIF_TOK_NUMBER}; -static short f_NumberDefinition[] = {EDIF_TOK_SCALE, -EDIF_TOK_GRIDMAP, - EDIF_TOK_COMMENT}; -static short f_NumberDisplay[] = {EDIF_TOK_E, EDIF_TOK_DISPLAY}; -static short f_OffPageConnector[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - -EDIF_TOK_UNUSED, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_OffsetEvent[] = {EDIF_TOK_EVENT, EDIF_TOK_E}; -static short f_OpenShape[] = {EDIF_TOK_CURVE, EDIF_TOK_PROPERTY}; -static short f_Origin[] = {EDIF_TOK_PT}; -static short f_OverhangDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_OverlapDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Oversize[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE, - EDIF_TOK_CORNERTYPE}; -static short f_Page[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_INSTANCE, EDIF_TOK_NET, EDIF_TOK_NETBUNDLE, - EDIF_TOK_COMMENTGRAPHICS, EDIF_TOK_PORTIMPLEMENTATION, - -EDIF_TOK_PAGESIZE, -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PageSize[] = {EDIF_TOK_RECTANGLE}; -static short f_Parameter[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_BOOLEAN, EDIF_TOK_INTEGER, - EDIF_TOK_MINOMAX, EDIF_TOK_NUMBER, - EDIF_TOK_POINT, EDIF_TOK_STRING}; -static short f_ParameterAssign[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_BOOLEAN, EDIF_TOK_INTEGER, - EDIF_TOK_MINOMAX, EDIF_TOK_NUMBER, EDIF_TOK_POINT, - EDIF_TOK_STRING}; -static short f_ParameterDisplay[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_DISPLAY}; -static short f_Path[] = {EDIF_TOK_POINTLIST, EDIF_TOK_PROPERTY}; -static short f_PathDelay[] = {EDIF_TOK_DELAY, EDIF_TOK_EVENT}; -static short f_Permutable[] = {EDIF_TOK_PORTREF, EDIF_TOK_PERMUTABLE, - EDIF_TOK_NONPERMUTABLE}; -static short f_PhysicalDesignRule[] = {EDIF_TOK_FIGUREWIDTH, - EDIF_TOK_FIGUREAREA, - EDIF_TOK_RECTANGLESIZE, - EDIF_TOK_FIGUREPERIMETER, - EDIF_TOK_OVERLAPDISTANCE, - EDIF_TOK_OVERHANGDISTANCE, - EDIF_TOK_ENCLOSUREDISTANCE, - EDIF_TOK_INTERFIGUREGROUPSPACING, - EDIF_TOK_NOTCHSPACING, - EDIF_TOK_INTRAFIGUREGROUPSPACING, - EDIF_TOK_NOTALLOWED, - EDIF_TOK_FIGUREGROUP, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Plug[] = {EDIF_TOK_SOCKETSET}; -static short f_Point[] = {EDIF_TOK_PT, EDIF_TOK_POINTDISPLAY, - EDIF_TOK_POINT}; -static short f_PointDisplay[] = {EDIF_TOK_PT, EDIF_TOK_DISPLAY}; -static short f_PointList[] = {EDIF_TOK_PT}; -static short f_Polygon[] = {EDIF_TOK_POINTLIST, EDIF_TOK_PROPERTY}; -static short f_Port[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - -EDIF_TOK_DIRECTION, -EDIF_TOK_UNUSED, - EDIF_TOK_PORTDELAY, -EDIF_TOK_DESIGNATOR, - -EDIF_TOK_DCFANINLOAD, -EDIF_TOK_DCFANOUTLOAD, - -EDIF_TOK_DCMAXFANIN, -EDIF_TOK_DCMAXFANOUT, - -EDIF_TOK_ACLOAD, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PortBackAnnotate[] = {EDIF_TOK_PORTREF, -EDIF_TOK_DESIGNATOR, - EDIF_TOK_PORTDELAY, -EDIF_TOK_DCFANINLOAD, - -EDIF_TOK_DCFANOUTLOAD, - -EDIF_TOK_DCMAXFANIN, - -EDIF_TOK_DCMAXFANOUT, -EDIF_TOK_ACLOAD, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT}; -static short f_PortBundle[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_LISTOFPORTS, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PortDelay[] = {EDIF_TOK_DERIVATION, EDIF_TOK_DELAY, - EDIF_TOK_LOADDELAY, EDIF_TOK_TRANSITION, - EDIF_TOK_BECOMES}; -static short f_PortGroup[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_PORTREF}; -static short f_PortImplementation[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME, EDIF_TOK_MEMBER, - -EDIF_TOK_CONNECTLOCATION, - EDIF_TOK_FIGURE, EDIF_TOK_INSTANCE, - EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_PROPERTYDISPLAY, - EDIF_TOK_KEYWORDDISPLAY, - EDIF_TOK_PROPERTY, - EDIF_TOK_USERDATA, EDIF_TOK_COMMENT}; -static short f_PortInstance[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME, - EDIF_TOK_MEMBER, -EDIF_TOK_UNUSED, - EDIF_TOK_PORTDELAY, -EDIF_TOK_DESIGNATOR, - -EDIF_TOK_DCFANINLOAD, - -EDIF_TOK_DCFANOUTLOAD, -EDIF_TOK_DCMAXFANIN, - -EDIF_TOK_DCMAXFANOUT, -EDIF_TOK_ACLOAD, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_PortList[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME, - EDIF_TOK_MEMBER}; -static short f_PortListAlias[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_ARRAY, EDIF_TOK_PORTLIST}; -static short f_PortMap[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PortRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_PORTREF, EDIF_TOK_INSTANCEREF, - EDIF_TOK_VIEWREF}; -static short f_Program[] = {EDIF_TOK_VERSION}; -static short f_Property[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_BOOLEAN, - EDIF_TOK_INTEGER, EDIF_TOK_MINOMAX, - EDIF_TOK_NUMBER, EDIF_TOK_POINT, EDIF_TOK_STRING, - -EDIF_TOK_OWNER, -EDIF_TOK_UNIT, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT}; -static short f_PropertyDisplay[] = {EDIF_TOK_NAME, EDIF_TOK_DISPLAY}; -static short f_ProtectionFrame[] = {EDIF_TOK_PORTIMPLEMENTATION, - EDIF_TOK_FIGURE, EDIF_TOK_INSTANCE, - EDIF_TOK_COMMENTGRAPHICS, - -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_PROPERTYDISPLAY, - EDIF_TOK_KEYWORDDISPLAY, - EDIF_TOK_PARAMETERDISPLAY, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_RangeVector[] = {EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET}; -static short f_Rectangle[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY}; -static short f_RectangleSize[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_RANGEVECTOR, - EDIF_TOK_MULTIPLEVALUESET,EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Rename[] = {EDIF_TOK_NAME, EDIF_TOK_STRINGDISPLAY}; -static short f_Resolves[] = {EDIF_TOK_NAME}; -static short f_Scale[] = {EDIF_TOK_E, EDIF_TOK_UNIT}; -static short f_Section[] = {EDIF_TOK_SECTION, EDIF_TOK_INSTANCE}; -static short f_Shape[] = {EDIF_TOK_CURVE, EDIF_TOK_PROPERTY}; -static short f_Simulate[] = {EDIF_TOK_NAME, EDIF_TOK_PORTLISTALIAS, - EDIF_TOK_WAVEVALUE, EDIF_TOK_APPLY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_SimulationInfo[] = {EDIF_TOK_LOGICVALUE, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_SingleValueSet[] = {EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN}; -static short f_Site[] = {EDIF_TOK_VIEWREF, EDIF_TOK_TRANSFORM}; -static short f_Socket[] = {EDIF_TOK_SYMMETRY}; -static short f_SocketSet[] = {EDIF_TOK_SYMMETRY, EDIF_TOK_SITE}; -static short f_Status[] = {EDIF_TOK_WRITTEN, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Steady[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_PORTREF, - EDIF_TOK_PORTLIST, EDIF_TOK_DURATION, - EDIF_TOK_TRANSITION, EDIF_TOK_BECOMES}; -static short f_String[] = {EDIF_TOK_STRINGDISPLAY, EDIF_TOK_STRING}; -static short f_StringDisplay[] = {EDIF_TOK_DISPLAY}; -static short f_Strong[] = {EDIF_TOK_NAME}; -static short f_Symbol[] = {EDIF_TOK_PORTIMPLEMENTATION, EDIF_TOK_FIGURE, - EDIF_TOK_INSTANCE, EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_ANNOTATE, -EDIF_TOK_PAGESIZE, - -EDIF_TOK_BOUNDINGBOX, EDIF_TOK_PROPERTYDISPLAY, - EDIF_TOK_KEYWORDDISPLAY, EDIF_TOK_PARAMETERDISPLAY, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Symmetry[] = {EDIF_TOK_TRANSFORM}; -static short f_Table[] = {EDIF_TOK_ENTRY, EDIF_TOK_TABLEDEFAULT}; -static short f_TableDefault[] = {EDIF_TOK_LOGICREF, EDIF_TOK_PORTREF, - EDIF_TOK_NOCHANGE, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_Technology[] = {EDIF_TOK_NUMBERDEFINITION, EDIF_TOK_FIGUREGROUP, - EDIF_TOK_FABRICATE, -EDIF_TOK_SIMULATIONINFO, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA, - -EDIF_TOK_PHYSICALDESIGNRULE}; -static short f_TimeInterval[] = {EDIF_TOK_EVENT, EDIF_TOK_OFFSETEVENT, - EDIF_TOK_DURATION}; -static short f_Timing[] = {EDIF_TOK_DERIVATION, EDIF_TOK_PATHDELAY, - EDIF_TOK_FORBIDDENEVENT, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Transform[] = {EDIF_TOK_SCALEX, EDIF_TOK_SCALEY, EDIF_TOK_DELTA, - EDIF_TOK_ORIENTATION, EDIF_TOK_ORIGIN}; -static short f_Transition[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST, - EDIF_TOK_LOGICONEOF}; -static short f_Trigger[] = {EDIF_TOK_CHANGE, EDIF_TOK_STEADY, - EDIF_TOK_INITIAL}; -static short f_Union[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE}; -static short f_View[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_VIEWTYPE, - EDIF_TOK_INTERFACE, -EDIF_TOK_STATUS, - -EDIF_TOK_CONTENTS, EDIF_TOK_COMMENT, - EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA}; -static short f_ViewList[] = {EDIF_TOK_VIEWREF, EDIF_TOK_VIEWLIST}; -static short f_ViewMap[] = {EDIF_TOK_PORTMAP, EDIF_TOK_PORTBACKANNOTATE, - EDIF_TOK_INSTANCEMAP, - EDIF_TOK_INSTANCEBACKANNOTATE, EDIF_TOK_NETMAP, - EDIF_TOK_NETBACKANNOTATE, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_ViewRef[] = {EDIF_TOK_NAME, EDIF_TOK_CELLREF}; -static short f_Visible[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE}; -static short f_VoltageMap[] = {EDIF_TOK_MNM, EDIF_TOK_E}; -static short f_WaveValue[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_E, - EDIF_TOK_LOGICWAVEFORM}; -static short f_Weak[] = {EDIF_TOK_NAME}; -static short f_WeakJoined[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_JOINED}; -static short f_When[] = {EDIF_TOK_TRIGGER, EDIF_TOK_AFTER, - EDIF_TOK_FOLLOW, EDIF_TOK_MAINTAIN, - EDIF_TOK_LOGICASSIGN, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Written[] = {EDIF_TOK_TIMESTAMP, EDIF_TOK_AUTHOR, - EDIF_TOK_PROGRAM, EDIF_TOK_DATAORIGIN, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -/* - * Context binding table: - * - * This binds context follower arrays to their originating context. - */ -typedef struct Binder { - short *Follower; /* pointer to follower array */ - short Origin; /* '%token' value of origin */ - short FollowerSize; /* size of follower array */ -} Binder; -#define BE(f,o) {f,o,sizeof(f)/sizeof(short)} -static Binder BinderDef[] = { - BE(f_NULL, 0), - BE(f_Edif, EDIF_TOK_EDIF), - BE(f_AcLoad, EDIF_TOK_ACLOAD), - BE(f_After, EDIF_TOK_AFTER), - BE(f_Annotate, EDIF_TOK_ANNOTATE), - BE(f_Apply, EDIF_TOK_APPLY), - BE(f_Arc, EDIF_TOK_ARC), - BE(f_Array, EDIF_TOK_ARRAY), - BE(f_ArrayMacro, EDIF_TOK_ARRAYMACRO), - BE(f_ArrayRelatedInfo, EDIF_TOK_ARRAYRELATEDINFO), - BE(f_ArraySite, EDIF_TOK_ARRAYSITE), - BE(f_AtLeast, EDIF_TOK_ATLEAST), - BE(f_AtMost, EDIF_TOK_ATMOST), - BE(f_Becomes, EDIF_TOK_BECOMES), - BE(f_Boolean, EDIF_TOK_BOOLEAN), - BE(f_BooleanDisplay, EDIF_TOK_BOOLEANDISPLAY), - BE(f_BooleanMap, EDIF_TOK_BOOLEANMAP), - BE(f_BorderPattern, EDIF_TOK_BORDERPATTERN), - BE(f_BoundingBox, EDIF_TOK_BOUNDINGBOX), - BE(f_Cell, EDIF_TOK_CELL), - BE(f_CellRef, EDIF_TOK_CELLREF), - BE(f_Change, EDIF_TOK_CHANGE), - BE(f_Circle, EDIF_TOK_CIRCLE), - BE(f_Color, EDIF_TOK_COLOR), - BE(f_CommentGraphics, EDIF_TOK_COMMENTGRAPHICS), - BE(f_Compound, EDIF_TOK_COMPOUND), - BE(f_ConnectLocation, EDIF_TOK_CONNECTLOCATION), - BE(f_Contents, EDIF_TOK_CONTENTS), - BE(f_Criticality, EDIF_TOK_CRITICALITY), - BE(f_CurrentMap, EDIF_TOK_CURRENTMAP), - BE(f_Curve, EDIF_TOK_CURVE), - BE(f_Cycle, EDIF_TOK_CYCLE), - BE(f_DataOrigin, EDIF_TOK_DATAORIGIN), - BE(f_DcFanInLoad, EDIF_TOK_DCFANINLOAD), - BE(f_DcFanOutLoad, EDIF_TOK_DCFANOUTLOAD), - BE(f_DcMaxFanIn, EDIF_TOK_DCMAXFANIN), - BE(f_DcMaxFanOut, EDIF_TOK_DCMAXFANOUT), - BE(f_Delay, EDIF_TOK_DELAY), - BE(f_Delta, EDIF_TOK_DELTA), - BE(f_Design, EDIF_TOK_DESIGN), - BE(f_Designator, EDIF_TOK_DESIGNATOR), - BE(f_Difference, EDIF_TOK_DIFFERENCE), - BE(f_Display, EDIF_TOK_DISPLAY), - BE(f_Dominates, EDIF_TOK_DOMINATES), - BE(f_Dot, EDIF_TOK_DOT), - BE(f_Duration, EDIF_TOK_DURATION), - BE(f_EnclosureDistance, EDIF_TOK_ENCLOSUREDISTANCE), - BE(f_Entry, EDIF_TOK_ENTRY), - BE(f_Exactly, EDIF_TOK_EXACTLY), - BE(f_External, EDIF_TOK_EXTERNAL), - BE(f_Fabricate, EDIF_TOK_FABRICATE), - BE(f_Figure, EDIF_TOK_FIGURE), - BE(f_FigureArea, EDIF_TOK_FIGUREAREA), - BE(f_FigureGroup, EDIF_TOK_FIGUREGROUP), - BE(f_FigureGroupObject, EDIF_TOK_FIGUREGROUPOBJECT), - BE(f_FigureGroupOverride, EDIF_TOK_FIGUREGROUPOVERRIDE), - BE(f_FigureGroupRef, EDIF_TOK_FIGUREGROUPREF), - BE(f_FigurePerimeter, EDIF_TOK_FIGUREPERIMETER), - BE(f_FigureWidth, EDIF_TOK_FIGUREWIDTH), - BE(f_FillPattern, EDIF_TOK_FILLPATTERN), - BE(f_Follow, EDIF_TOK_FOLLOW), - BE(f_ForbiddenEvent, EDIF_TOK_FORBIDDENEVENT), - BE(f_GlobalPortRef, EDIF_TOK_GLOBALPORTREF), - BE(f_GreaterThan, EDIF_TOK_GREATERTHAN), - BE(f_GridMap, EDIF_TOK_GRIDMAP), - BE(f_IncludeFigureGroup, EDIF_TOK_INCLUDEFIGUREGROUP), - BE(f_Instance, EDIF_TOK_INSTANCE), - BE(f_InstanceBackAnnotate, EDIF_TOK_INSTANCEBACKANNOTATE), - BE(f_InstanceGroup, EDIF_TOK_INSTANCEGROUP), - BE(f_InstanceMap, EDIF_TOK_INSTANCEMAP), - BE(f_InstanceRef, EDIF_TOK_INSTANCEREF), - BE(f_Integer, EDIF_TOK_INTEGER), - BE(f_IntegerDisplay, EDIF_TOK_INTEGERDISPLAY), - BE(f_InterFigureGroupSpacing, EDIF_TOK_INTERFIGUREGROUPSPACING), - BE(f_Interface, EDIF_TOK_INTERFACE), - BE(f_Intersection, EDIF_TOK_INTERSECTION), - BE(f_IntraFigureGroupSpacing, EDIF_TOK_INTRAFIGUREGROUPSPACING), - BE(f_Inverse, EDIF_TOK_INVERSE), - BE(f_Joined, EDIF_TOK_JOINED), - BE(f_KeywordDisplay, EDIF_TOK_KEYWORDDISPLAY), - BE(f_KeywordMap, EDIF_TOK_KEYWORDMAP), - BE(f_LessThan, EDIF_TOK_LESSTHAN), - BE(f_Library, EDIF_TOK_LIBRARY), - BE(f_LibraryRef, EDIF_TOK_LIBRARYREF), - BE(f_ListOfNets, EDIF_TOK_LISTOFNETS), - BE(f_ListOfPorts, EDIF_TOK_LISTOFPORTS), - BE(f_LoadDelay, EDIF_TOK_LOADDELAY), - BE(f_LogicAssign, EDIF_TOK_LOGICASSIGN), - BE(f_LogicInput, EDIF_TOK_LOGICINPUT), - BE(f_LogicList, EDIF_TOK_LOGICLIST), - BE(f_LogicMapInput, EDIF_TOK_LOGICMAPINPUT), - BE(f_LogicMapOutput, EDIF_TOK_LOGICMAPOUTPUT), - BE(f_LogicOneOf, EDIF_TOK_LOGICONEOF), - BE(f_LogicOutput, EDIF_TOK_LOGICOUTPUT), - BE(f_LogicPort, EDIF_TOK_LOGICPORT), - BE(f_LogicRef, EDIF_TOK_LOGICREF), - BE(f_LogicValue, EDIF_TOK_LOGICVALUE), - BE(f_LogicWaveform, EDIF_TOK_LOGICWAVEFORM), - BE(f_Maintain, EDIF_TOK_MAINTAIN), - BE(f_Match, EDIF_TOK_MATCH), - BE(f_Member, EDIF_TOK_MEMBER), - BE(f_MiNoMax, EDIF_TOK_MINOMAX), - BE(f_MiNoMaxDisplay, EDIF_TOK_MINOMAXDISPLAY), - BE(f_Mnm, EDIF_TOK_MNM), - BE(f_MultipleValueSet, EDIF_TOK_MULTIPLEVALUESET), - BE(f_MustJoin, EDIF_TOK_MUSTJOIN), - BE(f_Name, EDIF_TOK_NAME), - BE(f_Net, EDIF_TOK_NET), - BE(f_NetBackAnnotate, EDIF_TOK_NETBACKANNOTATE), - BE(f_NetBundle, EDIF_TOK_NETBUNDLE), - BE(f_NetDelay, EDIF_TOK_NETDELAY), - BE(f_NetGroup, EDIF_TOK_NETGROUP), - BE(f_NetMap, EDIF_TOK_NETMAP), - BE(f_NetRef, EDIF_TOK_NETREF), - BE(f_NonPermutable, EDIF_TOK_NONPERMUTABLE), - BE(f_NotAllowed, EDIF_TOK_NOTALLOWED), - BE(f_NotchSpacing, EDIF_TOK_NOTCHSPACING), - BE(f_Number, EDIF_TOK_NUMBER), - BE(f_NumberDefinition, EDIF_TOK_NUMBERDEFINITION), - BE(f_NumberDisplay, EDIF_TOK_NUMBERDISPLAY), - BE(f_OffPageConnector, EDIF_TOK_OFFPAGECONNECTOR), - BE(f_OffsetEvent, EDIF_TOK_OFFSETEVENT), - BE(f_OpenShape, EDIF_TOK_OPENSHAPE), - BE(f_Origin, EDIF_TOK_ORIGIN), - BE(f_OverhangDistance, EDIF_TOK_OVERHANGDISTANCE), - BE(f_OverlapDistance, EDIF_TOK_OVERLAPDISTANCE), - BE(f_Oversize, EDIF_TOK_OVERSIZE), - BE(f_Page, EDIF_TOK_PAGE), - BE(f_PageSize, EDIF_TOK_PAGESIZE), - BE(f_Parameter, EDIF_TOK_PARAMETER), - BE(f_ParameterAssign, EDIF_TOK_PARAMETERASSIGN), - BE(f_ParameterDisplay, EDIF_TOK_PARAMETERDISPLAY), - BE(f_Path, EDIF_TOK_PATH), - BE(f_PathDelay, EDIF_TOK_PATHDELAY), - BE(f_Permutable, EDIF_TOK_PERMUTABLE), - BE(f_PhysicalDesignRule, EDIF_TOK_PHYSICALDESIGNRULE), - BE(f_Plug, EDIF_TOK_PLUG), - BE(f_Point, EDIF_TOK_POINT), - BE(f_PointDisplay, EDIF_TOK_POINTDISPLAY), - BE(f_PointList, EDIF_TOK_POINTLIST), - BE(f_Polygon, EDIF_TOK_POLYGON), - BE(f_Port, EDIF_TOK_PORT), - BE(f_PortBackAnnotate, EDIF_TOK_PORTBACKANNOTATE), - BE(f_PortBundle, EDIF_TOK_PORTBUNDLE), - BE(f_PortDelay, EDIF_TOK_PORTDELAY), - BE(f_PortGroup, EDIF_TOK_PORTGROUP), - BE(f_PortImplementation, EDIF_TOK_PORTIMPLEMENTATION), - BE(f_PortInstance, EDIF_TOK_PORTINSTANCE), - BE(f_PortList, EDIF_TOK_PORTLIST), - BE(f_PortListAlias, EDIF_TOK_PORTLISTALIAS), - BE(f_PortMap, EDIF_TOK_PORTMAP), - BE(f_PortRef, EDIF_TOK_PORTREF), - BE(f_Program, EDIF_TOK_PROGRAM), - BE(f_Property, EDIF_TOK_PROPERTY), - BE(f_PropertyDisplay, EDIF_TOK_PROPERTYDISPLAY), - BE(f_ProtectionFrame, EDIF_TOK_PROTECTIONFRAME), - BE(f_RangeVector, EDIF_TOK_RANGEVECTOR), - BE(f_Rectangle, EDIF_TOK_RECTANGLE), - BE(f_RectangleSize, EDIF_TOK_RECTANGLESIZE), - BE(f_Rename, EDIF_TOK_RENAME), - BE(f_Resolves, EDIF_TOK_RESOLVES), - BE(f_Scale, EDIF_TOK_SCALE), - BE(f_Section, EDIF_TOK_SECTION), - BE(f_Shape, EDIF_TOK_SHAPE), - BE(f_Simulate, EDIF_TOK_SIMULATE), - BE(f_SimulationInfo, EDIF_TOK_SIMULATIONINFO), - BE(f_SingleValueSet, EDIF_TOK_SINGLEVALUESET), - BE(f_Site, EDIF_TOK_SITE), - BE(f_Socket, EDIF_TOK_SOCKET), - BE(f_SocketSet, EDIF_TOK_SOCKETSET), - BE(f_Status, EDIF_TOK_STATUS), - BE(f_Steady, EDIF_TOK_STEADY), - BE(f_String, EDIF_TOK_STRING), - BE(f_StringDisplay, EDIF_TOK_STRINGDISPLAY), - BE(f_Strong, EDIF_TOK_STRONG), - BE(f_Symbol, EDIF_TOK_SYMBOL), - BE(f_Symmetry, EDIF_TOK_SYMMETRY), - BE(f_Table, EDIF_TOK_TABLE), - BE(f_TableDefault, EDIF_TOK_TABLEDEFAULT), - BE(f_Technology, EDIF_TOK_TECHNOLOGY), - BE(f_TimeInterval, EDIF_TOK_TIMEINTERVAL), - BE(f_Timing, EDIF_TOK_TIMING), - BE(f_Transform, EDIF_TOK_TRANSFORM), - BE(f_Transition, EDIF_TOK_TRANSITION), - BE(f_Trigger, EDIF_TOK_TRIGGER), - BE(f_Union, EDIF_TOK_UNION), - BE(f_View, EDIF_TOK_VIEW), - BE(f_ViewList, EDIF_TOK_VIEWLIST), - BE(f_ViewMap, EDIF_TOK_VIEWMAP), - BE(f_ViewRef, EDIF_TOK_VIEWREF), - BE(f_Visible, EDIF_TOK_VISIBLE), - BE(f_VoltageMap, EDIF_TOK_VOLTAGEMAP), - BE(f_WaveValue, EDIF_TOK_WAVEVALUE), - BE(f_Weak, EDIF_TOK_WEAK), - BE(f_WeakJoined, EDIF_TOK_WEAKJOINED), - BE(f_When, EDIF_TOK_WHEN), - BE(f_Written, EDIF_TOK_WRITTEN) -}; -static int BinderDefSize = sizeof(BinderDef) / sizeof(Binder); -/* - * Keyword table: - * - * This hash table holds all strings which may have to be matched - * to. WARNING: it is assumed that there is no overlap of the 'token' - * and 'context' strings. - */ -typedef struct Keyword { - struct Keyword *Next; /* pointer to next entry */ - const char *String; /* pointer to associated string */ -} Keyword; -#define KEYWORD_HASH 127 /* hash table size */ -static Keyword *KeywordTable[KEYWORD_HASH]; -/* - * Enter keyword: - * - * The passed string is entered into the keyword hash table. - */ -static void EnterKeyword(const char * str) -{ - /* - * Locals. - */ - register Keyword *key; - register unsigned int hsh; - register const char *cp; - /* - * Create the hash code, and add an entry to the table. - */ - for (hsh = 0, cp = str; *cp; hsh += hsh + *cp++); - hsh %= KEYWORD_HASH; - key = (Keyword *) Malloc(sizeof(Keyword)); - key->Next = KeywordTable[hsh]; - (KeywordTable[hsh] = key)->String = str; -} -/* - * Find keyword: - * - * The passed string is located within the keyword table. If an - * entry exists, then the value of the keyword string is returned. This - * is real useful for doing string comparisons by pointer value later. - * If there is no match, a NULL is returned. - */ -static const char *FindKeyword(const char * str) -{ - /* - * Locals. - */ - register Keyword *wlk,*owk; - register unsigned int hsh; - register char *cp; - char lower[IDENT_LENGTH + 1]; - /* - * Create a lower case copy of the string. - */ - for (cp = lower; *str;) - if (isupper( (int) *str)) - *cp++ = tolower( (int) *str++); - else - *cp++ = *str++; - *cp = '\0'; - /* - * Search the hash table for a match. - */ - for (hsh = 0, cp = lower; *cp; hsh += hsh + *cp++); - hsh %= KEYWORD_HASH; - for (owk = NULL, wlk = KeywordTable[hsh]; wlk; wlk = (owk = wlk)->Next) - if (!strcmp(wlk->String,lower)){ - /* - * Readjust the LRU. - */ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = KeywordTable[hsh]; - KeywordTable[hsh] = wlk; - } - return (wlk->String); - } - return (NULL); -} -/* - * Token hash table. - */ -#define TOKEN_HASH 51 -static Token *TokenHash[TOKEN_HASH]; -/* - * Find token: - * - * A pointer to the token of the passed code is returned. If - * no such beastie is present a NULL is returned instead. - */ -static Token *FindToken(register int cod) -{ - /* - * Locals. - */ - register Token *wlk,*owk; - register unsigned int hsh; - /* - * Search the hash table for a matching token. - */ - hsh = cod % TOKEN_HASH; - for (owk = NULL, wlk = TokenHash[hsh]; wlk; wlk = (owk = wlk)->Next) - if (cod == wlk->Code){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = TokenHash[hsh]; - TokenHash[hsh] = wlk; - } - break; - } - return (wlk); -} -/* - * Context hash table. - */ -#define CONTEXT_HASH 127 -static Context *ContextHash[CONTEXT_HASH]; -/* - * Find context: - * - * A pointer to the context of the passed code is returned. If - * no such beastie is present a NULL is returned instead. - */ -static Context *FindContext(register int cod) -{ - /* - * Locals. - */ - register Context *wlk,*owk; - register unsigned int hsh; - /* - * Search the hash table for a matching context. - */ - hsh = cod % CONTEXT_HASH; - for (owk = NULL, wlk = ContextHash[hsh]; wlk; wlk = (owk = wlk)->Next) - if (cod == wlk->Code){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = ContextHash[hsh]; - ContextHash[hsh] = wlk; - } - break; - } - return (wlk); -} -/* - * Token stacking variables. - */ -#ifdef DEBUG -#define TS_DEPTH 8 -#define TS_MASK (TS_DEPTH - 1) -static unsigned int TSP = 0; /* token stack pointer */ -static char *TokenStack[TS_DEPTH]; /* token name strings */ -static short TokenType[TS_DEPTH]; /* token types */ -/* - * Stack: - * - * Add a token to the debug stack. The passed string and type are - * what is to be pushed. - */ -static void Stack(char * str, int typ) -{ - /* - * Free any previous string, then push. - */ - if (TokenStack[TSP & TS_MASK]) - Free(TokenStack[TSP & TS_MASK]); - TokenStack[TSP & TS_MASK] = strcpy((char *)Malloc(strlen(str) + 1),str); - TokenType[TSP & TS_MASK] = typ; - TSP += 1; -} -/* - * Dump stack: - * - * This displays the last set of accumulated tokens. - */ -static void DumpStack() -{ - /* - * Locals. - */ - register int i; - register Context *cxt; - register Token *tok; - register char *nam; - FILE *Error = stderr; - /* - * Run through the list displaying the oldest first. - */ - fprintf(Error,"\n\n"); - for (i = 0; i < TS_DEPTH; i += 1) - if (TokenStack[(TSP + i) & TS_MASK]){ - /* - * Get the type name string. - */ - if ((cxt = FindContext(TokenType[(TSP + i) & TS_MASK])) != NULL) - nam = cxt->Name; - else if ((tok = FindToken(TokenType[(TSP + i) & TS_MASK])) != NULL) - nam = tok->Name; - else switch (TokenType[(TSP + i) & TS_MASK]){ - case EDIF_TOK_IDENT: nam = "IDENT"; break; - case EDIF_TOK_INT: nam = "INT"; break; - case EDIF_TOK_KEYWORD: nam = "KEYWORD"; break; - case EDIF_TOK_STR: nam = "STR"; break; - default: nam = "?"; break; - } - /* - * Now print the token state. - */ - fprintf(Error,"%2d %-16.16s '%s'\n",TS_DEPTH - i,nam, - TokenStack[(TSP + i) & TS_MASK]); - } - fprintf(Error,"\n"); -} -#else -#define Stack(s,t) -#endif /* DEBUG */ -/* - * Parser state variables. - */ -static FILE *Input = NULL; /* input stream */ -static FILE *Error = NULL; /* error stream */ -static char *InFile; /* file name on the input stream */ -static long LineNumber; /* current input line number */ -static ContextCar *CSP = NULL; /* top of context stack */ -static char yytext[IDENT_LENGTH + 1]; /* token buffer */ -static char CharBuf[IDENT_LENGTH + 1]; /* garbage buffer */ -/* - * yyerror: - * - * Standard error reporter, it prints out the passed string - * preceeded by the current filename and line number. - */ -static void yyerror(const char *ers) -{ -#ifdef DEBUG - DumpStack(); -#endif /* DEBUG */ - fprintf(Error,"%s, line %ld: %s\n",InFile,LineNumber,ers); -} -/* - * String bucket definitions. - */ -#define BUCKET_SIZE 64 -typedef struct Bucket { - struct Bucket *Next; /* pointer to next bucket */ - int Index; /* pointer to next free slot */ - char Data[BUCKET_SIZE]; /* string data */ -} Bucket; -static Bucket *CurrentBucket = NULL; /* string bucket list */ -static int StringSize = 0; /* current string length */ -/* - * Push string: - * - * This adds the passed charater to the current string bucket. - */ -static void PushString(char chr) -{ - /* - * Locals. - */ - register Bucket *bck; - /* - * Make sure there is room for the push. - */ - if ((bck = CurrentBucket)->Index >= BUCKET_SIZE){ - bck = (Bucket *) Malloc(sizeof(Bucket)); - bck->Next = CurrentBucket; - (CurrentBucket = bck)->Index = 0; - } - /* - * Push the character. - */ - bck->Data[bck->Index++] = chr; - StringSize += 1; -} -/* - * Form string: - * - * This converts the current string bucket into a real live string, - * whose pointer is returned. - */ -static char *FormString() -{ - /* - * Locals. - */ - register Bucket *bck; - register char *cp; - /* - * Allocate space for the string, set the pointer at the end. - */ - cp = (char *) Malloc(StringSize + 1); - - cp += StringSize; - *cp-- = '\0'; - /* - * Yank characters out of the bucket. - */ - for (bck = CurrentBucket; bck->Index || bck->Next;){ - if (!bck->Index){ - CurrentBucket = bck->Next; - Free(bck); - bck = CurrentBucket; - } - *cp-- = bck->Data[--bck->Index]; - } - /* reset buffer size to zero */ - StringSize =0; - return (cp + 1); -} -/* - * Parse EDIF: - * - * This builds the context tree and then calls the real parser. - * It is passed two file streams, the first is where the input comes - * from; the second is where error messages get printed. - */ -void ParseEDIF(char* filename,FILE* err) -{ - /* - * Locals. - */ - register int i; - static int ContextDefined = 1; - /* - * Set up the file state to something useful. - */ - InFile = filename; - Input = fopen(filename,"r"); - Error = err; - LineNumber = 1; - /* - * Define both the enabled token and context strings. - */ - if (ContextDefined){ - for (i = TokenDefSize; i--; EnterKeyword(TokenDef[i].Name)){ - register unsigned int hsh; - hsh = TokenDef[i].Code % TOKEN_HASH; - TokenDef[i].Next = TokenHash[hsh]; - TokenHash[hsh] = &TokenDef[i]; - } - for (i = ContextDefSize; i--; EnterKeyword(ContextDef[i].Name)){ - register unsigned int hsh; - hsh = ContextDef[i].Code % CONTEXT_HASH; - ContextDef[i].Next = ContextHash[hsh]; - ContextHash[hsh] = &ContextDef[i]; - } - /* - * Build the context tree. - */ - for (i = BinderDefSize; i--;){ - register Context *cxt; - register int j; - /* - * Define the current context to have carriers bound to it. - */ - cxt = FindContext(BinderDef[i].Origin); - for (j = BinderDef[i].FollowerSize; j--;){ - register ContextCar *cc; - /* - * Add carriers to the current context. - */ - cc = (ContextCar *) Malloc(sizeof(ContextCar)); - cc->Next = cxt->Context; - (cxt->Context = cc)->Context = - FindContext(PCB_ABS(BinderDef[i].Follower[j])); - cc->u.Single = BinderDef[i].Follower[j] < 0; - } - } - /* - * Build the token tree. - */ - for (i = TieDefSize; i--;){ - register Context *cxt; - register int j; - /* - * Define the current context to have carriers bound to it. - */ - cxt = FindContext(TieDef[i].Origin); - for (j = TieDef[i].EnableSize; j--;){ - register TokenCar *tc; - /* - * Add carriers to the current context. - */ - tc = (TokenCar *) Malloc(sizeof(TokenCar)); - tc->Next = cxt->Token; - (cxt->Token = tc)->Token = FindToken(TieDef[i].Enable[j]); - } - } - /* - * Put a bogus context on the stack which has 'EDIF' as its - * follower. - */ - CSP = (ContextCar *) Malloc(sizeof(ContextCar)); - CSP->Next = NULL; - CSP->Context = FindContext(0); - CSP->u.Used = NULL; - ContextDefined = 0; - } - /* - * Create an initial, empty string bucket. - */ - CurrentBucket = (Bucket *) Malloc(sizeof(Bucket)); - CurrentBucket->Next = 0; - CurrentBucket->Index = 0; - /* - * Fill the token stack with NULLs if debugging is enabled. - */ -#ifdef DEBUG - for (i = TS_DEPTH; i--; TokenStack[i] = NULL) - if (TokenStack[i]) - Free(TokenStack[i]); - TSP = 0; -#endif /* DEBUG */ - /* - * Go parse things! - */ - edifparse(); -} -/* - * Match token: - * - * The passed string is looked up in the current context's token - * list to see if it is enabled. If so the token value is returned, - * if not then zero. - */ -static int MatchToken(register const char * str) -{ - /* - * Locals. - */ - register TokenCar *wlk,*owk; - /* - * Convert the string to the proper form, then search the token - * carrier list for a match. - */ - str = FindKeyword(str); - for (owk = NULL, wlk = CSP->Context->Token; wlk; wlk = (owk = wlk)->Next) - if (str == wlk->Token->Name){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = CSP->Context->Token; - CSP->Context->Token = wlk; - } - return (wlk->Token->Code); - } - return (0); -} -/* - * Match context: - * - * If the passed keyword string is within the current context, the - * new context is pushed and token value is returned. A zero otherwise. - */ -static int MatchContext(register const char * str) -{ - /* - * Locals. - */ - register ContextCar *wlk,*owk; - /* - * See if the context is present. - */ - str = FindKeyword(str); - for (owk = NULL, wlk = CSP->Context->Context; wlk; wlk = (owk = wlk)->Next) - if (str == wlk->Context->Name){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = CSP->Context->Context; - CSP->Context->Context = wlk; - } - /* - * If a single context, make sure it isn't already used. - */ - if (wlk->u.Single){ - register UsedCar *usc; - for (usc = CSP->u.Used; usc; usc = usc->Next) - if (usc->Code == wlk->Context->Code) - break; - if (usc){ - sprintf(CharBuf,"'%s' is used more than once within '%s'", - str,CSP->Context->Name); - yyerror(CharBuf); - } else { - usc = (UsedCar *) Malloc(sizeof(UsedCar)); - usc->Next = CSP->u.Used; - (CSP->u.Used = usc)->Code = wlk->Context->Code; - } - } - /* - * Push the new context. - */ - owk = (ContextCar *) Malloc(sizeof(ContextCar)); - owk->Next = CSP; - (CSP = owk)->Context = wlk->Context; - owk->u.Used = NULL; - return (wlk->Context->Code); - } - return (0); -} -/* - * PopC: - * - * This pops the current context. - */ -static void PopC() -{ - /* - * Locals. - */ - register UsedCar *usc; - register ContextCar *csp; - /* - * Release single markers and pop context. - */ - while ( (usc = CSP->u.Used) ){ - CSP->u.Used = usc->Next; - Free(usc); - } - csp = CSP->Next; - Free(CSP); - CSP = csp; -} -/* - * Lexical analyzer states. - */ -#define L_START 0 -#define L_INT 1 -#define L_IDENT 2 -#define L_KEYWORD 3 -#define L_STRING 4 -#define L_KEYWORD2 5 -#define L_ASCIICHAR 6 -#define L_ASCIICHAR2 7 -/* - * yylex: - * - * This is the lexical analyzer called by the YACC/BISON parser. - * It returns a pretty restricted set of token types and does the - * context movement when acceptable keywords are found. The token - * value returned is a NULL terminated string to allocated storage - * (ie - it should get released some time) with some restrictions. - * The token value for integers is strips a leading '+' if present. - * String token values have the leading and trailing '"'-s stripped. - * '%' conversion characters in string values are passed converted. - * The '(' and ')' characters do not have a token value. - */ -static int yylex() -{ - /* - * Locals. - */ - register int c,s,l; - /* - * Keep on sucking up characters until we find something which - * explicitly forces us out of this function. - */ - for (s = L_START, l = 0; 1;){ - yytext[l++] = c = Getc(Input); - switch (s){ - /* - * Starting state, look for something resembling a token. - */ - case L_START: - if (isdigit(c) || c == '-') - s = L_INT; - else if (isalpha(c) || c == '&') - s = L_IDENT; - else if (isspace(c)){ - if (c == '\n') - LineNumber += 1; - l = 0; - } else if (c == '('){ - l = 0; - s = L_KEYWORD; - } else if (c == '"') - s = L_STRING; - else if (c == '+'){ - l = 0; /* strip '+' */ - s = L_INT; - } else if (c == EOF) - return ('\0'); - else { - yytext[1] = '\0'; - Stack(yytext,c); - return (c); - } - break; - /* - * Suck up the integer digits. - */ - case L_INT: - if (isdigit(c)) - break; - Ungetc(c); - yytext[--l] = '\0'; - yylval.s = strcpy((char *)Malloc(l + 1),yytext); - Stack(yytext,EDIF_TOK_INT); - return (EDIF_TOK_INT); - /* - * Grab an identifier, see if the current context enables - * it with a specific token value. - */ - case L_IDENT: - if (isalpha(c) || isdigit(c) || c == '_') - break; - Ungetc(c); - yytext[--l] = '\0'; - if (CSP->Context->Token && (c = MatchToken(yytext))){ - Stack(yytext,c); - return (c); - } - yylval.s = strcpy((char *)Malloc(l + 1),yytext); - Stack(yytext, EDIF_TOK_IDENT); - return (EDIF_TOK_IDENT); - /* - * Scan until you find the start of an identifier, discard - * any whitespace found. On no identifier, return a '('. - */ - case L_KEYWORD: - if (isalpha(c) || c == '&'){ - s = L_KEYWORD2; - break; - } else if (isspace(c)){ - l = 0; - break; - } - Ungetc(c); - Stack("(",'('); - return ('('); - /* - * Suck up the keyword identifier, if it matches the set of - * allowable contexts then return its token value and push - * the context, otherwise just return the identifier string. - */ - case L_KEYWORD2: - if (isalpha(c) || isdigit(c) || c == '_') - break; - Ungetc(c); - yytext[--l] = '\0'; - if ( (c = MatchContext(yytext)) ){ - Stack(yytext,c); - return (c); - } - yylval.s = strcpy((char *)Malloc(l + 1),yytext); - Stack(yytext, EDIF_TOK_KEYWORD); - return (EDIF_TOK_KEYWORD); - /* - * Suck up string characters but once resolved they should - * be deposited in the string bucket because they can be - * arbitrarily long. - */ - case L_STRING: - if (c == '\n') - LineNumber += 1; - else if (c == '\r') - ; - else if (c == '"' || c == EOF){ - yylval.s = FormString(); - Stack(yylval.s, EDIF_TOK_STR); - return (EDIF_TOK_STR); - } else if (c == '%') - s = L_ASCIICHAR; - else - PushString(c); - l = 0; - break; - /* - * Skip white space and look for integers to be pushed - * as characters. - */ - case L_ASCIICHAR: - if (isdigit(c)){ - s = L_ASCIICHAR2; - break; - } else if (c == '%' || c == EOF) - s = L_STRING; - else if (c == '\n') - LineNumber += 1; - l = 0; - break; - /* - * Convert the accumulated integer into a char and push. - */ - case L_ASCIICHAR2: - if (isdigit(c)) - break; - Ungetc(c); - yytext[--l] = '\0'; - PushString(atoi(yytext)); - s = L_ASCIICHAR; - l = 0; - break; - } - } -} - -int ReadEdifNetlist(char *filename) -{ - Message(PCB_MSG_INFO, _("Importing edif netlist %s\n"), filename); - ParseEDIF(filename, NULL); - - return 0; -} Index: 1.1.4/src_plugins/import_edif/README =================================================================== --- 1.1.4/src_plugins/import_edif/README (revision 10776) +++ 1.1.4/src_plugins/import_edif/README (nonexistent) @@ -1,5 +0,0 @@ -Import plugin for netlists in the EDIF format. - -#state: works -#default: buildin -#implements: import Index: 1.1.4/src_plugins/import_edif/Makefile =================================================================== --- 1.1.4/src_plugins/import_edif/Makefile (revision 10776) +++ 1.1.4/src_plugins/import_edif/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && make mod_import_edif - -clean: - rm *.o *.so 2>/dev/null ; true - Index: 1.1.4/src_plugins/import_edif/edif.h =================================================================== --- 1.1.4/src_plugins/import_edif/edif.h (revision 10776) +++ 1.1.4/src_plugins/import_edif/edif.h (nonexistent) @@ -1,365 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - 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 3 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_EDIF_EDIF_TAB_H_INCLUDED -# define YY_EDIF_EDIF_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int edifdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - EDIF_TOK_IDENT = 258, - EDIF_TOK_INT = 259, - EDIF_TOK_KEYWORD = 260, - EDIF_TOK_STR = 261, - EDIF_TOK_ANGLE = 262, - EDIF_TOK_BEHAVIOR = 263, - EDIF_TOK_CALCULATED = 264, - EDIF_TOK_CAPACITANCE = 265, - EDIF_TOK_CENTERCENTER = 266, - EDIF_TOK_CENTERLEFT = 267, - EDIF_TOK_CENTERRIGHT = 268, - EDIF_TOK_CHARGE = 269, - EDIF_TOK_CONDUCTANCE = 270, - EDIF_TOK_CURRENT = 271, - EDIF_TOK_DISTANCE = 272, - EDIF_TOK_DOCUMENT = 273, - EDIF_TOK_ENERGY = 274, - EDIF_TOK_EXTEND = 275, - EDIF_TOK_FLUX = 276, - EDIF_TOK_FREQUENCY = 277, - EDIF_TOK_GENERIC = 278, - EDIF_TOK_GRAPHIC = 279, - EDIF_TOK_INDUCTANCE = 280, - EDIF_TOK_INOUT = 281, - EDIF_TOK_INPUT = 282, - EDIF_TOK_LOGICMODEL = 283, - EDIF_TOK_LOWERCENTER = 284, - EDIF_TOK_LOWERLEFT = 285, - EDIF_TOK_LOWERRIGHT = 286, - EDIF_TOK_MASKLAYOUT = 287, - EDIF_TOK_MASS = 288, - EDIF_TOK_MEASURED = 289, - EDIF_TOK_MX = 290, - EDIF_TOK_MXR90 = 291, - EDIF_TOK_MY = 292, - EDIF_TOK_MYR90 = 293, - EDIF_TOK_NETLIST = 294, - EDIF_TOK_OUTPUT = 295, - EDIF_TOK_PCBLAYOUT = 296, - EDIF_TOK_POWER = 297, - EDIF_TOK_R0 = 298, - EDIF_TOK_R180 = 299, - EDIF_TOK_R270 = 300, - EDIF_TOK_R90 = 301, - EDIF_TOK_REQUIRED = 302, - EDIF_TOK_RESISTANCE = 303, - EDIF_TOK_RIPPER = 304, - EDIF_TOK_ROUND = 305, - EDIF_TOK_SCHEMATIC = 306, - EDIF_TOK_STRANGER = 307, - EDIF_TOK_SYMBOLIC = 308, - EDIF_TOK_TEMPERATURE = 309, - EDIF_TOK_TIE = 310, - EDIF_TOK_TIME = 311, - EDIF_TOK_TRUNCATE = 312, - EDIF_TOK_UPPERCENTER = 313, - EDIF_TOK_UPPERLEFT = 314, - EDIF_TOK_UPPERRIGHT = 315, - EDIF_TOK_VOLTAGE = 316, - EDIF_TOK_ACLOAD = 317, - EDIF_TOK_AFTER = 318, - EDIF_TOK_ANNOTATE = 319, - EDIF_TOK_APPLY = 320, - EDIF_TOK_ARC = 321, - EDIF_TOK_ARRAY = 322, - EDIF_TOK_ARRAYMACRO = 323, - EDIF_TOK_ARRAYRELATEDINFO = 324, - EDIF_TOK_ARRAYSITE = 325, - EDIF_TOK_ATLEAST = 326, - EDIF_TOK_ATMOST = 327, - EDIF_TOK_AUTHOR = 328, - EDIF_TOK_BASEARRAY = 329, - EDIF_TOK_BECOMES = 330, - EDIF_TOK_BETWEEN = 331, - EDIF_TOK_BOOLEAN = 332, - EDIF_TOK_BOOLEANDISPLAY = 333, - EDIF_TOK_BOOLEANMAP = 334, - EDIF_TOK_BORDERPATTERN = 335, - EDIF_TOK_BORDERWIDTH = 336, - EDIF_TOK_BOUNDINGBOX = 337, - EDIF_TOK_CELL = 338, - EDIF_TOK_CELLREF = 339, - EDIF_TOK_CELLTYPE = 340, - EDIF_TOK_CHANGE = 341, - EDIF_TOK_CIRCLE = 342, - EDIF_TOK_COLOR = 343, - EDIF_TOK_COMMENT = 344, - EDIF_TOK_COMMENTGRAPHICS = 345, - EDIF_TOK_COMPOUND = 346, - EDIF_TOK_CONNECTLOCATION = 347, - EDIF_TOK_CONTENTS = 348, - EDIF_TOK_CORNERTYPE = 349, - EDIF_TOK_CRITICALITY = 350, - EDIF_TOK_CURRENTMAP = 351, - EDIF_TOK_CURVE = 352, - EDIF_TOK_CYCLE = 353, - EDIF_TOK_DATAORIGIN = 354, - EDIF_TOK_DCFANINLOAD = 355, - EDIF_TOK_DCFANOUTLOAD = 356, - EDIF_TOK_DCMAXFANIN = 357, - EDIF_TOK_DCMAXFANOUT = 358, - EDIF_TOK_DELAY = 359, - EDIF_TOK_DELTA = 360, - EDIF_TOK_DERIVATION = 361, - EDIF_TOK_DESIGN = 362, - EDIF_TOK_DESIGNATOR = 363, - EDIF_TOK_DIFFERENCE = 364, - EDIF_TOK_DIRECTION = 365, - EDIF_TOK_DISPLAY = 366, - EDIF_TOK_DOMINATES = 367, - EDIF_TOK_DOT = 368, - EDIF_TOK_DURATION = 369, - EDIF_TOK_E = 370, - EDIF_TOK_EDIF = 371, - EDIF_TOK_EDIFLEVEL = 372, - EDIF_TOK_EDIFVERSION = 373, - EDIF_TOK_ENCLOSUREDISTANCE = 374, - EDIF_TOK_ENDTYPE = 375, - EDIF_TOK_ENTRY = 376, - EDIF_TOK_EVENT = 377, - EDIF_TOK_EXACTLY = 378, - EDIF_TOK_EXTERNAL = 379, - EDIF_TOK_FABRICATE = 380, - EDIF_TOK_FALSE = 381, - EDIF_TOK_FIGURE = 382, - EDIF_TOK_FIGUREAREA = 383, - EDIF_TOK_FIGUREGROUP = 384, - EDIF_TOK_FIGUREGROUPOBJECT = 385, - EDIF_TOK_FIGUREGROUPOVERRIDE = 386, - EDIF_TOK_FIGUREGROUPREF = 387, - EDIF_TOK_FIGUREPERIMETER = 388, - EDIF_TOK_FIGUREWIDTH = 389, - EDIF_TOK_FILLPATTERN = 390, - EDIF_TOK_FOLLOW = 391, - EDIF_TOK_FORBIDDENEVENT = 392, - EDIF_TOK_GLOBALPORTREF = 393, - EDIF_TOK_GREATERTHAN = 394, - EDIF_TOK_GRIDMAP = 395, - EDIF_TOK_IGNORE = 396, - EDIF_TOK_INCLUDEFIGUREGROUP = 397, - EDIF_TOK_INITIAL = 398, - EDIF_TOK_INSTANCE = 399, - EDIF_TOK_INSTANCEBACKANNOTATE = 400, - EDIF_TOK_INSTANCEGROUP = 401, - EDIF_TOK_INSTANCEMAP = 402, - EDIF_TOK_INSTANCEREF = 403, - EDIF_TOK_INTEGER = 404, - EDIF_TOK_INTEGERDISPLAY = 405, - EDIF_TOK_INTERFACE = 406, - EDIF_TOK_INTERFIGUREGROUPSPACING = 407, - EDIF_TOK_INTERSECTION = 408, - EDIF_TOK_INTRAFIGUREGROUPSPACING = 409, - EDIF_TOK_INVERSE = 410, - EDIF_TOK_ISOLATED = 411, - EDIF_TOK_JOINED = 412, - EDIF_TOK_JUSTIFY = 413, - EDIF_TOK_KEYWORDDISPLAY = 414, - EDIF_TOK_KEYWORDLEVEL = 415, - EDIF_TOK_KEYWORDMAP = 416, - EDIF_TOK_LESSTHAN = 417, - EDIF_TOK_LIBRARY = 418, - EDIF_TOK_LIBRARYREF = 419, - EDIF_TOK_LISTOFNETS = 420, - EDIF_TOK_LISTOFPORTS = 421, - EDIF_TOK_LOADDELAY = 422, - EDIF_TOK_LOGICASSIGN = 423, - EDIF_TOK_LOGICINPUT = 424, - EDIF_TOK_LOGICLIST = 425, - EDIF_TOK_LOGICMAPINPUT = 426, - EDIF_TOK_LOGICMAPOUTPUT = 427, - EDIF_TOK_LOGICONEOF = 428, - EDIF_TOK_LOGICOUTPUT = 429, - EDIF_TOK_LOGICPORT = 430, - EDIF_TOK_LOGICREF = 431, - EDIF_TOK_LOGICVALUE = 432, - EDIF_TOK_LOGICWAVEFORM = 433, - EDIF_TOK_MAINTAIN = 434, - EDIF_TOK_MATCH = 435, - EDIF_TOK_MEMBER = 436, - EDIF_TOK_MINOMAX = 437, - EDIF_TOK_MINOMAXDISPLAY = 438, - EDIF_TOK_MNM = 439, - EDIF_TOK_MULTIPLEVALUESET = 440, - EDIF_TOK_MUSTJOIN = 441, - EDIF_TOK_NAME = 442, - EDIF_TOK_NET = 443, - EDIF_TOK_NETBACKANNOTATE = 444, - EDIF_TOK_NETBUNDLE = 445, - EDIF_TOK_NETDELAY = 446, - EDIF_TOK_NETGROUP = 447, - EDIF_TOK_NETMAP = 448, - EDIF_TOK_NETREF = 449, - EDIF_TOK_NOCHANGE = 450, - EDIF_TOK_NONPERMUTABLE = 451, - EDIF_TOK_NOTALLOWED = 452, - EDIF_TOK_NOTCHSPACING = 453, - EDIF_TOK_NUMBER = 454, - EDIF_TOK_NUMBERDEFINITION = 455, - EDIF_TOK_NUMBERDISPLAY = 456, - EDIF_TOK_OFFPAGECONNECTOR = 457, - EDIF_TOK_OFFSETEVENT = 458, - EDIF_TOK_OPENSHAPE = 459, - EDIF_TOK_ORIENTATION = 460, - EDIF_TOK_ORIGIN = 461, - EDIF_TOK_OVERHANGDISTANCE = 462, - EDIF_TOK_OVERLAPDISTANCE = 463, - EDIF_TOK_OVERSIZE = 464, - EDIF_TOK_OWNER = 465, - EDIF_TOK_PAGE = 466, - EDIF_TOK_PAGESIZE = 467, - EDIF_TOK_PARAMETER = 468, - EDIF_TOK_PARAMETERASSIGN = 469, - EDIF_TOK_PARAMETERDISPLAY = 470, - EDIF_TOK_PATH = 471, - EDIF_TOK_PATHDELAY = 472, - EDIF_TOK_PATHWIDTH = 473, - EDIF_TOK_PERMUTABLE = 474, - EDIF_TOK_PHYSICALDESIGNRULE = 475, - EDIF_TOK_PLUG = 476, - EDIF_TOK_POINT = 477, - EDIF_TOK_POINTDISPLAY = 478, - EDIF_TOK_POINTLIST = 479, - EDIF_TOK_POLYGON = 480, - EDIF_TOK_PORT = 481, - EDIF_TOK_PORTBACKANNOTATE = 482, - EDIF_TOK_PORTBUNDLE = 483, - EDIF_TOK_PORTDELAY = 484, - EDIF_TOK_PORTGROUP = 485, - EDIF_TOK_PORTIMPLEMENTATION = 486, - EDIF_TOK_PORTINSTANCE = 487, - EDIF_TOK_PORTLIST = 488, - EDIF_TOK_PORTLISTALIAS = 489, - EDIF_TOK_PORTMAP = 490, - EDIF_TOK_PORTREF = 491, - EDIF_TOK_PROGRAM = 492, - EDIF_TOK_PROPERTY = 493, - EDIF_TOK_PROPERTYDISPLAY = 494, - EDIF_TOK_PROTECTIONFRAME = 495, - EDIF_TOK_PT = 496, - EDIF_TOK_RANGEVECTOR = 497, - EDIF_TOK_RECTANGLE = 498, - EDIF_TOK_RECTANGLESIZE = 499, - EDIF_TOK_RENAME = 500, - EDIF_TOK_RESOLVES = 501, - EDIF_TOK_SCALE = 502, - EDIF_TOK_SCALEX = 503, - EDIF_TOK_SCALEY = 504, - EDIF_TOK_SECTION = 505, - EDIF_TOK_SHAPE = 506, - EDIF_TOK_SIMULATE = 507, - EDIF_TOK_SIMULATIONINFO = 508, - EDIF_TOK_SINGLEVALUESET = 509, - EDIF_TOK_SITE = 510, - EDIF_TOK_SOCKET = 511, - EDIF_TOK_SOCKETSET = 512, - EDIF_TOK_STATUS = 513, - EDIF_TOK_STEADY = 514, - EDIF_TOK_STRING = 515, - EDIF_TOK_STRINGDISPLAY = 516, - EDIF_TOK_STRONG = 517, - EDIF_TOK_SYMBOL = 518, - EDIF_TOK_SYMMETRY = 519, - EDIF_TOK_TABLE = 520, - EDIF_TOK_TABLEDEFAULT = 521, - EDIF_TOK_TECHNOLOGY = 522, - EDIF_TOK_TEXTHEIGHT = 523, - EDIF_TOK_TIMEINTERVAL = 524, - EDIF_TOK_TIMESTAMP = 525, - EDIF_TOK_TIMING = 526, - EDIF_TOK_TRANSFORM = 527, - EDIF_TOK_TRANSITION = 528, - EDIF_TOK_TRIGGER = 529, - EDIF_TOK_TRUE = 530, - EDIF_TOK_UNCONSTRAINED = 531, - EDIF_TOK_UNDEFINED = 532, - EDIF_TOK_UNION = 533, - EDIF_TOK_UNIT = 534, - EDIF_TOK_UNUSED = 535, - EDIF_TOK_USERDATA = 536, - EDIF_TOK_VERSION = 537, - EDIF_TOK_VIEW = 538, - EDIF_TOK_VIEWLIST = 539, - EDIF_TOK_VIEWMAP = 540, - EDIF_TOK_VIEWREF = 541, - EDIF_TOK_VIEWTYPE = 542, - EDIF_TOK_VISIBLE = 543, - EDIF_TOK_VOLTAGEMAP = 544, - EDIF_TOK_WAVEVALUE = 545, - EDIF_TOK_WEAK = 546, - EDIF_TOK_WEAKJOINED = 547, - EDIF_TOK_WHEN = 548, - EDIF_TOK_WRITTEN = 549 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 198 "../../src_plugins/import_edif/edif.y" /* yacc.c:1909 */ - - char* s; - pair_list* pl; - str_pair* ps; - -#line 355 "edif.tab.h" /* yacc.c:1909 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE ediflval; - -int edifparse (void); - -#endif /* !YY_EDIF_EDIF_TAB_H_INCLUDED */ Index: 1.1.4/src_plugins/import_edif/edif.y =================================================================== --- 1.1.4/src_plugins/import_edif/edif.y (revision 10776) +++ 1.1.4/src_plugins/import_edif/edif.y (nonexistent) @@ -1,4455 +0,0 @@ -%{ -/* - * PCB Edif parser based heavily on: - * - * Header: edif.y,v 1.18 87/12/07 19:59:49 roger Locked - */ -/************************************************************************ - * * - * edif.y * - * * - * EDIF 2.0.0 parser, Level 0 * - * * - * You are free to copy, distribute, use it, abuse it, make it * - * write bad tracks all over the disk ... or anything else. * - * * - * Your friendly neighborhood Rogue Monster - roger@mips.com * - * * - ************************************************************************/ -#include - -/* for malloc, free, atoi */ -#include - -/* for strcpy */ -#include - -#include - -#include "global.h" -#include "data.h" -#include "error.h" -#include "plugins.h" -#include "compat_misc.h" - -/* from mymem.h, not include because of the malloc junk */ -LibraryMenuTypePtr GetLibraryMenuMemory(LibraryTypePtr, int *idx); -LibraryEntryTypePtr GetLibraryEntryMemory(LibraryMenuTypePtr); - - -/* - * Local definitions. - */ -#define IDENT_LENGTH 255 -#define Malloc(s) malloc(s) -#define Free(p) free(p) -#define Getc(s) getc(s) -#define Ungetc(c) ungetc(c,Input) - - typedef struct _str_pair - { - char* str1; - char* str2; - struct _str_pair* next; - } str_pair; - - typedef struct _pair_list - { - char* name; - str_pair* list; - } pair_list; - - str_pair* new_str_pair(char* s1, char* s2) - { - str_pair* ps = (str_pair *)malloc(sizeof(str_pair)); - ps->str1 = s1; - ps->str2 = s2; - ps->next = NULL; - return ps; - } - - pair_list* new_pair_list(str_pair* ps) - { - pair_list* pl = (pair_list *)malloc(sizeof(pair_list)); - pl->list = ps; - pl->name = NULL; - return pl; - } - - void str_pair_free(str_pair* ps) - { - str_pair* node; - while ( ps ) - { - free(ps->str1); - free(ps->str2); - node = ps; - ps = ps->next; - free(node); - } - } - - void pair_list_free(pair_list* pl) - { - str_pair_free(pl->list); - free(pl->name); - free(pl); - } - - void define_pcb_net(str_pair* name, pair_list* nodes) - { - int tl; - str_pair* done_node; - str_pair* node; - char* buf; - char* p; - LibraryEntryTypePtr entry; - LibraryMenuTypePtr menu = GetLibraryMenuMemory(&PCB->NetlistLib[NETLIST_INPUT], NULL); - - if ( !name->str1 ) - { - /* no net name given, stop now */ - /* if renamed str2 also exists and must be freed */ - if ( name->str2 ) free(name->str2); - free(name); - pair_list_free(nodes); - return; - } - menu->Name = pcb_strdup (name->str1); - free(name->str1); - /* if renamed str2 also exists and must be freed */ - if ( name->str2 ) free(name->str2); - free(name); - buf = (char *)malloc(256); - if ( !buf ) - { - /* no memory */ - pair_list_free(nodes); - return; - } - - node = nodes->list; - free(nodes->name); - free(nodes); - while ( node ) - { - /* check for node with no instance */ - if ( !node->str1 ) - { - /* toss it and move on */ - free(node->str2); - done_node = node; - node = node->next; - free(done_node); - continue; - } - tl = strlen(node->str1) + strlen(node->str2); - if ( tl + 3 > 256 ) - { - free(buf); - buf = (char *)malloc(tl+3); - if ( !buf ) - { - /* no memory */ - str_pair_free(node); - return; - } - } - strcpy(buf,node->str1); - /* make all upper case, because of PCB funky behaviour */ - p=buf; - while ( *p ) - { - *p = toupper( (int) *p); - p++; - } - /* add dash separating designator from node */ - *(buf+strlen(node->str1)) = '-'; - /* check for the edif number prefix */ - if ( node->str2[0] == '&' ) - { - /* skip number prefix */ - strcpy(buf+strlen(node->str1)+1,node->str2 +1); - } - else - { - strcpy(buf+strlen(node->str1)+1,node->str2); - } - /* free the strings */ - free(node->str1); - free(node->str2); - entry = GetLibraryEntryMemory (menu); - entry->ListEntry = pcb_strdup(buf); - done_node = node; - node = node->next; - free(done_node); - } - } - - -/* forward function declarations */ - static int yylex(void); - static void yyerror(const char *); - static void PopC(void); -%} - -%name-prefix "edif" - -%union { - char* s; - pair_list* pl; - str_pair* ps; -} - -%type Int Ident Str Keyword Name _Name -%type PortRef _PortRef NetNameDef NameDef -%type Rename _Joined -%type __Rename _Rename NameRef -%type InstanceRef InstNameRef Member PortNameRef -%type Net _Net Joined - -%token EDIF_TOK_IDENT -%token EDIF_TOK_INT -%token EDIF_TOK_KEYWORD -%token EDIF_TOK_STR - -%token EDIF_TOK_ANGLE -%token EDIF_TOK_BEHAVIOR -%token EDIF_TOK_CALCULATED -%token EDIF_TOK_CAPACITANCE -%token EDIF_TOK_CENTERCENTER -%token EDIF_TOK_CENTERLEFT -%token EDIF_TOK_CENTERRIGHT -%token EDIF_TOK_CHARGE -%token EDIF_TOK_CONDUCTANCE -%token EDIF_TOK_CURRENT -%token EDIF_TOK_DISTANCE -%token EDIF_TOK_DOCUMENT -%token EDIF_TOK_ENERGY -%token EDIF_TOK_EXTEND -%token EDIF_TOK_FLUX -%token EDIF_TOK_FREQUENCY -%token EDIF_TOK_GENERIC -%token EDIF_TOK_GRAPHIC -%token EDIF_TOK_INDUCTANCE -%token EDIF_TOK_INOUT -%token EDIF_TOK_INPUT -%token EDIF_TOK_LOGICMODEL -%token EDIF_TOK_LOWERCENTER -%token EDIF_TOK_LOWERLEFT -%token EDIF_TOK_LOWERRIGHT -%token EDIF_TOK_MASKLAYOUT -%token EDIF_TOK_MASS -%token EDIF_TOK_MEASURED -%token EDIF_TOK_MX -%token EDIF_TOK_MXR90 -%token EDIF_TOK_MY -%token EDIF_TOK_MYR90 -%token EDIF_TOK_NETLIST -%token EDIF_TOK_OUTPUT -%token EDIF_TOK_PCBLAYOUT -%token EDIF_TOK_POWER -%token EDIF_TOK_R0 -%token EDIF_TOK_R180 -%token EDIF_TOK_R270 -%token EDIF_TOK_R90 -%token EDIF_TOK_REQUIRED -%token EDIF_TOK_RESISTANCE -%token EDIF_TOK_RIPPER -%token EDIF_TOK_ROUND -%token EDIF_TOK_SCHEMATIC -%token EDIF_TOK_STRANGER -%token EDIF_TOK_SYMBOLIC -%token EDIF_TOK_TEMPERATURE -%token EDIF_TOK_TIE -%token EDIF_TOK_TIME -%token EDIF_TOK_TRUNCATE -%token EDIF_TOK_UPPERCENTER -%token EDIF_TOK_UPPERLEFT -%token EDIF_TOK_UPPERRIGHT -%token EDIF_TOK_VOLTAGE - -%token EDIF_TOK_ACLOAD -%token EDIF_TOK_AFTER -%token EDIF_TOK_ANNOTATE -%token EDIF_TOK_APPLY -%token EDIF_TOK_ARC -%token EDIF_TOK_ARRAY -%token EDIF_TOK_ARRAYMACRO -%token EDIF_TOK_ARRAYRELATEDINFO -%token EDIF_TOK_ARRAYSITE -%token EDIF_TOK_ATLEAST -%token EDIF_TOK_ATMOST -%token EDIF_TOK_AUTHOR -%token EDIF_TOK_BASEARRAY -%token EDIF_TOK_BECOMES -%token EDIF_TOK_BETWEEN -%token EDIF_TOK_BOOLEAN -%token EDIF_TOK_BOOLEANDISPLAY -%token EDIF_TOK_BOOLEANMAP -%token EDIF_TOK_BORDERPATTERN -%token EDIF_TOK_BORDERWIDTH -%token EDIF_TOK_BOUNDINGBOX -%token EDIF_TOK_CELL -%token EDIF_TOK_CELLREF -%token EDIF_TOK_CELLTYPE -%token EDIF_TOK_CHANGE -%token EDIF_TOK_CIRCLE -%token EDIF_TOK_COLOR -%token EDIF_TOK_COMMENT -%token EDIF_TOK_COMMENTGRAPHICS -%token EDIF_TOK_COMPOUND -%token EDIF_TOK_CONNECTLOCATION -%token EDIF_TOK_CONTENTS -%token EDIF_TOK_CORNERTYPE -%token EDIF_TOK_CRITICALITY -%token EDIF_TOK_CURRENTMAP -%token EDIF_TOK_CURVE -%token EDIF_TOK_CYCLE -%token EDIF_TOK_DATAORIGIN -%token EDIF_TOK_DCFANINLOAD -%token EDIF_TOK_DCFANOUTLOAD -%token EDIF_TOK_DCMAXFANIN -%token EDIF_TOK_DCMAXFANOUT -%token EDIF_TOK_DELAY -%token EDIF_TOK_DELTA -%token EDIF_TOK_DERIVATION -%token EDIF_TOK_DESIGN -%token EDIF_TOK_DESIGNATOR -%token EDIF_TOK_DIFFERENCE -%token EDIF_TOK_DIRECTION -%token EDIF_TOK_DISPLAY -%token EDIF_TOK_DOMINATES -%token EDIF_TOK_DOT -%token EDIF_TOK_DURATION -%token EDIF_TOK_E -%token EDIF_TOK_EDIF -%token EDIF_TOK_EDIFLEVEL -%token EDIF_TOK_EDIFVERSION -%token EDIF_TOK_ENCLOSUREDISTANCE -%token EDIF_TOK_ENDTYPE -%token EDIF_TOK_ENTRY -%token EDIF_TOK_EVENT -%token EDIF_TOK_EXACTLY -%token EDIF_TOK_EXTERNAL -%token EDIF_TOK_FABRICATE -%token EDIF_TOK_FALSE -%token EDIF_TOK_FIGURE -%token EDIF_TOK_FIGUREAREA -%token EDIF_TOK_FIGUREGROUP -%token EDIF_TOK_FIGUREGROUPOBJECT -%token EDIF_TOK_FIGUREGROUPOVERRIDE -%token EDIF_TOK_FIGUREGROUPREF -%token EDIF_TOK_FIGUREPERIMETER -%token EDIF_TOK_FIGUREWIDTH -%token EDIF_TOK_FILLPATTERN -%token EDIF_TOK_FOLLOW -%token EDIF_TOK_FORBIDDENEVENT -%token EDIF_TOK_GLOBALPORTREF -%token EDIF_TOK_GREATERTHAN -%token EDIF_TOK_GRIDMAP -%token EDIF_TOK_IGNORE -%token EDIF_TOK_INCLUDEFIGUREGROUP -%token EDIF_TOK_INITIAL -%token EDIF_TOK_INSTANCE -%token EDIF_TOK_INSTANCEBACKANNOTATE -%token EDIF_TOK_INSTANCEGROUP -%token EDIF_TOK_INSTANCEMAP -%token EDIF_TOK_INSTANCEREF -%token EDIF_TOK_INTEGER -%token EDIF_TOK_INTEGERDISPLAY -%token EDIF_TOK_INTERFACE -%token EDIF_TOK_INTERFIGUREGROUPSPACING -%token EDIF_TOK_INTERSECTION -%token EDIF_TOK_INTRAFIGUREGROUPSPACING -%token EDIF_TOK_INVERSE -%token EDIF_TOK_ISOLATED -%token EDIF_TOK_JOINED -%token EDIF_TOK_JUSTIFY -%token EDIF_TOK_KEYWORDDISPLAY -%token EDIF_TOK_KEYWORDLEVEL -%token EDIF_TOK_KEYWORDMAP -%token EDIF_TOK_LESSTHAN -%token EDIF_TOK_LIBRARY -%token EDIF_TOK_LIBRARYREF -%token EDIF_TOK_LISTOFNETS -%token EDIF_TOK_LISTOFPORTS -%token EDIF_TOK_LOADDELAY -%token EDIF_TOK_LOGICASSIGN -%token EDIF_TOK_LOGICINPUT -%token EDIF_TOK_LOGICLIST -%token EDIF_TOK_LOGICMAPINPUT -%token EDIF_TOK_LOGICMAPOUTPUT -%token EDIF_TOK_LOGICONEOF -%token EDIF_TOK_LOGICOUTPUT -%token EDIF_TOK_LOGICPORT -%token EDIF_TOK_LOGICREF -%token EDIF_TOK_LOGICVALUE -%token EDIF_TOK_LOGICWAVEFORM -%token EDIF_TOK_MAINTAIN -%token EDIF_TOK_MATCH -%token EDIF_TOK_MEMBER -%token EDIF_TOK_MINOMAX -%token EDIF_TOK_MINOMAXDISPLAY -%token EDIF_TOK_MNM -%token EDIF_TOK_MULTIPLEVALUESET -%token EDIF_TOK_MUSTJOIN -%token EDIF_TOK_NAME -%token EDIF_TOK_NET -%token EDIF_TOK_NETBACKANNOTATE -%token EDIF_TOK_NETBUNDLE -%token EDIF_TOK_NETDELAY -%token EDIF_TOK_NETGROUP -%token EDIF_TOK_NETMAP -%token EDIF_TOK_NETREF -%token EDIF_TOK_NOCHANGE -%token EDIF_TOK_NONPERMUTABLE -%token EDIF_TOK_NOTALLOWED -%token EDIF_TOK_NOTCHSPACING -%token EDIF_TOK_NUMBER -%token EDIF_TOK_NUMBERDEFINITION -%token EDIF_TOK_NUMBERDISPLAY -%token EDIF_TOK_OFFPAGECONNECTOR -%token EDIF_TOK_OFFSETEVENT -%token EDIF_TOK_OPENSHAPE -%token EDIF_TOK_ORIENTATION -%token EDIF_TOK_ORIGIN -%token EDIF_TOK_OVERHANGDISTANCE -%token EDIF_TOK_OVERLAPDISTANCE -%token EDIF_TOK_OVERSIZE -%token EDIF_TOK_OWNER -%token EDIF_TOK_PAGE -%token EDIF_TOK_PAGESIZE -%token EDIF_TOK_PARAMETER -%token EDIF_TOK_PARAMETERASSIGN -%token EDIF_TOK_PARAMETERDISPLAY -%token EDIF_TOK_PATH -%token EDIF_TOK_PATHDELAY -%token EDIF_TOK_PATHWIDTH -%token EDIF_TOK_PERMUTABLE -%token EDIF_TOK_PHYSICALDESIGNRULE -%token EDIF_TOK_PLUG -%token EDIF_TOK_POINT -%token EDIF_TOK_POINTDISPLAY -%token EDIF_TOK_POINTLIST -%token EDIF_TOK_POLYGON -%token EDIF_TOK_PORT -%token EDIF_TOK_PORTBACKANNOTATE -%token EDIF_TOK_PORTBUNDLE -%token EDIF_TOK_PORTDELAY -%token EDIF_TOK_PORTGROUP -%token EDIF_TOK_PORTIMPLEMENTATION -%token EDIF_TOK_PORTINSTANCE -%token EDIF_TOK_PORTLIST -%token EDIF_TOK_PORTLISTALIAS -%token EDIF_TOK_PORTMAP -%token EDIF_TOK_PORTREF -%token EDIF_TOK_PROGRAM -%token EDIF_TOK_PROPERTY -%token EDIF_TOK_PROPERTYDISPLAY -%token EDIF_TOK_PROTECTIONFRAME -%token EDIF_TOK_PT -%token EDIF_TOK_RANGEVECTOR -%token EDIF_TOK_RECTANGLE -%token EDIF_TOK_RECTANGLESIZE -%token EDIF_TOK_RENAME -%token EDIF_TOK_RESOLVES -%token EDIF_TOK_SCALE -%token EDIF_TOK_SCALEX -%token EDIF_TOK_SCALEY -%token EDIF_TOK_SECTION -%token EDIF_TOK_SHAPE -%token EDIF_TOK_SIMULATE -%token EDIF_TOK_SIMULATIONINFO -%token EDIF_TOK_SINGLEVALUESET -%token EDIF_TOK_SITE -%token EDIF_TOK_SOCKET -%token EDIF_TOK_SOCKETSET -%token EDIF_TOK_STATUS -%token EDIF_TOK_STEADY -%token EDIF_TOK_STRING -%token EDIF_TOK_STRINGDISPLAY -%token EDIF_TOK_STRONG -%token EDIF_TOK_SYMBOL -%token EDIF_TOK_SYMMETRY -%token EDIF_TOK_TABLE -%token EDIF_TOK_TABLEDEFAULT -%token EDIF_TOK_TECHNOLOGY -%token EDIF_TOK_TEXTHEIGHT -%token EDIF_TOK_TIMEINTERVAL -%token EDIF_TOK_TIMESTAMP -%token EDIF_TOK_TIMING -%token EDIF_TOK_TRANSFORM -%token EDIF_TOK_TRANSITION -%token EDIF_TOK_TRIGGER -%token EDIF_TOK_TRUE -%token EDIF_TOK_UNCONSTRAINED -%token EDIF_TOK_UNDEFINED -%token EDIF_TOK_UNION -%token EDIF_TOK_UNIT -%token EDIF_TOK_UNUSED -%token EDIF_TOK_USERDATA -%token EDIF_TOK_VERSION -%token EDIF_TOK_VIEW -%token EDIF_TOK_VIEWLIST -%token EDIF_TOK_VIEWMAP -%token EDIF_TOK_VIEWREF -%token EDIF_TOK_VIEWTYPE -%token EDIF_TOK_VISIBLE -%token EDIF_TOK_VOLTAGEMAP -%token EDIF_TOK_WAVEVALUE -%token EDIF_TOK_WEAK -%token EDIF_TOK_WEAKJOINED -%token EDIF_TOK_WHEN -%token EDIF_TOK_WRITTEN - -%start Edif - -%% - -PopC : ')' { PopC(); } - ; - -Edif : EDIF_TOK_EDIF EdifFileName EdifVersion EdifLevel KeywordMap _Edif PopC - ; - -_Edif : - | _Edif Status - | _Edif External - | _Edif Library - | _Edif Design - | _Edif Comment - | _Edif UserData - ; - -EdifFileName : NameDef { str_pair_free($1); } - ; - -EdifLevel : EDIF_TOK_EDIFLEVEL Int PopC { free($2); } - ; - -EdifVersion : EDIF_TOK_EDIFVERSION Int Int Int PopC -{ free($2); free($3); free($4); } - ; - -AcLoad : EDIF_TOK_ACLOAD _AcLoad PopC - ; - -_AcLoad : MiNoMaValue - | MiNoMaDisp - ; - -After : EDIF_TOK_AFTER _After PopC - ; - -_After : MiNoMaValue - | _After Follow - | _After Maintain - | _After LogicAssn - | _After Comment - | _After UserData - ; - -Annotate : EDIF_TOK_ANNOTATE _Annotate PopC - ; - -_Annotate : Str { free($1); } - | StrDisplay - ; - -Apply : EDIF_TOK_APPLY _Apply PopC - ; - -_Apply : Cycle - | _Apply LogicIn - | _Apply LogicOut - | _Apply Comment - | _Apply UserData - ; - -Arc : EDIF_TOK_ARC PointValue PointValue PointValue PopC - ; - -Array : EDIF_TOK_ARRAY NameDef Int _Array PopC { str_pair_free($2); free($3); } - ; - -_Array : - | Int { free($1); } - ; - -ArrayMacro : EDIF_TOK_ARRAYMACRO Plug PopC - ; - -ArrayRelInfo : EDIF_TOK_ARRAYRELATEDINFO _ArrayRelInfo PopC - ; - -_ArrayRelInfo : BaseArray - | ArraySite - | ArrayMacro - | _ArrayRelInfo Comment - | _ArrayRelInfo UserData - ; - -ArraySite : EDIF_TOK_ARRAYSITE Socket PopC - ; - -AtLeast : EDIF_TOK_ATLEAST ScaledInt PopC - ; - -AtMost : EDIF_TOK_ATMOST ScaledInt PopC - ; - -Author : EDIF_TOK_AUTHOR Str PopC { free($2); } - ; - -BaseArray : EDIF_TOK_BASEARRAY PopC - ; - -Becomes : EDIF_TOK_BECOMES _Becomes PopC - ; - -_Becomes : LogicNameRef - | LogicList - | LogicOneOf - ; - -Between : EDIF_TOK_BETWEEN __Between _Between PopC - ; - -__Between : AtLeast - | GreaterThan - ; - -_Between : AtMost - | LessThan - ; - -Boolean : EDIF_TOK_BOOLEAN _Boolean PopC - ; - -_Boolean : - | _Boolean BooleanValue - | _Boolean BooleanDisp - | _Boolean Boolean - ; - -BooleanDisp : EDIF_TOK_BOOLEANDISPLAY _BooleanDisp PopC - ; - -_BooleanDisp : BooleanValue - | _BooleanDisp Display - ; - -BooleanMap : EDIF_TOK_BOOLEANMAP BooleanValue PopC - ; - -BooleanValue : True - | False - ; - -BorderPat : EDIF_TOK_BORDERPATTERN Int Int Boolean PopC { free($2); free($3); } - ; - -BorderWidth : EDIF_TOK_BORDERWIDTH Int PopC { free($2); } - ; - -BoundBox : EDIF_TOK_BOUNDINGBOX Rectangle PopC - ; - -Cell : EDIF_TOK_CELL CellNameDef _Cell PopC - ; - -_Cell : CellType - | _Cell Status - | _Cell ViewMap - | _Cell View - | _Cell Comment - | _Cell UserData - | _Cell Property - ; - -CellNameDef : NameDef { str_pair_free($1); } - ; - -CellRef : EDIF_TOK_CELLREF CellNameRef _CellRef PopC - ; - -_CellRef : - | LibraryRef - ; - -CellNameRef : NameRef { free($1); } - ; - -CellType : EDIF_TOK_CELLTYPE _CellType PopC - ; - -_CellType : EDIF_TOK_TIE - | EDIF_TOK_RIPPER - | EDIF_TOK_GENERIC - ; - -Change : EDIF_TOK_CHANGE __Change _Change PopC - ; - -__Change : PortNameRef - | PortRef { str_pair_free($1); } - | PortList - ; - -_Change : - | Becomes - | Transition - ; - -Circle : EDIF_TOK_CIRCLE PointValue PointValue _Circle PopC - ; - -_Circle : - | _Circle Property - ; - -Color : EDIF_TOK_COLOR ScaledInt ScaledInt ScaledInt PopC - ; - -Comment : EDIF_TOK_COMMENT _Comment PopC - ; - -_Comment : - | _Comment Str { free($2); } - ; - -CommGraph : EDIF_TOK_COMMENTGRAPHICS _CommGraph PopC - ; - -_CommGraph : - | _CommGraph Annotate - | _CommGraph Figure - | _CommGraph Instance - | _CommGraph BoundBox - | _CommGraph Property - | _CommGraph Comment - | _CommGraph UserData - ; - -Compound : EDIF_TOK_COMPOUND LogicNameRef PopC - ; - -Contents : EDIF_TOK_CONTENTS _Contents PopC - ; - -_Contents : - | _Contents Instance - | _Contents OffPageConn - | _Contents Figure - | _Contents Section - | _Contents Net - | _Contents NetBundle - | _Contents Page - | _Contents CommGraph - | _Contents PortImpl - | _Contents Timing - | _Contents Simulate - | _Contents When - | _Contents Follow - | _Contents LogicPort - | _Contents BoundBox - | _Contents Comment - | _Contents UserData - ; - -ConnectLoc : EDIF_TOK_CONNECTLOCATION _ConnectLoc PopC - ; - -_ConnectLoc : - | Figure - ; - -CornerType : EDIF_TOK_CORNERTYPE _CornerType PopC - ; - -_CornerType : EDIF_TOK_EXTEND - | EDIF_TOK_ROUND - | EDIF_TOK_TRUNCATE - ; - -Criticality : EDIF_TOK_CRITICALITY _Criticality PopC - ; - -_Criticality : Int { free($1); } - | IntDisplay - ; - -CurrentMap : EDIF_TOK_CURRENTMAP MiNoMaValue PopC - ; - -Curve : EDIF_TOK_CURVE _Curve PopC - ; - -_Curve : - | _Curve Arc - | _Curve PointValue - ; - -Cycle : EDIF_TOK_CYCLE Int _Cycle PopC { free($2); } - ; - -_Cycle : - | Duration - ; - -DataOrigin : EDIF_TOK_DATAORIGIN Str _DataOrigin PopC { free($2); } - ; - -_DataOrigin : - | Version - ; - -DcFanInLoad : EDIF_TOK_DCFANINLOAD _DcFanInLoad PopC - ; - -_DcFanInLoad : ScaledInt - | NumbDisplay - ; - -DcFanOutLoad : EDIF_TOK_DCFANOUTLOAD _DcFanOutLoad PopC - ; - -_DcFanOutLoad : ScaledInt - | NumbDisplay - ; - -DcMaxFanIn : EDIF_TOK_DCMAXFANIN _DcMaxFanIn PopC - ; - -_DcMaxFanIn : ScaledInt - | NumbDisplay - ; - -DcMaxFanOut : EDIF_TOK_DCMAXFANOUT _DcMaxFanOut PopC - ; - -_DcMaxFanOut : ScaledInt - | NumbDisplay - ; - -Delay : EDIF_TOK_DELAY _Delay PopC - ; - -_Delay : MiNoMaValue - | MiNoMaDisp - ; - -Delta : EDIF_TOK_DELTA _Delta PopC - ; - -_Delta : - | _Delta PointValue - ; - -Derivation : EDIF_TOK_DERIVATION _Derivation PopC - ; - -_Derivation : EDIF_TOK_CALCULATED - | EDIF_TOK_MEASURED - | EDIF_TOK_REQUIRED - ; - -Design : EDIF_TOK_DESIGN DesignNameDef _Design PopC - ; - -_Design : CellRef - | _Design Status - | _Design Comment - | _Design Property - | _Design UserData - ; - -Designator : EDIF_TOK_DESIGNATOR _Designator PopC - ; - -_Designator : Str { free($1); } - | StrDisplay - ; - -DesignNameDef : NameDef { str_pair_free($1); } - ; - -DesignRule : EDIF_TOK_PHYSICALDESIGNRULE _DesignRule PopC - ; - -_DesignRule : - | _DesignRule FigureWidth - | _DesignRule FigureArea - | _DesignRule RectSize - | _DesignRule FigurePerim - | _DesignRule OverlapDist - | _DesignRule OverhngDist - | _DesignRule EncloseDist - | _DesignRule InterFigGrp - | _DesignRule IntraFigGrp - | _DesignRule NotchSpace - | _DesignRule NotAllowed - | _DesignRule FigGrp - | _DesignRule Comment - | _DesignRule UserData - ; - -Difference : EDIF_TOK_DIFFERENCE _Difference PopC - ; - -_Difference : FigGrpRef - | FigureOp - | _Difference FigGrpRef - | _Difference FigureOp - ; - -Direction : EDIF_TOK_DIRECTION _Direction PopC - ; - -_Direction : EDIF_TOK_INOUT - | EDIF_TOK_INPUT - | EDIF_TOK_OUTPUT - ; - -Display : EDIF_TOK_DISPLAY _Display _DisplayJust _DisplayOrien _DisplayOrg PopC - ; - -_Display : FigGrpNameRef - | FigGrpOver - ; - -_DisplayJust : - | Justify - ; - -_DisplayOrien : - | Orientation - ; - -_DisplayOrg : - | Origin - ; - -Dominates : EDIF_TOK_DOMINATES _Dominates PopC - ; - -_Dominates : - | _Dominates LogicNameRef - ; - -Dot : EDIF_TOK_DOT _Dot PopC - ; - -_Dot : PointValue - | _Dot Property - ; - -Duration : EDIF_TOK_DURATION ScaledInt PopC - ; - -EncloseDist : EDIF_TOK_ENCLOSUREDISTANCE RuleNameDef FigGrpObj FigGrpObj _EncloseDist - PopC - ; - -_EncloseDist : Range - | SingleValSet - | _EncloseDist Comment - | _EncloseDist UserData - ; - -EndType : EDIF_TOK_ENDTYPE _EndType PopC - ; - -_EndType : EDIF_TOK_EXTEND - | EDIF_TOK_ROUND - | EDIF_TOK_TRUNCATE - ; - -Entry : EDIF_TOK_ENTRY ___Entry __Entry _Entry - PopC - ; - -___Entry : Match - | Change - | Steady - ; - -__Entry : LogicRef - | PortRef { str_pair_free($1); } - | NoChange - | Table - ; - -_Entry : - | Delay - | LoadDelay - ; - -Event : EDIF_TOK_EVENT _Event PopC - ; - -_Event : PortRef { str_pair_free($1); } - | PortList - | PortGroup - | NetRef - | NetGroup - | _Event Transition - | _Event Becomes - ; - -Exactly : EDIF_TOK_EXACTLY ScaledInt PopC - ; - -External : EDIF_TOK_EXTERNAL LibNameDef EdifLevel _External PopC - ; - -_External : Technology - | _External Status - | _External Cell - | _External Comment - | _External UserData - ; - -Fabricate : EDIF_TOK_FABRICATE LayerNameDef FigGrpNameRef PopC - ; - -False : EDIF_TOK_FALSE PopC - ; - -FigGrp : EDIF_TOK_FIGUREGROUP _FigGrp PopC - ; - -_FigGrp : FigGrpNameDef - | _FigGrp CornerType - | _FigGrp EndType - | _FigGrp PathWidth - | _FigGrp BorderWidth - | _FigGrp Color - | _FigGrp FillPattern - | _FigGrp BorderPat - | _FigGrp TextHeight - | _FigGrp Visible - | _FigGrp Comment - | _FigGrp Property - | _FigGrp UserData - | _FigGrp IncFigGrp - ; - -FigGrpNameDef : NameDef { str_pair_free($1); } - ; - -FigGrpNameRef : NameRef { free($1); } - ; - -FigGrpObj : EDIF_TOK_FIGUREGROUPOBJECT _FigGrpObj PopC - ; - -_FigGrpObj : FigGrpNameRef - | FigGrpRef - | FigureOp - ; - -FigGrpOver : EDIF_TOK_FIGUREGROUPOVERRIDE _FigGrpOver PopC - ; - -_FigGrpOver : FigGrpNameRef - | _FigGrpOver CornerType - | _FigGrpOver EndType - | _FigGrpOver PathWidth - | _FigGrpOver BorderWidth - | _FigGrpOver Color - | _FigGrpOver FillPattern - | _FigGrpOver BorderPat - | _FigGrpOver TextHeight - | _FigGrpOver Visible - | _FigGrpOver Comment - | _FigGrpOver Property - | _FigGrpOver UserData - ; - -FigGrpRef : EDIF_TOK_FIGUREGROUPREF FigGrpNameRef _FigGrpRef PopC - ; - -_FigGrpRef : - | LibraryRef - ; - -Figure : EDIF_TOK_FIGURE _Figure PopC - ; - -_Figure : FigGrpNameDef - | FigGrpOver - | _Figure Circle - | _Figure Dot - | _Figure OpenShape - | _Figure Path - | _Figure Polygon - | _Figure Rectangle - | _Figure Shape - | _Figure Comment - | _Figure UserData - ; - -FigureArea : EDIF_TOK_FIGUREAREA RuleNameDef FigGrpObj _FigureArea PopC - ; - -_FigureArea : Range - | SingleValSet - | _FigureArea Comment - | _FigureArea UserData - ; - -FigureOp : Intersection - | Union - | Difference - | Inverse - | Oversize - ; - -FigurePerim : EDIF_TOK_FIGUREPERIMETER RuleNameDef FigGrpObj _FigurePerim PopC - ; - -_FigurePerim : Range - | SingleValSet - | _FigurePerim Comment - | _FigurePerim UserData - ; - -FigureWidth : EDIF_TOK_FIGUREWIDTH RuleNameDef FigGrpObj _FigureWidth PopC - ; - -_FigureWidth : Range - | SingleValSet - | _FigureWidth Comment - | _FigureWidth UserData - ; - -FillPattern : EDIF_TOK_FILLPATTERN Int Int Boolean PopC { free($2); free($3); } - ; - -Follow : EDIF_TOK_FOLLOW __Follow _Follow PopC - ; - -__Follow : PortNameRef - | PortRef { str_pair_free($1); } - ; - -_Follow : PortRef { str_pair_free($1); } - | Table - | _Follow Delay - | _Follow LoadDelay - ; - -Forbidden : EDIF_TOK_FORBIDDENEVENT _Forbidden PopC - ; - -_Forbidden : TimeIntval - | _Forbidden Event - ; - -Form : Keyword _Form ')' { free($1); } - ; - -_Form : - | _Form Int { free($2); } - | _Form Str { free($2); } - | _Form Ident { free($2); } - | _Form Form - ; - -GlobPortRef : EDIF_TOK_GLOBALPORTREF PortNameRef PopC - ; - -GreaterThan : EDIF_TOK_GREATERTHAN ScaledInt PopC - ; - -GridMap : EDIF_TOK_GRIDMAP ScaledInt ScaledInt PopC - ; - -Ignore : EDIF_TOK_IGNORE PopC - ; - -IncFigGrp : EDIF_TOK_INCLUDEFIGUREGROUP _IncFigGrp PopC - ; - -_IncFigGrp : FigGrpRef - | FigureOp - ; - -Initial : EDIF_TOK_INITIAL PopC - ; - -Instance : EDIF_TOK_INSTANCE InstNameDef _Instance PopC - ; - -_Instance : ViewRef - | ViewList - | _Instance Transform - | _Instance ParamAssign - | _Instance PortInst - | _Instance Timing - | _Instance Designator - | _Instance Property - | _Instance Comment - | _Instance UserData - ; - -InstanceRef : EDIF_TOK_INSTANCEREF InstNameRef _InstanceRef PopC { $$=$2; } - ; - -_InstanceRef : -| InstanceRef { free($1); } - | ViewRef - ; - -InstBackAn : EDIF_TOK_INSTANCEBACKANNOTATE _InstBackAn PopC - ; - -_InstBackAn : InstanceRef { free($1); } - | _InstBackAn Designator - | _InstBackAn Timing - | _InstBackAn Property - | _InstBackAn Comment - ; - -InstGroup : EDIF_TOK_INSTANCEGROUP _InstGroup PopC - ; - -_InstGroup : - | _InstGroup InstanceRef { free($2); } - ; - -InstMap : EDIF_TOK_INSTANCEMAP _InstMap PopC - ; - -_InstMap : - | _InstMap InstanceRef { free($2); } - | _InstMap InstGroup - | _InstMap Comment - | _InstMap UserData - ; - -InstNameDef : NameDef { str_pair_free($1); } - | Array - ; - -InstNameRef : NameRef { $$=$1; } - | Member - ; - -IntDisplay : EDIF_TOK_INTEGERDISPLAY _IntDisplay PopC - ; - -_IntDisplay : Int { free($1); } - | _IntDisplay Display - ; - -Integer : EDIF_TOK_INTEGER _Integer PopC - ; - -_Integer : - | _Integer Int { free($2); } - | _Integer IntDisplay - | _Integer Integer - ; - -Interface : EDIF_TOK_INTERFACE _Interface PopC - ; - -_Interface : - | _Interface Port - | _Interface PortBundle - | _Interface Symbol - | _Interface ProtectFrame - | _Interface ArrayRelInfo - | _Interface Parameter - | _Interface Joined { pair_list_free($2); } - | _Interface MustJoin - | _Interface WeakJoined - | _Interface Permutable - | _Interface Timing - | _Interface Simulate - | _Interface Designator - | _Interface Property - | _Interface Comment - | _Interface UserData - ; - -InterFigGrp : EDIF_TOK_INTERFIGUREGROUPSPACING RuleNameDef FigGrpObj FigGrpObj - _InterFigGrp PopC - ; - -_InterFigGrp : Range - | SingleValSet - | _InterFigGrp Comment - | _InterFigGrp UserData - ; - -Intersection : EDIF_TOK_INTERSECTION _Intersection PopC - ; - -_Intersection : FigGrpRef - | FigureOp - | _Intersection FigGrpRef - | _Intersection FigureOp - ; - -IntraFigGrp : EDIF_TOK_INTRAFIGUREGROUPSPACING RuleNameDef FigGrpObj _IntraFigGrp PopC - ; - -_IntraFigGrp : Range - | SingleValSet - | _IntraFigGrp Comment - | _IntraFigGrp UserData - ; - -Inverse : EDIF_TOK_INVERSE _Inverse PopC - ; - -_Inverse : FigGrpRef - | FigureOp - ; - -Isolated : EDIF_TOK_ISOLATED PopC - ; - -Joined : EDIF_TOK_JOINED _Joined PopC { $$ = new_pair_list($2); } - ; - -_Joined : { $$=NULL; } -| _Joined PortRef { $2->next = $1; $$ = $2; } - | _Joined PortList - | _Joined GlobPortRef - ; - -Justify : EDIF_TOK_JUSTIFY _Justify PopC - ; - -_Justify : EDIF_TOK_CENTERCENTER - | EDIF_TOK_CENTERLEFT - | EDIF_TOK_CENTERRIGHT - | EDIF_TOK_LOWERCENTER - | EDIF_TOK_LOWERLEFT - | EDIF_TOK_LOWERRIGHT - | EDIF_TOK_UPPERCENTER - | EDIF_TOK_UPPERLEFT - | EDIF_TOK_UPPERRIGHT - ; - -KeywordDisp : EDIF_TOK_KEYWORDDISPLAY _KeywordDisp PopC - ; - -_KeywordDisp : KeywordName - | _KeywordDisp Display - ; - -KeywordLevel : EDIF_TOK_KEYWORDLEVEL Int PopC { free($2); } - ; - -KeywordMap : EDIF_TOK_KEYWORDMAP _KeywordMap PopC - ; - -_KeywordMap : KeywordLevel - | _KeywordMap Comment - ; - -KeywordName : Ident { free($1); } - ; - -LayerNameDef : NameDef { str_pair_free($1); } - ; - -LessThan : EDIF_TOK_LESSTHAN ScaledInt PopC - ; - -LibNameDef : NameDef { str_pair_free($1); } - ; - -LibNameRef : NameRef { free($1); } - ; - -Library : EDIF_TOK_LIBRARY LibNameDef EdifLevel _Library PopC - ; - -_Library : Technology - | _Library Status - | _Library Cell - | _Library Comment - | _Library UserData - ; - -LibraryRef : EDIF_TOK_LIBRARYREF LibNameRef PopC - ; - -ListOfNets : EDIF_TOK_LISTOFNETS _ListOfNets PopC - ; - -_ListOfNets : - | _ListOfNets Net - ; - -ListOfPorts : EDIF_TOK_LISTOFPORTS _ListOfPorts PopC - ; - -_ListOfPorts : - | _ListOfPorts Port - | _ListOfPorts PortBundle - ; - -LoadDelay : EDIF_TOK_LOADDELAY _LoadDelay _LoadDelay PopC - ; - -_LoadDelay : MiNoMaValue - | MiNoMaDisp - ; - -LogicAssn : EDIF_TOK_LOGICASSIGN ___LogicAssn __LogicAssn _LogicAssn PopC - ; - -___LogicAssn : PortNameRef - | PortRef { str_pair_free($1); } - ; - -__LogicAssn : PortRef { str_pair_free($1); } - | LogicRef - | Table - ; - -_LogicAssn : - | Delay - | LoadDelay - ; - -LogicIn : EDIF_TOK_LOGICINPUT _LogicIn PopC - ; - -_LogicIn : PortList - | PortRef { str_pair_free($1); } - | PortNameRef - | _LogicIn LogicWave - ; - -LogicList : EDIF_TOK_LOGICLIST _LogicList PopC - ; - -_LogicList : - | _LogicList LogicNameRef - | _LogicList LogicOneOf - | _LogicList Ignore - ; - -LogicMapIn : EDIF_TOK_LOGICMAPINPUT _LogicMapIn PopC - ; - -_LogicMapIn : - | _LogicMapIn LogicNameRef - ; - -LogicMapOut : EDIF_TOK_LOGICMAPOUTPUT _LogicMapOut PopC - ; - -_LogicMapOut : - | _LogicMapOut LogicNameRef - ; - -LogicNameDef : NameDef { str_pair_free($1); } - ; - -LogicNameRef : NameRef { free($1); } - ; - -LogicOneOf : EDIF_TOK_LOGICONEOF _LogicOneOf PopC - ; - -_LogicOneOf : - | _LogicOneOf LogicNameRef - | _LogicOneOf LogicList - ; - -LogicOut : EDIF_TOK_LOGICOUTPUT _LogicOut PopC - ; - -_LogicOut : PortList - | PortRef { str_pair_free($1); } - | PortNameRef - | _LogicOut LogicWave - ; - -LogicPort : EDIF_TOK_LOGICPORT _LogicPort PopC - ; - -_LogicPort : PortNameDef - | _LogicPort Property - | _LogicPort Comment - | _LogicPort UserData - ; - -LogicRef : EDIF_TOK_LOGICREF LogicNameRef _LogicRef PopC - ; - -_LogicRef : - | LibraryRef - ; - -LogicValue : EDIF_TOK_LOGICVALUE _LogicValue PopC - ; - -_LogicValue : LogicNameDef - | _LogicValue VoltageMap - | _LogicValue CurrentMap - | _LogicValue BooleanMap - | _LogicValue Compound - | _LogicValue Weak - | _LogicValue Strong - | _LogicValue Dominates - | _LogicValue LogicMapOut - | _LogicValue LogicMapIn - | _LogicValue Isolated - | _LogicValue Resolves - | _LogicValue Property - | _LogicValue Comment - | _LogicValue UserData - ; - -LogicWave : EDIF_TOK_LOGICWAVEFORM _LogicWave PopC - ; - -_LogicWave : - | _LogicWave LogicNameRef - | _LogicWave LogicList - | _LogicWave LogicOneOf - | _LogicWave Ignore - ; - -Maintain : EDIF_TOK_MAINTAIN __Maintain _Maintain PopC - ; - -__Maintain : PortNameRef - | PortRef { str_pair_free($1); } - ; - -_Maintain : - | Delay - | LoadDelay - ; - -Match : EDIF_TOK_MATCH __Match _Match PopC - ; - -__Match : PortNameRef - | PortRef { str_pair_free($1); } - | PortList - ; - -_Match : LogicNameRef - | LogicList - | LogicOneOf - ; - -Member : EDIF_TOK_MEMBER NameRef _Member PopC { free($2); } - ; - -_Member : Int { free($1); } - | _Member Int { free($2); } - ; - -MiNoMa : EDIF_TOK_MINOMAX _MiNoMa PopC - ; - -_MiNoMa : - | _MiNoMa MiNoMaValue - | _MiNoMa MiNoMaDisp - | _MiNoMa MiNoMa - ; - -MiNoMaDisp : EDIF_TOK_MINOMAXDISPLAY _MiNoMaDisp PopC - ; - -_MiNoMaDisp : MiNoMaValue - | _MiNoMaDisp Display - ; - -MiNoMaValue : Mnm - | ScaledInt - ; - -Mnm : EDIF_TOK_MNM _Mnm _Mnm _Mnm PopC - ; - -_Mnm : ScaledInt - | Undefined - | Unconstrained - ; - -MultValSet : EDIF_TOK_MULTIPLEVALUESET _MultValSet PopC - ; - -_MultValSet : - | _MultValSet RangeVector - ; - -MustJoin : EDIF_TOK_MUSTJOIN _MustJoin PopC - ; - -_MustJoin : - | _MustJoin PortRef { str_pair_free($2); } - | _MustJoin PortList - | _MustJoin WeakJoined - | _MustJoin Joined { pair_list_free($2); } - ; - -Name : EDIF_TOK_NAME _Name PopC { $$=$2; } - ; - -_Name : Ident { $$=$1; } - | _Name Display - ; - -NameDef : Ident { $$ = new_str_pair($1,NULL); } - | Name { $$ = new_str_pair($1,NULL); } -| Rename { $$=$1; } - ; - -NameRef : Ident { $$=$1; } - | Name { $$=$1; } - ; - -Net : EDIF_TOK_NET NetNameDef _Net PopC { define_pcb_net($2, $3); } - ; - -_Net : Joined { $$=$1; } - | _Net Criticality - | _Net NetDelay - | _Net Figure - | _Net Net - | _Net Instance - | _Net CommGraph - | _Net Property - | _Net Comment - | _Net UserData - ; - -NetBackAn : EDIF_TOK_NETBACKANNOTATE _NetBackAn PopC - ; - -_NetBackAn : NetRef - | _NetBackAn NetDelay - | _NetBackAn Criticality - | _NetBackAn Property - | _NetBackAn Comment - ; - -NetBundle : EDIF_TOK_NETBUNDLE NetNameDef _NetBundle PopC { str_pair_free($2); } - ; - -_NetBundle : ListOfNets - | _NetBundle Figure - | _NetBundle CommGraph - | _NetBundle Property - | _NetBundle Comment - | _NetBundle UserData - ; - -NetDelay : EDIF_TOK_NETDELAY Derivation _NetDelay PopC - ; - -_NetDelay : Delay - | _NetDelay Transition - | _NetDelay Becomes - ; - -NetGroup : EDIF_TOK_NETGROUP _NetGroup PopC - ; - -_NetGroup : - | _NetGroup NetNameRef - | _NetGroup NetRef - ; - -NetMap : EDIF_TOK_NETMAP _NetMap PopC - ; - -_NetMap : - | _NetMap NetRef - | _NetMap NetGroup - | _NetMap Comment - | _NetMap UserData - ; - -NetNameDef : NameDef { $$=$1; } -| Array { $$=NULL; } - - ; - -NetNameRef : NameRef { free($1); } - | Member - ; - -NetRef : EDIF_TOK_NETREF NetNameRef _NetRef PopC - ; - -_NetRef : - | NetRef - | InstanceRef { free($1); } - | ViewRef - ; - -NoChange : EDIF_TOK_NOCHANGE PopC - ; - -NonPermut : EDIF_TOK_NONPERMUTABLE _NonPermut PopC - ; - -_NonPermut : - | _NonPermut PortRef { str_pair_free($2); } - | _NonPermut Permutable - ; - -NotAllowed : EDIF_TOK_NOTALLOWED RuleNameDef _NotAllowed PopC - ; - -_NotAllowed : FigGrpObj - | _NotAllowed Comment - | _NotAllowed UserData - ; - -NotchSpace : EDIF_TOK_NOTCHSPACING RuleNameDef FigGrpObj _NotchSpace PopC - ; - -_NotchSpace : Range - | SingleValSet - | _NotchSpace Comment - | _NotchSpace UserData - ; - -Number : EDIF_TOK_NUMBER _Number PopC - ; - -_Number : - | _Number ScaledInt - | _Number NumbDisplay - | _Number Number - ; - -NumbDisplay : EDIF_TOK_NUMBERDISPLAY _NumbDisplay PopC - ; - -_NumbDisplay : ScaledInt - | _NumbDisplay Display - ; - -NumberDefn : EDIF_TOK_NUMBERDEFINITION _NumberDefn PopC - ; - -_NumberDefn : - | _NumberDefn Scale - | _NumberDefn GridMap - | _NumberDefn Comment - ; - -OffPageConn : EDIF_TOK_OFFPAGECONNECTOR _OffPageConn PopC - ; - -_OffPageConn : PortNameDef - | _OffPageConn Unused - | _OffPageConn Property - | _OffPageConn Comment - | _OffPageConn UserData - ; - -OffsetEvent : EDIF_TOK_OFFSETEVENT Event ScaledInt PopC - ; - -OpenShape : EDIF_TOK_OPENSHAPE _OpenShape PopC - ; - -_OpenShape : Curve - | _OpenShape Property - ; - -Orientation : EDIF_TOK_ORIENTATION _Orientation PopC - ; - -_Orientation : EDIF_TOK_R0 - | EDIF_TOK_R90 - | EDIF_TOK_R180 - | EDIF_TOK_R270 - | EDIF_TOK_MX - | EDIF_TOK_MY - | EDIF_TOK_MYR90 - | EDIF_TOK_MXR90 - ; - -Origin : EDIF_TOK_ORIGIN PointValue PopC - ; - -OverhngDist : EDIF_TOK_OVERHANGDISTANCE RuleNameDef FigGrpObj FigGrpObj _OverhngDist - PopC - ; - -_OverhngDist : Range - | SingleValSet - | _OverhngDist Comment - | _OverhngDist UserData - ; - -OverlapDist : EDIF_TOK_OVERLAPDISTANCE RuleNameDef FigGrpObj FigGrpObj _OverlapDist - PopC - ; - -_OverlapDist : Range - | SingleValSet - | _OverlapDist Comment - | _OverlapDist UserData - ; - -Oversize : EDIF_TOK_OVERSIZE Int _Oversize CornerType PopC { free($2); } - ; - -_Oversize : FigGrpRef - | FigureOp - ; - -Owner : EDIF_TOK_OWNER Str PopC { free($2); } - ; - -Page : EDIF_TOK_PAGE _Page PopC - ; - -_Page : InstNameDef - | _Page Instance - | _Page Net - | _Page NetBundle - | _Page CommGraph - | _Page PortImpl - | _Page PageSize - | _Page BoundBox - | _Page Comment - | _Page UserData - ; - -PageSize : EDIF_TOK_PAGESIZE Rectangle PopC - ; - -ParamDisp : EDIF_TOK_PARAMETERDISPLAY _ParamDisp PopC - ; - -_ParamDisp : ValueNameRef - | _ParamDisp Display - ; - -Parameter : EDIF_TOK_PARAMETER ValueNameDef TypedValue _Parameter PopC - ; - -_Parameter : - | Unit - ; - -ParamAssign : EDIF_TOK_PARAMETERASSIGN ValueNameRef TypedValue PopC - ; - -Path : EDIF_TOK_PATH _Path PopC - ; - -_Path : PointList - | _Path Property - ; - -PathDelay : EDIF_TOK_PATHDELAY _PathDelay PopC - ; - -_PathDelay : Delay - | _PathDelay Event - ; - -PathWidth : EDIF_TOK_PATHWIDTH Int PopC { free($2); } - ; - -Permutable : EDIF_TOK_PERMUTABLE _Permutable PopC - ; - -_Permutable : - | _Permutable PortRef { str_pair_free($2); } - | _Permutable Permutable - | _Permutable NonPermut - ; - -Plug : EDIF_TOK_PLUG _Plug PopC - ; - -_Plug : - | _Plug SocketSet - ; - -Point : EDIF_TOK_POINT _Point PopC - ; - -_Point : - | _Point PointValue - | _Point PointDisp - | _Point Point - ; - -PointDisp : EDIF_TOK_POINTDISPLAY _PointDisp PopC - ; - -_PointDisp : PointValue - | _PointDisp Display - ; - -PointList : EDIF_TOK_POINTLIST _PointList PopC - ; - -_PointList : - | _PointList PointValue - ; - -PointValue : EDIF_TOK_PT Int Int PopC { free($2); free($3); } - ; - -Polygon : EDIF_TOK_POLYGON _Polygon PopC - ; - -_Polygon : PointList - | _Polygon Property - ; - -Port : EDIF_TOK_PORT _Port PopC - ; - -_Port : PortNameDef - | _Port Direction - | _Port Unused - | _Port PortDelay - | _Port Designator - | _Port DcFanInLoad - | _Port DcFanOutLoad - | _Port DcMaxFanIn - | _Port DcMaxFanOut - | _Port AcLoad - | _Port Property - | _Port Comment - | _Port UserData - ; - -PortBackAn : EDIF_TOK_PORTBACKANNOTATE _PortBackAn PopC - ; - -_PortBackAn : PortRef { str_pair_free($1); } - | _PortBackAn Designator - | _PortBackAn PortDelay - | _PortBackAn DcFanInLoad - | _PortBackAn DcFanOutLoad - | _PortBackAn DcMaxFanIn - | _PortBackAn DcMaxFanOut - | _PortBackAn AcLoad - | _PortBackAn Property - | _PortBackAn Comment - ; - -PortBundle : EDIF_TOK_PORTBUNDLE PortNameDef _PortBundle PopC - ; - -_PortBundle : ListOfPorts - | _PortBundle Property - | _PortBundle Comment - | _PortBundle UserData - ; - -PortDelay : EDIF_TOK_PORTDELAY Derivation _PortDelay PopC - ; - -_PortDelay : Delay - | LoadDelay - | _PortDelay Transition - | _PortDelay Becomes - ; - -PortGroup : EDIF_TOK_PORTGROUP _PortGroup PopC - ; - -_PortGroup : - | _PortGroup PortNameRef - | _PortGroup PortRef { str_pair_free($2); } - ; - -PortImpl : EDIF_TOK_PORTIMPLEMENTATION _PortImpl PopC - ; - -_PortImpl : PortRef { str_pair_free($1); } - | PortNameRef - | _PortImpl ConnectLoc - | _PortImpl Figure - | _PortImpl Instance - | _PortImpl CommGraph - | _PortImpl PropDisplay - | _PortImpl KeywordDisp - | _PortImpl Property - | _PortImpl UserData - | _PortImpl Comment - ; - -PortInst : EDIF_TOK_PORTINSTANCE _PortInst PopC - ; - -_PortInst : PortRef { str_pair_free($1); } - | PortNameRef - | _PortInst Unused - | _PortInst PortDelay - | _PortInst Designator - | _PortInst DcFanInLoad - | _PortInst DcFanOutLoad - | _PortInst DcMaxFanIn - | _PortInst DcMaxFanOut - | _PortInst AcLoad - | _PortInst Property - | _PortInst Comment - | _PortInst UserData - ; - -PortList : EDIF_TOK_PORTLIST _PortList PopC - ; - -_PortList : - | _PortList PortRef { str_pair_free($2); } - | _PortList PortNameRef - ; - -PortListAls : EDIF_TOK_PORTLISTALIAS PortNameDef PortList PopC - ; - -PortMap : EDIF_TOK_PORTMAP _PortMap PopC - ; - -_PortMap : - | _PortMap PortRef { str_pair_free($2); } - | _PortMap PortGroup - | _PortMap Comment - | _PortMap UserData - ; - -PortNameDef : NameDef { str_pair_free($1); } - | Array - ; - -PortNameRef : NameRef { $$=$1; } - | Member - ; - -PortRef : EDIF_TOK_PORTREF PortNameRef _PortRef PopC -{ - if ($3) - { - $$ = new_str_pair($3->str1,$2); - free($3); - } - else - { - /* handle port with no instance by passing up the chain */ - $$ = new_str_pair(NULL,$2); - } -} - ; - -_PortRef : { $$=NULL; } - | PortRef { $$=$1; } - | InstanceRef { $$ = new_str_pair($1,NULL); } - | ViewRef { $$=NULL; } - ; - -Program : EDIF_TOK_PROGRAM Str _Program PopC - ; - -_Program : - | Version - ; - -PropDisplay : EDIF_TOK_PROPERTYDISPLAY _PropDisplay PopC - ; - -_PropDisplay : PropNameRef - | _PropDisplay Display - ; - -Property : EDIF_TOK_PROPERTY PropNameDef _Property PopC - ; - -_Property : TypedValue - | _Property Owner - | _Property Unit - | _Property Property - | _Property Comment - ; - -PropNameDef : NameDef { str_pair_free($1); } - ; - -PropNameRef : NameRef { free($1); } - ; - -ProtectFrame : EDIF_TOK_PROTECTIONFRAME _ProtectFrame PopC - ; - -_ProtectFrame : - | _ProtectFrame PortImpl - | _ProtectFrame Figure - | _ProtectFrame Instance - | _ProtectFrame CommGraph - | _ProtectFrame BoundBox - | _ProtectFrame PropDisplay - | _ProtectFrame KeywordDisp - | _ProtectFrame ParamDisp - | _ProtectFrame Property - | _ProtectFrame Comment - | _ProtectFrame UserData - ; - -Range : LessThan - | GreaterThan - | AtMost - | AtLeast - | Exactly - | Between - ; - -RangeVector : EDIF_TOK_RANGEVECTOR _RangeVector PopC - ; - -_RangeVector : - | _RangeVector Range - | _RangeVector SingleValSet - ; - -Rectangle : EDIF_TOK_RECTANGLE PointValue _Rectangle PopC - ; - -_Rectangle : PointValue - | _Rectangle Property - ; - -RectSize : EDIF_TOK_RECTANGLESIZE RuleNameDef FigGrpObj _RectSize PopC - ; - -_RectSize : RangeVector - | MultValSet - | _RectSize Comment - | _RectSize UserData - ; - -Rename : EDIF_TOK_RENAME __Rename _Rename PopC -{ $$ = new_str_pair($2,$3); } - ; - -__Rename : Ident { $$=$1; } - | Name { $$=$1; } - ; - -_Rename : Str { $$=$1; } - | StrDisplay { $$=NULL; } - ; - -Resolves : EDIF_TOK_RESOLVES _Resolves PopC - ; - -_Resolves : - | _Resolves LogicNameRef - ; - -RuleNameDef : NameDef { str_pair_free($1); } - ; - -Scale : EDIF_TOK_SCALE ScaledInt ScaledInt Unit PopC - ; - -ScaledInt : Int { free($1); } - | EDIF_TOK_E Int Int PopC { free($2); free($3); } - ; - -ScaleX : EDIF_TOK_SCALEX Int Int PopC { free($2); free($3); } - ; - -ScaleY : EDIF_TOK_SCALEY Int Int PopC { free($2); free($3); } - ; - -Section : EDIF_TOK_SECTION _Section PopC - ; - -_Section : Str { free($1); } - | _Section Section - | _Section Str { free($2); } - | _Section Instance - ; - -Shape : EDIF_TOK_SHAPE _Shape PopC - ; - -_Shape : Curve - | _Shape Property - ; - -SimNameDef : NameDef { str_pair_free($1); } - ; - -Simulate : EDIF_TOK_SIMULATE _Simulate PopC - ; - -_Simulate : SimNameDef - | _Simulate PortListAls - | _Simulate WaveValue - | _Simulate Apply - | _Simulate Comment - | _Simulate UserData - ; - -SimulInfo : EDIF_TOK_SIMULATIONINFO _SimulInfo PopC - ; - -_SimulInfo : - | _SimulInfo LogicValue - | _SimulInfo Comment - | _SimulInfo UserData - ; - -SingleValSet : EDIF_TOK_SINGLEVALUESET _SingleValSet PopC - ; - -_SingleValSet : - | Range - ; - -Site : EDIF_TOK_SITE ViewRef _Site PopC - ; - -_Site : - | Transform - ; - -Socket : EDIF_TOK_SOCKET _Socket PopC - ; - -_Socket : - | Symmetry - ; - -SocketSet : EDIF_TOK_SOCKETSET _SocketSet PopC - ; - -_SocketSet : Symmetry - | _SocketSet Site - ; - -Status : EDIF_TOK_STATUS _Status PopC - ; - -_Status : - | _Status Written - | _Status Comment - | _Status UserData - ; - -Steady : EDIF_TOK_STEADY __Steady _Steady PopC - ; - -__Steady : PortNameRef - | PortRef { str_pair_free($1); } - | PortList - ; - -_Steady : Duration - | _Steady Transition - | _Steady Becomes - ; - -StrDisplay : EDIF_TOK_STRINGDISPLAY _StrDisplay PopC - ; - -String : EDIF_TOK_STRING _String PopC - ; - -_String : - | _String Str { free($2); } - | _String StrDisplay - | _String String - ; - -_StrDisplay : Str { free($1); } - | _StrDisplay Display - ; - -Strong : EDIF_TOK_STRONG LogicNameRef PopC - ; - -Symbol : EDIF_TOK_SYMBOL _Symbol PopC - ; - -_Symbol : - | _Symbol PortImpl - | _Symbol Figure - | _Symbol Instance - | _Symbol CommGraph - | _Symbol Annotate - | _Symbol PageSize - | _Symbol BoundBox - | _Symbol PropDisplay - | _Symbol KeywordDisp - | _Symbol ParamDisp - | _Symbol Property - | _Symbol Comment - | _Symbol UserData - ; - -Symmetry : EDIF_TOK_SYMMETRY _Symmetry PopC - ; - -_Symmetry : - | _Symmetry Transform - ; - -Table : EDIF_TOK_TABLE _Table PopC - ; - -_Table : - | _Table Entry - | _Table TableDeflt - ; - -TableDeflt : EDIF_TOK_TABLEDEFAULT __TableDeflt _TableDeflt PopC - ; - -__TableDeflt : LogicRef - | PortRef { str_pair_free($1); } - | NoChange - | Table - ; - -_TableDeflt : - | Delay - | LoadDelay - ; - -Technology : EDIF_TOK_TECHNOLOGY _Technology PopC - ; - -_Technology : NumberDefn - | _Technology FigGrp - | _Technology Fabricate - | _Technology SimulInfo - | _Technology DesignRule - | _Technology Comment - | _Technology UserData - ; - -TextHeight : EDIF_TOK_TEXTHEIGHT Int PopC { free($2); } - ; - -TimeIntval : EDIF_TOK_TIMEINTERVAL __TimeIntval _TimeIntval PopC - ; - -__TimeIntval : Event - | OffsetEvent - ; - -_TimeIntval : Event - | OffsetEvent - | Duration - ; - -TimeStamp : EDIF_TOK_TIMESTAMP Int Int Int Int Int Int PopC -{ free($2); free($3); free($4); free($5); free($6); free($7); } - ; - -Timing : EDIF_TOK_TIMING _Timing PopC - ; - -_Timing : Derivation - | _Timing PathDelay - | _Timing Forbidden - | _Timing Comment - | _Timing UserData - ; - -Transform : EDIF_TOK_TRANSFORM _TransX _TransY _TransDelta _TransOrien _TransOrg - PopC - ; - -_TransX : - | ScaleX - ; - -_TransY : - | ScaleY - ; - -_TransDelta : - | Delta - ; - -_TransOrien : - | Orientation - ; - -_TransOrg : - | Origin - ; - -Transition : EDIF_TOK_TRANSITION _Transition _Transition PopC - ; - -_Transition : LogicNameRef - | LogicList - | LogicOneOf - ; - -Trigger : EDIF_TOK_TRIGGER _Trigger PopC - ; - -_Trigger : - | _Trigger Change - | _Trigger Steady - | _Trigger Initial - ; - -True : EDIF_TOK_TRUE PopC - ; - -TypedValue : Boolean - | Integer - | MiNoMa - | Number - | Point - | String - ; - -Unconstrained : EDIF_TOK_UNCONSTRAINED PopC - ; - -Undefined : EDIF_TOK_UNDEFINED PopC - ; - -Union : EDIF_TOK_UNION _Union PopC - ; - -_Union : FigGrpRef - | FigureOp - | _Union FigGrpRef - | _Union FigureOp - ; - -Unit : EDIF_TOK_UNIT _Unit PopC - ; - -_Unit : EDIF_TOK_DISTANCE - | EDIF_TOK_CAPACITANCE - | EDIF_TOK_CURRENT - | EDIF_TOK_RESISTANCE - | EDIF_TOK_TEMPERATURE - | EDIF_TOK_TIME - | EDIF_TOK_VOLTAGE - | EDIF_TOK_MASS - | EDIF_TOK_FREQUENCY - | EDIF_TOK_INDUCTANCE - | EDIF_TOK_ENERGY - | EDIF_TOK_POWER - | EDIF_TOK_CHARGE - | EDIF_TOK_CONDUCTANCE - | EDIF_TOK_FLUX - | EDIF_TOK_ANGLE - ; - -Unused : EDIF_TOK_UNUSED PopC - ; - -UserData : EDIF_TOK_USERDATA _UserData PopC - ; - -_UserData : Ident { free($1); } - | _UserData Int { free($2); } - | _UserData Str { free($2); } - | _UserData Ident { free($2); } - | _UserData Form - ; - -ValueNameDef : NameDef { str_pair_free($1); } - | Array - ; - -ValueNameRef : NameRef { free($1); } - | Member - ; - -Version : EDIF_TOK_VERSION Str PopC { free($2); } - ; - -View : EDIF_TOK_VIEW ViewNameDef ViewType _View PopC - ; - -_View : Interface - | _View Status - | _View Contents - | _View Comment - | _View Property - | _View UserData - ; - -ViewList : EDIF_TOK_VIEWLIST _ViewList PopC - ; - -_ViewList : - | _ViewList ViewRef - | _ViewList ViewList - ; - -ViewMap : EDIF_TOK_VIEWMAP _ViewMap PopC - ; - -_ViewMap : - | _ViewMap PortMap - | _ViewMap PortBackAn - | _ViewMap InstMap - | _ViewMap InstBackAn - | _ViewMap NetMap - | _ViewMap NetBackAn - | _ViewMap Comment - | _ViewMap UserData - ; - -ViewNameDef : NameDef { str_pair_free($1); } - ; - -ViewNameRef : NameRef { free($1); } - ; - -ViewRef : EDIF_TOK_VIEWREF ViewNameRef _ViewRef PopC - ; - -_ViewRef : - | CellRef - ; - -ViewType : EDIF_TOK_VIEWTYPE _ViewType PopC - ; - -_ViewType : EDIF_TOK_MASKLAYOUT - | EDIF_TOK_PCBLAYOUT - | EDIF_TOK_NETLIST - | EDIF_TOK_SCHEMATIC - | EDIF_TOK_SYMBOLIC - | EDIF_TOK_BEHAVIOR - | EDIF_TOK_LOGICMODEL - | EDIF_TOK_DOCUMENT - | EDIF_TOK_GRAPHIC - | EDIF_TOK_STRANGER - ; - -Visible : EDIF_TOK_VISIBLE BooleanValue PopC - ; - -VoltageMap : EDIF_TOK_VOLTAGEMAP MiNoMaValue PopC - ; - -WaveValue : EDIF_TOK_WAVEVALUE LogicNameDef ScaledInt LogicWave PopC - ; - -Weak : EDIF_TOK_WEAK LogicNameRef PopC - ; - -WeakJoined : EDIF_TOK_WEAKJOINED _WeakJoined PopC - ; - -_WeakJoined : - | _WeakJoined PortRef { str_pair_free($2); } - | _WeakJoined PortList - | _WeakJoined Joined { pair_list_free($2); } - ; - -When : EDIF_TOK_WHEN _When PopC - ; - -_When : Trigger - | _When After - | _When Follow - | _When Maintain - | _When LogicAssn - | _When Comment - | _When UserData - ; - -Written : EDIF_TOK_WRITTEN _Written PopC - ; - -_Written : TimeStamp - | _Written Author - | _Written Program - | _Written DataOrigin - | _Written Property - | _Written Comment - | _Written UserData - ; - -Ident : EDIF_TOK_IDENT { $$=$1; } - ; - -Str : EDIF_TOK_STR { $$=$1; } - ; - -Int : EDIF_TOK_INT { $$=$1; } - ; - -Keyword : EDIF_TOK_KEYWORD { $$=$1; } - ; - -%% -/* - * xmalloc: - * - * Garbage function for 'alloca()'. - */ -char *xmalloc(int siz) -{ - return ((char *)Malloc(siz)); -} -/* - * Token & context carriers: - * - * These are the linkage pointers for threading this context garbage - * for converting identifiers into parser tokens. - */ -typedef struct TokenCar { - struct TokenCar *Next; /* pointer to next carrier */ - struct Token *Token; /* associated token */ -} TokenCar; -typedef struct UsedCar { - struct UsedCar *Next; /* pointer to next carrier */ - short Code; /* used '%token' value */ -} UsedCar; -typedef struct ContextCar { - struct ContextCar *Next; /* pointer to next carrier */ - struct Context *Context; /* associated context */ - union { - int Single; /* single usage flag (context tree) */ - struct UsedCar *Used; /* single used list (context stack) */ - } u; -} ContextCar; -/* - * Token definitions: - * - * This associates the '%token' codings with strings which are to - * be free standing tokens. Doesn't have to be in sorted order but the - * strings must be in lower case. - */ -typedef struct Token { - const char *Name; /* token name */ - int Code; /* '%token' value */ - struct Token *Next; /* hash table linkage */ -} Token; -static Token TokenDef[] = { - {"angle", EDIF_TOK_ANGLE}, - {"behavior", EDIF_TOK_BEHAVIOR}, - {"calculated", EDIF_TOK_CALCULATED}, - {"capacitance", EDIF_TOK_CAPACITANCE}, - {"centercenter", EDIF_TOK_CENTERCENTER}, - {"centerleft", EDIF_TOK_CENTERLEFT}, - {"centerright", EDIF_TOK_CENTERRIGHT}, - {"charge", EDIF_TOK_CHARGE}, - {"conductance", EDIF_TOK_CONDUCTANCE}, - {"current", EDIF_TOK_CURRENT}, - {"distance", EDIF_TOK_DISTANCE}, - {"document", EDIF_TOK_DOCUMENT}, - {"energy", EDIF_TOK_ENERGY}, - {"extend", EDIF_TOK_EXTEND}, - {"flux", EDIF_TOK_FLUX}, - {"frequency", EDIF_TOK_FREQUENCY}, - {"generic", EDIF_TOK_GENERIC}, - {"graphic", EDIF_TOK_GRAPHIC}, - {"inductance", EDIF_TOK_INDUCTANCE}, - {"inout", EDIF_TOK_INOUT}, - {"input", EDIF_TOK_INPUT}, - {"logicmodel", EDIF_TOK_LOGICMODEL}, - {"lowercenter", EDIF_TOK_LOWERCENTER}, - {"lowerleft", EDIF_TOK_LOWERLEFT}, - {"lowerright", EDIF_TOK_LOWERRIGHT}, - {"masklayout", EDIF_TOK_MASKLAYOUT}, - {"mass", EDIF_TOK_MASS}, - {"measured", EDIF_TOK_MEASURED}, - {"mx", EDIF_TOK_MX}, - {"mxr90", EDIF_TOK_MXR90}, - {"my", EDIF_TOK_MY}, - {"myr90", EDIF_TOK_MYR90}, - {"netlist", EDIF_TOK_NETLIST}, - {"output", EDIF_TOK_OUTPUT}, - {"pcblayout", EDIF_TOK_PCBLAYOUT}, - {"power", EDIF_TOK_POWER}, - {"r0", EDIF_TOK_R0}, - {"r180", EDIF_TOK_R180}, - {"r270", EDIF_TOK_R270}, - {"r90", EDIF_TOK_R90}, - {"required", EDIF_TOK_REQUIRED}, - {"resistance", EDIF_TOK_RESISTANCE}, - {"ripper", EDIF_TOK_RIPPER}, - {"round", EDIF_TOK_ROUND}, - {"schematic", EDIF_TOK_SCHEMATIC}, - {"stranger", EDIF_TOK_STRANGER}, - {"symbolic", EDIF_TOK_SYMBOLIC}, - {"temperature", EDIF_TOK_TEMPERATURE}, - {"tie", EDIF_TOK_TIE}, - {"time", EDIF_TOK_TIME}, - {"truncate", EDIF_TOK_TRUNCATE}, - {"uppercenter", EDIF_TOK_UPPERCENTER}, - {"upperleft", EDIF_TOK_UPPERLEFT}, - {"upperright", EDIF_TOK_UPPERRIGHT}, - {"voltage", EDIF_TOK_VOLTAGE} -}; -static int TokenDefSize = sizeof(TokenDef) / sizeof(Token); -/* - * Token enable definitions: - * - * There is one array for each set of tokens enabled by a - * particular context (barf). Another array is used to bind - * these arrays to a context. - */ -static short e_CellType[] = {EDIF_TOK_TIE, EDIF_TOK_RIPPER, EDIF_TOK_GENERIC}; -static short e_CornerType[] = {EDIF_TOK_EXTEND, EDIF_TOK_TRUNCATE, - EDIF_TOK_ROUND}; -static short e_Derivation[] = {EDIF_TOK_CALCULATED, EDIF_TOK_MEASURED, - EDIF_TOK_REQUIRED}; -static short e_Direction[] = {EDIF_TOK_INPUT, EDIF_TOK_OUTPUT, - EDIF_TOK_INOUT}; -static short e_EndType[] = {EDIF_TOK_EXTEND, EDIF_TOK_TRUNCATE, - EDIF_TOK_ROUND}; -static short e_Justify[] = {EDIF_TOK_CENTERCENTER, EDIF_TOK_CENTERLEFT, - EDIF_TOK_CENTERRIGHT, EDIF_TOK_LOWERCENTER, - EDIF_TOK_LOWERLEFT, EDIF_TOK_LOWERRIGHT, - EDIF_TOK_UPPERCENTER, EDIF_TOK_UPPERLEFT, - EDIF_TOK_UPPERRIGHT}; -static short e_Orientation[] = {EDIF_TOK_R0, EDIF_TOK_R90, EDIF_TOK_R180, - EDIF_TOK_R270, EDIF_TOK_MX, EDIF_TOK_MY, - EDIF_TOK_MXR90, EDIF_TOK_MYR90}; -static short e_Unit[] = {EDIF_TOK_DISTANCE, EDIF_TOK_CAPACITANCE, - EDIF_TOK_CURRENT, EDIF_TOK_RESISTANCE, - EDIF_TOK_TEMPERATURE, EDIF_TOK_TIME, - EDIF_TOK_VOLTAGE, EDIF_TOK_MASS, EDIF_TOK_FREQUENCY, - EDIF_TOK_INDUCTANCE, EDIF_TOK_ENERGY, - EDIF_TOK_POWER, EDIF_TOK_CHARGE, - EDIF_TOK_CONDUCTANCE, EDIF_TOK_FLUX, EDIF_TOK_ANGLE}; -static short e_ViewType[] = {EDIF_TOK_MASKLAYOUT, EDIF_TOK_PCBLAYOUT, - EDIF_TOK_NETLIST, EDIF_TOK_SCHEMATIC, - EDIF_TOK_SYMBOLIC, EDIF_TOK_BEHAVIOR, - EDIF_TOK_LOGICMODEL, EDIF_TOK_DOCUMENT, - EDIF_TOK_GRAPHIC, EDIF_TOK_STRANGER}; -/* - * Token tying table: - * - * This binds enabled tokens to a context. - */ -typedef struct Tie { - short *Enable; /* pointer to enable array */ - short Origin; /* '%token' value of context */ - short EnableSize; /* size of enabled array */ -} Tie; -#define TE(e,o) {e,o,sizeof(e)/sizeof(short)} -static Tie TieDef[] = { - TE(e_CellType, EDIF_TOK_CELLTYPE), - TE(e_CornerType, EDIF_TOK_CORNERTYPE), - TE(e_Derivation, EDIF_TOK_DERIVATION), - TE(e_Direction, EDIF_TOK_DIRECTION), - TE(e_EndType, EDIF_TOK_ENDTYPE), - TE(e_Justify, EDIF_TOK_JUSTIFY), - TE(e_Orientation, EDIF_TOK_ORIENTATION), - TE(e_Unit, EDIF_TOK_UNIT), - TE(e_ViewType, EDIF_TOK_VIEWTYPE) -}; -static int TieDefSize = sizeof(TieDef) / sizeof(Tie); -/* - * Context definitions: - * - * This associates keyword strings with '%token' values. It - * also creates a pretty much empty header for later building of - * the context tree. Again they needn't be sorted, but strings - * must be lower case. - */ -typedef struct Context { - const char *Name; /* keyword name */ - short Code; /* '%token' value */ - short Flags; /* special operation flags */ - struct ContextCar *Context; /* contexts which can be moved to */ - struct TokenCar *Token; /* active tokens */ - struct Context *Next; /* hash table linkage */ -} Context; -static Context ContextDef[] = { - {"", 0}, /* start context */ - {"acload", EDIF_TOK_ACLOAD}, - {"after", EDIF_TOK_AFTER}, - {"annotate", EDIF_TOK_ANNOTATE}, - {"apply", EDIF_TOK_APPLY}, - {"arc", EDIF_TOK_ARC}, - {"array", EDIF_TOK_ARRAY}, - {"arraymacro", EDIF_TOK_ARRAYMACRO}, - {"arrayrelatedinfo", EDIF_TOK_ARRAYRELATEDINFO}, - {"arraysite", EDIF_TOK_ARRAYSITE}, - {"atleast", EDIF_TOK_ATLEAST}, - {"atmost", EDIF_TOK_ATMOST}, - {"author", EDIF_TOK_AUTHOR}, - {"basearray", EDIF_TOK_BASEARRAY}, - {"becomes", EDIF_TOK_BECOMES}, - {"between", EDIF_TOK_BETWEEN}, - {"boolean", EDIF_TOK_BOOLEAN}, - {"booleandisplay", EDIF_TOK_BOOLEANDISPLAY}, - {"booleanmap", EDIF_TOK_BOOLEANMAP}, - {"borderpattern", EDIF_TOK_BORDERPATTERN}, - {"borderwidth", EDIF_TOK_BORDERWIDTH}, - {"boundingbox", EDIF_TOK_BOUNDINGBOX}, - {"cell", EDIF_TOK_CELL}, - {"cellref", EDIF_TOK_CELLREF}, - {"celltype", EDIF_TOK_CELLTYPE}, - {"change", EDIF_TOK_CHANGE}, - {"circle", EDIF_TOK_CIRCLE}, - {"color", EDIF_TOK_COLOR}, - {"comment", EDIF_TOK_COMMENT}, - {"commentgraphics", EDIF_TOK_COMMENTGRAPHICS}, - {"compound", EDIF_TOK_COMPOUND}, - {"connectlocation", EDIF_TOK_CONNECTLOCATION}, - {"contents", EDIF_TOK_CONTENTS}, - {"cornertype", EDIF_TOK_CORNERTYPE}, - {"criticality", EDIF_TOK_CRITICALITY}, - {"currentmap", EDIF_TOK_CURRENTMAP}, - {"curve", EDIF_TOK_CURVE}, - {"cycle", EDIF_TOK_CYCLE}, - {"dataorigin", EDIF_TOK_DATAORIGIN}, - {"dcfaninload", EDIF_TOK_DCFANINLOAD}, - {"dcfanoutload", EDIF_TOK_DCFANOUTLOAD}, - {"dcmaxfanin", EDIF_TOK_DCMAXFANIN}, - {"dcmaxfanout", EDIF_TOK_DCMAXFANOUT}, - {"delay", EDIF_TOK_DELAY}, - {"delta", EDIF_TOK_DELTA}, - {"derivation", EDIF_TOK_DERIVATION}, - {"design", EDIF_TOK_DESIGN}, - {"designator", EDIF_TOK_DESIGNATOR}, - {"difference", EDIF_TOK_DIFFERENCE}, - {"direction", EDIF_TOK_DIRECTION}, - {"display", EDIF_TOK_DISPLAY}, - {"dominates", EDIF_TOK_DOMINATES}, - {"dot", EDIF_TOK_DOT}, - {"duration", EDIF_TOK_DURATION}, - {"e", EDIF_TOK_E}, - {"edif", EDIF_TOK_EDIF}, - {"ediflevel", EDIF_TOK_EDIFLEVEL}, - {"edifversion", EDIF_TOK_EDIFVERSION}, - {"enclosuredistance", EDIF_TOK_ENCLOSUREDISTANCE}, - {"endtype", EDIF_TOK_ENDTYPE}, - {"entry", EDIF_TOK_ENTRY}, - {"exactly", EDIF_TOK_EXACTLY}, - {"external", EDIF_TOK_EXTERNAL}, - {"fabricate", EDIF_TOK_FABRICATE}, - {"false", EDIF_TOK_FALSE}, - {"figure", EDIF_TOK_FIGURE}, - {"figurearea", EDIF_TOK_FIGUREAREA}, - {"figuregroup", EDIF_TOK_FIGUREGROUP}, - {"figuregroupobject", EDIF_TOK_FIGUREGROUPOBJECT}, - {"figuregroupoverride", EDIF_TOK_FIGUREGROUPOVERRIDE}, - {"figuregroupref", EDIF_TOK_FIGUREGROUPREF}, - {"figureperimeter", EDIF_TOK_FIGUREPERIMETER}, - {"figurewidth", EDIF_TOK_FIGUREWIDTH}, - {"fillpattern", EDIF_TOK_FILLPATTERN}, - {"follow", EDIF_TOK_FOLLOW}, - {"forbiddenevent", EDIF_TOK_FORBIDDENEVENT}, - {"globalportref", EDIF_TOK_GLOBALPORTREF}, - {"greaterthan", EDIF_TOK_GREATERTHAN}, - {"gridmap", EDIF_TOK_GRIDMAP}, - {"ignore", EDIF_TOK_IGNORE}, - {"includefiguregroup", EDIF_TOK_INCLUDEFIGUREGROUP}, - {"initial", EDIF_TOK_INITIAL}, - {"instance", EDIF_TOK_INSTANCE}, - {"instancebackannotate", EDIF_TOK_INSTANCEBACKANNOTATE}, - {"instancegroup", EDIF_TOK_INSTANCEGROUP}, - {"instancemap", EDIF_TOK_INSTANCEMAP}, - {"instanceref", EDIF_TOK_INSTANCEREF}, - {"integer", EDIF_TOK_INTEGER}, - {"integerdisplay", EDIF_TOK_INTEGERDISPLAY}, - {"interface", EDIF_TOK_INTERFACE}, - {"interfiguregroupspacing", EDIF_TOK_INTERFIGUREGROUPSPACING}, - {"intersection", EDIF_TOK_INTERSECTION}, - {"intrafiguregroupspacing", EDIF_TOK_INTRAFIGUREGROUPSPACING}, - {"inverse", EDIF_TOK_INVERSE}, - {"isolated", EDIF_TOK_ISOLATED}, - {"joined", EDIF_TOK_JOINED}, - {"justify", EDIF_TOK_JUSTIFY}, - {"keyworddisplay", EDIF_TOK_KEYWORDDISPLAY}, - {"keywordlevel", EDIF_TOK_KEYWORDLEVEL}, - {"keywordmap", EDIF_TOK_KEYWORDMAP}, - {"lessthan", EDIF_TOK_LESSTHAN}, - {"library", EDIF_TOK_LIBRARY}, - {"libraryref", EDIF_TOK_LIBRARYREF}, - {"listofnets", EDIF_TOK_LISTOFNETS}, - {"listofports", EDIF_TOK_LISTOFPORTS}, - {"loaddelay", EDIF_TOK_LOADDELAY}, - {"logicassign", EDIF_TOK_LOGICASSIGN}, - {"logicinput", EDIF_TOK_LOGICINPUT}, - {"logiclist", EDIF_TOK_LOGICLIST}, - {"logicmapinput", EDIF_TOK_LOGICMAPINPUT}, - {"logicmapoutput", EDIF_TOK_LOGICMAPOUTPUT}, - {"logiconeof", EDIF_TOK_LOGICONEOF}, - {"logicoutput", EDIF_TOK_LOGICOUTPUT}, - {"logicport", EDIF_TOK_LOGICPORT}, - {"logicref", EDIF_TOK_LOGICREF}, - {"logicvalue", EDIF_TOK_LOGICVALUE}, - {"logicwaveform", EDIF_TOK_LOGICWAVEFORM}, - {"maintain", EDIF_TOK_MAINTAIN}, - {"match", EDIF_TOK_MATCH}, - {"member", EDIF_TOK_MEMBER}, - {"minomax", EDIF_TOK_MINOMAX}, - {"minomaxdisplay", EDIF_TOK_MINOMAXDISPLAY}, - {"mnm", EDIF_TOK_MNM}, - {"multiplevalueset", EDIF_TOK_MULTIPLEVALUESET}, - {"mustjoin", EDIF_TOK_MUSTJOIN}, - {"name", EDIF_TOK_NAME}, - {"net", EDIF_TOK_NET}, - {"netbackannotate", EDIF_TOK_NETBACKANNOTATE}, - {"netbundle", EDIF_TOK_NETBUNDLE}, - {"netdelay", EDIF_TOK_NETDELAY}, - {"netgroup", EDIF_TOK_NETGROUP}, - {"netmap", EDIF_TOK_NETMAP}, - {"netref", EDIF_TOK_NETREF}, - {"nochange", EDIF_TOK_NOCHANGE}, - {"nonpermutable", EDIF_TOK_NONPERMUTABLE}, - {"notallowed", EDIF_TOK_NOTALLOWED}, - {"notchspacing", EDIF_TOK_NOTCHSPACING}, - {"number", EDIF_TOK_NUMBER}, - {"numberdefinition", EDIF_TOK_NUMBERDEFINITION}, - {"numberdisplay", EDIF_TOK_NUMBERDISPLAY}, - {"offpageconnector", EDIF_TOK_OFFPAGECONNECTOR}, - {"offsetevent", EDIF_TOK_OFFSETEVENT}, - {"openshape", EDIF_TOK_OPENSHAPE}, - {"orientation", EDIF_TOK_ORIENTATION}, - {"origin", EDIF_TOK_ORIGIN}, - {"overhangdistance", EDIF_TOK_OVERHANGDISTANCE}, - {"overlapdistance", EDIF_TOK_OVERLAPDISTANCE}, - {"oversize", EDIF_TOK_OVERSIZE}, - {"owner", EDIF_TOK_OWNER}, - {"page", EDIF_TOK_PAGE}, - {"pagesize", EDIF_TOK_PAGESIZE}, - {"parameter", EDIF_TOK_PARAMETER}, - {"parameterassign", EDIF_TOK_PARAMETERASSIGN}, - {"parameterdisplay", EDIF_TOK_PARAMETERDISPLAY}, - {"path", EDIF_TOK_PATH}, - {"pathdelay", EDIF_TOK_PATHDELAY}, - {"pathwidth", EDIF_TOK_PATHWIDTH}, - {"permutable", EDIF_TOK_PERMUTABLE}, - {"physicaldesignrule", EDIF_TOK_PHYSICALDESIGNRULE}, - {"plug", EDIF_TOK_PLUG}, - {"point", EDIF_TOK_POINT}, - {"pointdisplay", EDIF_TOK_POINTDISPLAY}, - {"pointlist", EDIF_TOK_POINTLIST}, - {"polygon", EDIF_TOK_POLYGON}, - {"port", EDIF_TOK_PORT}, - {"portbackannotate", EDIF_TOK_PORTBACKANNOTATE}, - {"portbundle", EDIF_TOK_PORTBUNDLE}, - {"portdelay", EDIF_TOK_PORTDELAY}, - {"portgroup", EDIF_TOK_PORTGROUP}, - {"portimplementation", EDIF_TOK_PORTIMPLEMENTATION}, - {"portinstance", EDIF_TOK_PORTINSTANCE}, - {"portlist", EDIF_TOK_PORTLIST}, - {"portlistalias", EDIF_TOK_PORTLISTALIAS}, - {"portmap", EDIF_TOK_PORTMAP}, - {"portref", EDIF_TOK_PORTREF}, - {"program", EDIF_TOK_PROGRAM}, - {"property", EDIF_TOK_PROPERTY}, - {"propertydisplay", EDIF_TOK_PROPERTYDISPLAY}, - {"protectionframe", EDIF_TOK_PROTECTIONFRAME}, - {"pt", EDIF_TOK_PT}, - {"rangevector", EDIF_TOK_RANGEVECTOR}, - {"rectangle", EDIF_TOK_RECTANGLE}, - {"rectanglesize", EDIF_TOK_RECTANGLESIZE}, - {"rename", EDIF_TOK_RENAME}, - {"resolves", EDIF_TOK_RESOLVES}, - {"scale", EDIF_TOK_SCALE}, - {"scalex", EDIF_TOK_SCALEX}, - {"scaley", EDIF_TOK_SCALEY}, - {"section", EDIF_TOK_SECTION}, - {"shape", EDIF_TOK_SHAPE}, - {"simulate", EDIF_TOK_SIMULATE}, - {"simulationinfo", EDIF_TOK_SIMULATIONINFO}, - {"singlevalueset", EDIF_TOK_SINGLEVALUESET}, - {"site", EDIF_TOK_SITE}, - {"socket", EDIF_TOK_SOCKET}, - {"socketset", EDIF_TOK_SOCKETSET}, - {"status", EDIF_TOK_STATUS}, - {"steady", EDIF_TOK_STEADY}, - {"string", EDIF_TOK_STRING}, - {"stringdisplay", EDIF_TOK_STRINGDISPLAY}, - {"strong", EDIF_TOK_STRONG}, - {"symbol", EDIF_TOK_SYMBOL}, - {"symmetry", EDIF_TOK_SYMMETRY}, - {"table", EDIF_TOK_TABLE}, - {"tabledefault", EDIF_TOK_TABLEDEFAULT}, - {"technology", EDIF_TOK_TECHNOLOGY}, - {"textheight", EDIF_TOK_TEXTHEIGHT}, - {"timeinterval", EDIF_TOK_TIMEINTERVAL}, - {"timestamp", EDIF_TOK_TIMESTAMP}, - {"timing", EDIF_TOK_TIMING}, - {"transform", EDIF_TOK_TRANSFORM}, - {"transition", EDIF_TOK_TRANSITION}, - {"trigger", EDIF_TOK_TRIGGER}, - {"true", EDIF_TOK_TRUE}, - {"unconstrained", EDIF_TOK_UNCONSTRAINED}, - {"undefined", EDIF_TOK_UNDEFINED}, - {"union", EDIF_TOK_UNION}, - {"unit", EDIF_TOK_UNIT}, - {"unused", EDIF_TOK_UNUSED}, - {"userdata", EDIF_TOK_USERDATA}, - {"version", EDIF_TOK_VERSION}, - {"view", EDIF_TOK_VIEW}, - {"viewlist", EDIF_TOK_VIEWLIST}, - {"viewmap", EDIF_TOK_VIEWMAP}, - {"viewref", EDIF_TOK_VIEWREF}, - {"viewtype", EDIF_TOK_VIEWTYPE}, - {"visible", EDIF_TOK_VISIBLE}, - {"voltagemap", EDIF_TOK_VOLTAGEMAP}, - {"wavevalue", EDIF_TOK_WAVEVALUE}, - {"weak", EDIF_TOK_WEAK}, - {"weakjoined", EDIF_TOK_WEAKJOINED}, - {"when", EDIF_TOK_WHEN}, - {"written", EDIF_TOK_WRITTEN} -}; -static int ContextDefSize = sizeof(ContextDef) / sizeof(Context); -/* - * Context follower tables: - * - * This is pretty ugly, an array is defined for each context - * which has following context levels. Yet another table is used - * to bind these arrays to the originating contexts. - * Arrays are declared as: - * - * static short f_[] = { ... }; - * - * The array entries are the '%token' values for all keywords which - * can be reached from the context. Like I said, ugly, - * but it works. - * A negative entry means that the follow can only occur once within - * the specified context. - */ -static short f_NULL[] = {EDIF_TOK_EDIF}; -static short f_Edif[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_EDIFVERSION, - EDIF_TOK_EDIFLEVEL, EDIF_TOK_KEYWORDMAP, - -EDIF_TOK_STATUS, EDIF_TOK_EXTERNAL, - EDIF_TOK_LIBRARY, EDIF_TOK_DESIGN, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_AcLoad[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY}; -static short f_After[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_FOLLOW, - EDIF_TOK_MAINTAIN, EDIF_TOK_LOGICASSIGN, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Annotate[] = {EDIF_TOK_STRINGDISPLAY}; -static short f_Apply[] = {EDIF_TOK_CYCLE, EDIF_TOK_LOGICINPUT, - EDIF_TOK_LOGICOUTPUT, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Arc[] = {EDIF_TOK_PT}; -static short f_Array[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME}; -static short f_ArrayMacro[] = {EDIF_TOK_PLUG}; -static short f_ArrayRelatedInfo[] = {EDIF_TOK_BASEARRAY, EDIF_TOK_ARRAYSITE, - EDIF_TOK_ARRAYMACRO, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_ArraySite[] = {EDIF_TOK_SOCKET}; -static short f_AtLeast[] = {EDIF_TOK_E}; -static short f_AtMost[] = {EDIF_TOK_E}; -static short f_Becomes[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST, - EDIF_TOK_LOGICONEOF}; -/* -static short f_Between[] = {EDIF_TOK_ATLEAST, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_LESSTHAN}; -*/ -static short f_Boolean[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE, - EDIF_TOK_BOOLEANDISPLAY, EDIF_TOK_BOOLEAN}; -static short f_BooleanDisplay[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE, - EDIF_TOK_DISPLAY}; -static short f_BooleanMap[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE}; -static short f_BorderPattern[] = {EDIF_TOK_BOOLEAN}; -static short f_BoundingBox[] = {EDIF_TOK_RECTANGLE}; -static short f_Cell[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_CELLTYPE, - -EDIF_TOK_STATUS, -EDIF_TOK_VIEWMAP, EDIF_TOK_VIEW, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA, - EDIF_TOK_PROPERTY}; -static short f_CellRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF}; -static short f_Change[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_BECOMES, EDIF_TOK_TRANSITION}; -static short f_Circle[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY}; -static short f_Color[] = {EDIF_TOK_E}; -static short f_CommentGraphics[] = {EDIF_TOK_ANNOTATE, EDIF_TOK_FIGURE, - EDIF_TOK_INSTANCE, -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Compound[] = {EDIF_TOK_NAME}; -static short f_ConnectLocation[] = {EDIF_TOK_FIGURE}; -static short f_Contents[] = {EDIF_TOK_INSTANCE, EDIF_TOK_OFFPAGECONNECTOR, - EDIF_TOK_FIGURE, EDIF_TOK_SECTION, EDIF_TOK_NET, - EDIF_TOK_NETBUNDLE, EDIF_TOK_PAGE, - EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_PORTIMPLEMENTATION, - EDIF_TOK_TIMING, EDIF_TOK_SIMULATE, - EDIF_TOK_WHEN, EDIF_TOK_FOLLOW, - EDIF_TOK_LOGICPORT, -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Criticality[] = {EDIF_TOK_INTEGERDISPLAY}; -static short f_CurrentMap[] = {EDIF_TOK_MNM, EDIF_TOK_E}; -static short f_Curve[] = {EDIF_TOK_ARC, EDIF_TOK_PT}; -static short f_Cycle[] = {EDIF_TOK_DURATION}; -static short f_DataOrigin[] = {EDIF_TOK_VERSION}; -static short f_DcFanInLoad[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_DcFanOutLoad[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_DcMaxFanIn[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_DcMaxFanOut[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY}; -static short f_Delay[] = {EDIF_TOK_MNM, EDIF_TOK_E}; -static short f_Delta[] = {EDIF_TOK_PT}; -static short f_Design[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_CELLREF, - EDIF_TOK_STATUS, EDIF_TOK_COMMENT, - EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA}; -static short f_Designator[] = {EDIF_TOK_STRINGDISPLAY}; -static short f_Difference[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE}; -static short f_Display[] = {EDIF_TOK_NAME, EDIF_TOK_FIGUREGROUPOVERRIDE, - EDIF_TOK_JUSTIFY, EDIF_TOK_ORIENTATION, - EDIF_TOK_ORIGIN}; -static short f_Dominates[] = {EDIF_TOK_NAME}; -static short f_Dot[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY}; -static short f_Duration[] = {EDIF_TOK_E}; -static short f_EnclosureDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Entry[] = {EDIF_TOK_MATCH, EDIF_TOK_CHANGE, EDIF_TOK_STEADY, - EDIF_TOK_LOGICREF, EDIF_TOK_PORTREF, - EDIF_TOK_NOCHANGE, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_Exactly[] = {EDIF_TOK_E}; -static short f_External[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_EDIFLEVEL, EDIF_TOK_TECHNOLOGY, - -EDIF_TOK_STATUS, EDIF_TOK_CELL, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Fabricate[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME}; -static short f_Figure[] = {EDIF_TOK_NAME, EDIF_TOK_FIGUREGROUPOVERRIDE, - EDIF_TOK_CIRCLE, EDIF_TOK_DOT, EDIF_TOK_OPENSHAPE, - EDIF_TOK_PATH, EDIF_TOK_POLYGON, - EDIF_TOK_RECTANGLE, EDIF_TOK_SHAPE, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_FigureArea[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_FigureGroup[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - -EDIF_TOK_CORNERTYPE, -EDIF_TOK_ENDTYPE, - -EDIF_TOK_PATHWIDTH, -EDIF_TOK_BORDERWIDTH, - -EDIF_TOK_COLOR, -EDIF_TOK_FILLPATTERN, - -EDIF_TOK_BORDERPATTERN, -EDIF_TOK_TEXTHEIGHT, - -EDIF_TOK_VISIBLE, EDIF_TOK_INCLUDEFIGUREGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_PROPERTY, - EDIF_TOK_USERDATA}; -static short f_FigureGroupObject[] = {EDIF_TOK_NAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_INTERSECTION, EDIF_TOK_UNION, - EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE, - EDIF_TOK_OVERSIZE}; -static short f_FigureGroupOverride[] = {EDIF_TOK_NAME, -EDIF_TOK_CORNERTYPE, - -EDIF_TOK_ENDTYPE, -EDIF_TOK_PATHWIDTH, - -EDIF_TOK_BORDERWIDTH, -EDIF_TOK_COLOR, - -EDIF_TOK_FILLPATTERN, - -EDIF_TOK_TEXTHEIGHT, - -EDIF_TOK_BORDERPATTERN, - EDIF_TOK_VISIBLE, EDIF_TOK_COMMENT, - EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA}; -static short f_FigureGroupRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF}; -static short f_FigurePerimeter[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_FigureWidth[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_FillPattern[] = {EDIF_TOK_BOOLEAN}; -static short f_Follow[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_ForbiddenEvent[] = {EDIF_TOK_TIMEINTERVAL, EDIF_TOK_EVENT}; -static short f_GlobalPortRef[] = {EDIF_TOK_NAME}; -static short f_GreaterThan[] = {EDIF_TOK_E}; -static short f_GridMap[] = {EDIF_TOK_E}; -static short f_IncludeFigureGroup[] = {EDIF_TOK_FIGUREGROUPREF, - EDIF_TOK_INTERSECTION, EDIF_TOK_UNION, - EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE, - EDIF_TOK_OVERSIZE}; -static short f_Instance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_VIEWREF, EDIF_TOK_VIEWLIST, - -EDIF_TOK_TRANSFORM, EDIF_TOK_PARAMETERASSIGN, - EDIF_TOK_PORTINSTANCE, EDIF_TOK_TIMING, - -EDIF_TOK_DESIGNATOR, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_InstanceBackAnnotate[] = {EDIF_TOK_INSTANCEREF, - -EDIF_TOK_DESIGNATOR, EDIF_TOK_TIMING, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT}; -static short f_InstanceGroup[] = {EDIF_TOK_INSTANCEREF}; -static short f_InstanceMap[] = {EDIF_TOK_INSTANCEREF, EDIF_TOK_INSTANCEGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_InstanceRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_INSTANCEREF, EDIF_TOK_VIEWREF}; -static short f_Integer[] = {EDIF_TOK_INTEGERDISPLAY, EDIF_TOK_INTEGER}; -static short f_IntegerDisplay[] = {EDIF_TOK_DISPLAY}; -static short f_Interface[] = {EDIF_TOK_PORT, EDIF_TOK_PORTBUNDLE, - -EDIF_TOK_SYMBOL, -EDIF_TOK_PROTECTIONFRAME, - -EDIF_TOK_ARRAYRELATEDINFO, EDIF_TOK_PARAMETER, - EDIF_TOK_JOINED, EDIF_TOK_MUSTJOIN, - EDIF_TOK_WEAKJOINED, EDIF_TOK_PERMUTABLE, - EDIF_TOK_TIMING, EDIF_TOK_SIMULATE, - -EDIF_TOK_DESIGNATOR, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_InterFigureGroupSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Intersection[] = {EDIF_TOK_FIGUREGROUPREF, - EDIF_TOK_INTERSECTION, EDIF_TOK_UNION, - EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE, - EDIF_TOK_OVERSIZE}; -static short f_IntraFigureGroupSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Inverse[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE}; -static short f_Joined[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_GLOBALPORTREF}; -static short f_KeywordDisplay[] = {EDIF_TOK_DISPLAY}; -static short f_KeywordMap[] = {EDIF_TOK_KEYWORDLEVEL, EDIF_TOK_COMMENT}; -static short f_LessThan[] = {EDIF_TOK_E}; -static short f_Library[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_EDIFLEVEL, - EDIF_TOK_TECHNOLOGY, -EDIF_TOK_STATUS, - EDIF_TOK_CELL, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_LibraryRef[] = {EDIF_TOK_NAME}; -static short f_ListOfNets[] = {EDIF_TOK_NET}; -static short f_ListOfPorts[] = {EDIF_TOK_PORT, EDIF_TOK_PORTBUNDLE}; -static short f_LoadDelay[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY}; -static short f_LogicAssign[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, - EDIF_TOK_LOGICREF, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_LogicInput[] = {EDIF_TOK_PORTLIST, EDIF_TOK_PORTREF, - EDIF_TOK_NAME, EDIF_TOK_LOGICWAVEFORM}; -static short f_LogicList[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICONEOF, - EDIF_TOK_IGNORE}; -static short f_LogicMapInput[] = {EDIF_TOK_LOGICREF}; -static short f_LogicMapOutput[] = {EDIF_TOK_LOGICREF}; -static short f_LogicOneOf[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST}; -static short f_LogicOutput[] = {EDIF_TOK_PORTLIST, EDIF_TOK_PORTREF, - EDIF_TOK_NAME, EDIF_TOK_LOGICWAVEFORM}; -static short f_LogicPort[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_LogicRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF}; -static short f_LogicValue[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - -EDIF_TOK_VOLTAGEMAP, -EDIF_TOK_CURRENTMAP, - -EDIF_TOK_BOOLEANMAP, -EDIF_TOK_COMPOUND, - -EDIF_TOK_WEAK ,-EDIF_TOK_STRONG, - -EDIF_TOK_DOMINATES, -EDIF_TOK_LOGICMAPOUTPUT, - -EDIF_TOK_LOGICMAPINPUT, - -EDIF_TOK_ISOLATED, EDIF_TOK_RESOLVES, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_LogicWaveform[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST, - EDIF_TOK_LOGICONEOF, EDIF_TOK_IGNORE}; -static short f_Maintain[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_DELAY, - EDIF_TOK_LOADDELAY}; -static short f_Match[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_LOGICLIST, EDIF_TOK_LOGICONEOF}; -static short f_Member[] = {EDIF_TOK_NAME}; -static short f_MiNoMax[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY, - EDIF_TOK_MINOMAX}; -static short f_MiNoMaxDisplay[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_DISPLAY}; -static short f_Mnm[] = {EDIF_TOK_E, EDIF_TOK_UNDEFINED, - EDIF_TOK_UNCONSTRAINED}; -static short f_MultipleValueSet[] = {EDIF_TOK_RANGEVECTOR}; -static short f_MustJoin[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_WEAKJOINED, EDIF_TOK_JOINED}; -static short f_Name[] = {EDIF_TOK_DISPLAY}; -static short f_Net[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, -EDIF_TOK_CRITICALITY, - EDIF_TOK_NETDELAY, EDIF_TOK_FIGURE, EDIF_TOK_NET, - EDIF_TOK_INSTANCE, EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA, EDIF_TOK_JOINED, EDIF_TOK_ARRAY}; -static short f_NetBackAnnotate[] = {EDIF_TOK_NETREF, EDIF_TOK_NETDELAY, - -EDIF_TOK_CRITICALITY, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT}; -static short f_NetBundle[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_LISTOFNETS, EDIF_TOK_FIGURE, - EDIF_TOK_COMMENTGRAPHICS, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_NetDelay[] = {EDIF_TOK_DERIVATION, EDIF_TOK_DELAY, - EDIF_TOK_TRANSITION, EDIF_TOK_BECOMES}; -static short f_NetGroup[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_NETREF}; -static short f_NetMap[] = {EDIF_TOK_NETREF, EDIF_TOK_NETGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_NetRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_NETREF, - EDIF_TOK_INSTANCEREF, EDIF_TOK_VIEWREF}; -static short f_NonPermutable[] = {EDIF_TOK_PORTREF, EDIF_TOK_PERMUTABLE}; -static short f_NotAllowed[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_NotchSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Number[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY, EDIF_TOK_NUMBER}; -static short f_NumberDefinition[] = {EDIF_TOK_SCALE, -EDIF_TOK_GRIDMAP, - EDIF_TOK_COMMENT}; -static short f_NumberDisplay[] = {EDIF_TOK_E, EDIF_TOK_DISPLAY}; -static short f_OffPageConnector[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - -EDIF_TOK_UNUSED, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_OffsetEvent[] = {EDIF_TOK_EVENT, EDIF_TOK_E}; -static short f_OpenShape[] = {EDIF_TOK_CURVE, EDIF_TOK_PROPERTY}; -static short f_Origin[] = {EDIF_TOK_PT}; -static short f_OverhangDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_OverlapDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN, - EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST, - EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY, - EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_Oversize[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE, - EDIF_TOK_CORNERTYPE}; -static short f_Page[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_INSTANCE, EDIF_TOK_NET, EDIF_TOK_NETBUNDLE, - EDIF_TOK_COMMENTGRAPHICS, EDIF_TOK_PORTIMPLEMENTATION, - -EDIF_TOK_PAGESIZE, -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PageSize[] = {EDIF_TOK_RECTANGLE}; -static short f_Parameter[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_BOOLEAN, EDIF_TOK_INTEGER, - EDIF_TOK_MINOMAX, EDIF_TOK_NUMBER, - EDIF_TOK_POINT, EDIF_TOK_STRING}; -static short f_ParameterAssign[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_BOOLEAN, EDIF_TOK_INTEGER, - EDIF_TOK_MINOMAX, EDIF_TOK_NUMBER, EDIF_TOK_POINT, - EDIF_TOK_STRING}; -static short f_ParameterDisplay[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_DISPLAY}; -static short f_Path[] = {EDIF_TOK_POINTLIST, EDIF_TOK_PROPERTY}; -static short f_PathDelay[] = {EDIF_TOK_DELAY, EDIF_TOK_EVENT}; -static short f_Permutable[] = {EDIF_TOK_PORTREF, EDIF_TOK_PERMUTABLE, - EDIF_TOK_NONPERMUTABLE}; -static short f_PhysicalDesignRule[] = {EDIF_TOK_FIGUREWIDTH, - EDIF_TOK_FIGUREAREA, - EDIF_TOK_RECTANGLESIZE, - EDIF_TOK_FIGUREPERIMETER, - EDIF_TOK_OVERLAPDISTANCE, - EDIF_TOK_OVERHANGDISTANCE, - EDIF_TOK_ENCLOSUREDISTANCE, - EDIF_TOK_INTERFIGUREGROUPSPACING, - EDIF_TOK_NOTCHSPACING, - EDIF_TOK_INTRAFIGUREGROUPSPACING, - EDIF_TOK_NOTALLOWED, - EDIF_TOK_FIGUREGROUP, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Plug[] = {EDIF_TOK_SOCKETSET}; -static short f_Point[] = {EDIF_TOK_PT, EDIF_TOK_POINTDISPLAY, - EDIF_TOK_POINT}; -static short f_PointDisplay[] = {EDIF_TOK_PT, EDIF_TOK_DISPLAY}; -static short f_PointList[] = {EDIF_TOK_PT}; -static short f_Polygon[] = {EDIF_TOK_POINTLIST, EDIF_TOK_PROPERTY}; -static short f_Port[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - -EDIF_TOK_DIRECTION, -EDIF_TOK_UNUSED, - EDIF_TOK_PORTDELAY, -EDIF_TOK_DESIGNATOR, - -EDIF_TOK_DCFANINLOAD, -EDIF_TOK_DCFANOUTLOAD, - -EDIF_TOK_DCMAXFANIN, -EDIF_TOK_DCMAXFANOUT, - -EDIF_TOK_ACLOAD, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PortBackAnnotate[] = {EDIF_TOK_PORTREF, -EDIF_TOK_DESIGNATOR, - EDIF_TOK_PORTDELAY, -EDIF_TOK_DCFANINLOAD, - -EDIF_TOK_DCFANOUTLOAD, - -EDIF_TOK_DCMAXFANIN, - -EDIF_TOK_DCMAXFANOUT, -EDIF_TOK_ACLOAD, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT}; -static short f_PortBundle[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY, - EDIF_TOK_LISTOFPORTS, EDIF_TOK_PROPERTY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PortDelay[] = {EDIF_TOK_DERIVATION, EDIF_TOK_DELAY, - EDIF_TOK_LOADDELAY, EDIF_TOK_TRANSITION, - EDIF_TOK_BECOMES}; -static short f_PortGroup[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_PORTREF}; -static short f_PortImplementation[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME, EDIF_TOK_MEMBER, - -EDIF_TOK_CONNECTLOCATION, - EDIF_TOK_FIGURE, EDIF_TOK_INSTANCE, - EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_PROPERTYDISPLAY, - EDIF_TOK_KEYWORDDISPLAY, - EDIF_TOK_PROPERTY, - EDIF_TOK_USERDATA, EDIF_TOK_COMMENT}; -static short f_PortInstance[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME, - EDIF_TOK_MEMBER, -EDIF_TOK_UNUSED, - EDIF_TOK_PORTDELAY, -EDIF_TOK_DESIGNATOR, - -EDIF_TOK_DCFANINLOAD, - -EDIF_TOK_DCFANOUTLOAD, -EDIF_TOK_DCMAXFANIN, - -EDIF_TOK_DCMAXFANOUT, -EDIF_TOK_ACLOAD, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_PortList[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME, - EDIF_TOK_MEMBER}; -static short f_PortListAlias[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_ARRAY, EDIF_TOK_PORTLIST}; -static short f_PortMap[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTGROUP, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_PortRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, - EDIF_TOK_PORTREF, EDIF_TOK_INSTANCEREF, - EDIF_TOK_VIEWREF}; -static short f_Program[] = {EDIF_TOK_VERSION}; -static short f_Property[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_BOOLEAN, - EDIF_TOK_INTEGER, EDIF_TOK_MINOMAX, - EDIF_TOK_NUMBER, EDIF_TOK_POINT, EDIF_TOK_STRING, - -EDIF_TOK_OWNER, -EDIF_TOK_UNIT, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT}; -static short f_PropertyDisplay[] = {EDIF_TOK_NAME, EDIF_TOK_DISPLAY}; -static short f_ProtectionFrame[] = {EDIF_TOK_PORTIMPLEMENTATION, - EDIF_TOK_FIGURE, EDIF_TOK_INSTANCE, - EDIF_TOK_COMMENTGRAPHICS, - -EDIF_TOK_BOUNDINGBOX, - EDIF_TOK_PROPERTYDISPLAY, - EDIF_TOK_KEYWORDDISPLAY, - EDIF_TOK_PARAMETERDISPLAY, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_RangeVector[] = {EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN, - EDIF_TOK_SINGLEVALUESET}; -static short f_Rectangle[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY}; -static short f_RectangleSize[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, - EDIF_TOK_FIGUREGROUPOBJECT, - EDIF_TOK_RANGEVECTOR, - EDIF_TOK_MULTIPLEVALUESET,EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Rename[] = {EDIF_TOK_NAME, EDIF_TOK_STRINGDISPLAY}; -static short f_Resolves[] = {EDIF_TOK_NAME}; -static short f_Scale[] = {EDIF_TOK_E, EDIF_TOK_UNIT}; -static short f_Section[] = {EDIF_TOK_SECTION, EDIF_TOK_INSTANCE}; -static short f_Shape[] = {EDIF_TOK_CURVE, EDIF_TOK_PROPERTY}; -static short f_Simulate[] = {EDIF_TOK_NAME, EDIF_TOK_PORTLISTALIAS, - EDIF_TOK_WAVEVALUE, EDIF_TOK_APPLY, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA}; -static short f_SimulationInfo[] = {EDIF_TOK_LOGICVALUE, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_SingleValueSet[] = {EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN, - EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST, - EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN}; -static short f_Site[] = {EDIF_TOK_VIEWREF, EDIF_TOK_TRANSFORM}; -static short f_Socket[] = {EDIF_TOK_SYMMETRY}; -static short f_SocketSet[] = {EDIF_TOK_SYMMETRY, EDIF_TOK_SITE}; -static short f_Status[] = {EDIF_TOK_WRITTEN, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Steady[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_PORTREF, - EDIF_TOK_PORTLIST, EDIF_TOK_DURATION, - EDIF_TOK_TRANSITION, EDIF_TOK_BECOMES}; -static short f_String[] = {EDIF_TOK_STRINGDISPLAY, EDIF_TOK_STRING}; -static short f_StringDisplay[] = {EDIF_TOK_DISPLAY}; -static short f_Strong[] = {EDIF_TOK_NAME}; -static short f_Symbol[] = {EDIF_TOK_PORTIMPLEMENTATION, EDIF_TOK_FIGURE, - EDIF_TOK_INSTANCE, EDIF_TOK_COMMENTGRAPHICS, - EDIF_TOK_ANNOTATE, -EDIF_TOK_PAGESIZE, - -EDIF_TOK_BOUNDINGBOX, EDIF_TOK_PROPERTYDISPLAY, - EDIF_TOK_KEYWORDDISPLAY, EDIF_TOK_PARAMETERDISPLAY, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Symmetry[] = {EDIF_TOK_TRANSFORM}; -static short f_Table[] = {EDIF_TOK_ENTRY, EDIF_TOK_TABLEDEFAULT}; -static short f_TableDefault[] = {EDIF_TOK_LOGICREF, EDIF_TOK_PORTREF, - EDIF_TOK_NOCHANGE, EDIF_TOK_TABLE, - EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY}; -static short f_Technology[] = {EDIF_TOK_NUMBERDEFINITION, EDIF_TOK_FIGUREGROUP, - EDIF_TOK_FABRICATE, -EDIF_TOK_SIMULATIONINFO, - EDIF_TOK_COMMENT, EDIF_TOK_USERDATA, - -EDIF_TOK_PHYSICALDESIGNRULE}; -static short f_TimeInterval[] = {EDIF_TOK_EVENT, EDIF_TOK_OFFSETEVENT, - EDIF_TOK_DURATION}; -static short f_Timing[] = {EDIF_TOK_DERIVATION, EDIF_TOK_PATHDELAY, - EDIF_TOK_FORBIDDENEVENT, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Transform[] = {EDIF_TOK_SCALEX, EDIF_TOK_SCALEY, EDIF_TOK_DELTA, - EDIF_TOK_ORIENTATION, EDIF_TOK_ORIGIN}; -static short f_Transition[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST, - EDIF_TOK_LOGICONEOF}; -static short f_Trigger[] = {EDIF_TOK_CHANGE, EDIF_TOK_STEADY, - EDIF_TOK_INITIAL}; -static short f_Union[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION, - EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE, - EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE}; -static short f_View[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_VIEWTYPE, - EDIF_TOK_INTERFACE, -EDIF_TOK_STATUS, - -EDIF_TOK_CONTENTS, EDIF_TOK_COMMENT, - EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA}; -static short f_ViewList[] = {EDIF_TOK_VIEWREF, EDIF_TOK_VIEWLIST}; -static short f_ViewMap[] = {EDIF_TOK_PORTMAP, EDIF_TOK_PORTBACKANNOTATE, - EDIF_TOK_INSTANCEMAP, - EDIF_TOK_INSTANCEBACKANNOTATE, EDIF_TOK_NETMAP, - EDIF_TOK_NETBACKANNOTATE, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_ViewRef[] = {EDIF_TOK_NAME, EDIF_TOK_CELLREF}; -static short f_Visible[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE}; -static short f_VoltageMap[] = {EDIF_TOK_MNM, EDIF_TOK_E}; -static short f_WaveValue[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_E, - EDIF_TOK_LOGICWAVEFORM}; -static short f_Weak[] = {EDIF_TOK_NAME}; -static short f_WeakJoined[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST, - EDIF_TOK_JOINED}; -static short f_When[] = {EDIF_TOK_TRIGGER, EDIF_TOK_AFTER, - EDIF_TOK_FOLLOW, EDIF_TOK_MAINTAIN, - EDIF_TOK_LOGICASSIGN, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -static short f_Written[] = {EDIF_TOK_TIMESTAMP, EDIF_TOK_AUTHOR, - EDIF_TOK_PROGRAM, EDIF_TOK_DATAORIGIN, - EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT, - EDIF_TOK_USERDATA}; -/* - * Context binding table: - * - * This binds context follower arrays to their originating context. - */ -typedef struct Binder { - short *Follower; /* pointer to follower array */ - short Origin; /* '%token' value of origin */ - short FollowerSize; /* size of follower array */ -} Binder; -#define BE(f,o) {f,o,sizeof(f)/sizeof(short)} -static Binder BinderDef[] = { - BE(f_NULL, 0), - BE(f_Edif, EDIF_TOK_EDIF), - BE(f_AcLoad, EDIF_TOK_ACLOAD), - BE(f_After, EDIF_TOK_AFTER), - BE(f_Annotate, EDIF_TOK_ANNOTATE), - BE(f_Apply, EDIF_TOK_APPLY), - BE(f_Arc, EDIF_TOK_ARC), - BE(f_Array, EDIF_TOK_ARRAY), - BE(f_ArrayMacro, EDIF_TOK_ARRAYMACRO), - BE(f_ArrayRelatedInfo, EDIF_TOK_ARRAYRELATEDINFO), - BE(f_ArraySite, EDIF_TOK_ARRAYSITE), - BE(f_AtLeast, EDIF_TOK_ATLEAST), - BE(f_AtMost, EDIF_TOK_ATMOST), - BE(f_Becomes, EDIF_TOK_BECOMES), - BE(f_Boolean, EDIF_TOK_BOOLEAN), - BE(f_BooleanDisplay, EDIF_TOK_BOOLEANDISPLAY), - BE(f_BooleanMap, EDIF_TOK_BOOLEANMAP), - BE(f_BorderPattern, EDIF_TOK_BORDERPATTERN), - BE(f_BoundingBox, EDIF_TOK_BOUNDINGBOX), - BE(f_Cell, EDIF_TOK_CELL), - BE(f_CellRef, EDIF_TOK_CELLREF), - BE(f_Change, EDIF_TOK_CHANGE), - BE(f_Circle, EDIF_TOK_CIRCLE), - BE(f_Color, EDIF_TOK_COLOR), - BE(f_CommentGraphics, EDIF_TOK_COMMENTGRAPHICS), - BE(f_Compound, EDIF_TOK_COMPOUND), - BE(f_ConnectLocation, EDIF_TOK_CONNECTLOCATION), - BE(f_Contents, EDIF_TOK_CONTENTS), - BE(f_Criticality, EDIF_TOK_CRITICALITY), - BE(f_CurrentMap, EDIF_TOK_CURRENTMAP), - BE(f_Curve, EDIF_TOK_CURVE), - BE(f_Cycle, EDIF_TOK_CYCLE), - BE(f_DataOrigin, EDIF_TOK_DATAORIGIN), - BE(f_DcFanInLoad, EDIF_TOK_DCFANINLOAD), - BE(f_DcFanOutLoad, EDIF_TOK_DCFANOUTLOAD), - BE(f_DcMaxFanIn, EDIF_TOK_DCMAXFANIN), - BE(f_DcMaxFanOut, EDIF_TOK_DCMAXFANOUT), - BE(f_Delay, EDIF_TOK_DELAY), - BE(f_Delta, EDIF_TOK_DELTA), - BE(f_Design, EDIF_TOK_DESIGN), - BE(f_Designator, EDIF_TOK_DESIGNATOR), - BE(f_Difference, EDIF_TOK_DIFFERENCE), - BE(f_Display, EDIF_TOK_DISPLAY), - BE(f_Dominates, EDIF_TOK_DOMINATES), - BE(f_Dot, EDIF_TOK_DOT), - BE(f_Duration, EDIF_TOK_DURATION), - BE(f_EnclosureDistance, EDIF_TOK_ENCLOSUREDISTANCE), - BE(f_Entry, EDIF_TOK_ENTRY), - BE(f_Exactly, EDIF_TOK_EXACTLY), - BE(f_External, EDIF_TOK_EXTERNAL), - BE(f_Fabricate, EDIF_TOK_FABRICATE), - BE(f_Figure, EDIF_TOK_FIGURE), - BE(f_FigureArea, EDIF_TOK_FIGUREAREA), - BE(f_FigureGroup, EDIF_TOK_FIGUREGROUP), - BE(f_FigureGroupObject, EDIF_TOK_FIGUREGROUPOBJECT), - BE(f_FigureGroupOverride, EDIF_TOK_FIGUREGROUPOVERRIDE), - BE(f_FigureGroupRef, EDIF_TOK_FIGUREGROUPREF), - BE(f_FigurePerimeter, EDIF_TOK_FIGUREPERIMETER), - BE(f_FigureWidth, EDIF_TOK_FIGUREWIDTH), - BE(f_FillPattern, EDIF_TOK_FILLPATTERN), - BE(f_Follow, EDIF_TOK_FOLLOW), - BE(f_ForbiddenEvent, EDIF_TOK_FORBIDDENEVENT), - BE(f_GlobalPortRef, EDIF_TOK_GLOBALPORTREF), - BE(f_GreaterThan, EDIF_TOK_GREATERTHAN), - BE(f_GridMap, EDIF_TOK_GRIDMAP), - BE(f_IncludeFigureGroup, EDIF_TOK_INCLUDEFIGUREGROUP), - BE(f_Instance, EDIF_TOK_INSTANCE), - BE(f_InstanceBackAnnotate, EDIF_TOK_INSTANCEBACKANNOTATE), - BE(f_InstanceGroup, EDIF_TOK_INSTANCEGROUP), - BE(f_InstanceMap, EDIF_TOK_INSTANCEMAP), - BE(f_InstanceRef, EDIF_TOK_INSTANCEREF), - BE(f_Integer, EDIF_TOK_INTEGER), - BE(f_IntegerDisplay, EDIF_TOK_INTEGERDISPLAY), - BE(f_InterFigureGroupSpacing, EDIF_TOK_INTERFIGUREGROUPSPACING), - BE(f_Interface, EDIF_TOK_INTERFACE), - BE(f_Intersection, EDIF_TOK_INTERSECTION), - BE(f_IntraFigureGroupSpacing, EDIF_TOK_INTRAFIGUREGROUPSPACING), - BE(f_Inverse, EDIF_TOK_INVERSE), - BE(f_Joined, EDIF_TOK_JOINED), - BE(f_KeywordDisplay, EDIF_TOK_KEYWORDDISPLAY), - BE(f_KeywordMap, EDIF_TOK_KEYWORDMAP), - BE(f_LessThan, EDIF_TOK_LESSTHAN), - BE(f_Library, EDIF_TOK_LIBRARY), - BE(f_LibraryRef, EDIF_TOK_LIBRARYREF), - BE(f_ListOfNets, EDIF_TOK_LISTOFNETS), - BE(f_ListOfPorts, EDIF_TOK_LISTOFPORTS), - BE(f_LoadDelay, EDIF_TOK_LOADDELAY), - BE(f_LogicAssign, EDIF_TOK_LOGICASSIGN), - BE(f_LogicInput, EDIF_TOK_LOGICINPUT), - BE(f_LogicList, EDIF_TOK_LOGICLIST), - BE(f_LogicMapInput, EDIF_TOK_LOGICMAPINPUT), - BE(f_LogicMapOutput, EDIF_TOK_LOGICMAPOUTPUT), - BE(f_LogicOneOf, EDIF_TOK_LOGICONEOF), - BE(f_LogicOutput, EDIF_TOK_LOGICOUTPUT), - BE(f_LogicPort, EDIF_TOK_LOGICPORT), - BE(f_LogicRef, EDIF_TOK_LOGICREF), - BE(f_LogicValue, EDIF_TOK_LOGICVALUE), - BE(f_LogicWaveform, EDIF_TOK_LOGICWAVEFORM), - BE(f_Maintain, EDIF_TOK_MAINTAIN), - BE(f_Match, EDIF_TOK_MATCH), - BE(f_Member, EDIF_TOK_MEMBER), - BE(f_MiNoMax, EDIF_TOK_MINOMAX), - BE(f_MiNoMaxDisplay, EDIF_TOK_MINOMAXDISPLAY), - BE(f_Mnm, EDIF_TOK_MNM), - BE(f_MultipleValueSet, EDIF_TOK_MULTIPLEVALUESET), - BE(f_MustJoin, EDIF_TOK_MUSTJOIN), - BE(f_Name, EDIF_TOK_NAME), - BE(f_Net, EDIF_TOK_NET), - BE(f_NetBackAnnotate, EDIF_TOK_NETBACKANNOTATE), - BE(f_NetBundle, EDIF_TOK_NETBUNDLE), - BE(f_NetDelay, EDIF_TOK_NETDELAY), - BE(f_NetGroup, EDIF_TOK_NETGROUP), - BE(f_NetMap, EDIF_TOK_NETMAP), - BE(f_NetRef, EDIF_TOK_NETREF), - BE(f_NonPermutable, EDIF_TOK_NONPERMUTABLE), - BE(f_NotAllowed, EDIF_TOK_NOTALLOWED), - BE(f_NotchSpacing, EDIF_TOK_NOTCHSPACING), - BE(f_Number, EDIF_TOK_NUMBER), - BE(f_NumberDefinition, EDIF_TOK_NUMBERDEFINITION), - BE(f_NumberDisplay, EDIF_TOK_NUMBERDISPLAY), - BE(f_OffPageConnector, EDIF_TOK_OFFPAGECONNECTOR), - BE(f_OffsetEvent, EDIF_TOK_OFFSETEVENT), - BE(f_OpenShape, EDIF_TOK_OPENSHAPE), - BE(f_Origin, EDIF_TOK_ORIGIN), - BE(f_OverhangDistance, EDIF_TOK_OVERHANGDISTANCE), - BE(f_OverlapDistance, EDIF_TOK_OVERLAPDISTANCE), - BE(f_Oversize, EDIF_TOK_OVERSIZE), - BE(f_Page, EDIF_TOK_PAGE), - BE(f_PageSize, EDIF_TOK_PAGESIZE), - BE(f_Parameter, EDIF_TOK_PARAMETER), - BE(f_ParameterAssign, EDIF_TOK_PARAMETERASSIGN), - BE(f_ParameterDisplay, EDIF_TOK_PARAMETERDISPLAY), - BE(f_Path, EDIF_TOK_PATH), - BE(f_PathDelay, EDIF_TOK_PATHDELAY), - BE(f_Permutable, EDIF_TOK_PERMUTABLE), - BE(f_PhysicalDesignRule, EDIF_TOK_PHYSICALDESIGNRULE), - BE(f_Plug, EDIF_TOK_PLUG), - BE(f_Point, EDIF_TOK_POINT), - BE(f_PointDisplay, EDIF_TOK_POINTDISPLAY), - BE(f_PointList, EDIF_TOK_POINTLIST), - BE(f_Polygon, EDIF_TOK_POLYGON), - BE(f_Port, EDIF_TOK_PORT), - BE(f_PortBackAnnotate, EDIF_TOK_PORTBACKANNOTATE), - BE(f_PortBundle, EDIF_TOK_PORTBUNDLE), - BE(f_PortDelay, EDIF_TOK_PORTDELAY), - BE(f_PortGroup, EDIF_TOK_PORTGROUP), - BE(f_PortImplementation, EDIF_TOK_PORTIMPLEMENTATION), - BE(f_PortInstance, EDIF_TOK_PORTINSTANCE), - BE(f_PortList, EDIF_TOK_PORTLIST), - BE(f_PortListAlias, EDIF_TOK_PORTLISTALIAS), - BE(f_PortMap, EDIF_TOK_PORTMAP), - BE(f_PortRef, EDIF_TOK_PORTREF), - BE(f_Program, EDIF_TOK_PROGRAM), - BE(f_Property, EDIF_TOK_PROPERTY), - BE(f_PropertyDisplay, EDIF_TOK_PROPERTYDISPLAY), - BE(f_ProtectionFrame, EDIF_TOK_PROTECTIONFRAME), - BE(f_RangeVector, EDIF_TOK_RANGEVECTOR), - BE(f_Rectangle, EDIF_TOK_RECTANGLE), - BE(f_RectangleSize, EDIF_TOK_RECTANGLESIZE), - BE(f_Rename, EDIF_TOK_RENAME), - BE(f_Resolves, EDIF_TOK_RESOLVES), - BE(f_Scale, EDIF_TOK_SCALE), - BE(f_Section, EDIF_TOK_SECTION), - BE(f_Shape, EDIF_TOK_SHAPE), - BE(f_Simulate, EDIF_TOK_SIMULATE), - BE(f_SimulationInfo, EDIF_TOK_SIMULATIONINFO), - BE(f_SingleValueSet, EDIF_TOK_SINGLEVALUESET), - BE(f_Site, EDIF_TOK_SITE), - BE(f_Socket, EDIF_TOK_SOCKET), - BE(f_SocketSet, EDIF_TOK_SOCKETSET), - BE(f_Status, EDIF_TOK_STATUS), - BE(f_Steady, EDIF_TOK_STEADY), - BE(f_String, EDIF_TOK_STRING), - BE(f_StringDisplay, EDIF_TOK_STRINGDISPLAY), - BE(f_Strong, EDIF_TOK_STRONG), - BE(f_Symbol, EDIF_TOK_SYMBOL), - BE(f_Symmetry, EDIF_TOK_SYMMETRY), - BE(f_Table, EDIF_TOK_TABLE), - BE(f_TableDefault, EDIF_TOK_TABLEDEFAULT), - BE(f_Technology, EDIF_TOK_TECHNOLOGY), - BE(f_TimeInterval, EDIF_TOK_TIMEINTERVAL), - BE(f_Timing, EDIF_TOK_TIMING), - BE(f_Transform, EDIF_TOK_TRANSFORM), - BE(f_Transition, EDIF_TOK_TRANSITION), - BE(f_Trigger, EDIF_TOK_TRIGGER), - BE(f_Union, EDIF_TOK_UNION), - BE(f_View, EDIF_TOK_VIEW), - BE(f_ViewList, EDIF_TOK_VIEWLIST), - BE(f_ViewMap, EDIF_TOK_VIEWMAP), - BE(f_ViewRef, EDIF_TOK_VIEWREF), - BE(f_Visible, EDIF_TOK_VISIBLE), - BE(f_VoltageMap, EDIF_TOK_VOLTAGEMAP), - BE(f_WaveValue, EDIF_TOK_WAVEVALUE), - BE(f_Weak, EDIF_TOK_WEAK), - BE(f_WeakJoined, EDIF_TOK_WEAKJOINED), - BE(f_When, EDIF_TOK_WHEN), - BE(f_Written, EDIF_TOK_WRITTEN) -}; -static int BinderDefSize = sizeof(BinderDef) / sizeof(Binder); -/* - * Keyword table: - * - * This hash table holds all strings which may have to be matched - * to. WARNING: it is assumed that there is no overlap of the 'token' - * and 'context' strings. - */ -typedef struct Keyword { - struct Keyword *Next; /* pointer to next entry */ - const char *String; /* pointer to associated string */ -} Keyword; -#define KEYWORD_HASH 127 /* hash table size */ -static Keyword *KeywordTable[KEYWORD_HASH]; -/* - * Enter keyword: - * - * The passed string is entered into the keyword hash table. - */ -static void EnterKeyword(const char * str) -{ - /* - * Locals. - */ - register Keyword *key; - register unsigned int hsh; - register const char *cp; - /* - * Create the hash code, and add an entry to the table. - */ - for (hsh = 0, cp = str; *cp; hsh += hsh + *cp++); - hsh %= KEYWORD_HASH; - key = (Keyword *) Malloc(sizeof(Keyword)); - key->Next = KeywordTable[hsh]; - (KeywordTable[hsh] = key)->String = str; -} -/* - * Find keyword: - * - * The passed string is located within the keyword table. If an - * entry exists, then the value of the keyword string is returned. This - * is real useful for doing string comparisons by pointer value later. - * If there is no match, a NULL is returned. - */ -static const char *FindKeyword(const char * str) -{ - /* - * Locals. - */ - register Keyword *wlk,*owk; - register unsigned int hsh; - register char *cp; - char lower[IDENT_LENGTH + 1]; - /* - * Create a lower case copy of the string. - */ - for (cp = lower; *str;) - if (isupper( (int) *str)) - *cp++ = tolower( (int) *str++); - else - *cp++ = *str++; - *cp = '\0'; - /* - * Search the hash table for a match. - */ - for (hsh = 0, cp = lower; *cp; hsh += hsh + *cp++); - hsh %= KEYWORD_HASH; - for (owk = NULL, wlk = KeywordTable[hsh]; wlk; wlk = (owk = wlk)->Next) - if (!strcmp(wlk->String,lower)){ - /* - * Readjust the LRU. - */ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = KeywordTable[hsh]; - KeywordTable[hsh] = wlk; - } - return (wlk->String); - } - return (NULL); -} -/* - * Token hash table. - */ -#define TOKEN_HASH 51 -static Token *TokenHash[TOKEN_HASH]; -/* - * Find token: - * - * A pointer to the token of the passed code is returned. If - * no such beastie is present a NULL is returned instead. - */ -static Token *FindToken(register int cod) -{ - /* - * Locals. - */ - register Token *wlk,*owk; - register unsigned int hsh; - /* - * Search the hash table for a matching token. - */ - hsh = cod % TOKEN_HASH; - for (owk = NULL, wlk = TokenHash[hsh]; wlk; wlk = (owk = wlk)->Next) - if (cod == wlk->Code){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = TokenHash[hsh]; - TokenHash[hsh] = wlk; - } - break; - } - return (wlk); -} -/* - * Context hash table. - */ -#define CONTEXT_HASH 127 -static Context *ContextHash[CONTEXT_HASH]; -/* - * Find context: - * - * A pointer to the context of the passed code is returned. If - * no such beastie is present a NULL is returned instead. - */ -static Context *FindContext(register int cod) -{ - /* - * Locals. - */ - register Context *wlk,*owk; - register unsigned int hsh; - /* - * Search the hash table for a matching context. - */ - hsh = cod % CONTEXT_HASH; - for (owk = NULL, wlk = ContextHash[hsh]; wlk; wlk = (owk = wlk)->Next) - if (cod == wlk->Code){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = ContextHash[hsh]; - ContextHash[hsh] = wlk; - } - break; - } - return (wlk); -} -/* - * Token stacking variables. - */ -#ifdef DEBUG -#define TS_DEPTH 8 -#define TS_MASK (TS_DEPTH - 1) -static unsigned int TSP = 0; /* token stack pointer */ -static char *TokenStack[TS_DEPTH]; /* token name strings */ -static short TokenType[TS_DEPTH]; /* token types */ -/* - * Stack: - * - * Add a token to the debug stack. The passed string and type are - * what is to be pushed. - */ -static void Stack(char * str, int typ) -{ - /* - * Free any previous string, then push. - */ - if (TokenStack[TSP & TS_MASK]) - Free(TokenStack[TSP & TS_MASK]); - TokenStack[TSP & TS_MASK] = strcpy((char *)Malloc(strlen(str) + 1),str); - TokenType[TSP & TS_MASK] = typ; - TSP += 1; -} -/* - * Dump stack: - * - * This displays the last set of accumulated tokens. - */ -static void DumpStack() -{ - /* - * Locals. - */ - register int i; - register Context *cxt; - register Token *tok; - register char *nam; - FILE *Error = stderr; - /* - * Run through the list displaying the oldest first. - */ - fprintf(Error,"\n\n"); - for (i = 0; i < TS_DEPTH; i += 1) - if (TokenStack[(TSP + i) & TS_MASK]){ - /* - * Get the type name string. - */ - if ((cxt = FindContext(TokenType[(TSP + i) & TS_MASK])) != NULL) - nam = cxt->Name; - else if ((tok = FindToken(TokenType[(TSP + i) & TS_MASK])) != NULL) - nam = tok->Name; - else switch (TokenType[(TSP + i) & TS_MASK]){ - case EDIF_TOK_IDENT: nam = "IDENT"; break; - case EDIF_TOK_INT: nam = "INT"; break; - case EDIF_TOK_KEYWORD: nam = "KEYWORD"; break; - case EDIF_TOK_STR: nam = "STR"; break; - default: nam = "?"; break; - } - /* - * Now print the token state. - */ - fprintf(Error,"%2d %-16.16s '%s'\n",TS_DEPTH - i,nam, - TokenStack[(TSP + i) & TS_MASK]); - } - fprintf(Error,"\n"); -} -#else -#define Stack(s,t) -#endif /* DEBUG */ -/* - * Parser state variables. - */ -static FILE *Input = NULL; /* input stream */ -static FILE *Error = NULL; /* error stream */ -static char *InFile; /* file name on the input stream */ -static long LineNumber; /* current input line number */ -static ContextCar *CSP = NULL; /* top of context stack */ -static char yytext[IDENT_LENGTH + 1]; /* token buffer */ -static char CharBuf[IDENT_LENGTH + 1]; /* garbage buffer */ -/* - * yyerror: - * - * Standard error reporter, it prints out the passed string - * preceeded by the current filename and line number. - */ -static void yyerror(const char *ers) -{ -#ifdef DEBUG - DumpStack(); -#endif /* DEBUG */ - fprintf(Error,"%s, line %ld: %s\n",InFile,LineNumber,ers); -} -/* - * String bucket definitions. - */ -#define BUCKET_SIZE 64 -typedef struct Bucket { - struct Bucket *Next; /* pointer to next bucket */ - int Index; /* pointer to next free slot */ - char Data[BUCKET_SIZE]; /* string data */ -} Bucket; -static Bucket *CurrentBucket = NULL; /* string bucket list */ -static int StringSize = 0; /* current string length */ -/* - * Push string: - * - * This adds the passed charater to the current string bucket. - */ -static void PushString(char chr) -{ - /* - * Locals. - */ - register Bucket *bck; - /* - * Make sure there is room for the push. - */ - if ((bck = CurrentBucket)->Index >= BUCKET_SIZE){ - bck = (Bucket *) Malloc(sizeof(Bucket)); - bck->Next = CurrentBucket; - (CurrentBucket = bck)->Index = 0; - } - /* - * Push the character. - */ - bck->Data[bck->Index++] = chr; - StringSize += 1; -} -/* - * Form string: - * - * This converts the current string bucket into a real live string, - * whose pointer is returned. - */ -static char *FormString() -{ - /* - * Locals. - */ - register Bucket *bck; - register char *cp; - /* - * Allocate space for the string, set the pointer at the end. - */ - cp = (char *) Malloc(StringSize + 1); - - cp += StringSize; - *cp-- = '\0'; - /* - * Yank characters out of the bucket. - */ - for (bck = CurrentBucket; bck->Index || bck->Next;){ - if (!bck->Index){ - CurrentBucket = bck->Next; - Free(bck); - bck = CurrentBucket; - } - *cp-- = bck->Data[--bck->Index]; - } - /* reset buffer size to zero */ - StringSize =0; - return (cp + 1); -} -/* - * Parse EDIF: - * - * This builds the context tree and then calls the real parser. - * It is passed two file streams, the first is where the input comes - * from; the second is where error messages get printed. - */ -void ParseEDIF(char* filename,FILE* err) -{ - /* - * Locals. - */ - register int i; - static int ContextDefined = 1; - /* - * Set up the file state to something useful. - */ - InFile = filename; - Input = fopen(filename,"r"); - Error = err; - LineNumber = 1; - /* - * Define both the enabled token and context strings. - */ - if (ContextDefined){ - for (i = TokenDefSize; i--; EnterKeyword(TokenDef[i].Name)){ - register unsigned int hsh; - hsh = TokenDef[i].Code % TOKEN_HASH; - TokenDef[i].Next = TokenHash[hsh]; - TokenHash[hsh] = &TokenDef[i]; - } - for (i = ContextDefSize; i--; EnterKeyword(ContextDef[i].Name)){ - register unsigned int hsh; - hsh = ContextDef[i].Code % CONTEXT_HASH; - ContextDef[i].Next = ContextHash[hsh]; - ContextHash[hsh] = &ContextDef[i]; - } - /* - * Build the context tree. - */ - for (i = BinderDefSize; i--;){ - register Context *cxt; - register int j; - /* - * Define the current context to have carriers bound to it. - */ - cxt = FindContext(BinderDef[i].Origin); - for (j = BinderDef[i].FollowerSize; j--;){ - register ContextCar *cc; - /* - * Add carriers to the current context. - */ - cc = (ContextCar *) Malloc(sizeof(ContextCar)); - cc->Next = cxt->Context; - (cxt->Context = cc)->Context = - FindContext(PCB_ABS(BinderDef[i].Follower[j])); - cc->u.Single = BinderDef[i].Follower[j] < 0; - } - } - /* - * Build the token tree. - */ - for (i = TieDefSize; i--;){ - register Context *cxt; - register int j; - /* - * Define the current context to have carriers bound to it. - */ - cxt = FindContext(TieDef[i].Origin); - for (j = TieDef[i].EnableSize; j--;){ - register TokenCar *tc; - /* - * Add carriers to the current context. - */ - tc = (TokenCar *) Malloc(sizeof(TokenCar)); - tc->Next = cxt->Token; - (cxt->Token = tc)->Token = FindToken(TieDef[i].Enable[j]); - } - } - /* - * Put a bogus context on the stack which has 'EDIF' as its - * follower. - */ - CSP = (ContextCar *) Malloc(sizeof(ContextCar)); - CSP->Next = NULL; - CSP->Context = FindContext(0); - CSP->u.Used = NULL; - ContextDefined = 0; - } - /* - * Create an initial, empty string bucket. - */ - CurrentBucket = (Bucket *) Malloc(sizeof(Bucket)); - CurrentBucket->Next = 0; - CurrentBucket->Index = 0; - /* - * Fill the token stack with NULLs if debugging is enabled. - */ -#ifdef DEBUG - for (i = TS_DEPTH; i--; TokenStack[i] = NULL) - if (TokenStack[i]) - Free(TokenStack[i]); - TSP = 0; -#endif /* DEBUG */ - /* - * Go parse things! - */ - edifparse(); -} -/* - * Match token: - * - * The passed string is looked up in the current context's token - * list to see if it is enabled. If so the token value is returned, - * if not then zero. - */ -static int MatchToken(register const char * str) -{ - /* - * Locals. - */ - register TokenCar *wlk,*owk; - /* - * Convert the string to the proper form, then search the token - * carrier list for a match. - */ - str = FindKeyword(str); - for (owk = NULL, wlk = CSP->Context->Token; wlk; wlk = (owk = wlk)->Next) - if (str == wlk->Token->Name){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = CSP->Context->Token; - CSP->Context->Token = wlk; - } - return (wlk->Token->Code); - } - return (0); -} -/* - * Match context: - * - * If the passed keyword string is within the current context, the - * new context is pushed and token value is returned. A zero otherwise. - */ -static int MatchContext(register const char * str) -{ - /* - * Locals. - */ - register ContextCar *wlk,*owk; - /* - * See if the context is present. - */ - str = FindKeyword(str); - for (owk = NULL, wlk = CSP->Context->Context; wlk; wlk = (owk = wlk)->Next) - if (str == wlk->Context->Name){ - if (owk){ - owk->Next = wlk->Next; - wlk->Next = CSP->Context->Context; - CSP->Context->Context = wlk; - } - /* - * If a single context, make sure it isn't already used. - */ - if (wlk->u.Single){ - register UsedCar *usc; - for (usc = CSP->u.Used; usc; usc = usc->Next) - if (usc->Code == wlk->Context->Code) - break; - if (usc){ - sprintf(CharBuf,"'%s' is used more than once within '%s'", - str,CSP->Context->Name); - yyerror(CharBuf); - } else { - usc = (UsedCar *) Malloc(sizeof(UsedCar)); - usc->Next = CSP->u.Used; - (CSP->u.Used = usc)->Code = wlk->Context->Code; - } - } - /* - * Push the new context. - */ - owk = (ContextCar *) Malloc(sizeof(ContextCar)); - owk->Next = CSP; - (CSP = owk)->Context = wlk->Context; - owk->u.Used = NULL; - return (wlk->Context->Code); - } - return (0); -} -/* - * PopC: - * - * This pops the current context. - */ -static void PopC() -{ - /* - * Locals. - */ - register UsedCar *usc; - register ContextCar *csp; - /* - * Release single markers and pop context. - */ - while ( (usc = CSP->u.Used) ){ - CSP->u.Used = usc->Next; - Free(usc); - } - csp = CSP->Next; - Free(CSP); - CSP = csp; -} -/* - * Lexical analyzer states. - */ -#define L_START 0 -#define L_INT 1 -#define L_IDENT 2 -#define L_KEYWORD 3 -#define L_STRING 4 -#define L_KEYWORD2 5 -#define L_ASCIICHAR 6 -#define L_ASCIICHAR2 7 -/* - * yylex: - * - * This is the lexical analyzer called by the YACC/BISON parser. - * It returns a pretty restricted set of token types and does the - * context movement when acceptable keywords are found. The token - * value returned is a NULL terminated string to allocated storage - * (ie - it should get released some time) with some restrictions. - * The token value for integers is strips a leading '+' if present. - * String token values have the leading and trailing '"'-s stripped. - * '%' conversion characters in string values are passed converted. - * The '(' and ')' characters do not have a token value. - */ -static int yylex() -{ - /* - * Locals. - */ - register int c,s,l; - /* - * Keep on sucking up characters until we find something which - * explicitly forces us out of this function. - */ - for (s = L_START, l = 0; 1;){ - yytext[l++] = c = Getc(Input); - switch (s){ - /* - * Starting state, look for something resembling a token. - */ - case L_START: - if (isdigit(c) || c == '-') - s = L_INT; - else if (isalpha(c) || c == '&') - s = L_IDENT; - else if (isspace(c)){ - if (c == '\n') - LineNumber += 1; - l = 0; - } else if (c == '('){ - l = 0; - s = L_KEYWORD; - } else if (c == '"') - s = L_STRING; - else if (c == '+'){ - l = 0; /* strip '+' */ - s = L_INT; - } else if (c == EOF) - return ('\0'); - else { - yytext[1] = '\0'; - Stack(yytext,c); - return (c); - } - break; - /* - * Suck up the integer digits. - */ - case L_INT: - if (isdigit(c)) - break; - Ungetc(c); - yytext[--l] = '\0'; - yylval.s = strcpy((char *)Malloc(l + 1),yytext); - Stack(yytext,EDIF_TOK_INT); - return (EDIF_TOK_INT); - /* - * Grab an identifier, see if the current context enables - * it with a specific token value. - */ - case L_IDENT: - if (isalpha(c) || isdigit(c) || c == '_') - break; - Ungetc(c); - yytext[--l] = '\0'; - if (CSP->Context->Token && (c = MatchToken(yytext))){ - Stack(yytext,c); - return (c); - } - yylval.s = strcpy((char *)Malloc(l + 1),yytext); - Stack(yytext, EDIF_TOK_IDENT); - return (EDIF_TOK_IDENT); - /* - * Scan until you find the start of an identifier, discard - * any whitespace found. On no identifier, return a '('. - */ - case L_KEYWORD: - if (isalpha(c) || c == '&'){ - s = L_KEYWORD2; - break; - } else if (isspace(c)){ - l = 0; - break; - } - Ungetc(c); - Stack("(",'('); - return ('('); - /* - * Suck up the keyword identifier, if it matches the set of - * allowable contexts then return its token value and push - * the context, otherwise just return the identifier string. - */ - case L_KEYWORD2: - if (isalpha(c) || isdigit(c) || c == '_') - break; - Ungetc(c); - yytext[--l] = '\0'; - if ( (c = MatchContext(yytext)) ){ - Stack(yytext,c); - return (c); - } - yylval.s = strcpy((char *)Malloc(l + 1),yytext); - Stack(yytext, EDIF_TOK_KEYWORD); - return (EDIF_TOK_KEYWORD); - /* - * Suck up string characters but once resolved they should - * be deposited in the string bucket because they can be - * arbitrarily long. - */ - case L_STRING: - if (c == '\n') - LineNumber += 1; - else if (c == '\r') - ; - else if (c == '"' || c == EOF){ - yylval.s = FormString(); - Stack(yylval.s, EDIF_TOK_STR); - return (EDIF_TOK_STR); - } else if (c == '%') - s = L_ASCIICHAR; - else - PushString(c); - l = 0; - break; - /* - * Skip white space and look for integers to be pushed - * as characters. - */ - case L_ASCIICHAR: - if (isdigit(c)){ - s = L_ASCIICHAR2; - break; - } else if (c == '%' || c == EOF) - s = L_STRING; - else if (c == '\n') - LineNumber += 1; - l = 0; - break; - /* - * Convert the accumulated integer into a char and push. - */ - case L_ASCIICHAR2: - if (isdigit(c)) - break; - Ungetc(c); - yytext[--l] = '\0'; - PushString(atoi(yytext)); - s = L_ASCIICHAR; - l = 0; - break; - } - } -} - -int ReadEdifNetlist(char *filename) -{ - Message(PCB_MSG_INFO, _("Importing edif netlist %s\n"), filename); - ParseEDIF(filename, NULL); - - return 0; -} Index: 1.1.4/src_plugins/export_xy/xy.c =================================================================== --- 1.1.4/src_plugins/export_xy/xy.c (revision 10776) +++ 1.1.4/src_plugins/export_xy/xy.c (nonexistent) @@ -1,384 +0,0 @@ -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include -#include - -#include "global.h" -#include "data.h" -#include "error.h" -#include "misc.h" -#include "pcb-printf.h" -#include "plugins.h" -#include "compat_misc.h" - -#include "hid.h" -#include "hid_nogui.h" -#include "hid_attrib.h" -#include "hid_helper.h" -#include "hid_init.h" - -extern char *CleanBOMString(const char *in); - - -const char *xy_cookie = "bom HID"; - -static HID_Attribute xy_options[] = { -/* %start-doc options "8 XY Creation" -@ftable @code -@item --xyfile -Name of the XY output file. -@end ftable -%end-doc -*/ - {"xyfile", "Name of the XY output file", - HID_String, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_xyfile 0 - -/* %start-doc options "8 BOM Creation" -@ftable @code -@item --xy-unit -Unit of XY dimensions. Defaults to mil. -@end ftable -%end-doc -*/ - {"xy-unit", "XY units", - HID_Unit, 0, 0, {-1, 0, 0}, NULL, 0}, -#define HA_unit 1 - {"xy-in-mm", ATTR_UNDOCUMENTED, - HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, -#define HA_xymm 2 -}; - -#define NUM_OPTIONS (sizeof(xy_options)/sizeof(xy_options[0])) - -static HID_Attr_Val xy_values[NUM_OPTIONS]; - -static const char *xy_filename; -static const Unit *xy_unit; - -static HID_Attribute *xy_get_export_options(int *n) -{ - static char *last_xy_filename = 0; - static int last_unit_value = -1; - - if (xy_options[HA_unit].default_val.int_value == last_unit_value) { - if (conf_core.editor.grid_unit) - xy_options[HA_unit].default_val.int_value = conf_core.editor.grid_unit->index; - else - xy_options[HA_unit].default_val.int_value = get_unit_struct("mil")->index; - last_unit_value = xy_options[HA_unit].default_val.int_value; - } - if (PCB) - derive_default_filename(PCB->Filename, &xy_options[HA_xyfile], ".xy", &last_xy_filename); - - if (n) - *n = NUM_OPTIONS; - return xy_options; -} - -/* --------------------------------------------------------------------------- - * 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. - * returns != zero on error - */ -static double xyToAngle(double x, double y, pcb_bool morethan2pins) -{ - double d = atan2(-y, x) * 180.0 / M_PI; - - /* IPC 7351 defines different rules for 2 pin elements */ - if (morethan2pins) { - /* Multi pin case: - * Output 0 degrees if pin1 in is top left or top, i.e. between angles of - * 80 to 170 degrees. - * Pin #1 can be at dead top (e.g. certain PLCCs) or anywhere in the top - * left. - */ - if (d < -100) - return 90; /* -180 to -100 */ - else if (d < -10) - return 180; /* -100 to -10 */ - else if (d < 80) - return 270; /* -10 to 80 */ - else if (d < 170) - return 0; /* 80 to 170 */ - else - return 90; /* 170 to 180 */ - } - else { - /* 2 pin element: - * Output 0 degrees if pin #1 is in top left or left, i.e. in sector - * between angles of 95 and 185 degrees. - */ - if (d < -175) - return 0; /* -180 to -175 */ - else if (d < -85) - return 90; /* -175 to -85 */ - else if (d < 5) - return 180; /* -85 to 5 */ - else if (d < 95) - return 270; /* 5 to 95 */ - else - return 0; /* 95 to 180 */ - } -} - -/* - * In order of preference. - * Includes numbered and BGA pins. - * Possibly BGA pins can be missing, so we add a few to try. - */ -#define MAXREFPINS 32 /* max length of following list */ -static char *reference_pin_names[] = {"1", "2", "A1", "A2", "B1", "B2", 0}; - -static int PrintXY(void) -{ - char utcTime[64]; - Coord x, y; - double theta = 0.0; - double sumx, sumy; - double pin1x = 0.0, pin1y = 0.0; - int pin_cnt; - time_t currenttime; - FILE *fp; - char *name, *descr, *value, *fixed_rotation; - int pinfound[MAXREFPINS]; - double pinx[MAXREFPINS]; - double piny[MAXREFPINS]; - double pinangle[MAXREFPINS]; - double padcentrex, padcentrey; - double centroidx, centroidy; - int found_any_not_at_centroid, found_any, rpindex; - - - fp = fopen(xy_filename, "w"); - if (!fp) { - gui->log("Cannot open file %s for writing\n", xy_filename); - return 1; - } - - /* Create a portable timestamp. */ - currenttime = time(NULL); - { - /* avoid gcc complaints */ - const char *fmt = "%c UTC"; - strftime(utcTime, sizeof(utcTime), fmt, gmtime(¤ttime)); - } - fprintf(fp, "# $Id"); - fprintf(fp, "$\n"); - fprintf(fp, "# PcbXY Version 1.0\n"); - fprintf(fp, "# Date: %s\n", utcTime); - fprintf(fp, "# Author: %s\n", pcb_author()); - fprintf(fp, "# Title: %s - PCB X-Y\n", UNKNOWN(PCB->Name)); - fprintf(fp, "# RefDes, Description, Value, X, Y, rotation, top/bottom\n"); - fprintf(fp, "# X,Y in %s. rotation in degrees.\n", xy_unit->in_suffix); - fprintf(fp, "# --------------------------------------------\n"); - - /* - * For each element we calculate the centroid of the footprint. - */ - - ELEMENT_LOOP(PCB->Data); - { - /* initialize our pin count and our totals for finding the - centriod */ - pin_cnt = 0; - sumx = 0.0; - sumy = 0.0; - - /* - * iterate over the pins and pads keeping a running count of how - * many pins/pads total and the sum of x and y coordinates - * - * While we're at it, store the location of pin/pad #1 and #2 if - * we can find them - */ - - PIN_LOOP(element); - { - sumx += (double) pin->X; - sumy += (double) pin->Y; - pin_cnt++; - - for (rpindex = 0; reference_pin_names[rpindex]; rpindex++) { - if (NSTRCMP(pin->Number, reference_pin_names[rpindex]) == 0) { - pinx[rpindex] = (double) pin->X; - piny[rpindex] = (double) pin->Y; - pinangle[rpindex] = 0.0; /* pins have no notion of angle */ - pinfound[rpindex] = 1; - } - } - } - END_LOOP; - - PAD_LOOP(element); - { - sumx += (pad->Point1.X + pad->Point2.X) / 2.0; - sumy += (pad->Point1.Y + pad->Point2.Y) / 2.0; - pin_cnt++; - - for (rpindex = 0; reference_pin_names[rpindex]; rpindex++) { - if (NSTRCMP(pad->Number, reference_pin_names[rpindex]) == 0) { - padcentrex = (double) (pad->Point1.X + pad->Point2.X) / 2.0; - padcentrey = (double) (pad->Point1.Y + pad->Point2.Y) / 2.0; - pinx[rpindex] = padcentrex; - piny[rpindex] = padcentrey; - /* - * NOTE: We swap the Y points because in PCB, the Y-axis - * is inverted. Increasing Y moves down. We want to deal - * in the usual increasing Y moves up coordinates though. - */ - pinangle[rpindex] = (180.0 / M_PI) * atan2(pad->Point1.Y - pad->Point2.Y, pad->Point2.X - pad->Point1.X); - pinfound[rpindex] = 1; - } - } - } - END_LOOP; - - if (pin_cnt > 0) { - centroidx = sumx / (double) pin_cnt; - centroidy = sumy / (double) pin_cnt; - - if (NSTRCMP(AttributeGetFromList(&element->Attributes, "xy-centre"), "origin") == 0) { - x = element->MarkX; - y = element->MarkY; - } - else { - x = centroidx; - y = centroidy; - } - - fixed_rotation = AttributeGetFromList(&element->Attributes, "xy-fixed-rotation"); - if (fixed_rotation) { - /* The user specified a fixed rotation */ - theta = atof(fixed_rotation); - found_any_not_at_centroid = 1; - found_any = 1; - } - else { - /* Find first reference pin not at the centroid */ - found_any_not_at_centroid = 0; - found_any = 0; - theta = 0.0; - for (rpindex = 0; reference_pin_names[rpindex] && !found_any_not_at_centroid; rpindex++) { - if (pinfound[rpindex]) { - found_any = 1; - - /* Recenter pin "#1" onto the axis which cross at the part - centroid */ - pin1x = pinx[rpindex] - x; - pin1y = piny[rpindex] - y; - - /* flip x, to reverse rotation for elements on back */ - if (FRONT(element) != 1) - pin1x = -pin1x; - - /* if only 1 pin, use pin 1's angle */ - if (pin_cnt == 1) { - theta = pinangle[rpindex]; - found_any_not_at_centroid = 1; - } - else if ((pin1x != 0.0) || (pin1y != 0.0)) { - theta = xyToAngle(pin1x, pin1y, pin_cnt > 2); - found_any_not_at_centroid = 1; - } - } - } - - if (!found_any) { - Message - (PCB_MSG_WARNING, "PrintBOM(): unable to figure out angle because I could\n" - " not find a suitable reference pin of element %s\n" - " Setting to %g degrees\n", UNKNOWN(NAMEONPCB_NAME(element)), theta); - } - else if (!found_any_not_at_centroid) { - Message - (PCB_MSG_WARNING, "PrintBOM(): unable to figure out angle of element\n" - " %s because the reference pin(s) are at the centroid of the part.\n" - " Setting to %g degrees\n", UNKNOWN(NAMEONPCB_NAME(element)), theta); - } - } - } - - - name = CleanBOMString((char *) UNKNOWN(NAMEONPCB_NAME(element))); - descr = CleanBOMString((char *) UNKNOWN(DESCRIPTION_NAME(element))); - value = CleanBOMString((char *) UNKNOWN(VALUE_NAME(element))); - - y = PCB->MaxHeight - y; - pcb_fprintf(fp, "%m+%s,\"%s\",\"%s\",%mS,%.2mS,%g,%s\n", - xy_unit->allow, name, descr, value, x, y, theta, FRONT(element) == 1 ? "top" : "bottom"); - free(name); - free(descr); - free(value); - } - END_LOOP; - - fclose(fp); - - return (0); -} - -static void xy_do_export(HID_Attr_Val * options) -{ - int i; - - if (!options) { - xy_get_export_options(0); - for (i = 0; i < NUM_OPTIONS; i++) - xy_values[i] = xy_options[i].default_val; - options = xy_values; - } - - xy_filename = options[HA_xyfile].str_value; - if (!xy_filename) - xy_filename = "pcb-out.xy"; - - if (options[HA_unit].int_value == -1) - xy_unit = options[HA_xymm].int_value ? get_unit_struct("mm") - : get_unit_struct("mil"); - else - xy_unit = &get_unit_list()[options[HA_unit].int_value]; - PrintXY(); -} - -static int xy_usage(const char *topic) -{ - fprintf(stderr, "\nXY exporter command line arguments:\n\n"); - hid_usage(xy_options, sizeof(xy_options) / sizeof(xy_options[0])); - fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x xy foo.pcb [xy_options]\n\n"); - return 0; -} - -static void xy_parse_arguments(int *argc, char ***argv) -{ - hid_register_attributes(xy_options, sizeof(xy_options) / sizeof(xy_options[0]), xy_cookie, 0); - hid_parse_command_line(argc, argv); -} - -HID xy_hid; - -pcb_uninit_t hid_export_xy_init() -{ - memset(&xy_hid, 0, sizeof(HID)); - - common_nogui_init(&xy_hid); - - xy_hid.struct_size = sizeof(HID); - xy_hid.name = "XY"; - xy_hid.description = "Exports a XY (centroid)"; - xy_hid.exporter = 1; - - xy_hid.get_export_options = xy_get_export_options; - xy_hid.do_export = xy_do_export; - xy_hid.parse_arguments = xy_parse_arguments; - - xy_hid.usage = xy_usage; - - hid_register_hid(&xy_hid); - return NULL; -} Index: 1.1.4/src_plugins/export_xy/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/export_xy/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/export_xy/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {export_xy} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_xy/xy.o @] - -switch /local/pcb/export_xy/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/export_xy/README =================================================================== --- 1.1.4/src_plugins/export_xy/README (revision 10776) +++ 1.1.4/src_plugins/export_xy/README (nonexistent) @@ -1,5 +0,0 @@ -Export XY centroid element data for pick & place. - -#state: works -#default: buildin -#implements: export Index: 1.1.4/src_plugins/export_xy/Makefile =================================================================== --- 1.1.4/src_plugins/export_xy/Makefile (revision 10776) +++ 1.1.4/src_plugins/export_xy/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_export_xy - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/Disable.tmpasm =================================================================== --- 1.1.4/src_plugins/Disable.tmpasm (revision 10776) +++ 1.1.4/src_plugins/Disable.tmpasm (nonexistent) @@ -1,14 +0,0 @@ -# tmpasm script for disable a plugin_src/ module -# Requires variables before the include: -# /local/pcb/mod/OBJS full path of all object files - -# append all objects to the source list used only for dependencies -# NOTE: .o suffixes will be replaced with .c before generating the dep -append /local/pcb/DEPSRCS /local/pcb/mod/OBJS - -put /local/pcb/mod/OBJS {} -put /local/pcb/mod/OBJS_C99 {} -put /local/pcb/mod/CONF {} -put /local/pcb/mod/LDFLAGS {} -put /local/pcb/mod/CFLAGS {} -put /local/pcb/mod {} Index: 1.1.4/src_plugins/hid_batch/batch.c =================================================================== --- 1.1.4/src_plugins/hid_batch/batch.c (revision 10776) +++ 1.1.4/src_plugins/hid_batch/batch.c (nonexistent) @@ -1,411 +0,0 @@ -#include "config.h" - -#include -#include -#include -#include - -#include "global.h" -#include "hid.h" -#include "data.h" -#include "misc.h" -#include "layer.h" -#include "hid.h" -#include "pcb-printf.h" -#include "plugins.h" -#include "compat_misc.h" - -#include "hid_draw_helpers.h" -#include "hid_nogui.h" -#include "hid_actions.h" -#include "hid_init.h" - -static const char *batch_cookie = "batch HID"; - -static void batch_begin(void); -static void batch_end(void); - -/* This is a text-line "batch" HID, which exists for scripting and - non-GUI needs. */ - -typedef struct hid_gc_struct { - int nothing_interesting_here; -} hid_gc_struct; - -static HID_Attribute *batch_get_export_options(int *n_ret) -{ - return 0; -} - -/* ----------------------------------------------------------------------------- */ - -static char *prompt = NULL; - -static void hid_batch_uninit(void) -{ - hid_remove_actions_by_cookie(batch_cookie); - if (prompt != NULL) - free(prompt); -} - -static int nop(int argc, const char **argv, Coord x, Coord y) -{ - return 0; -} - -static int PCBChanged(int argc, const char **argv, Coord x, Coord y) -{ - if (prompt != NULL) - free(prompt); - if (PCB && PCB->Filename) { - prompt = strrchr(PCB->Filename, '/'); - if (prompt) - prompt++; - else - prompt = PCB->Filename; - if (prompt != NULL) - prompt = pcb_strdup(prompt); - } - else - prompt = pcb_strdup("no-board"); - return 0; -} - -static int help(int argc, const char **argv, Coord x, Coord y) -{ - print_actions(); - return 0; -} - -static int info(int argc, const char **argv, Coord x, Coord y) -{ - int i, j; - int cg, sg; - if (!PCB || !PCB->Data || !PCB->Filename) { - printf("No PCB loaded.\n"); - return 0; - } - printf("Filename: %s\n", PCB->Filename); - pcb_printf("Size: %ml x %ml mils, %mm x %mm mm\n", PCB->MaxWidth, PCB->MaxHeight, PCB->MaxWidth, PCB->MaxHeight); - cg = GetLayerGroupNumberByNumber(component_silk_layer); - sg = GetLayerGroupNumberByNumber(solder_silk_layer); - for (i = 0; i < MAX_LAYER; i++) { - - int lg = GetLayerGroupNumberByNumber(i); - for (j = 0; j < MAX_LAYER; j++) - putchar(j == lg ? '#' : '-'); - printf(" %c %s\n", lg == cg ? 'c' : lg == sg ? 's' : '-', PCB->Data->Layer[i].Name); - } - return 0; -} - -HID_Action batch_action_list[] = { - {"PCBChanged", 0, PCBChanged} - , - {"RouteStylesChanged", 0, nop} - , - {"NetlistChanged", 0, nop} - , - {"LayersChanged", 0, nop} - , - {"LibraryChanged", 0, nop} - , - {"Busy", 0, nop} - , - {"Help", 0, help} - , - {"Info", 0, info} - , - {"PointCursor", 0, info} -}; - -REGISTER_ACTIONS(batch_action_list, batch_cookie) - -extern int isatty(); - -/* ----------------------------------------------------------------------------- */ -static int batch_stay; -static void batch_do_export(HID_Attr_Val * options) -{ - int interactive; - char line[1000]; - - batch_begin(); - - if (isatty(0)) - interactive = 1; - else - interactive = 0; - - if (interactive) { - printf("Entering %s version %s batch mode.\n", PACKAGE, VERSION); - printf("See http://repo.hu/projects/pcb-rnd for project information\n"); - } - - batch_stay = 1; - while (batch_stay) { - if (interactive) { - printf("%s> ", prompt); - fflush(stdout); - } - if (fgets(line, sizeof(line) - 1, stdin) == NULL) { - hid_batch_uninit(); - return; - } - hid_parse_command(line); - } - batch_end(); -} - -static void batch_do_exit(HID *hid) -{ - batch_stay = 0; -} - -static void batch_parse_arguments(int *argc, char ***argv) -{ - hid_parse_command_line(argc, argv); -} - -static void batch_invalidate_lr(int l, int r, int t, int b) -{ -} - -static void batch_invalidate_all(void) -{ -} - -static int batch_set_layer(const char *name, int idx, int empty) -{ - return 0; -} - -static hidGC batch_make_gc(void) -{ - return 0; -} - -static void batch_destroy_gc(hidGC gc) -{ -} - -static void batch_use_mask(int use_it) -{ -} - -static void batch_set_color(hidGC gc, const char *name) -{ -} - -static void batch_set_line_cap(hidGC gc, EndCapStyle style) -{ -} - -static void batch_set_line_width(hidGC gc, Coord width) -{ -} - -static void batch_set_draw_xor(hidGC gc, int xor_set) -{ -} - -static void batch_draw_line(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ -} - -static void batch_draw_arc(hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle end_angle) -{ -} - -static void batch_draw_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ -} - -static void batch_fill_circle(hidGC gc, Coord cx, Coord cy, Coord radius) -{ -} - -static void batch_fill_polygon(hidGC gc, int n_coords, Coord * x, Coord * y) -{ -} - -static void batch_fill_rect(hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) -{ -} - -static void batch_calibrate(double xval, double yval) -{ -} - -static int batch_shift_is_pressed(void) -{ - return 0; -} - -static int batch_control_is_pressed(void) -{ - return 0; -} - -static int batch_mod1_is_pressed(void) -{ - return 0; -} - -static void batch_get_coords(const char *msg, Coord * x, Coord * y) -{ -} - -static void batch_set_crosshair(int x, int y, int action) -{ -} - -static hidval batch_add_timer(void (*func) (hidval user_data), unsigned long milliseconds, hidval user_data) -{ - hidval rv; - rv.lval = 0; - return rv; -} - -static void batch_stop_timer(hidval timer) -{ -} - -hidval -batch_watch_file(int fd, unsigned int condition, void (*func) (hidval watch, int fd, unsigned int condition, hidval user_data), - hidval user_data) -{ - hidval ret; - ret.ptr = NULL; - return ret; -} - -void batch_unwatch_file(hidval data) -{ -} - -static hidval batch_add_block_hook(void (*func) (hidval data), hidval user_data) -{ - hidval ret; - ret.ptr = NULL; - return ret; -} - -static void batch_stop_block_hook(hidval mlpoll) -{ -} - -static int -batch_attribute_dialog(HID_Attribute * attrs_, int n_attrs_, HID_Attr_Val * results_, const char *title_, const char *descr_) -{ - return 0; -} - -static void batch_show_item(void *item) -{ -} - -static void batch_create_menu(const char *menu, const char *action, const char *mnemonic, const char *accel, const char *tip, const char *cookie) -{ -} - -static int batch_propedit_start(void *pe, int num_props, const char *(*query)(void *pe, const char *cmd, const char *key, const char *val, int idx)) -{ - printf("propedit start %d\n", num_props); - return 0; -} - -static void batch_propedit_end(void *pe) -{ - printf("propedit end\n"); -} - -static void *batch_propedit_add_prop(void *pe, const char *propname, int is_mutable, int num_vals) -{ - printf(" %s (%d) %s\n", propname, num_vals, is_mutable ? "mutable" : "immutable"); - return NULL; -} - -static void batch_propedit_add_value(void *pe, const char *propname, void *propctx, const char *value, int repeat_cnt) -{ - printf(" %s (%d)\n", value, repeat_cnt); -} - -static void batch_propedit_add_stat(void *pe, const char *propname, void *propctx, const char *most_common, const char *min, const char *max, const char *avg) -{ - printf(" [%s|%s|%s|%s]\n", most_common, min, max, avg); -} - - -#include "dolists.h" - -static HID batch_hid; - -pcb_uninit_t hid_hid_batch_init() -{ - memset(&batch_hid, 0, sizeof(HID)); - - common_nogui_init(&batch_hid); - common_draw_helpers_init(&batch_hid); - - batch_hid.struct_size = sizeof(HID); - batch_hid.name = "batch"; - batch_hid.description = "Batch-mode GUI for non-interactive use."; - batch_hid.gui = 1; - - batch_hid.get_export_options = batch_get_export_options; - batch_hid.do_export = batch_do_export; - batch_hid.do_exit = batch_do_exit; - batch_hid.parse_arguments = batch_parse_arguments; - batch_hid.invalidate_lr = batch_invalidate_lr; - batch_hid.invalidate_all = batch_invalidate_all; - batch_hid.set_layer = batch_set_layer; - batch_hid.make_gc = batch_make_gc; - batch_hid.destroy_gc = batch_destroy_gc; - batch_hid.use_mask = batch_use_mask; - batch_hid.set_color = batch_set_color; - batch_hid.set_line_cap = batch_set_line_cap; - batch_hid.set_line_width = batch_set_line_width; - batch_hid.set_draw_xor = batch_set_draw_xor; - batch_hid.draw_line = batch_draw_line; - batch_hid.draw_arc = batch_draw_arc; - batch_hid.draw_rect = batch_draw_rect; - batch_hid.fill_circle = batch_fill_circle; - batch_hid.fill_polygon = batch_fill_polygon; - batch_hid.fill_rect = batch_fill_rect; - batch_hid.calibrate = batch_calibrate; - batch_hid.shift_is_pressed = batch_shift_is_pressed; - batch_hid.control_is_pressed = batch_control_is_pressed; - batch_hid.mod1_is_pressed = batch_mod1_is_pressed; - batch_hid.get_coords = batch_get_coords; - batch_hid.set_crosshair = batch_set_crosshair; - batch_hid.add_timer = batch_add_timer; - batch_hid.stop_timer = batch_stop_timer; - batch_hid.watch_file = batch_watch_file; - batch_hid.unwatch_file = batch_unwatch_file; - batch_hid.add_block_hook = batch_add_block_hook; - batch_hid.stop_block_hook = batch_stop_block_hook; - batch_hid.attribute_dialog = batch_attribute_dialog; - batch_hid.show_item = batch_show_item; - batch_hid.create_menu = batch_create_menu; - - batch_hid.propedit_start = batch_propedit_start; - batch_hid.propedit_end = batch_propedit_end; - batch_hid.propedit_add_prop = batch_propedit_add_prop; - batch_hid.propedit_add_value = batch_propedit_add_value; - batch_hid.propedit_add_stat = batch_propedit_add_stat; - - - hid_register_hid(&batch_hid); - return NULL; -} - -static void batch_begin(void) -{ - REGISTER_ACTIONS(batch_action_list, batch_cookie) -} - -static void batch_end(void) -{ - hid_remove_actions_by_cookie(batch_cookie); -} Index: 1.1.4/src_plugins/hid_batch/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/hid_batch/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/hid_batch/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {hid_batch} -append /local/pcb/mod/OBJS [@ $(PLUGDIR)/hid_batch/batch.o @] - -switch /local/pcb/hid_batch/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/hid_batch/README =================================================================== --- 1.1.4/src_plugins/hid_batch/README (revision 10776) +++ 1.1.4/src_plugins/hid_batch/README (nonexistent) @@ -1,5 +0,0 @@ -HID without GUI; read actions from stdin. - -#state: works -#default: buildin -#implements: hid Index: 1.1.4/src_plugins/hid_batch/Makefile =================================================================== --- 1.1.4/src_plugins/hid_batch/Makefile (revision 10776) +++ 1.1.4/src_plugins/hid_batch/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && make mod_hid_batch - -clean: - rm *.o *.so 2>/dev/null ; true - Index: 1.1.4/src_plugins/query/query_y.h =================================================================== --- 1.1.4/src_plugins/query/query_y.h (revision 10776) +++ 1.1.4/src_plugins/query/query_y.h (nonexistent) @@ -1,95 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - 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 3 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_QRY_QUERY_Y_H_INCLUDED -# define YY_QRY_QUERY_Y_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int qry_debug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - T_LET = 258, - T_ASSERT = 259, - T_RULE = 260, - T_LIST = 261, - T_INVALID = 262, - T_FLD_P = 263, - T_FLD_A = 264, - T_OR = 265, - T_AND = 266, - T_EQ = 267, - T_NEQ = 268, - T_GTEQ = 269, - T_LTEQ = 270, - T_NL = 271, - T_UNIT = 272, - T_STR = 273, - T_QSTR = 274, - T_INT = 275, - T_DBL = 276, - T_CONST = 277 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 95 "query_y.y" /* yacc.c:1909 */ - - char *s; - Coord c; - double d; - const Unit *u; - pcb_qry_node_t *n; - -#line 85 "query_y.h" /* yacc.c:1909 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE qry_lval; - -int qry_parse (pcb_qry_node_t **prg_out); - -#endif /* !YY_QRY_QUERY_Y_H_INCLUDED */ Index: 1.1.4/src_plugins/query/query.c =================================================================== --- 1.1.4/src_plugins/query/query.c (revision 10776) +++ 1.1.4/src_plugins/query/query.c (nonexistent) @@ -1,294 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - common code for the compiled tree and plugin administration */ - -#include "config.h" -#include "global.h" -#include -#include -#include "conf.h" -#include "data.h" -#include "action_helper.h" -#include "change.h" -#include "error.h" -#include "undo.h" -#include "plugins.h" -#include "hid_init.h" -#include "hid_actions.h" -#include "compat_misc.h" -#include "query.h" -#include "fptr_cast.h" - -/******** tree helper ********/ - -const char *type_name[PCBQ_nodetype_max] = { - "PCBQ_RULE", - "PCBQ_RNAME", - "PCBQ_EXPR_PROG", - "PCBQ_EXPR", - "PCBQ_ITER_CTX", - "PCBQ_OP_AND", - "PCBQ_OP_OR", - "PCBQ_OP_EQ", - "PCBQ_OP_NEQ", - "PCBQ_OP_GTEQ", - "PCBQ_OP_LTEQ", - "PCBQ_OP_GT", - "PCBQ_OP_LT", - "PCBQ_OP_ADD", - "PCBQ_OP_SUB", - "PCBQ_OP_MUL", - "PCBQ_OP_DIV", - "PCBQ_OP_MATCH", - "PCBQ_OP_NOT", - "PCBQ_FIELD", - "PCBQ_FIELD_OF", - "PCBQ_LISTVAR", - "PCBQ_VAR", - "PCBQ_FNAME", - "PCBQ_FCALL", - "PCBQ_DATA_COORD", - "PCBQ_DATA_DOUBLE", - "PCBQ_DATA_STRING", - "PCBQ_DATA_REGEX", - "PCBQ_DATA_CONST", - "PCBQ_DATA_INVALID" -}; - -char *pcb_query_sprint_val(pcb_qry_val_t *val) -{ - switch(val->type) { - case PCBQ_VT_VOID: return pcb_strdup(""); - case PCBQ_VT_COORD: return pcb_strdup_printf("%mI=%$mH", val->data.crd, val->data.crd); - case PCBQ_VT_DOUBLE: return pcb_strdup_printf("%f", val->data.dbl); - case PCBQ_VT_STRING: return pcb_strdup_printf("\"%s\"", val->data.str); - case PCBQ_VT_OBJ: return pcb_strdup(""); - case PCBQ_VT_LST: return pcb_strdup(""); - } - return pcb_strdup(""); -} - -const char *pcb_qry_nodetype_name(pcb_qry_nodetype_t ntype) -{ - int type = ntype; - if ((type < 0) || (type >= PCBQ_nodetype_max)) - return ""; - return type_name[type]; -} - -pcb_qry_node_t *pcb_qry_n_alloc(pcb_qry_nodetype_t ntype) -{ - pcb_qry_node_t *nd = calloc(sizeof(pcb_qry_node_t), 1); - nd->type = ntype; - return nd; -} - -pcb_qry_node_t *pcb_qry_n_insert(pcb_qry_node_t *parent, pcb_qry_node_t *ch) -{ - ch->next = parent->data.children; - parent->data.children = ch; - ch->parent = parent; - return parent; -} - -static char ind[] = " "; -void pcb_qry_dump_tree_(const char *prefix, int level, pcb_qry_node_t *nd, pcb_query_iter_t *it_ctx) -{ - pcb_qry_node_t *n; - if (level < sizeof(ind)) ind[level] = '\0'; - printf("%s%s%s ", prefix, ind, pcb_qry_nodetype_name(nd->type)); - switch(nd->type) { - case PCBQ_DATA_INVALID:pcb_printf("%s%s invalid (literal)\n", prefix, ind); break; - case PCBQ_DATA_COORD: pcb_printf("%s%s %mI (%$mm)\n", prefix, ind, nd->data.crd, nd->data.crd); break; - case PCBQ_DATA_DOUBLE: pcb_printf("%s%s %f\n", prefix, ind, nd->data.dbl); break; - case PCBQ_DATA_CONST: pcb_printf("%s%s %s\n", prefix, ind, nd->data.str); break; - case PCBQ_ITER_CTX: pcb_printf("%s%s vars=%d\n", prefix, ind, nd->data.iter_ctx->num_vars); break; - case PCBQ_VAR: - pcb_printf("%s%s ", prefix, ind); - if ((it_ctx != NULL) && (nd->data.crd < it_ctx->num_vars)) { - if (it_ctx->it == NULL) - pcb_qry_iter_init(it_ctx); - printf("%s\n", it_ctx->vn[nd->data.crd]); - } - else - printf("\n", nd->data.crd); - break; - case PCBQ_FNAME: - { - const char *name = pcb_qry_fnc_name(nd->data.fnc); - if (name == NULL) - pcb_printf("%s%s \n", prefix, ind); - else - pcb_printf("%s%s %s()\n", prefix, ind, name); - } - break; - case PCBQ_FIELD: - case PCBQ_LISTVAR: - case PCBQ_DATA_REGEX: - case PCBQ_DATA_STRING: pcb_printf("%s%s '%s'\n", prefix, ind, nd->data.str); break; - default: - printf("\n"); - if (level < sizeof(ind)) ind[level] = ' '; - for(n = nd->data.children; n != NULL; n = n->next) { - if (n->parent != nd) - printf("#parent# "); - pcb_qry_dump_tree_(prefix, level+1, n, it_ctx); - } - return; - } - if (level < sizeof(ind)) ind[level] = ' '; -} - -pcb_query_iter_t *pcb_qry_find_iter(pcb_qry_node_t *node) -{ - for(; node != NULL;node = node->parent) { - if (node->type == PCBQ_EXPR_PROG) { - if (node->data.children->type == PCBQ_ITER_CTX) - return node->data.children->data.iter_ctx; - } - if (node->type == PCBQ_EXPR_PROG) { - if (node->data.children->type == PCBQ_ITER_CTX) - return node->data.children->data.iter_ctx; - } - } - - return NULL; -} - -void pcb_qry_dump_tree(const char *prefix, pcb_qry_node_t *top) -{ - pcb_query_iter_t *iter_ctx = pcb_qry_find_iter(top); - - if (iter_ctx == NULL) - printf("\n"); - - for(; top != NULL; top = top->next) - pcb_qry_dump_tree_(prefix, 0, top, iter_ctx); -} - -/******** iter admin ********/ -pcb_query_iter_t *pcb_qry_iter_alloc(void) -{ - pcb_query_iter_t *it = calloc(1, sizeof(pcb_query_iter_t)); - htsi_init(&it->names, strhash, strkeyeq); - return it; -} - - -int pcb_qry_iter_var(pcb_query_iter_t *it, const char *varname, int alloc) -{ - htsi_entry_t *e = htsi_getentry(&it->names, varname); - - if (e != NULL) - return e->value; - - if (!alloc) - return -1; - - htsi_set(&it->names, pcb_strdup(varname), it->num_vars); - return it->num_vars++; -} - -void pcb_qry_iter_init(pcb_query_iter_t *it) -{ - htsi_entry_t *e; - - if (it->vn != NULL) - return; - it->it = calloc(sizeof(pcb_obj_t *), it->num_vars); - it->lst = calloc(sizeof(pcb_qry_val_t), it->num_vars); - - it->vn = malloc(sizeof(char *) * it->num_vars); - for (e = htsi_first(&it->names); e; e = htsi_next(&it->names, e)) - it->vn[e->value] = e->key; - it->all_idx = -1; -} - -/******** functions ********/ -static htsp_t *qfnc = NULL; - - -int pcb_qry_fnc_reg(const char *name, pcb_qry_fnc_t fnc) -{ - if (qfnc == NULL) - qfnc = htsp_alloc(strhash, strkeyeq); - if (htsp_get(qfnc, name) != NULL) - return -1; - - htsp_set(qfnc, pcb_strdup(name), pcb_cast_f2d((pcb_fptr_t)fnc)); - - return 0; -} - -pcb_qry_fnc_t pcb_qry_fnc_lookup(const char *name) -{ - if (qfnc == NULL) - return NULL; - - return (pcb_qry_fnc_t)pcb_cast_d2f(htsp_get(qfnc, name)); -} - -/* slow linear search: it's only for the dump */ -const char *pcb_qry_fnc_name(pcb_qry_fnc_t fnc) -{ - htsp_entry_t *e; - void *target = pcb_cast_f2d((pcb_fptr_t)fnc); - - if (qfnc == NULL) - return NULL; - - for(e = htsp_first(qfnc); e != NULL; e = htsp_next(qfnc, e)) - if (e->value == target) - return e->key; - return NULL; -} - -/******** parser helper ********/ -void qry_error(void *prog, const char *err) -{ - pcb_trace("qry_error: %s\n", err); -} - -int qry_wrap() -{ - return 1; -} - -/******** plugin helper ********/ -void query_action_reg(const char *cookie); - -static const char *query_cookie = "query plugin"; - -static void hid_query_uninit(void) -{ - hid_remove_actions_by_cookie(query_cookie); -} - -void pcb_qry_basic_fnc_init(void); - -pcb_uninit_t hid_query_init(void) -{ - pcb_qry_basic_fnc_init(); - query_action_reg(query_cookie); - return hid_query_uninit; -} Index: 1.1.4/src_plugins/query/basic_fnc.c =================================================================== --- 1.1.4/src_plugins/query/basic_fnc.c (revision 10776) +++ 1.1.4/src_plugins/query/basic_fnc.c (nonexistent) @@ -1,42 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include "global.h" -#include "data.h" -#include "query_access.h" -#include "query_exec.h" - -/* Query language - basic functions */ -static int fnc_llen(int argc, pcb_qry_val_t *argv, pcb_qry_val_t *res) -{ - if (argc != 1) - return -1; - if (argv[0].type != PCBQ_VT_LST) - PCB_QRY_RET_INV(res); - PCB_QRY_RET_INT(res, pcb_objlist_length(&argv[0].data.lst)); -} - - - -void pcb_qry_basic_fnc_init(void) -{ - pcb_qry_fnc_reg("llen", fnc_llen); -} Index: 1.1.4/src_plugins/query/query_exec.c =================================================================== --- 1.1.4/src_plugins/query/query_exec.c (revision 10776) +++ 1.1.4/src_plugins/query/query_exec.c (nonexistent) @@ -1,465 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - execution */ - -#include "global.h" -#include "data.h" -#include "query.h" -#include "query_exec.h" -#include "query_access.h" - -void pcb_qry_init(pcb_qry_exec_t *ctx, pcb_qry_node_t *root) -{ - memset(ctx, 0, sizeof(pcb_qry_exec_t)); - ctx->all.type = PCBQ_VT_LST; - pcb_qry_list_all(&ctx->all, PCB_OBJ_ANY); - ctx->root = root; - ctx->iter = NULL; -} - -void pcb_qry_uninit(pcb_qry_exec_t *ctx) -{ - pcb_qry_list_free(&ctx->all); -#warning TODO: free the iterator -} - -int pcb_qry_run(pcb_qry_node_t *prg, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_obj_t *current), void *user_ctx) -{ - pcb_qry_exec_t ec; - pcb_qry_val_t res; - int errs = 0; - - pcb_qry_init(&ec, prg); - if (pcb_qry_it_reset(&ec, prg) != 0) - return -1; - - do { - if (pcb_qry_eval(&ec, prg, &res) == 0) { - pcb_obj_t *current = NULL; - if (ec.iter->all_idx >= 0) - current = ec.iter->it[ec.iter->all_idx]; - cb(user_ctx, &res, current); - } - else - errs++; - } while(pcb_qry_it_next(&ec)); - pcb_qry_uninit(&ec); - return errs; -} - - -/* load unary operand to o1 */ -#define UNOP() \ -do { \ - if ((node->data.children == NULL) || (node->data.children->next != NULL)) \ - return -1; \ - if (pcb_qry_eval(ctx, node->data.children, &o1) < 0) \ - return -1; \ -} while(0) - -/* load 1st binary operand to o1 */ -#define BINOPS1() \ -do { \ - if ((node->data.children == NULL) || (node->data.children->next == NULL) || (node->data.children->next->next != NULL)) \ - return -1; \ - if (pcb_qry_eval(ctx, node->data.children, &o1) < 0) \ - return -1; \ -} while(0) - -/* load 2nd binary operand to o2 */ -#define BINOPS2() \ -do { \ - if (pcb_qry_eval(ctx, node->data.children->next, &o2) < 0) \ - return -1; \ -} while(0) - -/* load binary operands to o1 and o2 */ -#define BINOPS() \ -do { \ - BINOPS1(); \ - BINOPS2(); \ -} while(0) - -static int promote(pcb_qry_val_t *a, pcb_qry_val_t *b) -{ - if ((a->type == PCBQ_VT_VOID) || (b->type == PCBQ_VT_VOID)) { - a->type = b->type = PCBQ_VT_VOID; - return 0; - } - if (a->type == b->type) - return 0; - switch(a->type) { - case PCBQ_VT_OBJ: return -1; - case PCBQ_VT_LST: return -1; - case PCBQ_VT_COORD: - if (b->type == PCBQ_VT_DOUBLE) PCB_QRY_RET_DBL(a, a->data.crd); - return -1; - case PCBQ_VT_DOUBLE: - if (b->type == PCBQ_VT_COORD) PCB_QRY_RET_DBL(b, b->data.crd); - return -1; - case PCBQ_VT_STRING: - case PCBQ_VT_VOID: - return -1; - } - return -1; -} - -static const char *op2str(char *buff, int buff_size, pcb_qry_val_t *val) -{ - switch(val->type) { - case PCBQ_VT_COORD: - pcb_snprintf(buff, buff_size, "%mI", val->data.crd); - return buff; - case PCBQ_VT_DOUBLE: - pcb_snprintf(buff, buff_size, "%f", val->data.crd); - return buff; - case PCBQ_VT_STRING: - return val->data.str; - case PCBQ_VT_VOID: - case PCBQ_VT_OBJ: - case PCBQ_VT_LST: return NULL; - } -} - -int pcb_qry_is_true(pcb_qry_val_t *val) -{ - switch(val->type) { - case PCBQ_VT_VOID: return 0; - case PCBQ_VT_OBJ: return val->data.obj.type != PCB_OBJ_VOID; - case PCBQ_VT_LST: return pcb_objlist_first(&val->data.lst) != NULL; - case PCBQ_VT_COORD: return val->data.crd; - case PCBQ_VT_DOUBLE: return val->data.dbl; - case PCBQ_VT_STRING: return (val->data.str != NULL) && (*val->data.str != '\0'); - } - return 0; -} - -static void setup_iter_list(pcb_qry_exec_t *ctx, int var_id, pcb_qry_val_t *listval) -{ - ctx->iter->lst[var_id] = *listval; - assert(listval->type == PCBQ_VT_LST); - ctx->iter->it[var_id] = pcb_objlist_first(&listval->data.lst); -} - -int pcb_qry_it_reset(pcb_qry_exec_t *ctx, pcb_qry_node_t *node) -{ - int n; - ctx->iter = pcb_qry_find_iter(node); - if (ctx->iter == NULL) - return -1; - - pcb_qry_iter_init(ctx->iter); - - for(n = 0; n < ctx->iter->num_vars; n++) { - if (strcmp(ctx->iter->vn[n], "@") == 0) { - setup_iter_list(ctx, n, &ctx->all); - ctx->iter->all_idx = n; - break; - } - } - - return 0; -} - -int pcb_qry_it_next(pcb_qry_exec_t *ctx) -{ - int i; - for(i = 0; i < ctx->iter->num_vars; i++) { - ctx->iter->it[i] = pcb_objlist_next(ctx->iter->it[i]); - if (ctx->iter->it[i] != NULL) - return 1; - ctx->iter->it[i] = pcb_objlist_first(&ctx->iter->lst[i].data.lst); - } - return 0; -} - - -int pcb_qry_eval(pcb_qry_exec_t *ctx, pcb_qry_node_t *node, pcb_qry_val_t *res) -{ - pcb_qry_val_t o1, o2; - - switch(node->type) { - case PCBQ_EXPR: - return pcb_qry_eval(ctx, node->data.children, res); - - case PCBQ_EXPR_PROG: { - pcb_qry_node_t *itn, *exprn; - itn = node->data.children; - if (itn == NULL) - return -1; - exprn = itn->next; - if (exprn == NULL) - return -1; - if (itn->type != PCBQ_ITER_CTX) - return -1; - if (ctx->iter != itn->data.iter_ctx) - return -1; - return pcb_qry_eval(ctx, exprn, res); - } - - - case PCBQ_OP_AND: /* lazy */ - BINOPS1(); - if (!pcb_qry_is_true(&o1)) - PCB_QRY_RET_INT(res, 0); - BINOPS2(); - if (!pcb_qry_is_true(&o2)) - PCB_QRY_RET_INT(res, 0); - PCB_QRY_RET_INT(res, 1); - - case PCBQ_OP_OR: /* lazy */ - BINOPS1(); - if (pcb_qry_is_true(&o1)) - PCB_QRY_RET_INT(res, 1); - BINOPS2(); - if (pcb_qry_is_true(&o2)) - PCB_QRY_RET_INT(res, 1); - PCB_QRY_RET_INT(res, 0); - - case PCBQ_OP_EQ: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_OBJ: PCB_QRY_RET_INT(res, ((o1.data.obj.type) == (o2.data.obj.type)) && ((o1.data.obj.data.any) == (o2.data.obj.data.any))); - case PCBQ_VT_LST: PCB_QRY_RET_INT(res, pcb_qry_list_cmp(&o1, &o2)); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd == o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_INT(res, o1.data.dbl == o2.data.dbl); - case PCBQ_VT_STRING: - if (o1.data.str == o2.data.str) - PCB_QRY_RET_INT(res, 1); - if ((o1.data.str == NULL) || (o2.data.str == NULL)) - PCB_QRY_RET_INT(res, 0); - PCB_QRY_RET_INT(res, strcmp(o1.data.str, o2.data.str) == 0); - } - return -1; - - case PCBQ_OP_NEQ: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_OBJ: PCB_QRY_RET_INT(res, ((o1.data.obj.type) != (o2.data.obj.type)) || ((o1.data.obj.data.any) != (o2.data.obj.data.any))); - case PCBQ_VT_LST: PCB_QRY_RET_INT(res, !pcb_qry_list_cmp(&o1, &o2)); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd != o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_INT(res, o1.data.dbl != o2.data.dbl); - case PCBQ_VT_STRING: - if (o1.data.str == o2.data.str) - PCB_QRY_RET_INT(res, 0); - if ((o1.data.str == NULL) || (o2.data.str == NULL)) - PCB_QRY_RET_INT(res, 1); - PCB_QRY_RET_INT(res, strcmp(o1.data.str, o2.data.str) != 0); - } - return -1; - - case PCBQ_OP_GTEQ: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd >= o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_INT(res, o1.data.dbl >= o2.data.dbl); - case PCBQ_VT_STRING: PCB_QRY_RET_INT(res, strcmp(o1.data.str, o2.data.str) >= 0); - default: return -1; - } - return -1; - - case PCBQ_OP_LTEQ: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd <= o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_INT(res, o1.data.dbl <= o2.data.dbl); - case PCBQ_VT_STRING: PCB_QRY_RET_INT(res, strcmp(o1.data.str, o2.data.str) <= 0); - default: return -1; - } - return -1; - - case PCBQ_OP_GT: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd > o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_INT(res, o1.data.dbl > o2.data.dbl); - case PCBQ_VT_STRING: PCB_QRY_RET_INT(res, strcmp(o1.data.str, o2.data.str) > 0); - default: return -1; - } - return -1; - case PCBQ_OP_LT: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd < o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_INT(res, o1.data.dbl < o2.data.dbl); - case PCBQ_VT_STRING: PCB_QRY_RET_INT(res, strcmp(o1.data.str, o2.data.str) < 0); - default: return -1; - } - return -1; - - case PCBQ_OP_ADD: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd + o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_DBL(res, o1.data.dbl + o2.data.dbl); - default: return -1; - } - return -1; - - case PCBQ_OP_SUB: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd - o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_DBL(res, o1.data.dbl - o2.data.dbl); - default: return -1; - } - return -1; - - case PCBQ_OP_MUL: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd * o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_DBL(res, o1.data.dbl * o2.data.dbl); - default: return -1; - } - return -1; - - case PCBQ_OP_DIV: - BINOPS(); - if (promote(&o1, &o2) != 0) - return -1; - switch(o1.type) { - case PCBQ_VT_VOID: PCB_QRY_RET_INV(res); - case PCBQ_VT_COORD: PCB_QRY_RET_INT(res, o1.data.crd / o2.data.crd); - case PCBQ_VT_DOUBLE: PCB_QRY_RET_DBL(res, o1.data.dbl / o2.data.dbl); - default: return -1; - } - return -1; - - case PCBQ_OP_MATCH: - BINOPS1(); - { - pcb_qry_node_t *o2n =node->data.children->next; - char buff[128]; - const char *s; - if (o2n->type != PCBQ_DATA_REGEX) - return -1; - s = op2str(buff, sizeof(buff), &o1); - if (s != NULL) - PCB_QRY_RET_INT(res, re_se_exec(o2n->precomp.regex, s)); - } - PCB_QRY_RET_INV(res); - - case PCBQ_OP_NOT: - UNOP(); - PCB_QRY_RET_INT(res, !pcb_qry_is_true(&o1)); - - case PCBQ_FIELD_OF: - if ((node->data.children == NULL) || (node->data.children->next == NULL)) - return -1; - if (pcb_qry_eval(ctx, node->data.children, &o1) < 0) - return -1; - return pcb_qry_obj_field(&o1, node->data.children->next, res); - - case PCBQ_VAR: - assert((node->data.crd >= 0) && (node->data.crd < ctx->iter->num_vars)); - res->type = PCBQ_VT_OBJ; - res->data.obj = *ctx->iter->it[node->data.crd]; - return 0; - - case PCBQ_LISTVAR: { - int vi = pcb_qry_iter_var(ctx->iter, node->data.str, 0); - if ((vi < 0) && (strcmp(node->data.str, "@") == 0)) { - res->type = PCBQ_VT_LST; - res->data.lst = ctx->all.data.lst; - return 0; - } - if (vi >= 0) { - res->type = PCBQ_VT_LST; - res->data.lst = ctx->iter->lst[vi].data.lst; - return 0; - } - } - return -1; - - case PCBQ_FNAME: - return -1; /* shall not eval such a node */ - - case PCBQ_FCALL: { - pcb_qry_val_t args[64]; - int n; - pcb_qry_node_t *farg, *fname = node->data.children; - if (fname == NULL) - return -1; - farg = fname->next; - if ((fname->type != PCBQ_FNAME) || (fname->data.fnc == NULL)) - return -1; - memset(args, 0, sizeof(args)); - for(n = 0; (n < 64) && (farg != NULL); n++, farg = farg->next) - if (pcb_qry_eval(ctx, farg, &args[n]) < 0) - return -1; - - if (farg != NULL) { - Message(PCB_MSG_ERROR, "too many function arguments\n"); - return -1; - } - printf("CALL n=%d\n", n); - return fname->data.fnc(n, args, res); - } - - case PCBQ_DATA_COORD: PCB_QRY_RET_INT(res, node->data.crd); - case PCBQ_DATA_DOUBLE: PCB_QRY_RET_DBL(res, node->data.dbl); - case PCBQ_DATA_STRING: PCB_QRY_RET_STR(res, node->data.str); - case PCBQ_DATA_CONST: PCB_QRY_RET_INT(res, node->precomp.cnst); - case PCBQ_DATA_INVALID: PCB_QRY_RET_INV(res); - - /* not yet implemented: */ - case PCBQ_RULE: - - /* must not meet these while executing a node */ - case PCBQ_DATA_REGEX: - case PCBQ_nodetype_max: - case PCBQ_FIELD: - case PCBQ_RNAME: - case PCBQ_ITER_CTX: - return -1; - } - return -1; -} Index: 1.1.4/src_plugins/query/fields.sphash =================================================================== --- 1.1.4/src_plugins/query/fields.sphash (revision 10776) +++ 1.1.4/src_plugins/query/fields.sphash (nonexistent) @@ -1,38 +0,0 @@ -a -p -x -y -cx -cy -x1 -y1 -x2 -y2 -thickness -clearance -layer -element -width -height -name -visible -position -type -angle -start -delta -scale -rotation -string -points -hole -mask -number -description -value -ID -bbox -type -area -refdes -length Index: 1.1.4/src_plugins/query/query.h =================================================================== --- 1.1.4/src_plugins/query/query.h (revision 10776) +++ 1.1.4/src_plugins/query/query.h (nonexistent) @@ -1,152 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PCB_QUERY_H -#define PCB_QUERY_H - -#include "obj_any.h" -#include -#include -#include "fields_sphash.h" - -typedef struct pcb_qry_val_s pcb_qry_val_t; -typedef struct pcb_query_iter_s pcb_query_iter_t; - -typedef int (*pcb_qry_fnc_t)(int argc, pcb_qry_val_t *argv, pcb_qry_val_t *res); - -/* value of an expression */ -typedef enum pcb_qry_valtype_e { - PCBQ_VT_VOID, - PCBQ_VT_OBJ, - PCBQ_VT_LST, - PCBQ_VT_COORD, /* considered int */ - PCBQ_VT_DOUBLE, - PCBQ_VT_STRING -} pcb_qry_valtype_t; - -struct pcb_qry_val_s { - pcb_qry_valtype_t type; - union { - pcb_obj_t obj; - pcb_objlist_t lst; - Coord crd; - double dbl; - const char *str; - } data; -}; - -/* Script parsed into a tree */ -typedef struct pcb_qry_node_s pcb_qry_node_t; -typedef enum { - PCBQ_RULE, - PCBQ_RNAME, - PCBQ_EXPR_PROG, - PCBQ_EXPR, - PCBQ_ITER_CTX, - - PCBQ_OP_AND, - PCBQ_OP_OR, - PCBQ_OP_EQ, - PCBQ_OP_NEQ, - PCBQ_OP_GTEQ, - PCBQ_OP_LTEQ, - PCBQ_OP_GT, - PCBQ_OP_LT, - PCBQ_OP_ADD, - PCBQ_OP_SUB, - PCBQ_OP_MUL, - PCBQ_OP_DIV, - PCBQ_OP_MATCH, - - PCBQ_OP_NOT, - PCBQ_FIELD, - PCBQ_FIELD_OF, - PCBQ_LISTVAR, - PCBQ_VAR, - PCBQ_FNAME, - PCBQ_FCALL, - - PCBQ_DATA_COORD, /* leaf */ - PCBQ_DATA_DOUBLE, /* leaf */ - PCBQ_DATA_STRING, /* leaf */ - PCBQ_DATA_REGEX, /* leaf */ - PCBQ_DATA_CONST, /* leaf */ - PCBQ_DATA_INVALID, /* leaf */ - - PCBQ_nodetype_max -} pcb_qry_nodetype_t; - - -struct pcb_qry_node_s { - pcb_qry_nodetype_t type; - pcb_qry_node_t *next; /* sibling on this level of the tree (or NULL) */ - pcb_qry_node_t *parent; - union { /* field selection depends on ->type */ - Coord crd; - double dbl; - const char *str; - pcb_query_iter_t *iter_ctx; - pcb_qry_node_t *children; /* first child (NULL for a leaf node) */ - pcb_qry_fnc_t fnc; - } data; - union { /* field selection depends on ->type */ - query_fields_keys_t fld; /* field_sphash value from str */ - pcb_qry_val_t result; /* of pure functions and subtrees */ - re_se_t *regex; - long cnst; /* named constant */ - } precomp; -}; - - -pcb_qry_node_t *pcb_qry_n_alloc(pcb_qry_nodetype_t ntype); -pcb_qry_node_t *pcb_qry_n_insert(pcb_qry_node_t *parent, pcb_qry_node_t *ch); - -void pcb_qry_dump_tree(const char *prefix, pcb_qry_node_t *top); - -void pcb_qry_set_input(const char *script); - - -struct pcb_query_iter_s { - htsi_t names; /* name->index hash */ - int num_vars; - - const char **vn; /* pointers to the hash names so they can be indexed */ - pcb_qry_val_t *lst; - pcb_obj_t **it; /* iterator state for each variable - point into the correspoinding lst[] */ - - int all_idx; /* index of the "@" variable or -1 */ -}; - -pcb_query_iter_t *pcb_qry_iter_alloc(void); -int pcb_qry_iter_var(pcb_query_iter_t *it, const char *varname, int alloc); -void pcb_qry_iter_init(pcb_query_iter_t *it); - -pcb_query_iter_t *pcb_qry_find_iter(pcb_qry_node_t *node); - -char *pcb_query_sprint_val(pcb_qry_val_t *val); - -/* functions */ -int pcb_qry_fnc_reg(const char *name, pcb_qry_fnc_t fnc); -pcb_qry_fnc_t pcb_qry_fnc_lookup(const char *name); -const char *pcb_qry_fnc_name(pcb_qry_fnc_t fnc); - -#endif Index: 1.1.4/src_plugins/query/README =================================================================== --- 1.1.4/src_plugins/query/README (revision 10776) +++ 1.1.4/src_plugins/query/README (nonexistent) @@ -1,6 +0,0 @@ -pcb-rnd query language: execute expressions on objects and rules for the -programmed drc. - -#state: WIP -#default: disable -#implements: (feature) Index: 1.1.4/src_plugins/query/query_exec.h =================================================================== --- 1.1.4/src_plugins/query/query_exec.h (revision 10776) +++ 1.1.4/src_plugins/query/query_exec.h (nonexistent) @@ -1,80 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - execution */ - -#ifndef PCB_QUERY_EXEC_H -#define PCB_QUERY_EXEC_H - -typedef struct pcb_qry_exec_s { - pcb_qry_node_t *root; - pcb_qry_val_t all; /* a list of all objects */ - pcb_query_iter_t *iter; /* current iterator */ -} pcb_qry_exec_t; - -void pcb_qry_init(pcb_qry_exec_t *ctx, pcb_qry_node_t *root); -void pcb_qry_uninit(pcb_qry_exec_t *ctx); - -int pcb_qry_run(pcb_qry_node_t *prg, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_obj_t *current), void *user_ctx); - -int pcb_qry_is_true(pcb_qry_val_t *val); - -int pcb_qry_eval(pcb_qry_exec_t *ctx, pcb_qry_node_t *node, pcb_qry_val_t *res); - -int pcb_qry_it_reset(pcb_qry_exec_t *ctx, pcb_qry_node_t *node); - -/* Returns 1 if context iterator is valid, 0 if the loop is over */ -int pcb_qry_it_next(pcb_qry_exec_t *ctx); - - - -/* Helper macros: load value o and return 0 */ -#define PCB_QRY_RET_INT(o, value) \ -do { \ - o->type = PCBQ_VT_COORD; \ - o->data.crd = value; \ - return 0; \ -} while(0) - -#define PCB_QRY_RET_DBL(o, value) \ -do { \ - o->type = PCBQ_VT_DOUBLE; \ - o->data.dbl = value; \ - return 0; \ -} while(0) - -#define PCB_QRY_RET_STR(o, value) \ -do { \ - o->type = PCBQ_VT_STRING; \ - o->data.str = value; \ - return 0; \ -} while(0) - -/* The case when the operation couldn't be carried out, sort of NaN */ -#define PCB_QRY_RET_INV(o) \ -do { \ - o->type = PCBQ_VT_VOID; \ - return 0; \ -} while(0) - - -#endif Index: 1.1.4/src_plugins/query/query_l.c =================================================================== --- 1.1.4/src_plugins/query/query_l.c (revision 10776) +++ 1.1.4/src_plugins/query/query_l.c (nonexistent) @@ -1,2248 +0,0 @@ -#line 2 "query_l.c" - -#line 4 "query_l.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define yy_create_buffer qry__create_buffer -#define yy_delete_buffer qry__delete_buffer -#define yy_flex_debug qry__flex_debug -#define yy_init_buffer qry__init_buffer -#define yy_flush_buffer qry__flush_buffer -#define yy_load_buffer_state qry__load_buffer_state -#define yy_switch_to_buffer qry__switch_to_buffer -#define yyin qry_in -#define yyleng qry_leng -#define yylex qry_lex -#define yylineno qry_lineno -#define yyout qry_out -#define yyrestart qry_restart -#define yytext qry_text -#define yywrap qry_wrap -#define yyalloc qry_alloc -#define yyrealloc qry_realloc -#define yyfree qry_free - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE qry_restart(qry_in ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int qry_leng; - -extern FILE *qry_in, *qry_out; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up qry_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up qry_text again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via qry_restart()), so that the user can continue scanning by - * just pointing qry_in at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when qry_text is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int qry_leng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow qry_wrap()'s to do buffer switches - * instead of setting up a fresh qry_in. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void qry_restart (FILE *input_file ); -void qry__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE qry__create_buffer (FILE *file,int size ); -void qry__delete_buffer (YY_BUFFER_STATE b ); -void qry__flush_buffer (YY_BUFFER_STATE b ); -void qry_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void qry_pop_buffer_state (void ); - -static void qry_ensure_buffer_stack (void ); -static void qry__load_buffer_state (void ); -static void qry__init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER qry__flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE qry__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE qry__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE qry__scan_bytes (yyconst char *bytes,int len ); - -void *qry_alloc (yy_size_t ); -void *qry_realloc (void *,yy_size_t ); -void qry_free (void * ); - -#define yy_new_buffer qry__create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - qry_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - qry__create_buffer(qry_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - qry_ensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - qry__create_buffer(qry_in,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *qry_in = (FILE *) 0, *qry_out = (FILE *) 0; - -typedef int yy_state_type; - -extern int qry_lineno; - -int qry_lineno = 1; - -extern char *qry_text; -#define yytext_ptr qry_text - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up qry_text. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - qry_leng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 62 -#define YY_END_OF_BUFFER 63 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[195] = - { 0, - 0, 0, 63, 62, 61, 60, 59, 62, 62, 62, - 59, 59, 55, 59, 62, 59, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 43, 58, 58, - 58, 58, 62, 52, 0, 1, 50, 0, 2, 56, - 57, 55, 54, 51, 53, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 32, 58, - 27, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 9, 58, 45, 58, 58, 58, 58, 42, - 46, 8, 58, 44, 49, 57, 14, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 20, - 31, 58, 16, 58, 17, 58, 58, 15, 58, 58, - 33, 58, 18, 58, 28, 58, 58, 58, 3, 58, - 47, 58, 58, 58, 23, 58, 58, 58, 58, 58, - 58, 58, 11, 39, 58, 58, 58, 58, 38, 12, - 25, 58, 58, 48, 58, 6, 5, 58, 58, 58, - 22, 24, 29, 58, 58, 21, 58, 40, 10, 58, - 58, 58, 58, 34, 37, 58, 35, 58, 58, 58, - 58, 4, 58, 19, 58, 58, 41, 13, 26, 7, - 36, 58, 30, 0 - - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 5, 1, 1, 1, 6, 7, 8, - 8, 8, 8, 8, 8, 9, 8, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 1, 3, 11, - 12, 13, 1, 8, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 21, 23, 24, 25, 26, 27, 28, - 21, 29, 30, 31, 32, 33, 21, 34, 35, 21, - 1, 1, 1, 1, 21, 1, 36, 21, 37, 38, - - 39, 21, 21, 40, 41, 21, 21, 42, 43, 44, - 21, 45, 21, 46, 47, 48, 49, 50, 21, 21, - 21, 21, 1, 51, 1, 8, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[52] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1 - } ; - -static yyconst flex_int16_t yy_base[198] = - { 0, - 0, 0, 210, 211, 211, 211, 197, 203, 201, 199, - 211, 195, 43, 192, 191, 190, 172, 173, 172, 0, - 40, 184, 171, 41, 182, 38, 40, 46, 181, 172, - 40, 171, 174, 48, 148, 146, 35, 34, 146, 179, - 138, 143, 134, 211, 179, 211, 211, 176, 211, 172, - 171, 52, 211, 211, 211, 0, 164, 148, 150, 148, - 60, 158, 151, 48, 139, 147, 142, 140, 0, 151, - 0, 138, 53, 142, 62, 136, 142, 131, 136, 131, - 66, 132, 211, 114, 0, 48, 112, 112, 116, 0, - 0, 211, 115, 0, 211, 146, 0, 124, 126, 137, - - 127, 125, 116, 119, 130, 125, 128, 127, 121, 0, - 0, 119, 0, 111, 0, 115, 105, 0, 116, 107, - 0, 119, 0, 114, 0, 96, 94, 97, 0, 84, - 0, 92, 103, 111, 0, 110, 109, 95, 107, 95, - 93, 93, 0, 0, 99, 102, 88, 98, 0, 0, - 0, 102, 70, 0, 73, 0, 0, 89, 84, 86, - 0, 0, 0, 85, 88, 0, 83, 0, 0, 81, - 83, 58, 64, 0, 0, 73, 89, 82, 76, 67, - 74, 0, 53, 0, 66, 65, 0, 0, 0, 0, - 0, 70, 0, 211, 98, 100, 85 - - } ; - -static yyconst flex_int16_t yy_def[198] = - { 0, - 194, 1, 194, 194, 194, 194, 194, 195, 194, 196, - 194, 194, 194, 194, 194, 194, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 194, 194, 195, 194, 194, 196, 194, 194, - 194, 194, 194, 194, 194, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 194, 197, 197, 197, 197, 197, 197, 197, - 197, 194, 197, 197, 194, 194, 197, 197, 197, 197, - - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 0, 194, 194, 194 - - } ; - -static yyconst flex_int16_t yy_nxt[263] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 20, - 20, 23, 20, 24, 25, 26, 27, 28, 29, 30, - 31, 20, 32, 20, 33, 34, 35, 20, 20, 20, - 36, 37, 38, 39, 40, 41, 20, 20, 42, 20, - 43, 51, 52, 60, 65, 68, 83, 78, 70, 73, - 51, 52, 66, 61, 69, 71, 79, 74, 80, 113, - 62, 72, 75, 87, 89, 88, 90, 101, 105, 123, - 106, 102, 114, 116, 127, 117, 56, 193, 192, 191, - 190, 189, 188, 187, 84, 124, 186, 128, 45, 45, - - 48, 48, 185, 184, 183, 182, 181, 180, 179, 178, - 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, - 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, - 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, - 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, - 137, 136, 135, 134, 133, 96, 132, 131, 130, 129, - 126, 125, 122, 121, 120, 119, 118, 115, 112, 111, - 110, 109, 108, 107, 104, 103, 100, 99, 98, 97, - 96, 50, 49, 46, 95, 94, 93, 92, 91, 86, - 85, 82, 81, 77, 76, 67, 64, 63, 59, 58, - - 57, 55, 54, 53, 50, 49, 47, 46, 44, 194, - 3, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194 - } ; - -static yyconst flex_int16_t yy_chk[263] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 13, 13, 21, 24, 26, 34, 31, 27, 28, - 52, 52, 24, 21, 26, 27, 31, 28, 31, 73, - 21, 27, 28, 37, 38, 37, 38, 61, 64, 81, - 64, 61, 73, 75, 86, 75, 197, 192, 186, 185, - 183, 181, 180, 179, 34, 81, 178, 86, 195, 195, - - 196, 196, 177, 176, 173, 172, 171, 170, 167, 165, - 164, 160, 159, 158, 155, 153, 152, 148, 147, 146, - 145, 142, 141, 140, 139, 138, 137, 136, 134, 133, - 132, 130, 128, 127, 126, 124, 122, 120, 119, 117, - 116, 114, 112, 109, 108, 107, 106, 105, 104, 103, - 102, 101, 100, 99, 98, 96, 93, 89, 88, 87, - 84, 82, 80, 79, 78, 77, 76, 74, 72, 70, - 68, 67, 66, 65, 63, 62, 60, 59, 58, 57, - 51, 50, 48, 45, 43, 42, 41, 40, 39, 36, - 35, 33, 32, 30, 29, 25, 23, 22, 19, 18, - - 17, 16, 15, 14, 12, 10, 9, 8, 7, 3, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int qry__flex_debug; -int qry__flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *qry_text; -#line 1 "query_l.l" -#line 2 "query_l.l" -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - compiler: lexical analyzer */ - -#include "global.h" -#include "unit.h" -#include "query.h" -#include "query_y.h" -#include "compat_misc.h" -#include "layer.h" - -static const char *pcb_qry_program, *pcb_qry_program_ptr; -static int qry_yy_input(char *buf, int buflen); -static pcb_qry_node_t *make_constant(char *str, long val); -#define YY_INPUT(buf, res, buflen) (res = qry_yy_input(buf, buflen)) -#line 638 "query_l.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int qry_lex_destroy (void ); - -int qry_get_debug (void ); - -void qry_set_debug (int debug_flag ); - -YY_EXTRA_TYPE qry_get_extra (void ); - -void qry_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *qry_get_in (void ); - -void qry_set_in (FILE * in_str ); - -FILE *qry_get_out (void ); - -void qry_set_out (FILE * out_str ); - -int qry_get_leng (void ); - -char *qry_get_text (void ); - -int qry_get_lineno (void ); - -void qry_set_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int qry_wrap (void ); -#else -extern int qry_wrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( qry_text, qry_leng, 1, qry_out )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( qry_in )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( qry_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, qry_in))==0 && ferror(qry_in)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(qry_in); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int qry_lex (void); - -#define YY_DECL int qry_lex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after qry_text and qry_leng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 41 "query_l.l" - -#line 827 "query_l.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! qry_in ) - qry_in = stdin; - - if ( ! qry_out ) - qry_out = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - qry_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - qry__create_buffer(qry_in,YY_BUF_SIZE ); - } - - qry__load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of qry_text. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 195 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 211 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -/* rule 1 can match eol */ -YY_RULE_SETUP -#line 42 "query_l.l" -{ qry_lval.s = pcb_strdup(qry_text+1); qry_lval.s[strlen(qry_lval.s)-1] = '\0'; return T_QSTR; /*"*/ } - YY_BREAK -case 2: -/* rule 2 can match eol */ -YY_RULE_SETUP -#line 43 "query_l.l" -{ qry_lval.s = pcb_strdup(qry_text+1); qry_lval.s[strlen(qry_lval.s)-1] = '\0'; return T_QSTR; } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 45 "query_l.l" -{ return T_LET; } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 46 "query_l.l" -{ return T_ASSERT; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 47 "query_l.l" -{ return T_RULE; } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 48 "query_l.l" -{ return T_LIST; } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 49 "query_l.l" -{ return T_INVALID; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 50 "query_l.l" -{ return T_FLD_P; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 51 "query_l.l" -{ return T_FLD_A; } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 53 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_POINT); return T_CONST; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 54 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_LINE); return T_CONST; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 55 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_TEXT); return T_CONST; } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 56 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_POLYGON); return T_CONST; } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 57 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_ARC); return T_CONST; } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 58 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_RAT); return T_CONST; } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 59 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_PAD); return T_CONST; } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 60 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_PIN); return T_CONST; } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 61 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_VIA); return T_CONST; } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 62 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_ELEMENT); return T_CONST; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 63 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_NET); return T_CONST; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 64 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_LAYER); return T_CONST; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 65 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_ELINE); return T_CONST; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 66 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_EARC); return T_CONST; } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 67 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_OBJ_ETEXT); return T_CONST; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 69 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 1); return T_CONST; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 70 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 1); return T_CONST; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 71 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 1); return T_CONST; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 72 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 1); return T_CONST; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 74 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 0); return T_CONST; } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 75 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 0); return T_CONST; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 76 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 0); return T_CONST; } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 77 "query_l.l" -{ qry_lval.n = make_constant(qry_text, 0); return T_CONST; } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 79 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_TOP); return T_CONST; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 80 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_BOTTOM); return T_CONST; } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 81 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_INTERN); return T_CONST; } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 82 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_INTERN); return T_CONST; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 83 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_COPPER); return T_CONST; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 84 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_SILK); return T_CONST; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 85 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_MASK); return T_CONST; } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 86 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_PASTE); return T_CONST; } - YY_BREAK -case 41: -YY_RULE_SETUP -#line 87 "query_l.l" -{ qry_lval.n = make_constant(qry_text, PCB_LYT_OUTLINE); return T_CONST; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 91 "query_l.l" -{ qry_lval.u = get_unit_struct_by_allow(ALLOW_MM); return T_UNIT; } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 92 "query_l.l" -{ qry_lval.u = get_unit_struct_by_allow(ALLOW_M); return T_UNIT; } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 93 "query_l.l" -{ qry_lval.u = get_unit_struct_by_allow(ALLOW_UM); return T_UNIT; } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 94 "query_l.l" -{ qry_lval.u = get_unit_struct_by_allow(ALLOW_CM); return T_UNIT; } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 95 "query_l.l" -{ qry_lval.u = get_unit_struct_by_allow(ALLOW_NM); return T_UNIT; } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 96 "query_l.l" -{ qry_lval.u = get_unit_struct_by_allow(ALLOW_MIL); return T_UNIT; } - YY_BREAK -case 48: -YY_RULE_SETUP -#line 97 "query_l.l" -{ qry_lval.u = get_unit_struct_by_allow(ALLOW_IN); return T_UNIT; } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 99 "query_l.l" -{ return T_OR; } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 100 "query_l.l" -{ return T_AND; } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 101 "query_l.l" -{ return T_EQ; } - YY_BREAK -case 52: -YY_RULE_SETUP -#line 102 "query_l.l" -{ return T_NEQ; } - YY_BREAK -case 53: -YY_RULE_SETUP -#line 103 "query_l.l" -{ return T_GTEQ; } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 104 "query_l.l" -{ return T_LTEQ; } - YY_BREAK -case 55: -YY_RULE_SETUP -#line 106 "query_l.l" -{ qry_lval.c = strtol(qry_text, NULL, 10); return T_INT; } - YY_BREAK -case 56: -YY_RULE_SETUP -#line 107 "query_l.l" -{ qry_lval.d = strtod(qry_text, NULL); return T_DBL; } - YY_BREAK -case 57: -YY_RULE_SETUP -#line 108 "query_l.l" -{ qry_lval.d = strtod(qry_text, NULL); return T_DBL; } - YY_BREAK -case 58: -YY_RULE_SETUP -#line 109 "query_l.l" -{ qry_lval.s = pcb_strdup(qry_text); return T_STR; } - YY_BREAK -case 59: -YY_RULE_SETUP -#line 111 "query_l.l" -{ return *qry_text; } - YY_BREAK -case 60: -/* rule 60 can match eol */ -YY_RULE_SETUP -#line 113 "query_l.l" -{ return T_NL; } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 114 "query_l.l" -{ continue; } - YY_BREAK -case 62: -YY_RULE_SETUP -#line 116 "query_l.l" -ECHO; - YY_BREAK -#line 1223 "query_l.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed qry_in at a new source and called - * qry_lex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = qry_in; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( qry_wrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * qry_text, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of qry_lex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - qry_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - qry_restart(qry_in ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) qry_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 195 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 195 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 194); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up qry_text */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - qry_restart(qry_in ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( qry_wrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve qry_text */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void qry_restart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - qry_ensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - qry__create_buffer(qry_in,YY_BUF_SIZE ); - } - - qry__init_buffer(YY_CURRENT_BUFFER,input_file ); - qry__load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void qry__switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * qry_pop_buffer_state(); - * qry_push_buffer_state(new_buffer); - */ - qry_ensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - qry__load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (qry_wrap()) processing, but the only time this flag - * is looked at is after qry_wrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void qry__load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - qry_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE qry__create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) qry_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in qry__create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) qry_alloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in qry__create_buffer()" ); - - b->yy_is_our_buffer = 1; - - qry__init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with qry__create_buffer() - * - */ - void qry__delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - qry_free((void *) b->yy_ch_buf ); - - qry_free((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a qry_restart() or at EOF. - */ - static void qry__init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - qry__flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then qry__init_buffer was _probably_ - * called from qry_restart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void qry__flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - qry__load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void qry_push_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - qry_ensure_buffer_stack(); - - /* This block is copied from qry__switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from qry__switch_to_buffer. */ - qry__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void qry_pop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - qry__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - qry__load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void qry_ensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)qry_alloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in qry_ensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)qry_realloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in qry_ensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE qry__scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) qry_alloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in qry__scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - qry__switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to qry_lex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * qry__scan_bytes() instead. - */ -YY_BUFFER_STATE qry__scan_string (yyconst char * yystr ) -{ - - return qry__scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to qry_lex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE qry__scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) qry_alloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in qry__scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = qry__scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in qry__scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up qry_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - qry_text[qry_leng] = (yy_hold_char); \ - (yy_c_buf_p) = qry_text + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - qry_leng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int qry_get_lineno (void) -{ - - return qry_lineno; -} - -/** Get the input stream. - * - */ -FILE *qry_get_in (void) -{ - return qry_in; -} - -/** Get the output stream. - * - */ -FILE *qry_get_out (void) -{ - return qry_out; -} - -/** Get the length of the current token. - * - */ -int qry_get_leng (void) -{ - return qry_leng; -} - -/** Get the current token. - * - */ - -char *qry_get_text (void) -{ - return qry_text; -} - -/** Set the current line number. - * @param line_number - * - */ -void qry_set_lineno (int line_number ) -{ - - qry_lineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see qry__switch_to_buffer - */ -void qry_set_in (FILE * in_str ) -{ - qry_in = in_str ; -} - -void qry_set_out (FILE * out_str ) -{ - qry_out = out_str ; -} - -int qry_get_debug (void) -{ - return qry__flex_debug; -} - -void qry_set_debug (int bdebug ) -{ - qry__flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from qry_lex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - qry_in = stdin; - qry_out = stdout; -#else - qry_in = (FILE *) 0; - qry_out = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * qry_lex_init() - */ - return 0; -} - -/* qry_lex_destroy is for both reentrant and non-reentrant scanners. */ -int qry_lex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - qry__delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - qry_pop_buffer_state(); - } - - /* Destroy the stack itself. */ - qry_free((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * qry_lex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *qry_alloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *qry_realloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void qry_free (void * ptr ) -{ - free( (char *) ptr ); /* see qry_realloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 116 "query_l.l" - - - -static int qry_yy_input(char *buf, int buflen) -{ - int len; - for(len = 0; (*pcb_qry_program_ptr != '\0') && (buflen > 0); len++,buflen--) { -/* printf("IN: '%c'\n", *pcb_qry_program_ptr);*/ - *buf = *pcb_qry_program_ptr; - buf++; - pcb_qry_program_ptr++; - } - return len; -} - -void pcb_qry_set_input(const char *script) -{ - pcb_qry_program = pcb_qry_program_ptr = script; -} - -static pcb_qry_node_t *make_constant(char *str, long val) -{ - pcb_qry_node_t *res = pcb_qry_n_alloc(PCBQ_DATA_CONST); - res->data.str = pcb_strdup(str); - res->precomp.cnst = val; - return res; -} - Index: 1.1.4/src_plugins/query/query_y.y =================================================================== --- 1.1.4/src_plugins/query/query_y.y (revision 10776) +++ 1.1.4/src_plugins/query/query_y.y (nonexistent) @@ -1,275 +0,0 @@ -%{ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - compiler: grammar */ - -#include -#include "global.h" -#include "unit.h" -#include "query.h" -#include "query_l.h" -#include "compat_misc.h" -#include "fields_sphash.h" - -#define UNIT_CONV(dst, negative, val, unit) \ -do { \ - dst = val; \ - if (negative) \ - dst = -dst; \ - if (unit != NULL) { \ - if (unit->family == IMPERIAL) \ - dst = PCB_MIL_TO_COORD(dst); \ - else if (unit->family == METRIC) \ - dst = PCB_MM_TO_COORD(dst); \ - dst /= unit->scale_factor; \ - } \ -} while(0) - -#define BINOP(dst, op1, operator, op2) \ -do { \ - assert(op2->next == NULL); \ - assert(op2->next == NULL); \ - dst = pcb_qry_n_alloc(operator); \ - pcb_qry_n_insert(dst, op2); \ - pcb_qry_n_insert(dst, op1); \ -} while(0) - -#define UNOP(dst, operator, op) \ -do { \ - assert(op->next == NULL); \ - dst = pcb_qry_n_alloc(operator); \ - pcb_qry_n_insert(dst, op); \ -} while(0) - -static pcb_query_iter_t *iter_ctx; - -static char *attrib_prepend_free(char *orig, char *prep, char sep) -{ - int l1 = strlen(orig), l2 = strlen(prep); - char *res = malloc(l1+l2+2); - memcpy(res, prep, l2); - res[l2] = sep; - memcpy(res+l2+1, orig, l1+1); - free(orig); - free(prep); - return res; -} - -static pcb_qry_node_t *make_regex_free(char *str) -{ - pcb_qry_node_t *res = pcb_qry_n_alloc(PCBQ_DATA_REGEX); - res->data.str = str; - res->precomp.regex = re_se_comp(str); - if (res->precomp.regex == NULL) - yyerror(NULL, "Invalid regex\n"); - return res; -} - - -%} - -%name-prefix "qry_" -%error-verbose -%parse-param {pcb_qry_node_t **prg_out} - -%union { - char *s; - Coord c; - double d; - const Unit *u; - pcb_qry_node_t *n; -} - -%token T_LET T_ASSERT T_RULE T_LIST T_INVALID T_FLD_P T_FLD_A -%token T_OR T_AND T_EQ T_NEQ T_GTEQ T_LTEQ -%token T_NL -%token T_UNIT -%token T_STR T_QSTR -%token T_INT -%token T_DBL -%token T_CONST - -/* the usual binary operators */ -%left T_OR -%left T_AND -%left T_EQ T_NEQ -%left '<' '>' T_GTEQ T_LTEQ -%left '+' '-' -%left '*' '/' -%left '.' - -/* Unary operators */ -%right '!' - -%left '(' - -%type number fields attribs var fname fcall fargs words string_literal -%type expr exprs program_expr program_rules rule -%type maybe_unit - -%% - -program: - program_rules { *prg_out = $1; } - | program_expr { *prg_out = $1; } - ; - -/* The program is a single expression - useful for search */ -program_expr: - { iter_ctx = pcb_qry_iter_alloc(); } - expr { - $$ = pcb_qry_n_alloc(PCBQ_EXPR_PROG); - $$->data.children = pcb_qry_n_alloc(PCBQ_ITER_CTX); - $$->data.children->parent = $$; - $$->data.children->data.iter_ctx = iter_ctx; - $$->data.children->next = $2; - $2->parent = $$; - } - ; - -/* The program is a collection of rules - useful for the DRC */ -program_rules: - /* empty */ { $$ = NULL; } - | rule program_rules { $$ = $1; $1->next = $2; } - ; - -rule: - T_RULE words T_NL exprs { - $$ = pcb_qry_n_alloc(PCBQ_RULE); - $$->data.children = $2; - $2->parent = $$; - $$->data.children->next = pcb_qry_n_alloc(PCBQ_ITER_CTX); - $$->data.children->next->data.iter_ctx = iter_ctx; - $$->data.children->next->next = $4; - $4->parent = $$; - } - ; - -exprs: - /* empty */ { $$ = NULL; } - | exprs expr T_NL { $$ = $1; $1->next = $2; } - ; - -expr: - fcall { $$ = $1; } - | number { $$ = $1; } - | string_literal { $$ = $1; } - | T_INVALID { $$ = pcb_qry_n_alloc(PCBQ_DATA_INVALID); } - | '!' expr { UNOP($$, PCBQ_OP_NOT, $2); } - | '(' expr ')' { $$ = $2; } - | expr T_AND expr { BINOP($$, $1, PCBQ_OP_AND, $3); } - | expr T_OR expr { BINOP($$, $1, PCBQ_OP_OR, $3); } - | expr T_EQ expr { BINOP($$, $1, PCBQ_OP_EQ, $3); } - | expr T_NEQ expr { BINOP($$, $1, PCBQ_OP_NEQ, $3); } - | expr T_GTEQ expr { BINOP($$, $1, PCBQ_OP_GTEQ, $3); } - | expr T_LTEQ expr { BINOP($$, $1, PCBQ_OP_LTEQ, $3); } - | expr '>' expr { BINOP($$, $1, PCBQ_OP_GT, $3); } - | expr '<' expr { BINOP($$, $1, PCBQ_OP_LT, $3); } - | expr '+' expr { BINOP($$, $1, PCBQ_OP_ADD, $3); } - | expr '-' expr { BINOP($$, $1, PCBQ_OP_SUB, $3); } - | expr '*' expr { BINOP($$, $1, PCBQ_OP_MUL, $3); } - | expr '/' expr { BINOP($$, $1, PCBQ_OP_DIV, $3); } - | expr '~' T_STR { BINOP($$, $1, PCBQ_OP_MATCH, make_regex_free($3)); } - | expr '~' T_QSTR { BINOP($$, $1, PCBQ_OP_MATCH, make_regex_free($3)); } - | T_CONST { $$ = $1; } - | var { $$ = $1; } - | var '.' fields { - pcb_qry_node_t *n; - $$ = pcb_qry_n_alloc(PCBQ_FIELD_OF); - $$->data.children = $1; - $1->next = $3; - $1->parent = $$; - for(n = $3; n != NULL; n = n->next) - n->parent = $$; - } - ; - -number: - T_INT maybe_unit { $$ = pcb_qry_n_alloc(PCBQ_DATA_COORD); UNIT_CONV($$->data.crd, 0, $1, $2); } - | T_DBL maybe_unit { $$ = pcb_qry_n_alloc(PCBQ_DATA_DOUBLE); UNIT_CONV($$->data.dbl, 0, $1, $2); } - | '-' T_INT maybe_unit { $$ = pcb_qry_n_alloc(PCBQ_DATA_COORD); UNIT_CONV($$->data.crd, 1, $2, $3); } - | '-' T_DBL maybe_unit { $$ = pcb_qry_n_alloc(PCBQ_DATA_DOUBLE); UNIT_CONV($$->data.dbl, 1, $2, $3); } - ; - -string_literal: - T_QSTR { $$ = pcb_qry_n_alloc(PCBQ_DATA_STRING); $$->data.str = $1; } - ; - -maybe_unit: - /* empty */ { $$ = NULL; } - | T_UNIT { $$ = $1; } - ; - -fields: - T_STR { $$ = pcb_qry_n_alloc(PCBQ_FIELD); $$->data.str = $1; $$->precomp.fld = query_fields_sphash($1); } - | T_STR '.' fields { $$ = pcb_qry_n_alloc(PCBQ_FIELD); $$->data.str = $1; $$->precomp.fld = query_fields_sphash($1); $$->next = $3; } - | T_FLD_P fields { $$ = $2; /* just ignore .p. */ } - | T_FLD_A attribs { $$ = pcb_qry_n_alloc(PCBQ_FIELD); $$->data.str = pcb_strdup("a"); $$->precomp.fld = query_fields_sphash("a"); $$->next = $2; } - ; - -attribs: - T_STR { $$ = pcb_qry_n_alloc(PCBQ_FIELD); $$->data.str = $1; } - | T_STR '.' attribs { $$ = pcb_qry_n_alloc(PCBQ_FIELD); $$->data.str = attrib_prepend_free($3->data.str, $1, '.'); } - | T_QSTR { $$ = pcb_qry_n_alloc(PCBQ_FIELD); $$->data.str = $1; } - ; - -var: - T_STR { $$ = pcb_qry_n_alloc(PCBQ_VAR); $$->data.crd = pcb_qry_iter_var(iter_ctx, $1, 1); free($1); } - | T_LIST '(' '@' ')' { $$ = pcb_qry_n_alloc(PCBQ_LISTVAR); $$->data.str = pcb_strdup("@"); } - | '@' { $$ = pcb_qry_n_alloc(PCBQ_VAR); $$->data.crd = pcb_qry_iter_var(iter_ctx, "@", 1); } - ; - -fcall: - fname '(' fargs ')' { $$ = pcb_qry_n_alloc(PCBQ_FCALL); $$->data.children = $1; $$->data.children->next = $3; $1->parent = $3->parent = $$; } - | fname '(' ')' { $$ = pcb_qry_n_alloc(PCBQ_FCALL); $$->data.children = $1; $1->parent = $$; } - ; - -fname: - T_STR { - $$ = pcb_qry_n_alloc(PCBQ_FNAME); - $$->data.fnc = pcb_qry_fnc_lookup($1); - if ($$->data.fnc == NULL) { - yyerror("Unknown function"); - free($1); - return -1; - } - free($1); - } - ; - - -fargs: - expr { $$ = $1; } - | expr ',' fargs { $$ = $1; $$->next = $3; } - ; - -words: - /* empty */ { $$ = pcb_qry_n_alloc(PCBQ_RNAME); $$->data.str = (const char *)pcb_strdup(""); } - | T_STR words { - int l1 = strlen($2->data.str), l2 = strlen($1); - - $2->data.str = (const char *)realloc((void *)$2->data.str, l1+l2+2); - memcpy((char *)$2->data.str+l1, $1, l2+1); - free($1); - } - ; Index: 1.1.4/src_plugins/query/query_l.h =================================================================== --- 1.1.4/src_plugins/query/query_l.h (revision 10776) +++ 1.1.4/src_plugins/query/query_l.h (nonexistent) @@ -1,332 +0,0 @@ -#ifndef qry_HEADER_H -#define qry_HEADER_H 1 -#define qry_IN_HEADER 1 - -#line 6 "query_l.h" - -#line 8 "query_l.h" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int qry_leng; - -extern FILE *qry_in, *qry_out; - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -void qry_restart (FILE *input_file ); -void qry__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE qry__create_buffer (FILE *file,int size ); -void qry__delete_buffer (YY_BUFFER_STATE b ); -void qry__flush_buffer (YY_BUFFER_STATE b ); -void qry_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void qry_pop_buffer_state (void ); - -YY_BUFFER_STATE qry__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE qry__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE qry__scan_bytes (yyconst char *bytes,int len ); - -void *qry_alloc (yy_size_t ); -void *qry_realloc (void *,yy_size_t ); -void qry_free (void * ); - -/* Begin user sect3 */ - -extern int qry_lineno; - -extern char *qry_text; -#define yytext_ptr qry_text - -#ifdef YY_HEADER_EXPORT_START_CONDITIONS -#define INITIAL 0 - -#endif - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int qry_lex_destroy (void ); - -int qry_get_debug (void ); - -void qry_set_debug (int debug_flag ); - -YY_EXTRA_TYPE qry_get_extra (void ); - -void qry_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *qry_get_in (void ); - -void qry_set_in (FILE * in_str ); - -FILE *qry_get_out (void ); - -void qry_set_out (FILE * out_str ); - -int qry_get_leng (void ); - -char *qry_get_text (void ); - -int qry_get_lineno (void ); - -void qry_set_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int qry_wrap (void ); -#else -extern int qry_wrap (void ); -#endif -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int qry_lex (void); - -#define YY_DECL int qry_lex (void) -#endif /* !YY_DECL */ - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif - -#line 116 "query_l.l" - - -#line 331 "query_l.h" -#undef qry_IN_HEADER -#endif /* qry_HEADER_H */ Index: 1.1.4/src_plugins/query/query_access.c =================================================================== --- 1.1.4/src_plugins/query/query_access.c (revision 10776) +++ 1.1.4/src_plugins/query/query_access.c (nonexistent) @@ -1,738 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - access to / extract core data */ - -#include -#include "global.h" -#include "data.h" -#include "query_access.h" -#include "query_exec.h" -#include "misc.h" -#include "layer.h" -#include "fields_sphash.h" - -#define APPEND(_ctx_, _type_, _obj_, _parenttype_, _parent_) \ -do { \ - pcb_objlist_t *lst = (pcb_objlist_t *)_ctx_; \ - pcb_obj_t *o = malloc(sizeof(pcb_obj_t)); \ - o->type = _type_; \ - o->data.any = _obj_; \ - o->parent_type = _parenttype_; \ - o->parent.any = _parent_; \ - pcb_objlist_append(lst, o); \ -} while(0) - -static int list_layer_cb(void *ctx, PCBType *pcb, LayerType *layer, int enter) -{ - if (enter) - APPEND(ctx, PCB_OBJ_LAYER, layer, PCB_PARENT_DATA, pcb->Data); - return 0; -} - -static void list_line_cb(void *ctx, PCBType *pcb, LayerType *layer, LineType *line) -{ - APPEND(ctx, PCB_OBJ_LINE, line, PCB_PARENT_LAYER, layer); -} - -static void list_arc_cb(void *ctx, PCBType *pcb, LayerType *layer, ArcType *arc) -{ - APPEND(ctx, PCB_OBJ_ARC, arc, PCB_PARENT_LAYER, layer); -} - -static void list_text_cb(void *ctx, PCBType *pcb, LayerType *layer, TextType *text) -{ - APPEND(ctx, PCB_OBJ_TEXT, text, PCB_PARENT_LAYER, layer); -} - -static void list_poly_cb(void *ctx, PCBType *pcb, LayerType *layer, PolygonType *poly) -{ - APPEND(ctx, PCB_OBJ_POLYGON, poly, PCB_PARENT_LAYER, layer); -} - -static int list_element_cb(void *ctx, PCBType *pcb, ElementType *element, int enter) -{ - if (enter) - APPEND(ctx, PCB_OBJ_ELEMENT, element, PCB_PARENT_DATA, pcb->Data); - return 0; -} - -static void list_eline_cb(void *ctx, PCBType *pcb, ElementType *element, LineType *line) -{ - APPEND(ctx, PCB_OBJ_ELINE, line, PCB_PARENT_ELEMENT, element); -} - -static void list_earc_cb(void *ctx, PCBType *pcb, ElementType *element, ArcType *arc) -{ - APPEND(ctx, PCB_OBJ_EARC, arc, PCB_PARENT_ELEMENT, element); -} - -static void list_etext_cb(void *ctx, PCBType *pcb, ElementType *element, TextType *text) -{ - APPEND(ctx, PCB_OBJ_ETEXT, text, PCB_PARENT_ELEMENT, element); -} - -static void list_epin_cb(void *ctx, PCBType *pcb, ElementType *element, PinType *pin) -{ - APPEND(ctx, PCB_OBJ_PIN, pin, PCB_PARENT_ELEMENT, element); -} - -static void list_epad_cb(void *ctx, PCBType *pcb, ElementType *element, PadType *pad) -{ - APPEND(ctx, PCB_OBJ_PAD, pad, PCB_PARENT_ELEMENT, element); -} - -static void list_via_cb(void *ctx, PCBType *pcb, PinType *via) -{ - APPEND(ctx, PCB_OBJ_VIA, via, PCB_PARENT_DATA, pcb->Data); -} - -void pcb_qry_list_all(pcb_qry_val_t *lst, pcb_objtype_t mask) -{ - assert(lst->type == PCBQ_VT_LST); - pcb_loop_all(&lst->data.lst, - (mask & PCB_OBJ_LAYER) ? list_layer_cb : NULL, - (mask & PCB_OBJ_LINE) ? list_line_cb : NULL, - (mask & PCB_OBJ_ARC) ? list_arc_cb : NULL, - (mask & PCB_OBJ_TEXT) ? list_text_cb : NULL, - (mask & PCB_OBJ_POLYGON) ? list_poly_cb : NULL, - (mask & PCB_OBJ_ELEMENT) ? list_element_cb : NULL, - (mask & PCB_OBJ_ELINE) ? list_eline_cb : NULL, - (mask & PCB_OBJ_EARC) ? list_earc_cb : NULL, - (mask & PCB_OBJ_ETEXT) ? list_etext_cb : NULL, - (mask & PCB_OBJ_PIN) ? list_epin_cb : NULL, - (mask & PCB_OBJ_PAD) ? list_epad_cb : NULL, - (mask & PCB_OBJ_VIA) ? list_via_cb : NULL - ); -} - -void pcb_qry_list_free(pcb_qry_val_t *lst_) -{ - pcb_objlist_t *lst = &lst_->data.lst; - - assert(lst_->type == PCBQ_VT_LST); - - for(;;) { - pcb_obj_t *n = pcb_objlist_first(lst); - if (n == NULL) - break; - pcb_objlist_remove(n); - free(n); - } -} - -int pcb_qry_list_cmp(pcb_qry_val_t *lst1, pcb_qry_val_t *lst2) -{ - abort(); -} - -/***********************/ - -/* set dst to point to the idxth field assuming field 0 is fld. Returns -1 - if there are not enough fields */ -#define fld_nth_req(dst, fld, idx) \ -do { \ - int __i__ = idx; \ - pcb_qry_node_t *__f__; \ - for(__f__ = (fld); __i__ > 0; __i__--, __f__ = __f__->next) { \ - if (__f__ == NULL) \ - return -1; \ - } \ - (dst) = __f__; \ -} while(0) - -#define fld_nth_opt(dst, fld, idx) \ -do { \ - int __i__ = idx; \ - pcb_qry_node_t *__f__; \ - for(__f__ = (fld); (__i__ > 0) && (__f__ != NULL); __i__--, __f__ = __f__->next) ; \ - (dst) = __f__; \ -} while(0) - -/* sets const char *s to point to the string data of the idxth field. Returns - -1 if tere are not enooung fields */ -#define fld2str_req(s, fld, idx) \ -do { \ - pcb_qry_node_t *_f_; \ - fld_nth_req(_f_, fld, idx); \ - if ((_f_ == NULL) || (_f_->type != PCBQ_FIELD)) \ - return -1; \ - (s) = _f_->data.str; \ -} while(0) - -/* Same, but doesn't return -1 on missing field but sets s to NULL */ -#define fld2str_opt(s, fld, idx) \ -do { \ - pcb_qry_node_t *_f_; \ - const char *__res__; \ - fld_nth_opt(_f_, fld, idx); \ - if (_f_ != NULL) { \ - if (_f_->type != PCBQ_FIELD) \ - return -1; \ - __res__ = _f_->data.str; \ - } \ - else \ - __res__ = NULL; \ - (s) = __res__; \ -} while(0) - -/* sets query_fields_keys_t h to point to the precomp field of the idxth field. - Returns -1 if tere are not enooung fields */ -#define fld2hash_req(h, fld, idx) \ -do { \ - pcb_qry_node_t *_f_; \ - fld_nth_req(_f_, fld, idx); \ - if ((_f_ == NULL) || (_f_->type != PCBQ_FIELD)) \ - return -1; \ - (h) = _f_->precomp.fld; \ -} while(0) - -/* Same, but doesn't return -1 on missing field but sets s to query_fields_SPHASH_INVALID */ -#define fld2hash_opt(h, fld, idx) \ -do { \ - pcb_qry_node_t *_f_; \ - query_fields_keys_t *__res__; \ - fld_nth_opt(_f_, fld, idx); \ - if (_f_ != NULL) { \ - if (_f_->type != PCBQ_FIELD) \ - return -1; \ - __res__ = _f_->precomp.fld; \ - } \ - else \ - __res__ = query_fields_SPHASH_INVALID; \ - (s) = __res__; \ -} while(0) - -static int field_layer(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - LayerType *l = obj->data.layer; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&l->Attributes, s2)); - } - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_name: PCB_QRY_RET_STR(res, l->Name); - case query_fields_visible: PCB_QRY_RET_INT(res, l->On); - case query_fields_position: PCB_QRY_RET_INT(res, pcb_layer_flags(GetLayerNumber(PCB->Data, l)) & PCB_LYT_ANYWHERE); - case query_fields_type: PCB_QRY_RET_INT(res, pcb_layer_flags(GetLayerNumber(PCB->Data, l)) & PCB_LYT_ANYTHING); - default:; - } - - PCB_QRY_RET_INV(res); -} - -static int field_layer_from_ptr(LayerType *l, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - pcb_obj_t tmp; - tmp.type = PCB_OBJ_LAYER; - tmp.data.layer = l; - tmp.parent_type = PCB_PARENT_DATA; - tmp.parent.data = PCB->Data; - return field_layer(&tmp, fld, res); -} - -/* process from .layer */ -static int layer_of_obj(pcb_qry_node_t *fld, pcb_qry_val_t *res, pcb_layer_type_t mask) -{ - int id; - const char *s1; - - if (pcb_layer_list(mask, &id, 1) != 1) - PCB_QRY_RET_INV(res); - - fld2str_req(s1, fld, 0); - - if (s1 == NULL) { - res->type = PCBQ_VT_OBJ; - res->data.obj.type = PCB_OBJ_LAYER; - res->data.obj.data.layer = PCB->Data->Layer+id; - return 0; - } - - return field_layer_from_ptr(PCB->Data->Layer+id, fld, res); -} - - -static int field_line(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - LineType *l = obj->data.line; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&l->Attributes, s2)); - } - - if (fh1 == query_fields_layer) { - if (obj->parent_type == PCB_PARENT_LAYER) - return field_layer_from_ptr(obj->parent.layer, fld->next, res); - else - PCB_QRY_RET_INV(res); - } - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_x1: PCB_QRY_RET_INT(res, l->Point1.X); - case query_fields_y1: PCB_QRY_RET_INT(res, l->Point1.Y); - case query_fields_x2: PCB_QRY_RET_INT(res, l->Point2.X); - case query_fields_y2: PCB_QRY_RET_INT(res, l->Point2.Y); - case query_fields_thickness: PCB_QRY_RET_INT(res, l->Thickness); - case query_fields_clearance: PCB_QRY_RET_INT(res, l->Clearance); - case query_fields_length: - { - double x = l->Point1.X - l->Point2.X; - double y = l->Point1.Y - l->Point2.Y; - double len = sqrt(x*x + y*y); - PCB_QRY_RET_INT(res, ((Coord)len)); - } - break; - default:; - } - - PCB_QRY_RET_INV(res); -} - -static int field_arc(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - ArcType *a = obj->data.arc; - query_fields_keys_t fh1, fh2; - - fld2hash_req(fh1, fld, 0); - - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&a->Attributes, s2)); - } - - if (fh1 == query_fields_angle) { - fld2hash_req(fh2, fld, 1); - switch(fh2) { - case query_fields_start: PCB_QRY_RET_INT(res, a->StartAngle); - case query_fields_delta: PCB_QRY_RET_INT(res, a->Delta); - default:; - } - PCB_QRY_RET_INV(res); - } - - if (fh1 == query_fields_layer) { - if (obj->parent_type == PCB_PARENT_LAYER) - return field_layer_from_ptr(obj->parent.layer, fld->next, res); - else - PCB_QRY_RET_INV(res); - } - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_cx: - case query_fields_x: PCB_QRY_RET_INT(res, a->X); - case query_fields_cy: - case query_fields_y: PCB_QRY_RET_INT(res, a->Y); - case query_fields_thickness: PCB_QRY_RET_INT(res, a->Thickness); - case query_fields_clearance: PCB_QRY_RET_INT(res, a->Clearance); - case query_fields_length: - { -#warning TODO: this breaks for elliptics; see http://tutorial.math.lamar.edu/Classes/CalcII/ArcLength.aspx - double r = (a->Width + a->Height)/2; - double len = r * M_PI / 180.0 * a->Delta; - PCB_QRY_RET_INT(res, ((Coord)len)); - } - break; - default:; - } - - PCB_QRY_RET_INV(res); -} - -static int field_text(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - TextType *t = obj->data.text; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&t->Attributes, s2)); - } - - if (fh1 == query_fields_layer) { - if (obj->parent_type == PCB_PARENT_LAYER) - return field_layer_from_ptr(obj->parent.layer, fld->next, res); - else - PCB_QRY_RET_INV(res); - } - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_x: PCB_QRY_RET_INT(res, t->X); - case query_fields_y: PCB_QRY_RET_INT(res, t->Y); - case query_fields_scale: PCB_QRY_RET_INT(res, t->Scale); - case query_fields_rotation: PCB_QRY_RET_INT(res, t->Direction); - case query_fields_string: PCB_QRY_RET_STR(res, t->TextString); - default:; - } - - PCB_QRY_RET_INV(res); -} - -static int field_polygon(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - PolygonType *p = obj->data.polygon; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); - } - - if (fh1 == query_fields_layer) { - if (obj->parent_type == PCB_PARENT_LAYER) - return field_layer_from_ptr(obj->parent.layer, fld->next, res); - else - PCB_QRY_RET_INV(res); - } - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_points: PCB_QRY_RET_INT(res, p->PointN); - default:; - } - - PCB_QRY_RET_INV(res); -} - -static int field_rat(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ -/* const char *s1, *s2; - - fld2str_req(s1, fld, 0); - fld2str_opt(s2, fld, 1);*/ -#warning TODO - PCB_QRY_RET_INV(res); -} - -static int field_via(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - PinType *p = obj->data.via; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); - } - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_x: PCB_QRY_RET_INT(res, p->X); - case query_fields_y: PCB_QRY_RET_INT(res, p->Y); - case query_fields_thickness: PCB_QRY_RET_INT(res, p->Thickness); - case query_fields_clearance: PCB_QRY_RET_INT(res, p->Clearance); - case query_fields_hole: PCB_QRY_RET_INT(res, p->DrillingHole); - case query_fields_mask: PCB_QRY_RET_INT(res, p->Mask); - case query_fields_name: PCB_QRY_RET_STR(res, p->Name); - case query_fields_number: PCB_QRY_RET_STR(res, p->Number); - default:; - } - - PCB_QRY_RET_INV(res); -} - -static int field_element(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - ElementType *p = obj->data.element; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); - } - - if (fh1 == query_fields_layer) - return layer_of_obj(fld->next, res, PCB_LYT_SILK | (TEST_FLAG(PCB_FLAG_ONSOLDER, p) ? PCB_LYT_BOTTOM : PCB_LYT_TOP)); - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_x: PCB_QRY_RET_INT(res, p->MarkX); - case query_fields_y: PCB_QRY_RET_INT(res, p->MarkY); - case query_fields_refdes: /* alias of: */ - case query_fields_name: PCB_QRY_RET_STR(res, p->Name[NAMEONPCB_INDEX].TextString); - case query_fields_description: PCB_QRY_RET_STR(res, p->Name[DESCRIPTION_INDEX].TextString); - case query_fields_value: PCB_QRY_RET_STR(res, p->Name[VALUE_INDEX].TextString); - - default:; - } - PCB_QRY_RET_INV(res); -} - -static int field_element_from_ptr(ElementType *e, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - pcb_obj_t tmp; - tmp.type = PCB_OBJ_ELEMENT; - tmp.data.element = e; - tmp.parent_type = PCB_PARENT_DATA; - tmp.parent.data = PCB->Data; - return field_element(&tmp, fld, res); -} - -static int field_element_obj(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - const char *s1; - - /* if parent is not an element (or not available) evaluate to invalid */ - if (obj->parent_type != PCB_PARENT_ELEMENT) - PCB_QRY_RET_INV(res); - - /* check subfield, if there's none, return the element object */ - fld2str_opt(s1, fld, 0); - if (s1 == NULL) { - res->type = PCBQ_VT_OBJ; - res->data.obj.data.element = obj->parent.element; - res->data.obj.parent_type = PCB_PARENT_DATA; - res->data.obj.parent.data = PCB->Data; - return 0; - } - - /* return subfields of the element */ - return field_element_from_ptr(obj->parent.element, fld, res); -} - -static int field_net(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ -/* const char *s1, *s2; - - fld2str_req(s1, fld, 0); - fld2str_opt(s2, fld, 1);*/ -#warning TODO - PCB_QRY_RET_INV(res); -} - - -static int field_eline(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - LineType *l = obj->data.line; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - switch(fh1) { - case query_fields_layer: return layer_of_obj(fld->next, res, PCB_LYT_SILK | (TEST_FLAG(PCB_FLAG_ONSOLDER, l) ? PCB_LYT_BOTTOM : PCB_LYT_TOP)); - case query_fields_element: return field_element_obj(obj, fld->next, res); - default:; - } - - return field_line(obj, fld, res); -} - -static int field_earc(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - ArcType *a = obj->data.arc; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - switch(fh1) { - case query_fields_layer: return layer_of_obj(fld->next, res, PCB_LYT_SILK | (TEST_FLAG(PCB_FLAG_ONSOLDER, a) ? PCB_LYT_BOTTOM : PCB_LYT_TOP)); - case query_fields_element: return field_element_obj(obj, fld->next, res); - default:; - } - - return field_arc(obj, fld, res); -} - -static int field_etext(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - TextType *t = obj->data.text; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - switch(fh1) { - case query_fields_layer: return layer_of_obj(fld->next, res, PCB_LYT_SILK | (TEST_FLAG(PCB_FLAG_ONSOLDER, t) ? PCB_LYT_BOTTOM : PCB_LYT_TOP)); - case query_fields_element: return field_element_obj(obj, fld->next, res); - default:; - } - - return field_text(obj, fld, res); -} - -static int field_pin(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - switch(fh1) { - case query_fields_element: return field_element_obj(obj, fld->next, res); - default:; - } - - return field_via(obj, fld, res); -} - -static int field_pad(pcb_obj_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - PadType *p = obj->data.pad; - query_fields_keys_t fh1; - - fld2hash_req(fh1, fld, 0); - - switch(fh1) { - case query_fields_a: - { - const char *s2; - fld2str_req(s2, fld, 1); - PCB_QRY_RET_STR(res, AttributeGetFromList(&p->Attributes, s2)); - } - case query_fields_layer: return layer_of_obj(fld->next, res, PCB_LYT_COPPER | (TEST_FLAG(PCB_FLAG_ONSOLDER, p) ? PCB_LYT_BOTTOM : PCB_LYT_TOP)); - case query_fields_element: return field_element_obj(obj, fld->next, res); - default:; - } - - - if (fld->next != NULL) - PCB_QRY_RET_INV(res); - - switch(fh1) { - case query_fields_x1: PCB_QRY_RET_INT(res, p->Point1.X); - case query_fields_y1: PCB_QRY_RET_INT(res, p->Point1.Y); - case query_fields_x2: PCB_QRY_RET_INT(res, p->Point2.X); - case query_fields_y2: PCB_QRY_RET_INT(res, p->Point2.Y); - case query_fields_thickness: PCB_QRY_RET_INT(res, p->Thickness); - case query_fields_clearance: PCB_QRY_RET_INT(res, p->Clearance); - case query_fields_mask: PCB_QRY_RET_INT(res, p->Mask); - case query_fields_name: PCB_QRY_RET_STR(res, p->Name); - case query_fields_number: PCB_QRY_RET_STR(res, p->Number); - default:; - } - - PCB_QRY_RET_INV(res); -} - - -/***/ - -int pcb_qry_obj_field(pcb_qry_val_t *objval, pcb_qry_node_t *fld, pcb_qry_val_t *res) -{ - pcb_obj_t *obj; - query_fields_keys_t fh1; - - if (objval->type != PCBQ_VT_OBJ) - return -1; - obj = &objval->data.obj; - - fld2hash_req(fh1, fld, 0); - - if (fh1 == query_fields_a) { - const char *s2; - fld2str_req(s2, fld, 0); - if (!PCB_OBJ_IS_CLASS(obj->type, PCB_OBJ_CLASS_OBJ)) - PCB_QRY_RET_INV(res); - PCB_QRY_RET_STR(res, AttributeGetFromList(&obj->data.anyobj->Attributes, s2)); - } - - if (fh1 == query_fields_ID) { - if (!PCB_OBJ_IS_CLASS(obj->type, PCB_OBJ_CLASS_OBJ)) - PCB_QRY_RET_INV(res); - PCB_QRY_RET_INT(res, obj->data.anyobj->ID); - } - - if (fh1 == query_fields_bbox) { - query_fields_keys_t fh2; - - if (!PCB_OBJ_IS_CLASS(obj->type, PCB_OBJ_CLASS_OBJ)) - PCB_QRY_RET_INV(res); - - fld2hash_req(fh2, fld, 1); - switch(fh2) { - case query_fields_x1: PCB_QRY_RET_INT(res, obj->data.anyobj->BoundingBox.X1); - case query_fields_y1: PCB_QRY_RET_INT(res, obj->data.anyobj->BoundingBox.Y1); - case query_fields_x2: PCB_QRY_RET_INT(res, obj->data.anyobj->BoundingBox.X2); - case query_fields_y2: PCB_QRY_RET_INT(res, obj->data.anyobj->BoundingBox.Y2); - case query_fields_width: PCB_QRY_RET_INT(res, obj->data.anyobj->BoundingBox.X2 - obj->data.anyobj->BoundingBox.X1); - case query_fields_height: PCB_QRY_RET_INT(res, obj->data.anyobj->BoundingBox.Y2 - obj->data.anyobj->BoundingBox.Y1); - case query_fields_area: PCB_QRY_RET_DBL(res, (double)(obj->data.anyobj->BoundingBox.Y2 - obj->data.anyobj->BoundingBox.Y1) * (double)(obj->data.anyobj->BoundingBox.X2 - obj->data.anyobj->BoundingBox.X1)); - default:; - } - PCB_QRY_RET_INV(res); - } - - if (fh1 == query_fields_type) - PCB_QRY_RET_INT(res, obj->type); - - switch(obj->type) { -/* case PCB_OBJ_POINT: return field_point(obj, fld, res);*/ - case PCB_OBJ_LINE: return field_line(obj, fld, res); - case PCB_OBJ_TEXT: return field_text(obj, fld, res); - case PCB_OBJ_POLYGON: return field_polygon(obj, fld, res); - case PCB_OBJ_ARC: return field_arc(obj, fld, res); - case PCB_OBJ_RAT: return field_rat(obj, fld, res); - case PCB_OBJ_PAD: return field_pad(obj, fld, res); - case PCB_OBJ_PIN: return field_pin(obj, fld, res); - case PCB_OBJ_VIA: return field_via(obj, fld, res); - case PCB_OBJ_ELEMENT: return field_element(obj, fld, res); - - case PCB_OBJ_NET: return field_net(obj, fld, res); - case PCB_OBJ_LAYER: return field_layer(obj, fld, res); - - case PCB_OBJ_ELINE: return field_eline(obj, fld, res); - case PCB_OBJ_EARC: return field_earc(obj, fld, res); - case PCB_OBJ_ETEXT: return field_etext(obj, fld, res); - default:; - } - - return -1; -} - Index: 1.1.4/src_plugins/query/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/query/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/query/Plug.tmpasm (nonexistent) @@ -1,21 +0,0 @@ -put /local/pcb/mod {query} -put /local/pcb/mod/OBJS [@ - $(PLUGDIR)/query/query.o - $(PLUGDIR)/query/query_access.o - $(PLUGDIR)/query/query_act.o - $(PLUGDIR)/query/query_exec.o - $(PLUGDIR)/query/query_l.o - $(PLUGDIR)/query/query_y.o - $(PLUGDIR)/query/basic_fnc.o - $(PLUGDIR)/query/fields_sphash.o -@] -put /local/pcb/mod/YACC {$(PLUGDIR)/query/query_y} -put /local/pcb/mod/LEX {$(PLUGDIR)/query/query_l} -put /local/pcb/mod/SPHASH {$(PLUGDIR)/query/fields.sphash} - - -switch /local/pcb/query/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/query/query_l.l =================================================================== --- 1.1.4/src_plugins/query/query_l.l (revision 10776) +++ 1.1.4/src_plugins/query/query_l.l (nonexistent) @@ -1,141 +0,0 @@ -%{ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - compiler: lexical analyzer */ - -#include "global.h" -#include "unit.h" -#include "query.h" -#include "query_y.h" -#include "compat_misc.h" -#include "layer.h" - -static const char *pcb_qry_program, *pcb_qry_program_ptr; -static int qry_yy_input(char *buf, int buflen); -static pcb_qry_node_t *make_constant(char *str, long val); -#define YY_INPUT(buf, res, buflen) (res = qry_yy_input(buf, buflen)) -%} - -%option prefix="qry_" - -%% -["][^"]*["] { qry_lval.s = pcb_strdup(yytext+1); qry_lval.s[strlen(qry_lval.s)-1] = '\0'; return T_QSTR; /*"*/ } -['][^']*['] { qry_lval.s = pcb_strdup(yytext+1); qry_lval.s[strlen(qry_lval.s)-1] = '\0'; return T_QSTR; } - -let { return T_LET; } -assert { return T_ASSERT; } -rule { return T_RULE; } -list { return T_LIST; } -invalid { return T_INVALID; } -p[.] { return T_FLD_P; } -a[.] { return T_FLD_A; } - -"POINT" { qry_lval.n = make_constant(yytext, PCB_OBJ_POINT); return T_CONST; } -"LINE" { qry_lval.n = make_constant(yytext, PCB_OBJ_LINE); return T_CONST; } -"TEXT" { qry_lval.n = make_constant(yytext, PCB_OBJ_TEXT); return T_CONST; } -"POLYGON" { qry_lval.n = make_constant(yytext, PCB_OBJ_POLYGON); return T_CONST; } -"ARC" { qry_lval.n = make_constant(yytext, PCB_OBJ_ARC); return T_CONST; } -"RAT" { qry_lval.n = make_constant(yytext, PCB_OBJ_RAT); return T_CONST; } -"PAD" { qry_lval.n = make_constant(yytext, PCB_OBJ_PAD); return T_CONST; } -"PIN" { qry_lval.n = make_constant(yytext, PCB_OBJ_PIN); return T_CONST; } -"VIA" { qry_lval.n = make_constant(yytext, PCB_OBJ_VIA); return T_CONST; } -"ELEMENT" { qry_lval.n = make_constant(yytext, PCB_OBJ_ELEMENT); return T_CONST; } -"NET" { qry_lval.n = make_constant(yytext, PCB_OBJ_NET); return T_CONST; } -"LAYER" { qry_lval.n = make_constant(yytext, PCB_OBJ_LAYER); return T_CONST; } -"ELINE" { qry_lval.n = make_constant(yytext, PCB_OBJ_ELINE); return T_CONST; } -"EARC" { qry_lval.n = make_constant(yytext, PCB_OBJ_EARC); return T_CONST; } -"ETEXT" { qry_lval.n = make_constant(yytext, PCB_OBJ_ETEXT); return T_CONST; } - -"TRUE" { qry_lval.n = make_constant(yytext, 1); return T_CONST; } -"VISIBLE" { qry_lval.n = make_constant(yytext, 1); return T_CONST; } -"ON" { qry_lval.n = make_constant(yytext, 1); return T_CONST; } -"YES" { qry_lval.n = make_constant(yytext, 1); return T_CONST; } - -"FALSE" { qry_lval.n = make_constant(yytext, 0); return T_CONST; } -"INVISIBLE" { qry_lval.n = make_constant(yytext, 0); return T_CONST; } -"OFF" { qry_lval.n = make_constant(yytext, 0); return T_CONST; } -"NO" { qry_lval.n = make_constant(yytext, 0); return T_CONST; } - -"TOP" { qry_lval.n = make_constant(yytext, PCB_LYT_TOP); return T_CONST; } -"BOTTOM" { qry_lval.n = make_constant(yytext, PCB_LYT_BOTTOM); return T_CONST; } -"INTERN" { qry_lval.n = make_constant(yytext, PCB_LYT_INTERN); return T_CONST; } -"INTERNAL" { qry_lval.n = make_constant(yytext, PCB_LYT_INTERN); return T_CONST; } -"COPPER" { qry_lval.n = make_constant(yytext, PCB_LYT_COPPER); return T_CONST; } -"SILK" { qry_lval.n = make_constant(yytext, PCB_LYT_SILK); return T_CONST; } -"MASK" { qry_lval.n = make_constant(yytext, PCB_LYT_MASK); return T_CONST; } -"PASTE" { qry_lval.n = make_constant(yytext, PCB_LYT_PASTE); return T_CONST; } -"OUTLINE" { qry_lval.n = make_constant(yytext, PCB_LYT_OUTLINE); return T_CONST; } - - - -mm { qry_lval.u = get_unit_struct_by_allow(ALLOW_MM); return T_UNIT; } -m { qry_lval.u = get_unit_struct_by_allow(ALLOW_M); return T_UNIT; } -um { qry_lval.u = get_unit_struct_by_allow(ALLOW_UM); return T_UNIT; } -cm { qry_lval.u = get_unit_struct_by_allow(ALLOW_CM); return T_UNIT; } -nm { qry_lval.u = get_unit_struct_by_allow(ALLOW_NM); return T_UNIT; } -mil { qry_lval.u = get_unit_struct_by_allow(ALLOW_MIL); return T_UNIT; } -inch { qry_lval.u = get_unit_struct_by_allow(ALLOW_IN); return T_UNIT; } - -[|][|] { return T_OR; } -[&][&] { return T_AND; } -[=][=] { return T_EQ; } -[!][=] { return T_NEQ; } -[>][=] { return T_GTEQ; } -[<][=] { return T_LTEQ; } - -[0-9]+ { qry_lval.c = strtol(yytext, NULL, 10); return T_INT; } -[.][0-9]+ { qry_lval.d = strtod(yytext, NULL); return T_DBL; } -[0-9]+[.][0-9]* { qry_lval.d = strtod(yytext, NULL); return T_DBL; } -[A-Za-z_][0-9A-Za-z_]* { qry_lval.s = pcb_strdup(yytext); return T_STR; } - -[@().,<>!*+/~-] { return *yytext; } - -[;\r\n] { return T_NL; } -[ \t] { continue; } - -%% - -static int qry_yy_input(char *buf, int buflen) -{ - int len; - for(len = 0; (*pcb_qry_program_ptr != '\0') && (buflen > 0); len++,buflen--) { -/* printf("IN: '%c'\n", *pcb_qry_program_ptr);*/ - *buf = *pcb_qry_program_ptr; - buf++; - pcb_qry_program_ptr++; - } - return len; -} - -void pcb_qry_set_input(const char *script) -{ - pcb_qry_program = pcb_qry_program_ptr = script; -} - -static pcb_qry_node_t *make_constant(char *str, long val) -{ - pcb_qry_node_t *res = pcb_qry_n_alloc(PCBQ_DATA_CONST); - res->data.str = pcb_strdup(str); - res->precomp.cnst = val; - return res; -} Index: 1.1.4/src_plugins/query/query_access.h =================================================================== --- 1.1.4/src_plugins/query/query_access.h (revision 10776) +++ 1.1.4/src_plugins/query/query_access.h (nonexistent) @@ -1,41 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - access to / extract core data */ - -#ifndef PCB_QUERY_ACCESS_H -#define PCB_QUERY_ACCESS_H - -#include "query.h" -#include "obj_any.h" - -/* Append objects with matching type to lst */ -void pcb_qry_list_all(pcb_qry_val_t *lst, pcb_objtype_t mask); - -int pcb_qry_list_cmp(pcb_qry_val_t *lst1, pcb_qry_val_t *lst2); - -void pcb_qry_list_free(pcb_qry_val_t *lst_); - -int pcb_qry_obj_field(pcb_qry_val_t *obj, pcb_qry_node_t *fld, pcb_qry_val_t *res); - - -#endif Index: 1.1.4/src_plugins/query/query_act.c =================================================================== --- 1.1.4/src_plugins/query/query_act.c (revision 10776) +++ 1.1.4/src_plugins/query/query_act.c (nonexistent) @@ -1,176 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - actions */ - -#include "global.h" -#include "query.h" -#include "query_y.h" -#include "query_exec.h" -#include "set.h" -#include "draw.h" -#include "select.h" -#include "macro.h" - -static const char query_action_syntax[] = - "query(dump, expr) - dry run: compile and dump an expression\n" - ; -static const char query_action_help[] = "Perform various queries on PCB data."; - -typedef struct { - int trues, falses; -} eval_stat_t; - -static void eval_cb(void *user_ctx, pcb_qry_val_t *res, pcb_obj_t *current) -{ - eval_stat_t *st = (eval_stat_t *)user_ctx; - int t = pcb_qry_is_true(res); - - printf(" %s", t ? "true" : "false"); - if (t) { - char *resv; - resv = pcb_query_sprint_val(res); - printf(" (%s)\n", resv); - free(resv); - st->trues++; - } - else { - printf("\n"); - st->falses++; - } -} - -typedef struct { - pcb_cardinal_t cnt; - pcb_change_flag_t how; -} select_t; - -static void select_cb(void *user_ctx, pcb_qry_val_t *res, pcb_obj_t *current) -{ - select_t *sel = (select_t *)user_ctx; - if (!pcb_qry_is_true(res)) - return; - if (PCB_OBJ_IS_CLASS(current->type, PCB_OBJ_CLASS_OBJ)) { - int state_wanted = (sel->how == PCB_CHGFLG_SET); - int state_is = TEST_FLAG(PCB_FLAG_SELECTED, current->data.anyobj); - if (state_wanted != state_is) { - if (current->type == PCB_OBJ_ELEMENT) - pcb_select_element(current->data.element, sel->how, 0); - else if (current->type == PCB_OBJ_ETEXT) - pcb_select_element_name(current->data.element, sel->how, 0); - else - CHANGE_FLAG(sel->how, PCB_FLAG_SELECTED, current->data.anyobj); - sel->cnt++; - } - } -} - -static int run_script(const char *script, void (*cb)(void *user_ctx, pcb_qry_val_t *res, pcb_obj_t *current), void *user_ctx) -{ - pcb_qry_node_t *prg = NULL; - - pcb_qry_set_input(script); - qry_parse(&prg); - - if (prg == NULL) { - Message(PCB_MSG_ERROR, "Compilation error.\n"); - return -1; - } - - return pcb_qry_run(prg, cb, user_ctx); -} - -static int query_action(int argc, const char **argv, Coord x, Coord y) -{ - const char *cmd = argc > 0 ? argv[0] : 0; - select_t sel; - - sel.cnt = 0; - - if (cmd == NULL) { - return -1; - } - - if (strcmp(cmd, "version") == 0) - return 0100; /* 1.0 */ - - if (strcmp(cmd, "dump") == 0) { - pcb_qry_node_t *prg = NULL; - printf("Script dump: '%s'\n", argv[1]); - pcb_qry_set_input(argv[1]); - qry_parse(&prg); - pcb_qry_dump_tree(" ", prg); - return 0; - } - - if (strcmp(cmd, "eval") == 0) { - int errs; - eval_stat_t st; - - memset(&st, 0, sizeof(st)); - printf("Script eval: '%s'\n", argv[1]); - errs = run_script(argv[1], eval_cb, &st); - - if (errs < 0) - printf("Failed to run the query\n"); - else - printf("eval statistics: true=%d false=%d errors=%d\n", st.trues, st.falses, errs); - return 0; - } - - if (strcmp(cmd, "select") == 0) { - sel.how = PCB_CHGFLG_SET; - if (run_script(argv[1], select_cb, &sel) < 0) - printf("Failed to run the query\n"); - if (sel.cnt > 0) { - SetChangedFlag(pcb_true); - Redraw(); - } - return 0; - } - - if (strcmp(cmd, "unselect") == 0) { - sel.how = PCB_CHGFLG_CLEAR; - if (run_script(argv[1], select_cb, &sel) < 0) - printf("Failed to run the query\n"); - if (sel.cnt > 0) { - SetChangedFlag(pcb_true); - Redraw(); - } - return 0; - } - - return -1; -} - -HID_Action query_action_list[] = { - {"query", NULL, query_action, - query_action_help, query_action_syntax} -}; - -REGISTER_ACTIONS(query_action_list, NULL) - -#include "dolists.h" -void query_action_reg(const char *cookie) -{ - REGISTER_ACTIONS(query_action_list, cookie) -} Index: 1.1.4/src_plugins/query/Makefile =================================================================== --- 1.1.4/src_plugins/query/Makefile (revision 10776) +++ 1.1.4/src_plugins/query/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && make mod_query - - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/query/query_y.c =================================================================== --- 1.1.4/src_plugins/query/query_y.c (revision 10776) +++ 1.1.4/src_plugins/query/query_y.c (nonexistent) @@ -1,2016 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - 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 3 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0.2" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - -/* Substitute the variable and function names. */ -#define yyparse qry_parse -#define yylex qry_lex -#define yyerror qry_error -#define yydebug qry_debug -#define yynerrs qry_nerrs - -#define yylval qry_lval -#define yychar qry_char - -/* Copy the first part of user declarations. */ -#line 1 "query_y.y" /* yacc.c:339 */ - -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2016 Tibor 'Igor2' Palinkas - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* Query language - compiler: grammar */ - -#include -#include "global.h" -#include "unit.h" -#include "query.h" -#include "query_l.h" -#include "compat_misc.h" -#include "fields_sphash.h" - -#define UNIT_CONV(dst, negative, val, unit) \ -do { \ - dst = val; \ - if (negative) \ - dst = -dst; \ - if (unit != NULL) { \ - if (unit->family == IMPERIAL) \ - dst = PCB_MIL_TO_COORD(dst); \ - else if (unit->family == METRIC) \ - dst = PCB_MM_TO_COORD(dst); \ - dst /= unit->scale_factor; \ - } \ -} while(0) - -#define BINOP(dst, op1, operator, op2) \ -do { \ - assert(op2->next == NULL); \ - assert(op2->next == NULL); \ - dst = pcb_qry_n_alloc(operator); \ - pcb_qry_n_insert(dst, op2); \ - pcb_qry_n_insert(dst, op1); \ -} while(0) - -#define UNOP(dst, operator, op) \ -do { \ - assert(op->next == NULL); \ - dst = pcb_qry_n_alloc(operator); \ - pcb_qry_n_insert(dst, op); \ -} while(0) - -static pcb_query_iter_t *iter_ctx; - -static char *attrib_prepend_free(char *orig, char *prep, char sep) -{ - int l1 = strlen(orig), l2 = strlen(prep); - char *res = malloc(l1+l2+2); - memcpy(res, prep, l2); - res[l2] = sep; - memcpy(res+l2+1, orig, l1+1); - free(orig); - free(prep); - return res; -} - -static pcb_qry_node_t *make_regex_free(char *str) -{ - pcb_qry_node_t *res = pcb_qry_n_alloc(PCBQ_DATA_REGEX); - res->data.str = str; - res->precomp.regex = re_se_comp(str); - if (res->precomp.regex == NULL) - yyerror(NULL, "Invalid regex\n"); - return res; -} - - - -#line 164 "query_y.c" /* yacc.c:339 */ - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 1 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "query_y.h". */ -#ifndef YY_QRY_QUERY_Y_H_INCLUDED -# define YY_QRY_QUERY_Y_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int qry_debug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - T_LET = 258, - T_ASSERT = 259, - T_RULE = 260, - T_LIST = 261, - T_INVALID = 262, - T_FLD_P = 263, - T_FLD_A = 264, - T_OR = 265, - T_AND = 266, - T_EQ = 267, - T_NEQ = 268, - T_GTEQ = 269, - T_LTEQ = 270, - T_NL = 271, - T_UNIT = 272, - T_STR = 273, - T_QSTR = 274, - T_INT = 275, - T_DBL = 276, - T_CONST = 277 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 95 "query_y.y" /* yacc.c:355 */ - - char *s; - Coord c; - double d; - const Unit *u; - pcb_qry_node_t *n; - -#line 235 "query_y.c" /* yacc.c:355 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE qry_lval; - -int qry_parse (pcb_qry_node_t **prg_out); - -#endif /* !YY_QRY_QUERY_Y_H_INCLUDED */ - -/* Copy the second part of user declarations. */ - -#line 250 "query_y.c" /* yacc.c:358 */ - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 9 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 231 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 36 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 18 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 57 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 93 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 277 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 30, 2, 2, 2, 2, 2, 2, - 31, 32, 27, 25, 35, 26, 29, 28, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 23, 2, 24, 2, 34, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 33, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 133, 133, 134, 139, 139, 152, 153, 157, 169, - 170, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 208, 209, 210, 211, 215, 219, - 220, 224, 225, 226, 227, 231, 232, 233, 237, 238, - 239, 243, 244, 248, 262, 263, 267, 268 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 1 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "T_LET", "T_ASSERT", "T_RULE", "T_LIST", - "T_INVALID", "T_FLD_P", "T_FLD_A", "T_OR", "T_AND", "T_EQ", "T_NEQ", - "T_GTEQ", "T_LTEQ", "T_NL", "T_UNIT", "T_STR", "T_QSTR", "T_INT", - "T_DBL", "T_CONST", "'<'", "'>'", "'+'", "'-'", "'*'", "'/'", "'.'", - "'!'", "'('", "')'", "'~'", "'@'", "','", "$accept", "program", - "program_expr", "$@1", "program_rules", "rule", "exprs", "expr", - "number", "string_literal", "maybe_unit", "fields", "attribs", "var", - "fcall", "fname", "fargs", "words", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 60, 62, 43, 45, 42, 47, 46, - 33, 40, 41, 126, 64, 44 -}; -# endif - -#define YYPACT_NINF -63 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-63))) - -#define YYTABLE_NINF -54 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 3, -17, 9, -63, 40, -63, 6, -17, -3, -63, - 0, -63, 2, -63, 10, 10, -63, 5, 40, 40, - -63, 139, -63, -63, 19, -63, 21, -63, -63, -63, - 23, -63, -63, -63, 10, 10, 31, 91, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 32, 45, -2, 40, 33, -63, -63, -63, 162, 179, - 194, 194, 198, 198, 198, 198, -21, -21, 31, 31, - -63, -63, 45, 37, 38, -63, -63, 65, 36, 115, - -63, -63, 43, -63, -63, 45, 40, -63, -63, 37, - -63, -63, -63 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 4, 56, 0, 3, 0, 2, 6, 56, 0, 1, - 0, 14, 48, 38, 39, 39, 31, 0, 0, 0, - 50, 5, 12, 13, 32, 11, 0, 7, 57, 9, - 0, 40, 34, 35, 39, 39, 15, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 0, 36, 37, 16, 18, 17, - 19, 20, 21, 22, 24, 23, 25, 26, 27, 28, - 29, 30, 0, 0, 41, 33, 52, 54, 0, 0, - 49, 43, 45, 47, 44, 0, 0, 51, 10, 0, - 42, 55, 46 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -63, -63, -63, -63, 63, -63, -63, -4, -63, -63, - -13, -62, -16, -63, -63, -63, -5, 75 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 2, 3, 4, 5, 6, 53, 77, 22, 23, - 32, 75, 84, 24, 25, 26, 78, 8 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int8 yytable[] = -{ - 21, 7, 33, -6, 10, 11, 48, 49, 1, 9, - 81, 1, 50, 29, 36, 37, 12, 13, 14, 15, - 16, 55, 56, 90, 17, 34, 35, 31, 18, 19, - 76, 30, 20, -53, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 10, 11, 51, 79, - 70, 71, 52, 72, 73, 82, 83, 54, 12, 13, - 14, 15, 16, 74, 50, 80, 17, 85, 87, 27, - 18, 19, 89, 92, 20, 38, 39, 40, 41, 42, - 43, 91, 28, 0, 0, 0, 0, 0, 44, 45, - 46, 47, 48, 49, 0, 0, 0, 0, 50, 0, - 86, 38, 39, 40, 41, 42, 43, 0, 0, 0, - 0, 0, 0, 0, 44, 45, 46, 47, 48, 49, - 0, 0, 0, 57, 50, 38, 39, 40, 41, 42, - 43, 88, 0, 0, 0, 0, 0, 0, 44, 45, - 46, 47, 48, 49, 0, 0, 0, 0, 50, 38, - 39, 40, 41, 42, 43, 0, 0, 0, 0, 0, - 0, 0, 44, 45, 46, 47, 48, 49, 0, 0, - 0, 0, 50, 39, 40, 41, 42, 43, 0, 0, - 0, 0, 0, 0, 0, 44, 45, 46, 47, 48, - 49, 40, 41, 42, 43, 50, 0, 0, 0, 0, - 0, 0, 44, 45, 46, 47, 48, 49, 42, 43, - 0, 0, 50, 0, 0, 0, 0, 44, 45, 46, - 47, 48, 49, 46, 47, 48, 49, 50, 0, 0, - 0, 50 -}; - -static const yytype_int8 yycheck[] = -{ - 4, 18, 15, 0, 6, 7, 27, 28, 5, 0, - 72, 5, 33, 16, 18, 19, 18, 19, 20, 21, - 22, 34, 35, 85, 26, 20, 21, 17, 30, 31, - 32, 31, 34, 31, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 6, 7, 29, 53, - 18, 19, 31, 8, 9, 18, 19, 34, 18, 19, - 20, 21, 22, 18, 33, 32, 26, 29, 32, 6, - 30, 31, 29, 89, 34, 10, 11, 12, 13, 14, - 15, 86, 7, -1, -1, -1, -1, -1, 23, 24, - 25, 26, 27, 28, -1, -1, -1, -1, 33, -1, - 35, 10, 11, 12, 13, 14, 15, -1, -1, -1, - -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, - -1, -1, -1, 32, 33, 10, 11, 12, 13, 14, - 15, 16, -1, -1, -1, -1, -1, -1, 23, 24, - 25, 26, 27, 28, -1, -1, -1, -1, 33, 10, - 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, - -1, -1, 23, 24, 25, 26, 27, 28, -1, -1, - -1, -1, 33, 11, 12, 13, 14, 15, -1, -1, - -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, - 28, 12, 13, 14, 15, 33, -1, -1, -1, -1, - -1, -1, 23, 24, 25, 26, 27, 28, 14, 15, - -1, -1, 33, -1, -1, -1, -1, 23, 24, 25, - 26, 27, 28, 25, 26, 27, 28, 33, -1, -1, - -1, 33 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 5, 37, 38, 39, 40, 41, 18, 53, 0, - 6, 7, 18, 19, 20, 21, 22, 26, 30, 31, - 34, 43, 44, 45, 49, 50, 51, 40, 53, 16, - 31, 17, 46, 46, 20, 21, 43, 43, 10, 11, - 12, 13, 14, 15, 23, 24, 25, 26, 27, 28, - 33, 29, 31, 42, 34, 46, 46, 32, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 18, 19, 8, 9, 18, 47, 32, 43, 52, 43, - 32, 47, 18, 19, 48, 29, 35, 32, 16, 29, - 47, 52, 48 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 36, 37, 37, 39, 38, 40, 40, 41, 42, - 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 44, 44, 44, 44, 45, 46, - 46, 47, 47, 47, 47, 48, 48, 48, 49, 49, - 49, 50, 50, 51, 52, 52, 53, 53 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 0, 2, 0, 2, 4, 0, - 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 1, 1, 3, 2, 2, 3, 3, 1, 0, - 1, 1, 3, 2, 2, 1, 3, 1, 1, 4, - 1, 4, 3, 1, 1, 3, 0, 2 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (prg_out, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, prg_out); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, pcb_qry_node_t **prg_out) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - YYUSE (prg_out); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, pcb_qry_node_t **prg_out) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep, prg_out); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, pcb_qry_node_t **prg_out) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , prg_out); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule, prg_out); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, pcb_qry_node_t **prg_out) -{ - YYUSE (yyvaluep); - YYUSE (prg_out); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (pcb_qry_node_t **prg_out) -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 133 "query_y.y" /* yacc.c:1646 */ - { *prg_out = (yyvsp[0].n); } -#line 1418 "query_y.c" /* yacc.c:1646 */ - break; - - case 3: -#line 134 "query_y.y" /* yacc.c:1646 */ - { *prg_out = (yyvsp[0].n); } -#line 1424 "query_y.c" /* yacc.c:1646 */ - break; - - case 4: -#line 139 "query_y.y" /* yacc.c:1646 */ - { iter_ctx = pcb_qry_iter_alloc(); } -#line 1430 "query_y.c" /* yacc.c:1646 */ - break; - - case 5: -#line 140 "query_y.y" /* yacc.c:1646 */ - { - (yyval.n) = pcb_qry_n_alloc(PCBQ_EXPR_PROG); - (yyval.n)->data.children = pcb_qry_n_alloc(PCBQ_ITER_CTX); - (yyval.n)->data.children->parent = (yyval.n); - (yyval.n)->data.children->data.iter_ctx = iter_ctx; - (yyval.n)->data.children->next = (yyvsp[0].n); - (yyvsp[0].n)->parent = (yyval.n); - } -#line 1443 "query_y.c" /* yacc.c:1646 */ - break; - - case 6: -#line 152 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = NULL; } -#line 1449 "query_y.c" /* yacc.c:1646 */ - break; - - case 7: -#line 153 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[-1].n); (yyvsp[-1].n)->next = (yyvsp[0].n); } -#line 1455 "query_y.c" /* yacc.c:1646 */ - break; - - case 8: -#line 157 "query_y.y" /* yacc.c:1646 */ - { - (yyval.n) = pcb_qry_n_alloc(PCBQ_RULE); - (yyval.n)->data.children = (yyvsp[-2].n); - (yyvsp[-2].n)->parent = (yyval.n); - (yyval.n)->data.children->next = pcb_qry_n_alloc(PCBQ_ITER_CTX); - (yyval.n)->data.children->next->data.iter_ctx = iter_ctx; - (yyval.n)->data.children->next->next = (yyvsp[0].n); - (yyvsp[0].n)->parent = (yyval.n); - } -#line 1469 "query_y.c" /* yacc.c:1646 */ - break; - - case 9: -#line 169 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = NULL; } -#line 1475 "query_y.c" /* yacc.c:1646 */ - break; - - case 10: -#line 170 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[-2].n); (yyvsp[-2].n)->next = (yyvsp[-1].n); } -#line 1481 "query_y.c" /* yacc.c:1646 */ - break; - - case 11: -#line 174 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[0].n); } -#line 1487 "query_y.c" /* yacc.c:1646 */ - break; - - case 12: -#line 175 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[0].n); } -#line 1493 "query_y.c" /* yacc.c:1646 */ - break; - - case 13: -#line 176 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[0].n); } -#line 1499 "query_y.c" /* yacc.c:1646 */ - break; - - case 14: -#line 177 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_DATA_INVALID); } -#line 1505 "query_y.c" /* yacc.c:1646 */ - break; - - case 15: -#line 178 "query_y.y" /* yacc.c:1646 */ - { UNOP((yyval.n), PCBQ_OP_NOT, (yyvsp[0].n)); } -#line 1511 "query_y.c" /* yacc.c:1646 */ - break; - - case 16: -#line 179 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[-1].n); } -#line 1517 "query_y.c" /* yacc.c:1646 */ - break; - - case 17: -#line 180 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_AND, (yyvsp[0].n)); } -#line 1523 "query_y.c" /* yacc.c:1646 */ - break; - - case 18: -#line 181 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_OR, (yyvsp[0].n)); } -#line 1529 "query_y.c" /* yacc.c:1646 */ - break; - - case 19: -#line 182 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_EQ, (yyvsp[0].n)); } -#line 1535 "query_y.c" /* yacc.c:1646 */ - break; - - case 20: -#line 183 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_NEQ, (yyvsp[0].n)); } -#line 1541 "query_y.c" /* yacc.c:1646 */ - break; - - case 21: -#line 184 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_GTEQ, (yyvsp[0].n)); } -#line 1547 "query_y.c" /* yacc.c:1646 */ - break; - - case 22: -#line 185 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_LTEQ, (yyvsp[0].n)); } -#line 1553 "query_y.c" /* yacc.c:1646 */ - break; - - case 23: -#line 186 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_GT, (yyvsp[0].n)); } -#line 1559 "query_y.c" /* yacc.c:1646 */ - break; - - case 24: -#line 187 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_LT, (yyvsp[0].n)); } -#line 1565 "query_y.c" /* yacc.c:1646 */ - break; - - case 25: -#line 188 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_ADD, (yyvsp[0].n)); } -#line 1571 "query_y.c" /* yacc.c:1646 */ - break; - - case 26: -#line 189 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_SUB, (yyvsp[0].n)); } -#line 1577 "query_y.c" /* yacc.c:1646 */ - break; - - case 27: -#line 190 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_MUL, (yyvsp[0].n)); } -#line 1583 "query_y.c" /* yacc.c:1646 */ - break; - - case 28: -#line 191 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_DIV, (yyvsp[0].n)); } -#line 1589 "query_y.c" /* yacc.c:1646 */ - break; - - case 29: -#line 192 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_MATCH, make_regex_free((yyvsp[0].s))); } -#line 1595 "query_y.c" /* yacc.c:1646 */ - break; - - case 30: -#line 193 "query_y.y" /* yacc.c:1646 */ - { BINOP((yyval.n), (yyvsp[-2].n), PCBQ_OP_MATCH, make_regex_free((yyvsp[0].s))); } -#line 1601 "query_y.c" /* yacc.c:1646 */ - break; - - case 31: -#line 194 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[0].n); } -#line 1607 "query_y.c" /* yacc.c:1646 */ - break; - - case 32: -#line 195 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[0].n); } -#line 1613 "query_y.c" /* yacc.c:1646 */ - break; - - case 33: -#line 196 "query_y.y" /* yacc.c:1646 */ - { - pcb_qry_node_t *n; - (yyval.n) = pcb_qry_n_alloc(PCBQ_FIELD_OF); - (yyval.n)->data.children = (yyvsp[-2].n); - (yyvsp[-2].n)->next = (yyvsp[0].n); - (yyvsp[-2].n)->parent = (yyval.n); - for(n = (yyvsp[0].n); n != NULL; n = n->next) - n->parent = (yyval.n); - } -#line 1627 "query_y.c" /* yacc.c:1646 */ - break; - - case 34: -#line 208 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_DATA_COORD); UNIT_CONV((yyval.n)->data.crd, 0, (yyvsp[-1].c), (yyvsp[0].u)); } -#line 1633 "query_y.c" /* yacc.c:1646 */ - break; - - case 35: -#line 209 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_DATA_DOUBLE); UNIT_CONV((yyval.n)->data.dbl, 0, (yyvsp[-1].d), (yyvsp[0].u)); } -#line 1639 "query_y.c" /* yacc.c:1646 */ - break; - - case 36: -#line 210 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_DATA_COORD); UNIT_CONV((yyval.n)->data.crd, 1, (yyvsp[-1].c), (yyvsp[0].u)); } -#line 1645 "query_y.c" /* yacc.c:1646 */ - break; - - case 37: -#line 211 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_DATA_DOUBLE); UNIT_CONV((yyval.n)->data.dbl, 1, (yyvsp[-1].d), (yyvsp[0].u)); } -#line 1651 "query_y.c" /* yacc.c:1646 */ - break; - - case 38: -#line 215 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_DATA_STRING); (yyval.n)->data.str = (yyvsp[0].s); } -#line 1657 "query_y.c" /* yacc.c:1646 */ - break; - - case 39: -#line 219 "query_y.y" /* yacc.c:1646 */ - { (yyval.u) = NULL; } -#line 1663 "query_y.c" /* yacc.c:1646 */ - break; - - case 40: -#line 220 "query_y.y" /* yacc.c:1646 */ - { (yyval.u) = (yyvsp[0].u); } -#line 1669 "query_y.c" /* yacc.c:1646 */ - break; - - case 41: -#line 224 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FIELD); (yyval.n)->data.str = (yyvsp[0].s); (yyval.n)->precomp.fld = query_fields_sphash((yyvsp[0].s)); } -#line 1675 "query_y.c" /* yacc.c:1646 */ - break; - - case 42: -#line 225 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FIELD); (yyval.n)->data.str = (yyvsp[-2].s); (yyval.n)->precomp.fld = query_fields_sphash((yyvsp[-2].s)); (yyval.n)->next = (yyvsp[0].n); } -#line 1681 "query_y.c" /* yacc.c:1646 */ - break; - - case 43: -#line 226 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[0].n); /* just ignore .p. */ } -#line 1687 "query_y.c" /* yacc.c:1646 */ - break; - - case 44: -#line 227 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FIELD); (yyval.n)->data.str = pcb_strdup("a"); (yyval.n)->precomp.fld = query_fields_sphash("a"); (yyval.n)->next = (yyvsp[0].n); } -#line 1693 "query_y.c" /* yacc.c:1646 */ - break; - - case 45: -#line 231 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FIELD); (yyval.n)->data.str = (yyvsp[0].s); } -#line 1699 "query_y.c" /* yacc.c:1646 */ - break; - - case 46: -#line 232 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FIELD); (yyval.n)->data.str = attrib_prepend_free((yyvsp[0].n)->data.str, (yyvsp[-2].s), '.'); } -#line 1705 "query_y.c" /* yacc.c:1646 */ - break; - - case 47: -#line 233 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FIELD); (yyval.n)->data.str = (yyvsp[0].s); } -#line 1711 "query_y.c" /* yacc.c:1646 */ - break; - - case 48: -#line 237 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_VAR); (yyval.n)->data.crd = pcb_qry_iter_var(iter_ctx, (yyvsp[0].s), 1); free((yyvsp[0].s)); } -#line 1717 "query_y.c" /* yacc.c:1646 */ - break; - - case 49: -#line 238 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_LISTVAR); (yyval.n)->data.str = pcb_strdup("@"); } -#line 1723 "query_y.c" /* yacc.c:1646 */ - break; - - case 50: -#line 239 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_VAR); (yyval.n)->data.crd = pcb_qry_iter_var(iter_ctx, "@", 1); } -#line 1729 "query_y.c" /* yacc.c:1646 */ - break; - - case 51: -#line 243 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FCALL); (yyval.n)->data.children = (yyvsp[-3].n); (yyval.n)->data.children->next = (yyvsp[-1].n); (yyvsp[-3].n)->parent = (yyvsp[-1].n)->parent = (yyval.n); } -#line 1735 "query_y.c" /* yacc.c:1646 */ - break; - - case 52: -#line 244 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_FCALL); (yyval.n)->data.children = (yyvsp[-2].n); (yyvsp[-2].n)->parent = (yyval.n); } -#line 1741 "query_y.c" /* yacc.c:1646 */ - break; - - case 53: -#line 248 "query_y.y" /* yacc.c:1646 */ - { - (yyval.n) = pcb_qry_n_alloc(PCBQ_FNAME); - (yyval.n)->data.fnc = pcb_qry_fnc_lookup((yyvsp[0].s)); - if ((yyval.n)->data.fnc == NULL) { - yyerror("Unknown function"); - free((yyvsp[0].s)); - return -1; - } - free((yyvsp[0].s)); - } -#line 1756 "query_y.c" /* yacc.c:1646 */ - break; - - case 54: -#line 262 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[0].n); } -#line 1762 "query_y.c" /* yacc.c:1646 */ - break; - - case 55: -#line 263 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = (yyvsp[-2].n); (yyval.n)->next = (yyvsp[0].n); } -#line 1768 "query_y.c" /* yacc.c:1646 */ - break; - - case 56: -#line 267 "query_y.y" /* yacc.c:1646 */ - { (yyval.n) = pcb_qry_n_alloc(PCBQ_RNAME); (yyval.n)->data.str = (const char *)pcb_strdup(""); } -#line 1774 "query_y.c" /* yacc.c:1646 */ - break; - - case 57: -#line 268 "query_y.y" /* yacc.c:1646 */ - { - int l1 = strlen((yyvsp[0].n)->data.str), l2 = strlen((yyvsp[-1].s)); - - (yyvsp[0].n)->data.str = (const char *)realloc((void *)(yyvsp[0].n)->data.str, l1+l2+2); - memcpy((char *)(yyvsp[0].n)->data.str+l1, (yyvsp[-1].s), l2+1); - free((yyvsp[-1].s)); - } -#line 1786 "query_y.c" /* yacc.c:1646 */ - break; - - -#line 1790 "query_y.c" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (prg_out, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (prg_out, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval, prg_out); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp, prg_out); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (prg_out, YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, prg_out); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, prg_out); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} Index: 1.1.4/src_plugins/plugins_fp.tmpasm =================================================================== --- 1.1.4/src_plugins/plugins_fp.tmpasm (revision 10776) +++ 1.1.4/src_plugins/plugins_fp.tmpasm (nonexistent) @@ -1,6 +0,0 @@ -# footprint plugins -# This has to be separate from any other class because gsch2pcb depends on it -# while it doesn't want to link the rest. - -include {../src_plugins/fp_fs/Plug.tmpasm} -include {../src_plugins/fp_wget/Plug.tmpasm} Index: 1.1.4/src_plugins/import_sch/import_sch_conf.h =================================================================== --- 1.1.4/src_plugins/import_sch/import_sch_conf.h (revision 10776) +++ 1.1.4/src_plugins/import_sch/import_sch_conf.h (nonexistent) @@ -1,15 +0,0 @@ -#ifndef PCB_IMPORT_SCH_CONF_H -#define PCB_IMPORT_SCH_CONF_H - -#include "conf.h" - -typedef struct { - const struct plugins { - const struct import_sch { - CFT_STRING gnetlist_program; /* gnetlist program name */ - CFT_STRING make_program; /* make program name */ - } import_sch; - } plugins; -} conf_import_sch_t; - -#endif Index: 1.1.4/src_plugins/import_sch/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/import_sch/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/import_sch/Plug.tmpasm (nonexistent) @@ -1,9 +0,0 @@ -put /local/pcb/mod {import_sch} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/import_sch/import_sch.o @] -put /local/pcb/mod/CONF {$(PLUGDIR)/import_sch/import_sch_conf.h} - -switch /local/pcb/import_sch/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/import_sch/import_sch.c =================================================================== --- 1.1.4/src_plugins/import_sch/import_sch.c (revision 10776) +++ 1.1.4/src_plugins/import_sch/import_sch.c (nonexistent) @@ -1,483 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "conf_core.h" - -#include "global.h" -#include "data.h" -#include "action_helper.h" -#include "change.h" -#include "error.h" -#include "undo.h" -#include "plugins.h" - -#include "misc.h" -#include "compat_fs.h" -#include "pcb-printf.h" -#include "remove.h" -#include "rats.h" -#include "hid_actions.h" -#include "import_sch_conf.h" -#include "misc_util.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -conf_import_sch_t conf_import_sch; - -extern int ActionExecuteFile(int argc, const char **argv, Coord x, Coord y); - -/* ---------------------------------------------------------------- */ -static const char import_syntax[] = - "Import()\n" - "Import([gnetlist|make[,source,source,...]])\n" "Import(setnewpoint[,(mark|center|X,Y)])\n" "Import(setdisperse,D,units)\n"; - -static const char import_help[] = "Import schematics."; - -/* %start-doc actions Import - -Imports element and netlist data from the schematics (or some other -source). The first parameter, which is optional, is the mode. If not -specified, the @code{import::mode} attribute in the PCB is used. -@code{gnetlist} means gnetlist is used to obtain the information from -the schematics. @code{make} invokes @code{make}, assuming the user -has a @code{Makefile} in the current directory. The @code{Makefile} -will be invoked with the following variables set: - -@table @code - -@item PCB -The name of the .pcb file - -@item SRCLIST -A space-separated list of source files - -@item OUT -The name of the file in which to put the command script, which may -contain any @pcb{} actions. By default, this is a temporary file -selected by @pcb{}, but if you specify an @code{import::outfile} -attribute, that file name is used instead (and not automatically -deleted afterwards). - -@end table - -The target specified to be built is the first of these that apply: - -@itemize @bullet - -@item -The target specified by an @code{import::target} attribute. - -@item -The output file specified by an @code{import::outfile} attribute. - -@item -If nothing else is specified, the target is @code{pcb_import}. - -@end itemize - -If you specify an @code{import::makefile} attribute, then "-f " will be added to the command line. - -If you specify the mode, you may also specify the source files -(schematics). If you do not specify any, the list of schematics is -obtained by reading the @code{import::src@var{N}} attributes (like -@code{import::src0}, @code{import::src1}, etc). - -For compatibility with future extensions to the import file format, -the generated file @emph{must not} start with the two characters -@code{#%}. - -If a temporary file is needed the @code{TMPDIR} environment variable -is used to select its location. -*/ - -/* -Note that the programs @code{gnetlist} and @code{make} must be -configured. - -If @pcb{} cannot determine which schematic(s) to import from, the GUI -is called to let user choose (see @code{ImportGUI()}). - -Note that Import() doesn't delete anything - after an Import, elements -which shouldn't be on the board are selected and may be removed once -it's determined that the deletion is appropriate. - -If @code{Import()} is called with @code{setnewpoint}, then the location -of new components can be specified. This is where parts show up when -they're added to the board. The default is the center of the board. - -@table @code - -@item Import(setnewpoint) - -Prompts the user to click on the board somewhere, uses that point. If -called by a hotkey, uses the current location of the crosshair. - -@item Import(setnewpoint,mark) - -Uses the location of the mark. If no mark is present, the point is -not changed. - -@item Import(setnewpoint,center) - -Resets the point to the center of the board. - -@item Import(setnewpoint,X,Y,units) - -Sets the point to the specific coordinates given. Example: -@code{Import(setnewpoint,50,25,mm)} - -@end table - -Note that the X and Y locations are stored in attributes named -@code{import::newX} and @code{import::newY} so you could change them -manually if you wished. - -Calling @code{Import(setdisperse,D,units)} sets how much the newly -placed elements are dispersed relative to the set point. For example, -@code{Import(setdisperse,10,mm)} will offset each part randomly up to -10mm away from the point. The default dispersion is 1/10th of the -smallest board dimension. Dispersion is saved in the -@code{import::disperse} attribute. - -%end-doc */ - -static int ActionImport(int argc, const char **argv, Coord x, Coord y) -{ - const char *mode; - const char **sources = NULL; - int nsources = 0; - -#ifdef DEBUG - printf("ActionImport: =========== Entering ActionImport ============\n"); -#endif - - mode = ACTION_ARG(0); - - if (mode && strcasecmp(mode, "setdisperse") == 0) { - const char *ds, *units; - char buf[50]; - - ds = ACTION_ARG(1); - units = ACTION_ARG(2); - if (!ds) { - const char *as = AttributeGet(PCB, "import::disperse"); - ds = gui->prompt_for(_("Enter dispersion:"), as ? as : "0"); - } - if (units) { - sprintf(buf, "%s%s", ds, units); - AttributePut(PCB, "import::disperse", buf); - } - else - AttributePut(PCB, "import::disperse", ds); - if (ACTION_ARG(1) == NULL) - free((char*)ds); - return 0; - } - - if (mode && strcasecmp(mode, "setnewpoint") == 0) { - const char *xs, *ys, *units; - Coord x, y; - char buf[50]; - - xs = ACTION_ARG(1); - ys = ACTION_ARG(2); - units = ACTION_ARG(3); - - if (!xs) { - gui->get_coords(_("Click on a location"), &x, &y); - } - else if (strcasecmp(xs, "center") == 0) { - AttributeRemove(PCB, "import::newX"); - AttributeRemove(PCB, "import::newY"); - return 0; - } - else if (strcasecmp(xs, "mark") == 0) { - if (Marked.status) { - x = Marked.X; - y = Marked.Y; - } - } - else if (ys) { - x = GetValue(xs, units, NULL, NULL); - y = GetValue(ys, units, NULL, NULL); - } - else { - Message(PCB_MSG_DEFAULT, _("Bad syntax for Import(setnewpoint)")); - return 1; - } - - pcb_sprintf(buf, "%$ms", x); - AttributePut(PCB, "import::newX", buf); - pcb_sprintf(buf, "%$ms", y); - AttributePut(PCB, "import::newY", buf); - return 0; - } - - if (!mode) - mode = AttributeGet(PCB, "import::mode"); - if (!mode) - mode = "gnetlist"; - - if (argc > 1) { - sources = argv + 1; - nsources = argc - 1; - } - - if (!sources) { - char sname[40]; - char *src; - - nsources = -1; - do { - nsources++; - sprintf(sname, "import::src%d", nsources); - src = AttributeGet(PCB, sname); - } while (src); - - if (nsources > 0) { - sources = (const char **) malloc((nsources + 1) * sizeof(char *)); - nsources = -1; - do { - nsources++; - sprintf(sname, "import::src%d", nsources); - src = AttributeGet(PCB, sname); - sources[nsources] = src; - } while (src); - } - } - - if (!sources) { - /* Replace .pcb with .sch and hope for the best. */ - char *pcbname = PCB->Filename; - char *schname; - char *dot, *slash, *bslash; - - if (!pcbname) - return hid_action("ImportGUI"); - - schname = (char *) malloc(strlen(pcbname) + 5); - strcpy(schname, pcbname); - dot = strchr(schname, '.'); - slash = strchr(schname, '/'); - bslash = strchr(schname, '\\'); - if (dot && slash && dot < slash) - dot = NULL; - if (dot && bslash && dot < bslash) - dot = NULL; - if (dot) - *dot = 0; - strcat(schname, ".sch"); - - if (access(schname, F_OK)) - return hid_action("ImportGUI"); - - sources = (const char **) malloc(2 * sizeof(char *)); - sources[0] = schname; - sources[1] = NULL; - nsources = 1; - } - - if (strcasecmp(mode, "gnetlist") == 0) { - char *tmpfile = tempfile_name_new("gnetlist_output"); - const char **cmd; - int i; - - if (tmpfile == NULL) { - Message(PCB_MSG_ERROR, _("Could not create temp file")); - return 1; - } - - if ((conf_import_sch.plugins.import_sch.gnetlist_program == NULL) || (*conf_import_sch.plugins.import_sch.gnetlist_program == '\0')) { - Message(PCB_MSG_ERROR, _("No gnetlist program configured, can not import. Please fill in configuration setting plugins/import_sch/gnetlist_program\n")); - return 1; - } - - cmd = (const char **) malloc((9 + nsources) * sizeof(char *)); - cmd[0] = conf_import_sch.plugins.import_sch.gnetlist_program; - cmd[1] = "-L"; - cmd[2] = PCBLIBDIR; - cmd[3] = "-g"; - cmd[4] = "pcbrndfwd"; - cmd[5] = "-o"; - cmd[6] = tmpfile; - cmd[7] = "--"; - for (i = 0; i < nsources; i++) - cmd[8 + i] = sources[i]; - cmd[8 + nsources] = NULL; - -#ifdef DEBUG - printf("ActionImport: =========== About to run gnetlist ============\n"); - printf("%s %s %s %s %s %s %s %s %s ...\n", cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8]); -#endif - - if (pcb_spawnvp(cmd)) { - unlink(tmpfile); - return 1; - } - -#ifdef DEBUG - printf("ActionImport: =========== About to run ActionExecuteFile, file = %s ============\n", tmpfile); -#endif - - cmd[0] = tmpfile; - cmd[1] = NULL; - ActionExecuteFile(1, cmd, 0, 0); - - free(cmd); - tempfile_unlink(tmpfile); - } - else if (strcasecmp(mode, "make") == 0) { - int must_free_tmpfile = 0; - char *tmpfile; - const char *cmd[10]; - int i; - char *srclist; - int srclen; - char *user_outfile = NULL; - char *user_makefile = NULL; - char *user_target = NULL; - - - user_outfile = AttributeGet(PCB, "import::outfile"); - user_makefile = AttributeGet(PCB, "import::makefile"); - user_target = AttributeGet(PCB, "import::target"); - if (user_outfile && !user_target) - user_target = user_outfile; - - if ((conf_import_sch.plugins.import_sch.make_program == NULL) || (*conf_import_sch.plugins.import_sch.make_program == '\0')) { - Message(PCB_MSG_ERROR, _("No make program configured, can not import. Please fill in configuration setting plugins/import_sch/make_program\n")); - return 1; - } - - if (user_outfile) - tmpfile = user_outfile; - else { - tmpfile = tempfile_name_new("gnetlist_output"); - if (tmpfile == NULL) { - Message(PCB_MSG_ERROR, _("Could not create temp file")); - return 1; - } - must_free_tmpfile = 1; - } - - srclen = sizeof("SRCLIST=") + 2; - for (i = 0; i < nsources; i++) - srclen += strlen(sources[i]) + 2; - srclist = (char *) malloc(srclen); - strcpy(srclist, "SRCLIST="); - for (i = 0; i < nsources; i++) { - if (i) - strcat(srclist, " "); - strcat(srclist, sources[i]); - } - - cmd[0] = conf_import_sch.plugins.import_sch.make_program; - cmd[1] = "-s"; - cmd[2] = Concat("PCB=", PCB->Filename, NULL); - cmd[3] = srclist; - cmd[4] = Concat("OUT=", tmpfile, NULL); - i = 5; - if (user_makefile) { - cmd[i++] = "-f"; - cmd[i++] = user_makefile; - } - cmd[i++] = user_target ? user_target : (char *) "pcb_import"; - cmd[i++] = NULL; - - if (pcb_spawnvp(cmd)) { - if (must_free_tmpfile) - unlink(tmpfile); - free((char*)cmd[2]); - free((char*)cmd[3]); - free((char*)cmd[4]); - return 1; - } - - cmd[0] = tmpfile; - cmd[1] = NULL; - ActionExecuteFile(1, cmd, 0, 0); - - free((char*)cmd[2]); - free((char*)cmd[3]); - free((char*)cmd[4]); - if (must_free_tmpfile) - tempfile_unlink(tmpfile); - } - else { - Message(PCB_MSG_DEFAULT, _("Unknown import mode: %s\n"), mode); - return 1; - } - - DeleteRats(pcb_false); - AddAllRats(pcb_false, NULL); - -#ifdef DEBUG - printf("ActionImport: =========== Leaving ActionImport ============\n"); -#endif - - return 0; -} - -static const char *import_sch_cookie = "import_sch plugin"; - -HID_Action import_sch_action_list[] = { - {"Import", 0, ActionImport, - import_help, import_syntax} -}; - -REGISTER_ACTIONS(import_sch_action_list, import_sch_cookie) - -static void hid_import_sch_uninit(void) -{ - hid_remove_actions_by_cookie(import_sch_cookie); - conf_unreg_fields("plugins/import_sch/"); -} - -#include "dolists.h" -pcb_uninit_t hid_import_sch_init(void) -{ - char *tmp; - - REGISTER_ACTIONS(import_sch_action_list, import_sch_cookie) -#define conf_reg(field,isarray,type_name,cpath,cname,desc,flags) \ - conf_reg_field(conf_import_sch, field,isarray,type_name,cpath,cname,desc,flags); -#include "import_sch_conf_fields.h" - - /* Compatibility: get some settings from the env */ - tmp = getenv ("PCB_MAKE_PROGRAM"); - if (tmp != NULL) - conf_set(CFR_ENV, "plugins/import_sch/make_program", -1, tmp, POL_OVERWRITE); - - tmp = getenv ("PCB_GNETLIST"); - if (tmp != NULL) - conf_set(CFR_ENV, "plugins/import_sch/gnetlist_program", -1, tmp, POL_OVERWRITE); - - return hid_import_sch_uninit; -} Property changes on: 1.1.4/src_plugins/import_sch/import_sch.c ___________________________________________________________________ Deleted: svn:mergeinfo ## -0,1 +0,0 ## Reverse-merged /trunk/src_plugins/import_sch/import_sch.c:r5727 Index: 1.1.4/src_plugins/import_sch/README =================================================================== --- 1.1.4/src_plugins/import_sch/README (revision 10776) +++ 1.1.4/src_plugins/import_sch/README (nonexistent) @@ -1,5 +0,0 @@ -Imports element and netlist data from the schematics (or some other source). - -#state: works -#default: buildin -#implements: import Index: 1.1.4/src_plugins/import_sch/Makefile =================================================================== --- 1.1.4/src_plugins/import_sch/Makefile (revision 10776) +++ 1.1.4/src_plugins/import_sch/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_autoplace - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/autoplace/autoplace.h =================================================================== --- 1.1.4/src_plugins/autoplace/autoplace.h (revision 10776) +++ 1.1.4/src_plugins/autoplace/autoplace.h (nonexistent) @@ -1,40 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * this file, autoplace.h, was written and is - * Copyright (c) 2001 C. Scott Ananian. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* prototypes for autoplace routines */ - -#ifndef PCB_AUTOPLACE_H -#define PCB_AUTOPLACE_H - -#include "global.h" - -pcb_bool AutoPlaceSelected(void); - -#endif Index: 1.1.4/src_plugins/autoplace/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/autoplace/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/autoplace/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {autoplace} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/autoplace/autoplace.o $(PLUGDIR)/autoplace/action.o @] - -switch /local/pcb/autoplace/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/autoplace/README =================================================================== --- 1.1.4/src_plugins/autoplace/README (revision 10776) +++ 1.1.4/src_plugins/autoplace/README (nonexistent) @@ -1,5 +0,0 @@ -Automatically place elements. - -#state: works -#default: buildin -#implements: (feature) Index: 1.1.4/src_plugins/autoplace/Makefile =================================================================== --- 1.1.4/src_plugins/autoplace/Makefile (revision 10776) +++ 1.1.4/src_plugins/autoplace/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_autoplace - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/autoplace/action.c =================================================================== --- 1.1.4/src_plugins/autoplace/action.c (revision 10776) +++ 1.1.4/src_plugins/autoplace/action.c (nonexistent) @@ -1,76 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -#include "config.h" -#include "global.h" -#include "autoplace.h" -#include "plugins.h" -#include "set.h" -#include "hid_actions.h" - -static const char autoplace_syntax[] = "AutoPlaceSelected()"; - -static const char autoplace_help[] = "Auto-place selected components."; - -/* %start-doc actions AutoPlaceSelected - -Attempts to re-arrange the selected components such that the nets -connecting them are minimized. Note that you cannot undo this. - -%end-doc */ - -static int ActionAutoPlaceSelected(int argc, const char **argv, Coord x, Coord y) -{ - hid_action("Busy"); - if (gui->confirm_dialog(_("Auto-placement can NOT be undone.\n" "Do you want to continue anyway?\n"), 0)) { - if (AutoPlaceSelected()) - SetChangedFlag(pcb_true); - } - return 0; -} - -static const char *autoplace_cookie = "autoplace plugin"; - -HID_Action autoplace_action_list[] = { - {"AutoPlaceSelected", 0, ActionAutoPlaceSelected, - autoplace_help, autoplace_syntax} - , -}; - -REGISTER_ACTIONS(autoplace_action_list, autoplace_cookie) - -static void hid_autoplace_uninit(void) -{ - hid_remove_actions_by_cookie(autoplace_cookie); -} - -#include "dolists.h" -pcb_uninit_t hid_autoplace_init(void) -{ - REGISTER_ACTIONS(autoplace_action_list, autoplace_cookie) - return hid_autoplace_uninit; -} Index: 1.1.4/src_plugins/autoplace/autoplace.c =================================================================== --- 1.1.4/src_plugins/autoplace/autoplace.c (revision 10776) +++ 1.1.4/src_plugins/autoplace/autoplace.c (nonexistent) @@ -1,763 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1998,1999,2000,2001 harry eaton - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA - * haceaton@aplcomm.jhuapl.edu - * - */ - -/* - * This moduel, autoplace.c, was written by and is - * Copyright (c) 2001 C. Scott Ananian - */ - -/* functions used to autoplace elements. - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "global.h" - -#include "autoplace.h" -#include "box.h" -#include "compat_misc.h" -#include "data.h" -#include "draw.h" -#include "error.h" -#include "layer.h" -#include "intersect.h" -#include "rtree.h" -#include "macro.h" -#include "mirror.h" -#include "misc.h" -#include "move.h" -#include "mymem.h" -#include "rats.h" -#include "remove.h" -#include "rotate.h" - -#define EXPANDRECTXY(r1, x1, y1, x2, y2) { \ - r1->X1=MIN(r1->X1, x1); r1->Y1=MIN(r1->Y1, y1); \ - r1->X2=MAX(r1->X2, x2); r1->Y2=MAX(r1->Y2, y2); \ -} -#define EXPANDRECT(r1, r2) EXPANDRECTXY(r1, r2->X1, r2->Y1, r2->X2, r2->Y2) - -/* --------------------------------------------------------------------------- - * some local prototypes - */ -static double ComputeCost(NetListTypePtr Nets, double T0, double T); - -/* --------------------------------------------------------------------------- - * some local types - */ -const struct { - double via_cost; - double congestion_penalty; /* penalty length / unit area */ - double overlap_penalty_min; /* penalty length / unit area at start */ - double overlap_penalty_max; /* penalty length / unit area at end */ - double out_of_bounds_penalty; /* assessed for each component oob */ - double overall_area_penalty; /* penalty length / unit area */ - double matching_neighbor_bonus; /* length bonus per same-type neigh. */ - double aligned_neighbor_bonus; /* length bonus per aligned neigh. */ - double oriented_neighbor_bonus; /* length bonus per same-rot neigh. */ -#if 0 - double pin_alignment_bonus; /* length bonus per exact alignment */ - double bound_alignment_bonus; /* length bonus per exact alignment */ -#endif - double m; /* annealing stage cutoff constant */ - double gamma; /* annealing schedule constant */ - int good_ratio; /* ratio of moves to good moves for halting */ - pcb_bool fast; /* ignore SMD/pin conflicts */ - Coord large_grid_size; /* snap perturbations to this grid when T is high */ - Coord small_grid_size; /* snap to this grid when T is small. */ -} -/* wire cost is manhattan distance (in mils), thus 1 inch = 1000 */ CostParameter = -{ - 3e3, /* via cost */ - 2e-2, /* congestion penalty */ - 1e-2, /* initial overlap penalty */ - 1e2, /* final overlap penalty */ - 1e3, /* out of bounds penalty */ - 1e0, /* penalty for total area used */ - 1e0, /* subtract 1000 from cost for every same-type neighbor */ - 1e0, /* subtract 1000 from cost for every aligned neighbor */ - 1e0, /* subtract 1000 from cost for every same-rotation neighbor */ - 20, /* move on when each module has been profitably moved 20 times */ - 0.75, /* annealing schedule constant: 0.85 */ - 40, /* halt when there are 60 times as many moves as good moves */ - pcb_false, /* don't ignore SMD/pin conflicts */ - PCB_MIL_TO_COORD(100), /* coarse grid is 100 mils */ - PCB_MIL_TO_COORD(10), /* fine grid is 10 mils */ -}; - -typedef struct { - ElementTypePtr *element; - pcb_cardinal_t elementN; -} ElementPtrListType; - -enum ewhich { SHIFT, ROTATE, EXCHANGE }; - -typedef struct { - ElementTypePtr element; - enum ewhich which; - Coord DX, DY; /* for shift */ - unsigned rotate; /* for rotate/flip */ - ElementTypePtr other; /* for exchange */ -} PerturbationType; - -/* --------------------------------------------------------------------------- - * some local identifiers - */ - -/* --------------------------------------------------------------------------- - * Update the X, Y and group position information stored in the NetList after - * elements have possibly been moved, rotated, flipped, etc. - */ -static void UpdateXY(NetListTypePtr Nets) -{ - pcb_cardinal_t SLayer, CLayer; - pcb_cardinal_t i, j; - /* find layer groups of the component side and solder side */ - SLayer = GetLayerGroupNumberByNumber(solder_silk_layer); - CLayer = GetLayerGroupNumberByNumber(component_silk_layer); - /* update all nets */ - for (i = 0; i < Nets->NetN; i++) { - for (j = 0; j < Nets->Net[i].ConnectionN; j++) { - ConnectionTypePtr c = &(Nets->Net[i].Connection[j]); - switch (c->type) { - case PCB_TYPE_PAD: - c->group = TEST_FLAG(PCB_FLAG_ONSOLDER, (ElementTypePtr) c->ptr1) - ? SLayer : CLayer; - c->X = ((PadTypePtr) c->ptr2)->Point1.X; - c->Y = ((PadTypePtr) c->ptr2)->Point1.Y; - break; - case PCB_TYPE_PIN: - c->group = SLayer; /* any layer will do */ - c->X = ((PinTypePtr) c->ptr2)->X; - c->Y = ((PinTypePtr) c->ptr2)->Y; - break; - default: - Message(PCB_MSG_DEFAULT, "Odd connection type encountered in " "UpdateXY"); - break; - } - } - } -} - -/* --------------------------------------------------------------------------- - * Create a list of selected elements. - */ -static PointerListType collectSelectedElements() -{ - PointerListType list = { 0, 0, NULL }; - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_SELECTED, element)) { - ElementTypePtr *epp = (ElementTypePtr *) GetPointerMemory(&list); - *epp = element; - } - } - END_LOOP; - return list; -} - -#if 0 /* only for debugging box lists */ -#include "create.h" -/* makes a line on the solder layer surrounding all boxes in blist */ -static void showboxes(BoxListTypePtr blist) -{ - pcb_cardinal_t i; - LayerTypePtr SLayer = &(PCB->Data->Layer[solder_silk_layer]); - for (i = 0; i < blist->BoxN; i++) { - CreateNewLineOnLayer(SLayer, blist->Box[i].X1, blist->Box[i].Y1, blist->Box[i].X2, blist->Box[i].Y1, 1, 1, 0); - CreateNewLineOnLayer(SLayer, blist->Box[i].X1, blist->Box[i].Y2, blist->Box[i].X2, blist->Box[i].Y2, 1, 1, 0); - CreateNewLineOnLayer(SLayer, blist->Box[i].X1, blist->Box[i].Y1, blist->Box[i].X1, blist->Box[i].Y2, 1, 1, 0); - CreateNewLineOnLayer(SLayer, blist->Box[i].X2, blist->Box[i].Y1, blist->Box[i].X2, blist->Box[i].Y2, 1, 1, 0); - } -} -#endif - -/* --------------------------------------------------------------------------- - * Helper function to compute "closest neighbor" for a box in a rtree. - * The closest neighbor on a certain side is the closest one in a trapezoid - * emanating from that side. - */ -/*------ r_find_neighbor ------*/ -struct r_neighbor_info { - const BoxType *neighbor; - BoxType trap; - direction_t search_dir; -}; -#define ROTATEBOX(box) { Coord t;\ - t = (box).X1; (box).X1 = - (box).Y1; (box).Y1 = t;\ - t = (box).X2; (box).X2 = - (box).Y2; (box).Y2 = t;\ - t = (box).X1; (box).X1 = (box).X2; (box).X2 = t;\ -} -/* helper methods for __r_find_neighbor */ -static r_dir_t __r_find_neighbor_reg_in_sea(const BoxType * region, void *cl) -{ - struct r_neighbor_info *ni = (struct r_neighbor_info *) cl; - BoxType query = *region; - ROTATEBOX_TO_NORTH(query, ni->search_dir); - /* ______________ __ trap.y1 __ - * \ / |__| query rect. - * \__________/ __ trap.y2 - * | | - * trap.x1 trap.x2 sides at 45-degree angle - */ - if ((query.Y2 > ni->trap.Y1) && (query.Y1 < ni->trap.Y2) && (query.X2 + ni->trap.Y2 > ni->trap.X1 + query.Y1) && (query.X1 + query.Y1 < ni->trap.X2 + ni->trap.Y2)) - return R_DIR_FOUND_CONTINUE; - return R_DIR_NOT_FOUND; -} - -static r_dir_t __r_find_neighbor_rect_in_reg(const BoxType * box, void *cl) -{ - struct r_neighbor_info *ni = (struct r_neighbor_info *) cl; - BoxType query = *box; - int r; - ROTATEBOX_TO_NORTH(query, ni->search_dir); - /* ______________ __ trap.y1 __ - * \ / |__| query rect. - * \__________/ __ trap.y2 - * | | - * trap.x1 trap.x2 sides at 45-degree angle - */ - r = (query.Y2 > ni->trap.Y1) && (query.Y1 < ni->trap.Y2) && - (query.X2 + ni->trap.Y2 > ni->trap.X1 + query.Y1) && (query.X1 + query.Y1 < ni->trap.X2 + ni->trap.Y2); - r = r && (query.Y2 <= ni->trap.Y2); - if (r) { - ni->trap.Y1 = query.Y2; - ni->neighbor = box; - } - return r ? R_DIR_FOUND_CONTINUE : R_DIR_NOT_FOUND; -} - -/* main r_find_neighbor routine. Returns NULL if no neighbor in the - * requested direction. */ -static const BoxType *r_find_neighbor(rtree_t * rtree, const BoxType * box, direction_t search_direction) -{ - struct r_neighbor_info ni; - BoxType bbox; - - ni.neighbor = NULL; - ni.trap = *box; - ni.search_dir = search_direction; - - bbox.X1 = bbox.Y1 = 0; - bbox.X2 = PCB->MaxWidth; - bbox.Y2 = PCB->MaxHeight; - /* rotate so that we can use the 'north' case for everything */ - ROTATEBOX_TO_NORTH(bbox, search_direction); - ROTATEBOX_TO_NORTH(ni.trap, search_direction); - /* shift Y's such that trap contains full bounds of trapezoid */ - ni.trap.Y2 = ni.trap.Y1; - ni.trap.Y1 = bbox.Y1; - /* do the search! */ - r_search(rtree, NULL, __r_find_neighbor_reg_in_sea, __r_find_neighbor_rect_in_reg, &ni, NULL); - return ni.neighbor; -} - -/* --------------------------------------------------------------------------- - * Compute cost function. - * note that area overlap cost is correct for SMD devices: SMD devices on - * opposite sides of the board don't overlap. - * - * Algorithms follow those described in sections 4.1 of - * "Placement and Routing of Electronic Modules" edited by Michael Pecht - * Marcel Dekker, Inc. 1993. ISBN: 0-8247-8916-4 TK7868.P7.P57 1993 - */ -static double ComputeCost(NetListTypePtr Nets, double T0, double T) -{ - double W = 0; /* wire cost */ - double delta1 = 0; /* wire congestion penalty function */ - double delta2 = 0; /* module overlap penalty function */ - double delta3 = 0; /* out of bounds penalty */ - double delta4 = 0; /* alignment bonus */ - double delta5 = 0; /* total area penalty */ - pcb_cardinal_t i, j; - Coord minx, maxx, miny, maxy; - pcb_bool allpads, allsameside; - pcb_cardinal_t thegroup; - BoxListType bounds = { 0, 0, NULL }; /* save bounding rectangles here */ - BoxListType solderside = { 0, 0, NULL }; /* solder side component bounds */ - BoxListType componentside = { 0, 0, NULL }; /* component side bounds */ - /* make sure the NetList have the proper updated X and Y coords */ - UpdateXY(Nets); - /* wire length term. approximated by half-perimeter of minimum - * rectangle enclosing the net. Note that we penalize vias in - * all-SMD nets by making the rectangle a cube and weighting - * the "layer height" of the net. */ - for (i = 0; i < Nets->NetN; i++) { - NetTypePtr n = &Nets->Net[i]; - if (n->ConnectionN < 2) - continue; /* no cost to go nowhere */ - minx = maxx = n->Connection[0].X; - miny = maxy = n->Connection[0].Y; - thegroup = n->Connection[0].group; - allpads = (n->Connection[0].type == PCB_TYPE_PAD); - allsameside = pcb_true; - for (j = 1; j < n->ConnectionN; j++) { - ConnectionTypePtr c = &(n->Connection[j]); - MAKEMIN(minx, c->X); - MAKEMAX(maxx, c->X); - MAKEMIN(miny, c->Y); - MAKEMAX(maxy, c->Y); - if (c->type != PCB_TYPE_PAD) - allpads = pcb_false; - if (c->group != thegroup) - allsameside = pcb_false; - } - /* save bounding rectangle */ - { - BoxTypePtr box = GetBoxMemory(&bounds); - box->X1 = minx; - box->Y1 = miny; - box->X2 = maxx; - box->Y2 = maxy; - } - /* okay, add half-perimeter to cost! */ - W += PCB_COORD_TO_MIL(maxx - minx) + PCB_COORD_TO_MIL(maxy - miny) + ((allpads && !allsameside) ? CostParameter.via_cost : 0); - } - /* now compute penalty function Wc which is proportional to - * amount of overlap and congestion. */ - /* delta1 is congestion penalty function */ - delta1 = CostParameter.congestion_penalty * sqrt(fabs(ComputeIntersectionArea(&bounds))); -#if 0 - printf("Wire Congestion Area: %f\n", ComputeIntersectionArea(&bounds)); -#endif - /* free bounding rectangles */ - FreeBoxListMemory(&bounds); - /* now collect module areas (bounding rect of pins/pads) */ - /* two lists for solder side / component side. */ - - ELEMENT_LOOP(PCB->Data); - { - BoxListTypePtr thisside; - BoxListTypePtr otherside; - BoxTypePtr box; - BoxTypePtr lastbox = NULL; - Coord thickness; - Coord clearance; - if (TEST_FLAG(PCB_FLAG_ONSOLDER, element)) { - thisside = &solderside; - otherside = &componentside; - } - else { - thisside = &componentside; - otherside = &solderside; - } - box = GetBoxMemory(thisside); - /* protect against elements with no pins/pads */ - if (pinlist_length(&element->Pin) == 0 && padlist_length(&element->Pad) == 0) - continue; - /* initialize box so that it will take the dimensions of - * the first pin/pad */ - box->X1 = MAX_COORD; - box->Y1 = MAX_COORD; - box->X2 = -MAX_COORD; - box->Y2 = -MAX_COORD; - PIN_LOOP(element); - { - thickness = pin->Thickness / 2; - clearance = pin->Clearance * 2; - EXPANDRECTXY(box, - pin->X - (thickness + clearance), - pin->Y - (thickness + clearance), pin->X + (thickness + clearance), pin->Y + (thickness + clearance))} - END_LOOP; - PAD_LOOP(element); - { - thickness = pad->Thickness / 2; - clearance = pad->Clearance * 2; - EXPANDRECTXY(box, - MIN(pad->Point1.X, - pad->Point2.X) - (thickness + - clearance), - MIN(pad->Point1.Y, - pad->Point2.Y) - (thickness + - clearance), - MAX(pad->Point1.X, - pad->Point2.X) + (thickness + clearance), MAX(pad->Point1.Y, pad->Point2.Y) + (thickness + clearance))} - END_LOOP; - /* add a box for each pin to the "opposite side": - * surface mount components can't sit on top of pins */ - if (!CostParameter.fast) - PIN_LOOP(element); - { - box = GetBoxMemory(otherside); - thickness = pin->Thickness / 2; - clearance = pin->Clearance * 2; - /* we ignore clearance here */ - /* (otherwise pins don't fit next to each other) */ - box->X1 = pin->X - thickness; - box->Y1 = pin->Y - thickness; - box->X2 = pin->X + thickness; - box->Y2 = pin->Y + thickness; - /* speed hack! coalesce with last box if we can */ - if (lastbox != NULL && - ((lastbox->X1 == box->X1 && - lastbox->X2 == box->X2 && - MIN(labs(lastbox->Y1 - box->Y2), - labs(box->Y1 - lastbox->Y2)) < - clearance) || (lastbox->Y1 == box->Y1 - && lastbox->Y2 == box->Y2 - && MIN(labs(lastbox->X1 - box->X2), labs(box->X1 - lastbox->X2)) < clearance))) { - EXPANDRECT(lastbox, box); - otherside->BoxN--; - } - else - lastbox = box; - } - END_LOOP; - /* assess out of bounds penalty */ - if (element->VBox.X1 < 0 || element->VBox.Y1 < 0 || element->VBox.X2 > PCB->MaxWidth || element->VBox.Y2 > PCB->MaxHeight) - delta3 += CostParameter.out_of_bounds_penalty; - } - END_LOOP; - /* compute intersection area of module areas box list */ - delta2 = sqrt(fabs(ComputeIntersectionArea(&solderside) + - ComputeIntersectionArea(&componentside))) * - (CostParameter.overlap_penalty_min + (1 - (T / T0)) * CostParameter.overlap_penalty_max); -#if 0 - printf("Module Overlap Area (solder): %f\n", ComputeIntersectionArea(&solderside)); - printf("Module Overlap Area (component): %f\n", ComputeIntersectionArea(&componentside)); -#endif - FreeBoxListMemory(&solderside); - FreeBoxListMemory(&componentside); - /* reward pin/pad x/y alignment */ - /* score higher if pins/pads belong to same *type* of component */ - /* XXX: subkey should be *distance* from thing aligned with, so that - * aligning to something far away isn't profitable */ - { - /* create r tree */ - PointerListType seboxes = { 0, 0, NULL } - , ceboxes = { - 0, 0, NULL}; - struct ebox { - BoxType box; - ElementTypePtr element; - }; - direction_t dir[4] = { NORTH, EAST, SOUTH, WEST }; - struct ebox **boxpp, *boxp; - rtree_t *rt_s, *rt_c; - int factor; - ELEMENT_LOOP(PCB->Data); - { - boxpp = (struct ebox **) - GetPointerMemory(TEST_FLAG(PCB_FLAG_ONSOLDER, element) ? &seboxes : &ceboxes); - *boxpp = (struct ebox *) malloc(sizeof(**boxpp)); - if (*boxpp == NULL) { - fprintf(stderr, "malloc() failed in ComputeCost\n"); - exit(1); - } - - (*boxpp)->box = element->VBox; - (*boxpp)->element = element; - } - END_LOOP; - rt_s = r_create_tree((const BoxType **) seboxes.Ptr, seboxes.PtrN, 1); - rt_c = r_create_tree((const BoxType **) ceboxes.Ptr, ceboxes.PtrN, 1); - FreePointerListMemory(&seboxes); - FreePointerListMemory(&ceboxes); - /* now, for each element, find its neighbor on all four sides */ - delta4 = 0; - for (i = 0; i < 4; i++) - ELEMENT_LOOP(PCB->Data); - { - boxp = (struct ebox *) - r_find_neighbor(TEST_FLAG(PCB_FLAG_ONSOLDER, element) ? rt_s : rt_c, &element->VBox, dir[i]); - /* score bounding box alignments */ - if (!boxp) - continue; - factor = 1; - if (element->Name[0].TextString && - boxp->element->Name[0].TextString && 0 == NSTRCMP(element->Name[0].TextString, boxp->element->Name[0].TextString)) { - delta4 += CostParameter.matching_neighbor_bonus; - factor++; - } - if (element->Name[0].Direction == boxp->element->Name[0].Direction) - delta4 += factor * CostParameter.oriented_neighbor_bonus; - if (element->VBox.X1 == boxp->element->VBox.X1 || - element->VBox.X1 == boxp->element->VBox.X2 || - element->VBox.X2 == boxp->element->VBox.X1 || - element->VBox.X2 == boxp->element->VBox.X2 || - element->VBox.Y1 == boxp->element->VBox.Y1 || - element->VBox.Y1 == boxp->element->VBox.Y2 || - element->VBox.Y2 == boxp->element->VBox.Y1 || element->VBox.Y2 == boxp->element->VBox.Y2) - delta4 += factor * CostParameter.aligned_neighbor_bonus; - } - END_LOOP; - /* free k-d tree memory */ - r_destroy_tree(&rt_s); - r_destroy_tree(&rt_c); - } - /* penalize total area used by this layout */ - { - Coord minX = MAX_COORD, minY = MAX_COORD; - Coord maxX = -MAX_COORD, maxY = -MAX_COORD; - ELEMENT_LOOP(PCB->Data); - { - MAKEMIN(minX, element->VBox.X1); - MAKEMIN(minY, element->VBox.Y1); - MAKEMAX(maxX, element->VBox.X2); - MAKEMAX(maxY, element->VBox.Y2); - } - END_LOOP; - if (minX < maxX && minY < maxY) - delta5 = CostParameter.overall_area_penalty * sqrt(PCB_COORD_TO_MIL(maxX - minX) * PCB_COORD_TO_MIL(maxY - minY)); - } - if (T == 5) { - T = W + delta1 + delta2 + delta3 - delta4 + delta5; - printf("cost components are %.3f %.3f %.3f %.3f %.3f %.3f\n", - W / T, delta1 / T, delta2 / T, delta3 / T, -delta4 / T, delta5 / T); - } - /* done! */ - return W + (delta1 + delta2 + delta3 - delta4 + delta5); -} - -/* --------------------------------------------------------------------------- - * Perturb: - * 1) flip SMD from solder side to component side or vice-versa. - * 2) rotate component 90, 180, or 270 degrees. - * 3) shift component random + or - amount in random direction. - * (magnitude of shift decreases over time) - * -- Only perturb selected elements (need count/list of selected?) -- - */ -PerturbationType createPerturbation(PointerListTypePtr selected, double T) -{ - PerturbationType pt = { 0 }; - /* pick element to perturb */ - pt.element = (ElementTypePtr) selected->Ptr[pcb_rand() % selected->PtrN]; - /* exchange, flip/rotate or shift? */ - switch (pcb_rand() % ((selected->PtrN > 1) ? 3 : 2)) { - case 0: - { /* shift! */ - Coord grid; - double scaleX = PCB_CLAMP(sqrt(T), PCB_MIL_TO_COORD(2.5), PCB->MaxWidth / 3); - double scaleY = PCB_CLAMP(sqrt(T), PCB_MIL_TO_COORD(2.5), PCB->MaxHeight / 3); - pt.which = SHIFT; - pt.DX = scaleX * 2 * ((((double) pcb_rand()) / RAND_MAX) - 0.5); - pt.DY = scaleY * 2 * ((((double) pcb_rand()) / RAND_MAX) - 0.5); - /* snap to grid. different grids for "high" and "low" T */ - grid = (T > PCB_MIL_TO_COORD(10)) ? CostParameter.large_grid_size : CostParameter.small_grid_size; - /* (round away from zero) */ - pt.DX = ((pt.DX / grid) + SGN(pt.DX)) * grid; - pt.DY = ((pt.DY / grid) + SGN(pt.DY)) * grid; - /* limit DX/DY so we don't fall off board */ - pt.DX = MAX(pt.DX, -pt.element->VBox.X1); - pt.DX = MIN(pt.DX, PCB->MaxWidth - pt.element->VBox.X2); - pt.DY = MAX(pt.DY, -pt.element->VBox.Y1); - pt.DY = MIN(pt.DY, PCB->MaxHeight - pt.element->VBox.Y2); - /* all done but the movin' */ - break; - } - case 1: - { /* flip/rotate! */ - /* only flip if it's an SMD component */ - pcb_bool isSMD = padlist_length(&(pt.element->Pad)) != 0; - pt.which = ROTATE; - pt.rotate = isSMD ? (pcb_rand() & 3) : (1 + (pcb_rand() % 3)); - /* 0 - flip; 1-3, rotate. */ - break; - } - case 2: - { /* exchange! */ - pt.which = EXCHANGE; - pt.other = (ElementTypePtr) - selected->Ptr[pcb_rand() % (selected->PtrN - 1)]; - if (pt.other == pt.element) - pt.other = (ElementTypePtr) selected->Ptr[selected->PtrN - 1]; - /* don't allow exchanging a solderside-side SMD component - * with a non-SMD component. */ - if ((pinlist_length(&(pt.element->Pin)) != 0 /* non-SMD */ && - TEST_FLAG(PCB_FLAG_ONSOLDER, pt.other)) || (pinlist_length(&pt.other->Pin) != 0 /* non-SMD */ && - TEST_FLAG(PCB_FLAG_ONSOLDER, pt.element))) - return createPerturbation(selected, T); - break; - } - default: - assert(0); - } - return pt; -} - -void doPerturb(PerturbationType * pt, pcb_bool undo) -{ - Coord bbcx, bbcy; - /* compute center of element bounding box */ - bbcx = (pt->element->VBox.X1 + pt->element->VBox.X2) / 2; - bbcy = (pt->element->VBox.Y1 + pt->element->VBox.Y2) / 2; - /* do exchange, shift or flip/rotate */ - switch (pt->which) { - case SHIFT: - { - Coord DX = pt->DX, DY = pt->DY; - if (undo) { - DX = -DX; - DY = -DY; - } - MoveElementLowLevel(PCB->Data, pt->element, DX, DY); - return; - } - case ROTATE: - { - unsigned b = pt->rotate; - if (undo) - b = (4 - b) & 3; - /* 0 - flip; 1-3, rotate. */ - if (b) - RotateElementLowLevel(PCB->Data, pt->element, bbcx, bbcy, b); - else { - Coord y = pt->element->VBox.Y1; - MirrorElementCoordinates(PCB->Data, pt->element, 0); - /* mirroring moves the element. move it back. */ - MoveElementLowLevel(PCB->Data, pt->element, 0, y - pt->element->VBox.Y1); - } - return; - } - case EXCHANGE: - { - /* first exchange positions */ - Coord x1 = pt->element->VBox.X1; - Coord y1 = pt->element->VBox.Y1; - Coord x2 = pt->other->BoundingBox.X1; - Coord y2 = pt->other->BoundingBox.Y1; - MoveElementLowLevel(PCB->Data, pt->element, x2 - x1, y2 - y1); - MoveElementLowLevel(PCB->Data, pt->other, x1 - x2, y1 - y2); - /* then flip both elements if they are on opposite sides */ - if (TEST_FLAG(PCB_FLAG_ONSOLDER, pt->element) != TEST_FLAG(PCB_FLAG_ONSOLDER, pt->other)) { - PerturbationType mypt; - mypt.element = pt->element; - mypt.which = ROTATE; - mypt.rotate = 0; /* flip */ - doPerturb(&mypt, undo); - mypt.element = pt->other; - doPerturb(&mypt, undo); - } - /* done */ - return; - } - default: - assert(0); - } -} - -/* --------------------------------------------------------------------------- - * Auto-place selected components. - */ -pcb_bool AutoPlaceSelected(void) -{ - NetListTypePtr Nets; - PointerListType Selected = { 0, 0, NULL }; - PerturbationType pt; - double C0, T0; - pcb_bool changed = pcb_false; - - /* (initial netlist processing copied from AddAllRats) */ - /* the netlist library has the text form - * ProcNetlist fills in the Netlist - * structure the way the final routing - * is supposed to look - */ - Nets = ProcNetlist(&(PCB->NetlistLib[NETLIST_EDITED])); - if (!Nets) { - Message(PCB_MSG_DEFAULT, _("Can't add rat lines because no netlist is loaded.\n")); - goto done; - } - - Selected = collectSelectedElements(); - if (Selected.PtrN == 0) { - Message(PCB_MSG_DEFAULT, _("No elements selected to autoplace.\n")); - goto done; - } - - /* simulated annealing */ - { /* compute T0 by doing a random series of moves. */ - const int TRIALS = 10; - const double Tx = PCB_MIL_TO_COORD(300), P = 0.95; - double Cs = 0.0; - int i; - C0 = ComputeCost(Nets, Tx, Tx); - for (i = 0; i < TRIALS; i++) { - pt = createPerturbation(&Selected, PCB_INCH_TO_COORD(1)); - doPerturb(&pt, pcb_false); - Cs += fabs(ComputeCost(Nets, Tx, Tx) - C0); - doPerturb(&pt, pcb_true); - } - T0 = -(Cs / TRIALS) / log(P); - printf("Initial T: %f\n", T0); - } - /* now anneal in earnest */ - { - double T = T0; - long steps = 0; - int good_moves = 0, moves = 0; - const int good_move_cutoff = CostParameter.m * Selected.PtrN; - const int move_cutoff = 2 * good_move_cutoff; - printf("Starting cost is %.0f\n", ComputeCost(Nets, T0, 5)); - C0 = ComputeCost(Nets, T0, T); - while (1) { - double Cprime; - pt = createPerturbation(&Selected, T); - doPerturb(&pt, pcb_false); - Cprime = ComputeCost(Nets, T0, T); - if (Cprime < C0) { /* good move! */ - C0 = Cprime; - good_moves++; - steps++; - } - else if ((pcb_rand() / (double) RAND_MAX) < exp(MIN(MAX(-20, (C0 - Cprime) / T), 20))) { - /* not good but keep it anyway */ - C0 = Cprime; - steps++; - } - else - doPerturb(&pt, pcb_true); /* undo last change */ - moves++; - /* are we at the end of a stage? */ - if (good_moves >= good_move_cutoff || moves >= move_cutoff) { - printf("END OF STAGE: COST %.0f\t" "GOOD_MOVES %d\tMOVES %d\t" "T: %.1f\n", C0, good_moves, moves, T); - /* is this the end? */ - if (T < 5 || good_moves < moves / CostParameter.good_ratio) - break; - /* nope, adjust T and continue */ - moves = good_moves = 0; - T *= CostParameter.gamma; - /* cost is T dependent, so recompute */ - C0 = ComputeCost(Nets, T0, T); - } - } - changed = (steps > 0); - } -done: - if (changed) { - DeleteRats(pcb_false); - AddAllRats(pcb_false, NULL); - Redraw(); - } - FreePointerListMemory(&Selected); - return (changed); -} Index: 1.1.4/src_plugins/export_ipcd356/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/export_ipcd356/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/export_ipcd356/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {export_ipcd356} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_ipcd356/ipcd356.o @] - -switch /local/pcb/export_ipcd356/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/export_ipcd356/README =================================================================== --- 1.1.4/src_plugins/export_ipcd356/README (revision 10776) +++ 1.1.4/src_plugins/export_ipcd356/README (nonexistent) @@ -1,5 +0,0 @@ -IPC-D-356 Netlist export. - -#state: Work-in-progress -#default: disable -#implements: export Index: 1.1.4/src_plugins/export_ipcd356/Makefile =================================================================== --- 1.1.4/src_plugins/export_ipcd356/Makefile (revision 10776) +++ 1.1.4/src_plugins/export_ipcd356/Makefile (nonexistent) @@ -1,5 +0,0 @@ -all: - cd ../../src && make mod_export_ipcd356 - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/export_ipcd356/ipcd356.c =================================================================== --- 1.1.4/src_plugins/export_ipcd356/ipcd356.c (revision 10776) +++ 1.1.4/src_plugins/export_ipcd356/ipcd356.c (nonexistent) @@ -1,627 +0,0 @@ -/*! - * - * \brief IPC-D-356 Netlist export. - * - * \author Copyright (C) 2012 Jerome Marchand (Jerome.Marchand@gmail.com) - * - *
    - * - *

    Copyright.

    \n - * - * PCB, interactive printed circuit board design - * - * 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 - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include "data.h" -#include "config.h" -#include "global.h" -#include "rats.h" -#include "error.h" -#include "find.h" -#include "misc.h" -#include "pcb-printf.h" -#include "netlist.h" -#include "conf_core.h" - -#include "hid.h" -#include "hid_nogui.h" -#include "hid_helper.h" -#include "hid_attrib.h" -#include "hid_init.h" -#include "plugins.h" - -static const char *ipcd356_cookie = "ipcd356 exporter"; - -static HID_Attribute IPCD356_options[] = { -/* %start-doc options "8 IPC-D-356 Netlist Export" -@ftable @code -@item --netlist-file -Name of the IPC-D-356 Netlist output file. -@end ftable -%end-doc -*/ - { - "netlistfile", - "Name of the IPC-D-356 Netlist output file", - HID_String, - 0, 0, {0, 0, 0}, 0, 0}, -#define HA_IPCD356_filename 0 -}; - -#define NUM_OPTIONS (sizeof(IPCD356_options)/sizeof(IPCD356_options[0])) - -static HID_Attr_Val IPCD356_values[NUM_OPTIONS]; - -const char *IPCD356_filename; - -typedef struct { - char NName[11]; - char NetName[256]; -} IPCD356_Alias; - -typedef struct { - int AliasN; /*!< Number of entries. */ - IPCD356_Alias *Alias; -} IPCD356_AliasList; - -void IPCD356_WriteNet(FILE *, char *); -void IPCD356_WriteHeader(FILE *); -void IPCD356_End(FILE *); -int IPCD356_Netlist(void); -int IPCD356_WriteAliases(FILE *, IPCD356_AliasList *); -void ResetVisitPinsViasAndPads(void); -void CheckNetLength(char *, IPCD356_AliasList *); -IPCD356_AliasList *CreateAliasList(void); -IPCD356_AliasList *AddAliasToList(IPCD356_AliasList *); -int IPCD356_SanityCheck(void); - -static HID_Attribute *IPCD356_get_export_options(int *n) -{ - static char *last_IPCD356_filename = 0; - - if (PCB) { - derive_default_filename(PCB->Filename, &IPCD356_options[HA_IPCD356_filename], ".net", &last_IPCD356_filename); - } - - if (n) - *n = NUM_OPTIONS; - - return IPCD356_options; -} - -/*! - * \brief Writes the IPC-D-356 Header to the file provided. - * - * The JOB name is the PCB Name (if set), otherwise the filename - * (including the path) is used. - * - * The units used for the netlist depends on what is set (mils or mm). - */ -void IPCD356_WriteHeader(FILE * fd) -{ - time_t currenttime; - char utcTime[64]; - const char *fmt = "%c UTC"; - - currenttime = time(NULL); - strftime(utcTime, sizeof utcTime, fmt, gmtime(¤ttime)); - - fprintf(fd, "C IPC-D-356 Netlist generated by gEDA pcb-rnd " VERSION "\nC \n"); - fprintf(fd, "C File created on %s\nC \n", utcTime); - if (PCB->Name == NULL) { - fprintf(fd, "P JOB %s\n", PCB->Filename); /* Use the file name if the PCB name in not set. */ - } - else { - fprintf(fd, "P JOB %s\n", PCB->Name); - } - fprintf(fd, "P CODE 00\n"); - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { /* Use whatever unit is currently in use (mil or mm). */ - fprintf(fd, "P UNITS CUST 0\n"); - } - else { - fprintf(fd, "P UNITS CUST 1\n"); - } - fprintf(fd, "P DIM N\n"); - fprintf(fd, "P VER IPC-D-356\n"); - fprintf(fd, "P IMAGE PRIMARY\nC \n"); -} - - -/*! - * \brief Writes a net to the file provided. - * - * The net name is passed through the "net" and should be 14 characters - * max.\n - * The function scans through pads, pins and vias and looks for the - * \c PCB_FLAG_FOUND.\n - * Once the object has been added to the net list the \c PCB_FLAG_VISIT is - * set on that object. - * - * \todo 1) The bottom layer is always written as layer #2 (A02).\n - * It could output the actual layer number (example: A06 on a - * 6 layer board).\n - * But I could not find an easy way to do this... - * - * \todo 2) Objects with mutiple connections could have the "M" - * (column 32) field written to indicate a Mid Net Point. - */ -void IPCD356_WriteNet(FILE * fd, char *net) -{ - int padx, pady, tmp; - - ELEMENT_LOOP(PCB->Data); - PAD_LOOP(element); - if (TEST_FLAG(PCB_FLAG_FOUND, pad)) { - fprintf(fd, "327%-17.14s", net); /* Net Name. */ - fprintf(fd, "%-6.6s", element->Name[1].TextString); /* Refdes. */ - fprintf(fd, "-%-4.4s", pad->Number); /* pin number. */ - fprintf(fd, " "); /*! \todo Midpoint indicator (M). */ - fprintf(fd, " "); /* Drilled hole Id (blank for pads). */ - if (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) == pcb_true) { - fprintf(fd, "A02"); /*! \todo Put actual layer # for bottom side. */ - } - else { - fprintf(fd, "A01"); /* Top side. */ - } - padx = (pad->Point1.X + pad->Point2.X) / 2; /* X location in PCB units. */ - pady = (PCB->MaxHeight - ((pad->Point1.Y + pad->Point2.Y) / 2)); /* Y location in PCB units. */ - - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - padx = padx / 2540; /* X location in 0.0001". */ - pady = pady / 2540; /* Y location in 0.0001". */ - } - else { - padx = padx / 1000; /* X location in 0.001 mm. */ - pady = pady / 1000; /* Y location in 0.001 mm. */ - } - fprintf(fd, "X%+6.6d", padx); /* X Pad center. */ - fprintf(fd, "Y%+6.6d", pady); /* Y pad center. */ - - padx = (pad->Thickness + (pad->Point2.X - pad->Point1.X)); /* Pad dimension X in PCB units. */ - pady = (pad->Thickness + (pad->Point2.Y - pad->Point1.Y)); /* Pad dimension Y in PCB units. */ - - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - padx = padx / 2540; /* X location in 0.0001". */ - pady = pady / 2540; /* Y location in 0.0001". */ - } - else { - padx = padx / 1000; /* X location in 0.001mm */ - pady = pady / 1000; /* Y location in 0.001mm */ - } - - fprintf(fd, "X%4.4d", padx); - fprintf(fd, "Y%4.4d", pady); - fprintf(fd, "R000"); /* Rotation (0 degrees). */ - fprintf(fd, " "); /* Column 72 should be left blank. */ - if (pad->Mask > 0) { - if (TEST_FLAG(PCB_FLAG_ONSOLDER, pad) == pcb_true) { - fprintf(fd, "S2"); /* Soldermask on bottom side. */ - } - else { - fprintf(fd, "S1"); /* SolderMask on top side. */ - } - } - else { - fprintf(fd, "S3"); /* No soldermask. */ - } - fprintf(fd, " "); /* Padding. */ - fprintf(fd, "\n"); - SET_FLAG(PCB_FLAG_VISIT, pad); - } - - END_LOOP; /* Pad. */ - PIN_LOOP(element); - if (TEST_FLAG(PCB_FLAG_FOUND, pin)) { - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) { /* Non plated? */ - fprintf(fd, "367%-17.14s", net); /* Net Name. */ - } - else { - fprintf(fd, "317%-17.14s", net); /* Net Name. */ - } - fprintf(fd, "%-6.6s", element->Name[1].TextString); /* Refdes. */ - fprintf(fd, "-%-4.4s", pin->Number); /* Pin number. */ - fprintf(fd, " "); /*! \todo Midpoint indicator (M). */ - tmp = pin->DrillingHole; - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - tmp = tmp / 2540; /* 0.0001". */ - } - else { - tmp = tmp / 1000; /* 0.001 mm. */ - } - - if (TEST_FLAG(PCB_FLAG_HOLE, pin)) { - fprintf(fd, "D%-4.4dU", tmp); /* Unplated Drilled hole Id. */ - } - else { - fprintf(fd, "D%-4.4dP", tmp); /* Plated drill hole. */ - } - fprintf(fd, "A00"); /* Accessible from both sides. */ - padx = pin->X; /* X location in PCB units. */ - pady = (PCB->MaxHeight - pin->Y); /* Y location in PCB units. */ - - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - padx = padx / 2540; /* X location in 0.0001". */ - pady = pady / 2540; /* Y location in 0.0001". */ - } - else { - padx = padx / 1000; /* X location in 0.001 mm. */ - pady = pady / 1000; /* Y location in 0.001 mm. */ - } - - fprintf(fd, "X%+6.6d", padx); /* X Pad center. */ - fprintf(fd, "Y%+6.6d", pady); /* Y pad center. */ - - padx = pin->Thickness; - - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - padx = padx / 2540; /* X location in 0.0001". */ - } - else { - padx = padx / 1000; /* X location in 0.001 mm. */ - } - - fprintf(fd, "X%4.4d", padx); /* Pad dimension X. */ - if (TEST_FLAG(PCB_FLAG_SQUARE, pin)) { - fprintf(fd, "Y%4.4d", padx); /* Pad dimension Y. */ - } - else { - fprintf(fd, "Y0000"); /* Y is 0 for round pins. */ - } - fprintf(fd, "R000"); /* Rotation (0 degrees). */ - fprintf(fd, " "); /* Column 72 should be left blank. */ - if (pin->Mask > 0) { - fprintf(fd, "S0"); /* No Soldermask. */ - } - else { - fprintf(fd, "S3"); /* Soldermask on both sides. */ - } - fprintf(fd, " "); /* Padding. */ - - fprintf(fd, "\n"); - - SET_FLAG(PCB_FLAG_VISIT, pin); - - } - - END_LOOP; /* Pin. */ - END_LOOP; /* Element */ - - VIA_LOOP(PCB->Data); - if (TEST_FLAG(PCB_FLAG_FOUND, via)) { - if (TEST_FLAG(PCB_FLAG_HOLE, via)) { /* Non plated ? */ - fprintf(fd, "367%-17.14s", net); /* Net Name. */ - } - else { - fprintf(fd, "317%-17.14s", net); /* Net Name. */ - } - fprintf(fd, "VIA "); /* Refdes. */ - fprintf(fd, "- "); /* Pin number. */ - fprintf(fd, " "); /*! \todo Midpoint indicator (M). */ - tmp = via->DrillingHole; - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - tmp = tmp / 2540; /* 0.0001". */ - } - else { - tmp = tmp / 1000; /* 0.001 mm. */ - } - - if (TEST_FLAG(PCB_FLAG_HOLE, via)) { - fprintf(fd, "D%-4.4dU", tmp); /* Unplated Drilled hole Id. */ - } - else { - fprintf(fd, "D%-4.4dP", tmp); /* Plated drill hole. */ - } - fprintf(fd, "A00"); /* Accessible from both sides. */ - padx = via->X; /* X location in PCB units. */ - pady = (PCB->MaxHeight - via->Y); /* Y location in PCB units. */ - - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - padx = padx / 2540; /* X location in 0.0001". */ - pady = pady / 2540; /* Y location in 0.0001". */ - } - else { - padx = padx / 1000; /* X location in 0.001 mm. */ - pady = pady / 1000; /* Y location in 0.001 mm. */ - } - - fprintf(fd, "X%+6.6d", padx); /* X Pad center. */ - fprintf(fd, "Y%+6.6d", pady); /* Y pad center. */ - - padx = via->Thickness; - - if (strcmp(conf_core.editor.grid_unit->suffix, "mil") == 0) { - padx = padx / 2540; /* X location in 0.0001". */ - } - else { - padx = padx / 1000; /* X location in 0.001 mm. */ - } - - fprintf(fd, "X%4.4d", padx); /* Pad dimension X. */ - fprintf(fd, "Y0000"); /* Y is 0 for round pins (vias always round?). */ - fprintf(fd, "R000"); /* Rotation (0 degrees). */ - fprintf(fd, " "); /* Column 72 should be left blank. */ - if (via->Mask > 0) { - fprintf(fd, "S0"); /* No Soldermask. */ - } - else { - fprintf(fd, "S3"); /* Soldermask on both sides. */ - } - fprintf(fd, " "); /* Padding. */ - fprintf(fd, "\n"); - SET_FLAG(PCB_FLAG_VISIT, via); - } - - END_LOOP; /* Via. */ -} - - -/*! - * \brief The main IPC-D-356 function. - * - * Gets the filename for the netlist from the dialog. - */ -int IPCD356_Netlist(void) -{ - FILE *fp; - char nodename[256]; - char net[256]; - LibraryMenuType *netname; - IPCD356_AliasList *aliaslist; - - if (IPCD356_SanityCheck()) { /* Check for invalid names + numbers. */ - Message(PCB_MSG_ERROR, "IPCD356: aborting on the sanity check.\n"); - return (1); - } - - sprintf(net, "%s.ipc", PCB->Name); - if (IPCD356_filename == NULL) - return 1; - - fp = fopen(IPCD356_filename, "w+"); - if (fp == NULL) { - Message(PCB_MSG_ERROR, "error opening %s\n", IPCD356_filename); - return 1; - } -/* free (IPCD356_filename); */ - - - IPCD356_WriteHeader(fp); - - aliaslist = CreateAliasList(); - if (aliaslist == NULL) { - Message(PCB_MSG_ERROR, "Error Aloccating memory for IPC-D-356 AliasList\n"); - return 1; - } - - if (IPCD356_WriteAliases(fp, aliaslist)) { - Message(PCB_MSG_ERROR, "Error Writing IPC-D-356 AliasList\n"); - return 1; - } - - - ELEMENT_LOOP(PCB->Data); - PIN_LOOP(element); - if (!TEST_FLAG(PCB_FLAG_VISIT, pin)) { - ClearFlagOnLinesAndPolygons(pcb_true, PCB_FLAG_FOUND); - ClearFlagOnPinsViasAndPads(pcb_true, PCB_FLAG_FOUND); - LookupConnectionByPin(PCB_TYPE_PIN, pin); - sprintf(nodename, "%s-%s", element->Name[1].TextString, pin->Number); - netname = pcb_netnode_to_netname(nodename); -/* Message(PCB_MSG_INFO, "Netname: %s\n", netname->Name +2); */ - if (netname) { - strcpy(net, &netname->Name[2]); - CheckNetLength(net, aliaslist); - } - else { - strcpy(net, "N/C"); - } - IPCD356_WriteNet(fp, net); - } - END_LOOP; /* Pin. */ - PAD_LOOP(element); - if (!TEST_FLAG(PCB_FLAG_VISIT, pad)) { - ClearFlagOnLinesAndPolygons(pcb_true, PCB_FLAG_FOUND); - ClearFlagOnPinsViasAndPads(pcb_true, PCB_FLAG_FOUND); - LookupConnectionByPin(PCB_TYPE_PAD, pad); - sprintf(nodename, "%s-%s", element->Name[1].TextString, pad->Number); - netname = pcb_netnode_to_netname(nodename); -/* Message(PCB_MSG_INFO, "Netname: %s\n", netname->Name +2); */ - if (netname) { - strcpy(net, &netname->Name[2]); - CheckNetLength(net, aliaslist); - } - else { - strcpy(net, "N/C"); - } - IPCD356_WriteNet(fp, net); - } - END_LOOP; /* Pad. */ - - END_LOOP; /* Element. */ - - VIA_LOOP(PCB->Data); - if (!TEST_FLAG(PCB_FLAG_VISIT, via)) { - ClearFlagOnLinesAndPolygons(pcb_true, PCB_FLAG_FOUND); - ClearFlagOnPinsViasAndPads(pcb_true, PCB_FLAG_FOUND); - LookupConnectionByPin(PCB_TYPE_PIN, via); - strcpy(net, "N/C"); - IPCD356_WriteNet(fp, net); - } - END_LOOP; /* Via. */ - - IPCD356_End(fp); - fclose(fp); - free(aliaslist); - ResetVisitPinsViasAndPads(); - ClearFlagOnLinesAndPolygons(pcb_true, PCB_FLAG_FOUND); - ClearFlagOnPinsViasAndPads(pcb_true, PCB_FLAG_FOUND); - return 0; -} - -void IPCD356_End(FILE * fd) -{ - fprintf(fd, "999\n"); -} - -void ResetVisitPinsViasAndPads() -{ - VIA_LOOP(PCB->Data); - CLEAR_FLAG(PCB_FLAG_VISIT, via); - END_LOOP; /* Via. */ - ELEMENT_LOOP(PCB->Data); - PIN_LOOP(element); - CLEAR_FLAG(PCB_FLAG_VISIT, pin); - END_LOOP; /* Pin. */ - PAD_LOOP(element); - CLEAR_FLAG(PCB_FLAG_VISIT, pad); - END_LOOP; /* Pad. */ - END_LOOP; /* Element. */ -} - -int IPCD356_WriteAliases(FILE * fd, IPCD356_AliasList * aliaslist) -{ - int index; - int i; - - index = 1; - - for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) { - if (strlen(PCB->NetlistLib[NETLIST_EDITED].Menu[i].Name + 2) > 14) { - if (index == 1) { - fprintf(fd, "C Netname Aliases Section\n"); - } - aliaslist = AddAliasToList(aliaslist); - if (aliaslist == NULL) { - return 1; - } - sprintf(aliaslist->Alias[index].NName, "NNAME%-5.5d", index); - strcpy(aliaslist->Alias[index].NetName, PCB->NetlistLib[NETLIST_EDITED].Menu[i].Name + 2); - - fprintf(fd, "P %s %-58.58s\n", aliaslist->Alias[index].NName, aliaslist->Alias[index].NetName); - index++; - } - } - if (index > 1) { - fprintf(fd, "C End Netname Aliases Section\nC \n"); - } - return 0; -} - -IPCD356_AliasList *CreateAliasList() -{ - IPCD356_AliasList *aliaslist; - - aliaslist = malloc(sizeof(IPCD356_AliasList)); /* Create an alias list. */ - aliaslist->AliasN = 0; /* Initialize Number of Alias. */ - return aliaslist; -} - -IPCD356_AliasList *AddAliasToList(IPCD356_AliasList * aliaslist) -{ - aliaslist->AliasN++; - aliaslist->Alias = realloc(aliaslist->Alias, sizeof(IPCD356_Alias) * (aliaslist->AliasN + 1)); - if (aliaslist->Alias == NULL) { - return NULL; - } - return aliaslist; -} - -void CheckNetLength(char *net, IPCD356_AliasList * aliaslist) -{ - int i; - - if (strlen(net) > 14) { - for (i = 1; i <= aliaslist->AliasN; i++) { - if (strcmp(net, aliaslist->Alias[i].NetName) == 0) { - strcpy(net, aliaslist->Alias[i].NName); - } - } - } -} - -int IPCD356_SanityCheck() -{ - ELEMENT_LOOP(PCB->Data); - if (element->Name[1].TextString == '\0') { - Message(PCB_MSG_ERROR, "Error: Found unnamed element. All elements need to be named to create an IPC-D-356 netlist.\n"); - return (1); - } - END_LOOP; /* Element. */ - return (0); -} - -static void IPCD356_do_export(HID_Attr_Val * options) -{ - int i; - - if (!options) { - IPCD356_get_export_options(0); - - for (i = 0; i < NUM_OPTIONS; i++) - IPCD356_values[i] = IPCD356_options[i].default_val; - - options = IPCD356_values; - } - - IPCD356_filename = options[HA_IPCD356_filename].str_value; - if (!IPCD356_filename) - IPCD356_filename = "pcb-out.net"; - - IPCD356_Netlist(); -} - -static void IPCD356_parse_arguments(int *argc, char ***argv) -{ - hid_parse_command_line(argc, argv); -} - -HID IPCD356_hid; - -pcb_uninit_t *hid_export_ipcd356_init() -{ - memset(&IPCD356_hid, 0, sizeof(HID)); - - common_nogui_init(&IPCD356_hid); - - IPCD356_hid.struct_size = sizeof(HID); - IPCD356_hid.name = "IPC-D-356"; - IPCD356_hid.description = "Exports a IPC-D-356 Netlist"; - IPCD356_hid.exporter = 1; - - IPCD356_hid.get_export_options = IPCD356_get_export_options; - IPCD356_hid.do_export = IPCD356_do_export; - IPCD356_hid.parse_arguments = IPCD356_parse_arguments; - - hid_register_hid(&IPCD356_hid); - - hid_register_attributes(IPCD356_options, sizeof(IPCD356_options) / sizeof(IPCD356_options[0]), ipcd356_cookie, 0); - return NULL; -} - Index: 1.1.4/src_plugins/renumber/renumber.c =================================================================== --- 1.1.4/src_plugins/renumber/renumber.c (revision 10776) +++ 1.1.4/src_plugins/renumber/renumber.c (nonexistent) @@ -1,382 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * - * 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: - * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA - * haceaton@aplcomm.jhuapl.edu - * - */ -#include "config.h" -#include "global.h" -#include "data.h" -#include "action_helper.h" -#include "change.h" -#include "error.h" -#include "undo.h" -#include "misc.h" -#include "set.h" -#include "plugins.h" -#include "hid_actions.h" -#include "conf_core.h" -#include "compat_misc.h" - -#include "pcb-printf.h" - -/* --------------------------------------------------------------------------- */ - -static const char renumber_syntax[] = "Renumber()\n" "Renumber(filename)"; - -static const char renumber_help[] = - "Renumber all elements. The changes will be recorded to filename\n" - "for use in backannotating these changes to the schematic."; - -/* %start-doc actions Renumber - -%end-doc */ - -#define WTF 0 - -static int ActionRenumber(int argc, const char **argv, Coord x, Coord y) -{ - pcb_bool changed = pcb_false; - ElementTypePtr *element_list; - ElementTypePtr *locked_element_list; - unsigned int i, j, k, cnt, lock_cnt; - unsigned int tmpi; - size_t sz; - char *tmps; - const char *name; - FILE *out; - static char *default_file = NULL; - size_t cnt_list_sz = 100; - struct _cnt_list { - char *name; - unsigned int cnt; - } *cnt_list; - char **was, **is, *pin; - unsigned int c_cnt = 0, numele; - int ok; - pcb_bool free_name = pcb_false; - - if (argc < 1) { - /* - * We deal with the case where name already exists in this - * function so the GUI doesn't need to deal with it - */ - name = gui->fileselect(_("Save Renumber Annotation File As ..."), - _("Choose a file to record the renumbering to.\n" - "This file may be used to back annotate the\n" - "change to the schematics.\n"), default_file, ".eco", "eco", 0); - - free_name = pcb_true; - } - else - name = argv[0]; - - if (default_file) { - free(default_file); - default_file = NULL; - } - - if (name && *name) { - default_file = pcb_strdup(name); - } - - if ((out = fopen(name, "r"))) { - fclose(out); - if (!gui->confirm_dialog(_("File exists! Ok to overwrite?"), 0)) { - if (free_name && name) - free((char*)name); - return 0; - } - } - - if ((out = fopen(name, "w")) == NULL) { - Message(PCB_MSG_DEFAULT, _("Could not open %s\n"), name); - if (free_name && name) - free((char*)name); - return 1; - } - - if (free_name && name) - free((char*)name); - - fprintf(out, "*COMMENT* PCB Annotation File\n"); - fprintf(out, "*FILEVERSION* 20061031\n"); - - /* - * Make a first pass through all of the elements and sort them out - * by location on the board. While here we also collect a list of - * locked elements. - * - * We'll actually renumber things in the 2nd pass. - */ - numele = elementlist_length(&PCB->Data->Element); - element_list = (ElementType **) calloc(numele, sizeof(ElementTypePtr)); - locked_element_list = (ElementType **) calloc(numele, sizeof(ElementTypePtr)); - was = (char **) calloc(numele, sizeof(char *)); - is = (char **) calloc(numele, sizeof(char *)); - if (element_list == NULL || locked_element_list == NULL || was == NULL || is == NULL) { - fprintf(stderr, "calloc() failed in ActionRenumber\n"); - exit(1); - } - - - cnt = 0; - lock_cnt = 0; - ELEMENT_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_LOCK, element->Name) || TEST_FLAG(PCB_FLAG_LOCK, element)) { - /* - * add to the list of locked elements which we won't try to - * renumber and whose reference designators are now reserved. - */ - pcb_fprintf(out, - "*WARN* Element \"%s\" at %$md is locked and will not be renumbered.\n", - UNKNOWN(NAMEONPCB_NAME(element)), element->MarkX, element->MarkY); - locked_element_list[lock_cnt] = element; - lock_cnt++; - } - - else { - /* count of devices which will be renumbered */ - cnt++; - - /* search for correct position in the list */ - i = 0; - while (element_list[i] && element->MarkY > element_list[i]->MarkY) - i++; - - /* - * We have found the position where we have the first element that - * has the same Y value or a lower Y value. Now move forward if - * needed through the X values - */ - while (element_list[i] - && element->MarkY == element_list[i]->MarkY && element->MarkX > element_list[i]->MarkX) - i++; - - for (j = cnt - 1; j > i; j--) { - element_list[j] = element_list[j - 1]; - } - element_list[i] = element; - } - } - END_LOOP; - - - /* - * Now that the elements are sorted by board position, we go through - * and renumber them. - */ - - /* - * turn off the flag which requires unique names so it doesn't get - * in our way. When we're done with the renumber we will have unique - * names. - */ - - conf_force_set_bool(conf_core.editor.unique_names, 0); - - cnt_list = (struct _cnt_list *) calloc(cnt_list_sz, sizeof(struct _cnt_list)); - for (i = 0; i < cnt; i++) { - /* If there is no refdes, maybe just spit out a warning */ - if (NAMEONPCB_NAME(element_list[i])) { - /* figure out the prefix */ - tmps = pcb_strdup(NAMEONPCB_NAME(element_list[i])); - j = 0; - while (tmps[j] && (tmps[j] < '0' || tmps[j] > '9') - && tmps[j] != '?') - j++; - tmps[j] = '\0'; - - /* check the counter for this prefix */ - for (j = 0; cnt_list[j].name && (strcmp(cnt_list[j].name, tmps) != 0) - && j < cnt_list_sz; j++); - - /* grow the list if needed */ - if (j == cnt_list_sz) { - cnt_list_sz += 100; - cnt_list = (struct _cnt_list *) realloc(cnt_list, cnt_list_sz); - if (cnt_list == NULL) { - fprintf(stderr, "realloc() failed in ActionRenumber\n"); - exit(1); - } - /* zero out the memory that we added */ - for (tmpi = j; tmpi < cnt_list_sz; tmpi++) { - cnt_list[tmpi].name = NULL; - cnt_list[tmpi].cnt = 0; - } - } - - /* - * start a new counter if we don't have a counter for this - * prefix - */ - if (!cnt_list[j].name) { - cnt_list[j].name = pcb_strdup(tmps); - cnt_list[j].cnt = 0; - } - - /* - * check to see if the new refdes is already used by a - * locked element - */ - do { - ok = 1; - cnt_list[j].cnt++; - free(tmps); - - /* space for the prefix plus 1 digit plus the '\0' */ - sz = strlen(cnt_list[j].name) + 2; - - /* and 1 more per extra digit needed to hold the number */ - tmpi = cnt_list[j].cnt; - while (tmpi > 10) { - sz++; - tmpi = tmpi / 10; - } - tmps = (char *) malloc(sz * sizeof(char)); - sprintf(tmps, "%s%d", cnt_list[j].name, cnt_list[j].cnt); - - /* - * now compare to the list of reserved (by locked - * elements) names - */ - for (k = 0; k < lock_cnt; k++) { - if (strcmp(UNKNOWN(NAMEONPCB_NAME(locked_element_list[k])), tmps) == 0) { - ok = 0; - break; - } - } - - } - while (!ok); - - if (strcmp(tmps, NAMEONPCB_NAME(element_list[i])) != 0) { - fprintf(out, "*RENAME* \"%s\" \"%s\"\n", NAMEONPCB_NAME(element_list[i]), tmps); - - /* add this rename to our table of renames so we can update the netlist */ - was[c_cnt] = pcb_strdup(NAMEONPCB_NAME(element_list[i])); - is[c_cnt] = pcb_strdup(tmps); - c_cnt++; - - AddObjectToChangeNameUndoList(PCB_TYPE_ELEMENT, NULL, NULL, element_list[i], NAMEONPCB_NAME(element_list[i])); - - ChangeObjectName(PCB_TYPE_ELEMENT, element_list[i], NULL, NULL, tmps); - changed = pcb_true; - - /* we don't free tmps in this case because it is used */ - } - else - free(tmps); - } - else { - pcb_fprintf(out, "*WARN* Element at %$md has no name.\n", element_list[i]->MarkX, element_list[i]->MarkY); - } - - } - - fclose(out); - - /* restore the unique flag setting */ - conf_update(NULL); - - if (changed) { - - /* update the netlist */ - AddNetlistLibToUndoList(PCB->NetlistLib); - - /* iterate over each net */ - for (i = 0; i < PCB->NetlistLib[WTF].MenuN; i++) { - - /* iterate over each pin on the net */ - for (j = 0; j < PCB->NetlistLib[WTF].Menu[i].EntryN; j++) { - - /* figure out the pin number part from strings like U3-21 */ - tmps = pcb_strdup(PCB->NetlistLib[WTF].Menu[i].Entry[j].ListEntry); - for (k = 0; tmps[k] && tmps[k] != '-'; k++); - tmps[k] = '\0'; - pin = tmps + k + 1; - - /* iterate over the list of changed reference designators */ - for (k = 0; k < c_cnt; k++) { - /* - * if the pin needs to change, change it and quit - * searching in the list. - */ - if (strcmp(tmps, was[k]) == 0) { - char *buffer; - free((char*)PCB->NetlistLib[WTF].Menu[i].Entry[j].ListEntry); - buffer = (char *) malloc((strlen(is[k]) + 1 + strlen(pin) + 1) * sizeof(char)); - sprintf(buffer, "%s-%s", is[k], pin); - PCB->NetlistLib[WTF].Menu[i].Entry[j].ListEntry = buffer; - k = c_cnt; - } - - } - free(tmps); - } - } - for (k = 0; k < c_cnt; k++) { - free(was[k]); - free(is[k]); - } - - pcb_netlist_changed(0); - IncrementUndoSerialNumber(); - SetChangedFlag(pcb_true); - } - - free(locked_element_list); - free(element_list); - free(cnt_list); - return 0; -} - -int action_renumber_block(int argc, const char **argv, Coord x, Coord y); -int action_renumber_buffer(int argc, const char **argv, Coord x, Coord y); - - -static const char *renumber_cookie = "renumber plugin"; - -HID_Action renumber_action_list[] = { - {"Renumber", 0, ActionRenumber, - renumber_help, renumber_syntax}, - {"RenumberBlock", NULL, action_renumber_block, - NULL, NULL}, - {"RenumberBuffer", NULL, action_renumber_buffer, - NULL, NULL} -}; - -static void hid_renumber_uninit(void) -{ - hid_remove_actions_by_cookie(renumber_cookie); -} - -REGISTER_ACTIONS(renumber_action_list, renumber_cookie) - -#include "dolists.h" -pcb_uninit_t hid_renumber_init(void) -{ - REGISTER_ACTIONS(renumber_action_list, renumber_cookie) - return hid_renumber_uninit; -} Index: 1.1.4/src_plugins/renumber/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/renumber/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/renumber/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {renumber} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/renumber/renumber.o $(PLUGDIR)/renumber/renumberblock.o @] - -switch /local/pcb/renumber/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/renumber/renumberblock.c =================================================================== --- 1.1.4/src_plugins/renumber/renumberblock.c (revision 10776) +++ 1.1.4/src_plugins/renumber/renumberblock.c (nonexistent) @@ -1,121 +0,0 @@ -/*! - * \file renumberblock.c - * - * \brief RenumberBlock plug-in for PCB. - * - * \author Copyright (C) 2006 DJ Delorie - * - * \copyright Licensed under the terms of the GNU General Public - * License, version 2 or later. - * - * Original source: http://www.delorie.com/pcb/renumberblock.c - * - * Usage: RenumberBlock(oldnum,newnum) - * - * All selected elements are renumbered by adding (newnum-oldnum) to - * the existing number. I.e. RenumberBlock(100,200) will change R213 - * to R313. - * - * Usage: RenumberBuffer(oldnum,newnum) - * - * Same, but the paste buffer is renumbered. - */ - -#include -#include - -#include "config.h" -#include "global.h" -#include "data.h" -#include "hid.h" -#include "misc.h" -#include "create.h" -#include "rtree.h" -#include "undo.h" -#include "error.h" -#include "change.h" -#include "conf_core.h" - -int action_renumber_block(int argc, const char **argv, Coord x, Coord y) -{ - char num_buf[15]; - int old_base, new_base; - - if (argc < 2) { - Message(PCB_MSG_ERROR, "Usage: RenumberBlock oldnum newnum"); - return 1; - } - - old_base = atoi(argv[0]); - new_base = atoi(argv[1]); - - conf_set_editor(name_on_pcb, 1); - - ELEMENT_LOOP(PCB->Data); - { - char *refdes_split, *cp; - char *old_ref, *new_ref; - int num; - - if (!TEST_FLAG(PCB_FLAG_SELECTED, element)) - continue; - - old_ref = element->Name[1].TextString; - for (refdes_split = cp = old_ref; *cp; cp++) - if (!isdigit(*cp)) - refdes_split = cp + 1; - - num = atoi(refdes_split); - num += (new_base - old_base); - sprintf(num_buf, "%d", num); - new_ref = (char *) malloc(refdes_split - old_ref + strlen(num_buf) + 1); - memcpy(new_ref, old_ref, refdes_split - old_ref); - strcpy(new_ref + (refdes_split - old_ref), num_buf); - - AddObjectToChangeNameUndoList(PCB_TYPE_ELEMENT, NULL, NULL, element, NAMEONPCB_NAME(element)); - - ChangeObjectName(PCB_TYPE_ELEMENT, element, NULL, NULL, new_ref); - } - END_LOOP; - IncrementUndoSerialNumber(); - return 0; -} - -int action_renumber_buffer(int argc, const char **argv, Coord x, Coord y) -{ - char num_buf[15]; - int old_base, new_base; - - if (argc < 2) { - Message(PCB_MSG_ERROR, "Usage: RenumberBuffer oldnum newnum"); - return 1; - } - - old_base = atoi(argv[0]); - new_base = atoi(argv[1]); - - conf_set_editor(name_on_pcb, 1); - - ELEMENT_LOOP(PASTEBUFFER->Data); - { - char *refdes_split, *cp; - char *old_ref, *new_ref; - int num; - - old_ref = element->Name[1].TextString; - for (refdes_split = cp = old_ref; *cp; cp++) - if (!isdigit(*cp)) - refdes_split = cp + 1; - - num = atoi(refdes_split); - num += (new_base - old_base); - sprintf(num_buf, "%d", num); - new_ref = (char *) malloc(refdes_split - old_ref + strlen(num_buf) + 1); - memcpy(new_ref, old_ref, refdes_split - old_ref); - strcpy(new_ref + (refdes_split - old_ref), num_buf); - - ChangeObjectName(PCB_TYPE_ELEMENT, element, NULL, NULL, new_ref); - } - END_LOOP; - return 0; -} Index: 1.1.4/src_plugins/renumber/README =================================================================== --- 1.1.4/src_plugins/renumber/README (revision 10776) +++ 1.1.4/src_plugins/renumber/README (nonexistent) @@ -1,6 +0,0 @@ -Renumber elements (renaming them) and generate a text file for -back annotation. - -#state: works -#default: buildin -#implements: (feature) Index: 1.1.4/src_plugins/renumber/Makefile =================================================================== --- 1.1.4/src_plugins/renumber/Makefile (revision 10776) +++ 1.1.4/src_plugins/renumber/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && make mod_renumber - - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/djopt/djopt.c =================================================================== --- 1.1.4/src_plugins/djopt/djopt.c (revision 10776) +++ 1.1.4/src_plugins/djopt/djopt.c (nonexistent) @@ -1,2702 +0,0 @@ -/* - * COPYRIGHT - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * DJ Delorie, 334 North Road, Deerfield NH 03037-1110, USA - * dj@delorie.com - * - */ - -#include "config.h" -#include "conf_core.h" - -#include "global.h" - -#include -#include - - -#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 "layer.h" -#include "pcb-printf.h" -#include "plugins.h" -#include "hid_flags.h" -#include "hid_actions.h" -#include "djopt_conf.h" - -conf_djopt_t conf_djopt; - -static const char *djopt_cookie = "djopt"; - -#ifndef HAVE_RINT -#define rint(x) (ceil((x) - 0.5)) -#endif - -#define dprintf if(0)pcb_printf - -#define selected(x) TEST_FLAG (PCB_FLAG_SELECTED, (x)) -#define autorouted(x) TEST_FLAG (PCB_FLAG_AUTO, (x)) - -#define SB (PCB->Bloat+1) - -/* must be 2^N-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) - -/* Manhattan length of the longest "freckle" */ -#define LONGEST_FRECKLE 2 - -struct line_s; - -typedef struct corner_s { - int layer; - struct corner_s *next; - int x, y; - int net; - PinType *via; - PadType *pad; - PinType *pin; - int miter; - int n_lines; - struct line_s **lines; -} corner_s; - -typedef struct line_s { - int layer; - struct line_s *next; - corner_s *s, *e; - LineType *line; - char is_pad; -} line_s; - -typedef struct rect_s { - int x1, y1, x2, y2; -} rect_s; - -#define DELETE(q) (q)->layer = 0xdeadbeef -#define DELETED(q) ((q)->layer == 0xdeadbeef) - -static corner_s *corners, *next_corner = 0; -static line_s *lines; - -static int layer_groupings[MAX_LAYER]; -static char layer_type[MAX_LAYER]; -#define LT_COMPONENT 1 -#define LT_SOLDER 2 - -static const char *element_name_for(corner_s * c) -{ - ELEMENT_LOOP(PCB->Data); - { - PIN_LOOP(element); - { - if (pin == c->pin) - return element->Name[1].TextString; - } - END_LOOP; - PAD_LOOP(element); - { - if (pad == c->pad) - return element->Name[1].TextString; - } - END_LOOP; - } - END_LOOP; - return "unknown"; -} - -static const char *corner_name(corner_s * c) -{ - static char buf[4][100]; - static int bn = 0; - char *bp; - bn = (bn + 1) % 4; - - if (c->net == 0xf1eef1ee) { - sprintf(buf[bn], "\033[31m[%p freed corner]\033[0m", (void *) c); - return buf[bn]; - } - - sprintf(buf[bn], "\033[%dm[%p ", (c->pin || c->pad || c->via) ? 33 : 34, (void *) c); - bp = buf[bn] + strlen(buf[bn]); - - if (c->pin) - pcb_sprintf(bp, "pin %s:%s at %#mD", element_name_for(c), c->pin->Number, c->x, c->y); - else if (c->via) - pcb_sprintf(bp, "via at %#mD", c->x, c->y); - else if (c->pad) { - pcb_sprintf(bp, "pad %s:%s at %#mD %#mD-%#mD", - element_name_for(c), c->pad->Number, c->x, c->y, - c->pad->Point1.X, c->pad->Point1.Y, c->pad->Point2.X, c->pad->Point2.Y); - } - else - pcb_sprintf(bp, "at %#mD", c->x, c->y); - sprintf(bp + strlen(bp), " n%d l%d]\033[0m", c->n_lines, c->layer); - return buf[bn]; -} - -static int solder_layer, component_layer; - -static void dj_abort(const char *msg, ...) -{ - va_list a; - va_start(a, msg); - vprintf(msg, a); - va_end(a); - fflush(stdout); - abort(); -} - -#if 1 -#define check(c,l) -#else -#define check(c,l) check2(__LINE__,c,l) -static void check2(int srcline, corner_s * c, line_s * l) -{ - int saw_c = 0, saw_l = 0; - corner_s *cc; - line_s *ll; - int i; - - for (cc = corners; cc; cc = cc->next) { - if (DELETED(cc)) - continue; - if (cc == c) - saw_c = 1; - for (i = 0; i < cc->n_lines; i++) - if (cc->lines[i]->s != cc && cc->lines[i]->e != cc) - dj_abort("check:%d: cc has line without backref\n", srcline); - if (cc->via && (cc->x != cc->via->X || cc->y != cc->via->Y)) - dj_abort("check:%d: via not at corner\n", srcline); - if (cc->pin && (cc->x != cc->pin->X || cc->y != cc->pin->Y)) - dj_abort("check:%d: pin not at corner\n", srcline); - } - if (c && !saw_c) - dj_abort("check:%d: corner not in corners list\n", srcline); - for (ll = lines; ll; ll = ll->next) { - if (DELETED(ll)) - continue; - if (ll == l) - saw_l = 1; - for (i = 0; i < ll->s->n_lines; i++) - if (ll->s->lines[i] == ll) - break; - if (i == ll->s->n_lines) - dj_abort("check:%d: ll->s has no backref\n", srcline); - for (i = 0; i < ll->e->n_lines; i++) - if (ll->e->lines[i] == ll) - break; - if (i == ll->e->n_lines) - dj_abort("check:%d: ll->e has no backref\n", srcline); - if (!ll->is_pad - && (ll->s->x != ll->line->Point1.X - || ll->s->y != ll->line->Point1.Y || ll->e->x != ll->line->Point2.X || ll->e->y != ll->line->Point2.Y)) { - pcb_printf("line: %#mD to %#mD pcbline: %#mD to %#mD\n", - ll->s->x, ll->s->y, - ll->e->x, ll->e->y, ll->line->Point1.X, ll->line->Point1.Y, ll->line->Point2.X, ll->line->Point2.Y); - dj_abort("check:%d: line doesn't match pcbline\n", srcline); - } - } - if (l && !saw_l) - dj_abort("check:%d: line not in lines list\n", srcline); -} - -#endif - -#define SWAP(a,b) { a^=b; b^=a; a^=b; } - -static int gridsnap(Coord n) -{ - if (n <= 0) - return 0; - return n - n % (conf_core.editor.grid); -} - -/* Avoid commonly used names. */ - -static int djabs(int x) -{ - return x > 0 ? x : -x; -} - -static int djmax(int x, int y) -{ - return x > y ? x : y; -} - -static int djmin(int x, int y) -{ - return x < y ? x : y; -} - -/* - * 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. - */ -static int dist(int x1, int y1, int x2, int y2) -{ - double dx1, dy1, dx2, dy2, d; - - dx1 = (double) x1; - dy1 = (double) y1; - dx2 = (double) x2; - dy2 = (double) y2; - - d = sqrt((dx1 - dx2) * (dx1 - dx2) + (dy1 - dy2) * (dy1 - dy2)); - d = rint(d); - - return (int) d; -} - -static int line_length(line_s * l) -{ - if (l->s->x == l->e->x) - return djabs(l->s->y - l->e->y); - if (l->s->y == l->e->y) - return djabs(l->s->x - l->e->x); - return dist(l->s->x, l->s->y, l->e->x, l->e->y); -} - -static int dist_ltp2(int dx, int y, int y1, int y2) -{ - if (y1 > y2) - SWAP(y1, y2); - if (y < y1) - return dist(dx, y, 0, y1); - if (y > y2) - return dist(dx, y, 0, y2); - return djabs(dx); -} - -int sqr(int a) -{ - return a * a; -} - -static int intersecting_layers(int l1, int l2) -{ - if (l1 == -1 || l2 == -1) - return 1; - if (l1 == l2) - return 1; - if (layer_groupings[l1] == layer_groupings[l2]) - return 1; - return 0; -} - -static int dist_line_to_point(line_s * l, corner_s * c) -{ - double len, r, d; - /* We can do this quickly if l is vertical or horizontal. */ - if (l->s->x == l->e->x) - return dist_ltp2(l->s->x - c->x, c->y, l->s->y, l->e->y); - if (l->s->y == l->e->y) - return dist_ltp2(l->s->y - c->y, c->x, l->s->x, l->e->x); - - /* Do it the hard way. See comments for IsPointOnLine() in search.c */ - len = sqrt(sqr(l->s->x - l->e->x) + sqr(l->s->y - l->e->y)); - if (len == 0) - return dist(l->s->x, l->s->y, c->x, c->y); - r = (l->s->y - c->y) * (l->s->y - l->e->y) + (l->s->x - c->x) * (l->s->x - l->e->x); - r /= len * len; - if (r < 0) - return dist(l->s->x, l->s->y, c->x, c->y); - if (r > 1) - return dist(l->e->x, l->e->y, c->x, c->y); - d = (l->e->y - l->s->y) * (c->x * l->s->x) + (l->e->x - l->s->x) * (c->y - l->s->y); - return (int) (d / len); -} - -static int line_orient(line_s * l, corner_s * c) -{ - int x1, y1, x2, y2; - if (c == l->s) { - x1 = l->s->x; - y1 = l->s->y; - x2 = l->e->x; - y2 = l->e->y; - } - else { - x1 = l->e->x; - y1 = l->e->y; - x2 = l->s->x; - y2 = l->s->y; - } - if (x1 == x2) { - if (y1 < y2) - return DOWN; - return UP; - } - else if (y1 == y2) { - if (x1 < x2) - return RIGHT; - return LEFT; - } - return DIAGONAL; -} - -#if 0 -/* Not used */ -static corner_s *common_corner(line_s * l1, line_s * l2) -{ - if (l1->s == l2->s || l1->s == l2->e) - return l1->s; - if (l1->e == l2->s || l1->e == l2->e) - return l1->e; - dj_abort("common_corner: no common corner found\n"); - return NULL; -} -#endif - -static corner_s *other_corner(line_s * l, corner_s * c) -{ - if (l->s == c) - return l->e; - if (l->e == c) - return l->s; - dj_abort("other_corner: neither corner passed\n"); - return NULL; -} - -static corner_s *find_corner_if(int x, int y, int l) -{ - corner_s *c; - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (c->x != x || c->y != y) - continue; - if (!(c->layer == -1 || intersecting_layers(c->layer, l))) - continue; - return c; - } - return 0; -} - -static corner_s *find_corner(int x, int y, int l) -{ - corner_s *c; - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (c->x != x || c->y != y) - continue; - if (!(c->layer == -1 || intersecting_layers(c->layer, l))) - continue; - return c; - } - c = (corner_s *) malloc(sizeof(corner_s)); - c->next = corners; - corners = c; - c->x = x; - c->y = y; - c->net = 0; - c->via = 0; - c->pad = 0; - c->pin = 0; - c->layer = l; - c->n_lines = 0; - c->lines = (line_s **) malloc(INC * sizeof(line_s *)); - return c; -} - -static void add_line_to_corner(line_s * l, corner_s * c) -{ - int n; - n = (c->n_lines + 1 + INC) & ~INC; - c->lines = (line_s **) realloc(c->lines, n * sizeof(line_s *)); - c->lines[c->n_lines] = l; - c->n_lines++; - dprintf("add_line_to_corner %#mD\n", c->x, c->y); -} - -static LineType *create_pcb_line(int layer, int x1, int y1, int x2, int y2, int thick, int clear, FlagType flags) -{ - char *from, *to; - LineType *nl; - LayerType *lyr = LAYER_PTR(layer); - - from = (char *) linelist_first(&lyr->Line); - nl = CreateNewLineOnLayer(PCB->Data->Layer + layer, x1, y1, x2, y2, thick, clear, flags); - AddObjectToCreateUndoList(PCB_TYPE_LINE, lyr, nl, nl); - - to = (char *) linelist_first(&lyr->Line); - if (from != to) { - line_s *lp; - for (lp = lines; lp; lp = lp->next) { - if (DELETED(lp)) - continue; - if ((char *) (lp->line) >= from && (char *) (lp->line) <= from + linelist_length(&lyr->Line) * sizeof(LineType)) - lp->line = (LineType *) ((char *) (lp->line) + (to - from)); - } - } - return nl; -} - -static void new_line(corner_s * s, corner_s * e, int layer, LineType * example) -{ - line_s *ls; - - if (layer >= max_copper_layer) - dj_abort("layer %d\n", layer); - - if (example == NULL) - dj_abort("NULL example passed to new_line()\n", layer); - - if (s->x == e->x && s->y == e->y) - return; - - ls = (line_s *) malloc(sizeof(line_s)); - ls->next = lines; - lines = ls; - ls->is_pad = 0; - ls->s = s; - ls->e = e; - ls->layer = layer; -#if 0 - if ((example->Point1.X == s->x && example->Point1.Y == s->y && example->Point2.X == e->x && example->Point2.Y == e->y) - || (example->Point2.X == s->x && example->Point2.Y == s->y && example->Point1.X == e->x && example->Point1.Y == e->y)) { - ls->line = example; - } - else -#endif - { - LineType *nl; - dprintf - ("New line \033[35m%#mD to %#mD from l%d t%#mS c%#mS f%s\033[0m\n", - s->x, s->y, e->x, e->y, layer, example->Thickness, example->Clearance, flags_to_string(example->Flags, PCB_TYPE_LINE)); - nl = create_pcb_line(layer, s->x, s->y, e->x, e->y, example->Thickness, example->Clearance, example->Flags); - - if (!nl) - dj_abort("can't create new line!"); - ls->line = nl; - } - add_line_to_corner(ls, s); - add_line_to_corner(ls, e); - check(s, ls); - check(e, ls); -} - -#if 0 -/* Not used */ -static int c_orth_to(corner_s * c, line_s * l, int o) -{ - int i, o2; - int rv = 0; - for (i = 0; i < c->n_lines; i++) { - if (c->lines[i] == l) - continue; - o2 = line_orient(c->lines[i], c); - if (ORIENT(o) == ORIENT(o2) || o2 == DIAGONAL) - return 0; - rv++; - } - return rv; -} -#endif - -static line_s *other_line(corner_s * c, line_s * l) -{ - int i; - line_s *rv = 0; - if (c->pin || c->pad || c->via) - return 0; - for (i = 0; i < c->n_lines; i++) { - if (c->lines[i] == l) - continue; - if (rv) - return 0; - rv = c->lines[i]; - } - return rv; -} - -static void empty_rect(rect_s * rect) -{ - rect->x1 = rect->y1 = INT_MAX; - rect->x2 = rect->y2 = INT_MIN; -} - -static void add_point_to_rect(rect_s * rect, int x, int y, int w) -{ - if (rect->x1 > x - w) - rect->x1 = x - w; - if (rect->x2 < x + w) - rect->x2 = x + w; - if (rect->y1 > y - w) - rect->y1 = y - w; - if (rect->y2 < y + w) - rect->y2 = y + w; -} - -static void add_line_to_rect(rect_s * rect, line_s * l) -{ - add_point_to_rect(rect, l->s->x, l->s->y, 0); - add_point_to_rect(rect, l->e->x, l->e->y, 0); -} - -static int pin_in_rect(rect_s * r, int x, int y, int w) -{ - if (x < r->x1 && x + w < r->x1) - return 0; - if (x > r->x2 && x - w > r->x2) - return 0; - if (y < r->y1 && y + w < r->y1) - return 0; - if (y > r->y2 && y - w > r->y2) - return 0; - return 1; -} - -static int line_in_rect(rect_s * r, line_s * l) -{ - rect_s lr; - empty_rect(&lr); - add_point_to_rect(&lr, l->s->x, l->s->y, l->line->Thickness / 2); - add_point_to_rect(&lr, l->e->x, l->e->y, l->line->Thickness / 2); - dprintf("line_in_rect %#mD-%#mD vs %#mD-%#mD\n", r->x1, r->y1, r->x2, r->y2, lr.x1, lr.y1, lr.x2, lr.y2); - /* simple intersection of rectangles */ - if (lr.x1 < r->x1) - lr.x1 = r->x1; - if (lr.x2 > r->x2) - lr.x2 = r->x2; - if (lr.y1 < r->y1) - lr.y1 = r->y1; - if (lr.y2 > r->y2) - lr.y2 = r->y2; - if (lr.x1 < lr.x2 && lr.y1 < lr.y2) - return 1; - return 0; -} - -static int corner_radius(corner_s * c) -{ - int diam = 0; - int i; - if (c->pin) - diam = djmax(c->pin->Thickness, diam); - if (c->via) - diam = djmax(c->via->Thickness, diam); - for (i = 0; i < c->n_lines; i++) - if (c->lines[i]->line) - diam = djmax(c->lines[i]->line->Thickness, diam); - diam = (diam + 1) / 2; - return diam; -} - -#if 0 -/* Not used */ -static int corner_layer(corner_s * c) -{ - if (c->pin || c->via) - return -1; - if (c->n_lines < 1) - return -1; - return c->lines[0]->layer; -} -#endif - -static void add_corner_to_rect_if(rect_s * rect, corner_s * c, rect_s * e) -{ - int diam = corner_radius(c); - if (!pin_in_rect(e, c->x, c->y, diam)) - return; - if (c->x < e->x1 && c->y < e->y1 && dist(c->x, c->y, e->x1, e->y1) > diam) - return; - if (c->x > e->x2 && c->y < e->y1 && dist(c->x, c->y, e->x2, e->y1) > diam) - return; - if (c->x < e->x1 && c->y > e->y2 && dist(c->x, c->y, e->x1, e->y2) > diam) - return; - if (c->x > e->x2 && c->y > e->y2 && dist(c->x, c->y, e->x2, e->y2) > diam) - return; - - /*pcb_printf("add point %#mD diam %#mS\n", c->x, c->y, diam); */ - add_point_to_rect(rect, c->x, c->y, diam); -} - -static void remove_line(line_s * l) -{ - int i, j; - LayerType *layer = &(PCB->Data->Layer[l->layer]); - - check(0, 0); - - if (l->line) - RemoveLine(layer, l->line); - - DELETE(l); - - for (i = 0, j = 0; i < l->s->n_lines; i++) - if (l->s->lines[i] != l) - l->s->lines[j++] = l->s->lines[i]; - l->s->n_lines = j; - - for (i = 0, j = 0; i < l->e->n_lines; i++) - if (l->e->lines[i] != l) - l->e->lines[j++] = l->e->lines[i]; - l->e->n_lines = j; - check(0, 0); -} - -static void move_line_to_layer(line_s * l, int layer) -{ - LayerType *ls, *ld; - - ls = LAYER_PTR(l->layer); - ld = LAYER_PTR(layer); - - MoveObjectToLayer(PCB_TYPE_LINE, ls, l->line, 0, ld, 0); - l->layer = layer; -} - -static void remove_via_at(corner_s * c) -{ - RemoveObject(PCB_TYPE_VIA, c->via, 0, 0); - c->via = 0; -} - -static void remove_corner(corner_s * c2) -{ - corner_s *c; - dprintf("remove corner %s\n", corner_name(c2)); - if (corners == c2) - corners = c2->next; - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (c->next == c2) - c->next = c2->next; - } - if (next_corner == c2) - next_corner = c2->next; - free(c2->lines); - c2->lines = 0; - DELETE(c2); -} - -static void merge_corners(corner_s * c1, corner_s * c2) -{ - int i; - if (c1 == c2) - abort(); - dprintf("merge corners %s %s\n", corner_name(c1), corner_name(c2)); - for (i = 0; i < c2->n_lines; i++) { - add_line_to_corner(c2->lines[i], c1); - if (c2->lines[i]->s == c2) - c2->lines[i]->s = c1; - if (c2->lines[i]->e == c2) - c2->lines[i]->e = c1; - } - if (c1->via && c2->via) - remove_via_at(c2); - else if (c2->via) - c1->via = c2->via; - if (c2->pad) - c1->pad = c2->pad; - if (c2->pin) - c1->pin = c2->pin; - if (c2->layer != c1->layer) - c1->layer = -1; - - remove_corner(c2); -} - -static void move_corner(corner_s * c, int x, int y) -{ - PinType *via; - int i; - corner_s *pad; - - check(c, 0); - if (c->pad || c->pin) - dj_abort("move_corner: has pin or pad\n"); - dprintf("move_corner %p from %#mD to %#mD\n", (void *) c, c->x, c->y, x, y); - pad = find_corner_if(x, y, c->layer); - c->x = x; - c->y = y; - via = c->via; - if (via) { - MoveObject(PCB_TYPE_VIA, via, via, via, x - via->X, y - via->Y); - dprintf("via move %#mD to %#mD\n", via->X, via->Y, x, y); - } - for (i = 0; i < c->n_lines; i++) { - LineTypePtr tl = c->lines[i]->line; - if (tl) { - if (c->lines[i]->s == c) { - MoveObject(PCB_TYPE_LINE_POINT, LAYER_PTR(c->lines[i]->layer), tl, &tl->Point1, x - (tl->Point1.X), y - (tl->Point1.Y)); - } - else { - MoveObject(PCB_TYPE_LINE_POINT, LAYER_PTR(c->lines[i]->layer), tl, &tl->Point2, x - (tl->Point2.X), y - (tl->Point2.Y)); - } - dprintf("Line %p moved to %#mD %#mD\n", (void *) tl, tl->Point1.X, tl->Point1.Y, tl->Point2.X, tl->Point2.Y); - } - } - if (pad && pad != c) - merge_corners(c, pad); - else - for (i = 0; i < c->n_lines; i++) { - if (c->lines[i]->s->x == c->lines[i]->e->x && c->lines[i]->s->y == c->lines[i]->e->y) { - corner_s *c2 = other_corner(c->lines[i], c); - dprintf("move_corner: removing line %#mD %#mD %p %p\n", c->x, c->y, c2->x, c2->y, (void *) c, (void *) c2); - - remove_line(c->lines[i]); - if (c != c2) - merge_corners(c, c2); - check(c, 0); - i--; - break; - } - } - gui->progress(0, 0, 0); - check(c, 0); -} - -static int any_line_selected() -{ - line_s *l; - for (l = lines; l; l = l->next) { - if (DELETED(l)) - continue; - if (l->line && selected(l->line)) - return 1; - } - return 0; -} - -static int trim_step(int s, int l1, int l2) -{ - dprintf("trim %d %d %d\n", s, l1, l2); - if (s > l1) - s = l1; - if (s > l2) - s = l2; - if (s != l1 && s != l2) - s = gridsnap(s); - return s; -} - -static int canonicalize_line(line_s * l); - -static int split_line(line_s * l, corner_s * c) -{ - int i; - LineType *pcbline; - line_s *ls; - - if (!intersecting_layers(l->layer, c->layer)) - return 0; - if (l->is_pad) - return 0; - if (c->pad) { - dprintf("split on pad!\n"); - if (l->s->pad == c->pad || l->e->pad == c->pad) - return 0; - dprintf("splitting...\n"); - } - - check(c, l); - pcbline = create_pcb_line(l->layer, c->x, c->y, l->e->x, l->e->y, l->line->Thickness, l->line->Clearance, l->line->Flags); - if (pcbline == 0) - return 0; /* already a line there */ - - check(c, l); - - dprintf("split line from %#mD to %#mD at %#mD\n", l->s->x, l->s->y, l->e->x, l->e->y, c->x, c->y); - ls = (line_s *) malloc(sizeof(line_s)); - - ls->next = lines; - lines = ls; - ls->is_pad = 0; - ls->s = c; - ls->e = l->e; - ls->line = pcbline; - ls->layer = l->layer; - for (i = 0; i < l->e->n_lines; i++) - if (l->e->lines[i] == l) - l->e->lines[i] = ls; - l->e = c; - add_line_to_corner(l, c); - add_line_to_corner(ls, c); - - MoveObject(PCB_TYPE_LINE_POINT, LAYER_PTR(l->layer), l->line, &l->line->Point2, - c->x - (l->line->Point2.X), c->y - (l->line->Point2.Y)); - - return 1; -} - -static int canonicalize_line(line_s * l) -{ - /* This could be faster */ - corner_s *c; - if (l->s->x == l->e->x) { - int y1 = l->s->y; - int y2 = l->e->y; - int x1 = l->s->x - l->line->Thickness / 2; - int x2 = l->s->x + l->line->Thickness / 2; - if (y1 > y2) { - int t = y1; - y1 = y2; - y2 = t; - } - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if ((y1 < c->y && c->y < y2) - && intersecting_layers(l->layer, c->layer)) { - if (c->x != l->s->x && c->x < x2 && c->x > x1 && !(c->pad || c->pin)) { - move_corner(c, l->s->x, c->y); - } - if (c->x == l->s->x) { - /* FIXME: if the line is split, we have to re-canonicalize - both segments. */ - return split_line(l, c); - } - } - } - } - else if (l->s->y == l->e->y) { - int x1 = l->s->x; - int x2 = l->e->x; - int y1 = l->s->y - l->line->Thickness / 2; - int y2 = l->s->y + l->line->Thickness / 2; - if (x1 > x2) { - int t = x1; - x1 = x2; - x2 = t; - } - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if ((x1 < c->x && c->x < x2) - && intersecting_layers(l->layer, c->layer)) { - if (c->y != l->s->y && c->y < y2 && c->y > y1 && !(c->pad || c->pin)) { - move_corner(c, c->x, l->s->y); - } - if (c->y == l->s->y) { - /* FIXME: Likewise. */ - return split_line(l, c); - } - } - } - } - else { - /* diagonal lines. Let's try to split them at pins/vias - anyway. */ - int x1 = l->s->x; - int x2 = l->e->x; - int y1 = l->s->y; - int y2 = l->e->y; - if (x1 > x2) { - int t = x1; - x1 = x2; - x2 = t; - } - if (y1 > y2) { - int t = y1; - y1 = y2; - y2 = t; - } - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (!c->via && !c->pin) - continue; - if ((x1 < c->x && c->x < x2) - && (y1 < c->y && c->y < y2) - && intersecting_layers(l->layer, c->layer)) { - int th = c->pin ? c->pin->Thickness : c->via->Thickness; - th /= 2; - if (dist(l->s->x, l->s->y, c->x, c->y) > th - && dist(l->e->x, l->e->y, c->x, c->y) > th && PinLineIntersect(c->pin ? c->pin : c->via, l->line)) { - return split_line(l, c); - } - } - } - } - return 0; -} - -/* Make sure all vias are at line end points */ -static int canonicalize_lines() -{ - int changes = 0; - int count; - line_s *l; - while (1) { - count = 0; - for (l = lines; l; l = l->next) { - if (DELETED(l)) - continue; - count += canonicalize_line(l); - } - changes += count; - if (count == 0) - break; - } - return changes; -} - -static int simple_optimize_corner(corner_s * c) -{ - int i; - int rv = 0; - - check(c, 0); - if (c->via) { - /* see if no via is needed */ - if (selected(c->via)) - dprintf("via check: line[0] layer %d at %#mD nl %d\n", c->lines[0]->layer, c->x, c->y, c->n_lines); - /* We can't delete vias that connect to power planes, or vias - that aren't tented (assume they're test points). */ - if (!TEST_ANY_THERMS(c->via) - && c->via->Mask == 0) { - for (i = 1; i < c->n_lines; i++) { - if (selected(c->via)) - dprintf(" line[%d] layer %d %#mD to %#mD\n", - i, c->lines[i]->layer, c->lines[i]->s->x, c->lines[i]->s->y, c->lines[i]->e->x, c->lines[i]->e->y); - if (c->lines[i]->layer != c->lines[0]->layer) - break; - } - if (i == c->n_lines) { - if (selected(c->via)) - dprintf(" remove it\n"); - remove_via_at(c); - rv++; - } - } - } - - check(c, 0); - if (c->n_lines == 2 && !c->via) { - /* see if it is an unneeded corner */ - int o = line_orient(c->lines[0], c); - corner_s *c2 = other_corner(c->lines[1], c); - corner_s *c0 = other_corner(c->lines[0], c); - if (o == line_orient(c->lines[1], c2) && o != DIAGONAL) { - dprintf("straight %#mD to %#mD to %#mD\n", c0->x, c0->y, c->x, c->y, c2->x, c2->y); - if (selected(c->lines[0]->line)) - SET_FLAG(PCB_FLAG_SELECTED, c->lines[1]->line); - if (selected(c->lines[1]->line)) - SET_FLAG(PCB_FLAG_SELECTED, c->lines[0]->line); - move_corner(c, c2->x, c2->y); - } - } - check(c, 0); - if (c->n_lines == 1 && !c->via) { - corner_s *c0 = other_corner(c->lines[0], c); - if (abs(c->x - c0->x) + abs(c->y - c0->y) <= LONGEST_FRECKLE) { - /* - * Remove this line, as it is a "freckle". A freckle is an extremely - * short line (around 0.01 thou) that is unconnected at one end. - * Freckles are almost insignificantly small, but are annoying as - * they prevent the mitering optimiser from working. - * Freckles sometimes arise because of a bug in the autorouter that - * causes it to create small overshoots (typically 0.01 thou) at the - * intersections of vertical and horizontal lines. These overshoots - * are converted to freckles as a side effect of canonicalize_line(). - * Note that canonicalize_line() is not at fault, the bug is in the - * autorouter creating overshoots. - * The autorouter bug arose some time between the 20080202 and 20091103 - * releases. - * This code is probably worth keeping even when the autorouter bug is - * fixed, as "freckles" could conceivably arise in other ways. - */ - dprintf("freckle %#mD to %#mD\n", c->x, c->y, c0->x, c0->y); - move_corner(c, c0->x, c0->y); - } - } - check(c, 0); - return rv; -} - -/* We always run these */ -static int simple_optimizations() -{ - corner_s *c; - int rv = 0; - - /* Look for corners that aren't */ - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (c->pad || c->pin) - continue; - rv += simple_optimize_corner(c); - } - return rv; -} - -static int is_hole(corner_s * c) -{ - return c->pin || c->pad || c->via; -} - -static int orthopull_1(corner_s * c, int fdir, int rdir, int any_sel) -{ - static corner_s **cs = 0; - static int cm = 0; - static line_s **ls = 0; - static int lm = 0; - int i, li, ln, cn, snap; - line_s *l = 0; - corner_s *c2, *cb; - int adir = 0, sdir = 0, pull; - int saw_sel = 0, saw_auto = 0; - int max, len = 0, r1 = 0, r2; - rect_s rr; - int edir = 0, done; - - if (cs == 0) { - cs = (corner_s **) malloc(10 * sizeof(corner_s)); - cm = 10; - ls = (line_s **) malloc(10 * sizeof(line_s)); - lm = 10; - } - - for (i = 0; i < c->n_lines; i++) { - int o = line_orient(c->lines[i], c); - if (o == rdir) - return 0; - } - - switch (fdir) { - case RIGHT: - adir = DOWN; - sdir = UP; - break; - case DOWN: - adir = RIGHT; - sdir = LEFT; - break; - default: - dj_abort("fdir not right or down\n"); - } - - c2 = c; - cn = 0; - ln = 0; - pull = 0; - while (c2) { - if (c2->pad || c2->pin || c2->n_lines < 2) - return 0; - if (cn >= cm) { - cm = cn + 10; - cs = (corner_s **) realloc(cs, cm * sizeof(corner_s)); - } - cs[cn++] = c2; - r2 = corner_radius(c2); - if (r1 < r2) - r1 = r2; - l = 0; - for (i = 0; i < c2->n_lines; i++) { - int o = line_orient(c2->lines[i], c2); - if (o == DIAGONAL) - return 0; - if (o == fdir) { - if (l) - return 0; /* we don't support overlapping lines yet */ - l = c2->lines[i]; - } - if (o == rdir && c2->lines[i] != ls[ln - 1]) - return 0; /* likewise */ - if (o == adir) - pull++; - if (o == sdir) - pull--; - } - if (!l) - break; - if (selected(l->line)) - saw_sel = 1; - if (autorouted(l->line)) - saw_auto = 1; - if (ln >= lm) { - lm = ln + 10; - ls = (line_s **) realloc(ls, lm * sizeof(line_s)); - } - ls[ln++] = l; - c2 = other_corner(l, c2); - } - if (cn < 2 || pull == 0) - return 0; - if (any_sel && !saw_sel) - return 0; - if (!any_sel && conf_djopt.plugins.djopt.auto_only && !saw_auto) - return 0; - - /* Ok, now look for other blockages. */ - - empty_rect(&rr); - add_point_to_rect(&rr, c->x, c->y, corner_radius(c)); - add_point_to_rect(&rr, c2->x, c2->y, corner_radius(c2)); - - if (fdir == RIGHT && pull < 0) - edir = UP; - else if (fdir == RIGHT && pull > 0) - edir = DOWN; - else if (fdir == DOWN && pull < 0) - edir = LEFT; - else if (fdir == DOWN && pull > 0) - edir = RIGHT; - - max = -1; - for (i = 0; i < cn; i++) - for (li = 0; li < cs[i]->n_lines; li++) { - if (line_orient(cs[i]->lines[li], cs[i]) != edir) - continue; - len = line_length(cs[i]->lines[li]); - if (max > len || max == -1) - max = len; - } - dprintf("c %s %4#mD cn %d pull %3d max %4#mS\n", fdir == RIGHT ? "right" : "down ", c->x, c->y, cn, pull, max); - - switch (edir) { - case UP: - rr.y1 = c->y - r1 - max; - break; - case DOWN: - rr.y2 = c->y + r1 + max; - break; - case LEFT: - rr.x1 = c->x - r1 - max; - break; - case RIGHT: - rr.x2 = c->x + r1 + max; - break; - } - rr.x1 -= SB + 1; - rr.x2 += SB + 1; - rr.y1 -= SB + 1; - rr.y2 += SB + 1; - - snap = 0; - for (cb = corners; cb; cb = cb->next) { - int sep; - if (DELETED(cb)) - continue; - r1 = corner_radius(cb); - if (cb->net == c->net && !cb->pad) - continue; - if (!pin_in_rect(&rr, cb->x, cb->y, r1)) - continue; - switch (edir) { -#define ECHK(X,Y,LT) \ - for (i=0; ilayer, 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; ilayer, 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; }\ - } - case UP: - ECHK(x, y, >=); - break; - case DOWN: - ECHK(x, y, <=); - break; - case LEFT: - ECHK(y, x, >=); - break; - case RIGHT: - ECHK(y, x, <=); - break; - } - } - - /* We must now check every line segment against our corners. */ - for (l = lines; l; l = l->next) { - int o, x1, x2, y1, y2; - if (DELETED(l)) - continue; - dprintf("check line %#mD to %#mD\n", l->s->x, l->s->y, l->e->x, l->e->y); - if (l->s->net == c->net) { - dprintf(" same net\n"); - continue; - } - o = line_orient(l, 0); - /* We don't need to check perpendicular lines, because their - corners already take care of it. */ - if ((fdir == RIGHT && (o == UP || o == DOWN)) - || (fdir == DOWN && (o == RIGHT || o == LEFT))) { - dprintf(" perpendicular\n"); - continue; - } - - /* Choose so that x1,y1 is closest to corner C */ - if ((fdir == RIGHT && l->s->x < l->e->x) - || (fdir == DOWN && l->s->y < l->e->y)) { - x1 = l->s->x; - y1 = l->s->y; - x2 = l->e->x; - y2 = l->e->y; - } - else { - x1 = l->e->x; - y1 = l->e->y; - x2 = l->s->x; - y2 = l->s->y; - } - - /* Eliminate all lines outside our range */ - if ((fdir == RIGHT && (x2 < c->x || x1 > c2->x)) - || (fdir == DOWN && (y2 < c->y || y1 > c2->y))) { - dprintf(" outside our range\n"); - continue; - } - - /* Eliminate all lines on the wrong side of us */ - if ((edir == UP && y1 > c->y && y2 > c->y) - || (edir == DOWN && y1 < c->y && y2 < c->y) - || (edir == LEFT && x1 > c->x && x2 > c->x) - || (edir == RIGHT && x1 < c->x && x2 < c->x)) { - dprintf(" wrong side\n"); - continue; - } - - /* For now, cheat on diagonals */ - switch (edir) { - case RIGHT: - if (x1 > x2) - x1 = x2; - break; - case LEFT: - if (x1 < x2) - x1 = x2; - break; - case DOWN: - if (y1 > y2) - y1 = y2; - break; - case UP: - if (y1 < y2) - y1 = y2; - break; - } - - /* Ok, now see how far we can get for each of our corners. */ - for (i = 0; i < cn; i++) { - int r = l->line->Thickness + SB + corner_radius(cs[i]) + 1; - int len = 0; - if ((fdir == RIGHT && (x2 < cs[i]->x || x1 > cs[i]->x)) - || (fdir == DOWN && (y2 < cs[i]->y || y1 > cs[i]->y))) - continue; - if (!intersecting_layers(cs[i]->layer, l->layer)) - continue; - switch (edir) { - case RIGHT: - len = x1 - c->x; - break; - case LEFT: - len = c->x - x1; - break; - case DOWN: - len = y1 - c->y; - break; - case UP: - len = c->y - y1; - break; - } - len -= r; - dprintf(" len is %#mS vs corner at %#mD\n", len, cs[i]->x, cs[i]->y); - if (len <= 0) - return 0; - if (max > len) - max = len; - } - - } - - /* We must make sure that if a segment isn't being completely - removed, that any vias and/or pads don't overlap. */ - done = 0; - while (!done) { - done = 1; - for (i = 0; i < cn; i++) - for (li = 0; li < cs[i]->n_lines; li++) { - line_s *l = cs[i]->lines[li]; - corner_s *oc = other_corner(l, cs[i]); - if (line_orient(l, cs[i]) != edir) - continue; - len = line_length(l); - if (!oc->pad || !cs[i]->via) { - if (!is_hole(l->s) || !is_hole(l->e)) - continue; - if (len == max) - continue; - } - len -= corner_radius(l->s); - len -= corner_radius(l->e); - len -= SB + 1; - if (max > len) { - max = len; - done = 0; - } - } - } - - if (max <= 0) - return 0; - switch (edir) { - case UP: - len = c->y - max; - break; - case DOWN: - len = c->y + max; - break; - case LEFT: - len = c->x - max; - break; - case RIGHT: - len = c->x + max; - break; - } - if (snap && max > conf_core.editor.grid) { - if (pull < 0) - len += conf_core.editor.grid - 1; - len = gridsnap(len); - } - if ((fdir == RIGHT && len == cs[0]->y) || (fdir == DOWN && len == cs[0]->x)) - return 0; - for (i = 0; i < cn; i++) { - if (fdir == RIGHT) { - max = len - cs[i]->y; - move_corner(cs[i], cs[i]->x, len); - } - else { - max = len - cs[i]->x; - move_corner(cs[i], len, cs[i]->y); - } - } - return max * pull; -} - -static int orthopull() -{ - /* Look for straight runs which could be moved to reduce total trace - length. */ - int any_sel = any_line_selected(); - corner_s *c; - int rv = 0; - - for (c = corners; c;) { - if (DELETED(c)) - continue; - if (c->pin || c->pad) { - c = c->next; - continue; - } - next_corner = c; - rv += orthopull_1(c, RIGHT, LEFT, any_sel); - if (c != next_corner) { - c = next_corner; - continue; - } - rv += orthopull_1(c, DOWN, UP, any_sel); - if (c != next_corner) { - c = next_corner; - continue; - } - c = c->next; - } - if (rv) - pcb_printf("orthopull: %ml mils saved\n", rv); - return rv; -} - -static int debumpify() -{ - /* Look for "U" shaped traces we can shorten (or eliminate) */ - int rv = 0; - int any_selected = any_line_selected(); - line_s *l, *l1, *l2; - corner_s *c, *c1, *c2; - rect_s rr, rp; - int o, o1, o2, step, w; - for (l = lines; l; l = l->next) { - if (DELETED(l)) - continue; - if (!l->line) - continue; - if (any_selected && !selected(l->line)) - continue; - if (!any_selected && conf_djopt.plugins.djopt.auto_only && !autorouted(l->line)) - continue; - if (l->s->pin || l->s->pad || l->e->pin || l->e->pad) - continue; - o = line_orient(l, 0); - if (o == DIAGONAL) - continue; - l1 = other_line(l->s, l); - if (!l1) - continue; - o1 = line_orient(l1, l->s); - l2 = other_line(l->e, l); - if (!l2) - continue; - o2 = line_orient(l2, l->e); - if (ORIENT(o) == ORIENT(o1) || o1 != o2 || o1 == DIAGONAL) - continue; - - dprintf("\nline: %#mD to %#mD\n", l->s->x, l->s->y, l->e->x, l->e->y); - w = l->line->Thickness / 2 + SB + 1; - empty_rect(&rr); - add_line_to_rect(&rr, l1); - add_line_to_rect(&rr, l2); - if (rr.x1 != l->s->x && rr.x1 != l->e->x) - rr.x1 -= w; - if (rr.x2 != l->s->x && rr.x2 != l->e->x) - rr.x2 += w; - if (rr.y1 != l->s->y && rr.y1 != l->e->y) - rr.y1 -= w; - if (rr.y2 != l->s->y && rr.y2 != l->e->y) - rr.y2 += w; - dprintf("range: x %#mS..%#mS y %#mS..%#mS\n", rr.x1, rr.x2, rr.y1, rr.y2); - - c1 = other_corner(l1, l->s); - c2 = other_corner(l2, l->e); - - empty_rect(&rp); - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (c->net != l->s->net && intersecting_layers(c->layer, l->s->layer)) - add_corner_to_rect_if(&rp, c, &rr); - } - if (rp.x1 == INT_MAX) { - rp.x1 = rr.x2; - rp.x2 = rr.x1; - rp.y1 = rr.y2; - rp.y2 = rr.y1; - } - dprintf("pin r: x %#mS..%#mS y %#mS..%#mS\n", rp.x1, rp.x2, rp.y1, rp.y2); - - switch (o1) { - case LEFT: - step = l->s->x - rp.x2 - w; - step = gridsnap(step); - if (step > l->s->x - c1->x) - step = l->s->x - c1->x; - if (step > l->s->x - c2->x) - step = l->s->x - c2->x; - if (step > 0) { - dprintf("left step %#mS at %#mD\n", step, l->s->x, l->s->y); - move_corner(l->s, l->s->x - step, l->s->y); - move_corner(l->e, l->e->x - step, l->e->y); - rv += step; - } - break; - case RIGHT: - step = rp.x1 - l->s->x - w; - step = gridsnap(step); - if (step > c1->x - l->s->x) - step = c1->x - l->s->x; - if (step > c2->x - l->s->x) - step = c2->x - l->s->x; - if (step > 0) { - dprintf("right step %#mS at %#mD\n", step, l->s->x, l->s->y); - move_corner(l->s, l->s->x + step, l->s->y); - move_corner(l->e, l->e->x + step, l->e->y); - rv += step; - } - break; - case UP: - if (rp.y2 == INT_MIN) - rp.y2 = rr.y1; - step = trim_step(l->s->y - rp.y2 - w, l->s->y - c1->y, l->s->y - c2->y); - if (step > 0) { - dprintf("up step %#mS at %#mD\n", step, l->s->x, l->s->y); - move_corner(l->s, l->s->x, l->s->y - step); - move_corner(l->e, l->e->x, l->e->y - step); - rv += step; - } - break; - case DOWN: - step = rp.y1 - l->s->y - w; - step = gridsnap(step); - if (step > c1->y - l->s->y) - step = c1->y - l->s->y; - if (step > c2->y - l->s->y) - step = c2->y - l->s->y; - if (step > 0) { - dprintf("down step %#mS at %#mD\n", step, l->s->x, l->s->y); - move_corner(l->s, l->s->x, l->s->y + step); - move_corner(l->e, l->e->x, l->e->y + step); - rv += step; - } - break; - } - check(0, l); - } - - rv += simple_optimizations(); - if (rv) - pcb_printf("debumpify: %ml mils saved\n", rv / 50); - return rv; -} - -static int simple_corner(corner_s * c) -{ - int o1, o2; - if (c->pad || c->pin || c->via) - return 0; - if (c->n_lines != 2) - return 0; - o1 = line_orient(c->lines[0], c); - o2 = line_orient(c->lines[1], c); - if (ORIENT(o1) == ORIENT(o2)) - return 0; - if (ORIENT(o1) == DIAGONAL || ORIENT(o2) == DIAGONAL) - return 0; - return 1; -} - -static int unjaggy_once() -{ - /* Look for sequences of simple corners we can reduce. */ - int rv = 0; - corner_s *c, *c0, *c1, *cc; - int l, w, sel = any_line_selected(); - int o0, o1, s0, s1; - rect_s rr, rp; - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (!simple_corner(c)) - continue; - if (!c->lines[0]->line || !c->lines[1]->line) - continue; - if (sel && !(selected(c->lines[0]->line) - || selected(c->lines[1]->line))) - continue; - if (!sel && conf_djopt.plugins.djopt.auto_only && !(autorouted(c->lines[0]->line) - || autorouted(c->lines[1]->line))) - continue; - dprintf("simple at %#mD\n", c->x, c->y); - - c0 = other_corner(c->lines[0], c); - o0 = line_orient(c->lines[0], c); - s0 = simple_corner(c0); - - c1 = other_corner(c->lines[1], c); - o1 = line_orient(c->lines[1], c); - s1 = simple_corner(c1); - - if (!s0 && !s1) - continue; - dprintf("simples at %#mD\n", c->x, c->y); - - w = 1; - for (l = 0; l < c0->n_lines; l++) - if (c0->lines[l] != c->lines[0] - && c0->lines[l]->layer == c->lines[0]->layer) { - int o = line_orient(c0->lines[l], c0); - if (o == o1) - w = 0; - } - for (l = 0; l < c1->n_lines; l++) - if (c1->lines[l] != c->lines[0] - && c1->lines[l]->layer == c->lines[0]->layer) { - int o = line_orient(c1->lines[l], c1); - if (o == o0) - w = 0; - } - if (!w) - continue; - dprintf("orient ok\n"); - - w = c->lines[0]->line->Thickness / 2 + SB + 1; - empty_rect(&rr); - add_line_to_rect(&rr, c->lines[0]); - add_line_to_rect(&rr, c->lines[1]); - if (c->x != rr.x1) - rr.x1 -= w; - else - rr.x2 += w; - if (c->y != rr.y1) - rr.y1 -= w; - else - rr.y2 += w; - - empty_rect(&rp); - for (cc = corners; cc; cc = cc->next) { - if (DELETED(cc)) - continue; - if (cc->net != c->net && intersecting_layers(cc->layer, c->layer)) - add_corner_to_rect_if(&rp, cc, &rr); - } - dprintf("rp x %#mS..%#mS y %#mS..%#mS\n", rp.x1, rp.x2, rp.y1, rp.y2); - if (rp.x1 <= rp.x2) /* something triggered */ - continue; - - dprintf("unjaggy at %#mD layer %d\n", c->x, c->y, c->layer); - if (c->x == c0->x) - move_corner(c, c1->x, c0->y); - else - move_corner(c, c0->x, c1->y); - rv++; - check(c, 0); - } - rv += simple_optimizations(); - check(c, 0); - return rv; -} - -static int unjaggy() -{ - int i, r = 0, j; - for (i = 0; i < 100; i++) { - j = unjaggy_once(); - if (j == 0) - break; - r += j; - } - if (r) - printf("%d unjagg%s \n", r, r == 1 ? "y" : "ies"); - return r; -} - -static int vianudge() -{ - /* Look for vias with all lines leaving the same way, try to nudge - via to eliminate one or more of them. */ - int rv = 0; - corner_s *c, *c2, *c3; - line_s *l; - unsigned char directions[MAX_LAYER]; - unsigned char counts[MAX_LAYER]; - - memset(directions, 0, sizeof(directions)); - memset(counts, 0, sizeof(counts)); - - for (c = corners; c; c = c->next) { - int o, i, vr, cr, oboth; - int len = 0, saved = 0; - - if (DELETED(c)) - continue; - - if (!c->via) - continue; - - memset(directions, 0, sizeof(directions)); - memset(counts, 0, sizeof(counts)); - - for (i = 0; i < c->n_lines; i++) { - o = line_orient(c->lines[i], c); - counts[c->lines[i]->layer]++; - directions[c->lines[i]->layer] |= o; - } - for (o = 0, i = 0; i < max_copper_layer; i++) - if (counts[i] == 1) { - o = directions[i]; - break; - } - switch (o) { - case LEFT: - case RIGHT: - oboth = LEFT | RIGHT; - break; - case UP: - case DOWN: - oboth = UP | DOWN; - break; - default: - continue; - } - for (i = 0; i < max_copper_layer; i++) - if (counts[i] && directions[i] != o && directions[i] != oboth) - goto vianudge_continue; - - c2 = 0; - for (i = 0; i < c->n_lines; i++) { - int ll = line_length(c->lines[i]); - if (line_orient(c->lines[i], c) != o) { - saved--; - continue; - } - saved++; - if (c2 == 0 || len > ll) { - len = ll; - c2 = other_corner(c->lines[i], c); - } - } - if (c2->pad || c2->pin || c2->via) - continue; - - /* Now look for clearance in the new position */ - vr = c->via->Thickness / 2 + SB + 1; - for (c3 = corners; c3; c3 = c3->next) { - if (DELETED(c3)) - continue; - if ((c3->net != c->net && (c3->pin || c3->via)) || c3->pad) { - cr = corner_radius(c3); - if (dist(c2->x, c2->y, c3->x, c3->y) < vr + cr) - goto vianudge_continue; - } - } - for (l = lines; l; l = l->next) { - if (DELETED(l)) - continue; - if (l->s->net != c->net) { - int ld = dist_line_to_point(l, c2); - if (ld < l->line->Thickness / 2 + vr) - goto vianudge_continue; - } - } - - /* at this point, we know we can move it */ - - dprintf("vianudge: nudging via at %#mD by %#mS saving %#mS\n", c->x, c->y, len, saved); - rv += len * saved; - move_corner(c, c2->x, c2->y); - - check(c, 0); - - vianudge_continue: - continue; - } - - if (rv) - pcb_printf("vianudge: %ml mils saved\n", rv); - return rv; -} - -static int viatrim() -{ - /* 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. */ - line_s *l, *l2; - int i, rv = 0, vrm = 0; - int any_sel = any_line_selected(); - - for (l = lines; l; l = l->next) { - rect_s r; - int my_layer, other_layer; - - if (DELETED(l)) - continue; - if (!l->s->via) - continue; - if (!l->e->via) - continue; - if (any_sel && !selected(l->line)) - continue; - if (!any_sel && conf_djopt.plugins.djopt.auto_only && !autorouted(l->line)) - continue; - - my_layer = l->layer; - other_layer = -1; - dprintf("line %p on layer %d from %#mD to %#mD\n", (void *) l, l->layer, l->s->x, l->s->y, l->e->x, l->e->y); - for (i = 0; i < l->s->n_lines; i++) - if (l->s->lines[i] != l) { - if (other_layer == -1) { - other_layer = l->s->lines[i]->layer; - dprintf("noting other line %p on layer %d\n", (void *) (l->s->lines[i]), my_layer); - } - else if (l->s->lines[i]->layer != other_layer) { - dprintf("saw other line %p on layer %d (not %d)\n", (void *) (l->s->lines[i]), l->s->lines[i]->layer, my_layer); - other_layer = -1; - goto viatrim_other_corner; - } - } - viatrim_other_corner: - if (other_layer == -1) - for (i = 0; i < l->e->n_lines; i++) - if (l->e->lines[i] != l) { - if (other_layer == -1) { - other_layer = l->s->lines[i]->layer; - dprintf("noting other line %p on layer %d\n", (void *) (l->s->lines[i]), my_layer); - } - else if (l->e->lines[i]->layer != other_layer) { - dprintf("saw end line on layer %d (not %d)\n", l->e->lines[i]->layer, other_layer); - goto viatrim_continue; - } - } - - /* Now see if any other line intersects us. We don't need to - check corners, because they'd either be pins/vias and - already conflict, or pads, which we'll check here anyway. */ - empty_rect(&r); - add_point_to_rect(&r, l->s->x, l->s->y, l->line->Thickness); - add_point_to_rect(&r, l->e->x, l->e->y, l->line->Thickness); - - for (l2 = lines; l2; l2 = l2->next) { - if (DELETED(l2)) - continue; - if (l2->s->net != l->s->net && l2->layer == other_layer) { - dprintf("checking other line %#mD to %#mD\n", l2->s->x, l2->s->y, l2->e->x, l2->e->y); - if (line_in_rect(&r, l2)) { - dprintf("line from %#mD to %#mD in the way\n", l2->s->x, l2->s->y, l2->e->x, l2->e->y); - goto viatrim_continue; - } - } - } - - if (l->layer == other_layer) - continue; - move_line_to_layer(l, other_layer); - rv++; - - viatrim_continue: - continue; - } - vrm = simple_optimizations(); - if (rv > 0) - printf("viatrim: %d traces moved, %d vias removed\n", rv, vrm); - return rv + vrm; -} - -static int automagic() -{ - int more = 1, oldmore = 0; - int toomany = 100; - while (more != oldmore && --toomany) { - oldmore = more; - more += debumpify(); - more += unjaggy(); - more += orthopull(); - more += vianudge(); - more += viatrim(); - } - return more - 1; -} - -static int miter() -{ - corner_s *c; - int done, progress; - int sel = any_line_selected(); - int saved = 0; - - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - c->miter = 0; - if (c->n_lines == 2 && !c->via && !c->pin && !c->via) { - int o1 = line_orient(c->lines[0], c); - int o2 = line_orient(c->lines[1], c); - if (ORIENT(o1) != ORIENT(o2) - && o1 != DIAGONAL && o2 != DIAGONAL && c->lines[0]->line->Thickness == c->lines[1]->line->Thickness) - c->miter = -1; - } - } - - done = 0; - progress = 1; - while (!done && progress) { - done = 1; - progress = 0; - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (c->miter == -1) { - int max = line_length(c->lines[0]); - int len = line_length(c->lines[1]); - int bloat; - int ref, dist; - corner_s *closest_corner = 0, *c2, *oc1, *oc2; - int mx = 0, my = 0, x, y; - int o1 = line_orient(c->lines[0], c); - int o2 = line_orient(c->lines[1], c); - - if (c->pad || c->pin || c->via) { - c->miter = 0; - progress = 1; - continue; - } - - oc1 = other_corner(c->lines[0], c); - oc2 = other_corner(c->lines[1], c); -#if 0 - if (oc1->pad) - oc1 = 0; - if (oc2->pad) - oc2 = 0; -#endif - - if ((sel && !(selected(c->lines[0]->line) - || selected(c->lines[1]->line))) - || (!sel && conf_djopt.plugins.djopt.auto_only && !(autorouted(c->lines[0]->line) - || autorouted(c->lines[1]->line)))) { - c->miter = 0; - progress = 1; - continue; - } - - if (max > len) - max = len; - switch (o1) { - case LEFT: - mx = -1; - break; - case RIGHT: - mx = 1; - break; - case UP: - my = -1; - break; - case DOWN: - my = 1; - break; - } - switch (o2) { - case LEFT: - mx = -1; - break; - case RIGHT: - mx = 1; - break; - case UP: - my = -1; - break; - case DOWN: - my = 1; - break; - } - ref = c->x * mx + c->y * my; - dist = max; - - bloat = (c->lines[0]->line->Thickness / 2 + SB + 1) * 3 / 2; - - for (c2 = corners; c2; c2 = c2->next) { - if (DELETED(c2)) - continue; - if (c2 != c && c2 != oc1 && c2 != oc2 - && c->x * mx <= c2->x * mx - && c->y * my <= c2->y * my && c->net != c2->net && intersecting_layers(c->layer, c2->layer)) { - int cr = corner_radius(c2); - len = c2->x * mx + c2->y * my - ref - cr - bloat; - if (c->x != c2->x && c->y != c2->y) - len -= cr; - if (len < dist || (len == dist && c->miter != -1)) { - dist = len; - closest_corner = c2; - } - } - } - - if (closest_corner && closest_corner->miter == -1) { - done = 0; - continue; - } - -#if 0 - if (dist < conf_core.editor.grid) { - c->miter = 0; - progress = 1; - continue; - } - - dist -= dist % conf_core.editor.grid; -#endif - if (dist <= 0) { - c->miter = 0; - progress = 1; - continue; - } - - x = c->x; - y = c->y; - switch (o1) { - case LEFT: - x -= dist; - break; - case RIGHT: - x += dist; - break; - case UP: - y -= dist; - break; - case DOWN: - y += dist; - break; - } - c2 = find_corner(x, y, c->layer); - if (c2 != other_corner(c->lines[0], c)) - split_line(c->lines[0], c2); - x = c->x; - y = c->y; - switch (o2) { - case LEFT: - x -= dist; - break; - case RIGHT: - x += dist; - break; - case UP: - y -= dist; - break; - case DOWN: - y += dist; - break; - } - move_corner(c, x, y); - c->miter = 0; - c2->miter = 0; - progress = 1; - saved++; - } - } - } - return saved; -} - -static void classify_corner(corner_s * c, int this_net) -{ - int i; - if (c->net == this_net) - return; - c->net = this_net; - for (i = 0; i < c->n_lines; i++) - classify_corner(other_corner(c->lines[i], c), this_net); -} - -static void classify_nets() -{ - static int this_net = 1; - corner_s *c; - - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (c->net) - continue; - classify_corner(c, this_net); - this_net++; - } -} - -#if 0 -/* Not used */ -static void dump_all() -{ - corner_s *c; - line_s *l; - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - printf("%p corner %d,%d layer %d net %d\n", (void *) c, c->x, c->y, c->layer, c->net); - } - for (l = lines; l; l = l->next) { - if (DELETED(l)) - continue; - printf("%p line %p to %p layer %d\n", (void *) l, (void *) (l->s), (void *) (l->e), l->layer); - } -} -#endif - -#if 0 -static void nudge_corner(corner_s * c, int dx, int dy, corner_s * prev_corner) -{ - int ox = c->x; - int oy = c->y; - int l; - if (prev_corner && (c->pin || c->pad)) - return; - move_corner(c, ox + dx, oy + dy); - for (l = 0; l < c->n_lines; l++) { - corner_s *oc = other_corner(c->lines[l], c); - if (oc == prev_corner) - continue; - if (dx && oc->x == ox) - nudge_corner(oc, dx, 0, c); - if (dy && oc->y == oy) - nudge_corner(oc, 0, dy, c); - } -} -#endif - -static line_s *choose_example_line(corner_s * c1, corner_s * c2) -{ - int ci, li; - corner_s *c[2]; - c[0] = c1; - c[1] = c2; - dprintf("choose_example_line\n"); - for (ci = 0; ci < 2; ci++) - for (li = 0; li < c[ci]->n_lines; li++) { - dprintf(" try[%d,%d] \033[36m<%#mD-%#mD t%#mS c%#mS f%s>\033[0m\n", - ci, li, - c[ci]->lines[li]->s->x, c[ci]->lines[li]->s->y, - c[ci]->lines[li]->e->x, c[ci]->lines[li]->e->y, - c[ci]->lines[li]->line->Thickness, - c[ci]->lines[li]->line->Clearance, flags_to_string(c[ci]->lines[li]->line->Flags, PCB_TYPE_LINE)); - /* Pads are disqualified, as we want to mimic a trace line. */ - if (c[ci]->lines[li]->line == (LineTypePtr) c[ci]->pad) { - dprintf(" bad, pad\n"); - continue; - } - /* Lines on layers that don't connect to the other pad are bad too. */ - if (!intersecting_layers(c[ci]->lines[li]->layer, c[1 - ci]->layer)) { - dprintf(" bad, layers\n"); - continue; - } - dprintf(" good\n"); - return c[ci]->lines[li]; - } - dprintf("choose_example_line: none found!\n"); - return 0; -} - -static int connect_corners(corner_s * c1, corner_s * c2) -{ - int layer; - line_s *ex = choose_example_line(c1, c2); - LineType *example = ex->line; - - dprintf - ("connect_corners \033[32m%#mD to %#mD, example line %#mD to %#mD l%d\033[0m\n", - c1->x, c1->y, c2->x, c2->y, ex->s->x, ex->s->y, ex->e->x, ex->e->y, ex->layer); - - layer = ex->layer; - - /* Assume c1 is the moveable one. */ - if (!(c1->pin || c1->pad || c1->via) && c1->n_lines == 1) { - int nx, ny; - /* Extend the line */ - if (c1->lines[0]->s->x == c1->lines[0]->e->x) - nx = c1->x, ny = c2->y; - else - nx = c2->x, ny = c1->y; - if (nx != c2->x || ny != c2->y) { - move_corner(c1, nx, ny); - new_line(c1, c2, layer, example); - return 1; - } - else { - move_corner(c1, nx, ny); - return 1; - } - } - else { - corner_s *nc = find_corner(c1->x, c2->y, layer); - new_line(c1, nc, layer, example); - new_line(nc, c2, layer, example); - return 0; - } -} - -static void pinsnap() -{ - corner_s *c; - int best_dist[MAX_LAYER + 1]; - corner_s *best_c[MAX_LAYER + 1]; - int l, got_one; - int left = 0, right = 0, top = 0, bottom = 0; - PinType *pin; - int again = 1; - - int close = 0; - corner_s *c2; - - /* 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. */ - while (again) { - again = 0; - for (c = corners; c; c = c->next) { - if (DELETED(c)) - continue; - if (!(c->pin || c->via || c->pad)) - continue; - - pin = 0; - - dprintf("\ncorner %s\n", corner_name(c)); - if (c->pin || c->via) { - pin = c->pin ? c->pin : c->via; - close = pin->Thickness / 2; - left = c->x - close; - right = c->x + close; - bottom = c->y - close; - top = c->y + close; - } - else if (c->pad) { - close = c->pad->Thickness / 2 + 1; - left = djmin(c->pad->Point1.X, c->pad->Point2.X) - close; - right = djmax(c->pad->Point1.X, c->pad->Point2.X) + close; - bottom = djmin(c->pad->Point1.Y, c->pad->Point2.Y) - close; - top = djmax(c->pad->Point1.Y, c->pad->Point2.Y) + close; - if (c->pad->Point1.X == c->pad->Point2.X) { - int hy = (c->pad->Point1.Y + c->pad->Point2.Y) / 2; - dprintf("pad y %#mS %#mS hy %#mS c %#mS\n", c->pad->Point1.Y, c->pad->Point2.Y, hy, c->y); - if (c->y < hy) - top = hy; - else - bottom = hy + 1; - } - else { - int hx = (c->pad->Point1.X + c->pad->Point2.X) / 2; - dprintf("pad x %#mS %#mS hx %#mS c %#mS\n", c->pad->Point1.X, c->pad->Point2.X, hx, c->x); - if (c->x < hx) - right = hx; - else - left = hx + 1; - } - } - - dprintf("%s x %#mS-%#mS y %#mS-%#mS\n", corner_name(c), left, right, bottom, top); - for (l = 0; l <= max_copper_layer; l++) { - best_dist[l] = close * 2; - best_c[l] = 0; - } - got_one = 0; - for (c2 = corners; c2; c2 = c2->next) { - int lt; - - if (DELETED(c2)) - continue; - lt = corner_radius(c2); - if (c2->n_lines && c2 != c && !(c2->pin || c2->pad || c2->via) - && intersecting_layers(c->layer, c2->layer) - && c2->x >= left - lt && c2->x <= right + lt && c2->y >= bottom - lt && c2->y <= top + lt) { - int d = dist(c->x, c->y, c2->x, c2->y); - if (pin && d > pin->Thickness / 2 + lt) - continue; - if (c2->n_lines == 1) { - got_one++; - dprintf("found orphan %s vs %s\n", corner_name(c2), corner_name(c)); - connect_corners(c, c2); - again = 1; - continue; - } - if (best_c[c2->layer] == 0 || c2->n_lines < best_c[c2->layer]->n_lines || (d < best_dist[c2->layer] - && c2->n_lines <= - best_c[c2->layer]->n_lines)) { - best_dist[c2->layer] = d; - best_c[c2->layer] = c2; - dprintf("layer %d best now %s\n", c2->layer, corner_name(c2)); - } - } - if (!got_one && c->n_lines == (c->pad ? 1 : 0)) { - for (l = 0; l <= max_copper_layer; l++) - if (best_c[l]) - dprintf("best[%d] = %s\n", l, corner_name(best_c[l])); - for (l = 0; l <= max_copper_layer; l++) - if (best_c[l]) { - dprintf("move %s to %s\n", corner_name(best_c[l]), corner_name(c)); - connect_corners(best_c[l], c); - again = 1; - continue; - } - } - } - } - } - - /* Now look for line ends that don't connect, see if they need to be - extended to intersect another line. */ - for (c = corners; c; c = c->next) { - line_s *l, *t; - int lo; - - if (DELETED(c)) - continue; - if (c->pin || c->via || c->pad) - continue; - if (c->n_lines != 1) - continue; - - l = c->lines[0]; - lo = line_orient(l, c); - dprintf("line end %#mD orient %d\n", c->x, c->y, lo); - - for (t = lines; t; t = t->next) { - if (DELETED(t)) - continue; - if (t->layer != c->lines[0]->layer) - continue; - switch (lo) { /* remember, orient is for the line relative to the corner */ - case LEFT: - if (t->s->x == t->e->x - && c->x < t->s->x - && t->s->x < c->x + (l->line->Thickness + t->line->Thickness) / 2 && ((t->s->y < c->y && c->y < t->e->y) - || (t->e->y < c->y && c->y < t->s->y))) { - dprintf("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y); - move_corner(c, t->s->x, c->y); - } - break; - case RIGHT: - if (t->s->x == t->e->x - && c->x > t->s->x - && t->s->x > c->x - (l->line->Thickness + t->line->Thickness) / 2 && ((t->s->y < c->y && c->y < t->e->y) - || (t->e->y < c->y && c->y < t->s->y))) { - dprintf("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y); - move_corner(c, t->s->x, c->y); - } - break; - case UP: - if (t->s->y == t->e->y - && c->y < t->s->y - && t->s->y < c->y + (l->line->Thickness + t->line->Thickness) / 2 && ((t->s->x < c->x && c->x < t->e->x) - || (t->e->x < c->x && c->x < t->s->x))) { - dprintf("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y); - move_corner(c, c->x, t->s->y); - } - break; - case DOWN: - if (t->s->y == t->e->y - && c->y > t->s->y - && t->s->y > c->y - (l->line->Thickness + t->line->Thickness) / 2 && ((t->s->x < c->x && c->x < t->e->x) - || (t->e->x < c->x && c->x < t->s->x))) { - dprintf("found %#mD - %#mD\n", t->s->x, t->s->y, t->e->x, t->e->y); - move_corner(c, c->x, t->s->y); - } - break; - } - } - } -} - -static int pad_orient(PadType * p) -{ - if (p->Point1.X == p->Point2.X) - return O_VERT; - if (p->Point1.Y == p->Point2.Y) - return O_HORIZ; - return DIAGONAL; -} - -static void padcleaner() -{ - line_s *l, *nextl; - int close; - rect_s r; - - dprintf("\ndj: padcleaner\n"); - for (l = lines; l; l = nextl) { - nextl = l->next; - - if (l->is_pad) - continue; - - if (DELETED(l)) - continue; - - dprintf("dj: line %p\n", (void *) l); - check(0, l); - - if (l->s->pad && l->s->pad == l->e->pad) - continue; - - ALLPAD_LOOP(PCB->Data); - { - int layerflag = TEST_FLAG(PCB_FLAG_ONSOLDER, element) ? LT_SOLDER : LT_COMPONENT; - - if (layer_type[l->layer] != layerflag) - continue; - - empty_rect(&r); - close = pad->Thickness / 2 + 1; - add_point_to_rect(&r, pad->Point1.X, pad->Point1.Y, close - SB / 2); - add_point_to_rect(&r, pad->Point2.X, pad->Point2.Y, close - SB / 2); - if (pin_in_rect(&r, l->s->x, l->s->y, 0) - && pin_in_rect(&r, l->e->x, l->e->y, 0) - && ORIENT(line_orient(l, 0)) == pad_orient(pad)) { - dprintf - ("padcleaner %#mD-%#mD %#mS vs line %#mD-%#mD %#mS\n", - pad->Point1.X, pad->Point1.Y, pad->Point2.X, pad->Point2.Y, - pad->Thickness, l->s->x, l->s->y, l->e->x, l->e->y, l->line->Thickness); - remove_line(l); - goto next_line; - } - } - ENDALL_LOOP; - next_line:; - } -} - -static void grok_layer_groups() -{ - int i, j, f; - LayerGroupType *l = &(PCB->LayerGroups); - - solder_layer = component_layer = -1; - for (i = 0; i < max_copper_layer; i++) { - layer_type[i] = 0; - layer_groupings[i] = 0; - } - for (i = 0; i < max_group; i++) { - f = 0; - for (j = 0; j < l->Number[i]; j++) { - if (l->Entries[i][j] == solder_silk_layer) - f |= LT_SOLDER; - if (l->Entries[i][j] == component_silk_layer) - f |= LT_COMPONENT; - } - for (j = 0; j < l->Number[i]; j++) { - if (l->Entries[i][j] < max_copper_layer) { - layer_type[l->Entries[i][j]] |= f; - layer_groupings[l->Entries[i][j]] = i; - if (solder_layer == -1 && f == LT_SOLDER) - solder_layer = l->Entries[i][j]; - if (component_layer == -1 && f == LT_COMPONENT) - component_layer = l->Entries[i][j]; - } - } - } -} - -static const char djopt_syntax[] = - "djopt(debumpify|unjaggy|simple|vianudge|viatrim|orthopull)\n" "djopt(auto) - all of the above\n" "djopt(miter)"; - -static const char djopt_help[] = "Perform various optimizations on the current board."; - -/* %start-doc actions djopt - -The different types of optimizations change your board in order to -reduce the total trace length and via count. - -@table @code - -@item debumpify -Looks for U-shaped traces that can be shortened or eliminated. - -@item unjaggy -Looks for corners which could be flipped to eliminate one or more -corners (i.e. jaggy lines become simpler). - -@item simple -Removing uneeded vias, replacing two or more trace segments in a row -with a single segment. This is usually performed automatically after -other optimizations. - -@item vianudge -Looks for vias where all traces leave in the same direction. Tries to -move via in that direction to eliminate one of the traces (and thus a -corner). - -@item viatrim -Looks for traces that go from via to via, where moving that trace to a -different layer eliminates one or both vias. - -@item orthopull -Looks for chains of traces all going in one direction, with more -traces orthogonal on one side than on the other. Moves the chain in -that direction, causing a net reduction in trace length, possibly -eliminating traces and/or corners. - -@item splitlines -Looks for lines that pass through vias, pins, or pads, and splits them -into separate lines so they can be managed separately. - -@item auto -Performs the above options, repeating until no further optimizations -can be made. - -@item miter -Replaces 90 degree corners with a pair of 45 degree corners, to reduce -RF losses and trace length. - -@end table - -%end-doc */ - -static int ActionDJopt(int argc, const char **argv, Coord x, Coord y) -{ - const char *arg = argc > 0 ? argv[0] : NULL; - int layn, saved = 0; - corner_s *c; - -#ifdef ENDIF - SwitchDrawingWindow(PCB->Zoom, Output.drawing_area->window, conf_core.editor.show_solder_side, pcb_false); -#endif - - hid_action("Busy"); - - lines = 0; - corners = 0; - - grok_layer_groups(); - - ELEMENT_LOOP(PCB->Data); - PIN_LOOP(element); - { - c = find_corner(pin->X, pin->Y, -1); - c->pin = pin; - } - END_LOOP; - PAD_LOOP(element); - { - int layern = TEST_FLAG(PCB_FLAG_ONSOLDER, pad) ? solder_layer : component_layer; - line_s *ls = (line_s *) malloc(sizeof(line_s)); - ls->next = lines; - lines = ls; - ls->is_pad = 1; - ls->s = find_corner(pad->Point1.X, pad->Point1.Y, layern); - ls->s->pad = pad; - ls->e = find_corner(pad->Point2.X, pad->Point2.Y, layern); - ls->e->pad = pad; - ls->layer = layern; - ls->line = (LineTypePtr) pad; - add_line_to_corner(ls, ls->s); - add_line_to_corner(ls, ls->e); - - } - END_LOOP; - END_LOOP; - VIA_LOOP(PCB->Data); - /* hace don't mess with vias that have thermals */ - /* but then again don't bump into them - if (!TEST_FLAG(ALLTHERMFLAGS, via)) - */ - { - c = find_corner(via->X, via->Y, -1); - c->via = via; - } - END_LOOP; - check(0, 0); - - if (NSTRCMP(arg, "splitlines") == 0) { - if (canonicalize_lines()) - IncrementUndoSerialNumber(); - return 0; - } - - for (layn = 0; layn < max_copper_layer; layn++) { - LayerType *layer = LAYER_PTR(layn); - - LINE_LOOP(layer); - { - line_s *ls; - - if (conf_djopt.plugins.djopt.auto_only && !autorouted(line)) - continue; - - /* don't mess with thermals */ - if (TEST_FLAG(PCB_FLAG_USETHERMAL, line)) - continue; - - if (line->Point1.X == line->Point2.X && line->Point1.Y == line->Point2.Y) { - RemoveLine(layer, line); - continue; - } - - ls = (line_s *) malloc(sizeof(line_s)); - ls->next = lines; - lines = ls; - ls->is_pad = 0; - ls->s = find_corner(line->Point1.X, line->Point1.Y, layn); - ls->e = find_corner(line->Point2.X, line->Point2.Y, layn); - ls->line = line; - add_line_to_corner(ls, ls->s); - add_line_to_corner(ls, ls->e); - ls->layer = layn; - } - END_LOOP; - } - - check(0, 0); - pinsnap(); - canonicalize_lines(); - check(0, 0); - classify_nets(); - /*dump_all(); */ - check(0, 0); - - if (NSTRCMP(arg, "debumpify") == 0) - saved += debumpify(); - else if (NSTRCMP(arg, "unjaggy") == 0) - saved += unjaggy(); - else if (NSTRCMP(arg, "simple") == 0) - saved += simple_optimizations(); - else if (NSTRCMP(arg, "vianudge") == 0) - saved += vianudge(); - else if (NSTRCMP(arg, "viatrim") == 0) - saved += viatrim(); - else if (NSTRCMP(arg, "orthopull") == 0) - saved += orthopull(); - else if (NSTRCMP(arg, "auto") == 0) - saved += automagic(); - else if (NSTRCMP(arg, "miter") == 0) - saved += miter(); - else { - printf("unknown command: %s\n", arg); - return 1; - } - - padcleaner(); - - check(0, 0); - if (saved) - IncrementUndoSerialNumber(); - return 0; -} - -HID_Action djopt_action_list[] = { - {"djopt", 0, ActionDJopt, - djopt_help, djopt_syntax} -}; - -REGISTER_ACTIONS(djopt_action_list, djopt_cookie) - -static void hid_djopt_uninit(void) -{ - hid_remove_actions_by_cookie(djopt_cookie); - conf_unreg_fields("plugins/djopt/"); -} - -#include "dolists.h" -pcb_uninit_t hid_djopt_init(void) -{ -#define conf_reg(field,isarray,type_name,cpath,cname,desc,flags) \ - conf_reg_field(conf_djopt, field,isarray,type_name,cpath,cname,desc,flags); -#include "djopt_conf_fields.h" - - REGISTER_ACTIONS(djopt_action_list, djopt_cookie) - return hid_djopt_uninit; -} Index: 1.1.4/src_plugins/djopt/djopt.h =================================================================== --- 1.1.4/src_plugins/djopt/djopt.h (revision 10776) +++ 1.1.4/src_plugins/djopt/djopt.h (nonexistent) @@ -1,34 +0,0 @@ -/* - * COPYRIGHT - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * DJ Delorie, 334 North Road, Deerfield NH 03037-1110, USA - * dj@delorie.com - * - */ - -#ifndef PCB_DJOPT_H -#define PCB_DJOPT_H - -#include "global.h" - -int ActionDJopt(int, char **, Coord, Coord); -int djopt_set_auto_only(int, char **, Coord, Coord); -#endif Index: 1.1.4/src_plugins/djopt/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/djopt/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/djopt/Plug.tmpasm (nonexistent) @@ -1,9 +0,0 @@ -put /local/pcb/mod {djopt} -append /local/pcb/mod/OBJS [@ $(PLUGDIR)/djopt/djopt.o @] -put /local/pcb/mod/CONF {$(PLUGDIR)/djopt/djopt_conf.h} - -switch /local/pcb/djopt/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/djopt/djopt_conf.h =================================================================== --- 1.1.4/src_plugins/djopt/djopt_conf.h (revision 10776) +++ 1.1.4/src_plugins/djopt/djopt_conf.h (nonexistent) @@ -1,14 +0,0 @@ -#ifndef PCB_DJOPT_CONF_H -#define PCB_DJOPT_CONF_H - -#include "conf.h" - -typedef struct { - const struct plugins { - const struct djopt { - CFT_BOOLEAN auto_only; /* Operate on autorouted tracks only */ - } djopt; - } plugins; -} conf_djopt_t; - -#endif Index: 1.1.4/src_plugins/djopt/README =================================================================== --- 1.1.4/src_plugins/djopt/README (revision 10776) +++ 1.1.4/src_plugins/djopt/README (nonexistent) @@ -1,5 +0,0 @@ -Various board optimization algorithms. - -#state: works -#default: buildin -#implements: (feature) Index: 1.1.4/src_plugins/djopt/Makefile =================================================================== --- 1.1.4/src_plugins/djopt/Makefile (revision 10776) +++ 1.1.4/src_plugins/djopt/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && make mod_djopt - -clean: - rm *.o *.so 2>/dev/null ; true - Index: 1.1.4/src_plugins/shand_cmd/command.c =================================================================== --- 1.1.4/src_plugins/shand_cmd/command.c (revision 10776) +++ 1.1.4/src_plugins/shand_cmd/command.c (nonexistent) @@ -1,414 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996, 2005 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* executes commands from user - */ - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include - -#include "global.h" -#include "action_helper.h" -#include "buffer.h" -#include "command.h" -#include "data.h" -#include "error.h" -#include "plug_io.h" -#include "mymem.h" -#include "misc.h" -#include "rats.h" -#include "set.h" -#include "plugins.h" -#include "hid_actions.h" -#include "compat_misc.h" - -/* ---------------------------------------------------------------------- */ - -/* %start-doc actions 00macros - -@macro colonaction - -This is one of the command box helper actions. While it is a regular -action and can be used like any other action, its name and syntax are -optimized for use with the command box (@code{:}) and thus the syntax -is documented for that purpose. - -@end macro - -%end-doc */ - -/* ---------------------------------------------------------------------- */ - -static const char h_syntax[] = "h"; - -static const char h_help[] = "Print a help message for commands."; - -/* %start-doc actions h - -@colonaction - -%end-doc */ - -static int CommandHelp(int argc, const char **argv, Coord x, Coord y) -{ - Message(PCB_MSG_DEFAULT, "following commands are supported:\n" - " Command() execute an action command (too numerous to list)\n" - " see the manual for the list of action commands\n" - " h display this help message\n" - " l [file] load layout\n" - " le [file] load element to buffer\n" - " m [file] load layout to buffer (merge)\n" - " q quits the application\n" - " q! quits without save warning\n" - " rn [file] read in a net-list file\n" - " s [file] save layout\n" " w [file] save layout\n" " wq [file] save layout and quit\n"); - return (0); -} - -/* ---------------------------------------------------------------------- */ - -static const char l_syntax[] = "l [name] [format]"; - -static const char l_help[] = "Loads layout data."; - -/* %start-doc actions l - -Loads a new datafile (layout) and, if confirmed, overwrites any -existing unsaved data. The filename and the searchpath -(@emph{filePath}) are passed to the command defined by -@emph{fileCommand}. If no filename is specified a file select box -will popup. - -@colonaction - -%end-doc */ - -static int CommandLoadLayout(int argc, const char **argv, Coord x, Coord y) -{ - const char *filename, *format = NULL; - - switch (argc) { - case 2: - format = argv[1]; - case 1: /* filename is passed in commandline */ - filename = argv[0]; - break; - - default: /* usage */ - Message(PCB_MSG_DEFAULT, "Usage: l [name]\n loads layout data\n"); - return (1); - } - - if (!PCB->Changed || gui->confirm_dialog("OK to override layout data?", 0)) - LoadPCB(filename, format, pcb_true, 0); - return (0); -} - -/* --------------------------------------------------------------------------- */ - -static const char le_syntax[] = "le [name]"; - -static const char le_help[] = "Loads an element into the current buffer."; - -/* %start-doc actions le - -The filename and the searchpath (@emph{elementSearchPaths}) are passed to the -element loader. If no filename is specified a file select box will popup. - -@colonaction - -%end-doc */ - -static int CommandLoadElementToBuffer(int argc, const char **argv, Coord x, Coord y) -{ - const char *filename; - - switch (argc) { - case 1: /* filename is passed in commandline */ - filename = argv[0]; - if (filename && LoadElementToBuffer(PASTEBUFFER, filename)) - SetMode(PCB_MODE_PASTE_BUFFER); - break; - - default: /* usage */ - Message(PCB_MSG_DEFAULT, pcb_false, "Usage: le [name]\n loads element data to buffer\n"); - return (1); - } - return (0); -} - -/* --------------------------------------------------------------------------- */ - -static const char m_syntax[] = "m [name]"; - -static const char m_help[] = "Loads a layout into the current buffer."; - -/* %start-doc actions m - -The filename and the searchpath (@emph{filePath}) are passed to the -command defined by @emph{fileCommand}. -If no filename is specified a file select box will popup. - -@colonaction - -%end-doc */ - -static int CommandLoadLayoutToBuffer(int argc, const char **argv, Coord x, Coord y) -{ - const char *filename, *format = NULL; - - switch (argc) { - case 2: - format = argv[1]; - case 1: /* filename is passed in commandline */ - filename = argv[0]; - if (filename && LoadLayoutToBuffer(PASTEBUFFER, filename, format)) - SetMode(PCB_MODE_PASTE_BUFFER); - break; - - default: /* usage */ - Message(PCB_MSG_DEFAULT, "Usage: m [name]\n loads layout data to buffer\n"); - return (1); - } - return (0); -} - -/* --------------------------------------------------------------------------- */ - -static const char q_syntax[] = "q"; - -static const char q_help[] = "Quits the application after confirming."; - -/* %start-doc actions q - -If you have unsaved changes, you will be prompted to confirm (or -save) before quitting. - -@colonaction - -%end-doc */ - -static int CommandQuit(int argc, const char **argv, Coord x, Coord y) -{ - if (!PCB->Changed || gui->close_confirm_dialog() == HID_CLOSE_CONFIRM_OK) - QuitApplication(); - return 0; -} - -static const char qreally_syntax[] = "q!"; - -static const char qreally_help[] = "Quits the application without confirming."; - -/* %start-doc actions q! - -Note that this command neither saves your data nor prompts for -confirmation. - -@colonaction - -%end-doc */ - -static int CommandReallyQuit(int argc, const char **argv, Coord x, Coord y) -{ - QuitApplication(); - return 0; -} - -/* ---------------------------------------------------------------------- */ - -static const char rn_syntax[] = "rn [name]"; - -static const char rn_help[] = "Reads netlist."; - -/* %start-doc actions rn - -If no filename is given a file select box will pop up. The file is -read via the command defined by the @emph{RatCommand} resource. The -command must send its output to @emph{stdout}. - -Netlists are used for generating rat's nests (see @ref{Rats Nest}) and -for verifying the board layout (which is also accomplished by the -@emph{Ratsnest} command). - -@colonaction - -%end-doc */ - -static int CommandLoadNetlist(int argc, const char **argv, Coord x, Coord y) -{ - const char *filename; - - switch (argc) { - case 1: /* filename is passed in commandline */ - filename = argv[0]; - break; - - default: /* usage */ - Message(PCB_MSG_DEFAULT, "Usage: rn [name]\n reads in a netlist file\n"); - return (1); - } - if (PCB->Netlistname) - free(PCB->Netlistname); - PCB->Netlistname = StripWhiteSpaceAndDup(filename); - - return (0); -} - -/* ---------------------------------------------------------------------- */ - -static const char s_syntax[] = "s [name]"; - -static const char s_help[] = "Saves layout data."; - -/* %start-doc actions s - -Data and the filename are passed to the command defined by the -resource @emph{saveCommand}. It must read the layout data from -@emph{stdin}. If no filename is entered, either the last one is used -again or, if it is not available, a file select box will pop up. - -@colonaction - -%end-doc */ - -static const char w_syntax[] = "w [name]"; - -static const char w_help[] = "Saves layout data."; - -/* %start-doc actions w - -This commands has been added for the convenience of @code{vi} users -and has the same functionality as @code{s}. - -@colonaction - -%end-doc */ - -static int CommandSaveLayout(int argc, const char **argv, Coord x, Coord y) -{ - switch (argc) { - case 0: - if (PCB->Filename) { - if (SavePCB(PCB->Filename, NULL) == 0) - SetChangedFlag(pcb_false); - } - else - Message(PCB_MSG_DEFAULT, "No filename to save to yet\n"); - break; - - case 1: - if (SavePCB(argv[0], NULL) == 0) { - SetChangedFlag(pcb_false); - free(PCB->Filename); - PCB->Filename = pcb_strdup(argv[0]); - if (gui->notify_filename_changed != NULL) - gui->notify_filename_changed(); - } - break; - - default: - Message(PCB_MSG_DEFAULT, "Usage: s [name] | w [name]\n saves layout data\n"); - return (1); - } - return (0); -} - -/* --------------------------------------------------------------------------- */ - -static const char wq_syntax[] = "wq"; - -static const char wq_help[] = "Saves the layout data and quits."; - -/* %start-doc actions wq - -This command has been added for the convenience of @code{vi} users and -has the same functionality as @code{s} combined with @code{q}. - -@colonaction - -%end-doc */ - -static int CommandSaveLayoutAndQuit(int argc, const char **argv, Coord x, Coord y) -{ - if (!CommandSaveLayout(argc, argv, x, y)) - return CommandQuit(0, 0, 0, 0); - return (1); -} - -/* --------------------------------------------------------------------------- */ - -HID_Action shand_cmd_action_list[] = { - {"h", 0, CommandHelp, - h_help, h_syntax} - , - {"l", 0, CommandLoadLayout, - l_help, l_syntax} - , - {"le", 0, CommandLoadElementToBuffer, - le_help, le_syntax} - , - {"m", 0, CommandLoadLayoutToBuffer, - m_help, m_syntax} - , - {"q", 0, CommandQuit, - q_help, q_syntax} - , - {"q!", 0, CommandReallyQuit, - qreally_help, qreally_syntax} - , - {"rn", 0, CommandLoadNetlist, - rn_help, rn_syntax} - , - {"s", 0, CommandSaveLayout, - s_help, s_syntax} - , - {"w", 0, CommandSaveLayout, - w_help, w_syntax} - , - {"wq", 0, CommandSaveLayoutAndQuit, - wq_help, wq_syntax} - , -}; - -static const char *shand_cmd_cookie = "shand_cmd plugin"; - -REGISTER_ACTIONS(shand_cmd_action_list, shand_cmd_cookie) - -static void hid_shand_cmd_uninit(void) -{ - hid_remove_actions_by_cookie(shand_cmd_cookie); -} - -#include "dolists.h" -pcb_uninit_t hid_shand_cmd_init(void) -{ - REGISTER_ACTIONS(shand_cmd_action_list, shand_cmd_cookie) - return hid_shand_cmd_uninit; -} Index: 1.1.4/src_plugins/shand_cmd/command.h =================================================================== --- 1.1.4/src_plugins/shand_cmd/command.h (revision 10776) +++ 1.1.4/src_plugins/shand_cmd/command.h (nonexistent) @@ -1,37 +0,0 @@ -/* - * COPYRIGHT - * - * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Contact addresses for paper mail and Email: - * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany - * Thomas.Nau@rz.uni-ulm.de - * - */ - -/* prototypes for command execution */ - -#ifndef PCB_COMMAND_H -#define PCB_COMMAND_H - -#include "global.h" - -void ExecuteUserCommand(char *); -void CallActionProc(char *action, char **arg, int argc); - -#endif Index: 1.1.4/src_plugins/shand_cmd/Plug.tmpasm =================================================================== --- 1.1.4/src_plugins/shand_cmd/Plug.tmpasm (revision 10776) +++ 1.1.4/src_plugins/shand_cmd/Plug.tmpasm (nonexistent) @@ -1,8 +0,0 @@ -put /local/pcb/mod {shand_cmd} -put /local/pcb/mod/OBJS [@ $(PLUGDIR)/shand_cmd/command.o @] - -switch /local/pcb/shand_cmd/controls - case {buildin} include /local/pcb/tmpasm/buildin; end; - case {plugin} include /local/pcb/tmpasm/plugin; end; - case {disable} include /local/pcb/tmpasm/disable; end; -end Index: 1.1.4/src_plugins/shand_cmd/README =================================================================== --- 1.1.4/src_plugins/shand_cmd/README (revision 10776) +++ 1.1.4/src_plugins/shand_cmd/README (nonexistent) @@ -1,5 +0,0 @@ -vi-like command shorthands (1..3 character long commands) - -#state: works -#default: buildin -#implements: (feature) Index: 1.1.4/src_plugins/shand_cmd/Makefile =================================================================== --- 1.1.4/src_plugins/shand_cmd/Makefile (revision 10776) +++ 1.1.4/src_plugins/shand_cmd/Makefile (nonexistent) @@ -1,6 +0,0 @@ -all: - cd ../../src && make mod_shand_cmd - - -clean: - rm *.o *.so 2>/dev/null ; true Index: 1.1.4/src_plugins/hid_lesstif/lesstif.h =================================================================== --- 1.1.4/src_plugins/hid_lesstif/lesstif.h (revision 10776) +++ 1.1.4/src_plugins/hid_lesstif/lesstif.h (nonexistent) @@ -1,84 +0,0 @@ -#include "hid_cfg_input.h" - -#define app_context lesstif_app_context -#define appwidget lesstif_appwidget -#define display lesstif_display -#define screen_s lesstif_screen_s -#define screen lesstif_screen -#define mainwind lesstif_mainwind -#define work_area lesstif_work_area -#define messages lesstif_messages -#define command lesstif_command -#define hscroll lesstif_hscroll -#define vscroll lesstif_vscroll -#define m_click lesstif_message_click - -extern XtAppContext app_context; -extern Widget appwidget; -extern Display *display; -extern Screen *screen_s; -extern int screen; - -extern hid_cfg_mouse_t lesstif_mouse; -extern hid_cfg_keys_t lesstif_keymap; - -extern Widget mainwind, work_area, command, hscroll, vscroll; -extern Widget m_click; - -extern Widget lesstif_menu(Widget, const char *, Arg *, int); -extern int lesstif_key_event(XKeyEvent *); -extern int lesstif_button_event(Widget w, XEvent * e); - -/* Returns TRUE if the point mapped to the PCB region, FALSE (=0) if - we're off-board. Note that *pcbxy is always written to, even if - out of range. */ -extern int lesstif_winxy_to_pcbxy(int winx, int winy, int *pcbx, int *pcby); - -/* Returns TRUE if the point is in the window, FALSE (=0) otherwise. */ -extern int lesstif_pcbxy_to_winxy(int pcbx, int pcby, int *winx, int *winy); - -extern void lesstif_need_idle_proc(void); -extern void lesstif_show_crosshair(int); -extern void lesstif_invalidate_all(void); -extern void lesstif_coords_to_pcb(int, int, Coord *, Coord *); -extern void lesstif_get_xy(const char *msg); -extern void lesstif_update_widget_flags(void); -extern int lesstif_call_action(const char *, int, char **); -extern void lesstif_sizes_reset(void); -extern void lesstif_pan_fixup(void); -extern void lesstif_show_library(void); -extern void lesstif_show_netlist(void); -extern Pixel lesstif_parse_color(const char *value); -extern void lesstif_insert_style_buttons(Widget menu); -extern void lesstif_styles_update_values(); -extern void lesstif_update_layer_groups(); -extern void lesstif_update_status_line(); -extern char *lesstif_prompt_for(const char *, const char *); -extern char *lesstif_fileselect(const char *, const char *, const char *, const char *, const char *, int); -extern void lesstif_log(const char *fmt, ...); -extern void lesstif_attributes_dialog(const char *, AttributeListType *); - -#ifndef XtRPCBCoord -#define XtRPCBCoord "PCBCoord" -#endif - -#define need_idle_proc lesstif_need_idle_proc -#define show_crosshair lesstif_show_crosshair - -/* - * Motif comes from a time when even constant strings where - * passed as char*. These days, this requires to do ugly - * type-casting. To better identify all the places where this - * is necessary, we make this cast even more ugly but unique - * enough that it is simple to grep. - */ -#define XmStrCast(s) ((char*)(s)) - -static XmString XmStringCreatePCB(const char *x) -{ - if (x && x[0]) - x = gettext(x); - return XmStringCreateLtoR(XmStrCast(x), XmFONTLIST_DEFAULT_TAG); -} - -extern const char *lesstif_cookie; Index: 1.1.4/src_plugins/hid_lesstif/netlist.c =================================================================== --- 1.1.4/src_plugins/hid_lesstif/netlist.c (revision 10776) +++ 1.1.4/src_plugins/hid_lesstif/netlist.c (nonexistent) @@ -1,441 +0,0 @@ -#include "config.h" - -#include -#include -#include -#include - -#include "xincludes.h" - -#include "compat_misc.h" -#include "global.h" -#include "data.h" - -#include "find.h" -#include "rats.h" -#include "select.h" -#include "undo.h" -#include "remove.h" -#include "crosshair.h" -#include "draw.h" - -#include "hid.h" -#include "hid_actions.h" -#include "lesstif.h" -#include "stdarg.h" - -static Widget netlist_dialog = 0; -static Widget netlist_list, netnode_list; - -static XmString *netlist_strings = 0; -static XmString *netnode_strings = 0; -static int n_netnode_strings; -static int last_pick = -1; - -static int LesstifNetlistChanged(int argc, const char **argv, Coord x, Coord y); - -static void pick_net(int pick) -{ - LibraryMenuType *menu = PCB->NetlistLib[NETLIST_EDITED].Menu + pick; - int i; - - if (pick == last_pick) - return; - last_pick = pick; - - if (netnode_strings) - free(netnode_strings); /* XXX leaked all XmStrings??? */ - n_netnode_strings = menu->EntryN; - netnode_strings = (XmString *) malloc(menu->EntryN * sizeof(XmString)); - for (i = 0; i < menu->EntryN; i++) - netnode_strings[i] = XmStringCreatePCB(menu->Entry[i].ListEntry); - stdarg_n = 0; - stdarg(XmNitems, netnode_strings); - stdarg(XmNitemCount, menu->EntryN); - XtSetValues(netnode_list, stdarg_args, stdarg_n); -} - -static void netlist_select(Widget w, void *v, XmListCallbackStruct * cbs) -{ - XmString str; - int pos = cbs->item_position; - LibraryMenuTypePtr net = &(PCB->NetlistLib[NETLIST_EDITED].Menu[pos - 1]); - char *name = net->Name; - if (name[0] == ' ') { - name[0] = '*'; - net->flag = 0; - } - else { - name[0] = ' '; - net->flag = 1; - } - - str = XmStringCreatePCB(name); - XmListReplaceItemsPos(netlist_list, &str, 1, pos); - XmStringFree(str); - XmListSelectPos(netlist_list, pos, False); -} - -static void netlist_extend(Widget w, void *v, XmListCallbackStruct * cbs) -{ - if (cbs->selected_item_count == 1) - pick_net(cbs->item_position - 1); -} - -typedef void (*Std_Nbcb_Func) (LibraryMenuTypePtr, int); - -static void nbcb_rat_on(LibraryMenuTypePtr net, int pos) -{ - XmString str; - char *name = net->Name; - name[0] = ' '; - net->flag = 1; - str = XmStringCreatePCB(name); - XmListReplaceItemsPos(netlist_list, &str, 1, pos); - XmStringFree(str); -} - -static void nbcb_rat_off(LibraryMenuTypePtr net, int pos) -{ - XmString str; - char *name = net->Name; - name[0] = '*'; - net->flag = 0; - str = XmStringCreatePCB(name); - XmListReplaceItemsPos(netlist_list, &str, 1, pos); - XmStringFree(str); -} - - -/* Select on the layout the current net treeview selection - */ -static void nbcb_select_common(LibraryMenuTypePtr net, int pos, int select_flag) -{ - LibraryEntryType *entry; - ConnectionType conn; - int i; - - InitConnectionLookup(); - ResetConnections(pcb_true); - - for (i = net->EntryN, entry = net->Entry; i; i--, entry++) - if (SeekPad(entry, &conn, pcb_false)) - RatFindHook(conn.type, conn.ptr1, conn.ptr2, conn.ptr2, pcb_true, pcb_true); - - SelectConnection(select_flag); - ResetConnections(pcb_false); - FreeConnectionLookupMemory(); - IncrementUndoSerialNumber(); - Draw(); -} - -static void nbcb_select(LibraryMenuTypePtr net, int pos) -{ - nbcb_select_common(net, pos, 1); -} - -static void nbcb_deselect(LibraryMenuTypePtr net, int pos) -{ - nbcb_select_common(net, pos, 0); -} - -static void nbcb_find(LibraryMenuTypePtr net, int pos) -{ - char *name = net->Name + 2; - hid_actionl("netlist", "find", name, NULL); -} - -static void nbcb_std_callback(Widget w, Std_Nbcb_Func v, XmPushButtonCallbackStruct * cbs) -{ - int *posl, posc, i; - XmString **items, **selected; - if (XmListGetSelectedPos(netlist_list, &posl, &posc) == False) - return; - if (v == nbcb_find) - hid_actionl("connection", "reset", NULL); - for (i = 0; i < posc; i++) { - LibraryMenuTypePtr net = &(PCB->NetlistLib[NETLIST_EDITED].Menu[posl[i] - 1]); - v(net, posl[i]); - } - stdarg_n = 0; - stdarg(XmNitems, &items); - XtGetValues(netlist_list, stdarg_args, stdarg_n); - selected = (XmString **) malloc(posc * sizeof(XmString *)); - for (i = 0; i < posc; i++) - selected[i] = items[posl[i] - 1]; - - stdarg_n = 0; - stdarg(XmNselectedItems, selected); - XtSetValues(netlist_list, stdarg_args, stdarg_n); -} - -static void nbcb_ripup(Widget w, Std_Nbcb_Func v, XmPushButtonCallbackStruct * cbs) -{ - nbcb_std_callback(w, nbcb_find, cbs); - - VISIBLELINE_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, line) && !TEST_FLAG(PCB_FLAG_LOCK, line)) - RemoveObject(PCB_TYPE_LINE, layer, line, line); - } - ENDALL_LOOP; - - VISIBLEARC_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, arc) && !TEST_FLAG(PCB_FLAG_LOCK, arc)) - RemoveObject(PCB_TYPE_ARC, layer, arc, arc); - } - ENDALL_LOOP; - - if (PCB->ViaOn) - VIA_LOOP(PCB->Data); - { - if (TEST_FLAG(PCB_FLAG_FOUND, via) && !TEST_FLAG(PCB_FLAG_LOCK, via)) - RemoveObject(PCB_TYPE_VIA, via, via, via); - } - END_LOOP; -} - -static void netnode_browse(Widget w, XtPointer v, XmListCallbackStruct * cbs) -{ - LibraryMenuType *menu = PCB->NetlistLib[NETLIST_EDITED].Menu + last_pick; - const char *name = menu->Entry[cbs->item_position - 1].ListEntry; - char *ename, *pname; - - ename = pcb_strdup(name); - pname = strchr(ename, '-'); - if (!pname) { - free(ename); - return; - } - *pname++ = 0; - - ELEMENT_LOOP(PCB->Data); - { - char *es = element->Name[NAMEONPCB_INDEX].TextString; - if (es && strcmp(es, ename) == 0) { - PIN_LOOP(element); - { - if (strcmp(pin->Number, pname) == 0) { - MoveCrosshairAbsolute(pin->X, pin->Y); - free(ename); - return; - } - } - END_LOOP; - PAD_LOOP(element); - { - if (strcmp(pad->Number, pname) == 0) { - int x = (pad->Point1.X + pad->Point2.X) / 2; - int y = (pad->Point1.Y + pad->Point2.Y) / 2; - gui->set_crosshair(x, y, HID_SC_PAN_VIEWPORT); - free(ename); - return; - } - } - END_LOOP; - } - } - END_LOOP; - free(ename); -} - -#define NLB_FORM ((Widget)(~0)) -static Widget -netlist_button(Widget parent, const char *name, const char *string, - Widget top, Widget bottom, Widget left, Widget right, XtCallbackProc callback, void *user_data) -{ - Widget rv; - XmString str; - -#define NLB_W(w) if (w == NLB_FORM) { stdarg(XmN ## w ## Attachment, XmATTACH_FORM); } \ - else if (w) { stdarg(XmN ## w ## Attachment, XmATTACH_WIDGET); \ - stdarg (XmN ## w ## Widget, w); } - - NLB_W(top); - NLB_W(bottom); - NLB_W(left); - NLB_W(right); - str = XmStringCreatePCB(string); - stdarg(XmNlabelString, str); - rv = XmCreatePushButton(parent, XmStrCast(name), stdarg_args, stdarg_n); - XtManageChild(rv); - if (callback) - XtAddCallback(rv, XmNactivateCallback, callback, (XtPointer) user_data); - XmStringFree(str); - return rv; -} - -static int build_netlist_dialog() -{ - Widget b_sel, b_unsel, b_find, /*b_ripup,*/ b_rat_on, /*b_rat_off,*/ l_ops; - XmString ops_str; - - if (!mainwind) - return 1; - if (netlist_dialog) - return 0; - - stdarg_n = 0; - stdarg(XmNresizePolicy, XmRESIZE_GROW); - stdarg(XmNtitle, "Netlists"); - stdarg(XmNautoUnmanage, False); - netlist_dialog = XmCreateFormDialog(mainwind, XmStrCast("netlist"), stdarg_args, stdarg_n); - - stdarg_n = 0; - b_rat_on = netlist_button(netlist_dialog, "rat_on", "Enable for rats", - 0, NLB_FORM, NLB_FORM, 0, (XtCallbackProc) nbcb_std_callback, (void *) nbcb_rat_on); - - stdarg_n = 0; - /*b_rat_off =*/ netlist_button(netlist_dialog, "rat_off", "Disable for rats", - 0, NLB_FORM, b_rat_on, 0, (XtCallbackProc) nbcb_std_callback, (void *) nbcb_rat_off); - - stdarg_n = 0; - b_sel = netlist_button(netlist_dialog, "select", "Select", - 0, b_rat_on, NLB_FORM, 0, (XtCallbackProc) nbcb_std_callback, (void *) nbcb_select); - - stdarg_n = 0; - b_unsel = netlist_button(netlist_dialog, "deselect", "Deselect", - 0, b_rat_on, b_sel, 0, (XtCallbackProc) nbcb_std_callback, (void *) nbcb_deselect); - - stdarg_n = 0; - b_find = netlist_button(netlist_dialog, "find", "Find", - 0, b_rat_on, b_unsel, 0, (XtCallbackProc) nbcb_std_callback, (void *) nbcb_find); - - - stdarg_n = 0; - /*b_ripup =*/ netlist_button(netlist_dialog, "ripup", "Rip Up", 0, b_rat_on, b_find, 0, (XtCallbackProc) nbcb_ripup, 0); - - stdarg_n = 0; - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, b_sel); - stdarg(XmNleftAttachment, XmATTACH_FORM); - ops_str = XmStringCreatePCB("Operations on selected net names:"); - stdarg(XmNlabelString, ops_str); - l_ops = XmCreateLabel(netlist_dialog, XmStrCast("ops"), stdarg_args, stdarg_n); - XtManageChild(l_ops); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, l_ops); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_POSITION); - stdarg(XmNrightPosition, 50); - stdarg(XmNvisibleItemCount, 10); - stdarg(XmNselectionPolicy, XmEXTENDED_SELECT); - netlist_list = XmCreateScrolledList(netlist_dialog, XmStrCast("nets"), stdarg_args, stdarg_n); - XtManageChild(netlist_list); - XtAddCallback(netlist_list, XmNdefaultActionCallback, (XtCallbackProc) netlist_select, 0); - XtAddCallback(netlist_list, XmNextendedSelectionCallback, (XtCallbackProc) netlist_extend, 0); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, l_ops); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_POSITION); - stdarg(XmNleftPosition, 50); - netnode_list = XmCreateScrolledList(netlist_dialog, XmStrCast("nodes"), stdarg_args, stdarg_n); - XtManageChild(netnode_list); - XtAddCallback(netnode_list, XmNbrowseSelectionCallback, (XtCallbackProc) netnode_browse, 0); - - return 0; -} - -static int LesstifNetlistChanged(int argc, const char **argv, Coord x, Coord y) -{ - int i; - if (!PCB->NetlistLib[NETLIST_EDITED].MenuN) - return 0; - if (build_netlist_dialog()) - return 0; - last_pick = -1; - if (netlist_strings) - free(netlist_strings); - netlist_strings = (XmString *) malloc(PCB->NetlistLib[NETLIST_EDITED].MenuN * sizeof(XmString)); - for (i = 0; i < PCB->NetlistLib[NETLIST_EDITED].MenuN; i++) - netlist_strings[i] = XmStringCreatePCB(PCB->NetlistLib[NETLIST_EDITED].Menu[i].Name); - stdarg_n = 0; - stdarg(XmNitems, netlist_strings); - stdarg(XmNitemCount, PCB->NetlistLib[NETLIST_EDITED].MenuN); - XtSetValues(netlist_list, stdarg_args, stdarg_n); - pick_net(0); - return 0; -} - -static const char netlistshow_syntax[] = "NetlistShow(pinname|netname)"; - -static const char netlistshow_help[] = "Selects the given pinname or netname in the netlist window."; - -/* %start-doc actions NetlistShow - -%end-doc */ - -static int LesstifNetlistShow(int argc, const char **argv, Coord x, Coord y) -{ - if (build_netlist_dialog()) - return 0; - - if (argc == 1) { - LibraryMenuTypePtr net; - - net = pcb_netnode_to_netname(argv[0]); - if (net) { - XmString item; - int vis = 0; - - /* Select net first, 'True' causes pick_net() to be invoked */ - item = XmStringCreatePCB(net->Name); - XmListSelectItem(netlist_list, item, True); - XmListSetItem(netlist_list, item); - XmStringFree(item); - - /* Now the netnode_list has the right contents */ - item = XmStringCreatePCB(argv[0]); - XmListSelectItem(netnode_list, item, False); - - /* - * Only force the item to the top if there are enough to scroll. - * A bug (?) in lesstif will cause the window to get ever wider - * if an XmList that doesn't require a scrollbar is forced to - * have one (when the top item is not the first item). - */ - stdarg_n = 0; - stdarg(XmNvisibleItemCount, &vis); - XtGetValues(netnode_list, stdarg_args, stdarg_n); - if (n_netnode_strings > vis) { - XmListSetItem(netnode_list, item); - } - XmStringFree(item); - } - else { - /* Try the argument as a netname */ - net = pcb_netname_to_netname(argv[0]); - if (net) { - XmString item; - - item = XmStringCreatePCB(net->Name); - XmListSetItem(netlist_list, item); - XmListSelectItem(netlist_list, item, True); - XmStringFree(item); - } - } - } - return 0; -} - -void lesstif_show_netlist() -{ - build_netlist_dialog(); - XtManageChild(netlist_dialog); -} - -HID_Action lesstif_netlist_action_list[] = { - {"NetlistChanged", 0, LesstifNetlistChanged, - netlistchanged_help, netlistchanged_syntax}, - {"NetlistShow", 0, LesstifNetlistShow, - netlistshow_help, netlistshow_syntax} -}; - -REGISTER_ACTIONS(lesstif_netlist_action_list, lesstif_cookie) Index: 1.1.4/src_plugins/hid_lesstif/dialogs.c =================================================================== --- 1.1.4/src_plugins/hid_lesstif/dialogs.c (revision 10776) +++ 1.1.4/src_plugins/hid_lesstif/dialogs.c (nonexistent) @@ -1,1948 +0,0 @@ -#include "xincludes.h" - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include - - -#include "compat_misc.h" -#include "global.h" -#include "data.h" -#include "crosshair.h" -#include "layer.h" -#include "misc.h" -#include "pcb-printf.h" - -#include "hid.h" -#include "lesstif.h" -#include "hid_attrib.h" -#include "hid_actions.h" -#include "hid_init.h" -#include "stdarg.h" -#include "misc_util.h" - -static int ok; - -#define COMPONENT_SIDE_NAME "(top)" -#define SOLDER_SIDE_NAME "(bottom)" - -/* ------------------------------------------------------------ */ - -static void dialog_callback(Widget w, void *v, void *cbs) -{ - ok = (int) (size_t) v; -} - -static int wait_for_dialog(Widget w) -{ - ok = -1; - XtManageChild(w); - while (ok == -1 && XtIsManaged(w)) { - XEvent e; - XtAppNextEvent(app_context, &e); - XtDispatchEvent(&e); - } - XtUnmanageChild(w); - return ok; -} - -/* ------------------------------------------------------------ */ - -static Widget fsb = 0; -static XmString xms_pcb, xms_net, xms_vend, xms_all, xms_load, xms_loadv, xms_save, xms_fp; - -static void setup_fsb_dialog() -{ - if (fsb) - return; - - xms_pcb = XmStringCreatePCB("*.pcb"); - xms_fp = XmStringCreatePCB("*.fp"); - xms_net = XmStringCreatePCB("*.net"); - xms_vend = XmStringCreatePCB("*.vend"); - xms_all = XmStringCreatePCB("*"); - xms_load = XmStringCreatePCB("Load From"); - xms_loadv = XmStringCreatePCB("Load Vendor"); - xms_save = XmStringCreatePCB("Save As"); - - stdarg_n = 0; - fsb = XmCreateFileSelectionDialog(mainwind, XmStrCast("file"), stdarg_args, stdarg_n); - - XtAddCallback(fsb, XmNokCallback, (XtCallbackProc) dialog_callback, (XtPointer) 1); - XtAddCallback(fsb, XmNcancelCallback, (XtCallbackProc) dialog_callback, (XtPointer) 0); -} - -static const char load_syntax[] = "Load()\n" "Load(Layout|LayoutToBuffer|ElementToBuffer|Netlist|Revert)"; - -static const char load_help[] = "Load layout data from a user-selected file."; - -/* %start-doc actions Load - -This action is a GUI front-end to the core's @code{LoadFrom} action -(@pxref{LoadFrom Action}). If you happen to pass a filename, like -@code{LoadFrom}, then @code{LoadFrom} is called directly. Else, the -user is prompted for a filename to load, and then @code{LoadFrom} is -called with that filename. - -%end-doc */ - -static int Load(int argc, const char **argv, Coord x, Coord y) -{ - const char *function; - char *name; - XmString xmname, pattern; - - if (argc > 1) - return hid_actionv("LoadFrom", argc, argv); - - function = argc ? argv[0] : "Layout"; - - setup_fsb_dialog(); - - if (strcasecmp(function, "Netlist") == 0) - pattern = xms_net; - else if (strcasecmp(function, "ElementToBuffer") == 0) - pattern = xms_fp; - else - pattern = xms_pcb; - - stdarg_n = 0; - stdarg(XmNtitle, "Load From"); - XtSetValues(XtParent(fsb), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNpattern, pattern); - stdarg(XmNmustMatch, True); - stdarg(XmNselectionLabelString, xms_load); - XtSetValues(fsb, stdarg_args, stdarg_n); - - if (!wait_for_dialog(fsb)) - return 1; - - stdarg_n = 0; - stdarg(XmNdirSpec, &xmname); - XtGetValues(fsb, stdarg_args, stdarg_n); - - XmStringGetLtoR(xmname, XmFONTLIST_DEFAULT_TAG, &name); - - hid_actionl("LoadFrom", function, name, NULL); - - XtFree(name); - - return 0; -} - -static const char loadvendor_syntax[] = "LoadVendor()"; - -static const char loadvendor_help[] = "Loads a user-selected vendor resource file."; - -/* %start-doc actions LoadVendor - -The user is prompted for a file to load, and then -@code{LoadVendorFrom} is called (@pxref{LoadVendorFrom Action}) to -load that vendor file. - -%end-doc */ - -static int LoadVendor(int argc, const char **argv, Coord x, Coord y) -{ - char *name; - XmString xmname, pattern; - - if (argc > 0) - return hid_actionv("LoadVendorFrom", argc, argv); - - setup_fsb_dialog(); - - pattern = xms_vend; - - stdarg_n = 0; - stdarg(XmNtitle, "Load Vendor"); - XtSetValues(XtParent(fsb), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNpattern, pattern); - stdarg(XmNmustMatch, True); - stdarg(XmNselectionLabelString, xms_loadv); - XtSetValues(fsb, stdarg_args, stdarg_n); - - if (!wait_for_dialog(fsb)) - return 1; - - stdarg_n = 0; - stdarg(XmNdirSpec, &xmname); - XtGetValues(fsb, stdarg_args, stdarg_n); - - XmStringGetLtoR(xmname, XmFONTLIST_DEFAULT_TAG, &name); - - hid_actionl("LoadVendorFrom", name, NULL); - - XtFree(name); - - return 0; -} - -static const char save_syntax[] = - "Save()\n" "Save(Layout|LayoutAs)\n" "Save(AllConnections|AllUnusedPins|ElementConnections)\n" "Save(PasteBuffer)"; - -static const char save_help[] = "Save layout data to a user-selected file."; - -/* %start-doc actions Save - -This action is a GUI front-end to the core's @code{SaveTo} action -(@pxref{SaveTo Action}). If you happen to pass a filename, like -@code{SaveTo}, then @code{SaveTo} is called directly. Else, the -user is prompted for a filename to save, and then @code{SaveTo} is -called with that filename. - -%end-doc */ - -static int Save(int argc, const char **argv, Coord x, Coord y) -{ - const char *function; - char *name; - XmString xmname, pattern; - - if (argc > 1) - hid_actionv("SaveTo", argc, argv); - - function = argc ? argv[0] : "Layout"; - - if (strcasecmp(function, "Layout") == 0) - if (PCB->Filename) - return hid_actionl("SaveTo", "Layout", PCB->Filename, NULL); - - setup_fsb_dialog(); - - pattern = xms_pcb; - - XtManageChild(fsb); - - stdarg_n = 0; - stdarg(XmNtitle, "Save As"); - XtSetValues(XtParent(fsb), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNpattern, pattern); - stdarg(XmNmustMatch, False); - stdarg(XmNselectionLabelString, xms_save); - XtSetValues(fsb, stdarg_args, stdarg_n); - - if (!wait_for_dialog(fsb)) - return 1; - - stdarg_n = 0; - stdarg(XmNdirSpec, &xmname); - XtGetValues(fsb, stdarg_args, stdarg_n); - - XmStringGetLtoR(xmname, XmFONTLIST_DEFAULT_TAG, &name); - - if (strcasecmp(function, "PasteBuffer") == 0) - hid_actionl("PasteBuffer", "Save", name, NULL); - else { - /* - * if we got this far and the function is Layout, then - * we really needed it to be a LayoutAs. Otherwise - * ActionSaveTo() will ignore the new file name we - * just obtained. - */ - if (strcasecmp(function, "Layout") == 0) - hid_actionl("SaveTo", "LayoutAs", name, NULL); - else - hid_actionl("SaveTo", function, name, NULL); - } - XtFree(name); - - return 0; -} - -/* ------------------------------------------------------------ */ - -static Widget log_form, log_text; -static int log_size = 0; -static int pending_newline = 0; - -static void log_clear(Widget w, void *up, void *cbp) -{ - XmTextSetString(log_text, XmStrCast("")); - log_size = 0; - pending_newline = 0; -} - -static void log_dismiss(Widget w, void *up, void *cbp) -{ - XtUnmanageChild(log_form); -} - -void lesstif_logv(enum pcb_message_level level, const char *fmt, va_list ap) -{ - /* TODO(hzeller): do something useful with level (color etc.) */ - char *buf, *scan; - if (!mainwind) { - vprintf(fmt, ap); - return; - } - if (!log_form) { - Widget clear_button, dismiss_button; - - stdarg_n = 0; - stdarg(XmNautoUnmanage, False); - stdarg(XmNwidth, 600); - stdarg(XmNheight, 200); - stdarg(XmNtitle, "pcb-rnd Log"); - log_form = XmCreateFormDialog(mainwind, XmStrCast("log"), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - clear_button = XmCreatePushButton(log_form, XmStrCast("clear"), stdarg_args, stdarg_n); - XtManageChild(clear_button); - XtAddCallback(clear_button, XmNactivateCallback, (XtCallbackProc) log_clear, 0); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_WIDGET); - stdarg(XmNrightWidget, clear_button); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - dismiss_button = XmCreatePushButton(log_form, XmStrCast("dismiss"), stdarg_args, stdarg_n); - XtManageChild(dismiss_button); - XtAddCallback(dismiss_button, XmNactivateCallback, (XtCallbackProc) log_dismiss, 0); - - stdarg_n = 0; - stdarg(XmNeditable, False); - stdarg(XmNeditMode, XmMULTI_LINE_EDIT); - stdarg(XmNcursorPositionVisible, True); - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, clear_button); - log_text = XmCreateScrolledText(log_form, XmStrCast("text"), stdarg_args, stdarg_n); - XtManageChild(log_text); - - XtManageChild(log_form); - } - if (pending_newline) { - XmTextInsert(log_text, log_size++, XmStrCast("\n")); - pending_newline = 0; - } - buf = pcb_strdup_vprintf(fmt, ap); - scan = &buf[strlen(buf) - 1]; - while (scan >= buf && *scan == '\n') { - pending_newline++; - *scan-- = 0; - } - XmTextInsert(log_text, log_size, buf); - log_size += strlen(buf); - - scan = strrchr(buf, '\n'); - if (scan) - scan++; - else - scan = buf; - XmTextSetCursorPosition(log_text, log_size - strlen(scan)); - free(buf); -} - -void lesstif_log(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - lesstif_logv(PCB_MSG_INFO, fmt, ap); - va_end(ap); -} - -/* ------------------------------------------------------------ */ - -static Widget confirm_dialog = 0; -static Widget confirm_cancel, confirm_ok, confirm_label; - -int lesstif_confirm_dialog(const char *msg, ...) -{ - const char *cancelmsg, *okmsg; - va_list ap; - XmString xs; - - if (mainwind == 0) - return 1; - - if (confirm_dialog == 0) { - stdarg_n = 0; - stdarg(XmNdefaultButtonType, XmDIALOG_OK_BUTTON); - stdarg(XmNtitle, "Confirm"); - confirm_dialog = XmCreateQuestionDialog(mainwind, XmStrCast("confirm"), stdarg_args, stdarg_n); - XtAddCallback(confirm_dialog, XmNcancelCallback, (XtCallbackProc) dialog_callback, (XtPointer) 0); - XtAddCallback(confirm_dialog, XmNokCallback, (XtCallbackProc) dialog_callback, (XtPointer) 1); - - confirm_cancel = XmMessageBoxGetChild(confirm_dialog, XmDIALOG_CANCEL_BUTTON); - confirm_ok = XmMessageBoxGetChild(confirm_dialog, XmDIALOG_OK_BUTTON); - confirm_label = XmMessageBoxGetChild(confirm_dialog, XmDIALOG_MESSAGE_LABEL); - XtUnmanageChild(XmMessageBoxGetChild(confirm_dialog, XmDIALOG_HELP_BUTTON)); - } - - va_start(ap, msg); - cancelmsg = va_arg(ap, const char *); - okmsg = va_arg(ap, const char *); - va_end(ap); - - if (!cancelmsg) { - cancelmsg = "Cancel"; - okmsg = "Ok"; - } - - stdarg_n = 0; - xs = XmStringCreatePCB(cancelmsg); - - if (okmsg) { - stdarg(XmNcancelLabelString, xs); - xs = XmStringCreatePCB(okmsg); - XtManageChild(confirm_cancel); - } - else - XtUnmanageChild(confirm_cancel); - - stdarg(XmNokLabelString, xs); - - xs = XmStringCreatePCB(msg); - stdarg(XmNmessageString, xs); - XtSetValues(confirm_dialog, stdarg_args, stdarg_n); - - wait_for_dialog(confirm_dialog); - - stdarg_n = 0; - stdarg(XmNdefaultPosition, False); - XtSetValues(confirm_dialog, stdarg_args, stdarg_n); - - return ok; -} - -static int ConfirmAction(int argc, const char **argv, Coord x, Coord y) -{ - int rv = lesstif_confirm_dialog(argc > 0 ? argv[0] : 0, - argc > 1 ? argv[1] : 0, - argc > 2 ? argv[2] : 0, - 0); - return rv; -} - -/* ------------------------------------------------------------ */ - -int lesstif_close_confirm_dialog() -{ - return lesstif_confirm_dialog("OK to lose data ?", NULL); -} - -/* ------------------------------------------------------------ */ - -static Widget report = 0, report_form; - -void lesstif_report_dialog(const char *title, const char *msg) -{ - if (!report) { - if (mainwind == 0) - return; - - stdarg_n = 0; - stdarg(XmNautoUnmanage, False); - stdarg(XmNwidth, 600); - stdarg(XmNheight, 200); - stdarg(XmNtitle, title); - report_form = XmCreateFormDialog(mainwind, XmStrCast("report"), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNeditable, False); - stdarg(XmNeditMode, XmMULTI_LINE_EDIT); - stdarg(XmNcursorPositionVisible, False); - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - report = XmCreateScrolledText(report_form, XmStrCast("text"), stdarg_args, stdarg_n); - XtManageChild(report); - } - stdarg_n = 0; - stdarg(XmNtitle, title); - XtSetValues(report_form, stdarg_args, stdarg_n); - XmTextSetString(report, (char *) msg); - - XtManageChild(report_form); -} - -/* ------------------------------------------------------------ */ -/* FIXME -- make this a proper file select dialog box */ -char *lesstif_fileselect(const char *title, const char *descr, - const char *default_file, const char *default_ext, const char *history_tag, int flags) -{ - - return lesstif_prompt_for(title, default_file); -} - -/* ------------------------------------------------------------ */ - -static Widget prompt_dialog = 0; -static Widget prompt_label, prompt_text; - -char *lesstif_prompt_for(const char *msg, const char *default_string) -{ - char *rv; - XmString xs; - if (prompt_dialog == 0) { - stdarg_n = 0; - stdarg(XmNautoUnmanage, False); - stdarg(XmNtitle, "pcb-rnd Prompt"); - prompt_dialog = XmCreateFormDialog(mainwind, XmStrCast("prompt"), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNalignment, XmALIGNMENT_BEGINNING); - prompt_label = XmCreateLabel(prompt_dialog, XmStrCast("label"), stdarg_args, stdarg_n); - XtManageChild(prompt_label); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_WIDGET); - stdarg(XmNtopWidget, prompt_label); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNeditable, True); - prompt_text = XmCreateText(prompt_dialog, XmStrCast("text"), stdarg_args, stdarg_n); - XtManageChild(prompt_text); - XtAddCallback(prompt_text, XmNactivateCallback, (XtCallbackProc) dialog_callback, (XtPointer) 1); - } - if (!default_string) - default_string = ""; - if (!msg) - msg = "Enter text:"; - stdarg_n = 0; - xs = XmStringCreatePCB(msg); - stdarg(XmNlabelString, xs); - XtSetValues(prompt_label, stdarg_args, stdarg_n); - XmTextSetString(prompt_text, (char *) default_string); - XmTextSetCursorPosition(prompt_text, strlen(default_string)); - wait_for_dialog(prompt_dialog); - rv = XmTextGetString(prompt_text); - return rv; -} - -static const char promptfor_syntax[] = "PromptFor([message[,default]])"; - -static const char promptfor_help[] = "Prompt for a response."; - -/* %start-doc actions PromptFor - -This is mostly for testing the lesstif HID interface. The parameters -are passed to the @code{prompt_for()} HID function, causing the user -to be prompted for a response. The respose is simply printed to the -user's stdout. - -%end-doc */ - -static int PromptFor(int argc, const char **argv, Coord x, Coord y) -{ - char *rv = lesstif_prompt_for(argc > 0 ? argv[0] : 0, - argc > 1 ? argv[1] : 0); - printf("rv = `%s'\n", rv); - return 0; -} - -/* ------------------------------------------------------------ */ - -static Widget create_form_ok_dialog(const char *name, int ok) -{ - Widget dialog, topform; - stdarg_n = 0; - dialog = XmCreateQuestionDialog(mainwind, XmStrCast(name), stdarg_args, stdarg_n); - - XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_SYMBOL_LABEL)); - XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_MESSAGE_LABEL)); - XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON)); - XtAddCallback(dialog, XmNcancelCallback, (XtCallbackProc) dialog_callback, (XtPointer) 0); - if (ok) - XtAddCallback(dialog, XmNokCallback, (XtCallbackProc) dialog_callback, (XtPointer) 1); - else - XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_OK_BUTTON)); - - stdarg_n = 0; - topform = XmCreateForm(dialog, XmStrCast("attributes"), stdarg_args, stdarg_n); - XtManageChild(topform); - return topform; -} - -int lesstif_attribute_dialog(HID_Attribute * attrs, int n_attrs, HID_Attr_Val * results, const char *title, const char *descr) -{ - Widget dialog, topform, lform, form; - Widget *wl; - int i, rv; - static XmString empty = 0; - int actual_nattrs = 0; - int attrcount = 0; - - if (!empty) - empty = XmStringCreatePCB(" "); - - for (i = 0; i < n_attrs; i++) { - if (attrs[i].help_text != ATTR_UNDOCUMENTED) - actual_nattrs++; - results[i] = attrs[i].default_val; - if (results[i].str_value) - results[i].str_value = pcb_strdup(results[i].str_value); - } - - wl = (Widget *) malloc(n_attrs * sizeof(Widget)); - - topform = create_form_ok_dialog(title, 1); - dialog = XtParent(topform); - - stdarg_n = 0; - stdarg(XmNfractionBase, n_attrs); - XtSetValues(topform, stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNfractionBase, actual_nattrs); - lform = XmCreateForm(topform, XmStrCast("attributes"), stdarg_args, stdarg_n); - XtManageChild(lform); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_WIDGET); - stdarg(XmNleftWidget, lform); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNfractionBase, actual_nattrs); - form = XmCreateForm(topform, XmStrCast("attributes"), stdarg_args, stdarg_n); - XtManageChild(form); - - attrcount = -1; - for (i = 0; i < n_attrs; i++) { - Widget w; - - if (attrs[i].help_text == ATTR_UNDOCUMENTED) - continue; - attrcount++; - - stdarg_n = 0; - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, attrcount); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, attrcount + 1); - stdarg(XmNalignment, XmALIGNMENT_END); - w = XmCreateLabel(lform, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - XtManageChild(w); - } - - attrcount = -1; - for (i = 0; i < n_attrs; i++) { - static char buf[30]; - stdarg_n = 0; - - if (attrs[i].help_text == ATTR_UNDOCUMENTED) - continue; - attrcount++; - - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, attrcount); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, attrcount + 1); - stdarg(XmNalignment, XmALIGNMENT_END); - - switch (attrs[i].type) { - case HID_Label: - stdarg(XmNlabelString, empty); - wl[i] = XmCreateLabel(form, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - break; - case HID_Boolean: - stdarg(XmNlabelString, empty); - stdarg(XmNset, results[i].int_value); - wl[i] = XmCreateToggleButton(form, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - break; - case HID_String: - stdarg(XmNcolumns, 40); - stdarg(XmNresizeWidth, True); - stdarg(XmNvalue, results[i].str_value); - wl[i] = XmCreateTextField(form, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - break; - case HID_Integer: - stdarg(XmNcolumns, 13); - stdarg(XmNresizeWidth, True); - sprintf(buf, "%d", results[i].int_value); - stdarg(XmNvalue, buf); - wl[i] = XmCreateTextField(form, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - break; - case HID_Coord: - stdarg(XmNcolumns, 13); - stdarg(XmNresizeWidth, True); - pcb_snprintf(buf, sizeof(buf), "%$mS", results[i].coord_value); - stdarg(XmNvalue, buf); - wl[i] = XmCreateTextField(form, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - break; - case HID_Real: - stdarg(XmNcolumns, 16); - stdarg(XmNresizeWidth, True); - pcb_snprintf(buf, sizeof(buf), "%g", results[i].real_value); - stdarg(XmNvalue, buf); - wl[i] = XmCreateTextField(form, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - break; - case HID_Enum: - { - static XmString empty = 0; - Widget submenu, default_button = 0; - int sn = stdarg_n; - - if (empty == 0) - empty = XmStringCreatePCB(""); - - submenu = XmCreatePulldownMenu(form, XmStrCast(attrs[i].name), stdarg_args + sn, stdarg_n - sn); - - stdarg_n = sn; - stdarg(XmNlabelString, empty); - stdarg(XmNsubMenuId, submenu); - wl[i] = XmCreateOptionMenu(form, XmStrCast(attrs[i].name), stdarg_args, stdarg_n); - - for (sn = 0; attrs[i].enumerations[sn]; sn++) { - Widget btn; - XmString label; - stdarg_n = 0; - label = XmStringCreatePCB(attrs[i].enumerations[sn]); - stdarg(XmNuserData, &attrs[i].enumerations[sn]); - stdarg(XmNlabelString, label); - btn = XmCreatePushButton(submenu, XmStrCast("menubutton"), stdarg_args, stdarg_n); - XtManageChild(btn); - XmStringFree(label); - if (sn == attrs[i].default_val.int_value) - default_button = btn; - } - if (default_button) { - stdarg_n = 0; - stdarg(XmNmenuHistory, default_button); - XtSetValues(wl[i], stdarg_args, stdarg_n); - } - } - break; - default: - wl[i] = XmCreateLabel(form, XmStrCast("UNIMPLEMENTED"), stdarg_args, stdarg_n); - break; - } - - XtManageChild(wl[i]); - } - - rv = wait_for_dialog(dialog); - - for (i = 0; i < n_attrs; i++) { - char *cp; - - if (attrs[i].help_text == ATTR_UNDOCUMENTED) - continue; - - switch (attrs[i].type) { - case HID_Boolean: - results[i].int_value = XmToggleButtonGetState(wl[i]); - break; - case HID_String: - results[i].str_value = XmTextGetString(wl[i]); - break; - case HID_Integer: - cp = XmTextGetString(wl[i]); - sscanf(cp, "%d", &results[i].int_value); - break; - case HID_Coord: - cp = XmTextGetString(wl[i]); - results[i].coord_value = GetValue(cp, NULL, NULL, NULL); - break; - case HID_Real: - cp = XmTextGetString(wl[i]); - sscanf(cp, "%lg", &results[i].real_value); - break; - case HID_Enum: - { - const char **uptr; - Widget btn; - - stdarg_n = 0; - stdarg(XmNmenuHistory, &btn); - XtGetValues(wl[i], stdarg_args, stdarg_n); - stdarg_n = 0; - stdarg(XmNuserData, &uptr); - XtGetValues(btn, stdarg_args, stdarg_n); - results[i].int_value = uptr - attrs[i].enumerations; - } - break; - default: - break; - } - } - - free(wl); - XtDestroyWidget(dialog); - - return rv ? 0 : 1; -} - -/* ------------------------------------------------------------ */ - -static const char dowindows_syntax[] = "DoWindows(1|2|3|4)\n" "DoWindows(Layout|Library|Log|Netlist)"; - -static const char dowindows_help[] = "Open various GUI windows."; - -/* %start-doc actions DoWindows - -@table @code - -@item 1 -@itemx Layout -Open the layout window. Since the layout window is always shown -anyway, this has no effect. - -@item 2 -@itemx Library -Open the library window. - -@item 3 -@itemx Log -Open the log window. - -@item 4 -@itemx Netlist -Open the netlist window. - -@end table - -%end-doc */ - -static int DoWindows(int argc, const char **argv, Coord x, Coord y) -{ - const char *a = argc == 1 ? argv[0] : ""; - if (strcmp(a, "1") == 0 || strcasecmp(a, "Layout") == 0) { - } - else if (strcmp(a, "2") == 0 || strcasecmp(a, "Library") == 0) { - lesstif_show_library(); - } - else if (strcmp(a, "3") == 0 || strcasecmp(a, "Log") == 0) { - if (log_form == 0) - lesstif_log(""); - XtManageChild(log_form); - } - else if (strcmp(a, "4") == 0 || strcasecmp(a, "Netlist") == 0) { - lesstif_show_netlist(); - } - else { - lesstif_log("Usage: DoWindows(1|2|3|4|Layout|Library|Log|Netlist)"); - return 1; - } - return 0; -} - -/* ------------------------------------------------------------ */ -static const char about_syntax[] = "About()"; - -static const char about_help[] = "Tell the user about this version of PCB."; - -/* %start-doc actions About - -This just pops up a dialog telling the user which version of -@code{pcb} they're running. - -%end-doc */ - - -static int About(int argc, const char **argv, Coord x, Coord y) -{ - static Widget about = 0; - if (!about) { - XmString xs; - stdarg_n = 0; - xs = XmStringCreatePCB(GetInfoString()); - stdarg(XmNmessageString, xs); - stdarg(XmNtitle, "About pcb-rnd"); - about = XmCreateInformationDialog(mainwind, XmStrCast("about"), stdarg_args, stdarg_n); - XtUnmanageChild(XmMessageBoxGetChild(about, XmDIALOG_CANCEL_BUTTON)); - XtUnmanageChild(XmMessageBoxGetChild(about, XmDIALOG_HELP_BUTTON)); - } - wait_for_dialog(about); - return 0; -} - -/* ------------------------------------------------------------ */ - -static const char print_syntax[] = "Print()"; - -static const char print_help[] = "Print the layout."; - -/* %start-doc actions Print - -This will find the default printing HID, prompt the user for its -options, and print the layout. - -%end-doc */ - -static int Print(int argc, const char **argv, Coord x, Coord y) -{ - HID_Attribute *opts; - HID *printer; - HID_Attr_Val *vals; - int n; - - printer = hid_find_printer(); - if (!printer) { - lesstif_confirm_dialog("No printer?", "Oh well", 0); - return 1; - } - opts = printer->get_export_options(&n); - vals = (HID_Attr_Val *) calloc(n, sizeof(HID_Attr_Val)); - if (lesstif_attribute_dialog(opts, n, vals, "Print", "")) { - free(vals); - return 1; - } - printer->do_export(vals); - free(vals); - return 0; -} - -static HID_Attribute printer_calibrate_attrs[] = { - {"Enter Values here:", "", - HID_Label, 0, 0, {0, 0, 0}, 0, 0}, - {"x-calibration", "X scale for calibrating your printer", - HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0}, - {"y-calibration", "Y scale for calibrating your printer", - HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0} -}; - -static HID_Attr_Val printer_calibrate_values[3]; - -static const char printcalibrate_syntax[] = "PrintCalibrate()"; - -static const char printcalibrate_help[] = "Calibrate the printer."; - -/* %start-doc actions PrintCalibrate - -This will print a calibration page, which you would measure and type -the measurements in, so that future printouts will be more precise. - -%end-doc */ - -static int PrintCalibrate(int argc, const char **argv, Coord x, Coord y) -{ - HID *printer = hid_find_printer(); - printer->calibrate(0.0, 0.0); - if (gui->attribute_dialog(printer_calibrate_attrs, 3, - printer_calibrate_values, - "Printer Calibration Values", "Enter calibration values for your printer")) - return 1; - printer->calibrate(printer_calibrate_values[1].real_value, printer_calibrate_values[2].real_value); - return 0; -} - -static const char export_syntax[] = "Export()"; - -static const char export_help[] = "Export the layout."; - -/* %start-doc actions Export - -Prompts the user for an exporter to use. Then, prompts the user for -that exporter's options, and exports the layout. - -%end-doc */ - -static int Export(int argc, const char **argv, Coord x, Coord y) -{ - static Widget selector = 0; - HID_Attribute *opts; - HID *printer, **hids; - HID_Attr_Val *vals; - int n, i, count; - Widget prev = 0; - Widget w; - - hids = hid_enumerate(); - - if (!selector) { - stdarg_n = 0; - stdarg(XmNtitle, "Export HIDs"); - selector = create_form_ok_dialog("export", 0); - count = 0; - for (i = 0; hids[i]; i++) { - if (hids[i]->exporter) { - stdarg_n = 0; - if (prev) { - stdarg(XmNtopAttachment, XmATTACH_WIDGET); - stdarg(XmNtopWidget, prev); - } - else { - stdarg(XmNtopAttachment, XmATTACH_FORM); - } - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - w = XmCreatePushButton(selector, (char *) hids[i]->name, stdarg_args, stdarg_n); - XtManageChild(w); - XtAddCallback(w, XmNactivateCallback, (XtCallbackProc) dialog_callback, (XtPointer) ((size_t) i + 1)); - prev = w; - count++; - } - } - if (count == 0) { - Widget label; - stdarg_n = 0; - stdarg(XmNlabelString, XmStringCreatePCB("No exporter found. Check your plugins!")); - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - label = XmCreateLabel(selector, XmStrCast("label"), stdarg_args, stdarg_n); - XtManageChild(label); - } - selector = XtParent(selector); - } - - - i = wait_for_dialog(selector); - - if (i <= 0) - return 1; - printer = hids[i - 1]; - - exporter = printer; - - opts = printer->get_export_options(&n); - vals = (HID_Attr_Val *) calloc(n, sizeof(HID_Attr_Val)); - if (lesstif_attribute_dialog(opts, n, vals, "Export", NULL)) { - free(vals); - return 1; - } - printer->do_export(vals); - free(vals); - exporter = NULL; - return 0; -} - -/* ------------------------------------------------------------ */ - -static Widget sizes_dialog = 0; -static Widget sz_pcb_w, sz_pcb_h, sz_bloat, sz_shrink, sz_drc_wid, sz_drc_slk, sz_drc_drill, sz_drc_ring; -static Widget sz_text; -static Widget sz_set, sz_reset, sz_units; - -static int sz_str2val(Widget w, pcb_bool pcbu) -{ - char *buf = XmTextGetString(w); - if (!pcbu) - return strtol(buf, NULL, 0); - return GetValueEx(buf, NULL, NULL, NULL, conf_core.editor.grid_unit->suffix, NULL); -} - -static void sz_val2str(Widget w, Coord u, int pcbu) -{ - static char buf[40]; - if (pcbu) - pcb_sprintf(buf, "%m+%.2mS", conf_core.editor.grid_unit->allow, u); - else - pcb_snprintf(buf, sizeof(buf), "%#mS %%", u); - XmTextSetString(w, buf); -} - -static void sizes_set() -{ - PCB->MaxWidth = sz_str2val(sz_pcb_w, 1); - PCB->MaxHeight = sz_str2val(sz_pcb_h, 1); - PCB->Bloat = sz_str2val(sz_bloat, 1); - PCB->Shrink = sz_str2val(sz_shrink, 1); - PCB->minWid = sz_str2val(sz_drc_wid, 1); - PCB->minSlk = sz_str2val(sz_drc_slk, 1); - PCB->minDrill = sz_str2val(sz_drc_drill, 1); - PCB->minRing = sz_str2val(sz_drc_ring, 1); -#warning think these over - are these only for new designs amd we keep real values in PCB-> ? - conf_set_design("design/text_scale", "%s", sz_text); - conf_set_design("design/bloat", "%s", sz_bloat); - conf_set_design("design/shrink", "%s", sz_shrink); - conf_set_design("design/min_wid", "%s", sz_drc_wid); - conf_set_design("design/min_slk", "%s", sz_drc_slk); - conf_set_design("design/min_drill", "%s", sz_drc_drill); - conf_set_design("design/min_ring", "%s", sz_drc_ring); - - SetCrosshairRange(0, 0, PCB->MaxWidth, PCB->MaxHeight); - lesstif_pan_fixup(); -} - -void lesstif_sizes_reset() -{ - char *ls; - if (!sizes_dialog) - return; - sz_val2str(sz_pcb_w, PCB->MaxWidth, 1); - sz_val2str(sz_pcb_h, PCB->MaxHeight, 1); - sz_val2str(sz_bloat, PCB->Bloat, 1); - sz_val2str(sz_shrink, PCB->Shrink, 1); - sz_val2str(sz_drc_wid, PCB->minWid, 1); - sz_val2str(sz_drc_slk, PCB->minSlk, 1); - sz_val2str(sz_drc_drill, PCB->minDrill, 1); - sz_val2str(sz_drc_ring, PCB->minRing, 1); - sz_val2str(sz_text, conf_core.design.text_scale, 0); - - ls = pcb_strdup_printf(_("Units are %s."), conf_core.editor.grid_unit->in_suffix); - stdarg_n = 0; - stdarg(XmNlabelString, XmStringCreatePCB(ls)); - XtSetValues(sz_units, stdarg_args, stdarg_n); - free(ls); -} - -static Widget size_field(Widget parent, const char *label, int posn) -{ - Widget w, l; - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, posn); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, posn + 1); - stdarg(XmNcolumns, 10); - w = XmCreateTextField(parent, XmStrCast("field"), stdarg_args, stdarg_n); - XtManageChild(w); - - stdarg_n = 0; - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_WIDGET); - stdarg(XmNrightWidget, w); - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, posn); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, posn + 1); - stdarg(XmNlabelString, XmStringCreatePCB(label)); - stdarg(XmNalignment, XmALIGNMENT_END); - l = XmCreateLabel(parent, XmStrCast("label"), stdarg_args, stdarg_n); - XtManageChild(l); - - return w; -} - -static const char adjustsizes_syntax[] = "AdjustSizes()"; - -static const char adjustsizes_help[] = "Let the user change the board size, DRC parameters, etc"; - -/* %start-doc actions AdjustSizes - -Displays a dialog box that lets the user change the board -size, DRC parameters, and text scale. - -The units are determined by the default display units. - -%end-doc */ - -static int AdjustSizes(int argc, const char **argv, Coord x, Coord y) -{ - if (!sizes_dialog) { - Widget inf, sep; - - stdarg_n = 0; - stdarg(XmNmarginWidth, 3); - stdarg(XmNmarginHeight, 3); - stdarg(XmNhorizontalSpacing, 3); - stdarg(XmNverticalSpacing, 3); - stdarg(XmNautoUnmanage, False); - stdarg(XmNtitle, "Board Sizes"); - sizes_dialog = XmCreateFormDialog(mainwind, XmStrCast("sizes"), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - sz_reset = XmCreatePushButton(sizes_dialog, XmStrCast("Reset"), stdarg_args, stdarg_n); - XtManageChild(sz_reset); - XtAddCallback(sz_reset, XmNactivateCallback, (XtCallbackProc) lesstif_sizes_reset, 0); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_WIDGET); - stdarg(XmNrightWidget, sz_reset); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - sz_set = XmCreatePushButton(sizes_dialog, XmStrCast("Set"), stdarg_args, stdarg_n); - XtManageChild(sz_set); - XtAddCallback(sz_set, XmNactivateCallback, (XtCallbackProc) sizes_set, 0); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, sz_reset); - sep = XmCreateSeparator(sizes_dialog, XmStrCast("sep"), stdarg_args, stdarg_n); - XtManageChild(sep); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, sep); - sz_units = XmCreateLabel(sizes_dialog, XmStrCast("units"), stdarg_args, stdarg_n); - XtManageChild(sz_units); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, sz_units); - stdarg(XmNfractionBase, 9); - inf = XmCreateForm(sizes_dialog, XmStrCast("sizes"), stdarg_args, stdarg_n); - XtManageChild(inf); - - sz_pcb_w = size_field(inf, "PCB Width", 0); - sz_pcb_h = size_field(inf, "PCB Height", 1); - sz_bloat = size_field(inf, "Bloat", 2); - sz_shrink = size_field(inf, "Shrink", 3); - sz_drc_wid = size_field(inf, "DRC Min Wid", 4); - sz_drc_slk = size_field(inf, "DRC Min Silk", 5); - sz_drc_drill = size_field(inf, "DRC Min Drill", 6); - sz_drc_ring = size_field(inf, "DRC Min Annular Ring", 7); - sz_text = size_field(inf, "Text Scale", 8); - } - lesstif_sizes_reset(); - XtManageChild(sizes_dialog); - return 0; -} - -/* ------------------------------------------------------------ */ - -static Widget layer_groups_form = 0; -static Widget lg_buttonform = 0; - -static int lg_setcol[MAX_LAYER + 2]; -static int lg_width, lg_height; -static int lg_r[MAX_LAYER + 3]; -static int lg_c[MAX_LAYER + 1]; -static int lg_label_width, lg_fa, lg_fd; -static GC lg_gc = 0; - -#if 0 -static Widget lglabels[MAX_LAYER + 2]; -static Widget lgbuttons[MAX_LAYER + 2][MAX_LAYER]; -#endif - -typedef struct { - XFontStruct *font; - Pixel fg, bg, sel; -} LgResource; - -static LgResource lgr; - -static XtResource lg_resources[] = { - {(char*)"font", (char*)"Font", XtRFontStruct, sizeof(XFontStruct *), XtOffset(LgResource *, font), XtRString, (void *) "fixed"}, - {(char*)"foreground", (char*)"Foreground", XtRPixel, sizeof(Pixel), XtOffset(LgResource *, fg), XtRString, (void *) "black"}, - {(char*)"selectColor", (char*)"Foreground", XtRPixel, sizeof(Pixel), XtOffset(LgResource *, sel), XtRString, (void *) "blue"}, - {(char*)"background", (char*)"Background", XtRPixel, sizeof(Pixel), XtOffset(LgResource *, bg), XtRString, (void *) "white"} -}; - -#if 0 -static void lgbutton_cb(Widget w, int ij, void *cbs) -{ - int layer, group, k; - - layer = ij / max_group; - group = ij % max_group; - group = MoveLayerToGroup(layer, group); - for (k = 0; k < max_group; k++) { - if (k == group) - XmToggleButtonSetState(lgbuttons[layer][k], 1, 0); - else - XmToggleButtonSetState(lgbuttons[layer][k], 0, 0); - } -} -#endif - -static void lgbutton_expose(Widget w, XtPointer u, XmDrawingAreaCallbackStruct * cbs) -{ - int i; - Window win = XtWindow(w); - - if (cbs && cbs->event->xexpose.count) - return; - if (lg_gc == 0 && !cbs) - return; - if (lg_gc == 0 && cbs) { - lg_gc = XCreateGC(display, win, 0, 0); - XSetFont(display, lg_gc, lgr.font->fid); - } - - XSetForeground(display, lg_gc, lgr.bg); - XFillRectangle(display, win, lg_gc, 0, 0, lg_width, lg_height); - XSetForeground(display, lg_gc, lgr.fg); - for (i = 0; i < max_group; i++) - XDrawLine(display, win, lg_gc, lg_c[i], 0, lg_c[i], lg_height); - for (i = 1; i < max_copper_layer + 2; i++) - XDrawLine(display, win, lg_gc, lg_label_width, lg_r[i], lg_width, lg_r[i]); - for (i = 0; i < max_copper_layer + 2; i++) { - int dir; - XCharStruct size; - int swidth; - const char *name; - - if (i == solder_silk_layer) - name = SOLDER_SIDE_NAME; - else if (i == component_silk_layer) - name = COMPONENT_SIDE_NAME; - else - name = PCB->Data->Layer[i].Name; - XTextExtents(lgr.font, name, strlen(name), &dir, &lg_fa, &lg_fd, &size); - swidth = size.rbearing - size.lbearing; - XDrawString(display, win, lg_gc, - (lg_label_width - swidth) / 2 - size.lbearing, - (lg_r[i] + lg_r[i + 1] + lg_fd + lg_fa) / 2 - 1, name, strlen(name)); - } - XSetForeground(display, lg_gc, lgr.sel); - for (i = 0; i < max_copper_layer + 2; i++) { - int c = lg_setcol[i]; - int x1 = lg_c[c] + 2; - int x2 = lg_c[c + 1] - 2; - int y1 = lg_r[i] + 2; - int y2 = lg_r[i + 1] - 2; - XFillRectangle(display, win, lg_gc, x1, y1, x2 - x1 + 1, y2 - y1 + 1); - } -} - -static void lgbutton_input(Widget w, XtPointer u, XmDrawingAreaCallbackStruct * cbs) -{ - int layer, group; - if (cbs->event->type != ButtonPress) - return; - layer = cbs->event->xbutton.y * (max_copper_layer + 2) / lg_height; - group = (cbs->event->xbutton.x - lg_label_width) * max_group / (lg_width - lg_label_width); - group = MoveLayerToGroup(layer, group); - lg_setcol[layer] = group; - lgbutton_expose(w, 0, 0); - gui->invalidate_all(); -} - -static void lgbutton_resize(Widget w, XtPointer u, XmDrawingAreaCallbackStruct * cbs) -{ - int i; - Dimension width, height; - stdarg_n = 0; - stdarg(XmNwidth, &width); - stdarg(XmNheight, &height); - XtGetValues(w, stdarg_args, stdarg_n); - lg_width = width; - lg_height = height; - - for (i = 0; i <= max_group; i++) - lg_c[i] = lg_label_width + (lg_width - lg_label_width) * i / max_group; - for (i = 0; i <= max_copper_layer + 2; i++) - lg_r[i] = lg_height * i / (max_copper_layer + 2); - lgbutton_expose(w, 0, 0); -} - -void lesstif_update_layer_groups() -{ - int sets[MAX_LAYER + 2][MAX_LAYER]; - int i, j; - LayerGroupType *l = &(PCB->LayerGroups); - - if (!layer_groups_form) - return; - - memset(sets, 0, sizeof(sets)); - - for (i = 0; i < max_group; i++) - for (j = 0; j < l->Number[i]; j++) { - sets[l->Entries[i][j]][i] = 1; - lg_setcol[l->Entries[i][j]] = i; - } - - lg_label_width = 0; - for (i = 0; i < max_copper_layer + 2; i++) { - int dir; - XCharStruct size; - int swidth; - const char *name; - - if (i == solder_silk_layer) - name = SOLDER_SIDE_NAME; - else if (i == component_silk_layer) - name = COMPONENT_SIDE_NAME; - else - name = PCB->Data->Layer[i].Name; - XTextExtents(lgr.font, name, strlen(name), &dir, &lg_fa, &lg_fd, &size); - swidth = size.rbearing - size.lbearing; - if (lg_label_width < swidth) - lg_label_width = swidth; - } - lg_label_width += 4; - - stdarg_n = 0; - stdarg(XmNwidth, lg_label_width + (lg_fa + lg_fd) * max_group); - stdarg(XmNheight, (lg_fa + lg_fd) * (max_copper_layer + 2)); - XtSetValues(lg_buttonform, stdarg_args, stdarg_n); - lgbutton_expose(lg_buttonform, 0, 0); - -#if 0 - for (i = 0; i < max_copper_layer + 2; i++) { - char *name = "unknown"; - stdarg_n = 0; - if (i < max_copper_layer) - name = PCB->Data->Layer[i].Name; - else if (i == solder_silk_layer) - name = SOLDER_SIDE_NAME; - else if (i == component_silk_layer) - name = COMPONENT_SIDE_NAME; - stdarg(XmNlabelString, XmStringCreatePCB(name)); - XtSetValues(lglabels[i], stdarg_args, stdarg_n); - for (j = 0; j < max_group; j++) { - if (sets[i][j] != XmToggleButtonGetState(lgbuttons[i][j])) { - XmToggleButtonSetState(lgbuttons[i][j], sets[i][j], 0); - } - } - } - XtUnmanageChild(lg_buttonform); - for (i = 0; i < MAX_LAYER + 2; i++) - for (j = 0; j < MAX_LAYER; j++) { - if (i < max_copper_layer + 2 && j < max_group) { - XtManageChild(lgbuttons[i][j]); - stdarg_n = 0; - stdarg(XmNleftPosition, j * (max_copper_layer + 2)); - stdarg(XmNrightPosition, (j + 1) * (max_copper_layer + 2)); - stdarg(XmNtopPosition, i * max_group); - stdarg(XmNbottomPosition, (i + 1) * max_group); - XtSetValues(lgbuttons[i][j], stdarg_args, stdarg_n); - } - else - XtUnmanageChild(lgbuttons[i][j]); - } - stdarg_n = 0; - stdarg(XmNfractionBase, max_copper_layer + 2); - XtSetValues(layer_groups_form, stdarg_args, stdarg_n); - stdarg_n = 0; - stdarg(XmNfractionBase, max_group * (max_copper_layer + 2)); - XtSetValues(lg_buttonform, stdarg_args, stdarg_n); - XtManageChild(lg_buttonform); -#endif -} - -static const char editlayergroups_syntax[] = "EditLayerGroups()"; - -static const char editlayergroups_help[] = "Let the user change the layer groupings"; - -/* %start-doc actions EditLayerGroups - -Displays a dialog that lets the user view and change the layer -groupings. Each layer (row) can be a member of any one layer group -(column). Note the special layers @code{solder} and @code{component} -allow you to specify which groups represent the top and bottom of the -board. - -See @ref{ChangeName Action}. - -%end-doc */ - -static int EditLayerGroups(int argc, const char **argv, Coord x, Coord y) -{ - if (!layer_groups_form) { - - stdarg_n = 0; - stdarg(XmNfractionBase, max_copper_layer + 2); - stdarg(XmNtitle, "Layer Groups"); - layer_groups_form = XmCreateFormDialog(mainwind, XmStrCast("layers"), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - lg_buttonform = XmCreateDrawingArea(layer_groups_form, XmStrCast("layers"), stdarg_args, stdarg_n); - XtManageChild(lg_buttonform); - - XtAddCallback(lg_buttonform, XmNexposeCallback, (XtCallbackProc) lgbutton_expose, 0); - XtAddCallback(lg_buttonform, XmNinputCallback, (XtCallbackProc) lgbutton_input, 0); - XtAddCallback(lg_buttonform, XmNresizeCallback, (XtCallbackProc) lgbutton_resize, 0); - - XtGetSubresources(layer_groups_form, &lgr, "layergroups", "LayerGroups", lg_resources, XtNumber(lg_resources), 0, 0); -#if 0 - stdarg(XmNfractionBase, max_group * (MAX_LAYER + 2)); - lg_buttonform = XmCreateForm(layer_groups_form, "lgbutton", stdarg_args, stdarg_n); - - for (i = 0; i < MAX_LAYER + 2; i++) { - stdarg_n = 0; - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, i); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, i + 1); - stdarg(XmNrightAttachment, XmATTACH_WIDGET); - stdarg(XmNrightWidget, lg_buttonform); - lglabels[i] = XmCreateLabel(layer_groups_form, "layer", stdarg_args, stdarg_n); - XtManageChild(lglabels[i]); - - for (j = 0; j < MAX_LAYER; j++) { - stdarg_n = 0; - stdarg(XmNleftAttachment, XmATTACH_POSITION); - stdarg(XmNleftPosition, j * (MAX_LAYER + 2)); - stdarg(XmNrightAttachment, XmATTACH_POSITION); - stdarg(XmNrightPosition, (j + 1) * (MAX_LAYER + 2)); - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, i * MAX_LAYER); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, (i + 1) * MAX_LAYER); - stdarg(XmNlabelString, XmStringCreatePCB(" ")); - stdarg(XmNspacing, 0); - stdarg(XmNvisibleWhenOff, True); - stdarg(XmNfillOnSelect, True); - stdarg(XmNshadowThickness, 0); - stdarg(XmNmarginWidth, 0); - stdarg(XmNmarginHeight, 0); - stdarg(XmNhighlightThickness, 0); - lgbuttons[i][j] = XmCreateToggleButton(lg_buttonform, "label", stdarg_args, stdarg_n); - XtManageChild(lgbuttons[i][j]); - - XtAddCallback(lgbuttons[i][j], XmNvalueChangedCallback, (XtCallbackProc) lgbutton_cb, (XtPointer) (i * max_group + j)); - } - } -#endif - } - lesstif_update_layer_groups(); - XtManageChild(layer_groups_form); - return 1; -} - -/* ------------------------------------------------------------ */ - -typedef struct { - Widget del; - Widget w_name; - Widget w_value; -} AttrRow; - -static AttrRow *attr_row = 0; -static int attr_num_rows = 0; -static int attr_max_rows = 0; -static Widget attr_dialog = NULL, f_top; -static AttributeListType *attributes_list; - -static void attributes_delete_callback(Widget w, void *v, void *cbs); - -static void fiddle_with_bb_layout() -{ - int i; - int max_height = 0; - int max_del_width = 0; - int max_name_width = 0; - int max_value_width = 0; - short ncolumns = 20; - short vcolumns = 20; - - for (i = 0; i < attr_num_rows; i++) { - String v; - - stdarg_n = 0; - stdarg(XmNvalue, &v); - XtGetValues(attr_row[i].w_name, stdarg_args, stdarg_n); - if (ncolumns < strlen(v)) - ncolumns = strlen(v); - - stdarg_n = 0; - stdarg(XmNvalue, &v); - XtGetValues(attr_row[i].w_value, stdarg_args, stdarg_n); - if (vcolumns < strlen(v)) - vcolumns = strlen(v); - } - - for (i = 0; i < attr_num_rows; i++) { - stdarg_n = 0; - stdarg(XmNcolumns, ncolumns); - XtSetValues(attr_row[i].w_name, stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNcolumns, vcolumns); - XtSetValues(attr_row[i].w_value, stdarg_args, stdarg_n); - } - - for (i = 0; i < attr_num_rows; i++) { - Dimension w, h; - stdarg_n = 0; - stdarg(XmNwidth, &w); - stdarg(XmNheight, &h); - - XtGetValues(attr_row[i].del, stdarg_args, stdarg_n); - if (max_height < h) - max_height = h; - if (max_del_width < w) - max_del_width = w; - - XtGetValues(attr_row[i].w_name, stdarg_args, stdarg_n); - if (max_height < h) - max_height = h; - if (max_name_width < w) - max_name_width = w; - - XtGetValues(attr_row[i].w_value, stdarg_args, stdarg_n); - if (max_height < h) - max_height = h; - if (max_value_width < w) - max_value_width = w; - } - - for (i = 0; i < attr_num_rows; i++) { - stdarg_n = 0; - stdarg(XmNx, 0); - stdarg(XmNy, i * max_height); - stdarg(XmNwidth, max_del_width); - stdarg(XmNheight, max_height); - XtSetValues(attr_row[i].del, stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNx, max_del_width); - stdarg(XmNy, i * max_height); - stdarg(XmNwidth, max_name_width); - stdarg(XmNheight, max_height); - XtSetValues(attr_row[i].w_name, stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNx, max_del_width + max_name_width); - stdarg(XmNy, i * max_height); - stdarg(XmNwidth, max_value_width); - stdarg(XmNheight, max_height); - XtSetValues(attr_row[i].w_value, stdarg_args, stdarg_n); - } - - stdarg_n = 0; - stdarg(XmNwidth, max_del_width + max_name_width + max_value_width + 1); - stdarg(XmNheight, max_height * attr_num_rows + 1); - XtSetValues(f_top, stdarg_args, stdarg_n); -} - -static void lesstif_attributes_need_rows(int new_max) -{ - if (attr_max_rows < new_max) { - if (attr_row) - attr_row = (AttrRow *) realloc(attr_row, new_max * sizeof(AttrRow)); - else - attr_row = (AttrRow *) malloc(new_max * sizeof(AttrRow)); - } - - while (attr_max_rows < new_max) { - stdarg_n = 0; - attr_row[attr_max_rows].del = XmCreatePushButton(f_top, XmStrCast("del"), stdarg_args, stdarg_n); - XtManageChild(attr_row[attr_max_rows].del); - XtAddCallback(attr_row[attr_max_rows].del, XmNactivateCallback, - (XtCallbackProc) attributes_delete_callback, (XtPointer) (size_t) attr_max_rows); - - stdarg_n = 0; - stdarg(XmNresizeWidth, True); - attr_row[attr_max_rows].w_name = XmCreateTextField(f_top, XmStrCast("name"), stdarg_args, stdarg_n); - XtManageChild(attr_row[attr_max_rows].w_name); - XtAddCallback(attr_row[attr_max_rows].w_name, XmNvalueChangedCallback, (XtCallbackProc) fiddle_with_bb_layout, NULL); - - stdarg_n = 0; - stdarg(XmNresizeWidth, True); - attr_row[attr_max_rows].w_value = XmCreateTextField(f_top, XmStrCast("value"), stdarg_args, stdarg_n); - XtManageChild(attr_row[attr_max_rows].w_value); - XtAddCallback(attr_row[attr_max_rows].w_value, XmNvalueChangedCallback, (XtCallbackProc) fiddle_with_bb_layout, NULL); - - attr_max_rows++; - } - - /* Manage any previously unused rows we now need to show. */ - while (attr_num_rows < new_max) { - XtManageChild(attr_row[attr_num_rows].del); - XtManageChild(attr_row[attr_num_rows].w_name); - XtManageChild(attr_row[attr_num_rows].w_value); - attr_num_rows++; - } -} - -static void lesstif_attributes_revert() -{ - int i; - - lesstif_attributes_need_rows(attributes_list->Number); - - /* Unmanage any previously used rows we don't need. */ - while (attr_num_rows > attributes_list->Number) { - attr_num_rows--; - XtUnmanageChild(attr_row[attr_num_rows].del); - XtUnmanageChild(attr_row[attr_num_rows].w_name); - XtUnmanageChild(attr_row[attr_num_rows].w_value); - } - - /* Fill in values */ - for (i = 0; i < attributes_list->Number; i++) { - XmTextFieldSetString(attr_row[i].w_name, attributes_list->List[i].name); - XmTextFieldSetString(attr_row[i].w_value, attributes_list->List[i].value); - } - - fiddle_with_bb_layout(); -} - -static void attributes_new_callback(Widget w, void *v, void *cbs) -{ - lesstif_attributes_need_rows(attr_num_rows + 1); /* also bumps attr_num_rows */ - XmTextFieldSetString(attr_row[attr_num_rows - 1].w_name, XmStrCast("")); - XmTextFieldSetString(attr_row[attr_num_rows - 1].w_value, XmStrCast("")); - - fiddle_with_bb_layout(); -} - -static void attributes_delete_callback(Widget w, void *v, void *cbs) -{ - int i, n; - Widget wn, wv; - - n = (int) (size_t) v; - - wn = attr_row[n].w_name; - wv = attr_row[n].w_value; - - for (i = n; i < attr_num_rows - 1; i++) { - attr_row[i].w_name = attr_row[i + 1].w_name; - attr_row[i].w_value = attr_row[i + 1].w_value; - } - attr_row[attr_num_rows - 1].w_name = wn; - attr_row[attr_num_rows - 1].w_value = wv; - attr_num_rows--; - - XtUnmanageChild(wn); - XtUnmanageChild(wv); - - fiddle_with_bb_layout(); -} - -static void attributes_revert_callback(Widget w, void *v, void *cbs) -{ - lesstif_attributes_revert(); -} - -void lesstif_attributes_dialog(const char *owner, AttributeListType * attrs_list) -{ - Widget bform, sw, b_ok, b_cancel, b_revert, b_new; - Widget sep; - - if (attr_dialog == NULL) { - stdarg_n = 0; - stdarg(XmNautoUnmanage, False); - stdarg(XmNtitle, owner); - stdarg(XmNwidth, 400); - stdarg(XmNheight, 300); - attr_dialog = XmCreateFormDialog(mainwind, XmStrCast("attributes"), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNorientation, XmHORIZONTAL); - stdarg(XmNentryAlignment, XmALIGNMENT_CENTER); - stdarg(XmNpacking, XmPACK_COLUMN); - bform = XmCreateRowColumn(attr_dialog, XmStrCast("attributes"), stdarg_args, stdarg_n); - XtManageChild(bform); - - stdarg_n = 0; - b_ok = XmCreatePushButton(bform, XmStrCast("OK"), stdarg_args, stdarg_n); - XtManageChild(b_ok); - XtAddCallback(b_ok, XmNactivateCallback, (XtCallbackProc) dialog_callback, (XtPointer) 0); - - stdarg_n = 0; - b_new = XmCreatePushButton(bform, XmStrCast("New"), stdarg_args, stdarg_n); - XtManageChild(b_new); - XtAddCallback(b_new, XmNactivateCallback, (XtCallbackProc) attributes_new_callback, NULL); - - stdarg_n = 0; - b_revert = XmCreatePushButton(bform, XmStrCast("Revert"), stdarg_args, stdarg_n); - XtManageChild(b_revert); - XtAddCallback(b_revert, XmNactivateCallback, (XtCallbackProc) attributes_revert_callback, NULL); - - stdarg_n = 0; - b_cancel = XmCreatePushButton(bform, XmStrCast("Cancel"), stdarg_args, stdarg_n); - XtManageChild(b_cancel); - XtAddCallback(b_cancel, XmNactivateCallback, (XtCallbackProc) dialog_callback, (XtPointer) 1); - - stdarg_n = 0; - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, bform); - sep = XmCreateSeparator(attr_dialog, XmStrCast("attributes"), stdarg_args, stdarg_n); - XtManageChild(sep); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_WIDGET); - stdarg(XmNbottomWidget, sep); - stdarg(XmNscrollingPolicy, XmAUTOMATIC); - sw = XmCreateScrolledWindow(attr_dialog, XmStrCast("attributes"), stdarg_args, stdarg_n); - XtManageChild(sw); - - stdarg_n = 0; - stdarg(XmNmarginHeight, 0); - stdarg(XmNmarginWidth, 0); - f_top = XmCreateBulletinBoard(sw, XmStrCast("f_top"), stdarg_args, stdarg_n); - XtManageChild(f_top); - } - else { - stdarg_n = 0; - stdarg(XmNtitle, owner); - XtSetValues(XtParent(attr_dialog), stdarg_args, stdarg_n); - } - - attributes_list = attrs_list; - lesstif_attributes_revert(); - - fiddle_with_bb_layout(); - - if (wait_for_dialog(attr_dialog) == 0) { - int i; - /* Copy the values back */ - for (i = 0; i < attributes_list->Number; i++) { - if (attributes_list->List[i].name) - free(attributes_list->List[i].name); - if (attributes_list->List[i].value) - free(attributes_list->List[i].value); - } - if (attributes_list->Max < attr_num_rows) { - int sz = attr_num_rows * sizeof(AttributeType); - if (attributes_list->List == NULL) - attributes_list->List = (AttributeType *) malloc(sz); - else - attributes_list->List = (AttributeType *) realloc(attributes_list->List, sz); - attributes_list->Max = attr_num_rows; - } - for (i = 0; i < attr_num_rows; i++) { - attributes_list->List[i].name = pcb_strdup(XmTextFieldGetString(attr_row[i].w_name)); - attributes_list->List[i].value = pcb_strdup(XmTextFieldGetString(attr_row[i].w_value)); - attributes_list->Number = attr_num_rows; - } - } - - return; -} - -/* ------------------------------------------------------------ */ - -static const char importgui_syntax[] = "ImportGUI()"; - -static const char importgui_help[] = "Lets the user choose the schematics to import from"; - -/* %start-doc actions ImportGUI - -Displays a dialog that lets the user select the schematic(s) to import -from, then saves that information in the layout's attributes for -future imports. - -%end-doc */ - -static int ImportGUI(int argc, const char **argv, Coord x, Coord y) -{ - static int I_am_recursing = 0; - static XmString xms_sch = 0, xms_import = 0; - int rv; - XmString xmname; - char *name, *bname; - char *original_dir, *target_dir, *last_slash; - - if (I_am_recursing) - return 1; - - if (xms_sch == 0) - xms_sch = XmStringCreatePCB("*.sch"); - if (xms_import == 0) - xms_import = XmStringCreatePCB("Import from"); - - setup_fsb_dialog(); - - stdarg_n = 0; - stdarg(XmNtitle, "Import From"); - XtSetValues(XtParent(fsb), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNpattern, xms_sch); - stdarg(XmNmustMatch, True); - stdarg(XmNselectionLabelString, xms_import); - XtSetValues(fsb, stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNdirectory, &xmname); - XtGetValues(fsb, stdarg_args, stdarg_n); - XmStringGetLtoR(xmname, XmFONTLIST_DEFAULT_TAG, &original_dir); - - if (!wait_for_dialog(fsb)) - return 1; - - stdarg_n = 0; - stdarg(XmNdirectory, &xmname); - XtGetValues(fsb, stdarg_args, stdarg_n); - XmStringGetLtoR(xmname, XmFONTLIST_DEFAULT_TAG, &target_dir); - - stdarg_n = 0; - stdarg(XmNdirSpec, &xmname); - XtGetValues(fsb, stdarg_args, stdarg_n); - - XmStringGetLtoR(xmname, XmFONTLIST_DEFAULT_TAG, &name); - - /* If the user didn't change directories, use just the base name. - This is the common case and means we don't have to get clever - about converting absolute paths into relative paths. */ - bname = name; - if (strcmp(original_dir, target_dir) == 0) { - last_slash = strrchr(name, '/'); - if (last_slash) - bname = last_slash + 1; - } - - AttributePut(PCB, "import::src0", bname); - - XtFree(name); - - - I_am_recursing = 1; - rv = hid_action("Import"); - I_am_recursing = 0; - - return rv; -} - -/* ------------------------------------------------------------ */ - -HID_Action lesstif_dialog_action_list[] = { - {"Load", 0, Load, - load_help, load_syntax} - , - {"LoadVendor", 0, LoadVendor, - loadvendor_help, loadvendor_syntax} - , - {"Save", 0, Save, - save_help, save_syntax} - , - {"DoWindows", 0, DoWindows, - dowindows_help, dowindows_syntax} - , - {"PromptFor", 0, PromptFor, - promptfor_help, promptfor_syntax} - , - {"Confirm", 0, ConfirmAction} - , - {"About", 0, About, - about_help, about_syntax} - , - {"Print", 0, Print, - print_help, print_syntax} - , - {"PrintCalibrate", 0, PrintCalibrate, - printcalibrate_help, printcalibrate_syntax} - , - {"Export", 0, Export, - export_help, export_syntax} - , - {"AdjustSizes", 0, AdjustSizes, - adjustsizes_help, adjustsizes_syntax} - , - {"EditLayerGroups", 0, EditLayerGroups, - editlayergroups_help, editlayergroups_syntax} - , - {"ImportGUI", 0, ImportGUI, - importgui_help, importgui_syntax} - , -}; - -REGISTER_ACTIONS(lesstif_dialog_action_list, lesstif_cookie) Index: 1.1.4/src_plugins/hid_lesstif/xincludes.h =================================================================== --- 1.1.4/src_plugins/hid_lesstif/xincludes.h (revision 10776) +++ 1.1.4/src_plugins/hid_lesstif/xincludes.h (nonexistent) @@ -1,46 +0,0 @@ -/* - * Some of the X headers are not very friendly in terms of namespace. - * For example, X.h typedef's Mask but we use Mask in the core of pcb - * and this causes problem. To avoid this, pull in the X headers in - * this file where we can add workarounds as needed. - */ - -#define Mask X_Mask - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_XRENDER -#include -#endif /* HAVE_XRENDER */ - -#ifdef HAVE_XINERAMA -#include -#endif /* HAVE_XINERAMA */ - -#undef Mask Index: 1.1.4/src_plugins/hid_lesstif/styles.c =================================================================== --- 1.1.4/src_plugins/hid_lesstif/styles.c (revision 10776) +++ 1.1.4/src_plugins/hid_lesstif/styles.c (nonexistent) @@ -1,440 +0,0 @@ -#include "xincludes.h" - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include - -#include "compat_misc.h" -#include "global.h" -#include "data.h" -#include "set.h" -#include "misc.h" -#include "mymem.h" -#include "pcb-printf.h" - -#include "hid.h" -#include "lesstif.h" -#include "hid_flags.h" -#include "stdarg.h" -#include "misc_util.h" - -/* There are three places where styles are kept: - - First, the "active" style is in conf_core.design.line_thickness et al. - - Second, there are NUM_STYLES styles in PCB->RouteStyle[]. - - (not anymore: Third, there are NUM_STYLES styles in conf_core.design.RouteStyle[]) - - Selecting a style copies its values to the active style. We also - need a way to modify the active style, copy the active style to - PCB->RouteStyle[], and copy PCB->RouteStyle[] to - Settings.RouteStyle[]. Since Lesstif reads the default style from - .Xdefaults, we can ignore Settings.RouteStyle[] in general, as it's - only used to initialize new PCB files. - - So, we need to do PCB->RouteStyle <-> active style. -*/ - -typedef enum { - SSthick, SSdiam, SShole, SSkeep, - SSNUM -} StyleValues; - -static Widget style_dialog = 0; -static Widget style_values[SSNUM]; - -/* dynamic arrays for styles */ -static int alloced_styles = 0; -static Widget *style_pb; -static Widget *units_pb; -static int *name_hashes; -typedef struct { - Widget *w; -} StyleButtons; - -static StyleButtons *style_button_list = NULL; -static int num_style_buttons = 0; /* number of style_button_list instances (depends on how many times it's placed in the menu) */ -/**/ - -static Widget value_form, value_labels, value_texts, units_form; -static int local_update = 0; -XmString xms_mm, xms_mil; - -static const Unit *unit = 0; -static XmString ustr; - -static int hash(char *cp) -{ - int h = 0; - while (*cp) { - h = h * 13 + *(unsigned char *) cp; - h ^= (h >> 16); - cp++; - } - return h; -} - -static const char *value_names[] = { - "Thickness", "Diameter", "Hole", "Clearance" -}; - -static int RouteStylesChanged(int argc, const char **argv, Coord x, Coord y); - -static void update_one_value(int i, Coord v) -{ - char buf[100]; - - pcb_snprintf(buf, sizeof(buf), "%m+%.2mS", unit->allow, v); - XmTextSetString(style_values[i], buf); - stdarg_n = 0; - stdarg(XmNlabelString, ustr); - XtSetValues(units_pb[i], stdarg_args, stdarg_n); -} - -static void update_values() -{ - local_update = 1; - update_one_value(SSthick, conf_core.design.line_thickness); - update_one_value(SSdiam, conf_core.design.via_thickness); - update_one_value(SShole, conf_core.design.via_drilling_hole); - update_one_value(SSkeep, conf_core.design.clearance); - local_update = 0; - lesstif_update_status_line(); -} - -void lesstif_styles_update_values() -{ - if (!style_dialog) { - lesstif_update_status_line(); - return; - } - unit = conf_core.editor.grid_unit; - ustr = XmStringCreateLocalized((char *) conf_core.editor.grid_unit->suffix); - update_values(); -} - -static void update_style_buttons() -{ - int i = hid_get_flag("GetStyle()"); - int j, n; - - for (n = 0; n < num_style_buttons; n++) { - for (j = 0; j < vtroutestyle_len(&PCB->RouteStyle); j++) - if (j != i) - XmToggleButtonSetState(style_button_list[n].w[j], 0, 0); - else - XmToggleButtonSetState(style_button_list[n].w[j], 1, 0); - } - if (style_dialog) { - for (j = 0; j < vtroutestyle_len(&PCB->RouteStyle); j++) - if (j != i) - XmToggleButtonSetState(style_pb[j], 0, 0); - else - XmToggleButtonSetState(style_pb[j], 1, 0); - } -} - -static void style_value_cb(Widget w, int i, void *cbs) -{ - char *s; - - if (local_update) - return; - s = XmTextGetString(w); - GetValueEx(s, NULL, NULL, NULL, unit->suffix, NULL); - switch (i) { - case SSthick: - conf_setf(CFR_DESIGN, "design/line_thickness", -1, "%s %s", s, unit->suffix); - break; - case SSdiam: - conf_setf(CFR_DESIGN, "design/via_thickness", -1, "%s %s", s, unit->suffix); - break; - case SShole: - conf_setf(CFR_DESIGN, "design/via_drilling_hole", -1, "%s %s", s, unit->suffix); - break; - case SSkeep: - conf_setf(CFR_DESIGN, "design/clearance", -1, "%s %s", s, unit->suffix); - break; - } - update_style_buttons(); -} - -static void units_cb() -{ - if (unit == get_unit_struct("mm")) - unit = get_unit_struct("mil"); - else - unit = get_unit_struct("mm"); - ustr = XmStringCreateLocalized((char *) unit->suffix); - update_values(); -} - -static Widget style_value(int i) -{ - Widget w, l; - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, i); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, i + 1); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNalignment, XmALIGNMENT_END); - l = XmCreateLabel(value_labels, XmStrCast(value_names[i]), stdarg_args, stdarg_n); - XtManageChild(l); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, i); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, i + 1); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNcolumns, 8); - w = XmCreateTextField(value_texts, XmStrCast(value_names[i]), stdarg_args, stdarg_n); - XtAddCallback(w, XmNvalueChangedCallback, (XtCallbackProc) style_value_cb, (XtPointer) (size_t) i); - XtManageChild(w); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_POSITION); - stdarg(XmNtopPosition, i); - stdarg(XmNbottomAttachment, XmATTACH_POSITION); - stdarg(XmNbottomPosition, i + 1); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNlabelString, ustr); - units_pb[i] = XmCreatePushButton(units_form, XmStrCast(value_names[i]), stdarg_args, stdarg_n); - XtAddCallback(units_pb[i], XmNactivateCallback, (XtCallbackProc) units_cb, (XtPointer) (size_t) i); - XtManageChild(units_pb[i]); - - return w; -} - -static void style_name_cb(Widget w, int i, XmToggleButtonCallbackStruct * cbs) -{ - char *newname = lesstif_prompt_for("New name", PCB->RouteStyle.array[i].name); - strncpy(PCB->RouteStyle.array[i].name, newname, sizeof(PCB->RouteStyle.array[i].name)-1); - PCB->RouteStyle.array[i].name[sizeof(PCB->RouteStyle.array[i].name)-1] = '\0'; - free(newname); - - RouteStylesChanged(0, 0, 0, 0); -} - -static void style_set_cb(Widget w, int i, XmToggleButtonCallbackStruct * cbs) -{ - PCB->RouteStyle.array[i].Thick = conf_core.design.line_thickness; - PCB->RouteStyle.array[i].Diameter = conf_core.design.via_thickness; - PCB->RouteStyle.array[i].Hole = conf_core.design.via_drilling_hole; - PCB->RouteStyle.array[i].Clearance = conf_core.design.clearance; - update_style_buttons(); -} - -static void style_selected(Widget w, int i, XmToggleButtonCallbackStruct * cbs) -{ - RouteStyleType *style; - int j, n; - if (cbs && cbs->set == 0) { - XmToggleButtonSetState(w, 1, 0); - return; - } - style = PCB->RouteStyle.array + i; - SetLineSize(style->Thick); - SetViaSize(style->Diameter, pcb_true); - SetViaDrillingHole(style->Hole, pcb_true); - SetClearanceWidth(style->Clearance); - if (style_dialog) { - for (j = 0; j < vtroutestyle_len(&PCB->RouteStyle); j++) - if (j != i) - XmToggleButtonSetState(style_pb[j], 0, 0); - else - XmToggleButtonSetState(style_pb[j], 1, 0); - update_values(); - } - else - lesstif_update_status_line(); - for (n = 0; n < num_style_buttons; n++) { - for (j = 0; j < vtroutestyle_len(&PCB->RouteStyle); j++) - if (j != i) - XmToggleButtonSetState(style_button_list[n].w[j], 0, 0); - else - XmToggleButtonSetState(style_button_list[n].w[j], 1, 0); - } -} - -static Widget style_button(int i) -{ - Widget pb, set; - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_WIDGET); - stdarg(XmNtopWidget, i ? style_pb[i - 1] : value_form); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNlabelString, XmStringCreatePCB("Name")); - set = XmCreatePushButton(style_dialog, XmStrCast("style"), stdarg_args, stdarg_n); - XtManageChild(set); - XtAddCallback(set, XmNactivateCallback, (XtCallbackProc) style_name_cb, (XtPointer) (size_t) i); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_WIDGET); - stdarg(XmNtopWidget, i ? style_pb[i - 1] : value_form); - stdarg(XmNleftAttachment, XmATTACH_WIDGET); - stdarg(XmNleftWidget, set); - stdarg(XmNlabelString, XmStringCreatePCB("Set")); - set = XmCreatePushButton(style_dialog, XmStrCast("style"), stdarg_args, stdarg_n); - XtManageChild(set); - XtAddCallback(set, XmNactivateCallback, (XtCallbackProc) style_set_cb, (XtPointer) (size_t) i); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_WIDGET); - stdarg(XmNtopWidget, i ? style_pb[i - 1] : value_form); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_WIDGET); - stdarg(XmNleftWidget, set); - stdarg(XmNlabelString, XmStringCreatePCB(PCB->RouteStyle.array[i].name)); - stdarg(XmNindicatorType, XmONE_OF_MANY); - stdarg(XmNalignment, XmALIGNMENT_BEGINNING); - pb = XmCreateToggleButton(style_dialog, XmStrCast("style"), stdarg_args, stdarg_n); - XtManageChild(pb); - XtAddCallback(pb, XmNvalueChangedCallback, (XtCallbackProc) style_selected, (XtPointer) (size_t) i); - return pb; -} - -static const char adjuststyle_syntax[] = "AdjustStyle()"; - -static const char adjuststyle_help[] = "Displays the route style adjustment window."; - -/* %start-doc actions AdjustStyle - -%end-doc */ - -static int AdjustStyle(int argc, const char **argv, Coord x, Coord y) -{ - if ((!mainwind) || (PCB->RouteStyle.array == NULL)) - return 1; - if (style_dialog == 0) { - int i; - - unit = conf_core.editor.grid_unit; - ustr = XmStringCreateLocalized((char *) unit->suffix); - - stdarg_n = 0; - stdarg(XmNautoUnmanage, False); - stdarg(XmNtitle, "Route Styles"); - style_dialog = XmCreateFormDialog(mainwind, XmStrCast("style"), stdarg_args, stdarg_n); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - value_form = XmCreateForm(style_dialog, XmStrCast("values"), stdarg_args, stdarg_n); - XtManageChild(value_form); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNfractionBase, 4); - stdarg(XmNresizePolicy, XmRESIZE_GROW); - units_form = XmCreateForm(value_form, XmStrCast("units"), stdarg_args, stdarg_n); - XtManageChild(units_form); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNfractionBase, 4); - value_labels = XmCreateForm(value_form, XmStrCast("values"), stdarg_args, stdarg_n); - XtManageChild(value_labels); - - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_WIDGET); - stdarg(XmNrightWidget, units_form); - stdarg(XmNleftAttachment, XmATTACH_WIDGET); - stdarg(XmNleftWidget, value_labels); - stdarg(XmNfractionBase, 4); - value_texts = XmCreateForm(value_form, XmStrCast("values"), stdarg_args, stdarg_n); - XtManageChild(value_texts); - - for (i = 0; i < SSNUM; i++) { - style_values[i] = style_value(i); - name_hashes[i] = hash(PCB->RouteStyle.array[i].name); - } - for (i = 0; i < vtroutestyle_len(&PCB->RouteStyle); i++) - style_pb[i] = style_button(i); - update_values(); - update_style_buttons(); - } - XtManageChild(style_dialog); - return 0; -} - -static int RouteStylesChanged(int argc, const char **argv, Coord x, Coord y) -{ - int i, j, h; - if (!PCB || vtroutestyle_len(&PCB->RouteStyle) == 0) - return 0; - update_style_buttons(); - if (!style_dialog) - return 0; - for (j = 0; j < vtroutestyle_len(&PCB->RouteStyle); j++) { - h = hash(PCB->RouteStyle.array[j].name); - if (name_hashes[j] == h) - continue; - name_hashes[j] = h; - stdarg_n = 0; - stdarg(XmNlabelString, XmStringCreatePCB(PCB->RouteStyle.array[j].name)); - if (style_dialog) - XtSetValues(style_pb[j], stdarg_args, stdarg_n); - for (i = 0; i < num_style_buttons; i++) - XtSetValues(style_button_list[i].w[j], stdarg_args, stdarg_n); - } - update_values(); - return 0; -} - -void lesstif_insert_style_buttons(Widget menu) -{ - StyleButtons *sb; - int s, i; - - num_style_buttons++; - s = num_style_buttons * sizeof(StyleButtons); - style_button_list = (StyleButtons *) realloc(style_button_list, s); - sb = style_button_list + num_style_buttons - 1; - sb->w = NULL; - - alloced_styles = vtroutestyle_len(&PCB->RouteStyle); - style_pb = realloc(style_pb, sizeof(style_pb[0]) * alloced_styles); - units_pb = realloc(units_pb, sizeof(units_pb[0]) * alloced_styles); - name_hashes = realloc(name_hashes, sizeof(name_hashes[0]) * alloced_styles); - sb->w = realloc(sb->w, sizeof(sb->w[0]) * alloced_styles); - - for (i = 0; i < vtroutestyle_len(&PCB->RouteStyle); i++) { - Widget btn; - stdarg_n = 0; - stdarg(XmNindicatorType, XmONE_OF_MANY); - stdarg(XmNlabelString, XmStringCreatePCB(PCB->RouteStyle.array[i].name)); - btn = XmCreateToggleButton(menu, XmStrCast("style"), stdarg_args, stdarg_n); - XtManageChild(btn); - XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc) style_selected, (XtPointer) (size_t) i); - sb->w[i] = btn; - } - update_style_buttons(); -} - -HID_Action lesstif_styles_action_list[] = { - {"AdjustStyle", 0, AdjustStyle, - adjuststyle_help, adjuststyle_syntax} - , - {"RouteStylesChanged", 0, RouteStylesChanged, - routestyleschanged_help, routestyleschanged_syntax} -}; - -REGISTER_ACTIONS(lesstif_styles_action_list, lesstif_cookie) Index: 1.1.4/src_plugins/hid_lesstif/main.c =================================================================== --- 1.1.4/src_plugins/hid_lesstif/main.c (revision 10776) +++ 1.1.4/src_plugins/hid_lesstif/main.c (nonexistent) @@ -1,3854 +0,0 @@ -/* 15 Oct 2008 Ineiev: add different crosshair shapes */ - -#include "xincludes.h" - -#include "config.h" -#include "conf_core.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "global.h" -#include "data.h" -#include "action_helper.h" -#include "crosshair.h" -#include "layer.h" -#include "mymem.h" -#include "misc.h" -#include "pcb-printf.h" -#include "clip.h" -#include "event.h" -#include "error.h" -#include "plugins.h" - -#include "hid.h" -#include "hid_nogui.h" -#include "hid_draw_helpers.h" -#include "hid_cfg.h" -#include "lesstif.h" -#include "hid_cfg_input.h" -#include "hid_attrib.h" -#include "hid_helper.h" -#include "hid_init.h" -#include "hid_color.h" -#include "hid_extents.h" -#include "hid_flags.h" -#include "hid_actions.h" -#include "stdarg.h" -#include "misc_util.h" -#include "compat_misc.h" - -#include - -const char *lesstif_cookie = "lesstif HID"; - -hid_cfg_mouse_t lesstif_mouse; -hid_cfg_keys_t lesstif_keymap; - - -#ifndef XtRDouble -#define XtRDouble "Double" -#endif - -/* How big the viewport can be relative to the pcb size. */ -#define MAX_ZOOM_SCALE 10 -#define UUNIT conf_core.editor.grid_unit->allow - -typedef struct hid_gc_struct { - HID *me_pointer; - Pixel color; - char *colorname; - int width; - EndCapStyle cap; - char xor_set; - char erase; -} hid_gc_struct; - -static HID lesstif_hid; - -#define CRASH(func) fprintf(stderr, "HID error: pcb called unimplemented GUI function %s\n", func), abort() - -XtAppContext app_context; -Widget appwidget; -Display *display; -static Window window = 0; -static Cursor my_cursor = 0; -static int old_cursor_mode = -1; -static int over_point = 0; - -/* The first is the "current" pixmap. The main_ is the real one we - usually use, the mask_ are the ones for doing polygon masks. The - pixmap is the saved pixels, the bitmap is for the "erase" color. - We set pixmap to point to main_pixmap or mask_pixmap as needed. */ -static Pixmap pixmap = 0; -static Pixmap main_pixmap = 0; -static Pixmap mask_pixmap = 0; -static Pixmap mask_bitmap = 0; -static int use_mask = 0; - -static int use_xrender = 0; -#ifdef HAVE_XRENDER -static Picture main_picture; -static Picture mask_picture; -static Pixmap pale_pixmap; -static Picture pale_picture; -#endif /* HAVE_XRENDER */ - -static int pixmap_w = 0, pixmap_h = 0; -Screen *screen_s; -int screen; -Colormap lesstif_colormap; -static GC my_gc = 0, bg_gc, clip_gc = 0, bset_gc = 0, bclear_gc = 0, mask_gc = 0; -static Pixel bgcolor, offlimit_color, grid_color; -static int bgred, bggreen, bgblue; - -static GC arc1_gc, arc2_gc; - -/* These are for the pinout windows. */ -typedef struct PinoutData { - struct PinoutData *prev, *next; - Widget form; - Window window; - Coord left, right, top, bottom; /* PCB extents of item */ - Coord x, y; /* PCB coordinates of upper right corner of window */ - double zoom; /* PCB units per screen pixel */ - int v_width, v_height; /* pixels */ - void *item; -} PinoutData; - -/* Linked list of all pinout windows. */ -static PinoutData *pinouts = 0; -/* If set, we are currently updating this pinout window. */ -static PinoutData *pinout = 0; - -static int crosshair_x = 0, crosshair_y = 0; -static int in_move_event = 0, crosshair_in_window = 1; - -Widget mainwind; -Widget work_area, messages, command, hscroll, vscroll; -static Widget m_mark, m_crosshair, m_grid, m_zoom, m_mode, m_status; -static Widget m_rats; -Widget lesstif_m_layer; -Widget m_click; - -/* This is the size, in pixels, of the viewport. */ -static int view_width, view_height; -/* This is the PCB location represented by the upper left corner of - the viewport. Note that PCB coordinates put 0,0 in the upper left, - much like X does. */ -static int view_left_x = 0, view_top_y = 0; -/* Denotes PCB units per screen pixel. Larger numbers mean zooming - out - the largest value means you are looking at the whole - board. */ -static double view_zoom = PCB_MIL_TO_COORD(10), prev_view_zoom = PCB_MIL_TO_COORD(10); -static pcb_bool autofade = 0; -static pcb_bool crosshair_on = pcb_true; - -static void lesstif_begin(void); -static void lesstif_end(void); - -static void ShowCrosshair(pcb_bool show) -{ - if (crosshair_on == show) - return; - - notify_crosshair_change(pcb_false); - if (Marked.status) - notify_mark_change(pcb_false); - - crosshair_on = show; - - notify_crosshair_change(pcb_true); - if (Marked.status) - notify_mark_change(pcb_true); -} - -/* This is the size of the current PCB work area. */ -/* Use PCB->MaxWidth, PCB->MaxHeight. */ -/* static int pcb_width, pcb_height; */ - static int use_private_colormap = 0; - static int stdin_listen = 0; - static char *background_image_file = 0; - - HID_Attribute lesstif_attribute_list[] = { - {"install", "Install private colormap", - HID_Boolean, 0, 0, {0, 0, 0}, 0, &use_private_colormap}, -#define HA_colormap 0 - -/* %start-doc options "22 lesstif GUI Options" -@ftable @code -@item --listen -Listen for actions on stdin. -@end ftable -%end-doc -*/ - {"listen", "Listen on standard input for actions", - HID_Boolean, 0, 0, {0, 0, 0}, 0, &stdin_listen}, -#define HA_listen 1 - -/* %start-doc options "22 lesstif GUI Options" -@ftable @code -@item --bg-image -File name of an image to put into the background of the GUI canvas. The image must -be a color PPM image, in binary (not ASCII) format. It can be any size, and will be -automatically scaled to fit the canvas. -@end ftable -%end-doc -*/ - {"bg-image", "Background Image", - HID_String, 0, 0, {0, 0, 0}, 0, &background_image_file}, -#define HA_bg_image 2 - -/* %start-doc options "22 lesstif GUI Options" -@ftable @code -@item --pcb-menu -Location of the @file{pcb-menu.res} file which defines the menu for the lesstif GUI. -@end ftable -%end-doc -*/ -#warning TODO#1: this should be generic and not depend on the HID -/* - {"pcb-menu", "Location of pcb-menu.res file", - HID_String, 0, 0, {0, PCBSHAREDIR "/pcb-menu.res", 0}, 0, &lesstif_pcbmenu_path} -#define HA_pcbmenu 3 -*/ - }; - -REGISTER_ATTRIBUTES(lesstif_attribute_list, lesstif_cookie) - - static void lesstif_use_mask(int use_it); - static void zoom_max(); - static void zoom_to(double factor, int x, int y); - static void zoom_by(double factor, int x, int y); - static void zoom_toggle(int x, int y); - static void pinout_callback(Widget, PinoutData *, XmDrawingAreaCallbackStruct *); - static void pinout_unmap(Widget, PinoutData *, void *); - static void Pan(int mode, int x, int y); - -/* Px converts view->pcb, Vx converts pcb->view */ - - static inline int - Vx(Coord x) -{ - int rv = (x - view_left_x) / view_zoom + 0.5; - if (conf_core.editor.view.flip_x) - rv = view_width - rv; - return rv; -} - -static inline int Vy(Coord y) -{ - int rv = (y - view_top_y) / view_zoom + 0.5; - if (conf_core.editor.view.flip_y) - rv = view_height - rv; - return rv; -} - -static inline int Vz(Coord z) -{ - return z / view_zoom + 0.5; -} - -static inline Coord Px(int x) -{ - if (conf_core.editor.view.flip_x) - x = view_width - x; - return x * view_zoom + view_left_x; -} - -static inline Coord Py(int y) -{ - if (conf_core.editor.view.flip_y) - y = view_height - y; - return y * view_zoom + view_top_y; -} - -static inline Coord Pz(int z) -{ - return z * view_zoom; -} - -void lesstif_coords_to_pcb(int vx, int vy, Coord * px, Coord * py) -{ - *px = Px(vx); - *py = Py(vy); -} - -Pixel lesstif_parse_color(const char *value) -{ - XColor color; - if (XParseColor(display, lesstif_colormap, value, &color)) - if (XAllocColor(display, lesstif_colormap, &color)) - return color.pixel; - return 0; -} - -/* ------------------------------------------------------------ */ - -static const char *cur_clip() -{ - if (conf_core.editor.orthogonal_moves) - return "+"; - if (conf_core.editor.all_direction_lines) - return "*"; - if (conf_core.editor.line_refraction == 0) - return "X"; - if (conf_core.editor.line_refraction == 1) - return "_/"; - return "\\_"; -} - -/* Called from the core when it's busy doing something and we need to - indicate that to the user. */ -static int Busy(int argc, const char **argv, Coord x, Coord y) -{ - static Cursor busy_cursor = 0; - if (busy_cursor == 0) - busy_cursor = XCreateFontCursor(display, XC_watch); - XDefineCursor(display, window, busy_cursor); - XFlush(display); - old_cursor_mode = -1; - return 0; -} - -/* ---------------------------------------------------------------------- */ - -/* Local actions. */ - -static int PointCursor(int argc, const char **argv, Coord x, Coord y) -{ - if (argc > 0) - over_point = 1; - else - over_point = 0; - old_cursor_mode = -1; - return 0; -} - -static int PCBChanged(int argc, const char **argv, Coord x, Coord y) -{ - if (work_area == 0) - return 0; - /*pcb_printf("PCB Changed! %$mD\n", PCB->MaxWidth, PCB->MaxHeight); */ - stdarg_n = 0; - stdarg(XmNminimum, 0); - stdarg(XmNvalue, 0); - stdarg(XmNsliderSize, PCB->MaxWidth ? PCB->MaxWidth : 1); - stdarg(XmNmaximum, PCB->MaxWidth ? PCB->MaxWidth : 1); - XtSetValues(hscroll, stdarg_args, stdarg_n); - stdarg_n = 0; - stdarg(XmNminimum, 0); - stdarg(XmNvalue, 0); - stdarg(XmNsliderSize, PCB->MaxHeight ? PCB->MaxHeight : 1); - stdarg(XmNmaximum, PCB->MaxHeight ? PCB->MaxHeight : 1); - XtSetValues(vscroll, stdarg_args, stdarg_n); - zoom_max(); - - hid_action("NetlistChanged"); - hid_action("LayersChanged"); - hid_action("RouteStylesChanged"); - lesstif_sizes_reset(); - lesstif_update_layer_groups(); - while (pinouts) - pinout_unmap(0, pinouts, 0); - if (PCB->Filename) { - char *cp = strrchr(PCB->Filename, '/'); - stdarg_n = 0; - stdarg(XmNtitle, cp ? cp + 1 : PCB->Filename); - XtSetValues(appwidget, stdarg_args, stdarg_n); - } - return 0; -} - - -static const char setunits_syntax[] = "SetUnits(mm|mil)"; - -static const char setunits_help[] = "Set the default measurement units."; - -/* %start-doc actions SetUnits - -@table @code - -@item mil -Sets the display units to mils (1/1000 inch). - -@item mm -Sets the display units to millimeters. - -@end table - -%end-doc */ - -static int SetUnits(int argc, const char **argv, Coord x, Coord y) -{ - const Unit *new_unit; - if (argc == 0) - return 0; - new_unit = get_unit_struct(argv[0]); - if (new_unit != NULL && new_unit->allow != NO_PRINT) { - conf_set(CFR_DESIGN, "editor/grid_unit", -1, argv[0], POL_OVERWRITE); -#warning TODO: figure what to do with increments -#if 0 - Settings.increments = get_increments_struct(Settings.grid_unit->suffix); -#endif - AttributePut(PCB, "PCB::grid::unit", argv[0]); - } - lesstif_sizes_reset(); - lesstif_styles_update_values(); - return 0; -} - -static const char zoom_syntax[] = "Zoom()\n" "Zoom(factor)"; - -static const char zoom_help[] = "Various zoom factor changes."; - -/* %start-doc actions Zoom - -Changes the zoom (magnification) of the view of the board. If no -arguments are passed, the view is scaled such that the board just fits -inside the visible window (i.e. ``view all''). Otherwise, -@var{factor} specifies a change in zoom factor. It may be prefixed by -@code{+}, @code{-}, or @code{=} to change how the zoom factor is -modified. The @var{factor} is a floating point number, such as -@code{1.5} or @code{0.75}. - -@table @code - -@item +@var{factor} -Values greater than 1.0 cause the board to be drawn smaller; more of -the board will be visible. Values between 0.0 and 1.0 cause the board -to be drawn bigger; less of the board will be visible. - -@item -@var{factor} -Values greater than 1.0 cause the board to be drawn bigger; less of -the board will be visible. Values between 0.0 and 1.0 cause the board -to be drawn smaller; more of the board will be visible. - -@item =@var{factor} - -The @var{factor} is an absolute zoom factor; the unit for this value -is "PCB units per screen pixel". Since PCB units are 0.01 mil, a -@var{factor} of 1000 means 10 mils (0.01 in) per pixel, or 100 DPI, -about the actual resolution of most screens - resulting in an "actual -size" board. Similarly, a @var{factor} of 100 gives you a 10x actual -size. - -@end table - -Note that zoom factors of zero are silently ignored. - -%end-doc */ - -static int ZoomAction(int argc, const char **argv, Coord x, Coord y) -{ - const char *vp; - double v; - if (x == 0 && y == 0) { - x = view_width / 2; - y = view_height / 2; - } - else { - x = Vx(x); - y = Vy(y); - } - if (argc < 1) { - zoom_max(); - return 0; - } - vp = argv[0]; - if (strcasecmp(vp, "toggle") == 0) { - zoom_toggle(x, y); - return 0; - } - if (*vp == '+' || *vp == '-' || *vp == '=') - vp++; - setlocale(LC_ALL, "C"); - v = strtod(vp, NULL); - setlocale(LC_ALL, ""); - if (v <= 0) - return 1; - switch (argv[0][0]) { - case '-': - zoom_by(1 / v, x, y); - break; - default: - case '+': - zoom_by(v, x, y); - break; - case '=': - zoom_to(v, x, y); - break; - } - return 0; -} - -static int pan_thumb_mode; - -static int PanAction(int argc, const char **argv, Coord x, Coord y) -{ - int mode; - - if (argc == 2) { - pan_thumb_mode = (strcasecmp(argv[0], "thumb") == 0) ? 1 : 0; - mode = atoi(argv[1]); - } - else { - pan_thumb_mode = 0; - mode = atoi(argv[0]); - } - Pan(mode, Vx(x), Vy(y)); - - return 0; -} - -static const char swapsides_syntax[] = "SwapSides(|v|h|r)"; - -static const char swapsides_help[] = "Swaps the side of the board you're looking at."; - -/* %start-doc actions SwapSides - -This action changes the way you view the board. - -@table @code - -@item v -Flips the board over vertically (up/down). - -@item h -Flips the board over horizontally (left/right), like flipping pages in -a book. - -@item r -Rotates the board 180 degrees without changing sides. - -@end table - -If no argument is given, the board isn't moved but the opposite side -is shown. - -Normally, this action changes which pads and silk layer are drawn as -pcb_true silk, and which are drawn as the "invisible" layer. It also -determines which solder mask you see. - -As a special case, if the layer group for the side you're looking at -is visible and currently active, and the layer group for the opposite -is not visible (i.e. disabled), then this action will also swap which -layer group is visible and active, effectively swapping the ``working -side'' of the board. - -%end-doc */ - -static int group_showing(int g, int *c) -{ - int i, l; - *c = PCB->LayerGroups.Entries[g][0]; - for (i = 0; i < PCB->LayerGroups.Number[g]; i++) { - l = PCB->LayerGroups.Entries[g][i]; - if (l >= 0 && l < max_copper_layer) { - *c = l; - if (PCB->Data->Layer[l].On) - return 1; - } - } - return 0; -} - -static int SwapSides(int argc, const char **argv, Coord x, Coord y) -{ - int old_shown_side = conf_core.editor.show_solder_side; - int comp_group = GetLayerGroupNumberByNumber(component_silk_layer); - int solder_group = GetLayerGroupNumberByNumber(solder_silk_layer); - int active_group = GetLayerGroupNumberByNumber(LayerStack[0]); - int comp_layer; - int solder_layer; - int comp_showing = group_showing(comp_group, &comp_layer); - int solder_showing = group_showing(solder_group, &solder_layer); - - if (argc > 0) { - switch (argv[0][0]) { - case 'h': - case 'H': - conf_toggle_editor_("view/flip_x", view.flip_x); - break; - case 'v': - case 'V': - conf_toggle_editor_("view/flip_y", view.flip_y); - break; - case 'r': - case 'R': - conf_toggle_editor_("view/flip_x", view.flip_x); - conf_toggle_editor_("view/flip_y", view.flip_y); - break; - default: - return 1; - } - /* SwapSides will swap this */ - conf_set_editor(show_solder_side, (conf_core.editor.view.flip_x == conf_core.editor.view.flip_y)); - } - - stdarg_n = 0; - if (conf_core.editor.view.flip_x) - stdarg(XmNprocessingDirection, XmMAX_ON_LEFT); - else - stdarg(XmNprocessingDirection, XmMAX_ON_RIGHT); - XtSetValues(hscroll, stdarg_args, stdarg_n); - - stdarg_n = 0; - if (conf_core.editor.view.flip_y) - stdarg(XmNprocessingDirection, XmMAX_ON_TOP); - else - stdarg(XmNprocessingDirection, XmMAX_ON_BOTTOM); - XtSetValues(vscroll, stdarg_args, stdarg_n); - - conf_toggle_editor(show_solder_side); - - /* The idea is that if we're looking at the front side and the front - layer is active (or visa versa), switching sides should switch - layers too. We used to only do this if the other layer wasn't - shown, but we now do it always. Change it back if users get - confused. */ - if (conf_core.editor.show_solder_side != old_shown_side) { - if (conf_core.editor.show_solder_side) { - if (active_group == comp_group) { - if (comp_showing && !solder_showing) - ChangeGroupVisibility(comp_layer, 0, 0); - ChangeGroupVisibility(solder_layer, 1, 1); - } - } - else { - if (active_group == solder_group) { - if (solder_showing && !comp_showing) - ChangeGroupVisibility(solder_layer, 0, 0); - ChangeGroupVisibility(comp_layer, 1, 1); - } - } - } - lesstif_invalidate_all(); - return 0; -} - -static Widget m_cmd = 0, m_cmd_label; - -static void command_callback(Widget w, XtPointer uptr, XmTextVerifyCallbackStruct * cbs) -{ - char *s; - switch (cbs->reason) { - case XmCR_ACTIVATE: - s = XmTextGetString(w); - lesstif_show_crosshair(0); - hid_parse_command(s); - XtFree(s); - XmTextSetString(w, XmStrCast("")); - case XmCR_LOSING_FOCUS: - XtUnmanageChild(m_cmd); - XtUnmanageChild(m_cmd_label); - break; - } -} - -static void command_event_handler(Widget w, XtPointer p, XEvent * e, Boolean * cont) -{ - char buf[10]; - KeySym sym; - - switch (e->type) { - case KeyPress: - XLookupString((XKeyEvent *) e, buf, sizeof(buf), &sym, NULL); - switch (sym) { - case XK_Escape: - XtUnmanageChild(m_cmd); - XtUnmanageChild(m_cmd_label); - XmTextSetString(w, XmStrCast("")); - *cont = False; - break; - } - break; - } -} - -static const char command_syntax[] = "Command()"; - -static const char command_help[] = "Displays the command line input window."; - -/* %start-doc actions Command - -The command window allows the user to manually enter actions to be -executed. Action syntax can be done one of two ways: - -@table @code - -@item -Follow the action name by an open parenthesis, arguments separated by -commas, end with a close parenthesis. Example: @code{Abc(1,2,3)} - -@item -Separate the action name and arguments by spaces. Example: @code{Abc -1 2 3}. - -@end table - -The first option allows you to have arguments with spaces in them, -but the second is more ``natural'' to type for most people. - -Note that action names are not case sensitive, but arguments normally -are. However, most actions will check for ``keywords'' in a case -insensitive way. - -There are three ways to finish with the command window. If you press -the @code{Enter} key, the command is invoked, the window goes away, -and the next time you bring up the command window it's empty. If you -press the @code{Esc} key, the window goes away without invoking -anything, and the next time you bring up the command window it's -empty. If you change focus away from the command window (i.e. click -on some other window), the command window goes away but the next time -you bring it up it resumes entering the command you were entering -before. - -%end-doc */ - -static int Command(int argc, const char **argv, Coord x, Coord y) -{ - XtManageChild(m_cmd_label); - XtManageChild(m_cmd); - XmProcessTraversal(m_cmd, XmTRAVERSE_CURRENT); - return 0; -} - -static const char benchmark_syntax[] = "Benchmark()"; - -static const char benchmark_help[] = "Benchmark the GUI speed."; - -/* %start-doc actions Benchmark - -This action is used to speed-test the Lesstif graphics subsystem. It -redraws the current screen as many times as possible in ten seconds. -It reports the amount of time needed to draw the screen once. - -%end-doc */ - -static int Benchmark(int argc, const char **argv, Coord x, Coord y) -{ - int i = 0; - time_t start, end; - BoxType region; - Drawable save_main; - - save_main = main_pixmap; - main_pixmap = window; - - region.X1 = 0; - region.Y1 = 0; - region.X2 = PCB->MaxWidth; - region.Y2 = PCB->MaxHeight; - - pixmap = window; - XSync(display, 0); - time(&start); - do { - XFillRectangle(display, pixmap, bg_gc, 0, 0, view_width, view_height); - hid_expose_callback(&lesstif_hid, ®ion, 0); - XSync(display, 0); - time(&end); - i++; - } - while (end - start < 10); - - printf("%g redraws per second\n", i / 10.0); - - main_pixmap = save_main; - return 0; -} - -static int Center(int argc, const char **argv, Coord x, Coord y) -{ - x = GridFit(x, PCB->Grid, PCB->GridOffsetX); - y = GridFit(y, PCB->Grid, PCB->GridOffsetY); - view_left_x = x - (view_width * view_zoom) / 2; - view_top_y = y - (view_height * view_zoom) / 2; - lesstif_pan_fixup(); - /* Move the pointer to the center of the window, but only if it's - currently within the window already. Watch out for edges, - though. */ - XWarpPointer(display, window, window, 0, 0, view_width, view_height, Vx(x), Vy(y)); - return 0; -} - -static const char cursor_syntax[] = "Cursor(Type,DeltaUp,DeltaRight,Units)"; - -static const char cursor_help[] = "Move the cursor."; - -/* %start-doc actions Cursor - -This action moves the mouse cursor. Unlike other actions which take -coordinates, this action's coordinates are always relative to the -user's view of the board. Thus, a positive @var{DeltaUp} may move the -cursor towards the board origin if the board is inverted. - -Type is one of @samp{Pan} or @samp{Warp}. @samp{Pan} causes the -viewport to move such that the crosshair is under the mouse cursor. -@samp{Warp} causes the mouse cursor to move to be above the crosshair. - -@var{Units} can be one of the following: - -@table @samp - -@item mil -@itemx mm -The cursor is moved by that amount, in board units. - -@item grid -The cursor is moved by that many grid points. - -@item view -The values are percentages of the viewport's view. Thus, a pan of -@samp{100} would scroll the viewport by exactly the width of the -current view. - -@item board -The values are percentages of the board size. Thus, a move of -@samp{50,50} moves you halfway across the board. - -@end table - -%end-doc */ - -static int CursorAction(int argc, const char **argv, Coord x, Coord y) -{ - UnitList extra_units_x = { - {"grid", 0, 0}, - {"view", 0, UNIT_PERCENT}, - {"board", 0, UNIT_PERCENT}, - {"", 0, 0} - }; - UnitList extra_units_y = { - {"grid", 0, 0}, - {"view", 0, UNIT_PERCENT}, - {"board", 0, UNIT_PERCENT}, - {"", 0, 0} - }; - int pan_warp = HID_SC_DO_NOTHING; - double dx, dy; - - extra_units_x[0].scale = PCB->Grid; - extra_units_x[1].scale = Pz(view_width); - extra_units_x[2].scale = PCB->MaxWidth; - - extra_units_y[0].scale = PCB->Grid; - extra_units_y[1].scale = Pz(view_height); - extra_units_y[2].scale = PCB->MaxHeight; - - if (argc != 4) - AFAIL(cursor); - - if (strcasecmp(argv[0], "pan") == 0) - pan_warp = HID_SC_PAN_VIEWPORT; - else if (strcasecmp(argv[0], "warp") == 0) - pan_warp = HID_SC_WARP_POINTER; - else - AFAIL(cursor); - - dx = GetValueEx(argv[1], argv[3], NULL, extra_units_x, "mil", NULL); - if (conf_core.editor.view.flip_x) - dx = -dx; - dy = GetValueEx(argv[2], argv[3], NULL, extra_units_y, "mil", NULL); - if (!conf_core.editor.view.flip_y) - dy = -dy; - - EventMoveCrosshair(Crosshair.X + dx, Crosshair.Y + dy); - gui->set_crosshair(Crosshair.X, Crosshair.Y, pan_warp); - - return 0; -} - -HID_Action lesstif_main_action_list[] = { - {"PCBChanged", 0, PCBChanged, - pcbchanged_help, pcbchanged_syntax} - , - {"SetUnits", 0, SetUnits, - setunits_help, setunits_syntax} - , - {"Zoom", "Click on a place to zoom in", ZoomAction, - zoom_help, zoom_syntax} - , - {"Pan", "Click on a place to pan", PanAction, - zoom_help, zoom_syntax} - , - {"SwapSides", 0, SwapSides, - swapsides_help, swapsides_syntax} - , - {"Command", 0, Command, - command_help, command_syntax} - , - {"Benchmark", 0, Benchmark, - benchmark_help, benchmark_syntax} - , - {"PointCursor", 0, PointCursor} - , - {"Center", "Click on a location to center", Center} - , - {"Busy", 0, Busy} - , - {"Cursor", 0, CursorAction, - cursor_help, cursor_syntax} - , -}; - -REGISTER_ACTIONS(lesstif_main_action_list, lesstif_cookie) - - -/* ---------------------------------------------------------------------- - * redraws the background image - */ - static int bg_w, bg_h, bgi_w, bgi_h; - static Pixel **bg = 0; - static XImage *bgi = 0; - static enum { - PT_unknown, - PT_RGB565, - PT_RGB888 - } pixel_type = PT_unknown; - - static void - LoadBackgroundFile(FILE * f, char *filename) -{ - XVisualInfo vinfot, *vinfo; - Visual *vis; - int c, r, b; - int i, nret; - int p[3], rows, cols, maxval; - - if (fgetc(f) != 'P') { - printf("bgimage: %s signature not P6\n", filename); - return; - } - if (fgetc(f) != '6') { - printf("bgimage: %s signature not P6\n", filename); - return; - } - for (i = 0; i < 3; i++) { - do { - b = fgetc(f); - if (feof(f)) - return; - if (b == '#') - while (!feof(f) && b != '\n') - b = fgetc(f); - } while (!isdigit(b)); - p[i] = b - '0'; - while (isdigit(b = fgetc(f))) - p[i] = p[i] * 10 + b - '0'; - } - bg_w = cols = p[0]; - bg_h = rows = p[1]; - maxval = p[2]; - - setbuf(stdout, 0); - bg = (Pixel **) malloc(rows * sizeof(Pixel *)); - if (!bg) { - printf("Out of memory loading %s\n", filename); - return; - } - for (i = 0; i < rows; i++) { - bg[i] = (Pixel *) malloc(cols * sizeof(Pixel)); - if (!bg[i]) { - printf("Out of memory loading %s\n", filename); - while (--i >= 0) - free(bg[i]); - free(bg); - bg = 0; - return; - } - } - - vis = DefaultVisual(display, DefaultScreen(display)); - - vinfot.visualid = XVisualIDFromVisual(vis); - vinfo = XGetVisualInfo(display, VisualIDMask, &vinfot, &nret); - -#if 0 - /* If you want to support more visuals below, you'll probably need - this. */ - printf("vinfo: rm %04x gm %04x bm %04x depth %d class %d\n", - vinfo->red_mask, vinfo->green_mask, vinfo->blue_mask, vinfo->depth, vinfo->class); -#endif - -#if !defined(__cplusplus) -#define c_class class -#endif - - if (vinfo->c_class == TrueColor - && vinfo->depth == 16 && vinfo->red_mask == 0xf800 && vinfo->green_mask == 0x07e0 && vinfo->blue_mask == 0x001f) - pixel_type = PT_RGB565; - - if (vinfo->c_class == TrueColor - && vinfo->depth == 24 && vinfo->red_mask == 0xff0000 && vinfo->green_mask == 0x00ff00 && vinfo->blue_mask == 0x0000ff) - pixel_type = PT_RGB888; - - for (r = 0; r < rows; r++) { - for (c = 0; c < cols; c++) { - XColor pix; - unsigned int pr = (unsigned) fgetc(f); - unsigned int pg = (unsigned) fgetc(f); - unsigned int pb = (unsigned) fgetc(f); - - switch (pixel_type) { - case PT_unknown: - pix.red = pr * 65535 / maxval; - pix.green = pg * 65535 / maxval; - pix.blue = pb * 65535 / maxval; - pix.flags = DoRed | DoGreen | DoBlue; - XAllocColor(display, lesstif_colormap, &pix); - bg[r][c] = pix.pixel; - break; - case PT_RGB565: - bg[r][c] = (pr >> 3) << 11 | (pg >> 2) << 5 | (pb >> 3); - break; - case PT_RGB888: - bg[r][c] = (pr << 16) | (pg << 8) | (pb); - break; - } - } - } -} - -void LoadBackgroundImage(char *filename) -{ - FILE *f = fopen(filename, "rb"); - if (!f) { - if (NSTRCMP(filename, "pcb-background.ppm")) - perror(filename); - return; - } - LoadBackgroundFile(f, filename); - fclose(f); -} - -static void DrawBackgroundImage() -{ - int x, y, w, h; - double xscale, yscale; - int pcbwidth = PCB->MaxWidth / view_zoom; - int pcbheight = PCB->MaxHeight / view_zoom; - - if (!window || !bg) - return; - - if (!bgi || view_width != bgi_w || view_height != bgi_h) { - if (bgi) - XDestroyImage(bgi); - /* Cheat - get the image, which sets up the format too. */ - bgi = XGetImage(XtDisplay(work_area), window, 0, 0, view_width, view_height, -1, ZPixmap); - bgi_w = view_width; - bgi_h = view_height; - } - - w = MIN(view_width, pcbwidth); - h = MIN(view_height, pcbheight); - - xscale = (double) bg_w / PCB->MaxWidth; - yscale = (double) bg_h / PCB->MaxHeight; - - for (y = 0; y < h; y++) { - int pr = Py(y); - int ir = pr * yscale; - for (x = 0; x < w; x++) { - int pc = Px(x); - int ic = pc * xscale; - XPutPixel(bgi, x, y, bg[ir][ic]); - } - } - XPutImage(display, main_pixmap, bg_gc, bgi, 0, 0, 0, 0, w, h); -} - -/* ---------------------------------------------------------------------- */ - -static HID_Attribute *lesstif_get_export_options(int *n) -{ - *n = sizeof(lesstif_attribute_list) / sizeof(HID_Attribute); - return lesstif_attribute_list; -} - -static void set_scroll(Widget s, int pos, int view, int pcb) -{ - int sz = view * view_zoom; - if (sz > pcb) - sz = pcb; - stdarg_n = 0; - stdarg(XmNvalue, pos); - stdarg(XmNsliderSize, sz); - stdarg(XmNincrement, view_zoom); - stdarg(XmNpageIncrement, sz); - stdarg(XmNmaximum, pcb); - XtSetValues(s, stdarg_args, stdarg_n); -} - -void lesstif_pan_fixup() -{ -#if 0 - if (view_left_x > PCB->MaxWidth - (view_width * view_zoom)) - view_left_x = PCB->MaxWidth - (view_width * view_zoom); - if (view_top_y > PCB->MaxHeight - (view_height * view_zoom)) - view_top_y = PCB->MaxHeight - (view_height * view_zoom); - if (view_left_x < 0) - view_left_x = 0; - if (view_top_y < 0) - view_top_y = 0; - if (view_width * view_zoom > PCB->MaxWidth && view_height * view_zoom > PCB->MaxHeight) { - zoom_by(1, 0, 0); - return; - } -#endif - - set_scroll(hscroll, view_left_x, view_width, PCB->MaxWidth); - set_scroll(vscroll, view_top_y, view_height, PCB->MaxHeight); - - lesstif_invalidate_all(); -} - -static void zoom_max() -{ - double new_zoom = PCB->MaxWidth / view_width; - if (new_zoom < PCB->MaxHeight / view_height) - new_zoom = PCB->MaxHeight / view_height; - - view_left_x = -(view_width * new_zoom - PCB->MaxWidth) / 2; - view_top_y = -(view_height * new_zoom - PCB->MaxHeight) / 2; - view_zoom = new_zoom; - pixel_slop = view_zoom; - lesstif_pan_fixup(); -} - -static void zoom_to(double new_zoom, int x, int y) -{ - double max_zoom, xfrac, yfrac; - int cx, cy; - - if (PCB == NULL) - return; - - xfrac = (double) x / (double) view_width; - yfrac = (double) y / (double) view_height; - - if (conf_core.editor.view.flip_x) - xfrac = 1 - xfrac; - if (conf_core.editor.view.flip_y) - yfrac = 1 - yfrac; - - max_zoom = PCB->MaxWidth / view_width; - if (max_zoom < PCB->MaxHeight / view_height) - max_zoom = PCB->MaxHeight / view_height; - - max_zoom *= MAX_ZOOM_SCALE; - - if (new_zoom < 1) - new_zoom = 1; - if (new_zoom > max_zoom) - new_zoom = max_zoom; - - cx = view_left_x + view_width * xfrac * view_zoom; - cy = view_top_y + view_height * yfrac * view_zoom; - - if (view_zoom != new_zoom) { - view_zoom = new_zoom; - pixel_slop = view_zoom; - - view_left_x = cx - view_width * xfrac * view_zoom; - view_top_y = cy - view_height * yfrac * view_zoom; - } - lesstif_pan_fixup(); -} - -static void zoom_toggle(int x, int y) -{ - double tmp; - - tmp = prev_view_zoom; - prev_view_zoom = view_zoom; - zoom_to(tmp, x, y); -} - -void zoom_by(double factor, int x, int y) -{ - zoom_to(view_zoom * factor, x, y); -} - -static int panning = 0; -static int shift_pressed; -static int ctrl_pressed; -static int alt_pressed; - -/* X and Y are in screen coordinates. */ -static void Pan(int mode, int x, int y) -{ - static int ox, oy; - static int opx, opy; - - panning = mode; - /* This is for ctrl-pan, where the viewport's position is directly - proportional to the cursor position in the window (like the Xaw - thumb panner) */ - if (pan_thumb_mode) { - opx = x * PCB->MaxWidth / view_width; - opy = y * PCB->MaxHeight / view_height; - if (conf_core.editor.view.flip_x) - opx = PCB->MaxWidth - opx; - if (conf_core.editor.view.flip_y) - opy = PCB->MaxHeight - opy; - view_left_x = opx - view_width / 2 * view_zoom; - view_top_y = opy - view_height / 2 * view_zoom; - lesstif_pan_fixup(); - } - /* This is the start of a regular pan. On the first click, we - remember the coordinates where we "grabbed" the screen. */ - else if (mode == 1) { - ox = x; - oy = y; - opx = view_left_x; - opy = view_top_y; - } - /* continued drag, we calculate how far we've moved the cursor and - set the position accordingly. */ - else { - if (conf_core.editor.view.flip_x) - view_left_x = opx + (x - ox) * view_zoom; - else - view_left_x = opx - (x - ox) * view_zoom; - if (conf_core.editor.view.flip_y) - view_top_y = opy + (y - oy) * view_zoom; - else - view_top_y = opy - (y - oy) * view_zoom; - lesstif_pan_fixup(); - } -} - -static void mod_changed(XKeyEvent * e, int set) -{ - switch (XKeycodeToKeysym(display, e->keycode, 0)) { - case XK_Shift_L: - case XK_Shift_R: - shift_pressed = set; - break; - case XK_Control_L: - case XK_Control_R: - ctrl_pressed = set; - break; -#ifdef __APPLE__ - case XK_Mode_switch: -#else - case XK_Alt_L: - case XK_Alt_R: -#endif - alt_pressed = set; - break; - default: - /* to include the Apple keyboard left and right command keys use XK_Meta_L and XK_Meta_R respectivly. */ - return; - } - in_move_event = 1; - notify_crosshair_change(pcb_false); - if (panning) - Pan(2, e->x, e->y); - EventMoveCrosshair(Px(e->x), Py(e->y)); - AdjustAttachedObjects(); - notify_crosshair_change(pcb_true); - in_move_event = 0; -} - -static hid_cfg_mod_t lesstif_mb2cfg(int but) -{ - switch(but) { - case 1: return MB_LEFT; - case 2: return MB_MIDDLE; - case 3: return MB_RIGHT; - case 4: return MB_SCROLL_UP; - case 5: return MB_SCROLL_DOWN; - } - return 0; -} - -static void work_area_input(Widget w, XtPointer v, XEvent * e, Boolean * ctd) -{ - static int pressed_button = 0; - - show_crosshair(0); - switch (e->type) { - case KeyPress: - mod_changed(&(e->xkey), 1); - if (lesstif_key_event(&(e->xkey))) - return; - break; - - case KeyRelease: - mod_changed(&(e->xkey), 0); - break; - - case ButtonPress: - { - int mods; - if (pressed_button) - return; - /*printf("click %d\n", e->xbutton.button); */ - if (lesstif_button_event(w, e)) - return; - - notify_crosshair_change(pcb_false); - pressed_button = e->xbutton.button; - mods = ((e->xbutton.state & ShiftMask) ? M_Shift : 0) - + ((e->xbutton.state & ControlMask) ? M_Ctrl : 0) -#ifdef __APPLE__ - + ((e->xbutton.state & (1 << 13)) ? M_Alt : 0); -#else - + ((e->xbutton.state & Mod1Mask) ? M_Alt : 0); -#endif - hid_cfg_mouse_action(&lesstif_mouse, lesstif_mb2cfg(e->xbutton.button) | mods); - - notify_crosshair_change(pcb_true); - break; - } - - case ButtonRelease: - { - int mods; - if (e->xbutton.button != pressed_button) - return; - lesstif_button_event(w, e); - notify_crosshair_change(pcb_false); - pressed_button = 0; - mods = ((e->xbutton.state & ShiftMask) ? M_Shift : 0) - + ((e->xbutton.state & ControlMask) ? M_Ctrl : 0) -#ifdef __APPLE__ - + ((e->xbutton.state & (1 << 13)) ? M_Alt : 0) -#else - + ((e->xbutton.state & Mod1Mask) ? M_Alt : 0) -#endif - + M_Release; - hid_cfg_mouse_action(&lesstif_mouse, lesstif_mb2cfg(e->xbutton.button) | mods); - notify_crosshair_change(pcb_true); - break; - } - - case MotionNotify: - { - Window root, child; - unsigned int keys_buttons; - int root_x, root_y, pos_x, pos_y; - while (XCheckMaskEvent(display, PointerMotionMask, e)); - XQueryPointer(display, e->xmotion.window, &root, &child, &root_x, &root_y, &pos_x, &pos_y, &keys_buttons); - shift_pressed = (keys_buttons & ShiftMask); - ctrl_pressed = (keys_buttons & ControlMask); -#ifdef __APPLE__ - alt_pressed = (keys_buttons & (1 << 13)); -#else - alt_pressed = (keys_buttons & Mod1Mask); -#endif - /*pcb_printf("m %#mS %#mS\n", Px(e->xmotion.x), Py(e->xmotion.y)); */ - crosshair_in_window = 1; - in_move_event = 1; - if (panning) - Pan(2, pos_x, pos_y); - EventMoveCrosshair(Px(pos_x), Py(pos_y)); - in_move_event = 0; - } - break; - - case LeaveNotify: - crosshair_in_window = 0; - ShowCrosshair(pcb_false); - need_idle_proc(); - break; - - case EnterNotify: - crosshair_in_window = 1; - in_move_event = 1; - EventMoveCrosshair(Px(e->xcrossing.x), Py(e->xcrossing.y)); - ShowCrosshair(pcb_true); - in_move_event = 0; - need_idle_proc(); - break; - - default: - printf("work_area: unknown event %d\n", e->type); - break; - } -} - -static void draw_right_cross(GC xor_gc, int x, int y, int view_width, int view_height) -{ - XDrawLine(display, window, xor_gc, 0, y, view_width, y); - XDrawLine(display, window, xor_gc, x, 0, x, view_height); -} - -static void draw_slanted_cross(GC xor_gc, int x, int y, int view_width, int view_height) -{ - int x0, y0, x1, y1; - - x0 = x + (view_height - y); - x0 = MAX(0, MIN(x0, view_width)); - x1 = x - y; - x1 = MAX(0, MIN(x1, view_width)); - y0 = y + (view_width - x); - y0 = MAX(0, MIN(y0, view_height)); - y1 = y - x; - y1 = MAX(0, MIN(y1, view_height)); - XDrawLine(display, window, xor_gc, x0, y0, x1, y1); - x0 = x - (view_height - y); - x0 = MAX(0, MIN(x0, view_width)); - x1 = x + y; - x1 = MAX(0, MIN(x1, view_width)); - y0 = y + x; - y0 = MAX(0, MIN(y0, view_height)); - y1 = y - (view_width - x); - y1 = MAX(0, MIN(y1, view_height)); - XDrawLine(display, window, xor_gc, x0, y0, x1, y1); -} - -static void draw_dozen_cross(GC xor_gc, int x, int y, int view_width, int view_height) -{ - int x0, y0, x1, y1; - double tan60 = sqrt(3); - - x0 = x + (view_height - y) / tan60; - x0 = MAX(0, MIN(x0, view_width)); - x1 = x - y / tan60; - x1 = MAX(0, MIN(x1, view_width)); - y0 = y + (view_width - x) * tan60; - y0 = MAX(0, MIN(y0, view_height)); - y1 = y - x * tan60; - y1 = MAX(0, MIN(y1, view_height)); - XDrawLine(display, window, xor_gc, x0, y0, x1, y1); - - x0 = x + (view_height - y) * tan60; - x0 = MAX(0, MIN(x0, view_width)); - x1 = x - y * tan60; - x1 = MAX(0, MIN(x1, view_width)); - y0 = y + (view_width - x) / tan60; - y0 = MAX(0, MIN(y0, view_height)); - y1 = y - x / tan60; - y1 = MAX(0, MIN(y1, view_height)); - XDrawLine(display, window, xor_gc, x0, y0, x1, y1); - - x0 = x - (view_height - y) / tan60; - x0 = MAX(0, MIN(x0, view_width)); - x1 = x + y / tan60; - x1 = MAX(0, MIN(x1, view_width)); - y0 = y + x * tan60; - y0 = MAX(0, MIN(y0, view_height)); - y1 = y - (view_width - x) * tan60; - y1 = MAX(0, MIN(y1, view_height)); - XDrawLine(display, window, xor_gc, x0, y0, x1, y1); - - x0 = x - (view_height - y) * tan60; - x0 = MAX(0, MIN(x0, view_width)); - x1 = x + y * tan60; - x1 = MAX(0, MIN(x1, view_width)); - y0 = y + x / tan60; - y0 = MAX(0, MIN(y0, view_height)); - y1 = y - (view_width - x) / tan60; - y1 = MAX(0, MIN(y1, view_height)); - XDrawLine(display, window, xor_gc, x0, y0, x1, y1); -} - -static void draw_crosshair(GC xor_gc, int x, int y, int view_width, int view_height) -{ - draw_right_cross(xor_gc, x, y, view_width, view_height); - if (Crosshair.shape == Union_Jack_Crosshair_Shape) - draw_slanted_cross(xor_gc, x, y, view_width, view_height); - if (Crosshair.shape == Dozen_Crosshair_Shape) - draw_dozen_cross(xor_gc, x, y, view_width, view_height); -} - -void lesstif_show_crosshair(int show) -{ - static int showing = 0; - static int sx, sy; - static GC xor_gc = 0; - Pixel crosshair_color; - - if (!crosshair_in_window || !window) - return; - if (xor_gc == 0) { - crosshair_color = lesstif_parse_color(conf_core.appearance.color.crosshair) ^ bgcolor; - xor_gc = XCreateGC(display, window, 0, 0); - XSetFunction(display, xor_gc, GXxor); - XSetForeground(display, xor_gc, crosshair_color); - } - if (show == showing) - return; - if (show) { - sx = Vx(crosshair_x); - sy = Vy(crosshair_y); - } - else - need_idle_proc(); - draw_crosshair(xor_gc, sx, sy, view_width, view_height); - showing = show; -} - -static void work_area_expose(Widget work_area, void *me, XmDrawingAreaCallbackStruct * cbs) -{ - XExposeEvent *e; - - show_crosshair(0); - e = &(cbs->event->xexpose); - XSetFunction(display, my_gc, GXcopy); - XCopyArea(display, main_pixmap, window, my_gc, e->x, e->y, e->width, e->height, e->x, e->y); - show_crosshair(1); -} - -static void scroll_callback(Widget scroll, int *view_dim, XmScrollBarCallbackStruct * cbs) -{ - *view_dim = cbs->value; - lesstif_invalidate_all(); -} - -static void work_area_make_pixmaps(Dimension width, Dimension height) -{ - if (main_pixmap) - XFreePixmap(display, main_pixmap); - main_pixmap = XCreatePixmap(display, window, width, height, XDefaultDepth(display, screen)); - - if (mask_pixmap) - XFreePixmap(display, mask_pixmap); - mask_pixmap = XCreatePixmap(display, window, width, height, XDefaultDepth(display, screen)); -#ifdef HAVE_XRENDER - if (main_picture) { - XRenderFreePicture(display, main_picture); - main_picture = 0; - } - if (mask_picture) { - XRenderFreePicture(display, mask_picture); - mask_picture = 0; - } - if (use_xrender) { - main_picture = XRenderCreatePicture(display, main_pixmap, - XRenderFindVisualFormat(display, DefaultVisual(display, screen)), 0, 0); - mask_picture = XRenderCreatePicture(display, mask_pixmap, - XRenderFindVisualFormat(display, DefaultVisual(display, screen)), 0, 0); - if (!main_picture || !mask_picture) - use_xrender = 0; - } -#endif /* HAVE_XRENDER */ - - if (mask_bitmap) - XFreePixmap(display, mask_bitmap); - mask_bitmap = XCreatePixmap(display, window, width, height, 1); - - pixmap = use_mask ? main_pixmap : mask_pixmap; - pixmap_w = width; - pixmap_h = height; -} - -static void work_area_resize(Widget work_area, void *me, XmDrawingAreaCallbackStruct * cbs) -{ - XColor color; - Dimension width, height; - - show_crosshair(0); - - stdarg_n = 0; - stdarg(XtNwidth, &width); - stdarg(XtNheight, &height); - stdarg(XmNbackground, &bgcolor); - XtGetValues(work_area, stdarg_args, stdarg_n); - view_width = width; - view_height = height; - - color.pixel = bgcolor; - XQueryColor(display, lesstif_colormap, &color); - bgred = color.red; - bggreen = color.green; - bgblue = color.blue; - - if (!window) - return; - - work_area_make_pixmaps(view_width, view_height); - - zoom_by(1, 0, 0); -} - -static void work_area_first_expose(Widget work_area, void *me, XmDrawingAreaCallbackStruct * cbs) -{ - int c; - Dimension width, height; - static char dashes[] = { 4, 4 }; - - window = XtWindow(work_area); - my_gc = XCreateGC(display, window, 0, 0); - - arc1_gc = XCreateGC(display, window, 0, 0); - c = lesstif_parse_color("#804000"); - XSetForeground(display, arc1_gc, c); - arc2_gc = XCreateGC(display, window, 0, 0); - c = lesstif_parse_color("#004080"); - XSetForeground(display, arc2_gc, c); - XSetLineAttributes(display, arc1_gc, 1, LineOnOffDash, 0, 0); - XSetLineAttributes(display, arc2_gc, 1, LineOnOffDash, 0, 0); - XSetDashes(display, arc1_gc, 0, dashes, 2); - XSetDashes(display, arc2_gc, 0, dashes, 2); - - stdarg_n = 0; - stdarg(XtNwidth, &width); - stdarg(XtNheight, &height); - stdarg(XmNbackground, &bgcolor); - XtGetValues(work_area, stdarg_args, stdarg_n); - view_width = width; - view_height = height; - - offlimit_color = lesstif_parse_color(conf_core.appearance.color.off_limit); - grid_color = lesstif_parse_color(conf_core.appearance.color.grid); - - bg_gc = XCreateGC(display, window, 0, 0); - XSetForeground(display, bg_gc, bgcolor); - - work_area_make_pixmaps(width, height); - -#ifdef HAVE_XRENDER - if (use_xrender) { - XRenderPictureAttributes pa; - XRenderColor a = { 0, 0, 0, 0x8000 }; - - pale_pixmap = XCreatePixmap(display, window, 1, 1, 8); - pa.repeat = True; - pale_picture = XRenderCreatePicture(display, pale_pixmap, - XRenderFindStandardFormat(display, PictStandardA8), CPRepeat, &pa); - if (pale_picture) - XRenderFillRectangle(display, PictOpSrc, pale_picture, &a, 0, 0, 1, 1); - else - use_xrender = 0; - } -#endif /* HAVE_XRENDER */ - - clip_gc = XCreateGC(display, window, 0, 0); - bset_gc = XCreateGC(display, mask_bitmap, 0, 0); - XSetForeground(display, bset_gc, 1); - bclear_gc = XCreateGC(display, mask_bitmap, 0, 0); - XSetForeground(display, bclear_gc, 0); - - XtRemoveCallback(work_area, XmNexposeCallback, (XtCallbackProc) work_area_first_expose, 0); - XtAddCallback(work_area, XmNexposeCallback, (XtCallbackProc) work_area_expose, 0); - lesstif_invalidate_all(); -} - -static Widget make_message(const char *name, Widget left, int resizeable) -{ - Widget w, f; - stdarg_n = 0; - if (left) { - stdarg(XmNleftAttachment, XmATTACH_WIDGET); - stdarg(XmNleftWidget, XtParent(left)); - } - else { - stdarg(XmNleftAttachment, XmATTACH_FORM); - } - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNshadowType, XmSHADOW_IN); - stdarg(XmNshadowThickness, 1); - stdarg(XmNalignment, XmALIGNMENT_CENTER); - stdarg(XmNmarginWidth, 4); - stdarg(XmNmarginHeight, 1); - if (!resizeable) - stdarg(XmNresizePolicy, XmRESIZE_GROW); - f = XmCreateForm(messages, XmStrCast(name), stdarg_args, stdarg_n); - XtManageChild(f); - stdarg_n = 0; - stdarg(XmNtopAttachment, XmATTACH_FORM); - stdarg(XmNbottomAttachment, XmATTACH_FORM); - stdarg(XmNleftAttachment, XmATTACH_FORM); - stdarg(XmNrightAttachment, XmATTACH_FORM); - w = XmCreateLabel(f, XmStrCast(name), stdarg_args, stdarg_n); - XtManageChild(w); - return w; -} - -static unsigned short int lesstif_translate_key(const char *desc, int len) -{ - KeySym key; - - if (strcasecmp(desc, "enter") == 0) desc = "Return"; - - key = XStringToKeysym(desc); - if (key == NoSymbol && len > 1) { - Message(PCB_MSG_DEFAULT, "no symbol for %s\n", desc); - return 0; - } - return key; -} - -int lesstif_key_name(unsigned short int key_char, char *out, int out_len) -{ - char *name = XKeysymToString(key_char); - if (name == NULL) - return -1; - strncpy(out, name, out_len); - out[out_len-1] = '\0'; - return 0; -} - - -extern Widget lesstif_menubar; -static int lesstif_hid_inited = 0; - -static void lesstif_do_export(HID_Attr_Val * options) -{ - Dimension width, height; - Widget menu; - Widget work_area_frame; - - lesstif_begin(); - - hid_cfg_keys_init(&lesstif_keymap); - lesstif_keymap.translate_key = lesstif_translate_key; - lesstif_keymap.key_name = lesstif_key_name; - lesstif_keymap.auto_chr = 1; - lesstif_keymap.auto_tr = hid_cfg_key_default_trans; - - stdarg_n = 0; - stdarg(XtNwidth, &width); - stdarg(XtNheight, &height); - XtGetValues(appwidget, stdarg_args, stdarg_n); - - if (width < 1) - width = 640; - if (width > XDisplayWidth(display, screen)) - width = XDisplayWidth(display, screen); - if (height < 1) - height = 480; - if (height > XDisplayHeight(display, screen)) - height = XDisplayHeight(display, screen); - - stdarg_n = 0; - stdarg(XmNwidth, width); - stdarg(XmNheight, height); - XtSetValues(appwidget, stdarg_args, stdarg_n); - - stdarg(XmNspacing, 0); - mainwind = XmCreateMainWindow(appwidget, XmStrCast("mainWind"), stdarg_args, stdarg_n); - XtManageChild(mainwind); - - stdarg_n = 0; - stdarg(XmNmarginWidth, 0); - stdarg(XmNmarginHeight, 0); - menu = lesstif_menu(mainwind, "menubar", stdarg_args, stdarg_n); - XtManageChild(menu); - - stdarg_n = 0; - stdarg(XmNshadowType, XmSHADOW_IN); - work_area_frame = XmCreateFrame(mainwind, XmStrCast("work_area_frame"), stdarg_args, stdarg_n); - XtManageChild(work_area_frame); - - stdarg_n = 0; - stdarg_do_color(conf_core.appearance.color.background, XmNbackground); - work_area = XmCreateDrawingArea(work_area_frame, XmStrCast("work_area"), stdarg_args, stdarg_n); - XtManageChild(work_area); - XtAddCallback(work_area, XmNexposeCallback, (XtCallbackProc) work_area_first_expose, 0); - XtAddCallback(work_area, XmNresizeCallback, (XtCallbackProc) work_area_resize, 0); - /* A regular callback won't work here, because lesstif swallows any - Ctrl