Skip to content

Commit 284b91a

Browse files
committed
path 4 extensions, more rarely used type fixes
1 parent 73b301e commit 284b91a

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

decoding.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ func decodePath(reader *bufio.Reader) (*Path, error) {
180180
Layer: -1,
181181
Datatype: -1,
182182
Pathtype: -1,
183+
Bgnextn: 0,
184+
Endextn: 0,
183185
Width: -1,
184186
XY: []int32{},
185187
}
@@ -222,6 +224,18 @@ OuterLoop:
222224
return nil, fmt.Errorf("could not decode Path/%s: %v", newRecord.Datatype, err)
223225
}
224226
path.Pathtype = data.(int16)
227+
case "BGNEXTN":
228+
data, err := newRecord.GetData()
229+
if err != nil {
230+
return nil, fmt.Errorf("could not decode Path/%s: %v", newRecord.Datatype, err)
231+
}
232+
path.Bgnextn = data.(int32)
233+
case "ENDEXTN":
234+
data, err := newRecord.GetData()
235+
if err != nil {
236+
return nil, fmt.Errorf("could not decode Path/%s: %v", newRecord.Datatype, err)
237+
}
238+
path.Endextn = data.(int32)
225239
case "WIDTH":
226240
data, err := newRecord.GetData()
227241
if err != nil {
@@ -234,10 +248,6 @@ OuterLoop:
234248
return nil, fmt.Errorf("could not decode Path/%s: %v", newRecord.Datatype, err)
235249
}
236250
path.XY = data.([]int32)
237-
case "BGNEXTN":
238-
continue
239-
case "ENDEXTN":
240-
continue
241251
default:
242252
return nil, fmt.Errorf("could not decode Path/%s: unknown datatype", newRecord.Datatype)
243253
}

lowlevel_types.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ var RecordTypes map[string]string = map[string]string{
5757
"2d00": "BOX", // begin of box element
5858
"2e02": "BOXTYPE", // boxtype for box element
5959
"2f03": "PLEX", // plex number
60-
"3003": "BGNEXTN", // Applies to Pathtype 4. 4-byte signed integer, extension of path outline beyond the first point. Value can be negative.
61-
"3103": "ENDEXTN", // Applies to Pathtype 4. 4-byte signed integer, extension of path outline beyond the last point. Value can be negative.
60+
"3003": "BGNEXTN", // path type 4 extension start
61+
"3103": "ENDEXTN", // path type 4 extension end
6262
"3202": "TAPENUM", // tape number
6363
"3302": "TAPECODE", // tape code
6464
"3503": "RESERVED", // type was used for NUMTYPES but was not required
@@ -110,11 +110,16 @@ var RecordTypesBytes map[string][]byte = map[string][]byte{
110110
"BOX": {0x2d, 0x00}, // begin of box element
111111
"BOXTYPE": {0x2e, 0x02}, // boxtype for box element
112112
"PLEX": {0x2f, 0x03}, // plex number
113+
"BGNEXTN": {0x30, 0x03}, // path type 4 extension start
114+
"ENDEXTN": {0x31, 0x03}, // path type 4 extension end
113115
"TAPENUM": {0x32, 0x02}, // tape number
114116
"TAPECODE": {0x33, 0x02}, // tape code
115117
"FORMAT": {0x36, 0x02}, // format type
116118
"MASK": {0x37, 0x06}, // list of layers
117119
"ENDMASKS": {0x38, 0x00}, // end of MASK
120+
"LIBDIRSIZE": {0x39, 0x02}, // contains the number of pages in the Library directory
121+
"SRFNAME": {0x3a, 0x06}, // contains the name of the Sticks Rules File, if one is bound to the library
122+
"LIBSECUR": {0x3b, 0x02}, // contains an array of Access Control List (ACL) data
118123
}
119124

120125
type ElementType int
@@ -216,6 +221,10 @@ func (r Record) GetData() (any, error) {
216221
return getDataPoint[int16](r)
217222
case "PLEX":
218223
return getDataPoint[int32](r)
224+
case "BGNEXTN":
225+
return getDataPoint[int32](r)
226+
case "ENDEXTN":
227+
return getDataPoint[int32](r)
219228
case "TAPENUM":
220229
return getDataPoint[int16](r)
221230
case "TAPECODE":
@@ -346,6 +355,8 @@ type Path struct {
346355
Layer int16
347356
Datatype int16
348357
Pathtype int16
358+
Bgnextn int32
359+
Endextn int32
349360
Width int32
350361
XY []int32
351362
}

0 commit comments

Comments
 (0)