Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
b55e819b
Commit
b55e819b
authored
Dec 22, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more specctra dsn import/export work
parent
745c9d21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
424 additions
and
406 deletions
+424
-406
dsn.cpp
pcbnew/dsn.cpp
+424
-406
No files found.
pcbnew/dsn.cpp
View file @
b55e819b
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include "fctsys.h"
#include "fctsys.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "common.h"
//
#include "common.h"
namespace
DSN
{
namespace
DSN
{
...
@@ -43,7 +43,8 @@ namespace DSN {
...
@@ -43,7 +43,8 @@ namespace DSN {
*/
*/
enum
DSN_T
{
enum
DSN_T
{
// the first few are special
// the first few are special (the uppercase ones)
T_QUOTE_DEF
=
-
9
,
T_DASH
=
-
8
,
T_DASH
=
-
8
,
T_SYMBOL
=
-
7
,
T_SYMBOL
=
-
7
,
T_NUMBER
=
-
6
,
T_NUMBER
=
-
6
,
...
@@ -424,365 +425,366 @@ struct KEYWORD
...
@@ -424,365 +425,366 @@ struct KEYWORD
};
};
#define TOKDEF(x) { #x, T_##x }
,
#define TOKDEF(x) { #x, T_##x }
// This MUST be sorted alphabetically, and also so MUST enum DSN_T {} be alphabetized.
// This MUST be sorted alphabetically, and also so MUST enum DSN_T {} be alphabetized.
// These MUST all be lower case because of the c
all to strlower()
in findToken().
// These MUST all be lower case because of the c
onversion to lowercase
in findToken().
const
static
KEYWORD
tokens
[]
=
{
const
static
KEYWORD
tokens
[]
=
{
TOKDEF
(
absolute
)
TOKDEF
(
absolute
)
,
TOKDEF
(
added
)
TOKDEF
(
added
)
,
TOKDEF
(
add_group
)
TOKDEF
(
add_group
)
,
TOKDEF
(
add_pins
)
TOKDEF
(
add_pins
)
,
TOKDEF
(
allow_antenna
)
TOKDEF
(
allow_antenna
)
,
TOKDEF
(
allow_redundant_wiring
)
TOKDEF
(
allow_redundant_wiring
)
,
TOKDEF
(
amp
)
TOKDEF
(
amp
)
,
TOKDEF
(
ancestor
)
TOKDEF
(
ancestor
)
,
TOKDEF
(
antipad
)
TOKDEF
(
antipad
)
,
TOKDEF
(
aperture_type
)
TOKDEF
(
aperture_type
)
,
TOKDEF
(
array
)
TOKDEF
(
array
)
,
TOKDEF
(
attach
)
TOKDEF
(
attach
)
,
TOKDEF
(
attr
)
TOKDEF
(
attr
)
,
TOKDEF
(
average_pair_length
)
TOKDEF
(
average_pair_length
)
,
TOKDEF
(
base_design
)
TOKDEF
(
base_design
)
,
TOKDEF
(
bbv_ctr2ctr
)
TOKDEF
(
bbv_ctr2ctr
)
,
TOKDEF
(
bond
)
TOKDEF
(
bond
)
,
TOKDEF
(
bottom
)
TOKDEF
(
bottom
)
,
TOKDEF
(
bottom_layer_sel
)
TOKDEF
(
bottom_layer_sel
)
,
TOKDEF
(
boundary
)
TOKDEF
(
boundary
)
,
TOKDEF
(
brickpat
)
TOKDEF
(
brickpat
)
,
TOKDEF
(
bundle
)
TOKDEF
(
bundle
)
,
TOKDEF
(
bypass
)
TOKDEF
(
bypass
)
,
TOKDEF
(
capacitance_resolution
)
TOKDEF
(
capacitance_resolution
)
,
TOKDEF
(
capacitor
)
TOKDEF
(
capacitor
)
,
TOKDEF
(
case_sensitive
)
TOKDEF
(
case_sensitive
)
,
TOKDEF
(
cct1
)
TOKDEF
(
cct1
)
,
TOKDEF
(
cct1a
)
TOKDEF
(
cct1a
)
,
TOKDEF
(
center_center
)
TOKDEF
(
center_center
)
,
TOKDEF
(
checking_trim_by_pin
)
TOKDEF
(
checking_trim_by_pin
)
,
TOKDEF
(
circ
)
TOKDEF
(
circ
)
,
TOKDEF
(
circle
)
TOKDEF
(
circle
)
,
TOKDEF
(
circuit
)
TOKDEF
(
circuit
)
,
TOKDEF
(
class
)
TOKDEF
(
class
)
,
TOKDEF
(
class_class
)
TOKDEF
(
class_class
)
,
TOKDEF
(
classes
)
TOKDEF
(
classes
)
,
TOKDEF
(
clear
)
TOKDEF
(
clear
)
,
TOKDEF
(
clearance
)
TOKDEF
(
clearance
)
,
TOKDEF
(
cluster
)
TOKDEF
(
cluster
)
,
TOKDEF
(
cm
)
TOKDEF
(
cm
)
,
TOKDEF
(
color
)
TOKDEF
(
color
)
,
TOKDEF
(
colors
)
TOKDEF
(
colors
)
,
TOKDEF
(
comment
)
TOKDEF
(
comment
)
,
TOKDEF
(
comp
)
TOKDEF
(
comp
)
,
TOKDEF
(
comp_edge_center
)
TOKDEF
(
comp_edge_center
)
,
TOKDEF
(
component
)
TOKDEF
(
component
)
,
TOKDEF
(
comp_order
)
TOKDEF
(
comp_order
)
,
TOKDEF
(
composite
)
TOKDEF
(
composite
)
,
TOKDEF
(
conductance_resolution
)
TOKDEF
(
conductance_resolution
)
,
TOKDEF
(
conductor
)
TOKDEF
(
conductor
)
,
TOKDEF
(
conflict
)
TOKDEF
(
conflict
)
,
TOKDEF
(
connect
)
TOKDEF
(
connect
)
,
TOKDEF
(
constant
)
TOKDEF
(
constant
)
,
TOKDEF
(
contact
)
TOKDEF
(
contact
)
,
TOKDEF
(
control
)
TOKDEF
(
control
)
,
TOKDEF
(
corner
)
TOKDEF
(
corner
)
,
TOKDEF
(
corners
)
TOKDEF
(
corners
)
,
TOKDEF
(
cost
)
TOKDEF
(
cost
)
,
TOKDEF
(
created_time
)
TOKDEF
(
created_time
)
,
TOKDEF
(
cross
)
TOKDEF
(
cross
)
,
TOKDEF
(
crosstalk_model
)
TOKDEF
(
crosstalk_model
)
,
TOKDEF
(
current_resolution
)
TOKDEF
(
current_resolution
)
,
TOKDEF
(
deleted_keepout
)
TOKDEF
(
deleted_keepout
)
,
TOKDEF
(
delete_pins
)
TOKDEF
(
delete_pins
)
,
TOKDEF
(
delta
)
TOKDEF
(
delta
)
,
TOKDEF
(
direction
)
TOKDEF
(
direction
)
,
TOKDEF
(
directory
)
TOKDEF
(
directory
)
,
TOKDEF
(
effective_via_length
)
TOKDEF
(
effective_via_length
)
,
TOKDEF
(
exclude
)
TOKDEF
(
exclude
)
,
TOKDEF
(
expose
)
TOKDEF
(
expose
)
,
TOKDEF
(
extra_image_directory
)
TOKDEF
(
extra_image_directory
)
,
TOKDEF
(
family
)
TOKDEF
(
family
)
,
TOKDEF
(
family_family
)
TOKDEF
(
family_family
)
,
TOKDEF
(
family_family_spacing
)
TOKDEF
(
family_family_spacing
)
,
TOKDEF
(
farad
)
TOKDEF
(
farad
)
,
TOKDEF
(
file
)
TOKDEF
(
file
)
,
TOKDEF
(
fit
)
TOKDEF
(
fit
)
,
TOKDEF
(
fix
)
TOKDEF
(
fix
)
,
TOKDEF
(
flip_style
)
TOKDEF
(
flip_style
)
,
TOKDEF
(
floor_plan
)
TOKDEF
(
floor_plan
)
,
TOKDEF
(
footprint
)
TOKDEF
(
footprint
)
,
TOKDEF
(
forbidden
)
TOKDEF
(
forbidden
)
,
TOKDEF
(
force_to_terminal_point
)
TOKDEF
(
force_to_terminal_point
)
,
TOKDEF
(
forgotten
)
TOKDEF
(
forgotten
)
,
TOKDEF
(
fromto
)
TOKDEF
(
fromto
)
,
TOKDEF
(
front
)
TOKDEF
(
front
)
,
TOKDEF
(
front_only
)
TOKDEF
(
front_only
)
,
TOKDEF
(
gap
)
TOKDEF
(
gap
)
,
TOKDEF
(
gates
)
TOKDEF
(
gates
)
,
TOKDEF
(
global
)
TOKDEF
(
global
)
,
TOKDEF
(
grid
)
TOKDEF
(
grid
)
,
TOKDEF
(
group
)
TOKDEF
(
group
)
,
TOKDEF
(
group_set
)
TOKDEF
(
group_set
)
,
TOKDEF
(
guide
)
TOKDEF
(
guide
)
,
TOKDEF
(
hard
)
TOKDEF
(
hard
)
,
TOKDEF
(
height
)
TOKDEF
(
height
)
,
TOKDEF
(
history
)
TOKDEF
(
history
)
,
TOKDEF
(
horizontal
)
TOKDEF
(
horizontal
)
,
TOKDEF
(
host_cad
)
TOKDEF
(
host_cad
)
,
TOKDEF
(
host_version
)
TOKDEF
(
host_version
)
,
TOKDEF
(
image
)
TOKDEF
(
image
)
,
TOKDEF
(
image_image
)
TOKDEF
(
image_image
)
,
TOKDEF
(
image_image_spacing
)
TOKDEF
(
image_image_spacing
)
,
TOKDEF
(
image_outline_clearance
)
TOKDEF
(
image_outline_clearance
)
,
TOKDEF
(
image_type
)
TOKDEF
(
image_type
)
,
TOKDEF
(
inch
)
TOKDEF
(
inch
)
,
TOKDEF
(
include
)
TOKDEF
(
include
)
,
TOKDEF
(
include_pins_in_crosstalk
)
TOKDEF
(
include_pins_in_crosstalk
)
,
TOKDEF
(
inductance_resolution
)
TOKDEF
(
inductance_resolution
)
,
TOKDEF
(
insert
)
TOKDEF
(
insert
)
,
TOKDEF
(
instcnfg
)
TOKDEF
(
instcnfg
)
,
TOKDEF
(
inter_layer_clearance
)
TOKDEF
(
inter_layer_clearance
)
,
TOKDEF
(
jumper
)
TOKDEF
(
jumper
)
,
TOKDEF
(
junction_type
)
TOKDEF
(
junction_type
)
,
TOKDEF
(
keepout
)
TOKDEF
(
keepout
)
,
TOKDEF
(
kg
)
TOKDEF
(
kg
)
,
TOKDEF
(
kohm
)
TOKDEF
(
kohm
)
,
TOKDEF
(
large
)
TOKDEF
(
large
)
,
TOKDEF
(
large_large
)
TOKDEF
(
large_large
)
,
TOKDEF
(
layer
)
TOKDEF
(
layer
)
,
TOKDEF
(
layer_depth
)
TOKDEF
(
layer_depth
)
,
TOKDEF
(
layer_noise_weight
)
TOKDEF
(
layer_noise_weight
)
,
TOKDEF
(
layer_pair
)
TOKDEF
(
layer_pair
)
,
TOKDEF
(
layer_rule
)
TOKDEF
(
layer_rule
)
,
TOKDEF
(
length
)
TOKDEF
(
length
)
,
TOKDEF
(
length_amplitude
)
TOKDEF
(
length_amplitude
)
,
TOKDEF
(
length_factor
)
TOKDEF
(
length_factor
)
,
TOKDEF
(
length_gap
)
TOKDEF
(
length_gap
)
,
TOKDEF
(
library
)
TOKDEF
(
library
)
,
TOKDEF
(
library_out
)
TOKDEF
(
library_out
)
,
TOKDEF
(
limit
)
TOKDEF
(
limit
)
,
TOKDEF
(
limit_bends
)
TOKDEF
(
limit_bends
)
,
TOKDEF
(
limit_crossing
)
TOKDEF
(
limit_crossing
)
,
TOKDEF
(
limit_vias
)
TOKDEF
(
limit_vias
)
,
TOKDEF
(
limit_way
)
TOKDEF
(
limit_way
)
,
TOKDEF
(
linear
)
TOKDEF
(
linear
)
,
TOKDEF
(
linear_interpolation
)
TOKDEF
(
linear_interpolation
)
,
TOKDEF
(
load
)
TOKDEF
(
load
)
,
TOKDEF
(
lock_type
)
TOKDEF
(
lock_type
)
,
TOKDEF
(
logical_part
)
TOKDEF
(
logical_part
)
,
TOKDEF
(
logical_part_mapping
)
TOKDEF
(
logical_part_mapping
)
,
TOKDEF
(
match_fromto_delay
)
TOKDEF
(
match_fromto_delay
)
,
TOKDEF
(
match_fromto_length
)
TOKDEF
(
match_fromto_length
)
,
TOKDEF
(
match_group_delay
)
TOKDEF
(
match_group_delay
)
,
TOKDEF
(
match_group_length
)
TOKDEF
(
match_group_length
)
,
TOKDEF
(
match_net_delay
)
TOKDEF
(
match_net_delay
)
,
TOKDEF
(
match_net_length
)
TOKDEF
(
match_net_length
)
,
TOKDEF
(
max_delay
)
TOKDEF
(
max_delay
)
,
TOKDEF
(
max_len
)
TOKDEF
(
max_len
)
,
TOKDEF
(
max_length
)
TOKDEF
(
max_length
)
,
TOKDEF
(
max_noise
)
TOKDEF
(
max_noise
)
,
TOKDEF
(
max_restricted_layer_length
)
TOKDEF
(
max_restricted_layer_length
)
,
TOKDEF
(
max_stagger
)
TOKDEF
(
max_stagger
)
,
TOKDEF
(
max_stub
)
TOKDEF
(
max_stub
)
,
TOKDEF
(
max_total_delay
)
TOKDEF
(
max_total_delay
)
,
TOKDEF
(
max_total_length
)
TOKDEF
(
max_total_length
)
,
TOKDEF
(
max_total_vias
)
TOKDEF
(
max_total_vias
)
,
TOKDEF
(
mhenry
)
TOKDEF
(
mhenry
)
,
TOKDEF
(
mho
)
TOKDEF
(
mho
)
,
TOKDEF
(
microvia
)
TOKDEF
(
microvia
)
,
TOKDEF
(
mid_driven
)
TOKDEF
(
mid_driven
)
,
TOKDEF
(
mil
)
TOKDEF
(
mil
)
,
TOKDEF
(
min_gap
)
TOKDEF
(
min_gap
)
,
TOKDEF
(
mirror
)
TOKDEF
(
mirror
)
,
TOKDEF
(
mirror_first
)
TOKDEF
(
mirror_first
)
,
TOKDEF
(
mm
)
TOKDEF
(
mm
)
,
TOKDEF
(
net
)
TOKDEF
(
net
)
,
TOKDEF
(
net_number
)
TOKDEF
(
net_number
)
,
TOKDEF
(
net_pin_changes
)
TOKDEF
(
net_pin_changes
)
,
TOKDEF
(
nets
)
TOKDEF
(
nets
)
,
TOKDEF
(
network
)
TOKDEF
(
network
)
,
TOKDEF
(
network_out
)
TOKDEF
(
network_out
)
,
TOKDEF
(
no
)
TOKDEF
(
no
)
,
TOKDEF
(
noexpose
)
TOKDEF
(
noexpose
)
,
TOKDEF
(
noise_accumulation
)
TOKDEF
(
noise_accumulation
)
,
TOKDEF
(
noise_calculation
)
TOKDEF
(
noise_calculation
)
,
TOKDEF
(
object_type
)
TOKDEF
(
object_type
)
,
TOKDEF
(
off
)
TOKDEF
(
off
)
,
TOKDEF
(
off_grid
)
TOKDEF
(
off_grid
)
,
TOKDEF
(
offset
)
TOKDEF
(
offset
)
,
TOKDEF
(
on
)
TOKDEF
(
on
)
,
TOKDEF
(
open
)
TOKDEF
(
open
)
,
TOKDEF
(
opposite_side
)
TOKDEF
(
opposite_side
)
,
TOKDEF
(
order
)
TOKDEF
(
order
)
,
TOKDEF
(
outline
)
TOKDEF
(
outline
)
,
TOKDEF
(
overlap
)
TOKDEF
(
overlap
)
,
TOKDEF
(
pad
)
TOKDEF
(
pad
)
,
TOKDEF
(
pad_pad
)
TOKDEF
(
pad_pad
)
,
TOKDEF
(
padstack
)
TOKDEF
(
padstack
)
,
TOKDEF
(
pair
)
TOKDEF
(
pair
)
,
TOKDEF
(
parallel
)
TOKDEF
(
parallel
)
,
TOKDEF
(
parallel_noise
)
TOKDEF
(
parallel_noise
)
,
TOKDEF
(
parallel_segment
)
TOKDEF
(
parallel_segment
)
,
TOKDEF
(
parser
)
TOKDEF
(
parser
)
,
TOKDEF
(
part_library
)
TOKDEF
(
part_library
)
,
TOKDEF
(
path
)
TOKDEF
(
path
)
,
TOKDEF
(
pcb
)
TOKDEF
(
pcb
)
,
TOKDEF
(
permit_orient
)
TOKDEF
(
permit_orient
)
,
TOKDEF
(
permit_side
)
TOKDEF
(
permit_side
)
,
TOKDEF
(
physical
)
TOKDEF
(
physical
)
,
TOKDEF
(
physical_part_mapping
)
TOKDEF
(
physical_part_mapping
)
,
TOKDEF
(
piggyback
)
TOKDEF
(
piggyback
)
,
TOKDEF
(
pin
)
TOKDEF
(
pin
)
,
TOKDEF
(
pin_allow
)
TOKDEF
(
pin_allow
)
,
TOKDEF
(
pin_cap_via
)
TOKDEF
(
pin_cap_via
)
,
TOKDEF
(
pins
)
TOKDEF
(
pins
)
,
TOKDEF
(
pintype
)
TOKDEF
(
pintype
)
,
TOKDEF
(
pin_via_cap
)
TOKDEF
(
pin_via_cap
)
,
TOKDEF
(
pin_width_taper
)
TOKDEF
(
pin_width_taper
)
,
TOKDEF
(
place
)
TOKDEF
(
place
)
,
TOKDEF
(
place_boundary
)
TOKDEF
(
place_boundary
)
,
TOKDEF
(
place_control
)
TOKDEF
(
place_control
)
,
TOKDEF
(
placement
)
TOKDEF
(
placement
)
,
TOKDEF
(
place_rule
)
TOKDEF
(
place_rule
)
,
TOKDEF
(
plan
)
TOKDEF
(
plan
)
,
TOKDEF
(
plane
)
TOKDEF
(
plane
)
,
TOKDEF
(
PN
)
TOKDEF
(
PN
)
,
TOKDEF
(
point
)
TOKDEF
(
point
)
,
TOKDEF
(
polygon
)
TOKDEF
(
polygon
)
,
TOKDEF
(
position
)
TOKDEF
(
position
)
,
TOKDEF
(
power
)
TOKDEF
(
power
)
,
TOKDEF
(
power_dissipation
)
TOKDEF
(
power_dissipation
)
,
TOKDEF
(
power_fanout
)
TOKDEF
(
power_fanout
)
,
TOKDEF
(
prefix
)
TOKDEF
(
prefix
)
,
TOKDEF
(
primary
)
TOKDEF
(
primary
)
,
TOKDEF
(
priority
)
TOKDEF
(
priority
)
,
TOKDEF
(
property
)
TOKDEF
(
property
)
,
TOKDEF
(
qarc
)
TOKDEF
(
qarc
)
,
TOKDEF
(
quarter
)
TOKDEF
(
quarter
)
,
TOKDEF
(
radius
)
TOKDEF
(
radius
)
,
TOKDEF
(
ratio
)
TOKDEF
(
ratio
)
,
TOKDEF
(
ratio_tolerance
)
TOKDEF
(
ratio_tolerance
)
,
TOKDEF
(
rect
)
TOKDEF
(
rect
)
,
TOKDEF
(
reduced
)
TOKDEF
(
reduced
)
,
TOKDEF
(
region
)
TOKDEF
(
region
)
,
TOKDEF
(
region_class
)
TOKDEF
(
region_class
)
,
TOKDEF
(
region_class_class
)
TOKDEF
(
region_class_class
)
,
TOKDEF
(
region_net
)
TOKDEF
(
region_net
)
,
TOKDEF
(
relative_delay
)
TOKDEF
(
relative_delay
)
,
TOKDEF
(
relative_group_delay
)
TOKDEF
(
relative_group_delay
)
,
TOKDEF
(
relative_group_length
)
TOKDEF
(
relative_group_length
)
,
TOKDEF
(
relative_length
)
TOKDEF
(
relative_length
)
,
TOKDEF
(
reorder
)
TOKDEF
(
reorder
)
,
TOKDEF
(
reroute_order_viols
)
TOKDEF
(
reroute_order_viols
)
,
TOKDEF
(
resistance_resolution
)
TOKDEF
(
resistance_resolution
)
,
TOKDEF
(
resolution
)
TOKDEF
(
resolution
)
,
TOKDEF
(
restricted_layer_length_factor
)
TOKDEF
(
restricted_layer_length_factor
)
,
TOKDEF
(
room
)
TOKDEF
(
room
)
,
TOKDEF
(
rotate
)
TOKDEF
(
rotate
)
,
TOKDEF
(
rotate_first
)
TOKDEF
(
rotate_first
)
,
TOKDEF
(
round
)
TOKDEF
(
round
)
,
TOKDEF
(
roundoff_rotation
)
TOKDEF
(
roundoff_rotation
)
,
TOKDEF
(
route
)
TOKDEF
(
route
)
,
TOKDEF
(
routes
)
TOKDEF
(
routes
)
,
TOKDEF
(
routes_include
)
TOKDEF
(
routes_include
)
,
TOKDEF
(
route_to_fanout_only
)
TOKDEF
(
route_to_fanout_only
)
,
TOKDEF
(
rule
)
TOKDEF
(
rule
)
,
TOKDEF
(
same_net_checking
)
TOKDEF
(
same_net_checking
)
,
TOKDEF
(
sample_window
)
TOKDEF
(
sample_window
)
,
TOKDEF
(
saturation_length
)
TOKDEF
(
saturation_length
)
,
TOKDEF
(
sec
)
TOKDEF
(
sec
)
,
TOKDEF
(
secondary
)
TOKDEF
(
secondary
)
,
TOKDEF
(
self
)
TOKDEF
(
self
)
,
TOKDEF
(
sequence_number
)
TOKDEF
(
sequence_number
)
,
TOKDEF
(
session
)
TOKDEF
(
session
)
,
TOKDEF
(
set_color
)
TOKDEF
(
set_color
)
,
TOKDEF
(
set_pattern
)
TOKDEF
(
set_pattern
)
,
TOKDEF
(
shape
)
TOKDEF
(
shape
)
,
TOKDEF
(
shield
)
TOKDEF
(
shield
)
,
TOKDEF
(
shield_gap
)
TOKDEF
(
shield_gap
)
,
TOKDEF
(
shield_loop
)
TOKDEF
(
shield_loop
)
,
TOKDEF
(
shield_tie_down_interval
)
TOKDEF
(
shield_tie_down_interval
)
,
TOKDEF
(
shield_width
)
TOKDEF
(
shield_width
)
,
TOKDEF
(
side
)
TOKDEF
(
side
)
,
TOKDEF
(
signal
)
TOKDEF
(
signal
)
,
TOKDEF
(
site
)
TOKDEF
(
site
)
,
TOKDEF
(
smd
)
TOKDEF
(
smd
)
,
TOKDEF
(
snap_angle
)
TOKDEF
(
snap_angle
)
,
TOKDEF
(
source
)
TOKDEF
(
source
)
,
TOKDEF
(
space_in_quoted_tokens
)
TOKDEF
(
space_in_quoted_tokens
)
,
TOKDEF
(
spacing
)
TOKDEF
(
spacing
)
,
TOKDEF
(
spare
)
TOKDEF
(
spare
)
,
TOKDEF
(
spiral_via
)
TOKDEF
(
spiral_via
)
,
TOKDEF
(
stack_via
)
TOKDEF
(
stack_via
)
,
TOKDEF
(
stack_via_depth
)
TOKDEF
(
stack_via_depth
)
,
TOKDEF
(
standard
)
TOKDEF
(
standard
)
,
TOKDEF
(
starburst
)
TOKDEF
(
starburst
)
,
TOKDEF
(
status
)
TOKDEF
(
status
)
,
TOKDEF
(
string_quote
)
TOKDEF
(
string_quote
)
,
TOKDEF
(
structure
)
TOKDEF
(
structure
)
,
TOKDEF
(
structure_out
)
TOKDEF
(
structure_out
)
,
TOKDEF
(
subgates
)
TOKDEF
(
subgates
)
,
TOKDEF
(
such
)
TOKDEF
(
such
)
,
TOKDEF
(
suffix
)
TOKDEF
(
suffix
)
,
TOKDEF
(
super_placement
)
TOKDEF
(
super_placement
)
,
TOKDEF
(
supply
)
TOKDEF
(
supply
)
,
TOKDEF
(
supply_pin
)
TOKDEF
(
supply_pin
)
,
TOKDEF
(
swapping
)
TOKDEF
(
swapping
)
,
TOKDEF
(
switch_window
)
TOKDEF
(
switch_window
)
,
TOKDEF
(
system
)
TOKDEF
(
system
)
,
TOKDEF
(
tandem_noise
)
TOKDEF
(
tandem_noise
)
,
TOKDEF
(
tandem_segment
)
TOKDEF
(
tandem_segment
)
,
TOKDEF
(
tandem_shield_overhang
)
TOKDEF
(
tandem_shield_overhang
)
,
TOKDEF
(
terminal
)
TOKDEF
(
terminal
)
,
TOKDEF
(
terminator
)
TOKDEF
(
terminator
)
,
TOKDEF
(
term_only
)
TOKDEF
(
term_only
)
,
TOKDEF
(
test
)
TOKDEF
(
test
)
,
TOKDEF
(
testpoint
)
TOKDEF
(
testpoint
)
,
TOKDEF
(
test_points
)
TOKDEF
(
test_points
)
,
TOKDEF
(
threshold
)
TOKDEF
(
threshold
)
,
TOKDEF
(
time_length_factor
)
TOKDEF
(
time_length_factor
)
,
TOKDEF
(
time_resolution
)
TOKDEF
(
time_resolution
)
,
TOKDEF
(
tjunction
)
TOKDEF
(
tjunction
)
,
TOKDEF
(
tolerance
)
TOKDEF
(
tolerance
)
,
TOKDEF
(
top
)
TOKDEF
(
top
)
,
TOKDEF
(
topology
)
TOKDEF
(
topology
)
,
TOKDEF
(
total
)
TOKDEF
(
total
)
,
TOKDEF
(
track_id
)
TOKDEF
(
track_id
)
,
TOKDEF
(
turret
)
TOKDEF
(
turret
)
,
TOKDEF
(
type
)
TOKDEF
(
type
)
,
TOKDEF
(
um
)
TOKDEF
(
um
)
,
TOKDEF
(
unassigned
)
TOKDEF
(
unassigned
)
,
TOKDEF
(
unconnects
)
TOKDEF
(
unconnects
)
,
TOKDEF
(
unit
)
TOKDEF
(
unit
)
,
TOKDEF
(
up
)
TOKDEF
(
up
)
,
TOKDEF
(
use_array
)
TOKDEF
(
use_array
)
,
TOKDEF
(
use_layer
)
TOKDEF
(
use_layer
)
,
TOKDEF
(
use_net
)
TOKDEF
(
use_net
)
,
TOKDEF
(
use_via
)
TOKDEF
(
use_via
)
,
TOKDEF
(
value
)
TOKDEF
(
value
)
,
TOKDEF
(
via
)
TOKDEF
(
via
)
,
TOKDEF
(
via_array_template
)
TOKDEF
(
via_array_template
)
,
TOKDEF
(
via_at_smd
)
TOKDEF
(
via_at_smd
)
,
TOKDEF
(
via_keepout
)
TOKDEF
(
via_keepout
)
,
TOKDEF
(
via_number
)
TOKDEF
(
via_number
)
,
TOKDEF
(
via_rotate_first
)
TOKDEF
(
via_rotate_first
)
,
TOKDEF
(
via_site
)
TOKDEF
(
via_site
)
,
TOKDEF
(
via_size
)
TOKDEF
(
via_size
)
,
TOKDEF
(
virtual_pin
)
TOKDEF
(
virtual_pin
)
,
TOKDEF
(
volt
)
TOKDEF
(
volt
)
,
TOKDEF
(
voltage_resolution
)
TOKDEF
(
voltage_resolution
)
,
TOKDEF
(
was_is
)
TOKDEF
(
was_is
)
,
TOKDEF
(
way
)
TOKDEF
(
way
)
,
TOKDEF
(
weight
)
TOKDEF
(
weight
)
,
TOKDEF
(
width
)
TOKDEF
(
width
)
,
TOKDEF
(
window
)
TOKDEF
(
window
)
,
TOKDEF
(
wire
)
TOKDEF
(
wire
)
,
TOKDEF
(
wires
)
TOKDEF
(
wires
)
,
TOKDEF
(
wires_include
)
TOKDEF
(
wires_include
)
,
TOKDEF
(
wiring
)
TOKDEF
(
wiring
)
,
TOKDEF
(
write_resolution
)
TOKDEF
(
write_resolution
)
,
TOKDEF
(
x
)
TOKDEF
(
x
)
,
};
};
static
int
compare
(
const
void
*
a1
,
const
void
*
a2
)
static
int
compare
(
const
void
*
a1
,
const
void
*
a2
)
{
{
const
KEYWORD
*
k1
=
(
const
KEYWORD
*
)
a1
;
const
KEYWORD
*
k1
=
(
const
KEYWORD
*
)
a1
;
...
@@ -793,33 +795,6 @@ static int compare( const void* a1, const void* a2 )
...
@@ -793,33 +795,6 @@ static int compare( const void* a1, const void* a2 )
}
}
/**
* Function findToken
* takes a string and looks up the string in the list of expected
* tokens.
* @return int - DSN_T or -1 if argument string is not a recognized token.
*/
static
int
findToken
(
const
char
*
tok
)
{
char
lowercase
[
80
];
strcpy
(
lowercase
,
tok
);
strlower
(
lowercase
);
KEYWORD
search
;
search
.
name
=
lowercase
;
const
KEYWORD
*
findings
=
(
const
KEYWORD
*
)
bsearch
(
&
search
,
tokens
,
sizeof
(
tokens
)
/
sizeof
(
tokens
[
0
]),
sizeof
(
KEYWORD
),
compare
);
if
(
findings
)
return
findings
->
token
;
else
return
-
1
;
}
struct
IOError
struct
IOError
{
{
wxString
errorText
;
wxString
errorText
;
...
@@ -921,15 +896,16 @@ LINE_READER::LINE_READER( FILE* aFile, unsigned aMaxLineLength )
...
@@ -921,15 +896,16 @@ LINE_READER::LINE_READER( FILE* aFile, unsigned aMaxLineLength )
int
LINE_READER
::
ReadLine
()
throw
(
IOError
)
int
LINE_READER
::
ReadLine
()
throw
(
IOError
)
{
{
const
char
*
p
=
fgets
(
&
line
[
0
]
,
capacity
,
fp
);
const
char
*
p
=
fgets
(
line
,
capacity
,
fp
);
if
(
!
p
)
if
(
!
p
)
{
{
length
=
0
;
line
[
0
]
=
0
;
length
=
0
;
}
}
else
else
{
{
length
=
strlen
(
&
line
[
0
]
);
length
=
strlen
(
line
);
if
(
length
>
maxLineLength
)
if
(
length
>
maxLineLength
)
throw
IOError
(
_
(
"Line length exceeded"
)
);
throw
IOError
(
_
(
"Line length exceeded"
)
);
...
@@ -957,10 +933,11 @@ class LEXER
...
@@ -957,10 +933,11 @@ class LEXER
LINE_READER
reader
;
LINE_READER
reader
;
int
stringDelimiter
;
int
stringDelimiter
;
wxString
filename
;
wxString
filename
;
int
lastTok
;
///< curTok from
la
s NextTok() call.
int
lastTok
;
///< curTok from
previou
s NextTok() call.
int
curTok
;
///< the DSN_T value of current token
DSN_T
curTok
;
///< the current token obtained on last NextTok()
std
::
string
curText
;
///< the text of the current token
std
::
string
curText
;
///< the text of the current token
std
::
string
lowercase
;
///< a scratch buf holding token in lowercase
int
readLine
()
throw
(
IOError
)
int
readLine
()
throw
(
IOError
)
...
@@ -972,6 +949,37 @@ class LEXER
...
@@ -972,6 +949,37 @@ class LEXER
return
len
;
return
len
;
}
}
/**
* Function findToken
* takes a string and looks up the string in the list of expected
* tokens.
*
* @param tok A string holding the token text to lookup, in an
* unpredictable case: uppercase or lowercase
* @return int - DSN_T or -1 if argument string is not a recognized token.
*/
int
findToken
(
const
std
::
string
&
tok
)
{
// convert to lower case once, this should be faster than using strcasecmp()
// for each test in compare().
lowercase
.
clear
();
for
(
std
::
string
::
const_iterator
iter
=
tok
.
begin
();
iter
!=
tok
.
end
();
++
iter
)
lowercase
+=
(
char
)
tolower
(
*
iter
);
KEYWORD
search
;
search
.
name
=
lowercase
.
c_str
();
const
KEYWORD
*
findings
=
(
const
KEYWORD
*
)
bsearch
(
&
search
,
tokens
,
sizeof
(
tokens
)
/
sizeof
(
tokens
[
0
]),
sizeof
(
KEYWORD
),
compare
);
if
(
findings
)
return
findings
->
token
;
else
return
-
1
;
}
public
:
public
:
...
@@ -982,8 +990,9 @@ public:
...
@@ -982,8 +990,9 @@ public:
stringDelimiter
=
'"'
;
stringDelimiter
=
'"'
;
filename
=
aFilename
;
filename
=
aFilename
;
// start should never change until we change the reader, and the DSN
// "start" should never change until we change the reader. The DSN
// format supports an include mechanism but we'll add that later.
// format spec supports an include file mechanism but we can add that later
// using a std::stack to hold a stack of LINE_READERs to track nesting.
start
=
(
char
*
)
reader
;
start
=
(
char
*
)
reader
;
limit
=
start
;
limit
=
start
;
...
@@ -991,15 +1000,28 @@ public:
...
@@ -991,15 +1000,28 @@ public:
head
=
start
;
head
=
start
;
}
}
/**
* Function SetStringDelimiter
* changes the string delimiter from the default " to some other character
* and returns the old value.
* @param aStringDelimiter The character in lowest 8 bits.
* @return int - The old delimiter in the lowest 8 bits.
*/
int
SetStringDelimiter
(
int
aStringDelimiter
)
{
int
old
=
stringDelimiter
;
stringDelimiter
=
aStringDelimiter
;
return
old
;
}
/**
/**
* Function NextTok
* Function NextTok
* returns the next token found in the input file or T_EOF when reaching
* returns the next token found in the input file or T_EOF when reaching
* the end of file.
* the end of file.
* @return
int - one of the DSN_T values
.
* @return
DSN_T - the type of token found next
.
* @throw IOError - only if the LINE_READER throws it.
* @throw IOError - only if the LINE_READER throws it.
*/
*/
int
NextTok
()
throw
(
IOError
);
DSN_T
NextTok
()
throw
(
IOError
);
/**
/**
...
@@ -1031,7 +1053,7 @@ public:
...
@@ -1031,7 +1053,7 @@ public:
* Function CurTok
* Function CurTok
* returns whatever NextTok() returned the last time it was called.
* returns whatever NextTok() returned the last time it was called.
*/
*/
int
CurTok
()
DSN_T
CurTok
()
{
{
return
curTok
;
return
curTok
;
}
}
...
@@ -1039,9 +1061,8 @@ public:
...
@@ -1039,9 +1061,8 @@ public:
};
};
int
LEXER
::
NextTok
()
throw
(
IOError
)
DSN_T
LEXER
::
NextTok
()
throw
(
IOError
)
{
{
L_next
:
lastTok
=
curTok
;
lastTok
=
curTok
;
cur
=
head
;
cur
=
head
;
...
@@ -1071,17 +1092,11 @@ L_read:
...
@@ -1071,17 +1092,11 @@ L_read:
// switching the string_quote character
// switching the string_quote character
if
(
lastTok
==
T_string_quote
)
if
(
lastTok
==
T_string_quote
)
{
{
stringDelimiter
=
*
cur
;
curText
.
clear
();
curText
.
clear
();
curText
+=
*
cur
;
curText
+=
*
cur
;
head
=
cur
+
1
;
head
=
cur
+
1
;
curTok
=
T_NONE
;
curTok
=
T_QUOTE_DEF
;
// Do not return this to the caller, consume it internally
// and go get another token for the caller.
goto
L_next
;
}
}
// a quoted string
// a quoted string
...
@@ -1142,7 +1157,7 @@ L_read:
...
@@ -1142,7 +1157,7 @@ L_read:
head
=
cur
+
1
;
head
=
cur
+
1
;
while
(
head
<
limit
&&
strchr
(
".0123456789"
,
*
head
)
)
while
(
head
<
limit
&&
strchr
(
".0123456789"
,
*
head
)
)
++
head
;
++
head
;
curText
.
clear
();
curText
.
clear
();
curText
.
append
(
cur
,
head
);
curText
.
append
(
cur
,
head
);
curTok
=
T_NUMBER
;
curTok
=
T_NUMBER
;
...
@@ -1154,15 +1169,18 @@ L_read:
...
@@ -1154,15 +1169,18 @@ L_read:
else
else
{
{
head
=
cur
+
1
;
head
=
cur
+
1
;
while
(
head
<
limit
&&
!
isspace
(
*
head
)
&&
*
head
!=
')'
)
while
(
head
<
limit
&&
!
isspace
(
*
head
)
&&
*
head
!=
')'
&&
*
head
!=
'('
)
++
head
;
++
head
;
curText
.
clear
();
curText
.
clear
();
curText
.
append
(
cur
,
head
);
curText
.
append
(
cur
,
head
);
curTok
=
findToken
(
curText
.
c_str
()
);
int
found
=
findToken
(
curText
);
if
(
found
!=
-
1
)
curTok
=
(
DSN_T
)
found
;
if
(
curTok
==
-
1
)
// unrecogized token
else
// unrecogized token
{
{
curTok
=
T_SYMBOL
;
curTok
=
T_SYMBOL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment