2 * ************************** README *******************
4 * If the file format is modified in any way, update
5 * PCB_FILE_VERSION in file.h
7 * ************************** README *******************
14 * PCB, interactive printed circuit board design
15 * Copyright (C) 1994,1995,1996 Thomas Nau
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 * Contact addresses for paper mail and Email:
32 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
33 * Thomas.Nau@rz.uni-ulm.de
37 /* grammar to parse ASCII input of PCB description
49 #include "layerflags.h"
60 #ifdef HAVE_LIBDMALLOC
61 # include <dmalloc.h> /* see http://dmalloc.com */
64 static LayerType
*Layer
;
65 static PolygonType
*Polygon
;
66 static SymbolType
*Symbol
;
68 static LibraryMenuType
*Menu
;
69 static bool LayerFlag
[MAX_ALL_LAYER
];
71 extern
char *yytext
; /* defined by LEX */
72 extern PCBType
*yyPCB
;
73 extern DataType
*yyData
;
74 extern ElementType
*yyElement
;
75 extern FontType
*yyFont
;
76 extern
int yylineno
; /* linenumber */
77 extern
char *yyfilename
; /* in this file */
79 static AttributeListType
*attr_list
;
81 int yyerror(const char *s
);
83 static int check_file_version
(int);
85 static void do_measure
(PLMeasure
*m
, Coord i
, double d
, int u
);
86 #define M(r,f,d) do_measure (&(r), f, d, 1)
88 /* Macros for interpreting what "measure" means - integer value only,
89 old units (mil), or new units (cmil). */
90 #define IV(m) integer_value (m)
91 #define OU(m) old_units (m)
92 #define NU(m) new_units (m)
94 static int integer_value
(PLMeasure m
);
95 static Coord old_units
(PLMeasure m
);
96 static Coord new_units
(PLMeasure m
);
99 #define YYERROR_VERBOSE 1
107 %
union /* define YYSTACK type */
116 %token
<number
> FLOATING
/* line thickness, coordinates ... */
117 %token
<integer
> INTEGER CHAR_CONST
/* flags ... */
118 %token
<string> STRING
/* element names ... */
120 %token T_FILEVERSION T_PCB T_LAYER T_VIA T_RAT T_LINE T_ARC T_RECTANGLE T_TEXT T_ELEMENTLINE
121 %token T_ELEMENT T_PIN T_PAD T_GRID T_FLAGS T_SYMBOL T_SYMBOLLINE T_CURSOR
122 %token T_ELEMENTARC T_MARK T_GROUPS T_STYLES T_POLYGON T_POLYGON_HOLE T_NETLIST T_NET T_CONN
123 %token T_AREA T_THERMAL T_DRC T_ATTRIBUTE
124 %token T_UMIL T_CMIL T_MIL T_IN T_NM T_UM T_MM T_M T_KM T_PX
125 %type
<integer
> symbolid
126 %type
<string> opt_string
127 %type
<flagtype
> flags
128 %type
<number
> number
129 %type
<measure
> measure
140 /* %start-doc pcbfile 00pcb
144 A special note about units: Older versions of @code{pcb} used mils
145 (1/1000 inch) as the base unit; a value of 500 in the file meant
146 half an inch. Newer versions uses a "high resolution" syntax,
147 where the base unit is 1/100 of a mil (0.000010 inch); a value of 500 in
148 the file means 5 mils. As a general rule, the variants of each entry
149 listed below which use square brackets are the high resolution formats
150 and use the 1/100 mil units, and the ones with parentheses are the older
151 variants and use 1 mil units. Note that when multiple variants
152 are listed, the most recent (and most preferred) format is the first
155 Symbolic and numeric flags (SFlags and NFlags) are described in
162 /* reset flags for 'used layers';
163 * init font and data pointers
169 Message
(_
("illegal fileformat\n"));
172 for
(i
= 0; i
< MAX_ALL_LAYER
; i
++)
173 LayerFlag
[i
] = false
;
174 yyFont
= &yyPCB
->Font
;
175 yyData
= yyPCB
->Data
;
178 /* Parse the default layer group string, just in case the file doesn't have one */
179 if
(ParseGroupString
(Settings.Groups
, &yyPCB
->LayerGroups
, &yyData
->LayerN
))
181 Message
(_
("illegal default layer-group string\n"));
199 PCBType
*pcb_save
= PCB
;
201 CreateNewPCBPost
(yyPCB
, 0);
202 /* initialize the polygon clipping now since
203 * we didn't know the layer grouping before.
206 ALLPOLYGON_LOOP
(yyData
);
208 InitClip
(yyData
, layer
, polygon
);
217 /* This case is when we load a footprint with file->open, or from the command line */
218 yyFont
= &yyPCB
->Font
;
219 yyData
= yyPCB
->Data
;
226 PCBType
*pcb_save
= PCB
;
230 /* This case is when we load a footprint with file->open, or from the command line */
231 CreateNewPCBPost
(yyPCB
, 0);
232 ParseGroupString
("1,c:2,s", &yyPCB
->LayerGroups
, &yyData
->LayerN
);
233 e
= yyPCB
->Data
->Element
->data
; /* we know there's only one */
235 MoveElementLowLevel
(yyPCB
->Data
, e
, -e
->BoundingBox.X1
, -e
->BoundingBox.Y1
);
237 yyPCB
->MaxWidth
= e
->BoundingBox.X2
;
238 yyPCB
->MaxHeight
= e
->BoundingBox.Y2
;
239 yyPCB
->is_footprint
= 1;
246 /* reset flags for 'used layers';
247 * init font and data pointers
251 if
(!yyData ||
!yyFont
)
253 Message
(_
("illegal fileformat\n"));
256 for
(i
= 0; i
< MAX_ALL_LAYER
; i
++)
257 LayerFlag
[i
] = false
;
271 /* mark all symbols invalid */
276 Message
(_
("illegal fileformat\n"));
279 yyFont
->Valid
= false
;
280 for
(i
= 0; i
<= MAX_FONTPOSITION
; i
++)
281 free
(yyFont
->Symbol
[i
].Line
);
282 bzero
(yyFont
->Symbol
, sizeof
(yyFont
->Symbol
));
286 yyFont
->Valid
= true
;
291 /* %start-doc pcbfile FileVersion
299 File format version. This version number represents the date when the pcb file
300 format was last changed.
303 Any version of pcb build from sources equal to or newer
304 than this number should be able to read the file. If this line is not present
305 in the input file then file format compatibility is not checked.
312 T_FILEVERSION
'[' INTEGER
']'
314 if
(check_file_version
($3) != 0)
321 /* %start-doc pcbfile PCB
324 PCB ["Name" Width Height]
325 PCB ("Name" Width Height]
331 Name of the PCB project
336 If you don't specify the size of the board, a very large default is
342 : T_PCB
'(' STRING
')'
345 yyPCB
->MaxWidth
= MAX_COORD
;
346 yyPCB
->MaxHeight
= MAX_COORD
;
348 | T_PCB
'(' STRING measure measure
')'
351 yyPCB
->MaxWidth
= OU
($4);
352 yyPCB
->MaxHeight
= OU
($5);
354 | T_PCB
'[' STRING measure measure
']'
357 yyPCB
->MaxWidth
= NU
($4);
358 yyPCB
->MaxHeight
= NU
($5);
362 /* %start-doc pcbfile Grid
365 Grid [Step OffsetX OffsetY Visible]
366 Grid (Step OffsetX OffsetY Visible)
367 Grid (Step OffsetX OffsetY)
372 Distance from one grid point to adjacent points. This value may be a
373 floating point number for the first two variants.
374 @item OffsetX OffsetY
375 The "origin" of the grid. Normally zero.
377 If non-zero, the grid will be visible on the screen.
388 : T_GRID
'(' measure measure measure
')'
390 yyPCB
->Grid
= OU
($3);
391 yyPCB
->GridOffsetX
= OU
($4);
392 yyPCB
->GridOffsetY
= OU
($5);
396 : T_GRID
'(' measure measure measure INTEGER
')'
398 yyPCB
->Grid
= OU
($3);
399 yyPCB
->GridOffsetX
= OU
($4);
400 yyPCB
->GridOffsetY
= OU
($5);
402 Settings.DrawGrid
= true
;
404 Settings.DrawGrid
= false
;
409 : T_GRID
'[' measure measure measure INTEGER
']'
411 yyPCB
->Grid
= NU
($3);
412 yyPCB
->GridOffsetX
= NU
($4);
413 yyPCB
->GridOffsetY
= NU
($5);
415 Settings.DrawGrid
= true
;
417 Settings.DrawGrid
= false
;
421 /* %start-doc pcbfile Cursor
430 Location of the cursor when the board was saved.
431 As of November 2012 the cursor position is not written to file anymore.
432 Older versions of pcb ignore the absence of this line in the pcb file.
434 The current zoom factor. Note that a zoom factor of "0" means 1 mil
435 per screen pixel, N means @math{2^N} mils per screen pixel, etc. The
436 first variant accepts floating point numbers. The special value
437 "1000" means "zoom to fit"
439 This field is ignored by PCB.
445 : T_CURSOR
'(' measure measure number
')'
447 yyPCB
->CursorX
= OU
($3);
448 yyPCB
->CursorY
= OU
($4);
450 | T_CURSOR
'[' measure measure number
']'
452 yyPCB
->CursorX
= NU
($3);
453 yyPCB
->CursorY
= NU
($4);
458 /* %start-doc pcbfile PolyArea
466 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.
473 | T_AREA
'[' number
']'
475 /* Read in cmil^2 for now; in future this should be a noop. */
476 yyPCB
->IsleArea
= MIL_TO_COORD
(MIL_TO_COORD
($3) / 100.0) / 100.0;
481 /* %start-doc pcbfile Thermal
489 Relative size of thermal fingers. A value of 1.0 makes the finger
490 width twice the clearance gap width (measured across the gap, not
491 diameter). The normal value is 0.5, which results in a finger width
492 the same as the clearance gap width.
500 | T_THERMAL
'[' number
']'
502 yyPCB
->ThermScale
= $3;
506 /* %start-doc pcbfile DRC
509 DRC [Bloat Shrink Line Silk Drill Ring]
510 DRC [Bloat Shrink Line Silk]
511 DRC [Bloat Shrink Line]
516 Minimum spacing between copper.
518 Minimum copper overlap to guarantee connectivity.
520 Minimum line thickness.
522 Minimum silk thickness.
526 Minimum width of the annular ring around pins and vias.
539 : T_DRC
'[' measure measure measure
']'
541 yyPCB
->Bloat
= NU
($3);
542 yyPCB
->Shrink
= NU
($4);
543 yyPCB
->minWid
= NU
($5);
544 yyPCB
->minRing
= NU
($5);
549 : T_DRC
'[' measure measure measure measure
']'
551 yyPCB
->Bloat
= NU
($3);
552 yyPCB
->Shrink
= NU
($4);
553 yyPCB
->minWid
= NU
($5);
554 yyPCB
->minSlk
= NU
($6);
555 yyPCB
->minRing
= NU
($5);
560 : T_DRC
'[' measure measure measure measure measure measure
']'
562 yyPCB
->Bloat
= NU
($3);
563 yyPCB
->Shrink
= NU
($4);
564 yyPCB
->minWid
= NU
($5);
565 yyPCB
->minSlk
= NU
($6);
566 yyPCB
->minDrill
= NU
($7);
567 yyPCB
->minRing
= NU
($8);
571 /* %start-doc pcbfile Flags
579 A number, whose value is normally given in hex, individual bits of which
580 represent pcb-wide flags as defined in @ref{PCBFlags}.
587 : T_FLAGS
'(' INTEGER
')'
589 yyPCB
->Flags
= MakeFlags
($3 & PCB_FLAGS
);
591 | T_FLAGS
'(' STRING
')'
593 yyPCB
->Flags
= string_to_pcbflags
($3, yyerror);
598 /* %start-doc pcbfile Groups
607 Encodes the layer grouping information. Each group is separated by a
608 colon, each member of each group is separated by a comma. Group
609 members are either numbers from @code{1}..@var{N} for each layer, and
610 the letters @code{c} or @code{s} representing the component side and
611 solder side of the board. Including @code{c} or @code{s} marks that
612 group as being the top or bottom side of the board.
615 Groups("1,2,c:3:4:5,6,s:7,8")
623 : T_GROUPS
'(' STRING
')'
625 if
(ParseGroupString
($3, &yyPCB
->LayerGroups
, &yyData
->LayerN
))
627 Message
(_
("illegal layer-group string\n"));
634 /* %start-doc pcbfile Styles
643 Encodes the four routing styles @code{pcb} knows about. The four styles
644 are separated by colons. Each style consists of five parameters as follows:
648 The name of the style.
650 Width of lines and arcs.
652 Copper diameter of pins and vias.
654 Drill diameter of pins and vias.
656 Minimum spacing to other nets. If omitted, 10 mils is the default.
663 Styles("Signal,10,40,20:Power,25,60,35:Fat,40,60,35:Skinny,8,36,20")
664 Styles["Logic,1000,3600,2000,1000:Power,2500,6000,3500,1000:
665 @ @ @ Line,4000,6000,3500,1000:Breakout,600,2402,1181,600"]
669 Note that strings in actual files cannot span lines; the above example
670 is split across lines only to make it readable.
675 : T_STYLES
'(' STRING
')'
677 if
(ParseRouteString
($3, &yyPCB
->RouteStyle
[0], "mil"))
679 Message
(_
("illegal route-style string\n"));
683 | T_STYLES
'[' STRING
']'
685 if
(ParseRouteString
($3, &yyPCB
->RouteStyle
[0], "cmil"))
687 Message
(_
("illegal route-style string\n"));
701 | pcbdefinitions pcbdefinition
706 |
{ attr_list
= & yyPCB
->Attributes
; } attribute
721 /* %start-doc pcbfile Via
724 Via [X Y Thickness Clearance Mask Drill "Name" SFlags]
725 Via (X Y Thickness Clearance Mask Drill "Name" NFlags)
726 Via (X Y Thickness Clearance Drill "Name" NFlags)
727 Via (X Y Thickness Drill "Name" NFlags)
728 Via (X Y Thickness "Name" NFlags)
733 coordinates of center
735 outer diameter of copper annulus
737 add to thickness to get clearance diameter
739 diameter of solder mask opening
743 string, name of via (vias have names?)
745 symbolic or numerical flags
753 /* x, y, thickness, clearance, mask, drilling-hole, name, flags */
754 : T_VIA
'[' measure measure measure measure measure measure STRING flags
']'
756 CreateNewVia
(yyData
, NU
($3), NU
($4), NU
($5), NU
($6), NU
($7),
763 /* x, y, thickness, clearance, mask, drilling-hole, name, flags */
764 : T_VIA
'(' measure measure measure measure measure measure STRING INTEGER
')'
766 CreateNewVia
(yyData
, OU
($3), OU
($4), OU
($5), OU
($6), OU
($7), OU
($8), $9,
774 /* x, y, thickness, clearance, drilling-hole, name, flags */
775 : T_VIA
'(' measure measure measure measure measure STRING INTEGER
')'
777 CreateNewVia
(yyData
, OU
($3), OU
($4), OU
($5), OU
($6),
778 OU
($5) + OU
($6), OU
($7), $8, OldFlags
($9));
784 /* x, y, thickness, drilling-hole, name, flags */
785 : T_VIA
'(' measure measure measure measure STRING INTEGER
')'
787 CreateNewVia
(yyData
, OU
($3), OU
($4), OU
($5), 2*GROUNDPLANEFRAME
,
788 OU
($5) + 2*MASKFRAME
, OU
($6), $7, OldFlags
($8));
794 /* old format: x, y, thickness, name, flags */
795 : T_VIA
'(' measure measure measure STRING INTEGER
')'
797 Coord hole
= (OU
($5) * DEFAULT_DRILLINGHOLE
);
799 /* make sure that there's enough copper left */
800 if
(OU
($5) - hole
< MIN_PINORVIACOPPER
&&
801 OU
($5) > MIN_PINORVIACOPPER
)
802 hole
= OU
($5) - MIN_PINORVIACOPPER
;
804 CreateNewVia
(yyData
, OU
($3), OU
($4), OU
($5), 2*GROUNDPLANEFRAME
,
805 OU
($5) + 2*MASKFRAME
, hole
, $6, OldFlags
($7));
810 /* %start-doc pcbfile Rat
813 Rat [X1 Y1 Group1 X2 Y2 Group2 SFlags]
814 Rat (X1 Y1 Group1 X2 Y2 Group2 NFlags)
819 The endpoints of the rat line.
821 The layer group each end is connected on.
823 Symbolic or numeric flags.
831 : T_RAT
'[' measure measure INTEGER measure measure INTEGER flags
']'
833 CreateNewRat
(yyData
, NU
($3), NU
($4), NU
($6), NU
($7), $5, $8,
834 Settings.RatThickness
, $9);
836 | T_RAT
'(' measure measure INTEGER measure measure INTEGER INTEGER
')'
838 CreateNewRat
(yyData
, OU
($3), OU
($4), OU
($6), OU
($7), $5, $8,
839 Settings.RatThickness
, OldFlags
($9));
843 /* %start-doc pcbfile Layer
846 Layer (LayerNum "Name" "Flags") (
847 @ @ @ @dots{} contents @dots{}
853 The layer number. Layers are numbered sequentially, starting with 1.
854 The last two layers (9 and 10 by default) are solder-side silk and
855 component-side silk, in that order. The two silk layers also mark top and
856 bottom side; the layer group where the solder-side silk layer is member in
857 is the solder side group. Analogous for the other side.
861 For layout files predating layer flags the name also defines
862 the layer type in some situations. For example, a layer named @emph{outline}
863 was considered to be the layer defining the extents of the board.
865 Layer flags. Currently this is the layer type, like @emph{copper}, @emph{silk}
866 or @emph{outline}. For a complete list see layertype_name[] in layerflags.c.
868 With layer flags missing, the type of layer is guessed at load time, mostly by
869 the layer name. This mechanism ensures compatibility with older layouts.
871 The contents of the layer, which may include attributes, lines, arcs, rectangles,
879 : T_LAYER
'(' INTEGER STRING opt_string
')' '('
881 if
($3 <= 0 ||
$3 > MAX_ALL_LAYER
)
883 yyerror("Layernumber out of range");
888 yyerror("Layernumber used twice");
891 Layer
= &yyData
->Layer
[$3-1];
893 /* memory for name is already allocated */
895 if
(Layer
->Name
== NULL
)
896 Layer
->Name
= strdup
("");
897 LayerFlag
[$3-1] = true
;
899 Layer
->Type
= string_to_layertype
($5, yyerror);
901 Layer
->Type
= guess_layertype
($4, $3, yyData
);
913 | layerdefinitions layerdefinition
923 /* x1, y1, x2, y2, flags */
924 | T_RECTANGLE
'(' measure measure measure measure INTEGER
')'
926 CreateNewPolygonFromRectangle
(Layer
,
927 OU
($3), OU
($4), OU
($3) + OU
($5), OU
($4) + OU
($6), OldFlags
($7));
932 |
{ attr_list
= & Layer
->Attributes
; } attribute
935 /* %start-doc pcbfile Line
938 Line [X1 Y1 X2 Y2 Thickness Clearance SFlags]
939 Line (X1 Y1 X2 Y2 Thickness Clearance NFlags)
940 Line (X1 Y1 X2 Y2 Thickness NFlags)
945 The end points of the line
947 The width of the line
949 The amount of space cleared around the line when the line passes
950 through a polygon. The clearance is added to the thickness to get the
951 thickness of the clear; thus the space between the line and the
952 polygon is @math{Clearance/2} wide.
954 Symbolic or numeric flags
962 /* x1, y1, x2, y2, thickness, clearance, flags */
963 : T_LINE
'[' measure measure measure measure measure measure flags
']'
965 CreateNewLineOnLayer
(Layer
, NU
($3), NU
($4), NU
($5), NU
($6),
966 NU
($7), NU
($8), $9);
971 /* x1, y1, x2, y2, thickness, clearance, flags */
972 : T_LINE
'(' measure measure measure measure measure measure INTEGER
')'
974 CreateNewLineOnLayer
(Layer
, OU
($3), OU
($4), OU
($5), OU
($6),
975 OU
($7), OU
($8), OldFlags
($9));
980 /* x1, y1, x2, y2, thickness, flags */
981 : T_LINE
'(' measure measure measure measure measure measure
')'
983 /* eliminate old-style rat-lines */
984 if
((IV
($8) & RATFLAG
) == 0)
985 CreateNewLineOnLayer
(Layer
, OU
($3), OU
($4), OU
($5), OU
($6), OU
($7),
986 200*GROUNDPLANEFRAME
, OldFlags
(IV
($8)));
990 /* %start-doc pcbfile Arc
993 Arc [X Y RadiusX RadiusY Thickness Clearance StartAngle DeltaAngle SFlags]
994 Arc (X Y RadiusX RadiusY Thickness Clearance StartAngle DeltaAngle NFlags)
995 Arc (X Y RadiusX RadiusY Thickness StartAngle DeltaAngle NFlags)
1000 Coordinates of the center of the arc.
1001 @item RadiusX RadiusY
1002 The RadiusX and RadiusY, from the center to the edge (centerline of the
1003 trace). The bounds of the circle of which this arc is a segment, is
1004 thus @math{2*RadiusX} by @math{2*RadiusY}.
1006 The width of the copper trace which forms the arc.
1008 The amount of space cleared around the arc when the line passes
1009 through a polygon. The clearance is added to the thickness to get the
1010 thickness of the clear; thus the space between the arc and the polygon
1011 is @math{Clearance/2} wide.
1013 The angle of one end of the arc, in degrees. In PCB, an angle of zero
1014 points left (negative X direction), and 90 degrees points down
1015 (positive Y direction).
1017 The sweep of the arc. This may be negative. Positive angles sweep
1020 Symbolic or numeric flags.
1028 /* x, y, width, height, thickness, clearance, startangle, delta, flags */
1029 : T_ARC
'[' measure measure measure measure measure measure number number flags
']'
1031 CreateNewArcOnLayer
(Layer
, NU
($3), NU
($4), NU
($5), NU
($6), $9, $10,
1032 NU
($7), NU
($8), $11);
1037 /* x, y, width, height, thickness, clearance, startangle, delta, flags */
1038 : T_ARC
'(' measure measure measure measure measure measure number number INTEGER
')'
1040 CreateNewArcOnLayer
(Layer
, OU
($3), OU
($4), OU
($5), OU
($6), $9, $10,
1041 OU
($7), OU
($8), OldFlags
($11));
1046 /* x, y, width, height, thickness, startangle, delta, flags */
1047 : T_ARC
'(' measure measure measure measure measure measure number INTEGER
')'
1049 CreateNewArcOnLayer
(Layer
, OU
($3), OU
($4), OU
($5), OU
($5), IV
($8), $9,
1050 OU
($7), 200*GROUNDPLANEFRAME
, OldFlags
($10));
1054 /* %start-doc pcbfile Text
1057 Text [X Y Direction Scale "String" SFlags]
1058 Text (X Y Direction Scale "String" NFlags)
1059 Text (X Y Direction "String" NFlags)
1064 The location of the upper left corner of the text.
1066 0 means text is drawn left to right, 1 means up, 2 means right to left
1067 (i.e. upside down), and 3 means down.
1069 Size of the text, as a percentage of the ``default'' size of of the
1070 font (the default font is about 40 mils high). Default is 100 (40
1075 Symbolic or numeric flags.
1083 /* x, y, direction, text, flags */
1084 : T_TEXT
'(' measure measure number STRING INTEGER
')'
1086 /* use a default scale of 100% */
1087 CreateNewText
(Layer
,yyFont
,OU
($3), OU
($4), $5, 100, $6, OldFlags
($7));
1093 /* x, y, direction, scale, text, flags */
1094 : T_TEXT
'(' measure measure number number STRING INTEGER
')'
1096 if
($8 & ONSILKFLAG
)
1098 LayerType
*lay
= &yyData
->Layer
[yyData
->LayerN
+
1099 (($8 & ONSOLDERFLAG
) ? BOTTOM_SILK_LAYER
: TOP_SILK_LAYER
)];
1101 CreateNewText
(lay
,yyFont
, OU
($3), OU
($4), $5, $6, $7,
1105 CreateNewText
(Layer
, yyFont
, OU
($3), OU
($4), $5, $6, $7,
1111 /* x, y, direction, scale, text, flags */
1112 : T_TEXT
'[' measure measure number number STRING flags
']'
1114 /* FIXME: shouldn't know about .f */
1115 /* I don't think this matters because anything with hi_format
1116 * will have the silk on its own layer in the file rather
1117 * than using the ONSILKFLAG and having it in a copper layer.
1118 * Thus there is no need for anything besides the 'else'
1119 * part of this code.
1121 if
($8.f
& ONSILKFLAG
)
1123 LayerType
*lay
= &yyData
->Layer
[yyData
->LayerN
+
1124 (($8.f
& ONSOLDERFLAG
) ? BOTTOM_SILK_LAYER
: TOP_SILK_LAYER
)];
1126 CreateNewText
(lay
, yyFont
, NU
($3), NU
($4), $5, $6, $7, $8);
1129 CreateNewText
(Layer
, yyFont
, NU
($3), NU
($4), $5, $6, $7, $8);
1134 /* %start-doc pcbfile Polygon
1138 @ @ @ @dots{} (X Y) @dots{}
1139 @ @ @ @dots{} [X Y] @dots{}
1141 @ @ @ @ @ @ @dots{} (X Y) @dots{}
1142 @ @ @ @ @ @ @dots{} [X Y] @dots{}
1150 Symbolic or numeric flags.
1152 Coordinates of each vertex. You must list at least three coordinates.
1154 Defines a hole within the polygon's outer contour. There may be zero or more such sections.
1160 : /* flags are passed in */
1161 T_POLYGON
'(' flags
')' '('
1163 Polygon
= CreateNewPolygon
(Layer
, $3);
1168 Cardinal contour
, contour_start
, contour_end
;
1169 bool bad_contour_found
= false
;
1171 for
(contour
= 0; contour
<= Polygon
->HoleIndexN
; contour
++)
1173 contour_start
= (contour
== 0) ?
1174 0 : Polygon
->HoleIndex
[contour
- 1];
1175 contour_end
= (contour
== Polygon
->HoleIndexN
) ?
1177 Polygon
->HoleIndex
[contour
];
1178 if
(contour_end
- contour_start
< 3)
1179 bad_contour_found
= true
;
1182 if
(bad_contour_found
)
1184 Message
(_
("WARNING parsing file '%s'\n"
1186 " description: 'ignored polygon "
1187 "(< 3 points in a contour)'\n"),
1188 yyfilename
, yylineno
);
1189 DestroyObject
(yyData
, POLYGON_TYPE
, Layer
, Polygon
, Polygon
);
1193 SetPolygonBoundingBox
(Polygon
);
1194 if
(!Layer
->polygon_tree
)
1195 Layer
->polygon_tree
= r_create_tree
(NULL
, 0, 0);
1196 r_insert_entry
(Layer
->polygon_tree
, (BoxType
*) Polygon
, 0);
1203 | polygonholes polygonhole
1207 : T_POLYGON_HOLE
'('
1209 CreateNewHoleInPolygon
(Polygon
);
1216 | polygonpoint polygonpoints
1221 : '(' measure measure
')'
1223 CreateNewPointInPolygon
(Polygon
, OU
($2), OU
($3));
1225 |
'[' measure measure
']'
1227 CreateNewPointInPolygon
(Polygon
, NU
($2), NU
($3));
1231 /* %start-doc pcbfile Element
1234 Element [SFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TSFlags] (
1235 Element (NFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TNFlags) (
1236 Element (NFlags "Desc" "Name" "Value" TX TY TDir TScale TNFlags) (
1237 Element (NFlags "Desc" "Name" TX TY TDir TScale TNFlags) (
1238 Element ("Desc" "Name" TX TY TDir TScale TNFlags) (
1239 @ @ @ @dots{} contents @dots{}
1245 Symbolic or numeric flags, for the element as a whole.
1247 Numeric flags, for the element as a whole.
1249 The description of the element. This is one of the three strings
1250 which can be displayed on the screen.
1252 The name of the element, usually the reference designator.
1254 The value of the element.
1256 The location of the element's mark. This is the reference point
1257 for placing the element and its pins and pads.
1259 The upper left corner of the text (one of the three strings).
1261 The relative direction of the text. 0 means left to right for
1262 an unrotated element, 1 means up, 2 left, 3 down.
1264 Size of the text, as a percentage of the ``default'' size of of the
1265 font (the default font is about 40 mils high). Default is 100 (40
1268 Symbolic or numeric flags, for the text.
1270 Numeric flags, for the text.
1273 Elements may contain pins, pads, element lines, element arcs,
1274 attributes, and (for older elements) an optional mark. Note that
1275 element definitions that have the mark coordinates in the element
1276 line, only support pins and pads which use relative coordinates. The
1277 pin and pad coordinates are relative to the mark. Element definitions
1278 which do not include the mark coordinates in the element line, may
1279 have a Mark definition in their contents, and only use pin and pad
1280 definitions which use absolute coordinates.
1286 | element_1.3
.4_format
1288 | element_1.7_format
1293 /* element_flags, description, pcb-name,
1294 * text_x, text_y, text_direction, text_scale, text_flags
1296 : T_ELEMENT
'(' STRING STRING measure measure INTEGER
')' '('
1298 yyElement
= CreateNewElement
(yyData
, yyFont
, NoFlags
(),
1299 $3, $4, NULL
, OU
($5), OU
($6), $7, 100, NoFlags
(), false
);
1304 elementdefinitions
')'
1306 SetElementBoundingBox
(yyData
, yyElement
, yyFont
);
1310 element_1.3
.4_format
1311 /* element_flags, description, pcb-name,
1312 * text_x, text_y, text_direction, text_scale, text_flags
1314 : T_ELEMENT
'(' INTEGER STRING STRING measure measure measure measure INTEGER
')' '('
1316 yyElement
= CreateNewElement
(yyData
, yyFont
, OldFlags
($3),
1317 $4, $5, NULL
, OU
($6), OU
($7), IV
($8), IV
($9), OldFlags
($10), false
);
1322 elementdefinitions
')'
1324 SetElementBoundingBox
(yyData
, yyElement
, yyFont
);
1329 /* element_flags, description, pcb-name, value,
1330 * text_x, text_y, text_direction, text_scale, text_flags
1332 : T_ELEMENT
'(' INTEGER STRING STRING STRING measure measure measure measure INTEGER
')' '('
1334 yyElement
= CreateNewElement
(yyData
, yyFont
, OldFlags
($3),
1335 $4, $5, $6, OU
($7), OU
($8), IV
($9), IV
($10), OldFlags
($11), false
);
1341 elementdefinitions
')'
1343 SetElementBoundingBox
(yyData
, yyElement
, yyFont
);
1348 /* element_flags, description, pcb-name, value, mark_x, mark_y,
1349 * text_x, text_y, text_direction, text_scale, text_flags
1351 : T_ELEMENT
'(' INTEGER STRING STRING STRING measure measure
1352 measure measure number number INTEGER
')' '('
1354 yyElement
= CreateNewElement
(yyData
, yyFont
, OldFlags
($3),
1355 $4, $5, $6, OU
($7) + OU
($9), OU
($8) + OU
($10),
1356 $11, $12, OldFlags
($13), false
);
1357 yyElement
->MarkX
= OU
($7);
1358 yyElement
->MarkY
= OU
($8);
1365 SetElementBoundingBox
(yyData
, yyElement
, yyFont
);
1370 /* element_flags, description, pcb-name, value, mark_x, mark_y,
1371 * text_x, text_y, text_direction, text_scale, text_flags
1373 : T_ELEMENT
'[' flags STRING STRING STRING measure measure
1374 measure measure number number flags
']' '('
1376 yyElement
= CreateNewElement
(yyData
, yyFont
, $3,
1377 $4, $5, $6, NU
($7) + NU
($9), NU
($8) + NU
($10),
1378 $11, $12, $13, false
);
1379 yyElement
->MarkX
= NU
($7);
1380 yyElement
->MarkY
= NU
($8);
1387 SetElementBoundingBox
(yyData
, yyElement
, yyFont
);
1391 /* %start-doc pcbfile ElementLine
1394 ElementLine [X1 Y1 X2 Y2 Thickness]
1395 ElementLine (X1 Y1 X2 Y2 Thickness)
1400 Coordinates of the endpoints of the line. These are relative to the
1401 Element's mark point for new element formats, or absolute for older
1404 The width of the silk for this line.
1409 /* %start-doc pcbfile ElementArc
1412 ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
1413 ElementArc (X Y Width Height StartAngle DeltaAngle Thickness)
1418 Coordinates of the center of the arc. These are relative to the
1419 Element's mark point for new element formats, or absolute for older
1422 The width and height, from the center to the edge. The bounds of the
1423 circle of which this arc is a segment, is thus @math{2*Width} by
1426 The angle of one end of the arc, in degrees. In PCB, an angle of zero
1427 points left (negative X direction), and 90 degrees points down
1428 (positive Y direction).
1430 The sweep of the arc. This may be negative. Positive angles sweep
1433 The width of the silk line which forms the arc.
1438 /* %start-doc pcbfile Mark
1447 Coordinates of the Mark, for older element formats that don't have
1448 the mark as part of the Element line.
1455 | elementdefinitions elementdefinition
1464 /* x1, y1, x2, y2, thickness */
1465 | T_ELEMENTLINE
'[' measure measure measure measure measure
']'
1467 CreateNewLineInElement
(yyElement
, NU
($3), NU
($4), NU
($5), NU
($6), NU
($7));
1469 /* x1, y1, x2, y2, thickness */
1470 | T_ELEMENTLINE
'(' measure measure measure measure measure
')'
1472 CreateNewLineInElement
(yyElement
, OU
($3), OU
($4), OU
($5), OU
($6), OU
($7));
1474 /* x, y, width, height, startangle, anglediff, thickness */
1475 | T_ELEMENTARC
'[' measure measure measure measure number number measure
']'
1477 CreateNewArcInElement
(yyElement
, NU
($3), NU
($4), NU
($5), NU
($6), $7, $8, NU
($9));
1479 /* x, y, width, height, startangle, anglediff, thickness */
1480 | T_ELEMENTARC
'(' measure measure measure measure number number measure
')'
1482 CreateNewArcInElement
(yyElement
, OU
($3), OU
($4), OU
($5), OU
($6), $7, $8, OU
($9));
1485 | T_MARK
'[' measure measure
']'
1487 yyElement
->MarkX
= NU
($3);
1488 yyElement
->MarkY
= NU
($4);
1490 | T_MARK
'(' measure measure
')'
1492 yyElement
->MarkX
= OU
($3);
1493 yyElement
->MarkY
= OU
($4);
1495 |
{ attr_list
= & yyElement
->Attributes
; } attribute
1500 | relementdefs relementdef
1508 /* x1, y1, x2, y2, thickness */
1509 | T_ELEMENTLINE
'[' measure measure measure measure measure
']'
1511 CreateNewLineInElement
(yyElement
, NU
($3) + yyElement
->MarkX
,
1512 NU
($4) + yyElement
->MarkY
, NU
($5) + yyElement
->MarkX
,
1513 NU
($6) + yyElement
->MarkY
, NU
($7));
1515 | T_ELEMENTLINE
'(' measure measure measure measure measure
')'
1517 CreateNewLineInElement
(yyElement
, OU
($3) + yyElement
->MarkX
,
1518 OU
($4) + yyElement
->MarkY
, OU
($5) + yyElement
->MarkX
,
1519 OU
($6) + yyElement
->MarkY
, OU
($7));
1521 /* x, y, width, height, startangle, anglediff, thickness */
1522 | T_ELEMENTARC
'[' measure measure measure measure number number measure
']'
1524 CreateNewArcInElement
(yyElement
, NU
($3) + yyElement
->MarkX
,
1525 NU
($4) + yyElement
->MarkY
, NU
($5), NU
($6), $7, $8, NU
($9));
1527 | T_ELEMENTARC
'(' measure measure measure measure number number measure
')'
1529 CreateNewArcInElement
(yyElement
, OU
($3) + yyElement
->MarkX
,
1530 OU
($4) + yyElement
->MarkY
, OU
($5), OU
($6), $7, $8, OU
($9));
1532 |
{ attr_list
= & yyElement
->Attributes
; } attribute
1535 /* %start-doc pcbfile Pin
1538 Pin [rX rY Thickness Clearance Mask Drill "Name" "Number" SFlags]
1539 Pin (rX rY Thickness Clearance Mask Drill "Name" "Number" NFlags)
1540 Pin (aX aY Thickness Drill "Name" "Number" NFlags)
1541 Pin (aX aY Thickness Drill "Name" NFlags)
1542 Pin (aX aY Thickness "Name" NFlags)
1547 coordinates of center, relative to the element's mark
1549 absolute coordinates of center.
1551 outer diameter of copper annulus
1553 add to thickness to get clearance diameter
1555 diameter of solder mask opening
1563 symbolic or numerical flags
1565 numerical flags only
1571 /* x, y, thickness, clearance, mask, drilling hole, name,
1573 : T_PIN
'[' measure measure measure measure measure measure STRING STRING flags
']'
1575 CreateNewPin
(yyElement
, NU
($3) + yyElement
->MarkX
,
1576 NU
($4) + yyElement
->MarkY
, NU
($5), NU
($6), NU
($7), NU
($8), $9,
1583 /* x, y, thickness, clearance, mask, drilling hole, name,
1585 : T_PIN
'(' measure measure measure measure measure measure STRING STRING INTEGER
')'
1587 CreateNewPin
(yyElement
, OU
($3) + yyElement
->MarkX
,
1588 OU
($4) + yyElement
->MarkY
, OU
($5), OU
($6), OU
($7), OU
($8), $9,
1589 $10, OldFlags
($11));
1596 /* x, y, thickness, drilling hole, name, number, flags */
1597 : T_PIN
'(' measure measure measure measure STRING STRING INTEGER
')'
1599 CreateNewPin
(yyElement
, OU
($3), OU
($4), OU
($5), 2*GROUNDPLANEFRAME
,
1600 OU
($5) + 2*MASKFRAME
, OU
($6), $7, $8, OldFlags
($9));
1607 /* x, y, thickness, drilling hole, name, flags */
1608 : T_PIN
'(' measure measure measure measure STRING INTEGER
')'
1612 sprintf
(p_number
, "%d", pin_num
++);
1613 CreateNewPin
(yyElement
, OU
($3), OU
($4), OU
($5), 2*GROUNDPLANEFRAME
,
1614 OU
($5) + 2*MASKFRAME
, OU
($6), $7, p_number
, OldFlags
($8));
1621 /* old format: x, y, thickness, name, flags
1622 * drilling hole is 40% of the diameter
1624 : T_PIN
'(' measure measure measure STRING INTEGER
')'
1626 Coord hole
= OU
($5) * DEFAULT_DRILLINGHOLE
;
1629 /* make sure that there's enough copper left */
1630 if
(OU
($5) - hole
< MIN_PINORVIACOPPER
&&
1631 OU
($5) > MIN_PINORVIACOPPER
)
1632 hole
= OU
($5) - MIN_PINORVIACOPPER
;
1634 sprintf
(p_number
, "%d", pin_num
++);
1635 CreateNewPin
(yyElement
, OU
($3), OU
($4), OU
($5), 2*GROUNDPLANEFRAME
,
1636 OU
($5) + 2*MASKFRAME
, hole
, $6, p_number
, OldFlags
($7));
1641 /* %start-doc pcbfile Pad
1644 Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags]
1645 Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags)
1646 Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags)
1647 Pad (aX1 aY1 aX2 aY2 Thickness "Name" NFlags)
1651 @item rX1 rY1 rX2 rY2
1652 Coordinates of the endpoints of the pad, relative to the element's
1653 mark. Note that the copper extends beyond these coordinates by half
1654 the thickness. To make a square or round pad, specify the same
1656 @item aX1 aY1 aX2 aY2
1657 Same, but absolute coordinates of the endpoints of the pad.
1661 add to thickness to get clearance width.
1663 width of solder mask opening.
1669 symbolic or numerical flags
1671 numerical flags only
1677 /* x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags */
1678 : T_PAD
'[' measure measure measure measure measure measure measure STRING STRING flags
']'
1680 CreateNewPad
(yyElement
, NU
($3) + yyElement
->MarkX
,
1681 NU
($4) + yyElement
->MarkY
,
1682 NU
($5) + yyElement
->MarkX
,
1683 NU
($6) + yyElement
->MarkY
, NU
($7), NU
($8), NU
($9),
1691 /* x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags */
1692 : T_PAD
'(' measure measure measure measure measure measure measure STRING STRING INTEGER
')'
1694 CreateNewPad
(yyElement
,OU
($3) + yyElement
->MarkX
,
1695 OU
($4) + yyElement
->MarkY
, OU
($5) + yyElement
->MarkX
,
1696 OU
($6) + yyElement
->MarkY
, OU
($7), OU
($8), OU
($9),
1697 $10, $11, OldFlags
($12));
1704 /* x1, y1, x2, y2, thickness, name , pad number, flags */
1705 : T_PAD
'(' measure measure measure measure measure STRING STRING INTEGER
')'
1707 CreateNewPad
(yyElement
,OU
($3),OU
($4),OU
($5),OU
($6),OU
($7), 2*GROUNDPLANEFRAME
,
1708 OU
($7) + 2*MASKFRAME
, $8, $9, OldFlags
($10));
1715 /* x1, y1, x2, y2, thickness, name and flags */
1716 : T_PAD
'(' measure measure measure measure measure STRING INTEGER
')'
1720 sprintf
(p_number
, "%d", pin_num
++);
1721 CreateNewPad
(yyElement
,OU
($3),OU
($4),OU
($5),OU
($6),OU
($7), 2*GROUNDPLANEFRAME
,
1722 OU
($7) + 2*MASKFRAME
, $8,p_number
, OldFlags
($9));
1727 flags
: INTEGER
{ $$
= OldFlags
($1); }
1728 | STRING
{ $$
= string_to_flags
($1, yyerror); }
1736 /* %start-doc pcbfile Symbol
1739 Symbol [Char Delta] (
1740 Symbol (Char Delta) (
1741 @ @ @ @dots{} symbol lines @dots{}
1747 The character or numerical character value this symbol represents.
1748 Characters must be in single quotes.
1750 Additional space to allow after this character.
1755 symbol
: symbolhead symboldata
')'
1757 symbolhead
: T_SYMBOL
'[' symbolid measure
']' '('
1759 if
($3 <= 0 ||
$3 > MAX_FONTPOSITION
)
1761 yyerror("fontposition out of range");
1764 Symbol
= &yyFont
->Symbol
[$3];
1767 yyerror("symbol ID used twice");
1770 Symbol
->Valid
= true
;
1771 Symbol
->Delta
= NU
($4);
1773 | T_SYMBOL
'(' symbolid measure
')' '('
1775 if
($3 <= 0 ||
$3 > MAX_FONTPOSITION
)
1777 yyerror("fontposition out of range");
1780 Symbol
= &yyFont
->Symbol
[$3];
1783 yyerror("symbol ID used twice");
1786 Symbol
->Valid
= true
;
1787 Symbol
->Delta
= OU
($4);
1798 | symboldata symboldefinition
1799 | symboldata hiressymbol
1802 /* %start-doc pcbfile SymbolLine
1805 SymbolLine [X1 Y1 X2 Y2 Thickness]
1806 SymbolLine (X1 Y1 X2 Y2 Thickness)
1811 The endpoints of this line.
1813 The width of this line.
1819 /* x1, y1, x2, y2, thickness */
1820 : T_SYMBOLLINE
'(' measure measure measure measure measure
')'
1822 CreateNewLineInSymbol
(Symbol
, OU
($3), OU
($4), OU
($5), OU
($6), OU
($7));
1826 /* x1, y1, x2, y2, thickness */
1827 : T_SYMBOLLINE
'[' measure measure measure measure measure
']'
1829 CreateNewLineInSymbol
(Symbol
, NU
($3), NU
($4), NU
($5), NU
($6), NU
($7));
1833 /* %start-doc pcbfile Netlist
1837 @ @ @ @dots{} nets @dots{}
1843 pcbnetlist
: pcbnetdef
1847 /* net(...) net(...) ... */
1848 : T_NETLIST
'(' ')' '('
1862 /* %start-doc pcbfile Net
1865 Net ("Name" "Style") (
1866 @ @ @ @dots{} connects @dots{}
1872 The name of this net.
1874 The routing style that should be used when autorouting this net.
1880 /* name style pin pin ... */
1881 : T_NET
'(' STRING STRING
')' '('
1883 Menu
= CreateNewNet
(&yyPCB
->NetlistLib
, $3, $4);
1900 /* %start-doc pcbfile Connect
1908 The name of a pin or pad which is included in this net. Pin and Pad
1909 names are named by the refdes and pin name, like @code{"U14-7"} for
1910 pin 7 of U14, or @code{"T4-E"} for pin E of T4.
1916 : T_CONN
'(' STRING
')'
1918 CreateNewConnection
(Menu
, $3);
1923 /* %start-doc pcbfile Attribute
1926 Attribute ("Name" "Value")
1929 Attributes allow boards and elements to have arbitrary data attached
1930 to them, which is not directly used by PCB itself but may be of use by
1931 other programs or users.
1935 The name of the attribute
1938 The value of the attribute. Values are always stored as strings, even
1939 if the value is interpreted as, for example, a number.
1946 : T_ATTRIBUTE
'(' STRING STRING
')'
1948 CreateNewAttribute
(attr_list
, $3, $4 ?
$4 : (char *)"");
1954 opt_string
: STRING
{ $$
= $1; }
1955 |
/* empty */ { $$
= 0; }
1959 : FLOATING
{ $$
= $1; }
1960 | INTEGER
{ $$
= $1; }
1964 /* Default unit (no suffix) is cmil */
1965 : number
{ do_measure
(&$$
, $1, MIL_TO_COORD
($1) / 100.0, 0); }
1966 | number T_UMIL
{ M
($$
, $1, MIL_TO_COORD
($1) / 1000000.0); }
1967 | number T_CMIL
{ M
($$
, $1, MIL_TO_COORD
($1) / 100.0); }
1968 | number T_MIL
{ M
($$
, $1, MIL_TO_COORD
($1)); }
1969 | number T_IN
{ M
($$
, $1, INCH_TO_COORD
($1)); }
1970 | number T_NM
{ M
($$
, $1, MM_TO_COORD
($1) / 1000000.0); }
1971 | number T_PX
{ M
($$
, $1, MM_TO_COORD
($1) / 1000000.0); }
1972 | number T_UM
{ M
($$
, $1, MM_TO_COORD
($1) / 1000.0); }
1973 | number T_MM
{ M
($$
, $1, MM_TO_COORD
($1)); }
1974 | number T_M
{ M
($$
, $1, MM_TO_COORD
($1) * 1000.0); }
1975 | number T_KM
{ M
($$
, $1, MM_TO_COORD
($1) * 1000000.0); }
1980 /* ---------------------------------------------------------------------------
1981 * error routine called by parser library
1983 int yyerror(const char * s
)
1985 Message
(_
("ERROR parsing file '%s'\n"
1987 " description: '%s'\n"),
1988 yyfilename
, yylineno
, s
);
1998 check_file_version
(int ver
)
2000 if
( ver
> PCB_FILE_VERSION
) {
2001 Message
(_
("ERROR: The file you are attempting to load is in a format\n"
2002 "which is too new for this version of pcb. To load this file\n"
2003 "you need a version of pcb which is >= %d. If you are\n"
2004 "using a version built from git source, the source date\n"
2005 "must be >= %d. This copy of pcb can only read files\n"
2006 "up to file version %d.\n"), ver
, ver
, PCB_FILE_VERSION
);
2014 do_measure
(PLMeasure
*m
, Coord i
, double d
, int u
)
2017 m
->bval
= round
(d
);
2023 integer_value
(PLMeasure m
)
2026 yyerror("units ignored here");
2031 old_units
(PLMeasure m
)
2035 return round
(MIL_TO_COORD
(m.ival
));
2039 new_units
(PLMeasure m
)
2043 return round
(MIL_TO_COORD
(m.ival
) / 100.0);