Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GdsRecords.h
Go to the documentation of this file.
1 
8 #ifndef _GDSPARSER_GDSRECORDS_H
9 #define _GDSPARSER_GDSRECORDS_H
10 
12 namespace GdsParser
13 {
14 
20 struct GdsRecords
21 {
23  enum EnumType {
24  HEADER = 0x00,
25  BGNLIB = 0x01,
26  LIBNAME = 0x02,
27  UNITS = 0x03,
28  ENDLIB = 0x04,
29  BGNSTR = 0x05,
30  STRNAME = 0x06,
31  ENDSTR = 0x07,
32  BOUNDARY = 0x08,
33  PATH = 0x09,
34  SREF = 0x0a,
35  AREF = 0x0b,
36  TEXT = 0x0c,
37  LAYER = 0x0d,
38  DATATYPE = 0x0e,
39  WIDTH = 0x0f,
40  XY = 0x10,
41  ENDEL = 0x11,
42  SNAME = 0x12,
43  COLROW = 0x13,
44  TEXTNODE = 0x14,
45  NODE = 0x15,
46  TEXTTYPE = 0x16,
47  PRESENTATION = 0x17,
48  SPACING = 0x18,
49  STRING = 0x19,
50  STRANS = 0x1a,
51  MAG = 0x1b,
52  ANGLE = 0x1c,
53  UINTEGER = 0x1d,
54  USTRING = 0x1e,
55  REFLIBS = 0x1f,
56  FONTS = 0x20,
57  PATHTYPE = 0x21,
58  GENERATIONS = 0x22,
59  ATTRTABLE = 0x23,
60  STYPTABLE = 0x24,
61  STRTYPE = 0x25,
62  ELFLAGS = 0x26,
63  ELKEY = 0x27,
64  LINKTYPE = 0x28,
65  LINKKEYS = 0x29,
66  NODETYPE = 0x2a,
67  PROPATTR = 0x2b,
68  PROPVALUE = 0x2c,
69  BOX = 0x2d,
70  BOXTYPE = 0x2e,
71  PLEX = 0x2f,
72  BGNEXTN = 0x30,
73  ENDTEXTN = 0x31, /* first 'T' a typo in GDSII manual??? */
74  TAPENUM = 0x32,
75  TAPECODE = 0x33,
76  STRCLASS = 0x34,
77  RESERVED = 0x35,
78  FORMAT = 0x36,
79  MASK = 0x37,
80  ENDMASKS = 0x38,
81  LIBDIRSIZE = 0x39,
82  SRFNAME = 0x3a,
83  LIBSECUR = 0x3b,
84  UNKNOWN = 0x3c /* unknown is set to the total number of records */
85  };
86 };
87 
89 static const char* gdsRecordsAscii[] = {
90  "HEADER",
91  "BGNLIB",
92  "LIBNAME",
93  "UNITS",
94  "ENDLIB",
95  "BGNSTR",
96  "STRNAME",
97  "ENDSTR",
98  "BOUNDARY",
99  "PATH",
100  "SREF",
101  "AREF",
102  "TEXT",
103  "LAYER",
104  "DATATYPE",
105  "WIDTH",
106  "XY",
107  "ENDEL",
108  "SNAME",
109  "COLROW",
110  "TEXTNODE",
111  "NODE",
112  "TEXTTYPE",
113  "PRESENTATION",
114  "SPACING",
115  "STRING",
116  "STRANS",
117  "MAG",
118  "ANGLE",
119  "UINTEGER",
120  "USTRING",
121  "REFLIBS",
122  "FONTS",
123  "PATHTYPE",
124  "GENERATIONS",
125  "ATTRTABLE",
126  "STYPTABLE",
127  "STRTYPE",
128  "ELFLAGS",
129  "ELKEY",
130  "LINKTYPE",
131  "LINKKEYS",
132  "NODETYPE",
133  "PROPATTR",
134  "PROPVALUE",
135  "BOX",
136  "BOXTYPE",
137  "PLEX",
138  "BGNEXTN",
139  "ENDTEXTN", /* first 'T' a typo in GDSII manual??? */
140  "TAPENUM",
141  "TAPECODE",
142  "STRCLASS",
143  "RESERVED",
144  "FORMAT",
145  "MASK",
146  "ENDMASKS",
147  "LIBDIRSIZE",
148  "SRFNAME",
149  "LIBSECUR",
150  "UNKNOWN" /* unknown is set to the total number of records */
151 };
152 
154 static const char* gdsRecordsDescription[] = {
155  "Start of stream, contains version number of stream file",
156  "Beginning of library, plus mod and access dates",
157  "The name of the library",
158  "Size of db unit in user units and size of db unit in meters",
159  "End of the library",
160  "Begin structure, plus create and mod dates",
161  "Name of a structure",
162  "End of a structure",
163  "The beginning of a BOUNDARY element",
164  "The beginning of a PATH element",
165  "The beginning of an SREF element",
166  "The beginning of an AREF element",
167  "The beginning of a TEXT element",
168  "Layer specification",
169  "Datatype specification",
170  "Width specification, negative means absolute",
171  "An array of XY coordinates",
172  "The end of an element",
173  "The name of a referenced structure",
174  "Columns and rows for an AREF",
175  "\"Not currently used\" per GDSII Stream Format Manual, Release 6.0",
176  "The beginning of a NODE element",
177  "Texttype specification",
178  "Text origin and font specification",
179  "\"Discontinued\" per GDSII Stream Format Manual, Release 6.0",
180  "Character string",
181  "Refl, absmag, and absangle for SREF, AREF and TEXT",
182  "Magnification, 1 is the default",
183  "Angular rotation factor",
184  "User integer, used only in V2.0, translates to userprop 126 on instream",
185  "User string, used only in V2.0, translates to userprop 127 on instream",
186  "Names of the reference libraries",
187  "Names of the textfont definition files",
188  "Type of path ends",
189  "Number of deleted or backed up structures to retain",
190  "Name of the attribute definition file",
191  "\"Unreleased feature\" per GDSII Stream Format Manual, Release 6.0",
192  "\"Unreleased feature\" per GDSII Stream Format Manual, Release 6.0",
193  "Flags for template and exterior data",
194  "\"Unreleased feature\" per GDSII Stream Format Manual, Release 6.0",
195  "\"Unreleased feature\" per GDSII Stream Format Manual, Release 6.0",
196  "\"Unreleased feature\" per GDSII Stream Format Manual, Release 6.0",
197  "Nodetype specification",
198  "Property number",
199  "Property value",
200  "The beginning of a BOX element",
201  "Boxtype specification",
202  "Plex number and plexhead flag",
203  "Path extension beginning for pathtype 4 in CustomPlus",
204  "Path extension end for pathtype 4 in CustomPlus",
205  "Tape number for multi-reel stream file, you've got a really old file here",
206  "Tape code to verify that you've loaded a reel from the proper set",
207  "Calma use only, non-Calma programs should not use, or set to all 0",
208  "Used to be NUMTYPES per GDSII Stream Format Manual, Release 6.0",
209  "Archive or Filtered flag",
210  "Only in filtered streams, lists layer and datatype mask used",
211  "The end of mask descriptions",
212  "Number of pages in library director, a GDSII thing...",
213  "Sticks rule file name",
214  "Access control list stuff for CalmaDOS, ancient!",
215  "***ERROR*** Unknown record type type"
216 };
217 
219 struct GdsData
220 {
222  enum EnumType {
223  NO_DATA = 0x00,
224  BIT_ARRAY = 0x01,
225  INTEGER_2 = 0x02,
226  INTEGER_4 = 0x03,
227  REAL_4 = 0x04,
228  REAL_8 = 0x05,
229  STRING = 0x06,
230  UNKNOWN = 0x07
231  };
232 };
233 
235 static const char* gdsDataAscii[] = {
236  "NO_DATA",
237  "BIT_ARRAY",
238  "INTEGER_2",
239  "INTEGER_4",
240  "REAL_4",
241  "REAL_8",
242  "STRING",
243  "UNKNOWN"
244 };
245 
247 static const char* gdsDataDescription[] = {
248  "No data present (nothing after the record header)",
249  "Bit array (2 bytes)",
250  "Two byte signed integer",
251  "Four byte signed integer",
252  "Four byte real (not used?)",
253  "Eight byte real",
254  "ASCII string (padded to an even byte count with NULL)",
255  "UNKNOWN"
256 };
257 
259 static const int gdsRecordsExpectData[] = {
260  0x02,
261  0x02,
262  0x06,
263  0x05,
264  0x00,
265  0x02,
266  0x06,
267  0x00,
268  0x00,
269  0x00,
270  0x00,
271  0x00,
272  0x00,
273  0x02,
274  0x02,
275  0x03,
276  0x03,
277  0x00,
278  0x06,
279  0x02,
280  0x00,
281  0x00,
282  0x02,
283  0x01,
284  0xffff,
285  0x06,
286  0x01,
287  0x05,
288  0x05,
289  0xffff,
290  0xffff,
291  0x06,
292  0x06,
293  0x02,
294  0x02,
295  0x06,
296  0x06,
297  0x02,
298  0x01,
299  0x03,
300  0xffff,
301  0xffff,
302  0x02,
303  0x02,
304  0x06,
305  0x00,
306  0x02,
307  0x03,
308  0x03,
309  0x03,
310  0x02,
311  0x02,
312  0x01,
313  0x03,
314  0x02,
315  0x06,
316  0x00,
317  0x02,
318  0x06,
319  0x02,
320  0xffff
321 };
322 
326 
329 inline const char* gds_record_ascii(int record_type)
330 {
331  return gdsRecordsAscii[record_type];
332 }
335 inline const char* gds_record_description(int record_type)
336 {
337  return gdsRecordsDescription[record_type];
338 }
341 inline int gds_record_expected_data(int record_type)
342 {
343  return gdsRecordsExpectData[record_type];
344 }
347 inline const char* gds_data_ascii(int data_type)
348 {
349  return gdsDataAscii[data_type];
350 }
353 inline const char* gds_data_description(int data_type)
354 {
355  return gdsDataDescription[data_type];
356 }
361 {
362  if (numeric > GdsRecords::UNKNOWN)
363  numeric = GdsRecords::UNKNOWN;
364  return (GdsRecords::EnumType)numeric;
365 }
369 inline GdsData::EnumType gds_data_type(int numeric)
370 {
371  if (numeric > GdsData::UNKNOWN)
372  numeric = GdsData::UNKNOWN;
373  return (GdsData::EnumType)numeric;
374 }
376 
377 } // namespace GdsParser
378 
379 #endif
int gds_record_expected_data(int record_type)
Definition: GdsRecords.h:341
const char * gds_data_description(int data_type)
Definition: GdsRecords.h:353
GDSII records. The records are numbered with consecutive integers, so we can use simple array to save...
Definition: GdsRecords.h:20
EnumType
enum type of data type
Definition: GdsRecords.h:222
GdsData::EnumType gds_data_type(int numeric)
convert integer to enum
Definition: GdsRecords.h:369
const char * gds_data_ascii(int data_type)
Definition: GdsRecords.h:347
const char * gds_record_description(int record_type)
Definition: GdsRecords.h:335
namespace for Limbo.GdsParser
Definition: GdsIO.h:19
const char * gds_record_ascii(int record_type)
Definition: GdsRecords.h:329
EnumType
enum type of GDSII records
Definition: GdsRecords.h:23
GdsRecords::EnumType gds_record_type(int numeric)
convert integer to enum
Definition: GdsRecords.h:360