@rotu/structview 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/deno.lock ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "version": "5",
3
+ "specifiers": {
4
+ "jsr:@std/assert@1": "1.0.15",
5
+ "jsr:@std/internal@^1.0.12": "1.0.12"
6
+ },
7
+ "jsr": {
8
+ "@std/assert@1.0.15": {
9
+ "integrity": "d64018e951dbdfab9777335ecdb000c0b4e3df036984083be219ce5941e4703b",
10
+ "dependencies": [
11
+ "jsr:@std/internal"
12
+ ]
13
+ },
14
+ "@std/internal@1.0.12": {
15
+ "integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027"
16
+ }
17
+ },
18
+ "workspace": {
19
+ "dependencies": [
20
+ "jsr:@std/assert@1"
21
+ ]
22
+ }
23
+ }
package/mod.js ADDED
@@ -0,0 +1,336 @@
1
+ /**
2
+ * Strongly typed classes for accessing binary data in a structured way
3
+ * @module
4
+ */ var _computedKey;
5
+ const dataViewSymbol = Symbol.for("Struct.dataview");
6
+ /**
7
+ * Get the underlying DataView of a struct
8
+ * @param struct
9
+ * @returns
10
+ */ export function structDataView(struct) {
11
+ const result = struct[dataViewSymbol];
12
+ if (!(result instanceof DataView)) {
13
+ throw new TypeError("not a struct");
14
+ }
15
+ return struct[dataViewSymbol];
16
+ }
17
+ /**
18
+ * Helper method to create a view of a contiguous subregion of a Struct's memory
19
+ * @param struct
20
+ * @param start byte offset to start
21
+ * @param end byte offset of the end of the subrange
22
+ * @returns region of the given struct.
23
+ */ function structBytes(struct, start, end) {
24
+ const dv = structDataView(struct);
25
+ start ??= 0;
26
+ end ??= dv.byteLength;
27
+ console.assert(start <= end);
28
+ console.assert(end <= dv.byteLength);
29
+ return new Uint8Array(dv.buffer, dv.byteOffset + start, end - start);
30
+ }
31
+ /**
32
+ * Define a descriptor based on a dataview of the struct
33
+ * @param fieldGetter function which, given a dataview, returns
34
+ * @returns
35
+ */ export function fromDataView(fieldGetter) {
36
+ return {
37
+ enumerable: true,
38
+ get () {
39
+ const dv = this[dataViewSymbol];
40
+ return fieldGetter(dv);
41
+ }
42
+ };
43
+ }
44
+ /**
45
+ * Field for a 8-bit unsigned integer
46
+ */ export function u8(fieldOffset) {
47
+ return {
48
+ enumerable: true,
49
+ get () {
50
+ return structDataView(this).getUint8(fieldOffset);
51
+ },
52
+ set (value) {
53
+ structDataView(this).setUint8(fieldOffset, value);
54
+ }
55
+ };
56
+ }
57
+ /**
58
+ * Field for a little-endian 16-bit unsigned integer
59
+ */ export function u16(fieldOffset) {
60
+ return {
61
+ enumerable: true,
62
+ get () {
63
+ return structDataView(this).getUint16(fieldOffset, true);
64
+ },
65
+ set (value) {
66
+ structDataView(this).setUint16(fieldOffset, value, true);
67
+ }
68
+ };
69
+ }
70
+ /**
71
+ * Field for a little-endian 32-bit unsigned integer
72
+ */ export function u32(fieldOffset) {
73
+ return {
74
+ enumerable: true,
75
+ get () {
76
+ return structDataView(this).getUint32(fieldOffset, true);
77
+ },
78
+ set (value) {
79
+ structDataView(this).setUint32(fieldOffset, value, true);
80
+ }
81
+ };
82
+ }
83
+ /**
84
+ * Field for a little-endian 64-bit unsigned integer
85
+ */ export function u64(fieldOffset) {
86
+ return {
87
+ enumerable: true,
88
+ get () {
89
+ return structDataView(this).getBigUint64(fieldOffset, true);
90
+ },
91
+ set (value) {
92
+ structDataView(this).setBigUint64(fieldOffset, value, true);
93
+ }
94
+ };
95
+ }
96
+ /**
97
+ * Field for a little-endian 8-bit signed integer
98
+ */ export function i8(fieldOffset) {
99
+ return {
100
+ enumerable: true,
101
+ get () {
102
+ return structDataView(this).getInt8(fieldOffset);
103
+ },
104
+ set (value) {
105
+ structDataView(this).setInt8(fieldOffset, value);
106
+ }
107
+ };
108
+ }
109
+ /**
110
+ * Field for a little-endian 16-bit signed integer
111
+ */ export function i16(fieldOffset) {
112
+ return {
113
+ enumerable: true,
114
+ get () {
115
+ return structDataView(this).getInt16(fieldOffset, true);
116
+ },
117
+ set (value) {
118
+ structDataView(this).setInt16(fieldOffset, value, true);
119
+ }
120
+ };
121
+ }
122
+ /**
123
+ * Field for a little-endian 32-bit signed integer
124
+ */ export function i32(fieldOffset) {
125
+ return {
126
+ enumerable: true,
127
+ get () {
128
+ return structDataView(this).getInt32(fieldOffset, true);
129
+ },
130
+ set (value) {
131
+ structDataView(this).setInt32(fieldOffset, value, true);
132
+ }
133
+ };
134
+ }
135
+ /**
136
+ * Field for a little-endian 64-bit signed integer
137
+ */ export function i64(fieldOffset) {
138
+ return {
139
+ enumerable: true,
140
+ get () {
141
+ return structDataView(this).getBigInt64(fieldOffset, true);
142
+ },
143
+ set (value) {
144
+ structDataView(this).setBigInt64(fieldOffset, value, true);
145
+ }
146
+ };
147
+ }
148
+ /**
149
+ * Field for a little-endian 16-bit binary float (float16_t)
150
+ */ export function f16(fieldOffset) {
151
+ return {
152
+ enumerable: true,
153
+ get () {
154
+ return structDataView(this).getFloat16(fieldOffset, true);
155
+ },
156
+ set (value) {
157
+ structDataView(this).setFloat16(fieldOffset, value, true);
158
+ }
159
+ };
160
+ }
161
+ /**
162
+ * Field for a little-endian 32-bit binary float (float32_t)
163
+ */ export function f32(fieldOffset) {
164
+ return {
165
+ enumerable: true,
166
+ get () {
167
+ return structDataView(this).getFloat32(fieldOffset, true);
168
+ },
169
+ set (value) {
170
+ structDataView(this).setFloat32(fieldOffset, value, true);
171
+ }
172
+ };
173
+ }
174
+ /**
175
+ * Field for a little-endian 64-bit binary float (float64_t)
176
+ */ export function f64(fieldOffset) {
177
+ return {
178
+ enumerable: true,
179
+ get () {
180
+ return structDataView(this).getFloat64(fieldOffset, true);
181
+ },
182
+ set (value) {
183
+ structDataView(this).setFloat64(fieldOffset, value, true);
184
+ }
185
+ };
186
+ }
187
+ /**
188
+ * Field for a UTF-8 fixed-length string
189
+ */ export function string(fieldOffset, byteLength) {
190
+ const TEXT_DECODER = new TextDecoder();
191
+ const TEXT_ENCODER = new TextEncoder();
192
+ return {
193
+ enumerable: true,
194
+ get () {
195
+ const str = TEXT_DECODER.decode(structBytes(this, fieldOffset, fieldOffset + byteLength));
196
+ // trim all trailing null characters
197
+ return str.replace(/\0+$/, "");
198
+ },
199
+ set (value) {
200
+ const bytes = structBytes(this, fieldOffset, fieldOffset + byteLength);
201
+ bytes.fill(0);
202
+ TEXT_ENCODER.encodeInto(value, bytes);
203
+ }
204
+ };
205
+ }
206
+ /**
207
+ * Field for a boolean stored in a byte (0 = false, nonzero = true)
208
+ * True will be stored as 1
209
+ */ export function bool(fieldOffset) {
210
+ return {
211
+ enumerable: true,
212
+ get () {
213
+ return Boolean(structDataView(this).getUint8(fieldOffset));
214
+ },
215
+ set (value) {
216
+ structDataView(this).setUint8(fieldOffset, value ? 1 : 0);
217
+ }
218
+ };
219
+ }
220
+ /**
221
+ * Field for an embedded struct
222
+ * @param ctor constructor for the inner struct
223
+ * @param byteOffset where the inner struct starts relative to the outer struct
224
+ * @param bytelength the length in bytes of the inner struct
225
+ * @returns property descriptor for a struct
226
+ */ export function substruct(ctor, byteOffset, bytelength) {
227
+ return fromDataView(function(dv) {
228
+ const offset2 = dv.byteOffset + (byteOffset ?? 0);
229
+ const bytelength2 = bytelength ?? dv.byteLength - (byteOffset ?? 0);
230
+ return Reflect.construct(ctor, [
231
+ {
232
+ buffer: dv.buffer,
233
+ byteOffset: offset2,
234
+ byteLength: bytelength2
235
+ }
236
+ ]);
237
+ });
238
+ }
239
+ _computedKey = Symbol.toStringTag;
240
+ /**
241
+ * Base class for a structured binary object
242
+ * Note there are no predeclared string-keyed properties - all property names are reserved for user-defined fields
243
+ */ export class Struct {
244
+ [dataViewSymbol];
245
+ get [_computedKey]() {
246
+ return Struct.name;
247
+ }
248
+ static toDataView(o) {
249
+ return o[dataViewSymbol];
250
+ }
251
+ /**
252
+ * Create a new Struct
253
+ * @param arg options for creating the struct.
254
+ * If options has a `.buffer` property, we will use that as the backing memory (e.g. any TypedArray or DataView).
255
+ * If options has no `.buffer` property but has a `.byteLength`, we will allocate a new buffer for the object.
256
+ */ constructor(arg){
257
+ if (typeof arg !== "object" || arg === null) {
258
+ throw new TypeError("Expected argument to be an object");
259
+ }
260
+ Object.preventExtensions(this);
261
+ if (arg.buffer) {
262
+ this[dataViewSymbol] = new DataView(arg.buffer, arg.byteOffset, arg.byteLength);
263
+ } else if (typeof arg.byteLength === "number") {
264
+ this[dataViewSymbol] = new DataView(new ArrayBuffer(arg.byteLength + (arg.byteOffset ?? 0)), arg.byteOffset, arg.byteLength);
265
+ } else {
266
+ throw new TypeError("Must provide either {buffer} or {byteLength}");
267
+ }
268
+ }
269
+ }
270
+ /**
271
+ * Subclass a type by adding the given property descriptors
272
+ * @param ctor constructor for the base class
273
+ * @param propertyDescriptors properties to add to subclass instances
274
+ * @returns A new class, inheriting from the base class, with the new property descriptors added
275
+ */ function subclassWithProperties(ctor, propertyDescriptors) {
276
+ return class extends ctor {
277
+ static{
278
+ Object.defineProperties(this.prototype, propertyDescriptors);
279
+ }
280
+ };
281
+ }
282
+ /**
283
+ * Subclass struct by adding the given property descriptors
284
+ * @param propertyDescriptors properties to add to subclass instances
285
+ * @returns A new class, inheriting from `Struct`, with the new property descriptors added
286
+ */ export function defineStruct(propertyDescriptors) {
287
+ return subclassWithProperties(Struct, propertyDescriptors);
288
+ }
289
+ /**
290
+ * Create a new struct subclass for an array of structs
291
+ * @param arrayOptions
292
+ * @returns A new class, inheriting from `Struct` whose elements are statically typed structs
293
+ */ export function defineArray(arrayOptions) {
294
+ var _computedKey;
295
+ const { struct, byteStride, length } = arrayOptions;
296
+ // Define a subclass of Struct which translates array-like index access into element access
297
+ // x[2] -> x.element(2)
298
+ const ProxiedStruct = function(...args) {
299
+ return Reflect.construct(Struct, args, new.target);
300
+ };
301
+ ProxiedStruct.prototype = new Proxy(Struct.prototype, {
302
+ get (target, p, receiver) {
303
+ if (typeof p === "string") {
304
+ const i = parseInt(p);
305
+ if (p === String(i)) {
306
+ return receiver.element(i);
307
+ }
308
+ }
309
+ return Reflect.get(target, p, receiver);
310
+ }
311
+ });
312
+ _computedKey = Symbol.iterator;
313
+ class StructArray extends ProxiedStruct {
314
+ #struct = struct;
315
+ #length = length;
316
+ #byteStride = byteStride;
317
+ get length() {
318
+ if (typeof this.#length === "number") {
319
+ return this.#length;
320
+ }
321
+ return structDataView(this).byteLength / this.#byteStride;
322
+ }
323
+ element(i) {
324
+ const ctor = this.#struct;
325
+ return new ctor(structBytes(this, this.#byteStride * i, this.#byteStride * (i + 1)));
326
+ }
327
+ *[_computedKey]() {
328
+ for(let i = 0; i < this.length; ++i){
329
+ yield this.element(i);
330
+ }
331
+ }
332
+ }
333
+ // deno-lint-ignore no-explicit-any
334
+ return StructArray;
335
+ }
336
+ //# sourceMappingURL=mod.js.map
package/mod.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sources":["./mod.ts"],"names":[],"mappings":"AAAA;;;CAGC;AAED,MAAM,iBAAiB,OAAO,GAAG,CAAC;AAkClC;;;;CAIC,GACD,OAAO,SAAS,eAAe,MAAiB;EAC9C,MAAM,SAAS,MAAM,CAAC,eAAe;EACrC,IAAI,CAAC,CAAC,kBAAkB,QAAQ,GAAG;IACjC,MAAM,IAAI,UAAU;EACtB;EACA,OAAO,MAAM,CAAC,eAAe;AAC/B;AACA;;;;;;CAMC,GACD,SAAS,YAAY,MAAiB,EAAE,KAAc,EAAE,GAAY;EAClE,MAAM,KAAK,eAAe;EAC1B,UAAU;EACV,QAAQ,GAAG,UAAU;EACrB,QAAQ,MAAM,CAAC,SAAS;EACxB,QAAQ,MAAM,CAAC,OAAO,GAAG,UAAU;EACnC,OAAO,IAAI,WAAW,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,OAAO,MAAM;AAChE;AASA;;;;CAIC,GACD,OAAO,SAAS,aACd,WAAe;EAEf,OAAO;IACL,YAAY;IACZ;MACE,MAAM,KAAK,IAAI,CAAC,eAAe;MAC/B,OAA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