From 1d2ffd94e0743e657a54831022bc2c3ecccc6abb Mon Sep 17 00:00:00 2001 From: Jad Dayoub Date: Fri, 7 Aug 2026 14:15:18 +0200 Subject: [PATCH 1/4] Add JSROOT test for types/array --- jsroot/types/array/read.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 jsroot/types/array/read.mjs diff --git a/jsroot/types/array/read.mjs b/jsroot/types/array/read.mjs new file mode 100644 index 0000000..975d6b6 --- /dev/null +++ b/jsroot/types/array/read.mjs @@ -0,0 +1,14 @@ +import { read } from "../../jsroot_reader.mjs"; + +const fields = [ + "Array_Int32", + "Array_Array", + "Array_String", + "Array_Variant", + "Array_Vector", +]; + +const [input = "types.array.root", output = "types.array.json"] = + process.argv.slice(2); + +read(input, output, fields); From c33c51dc6d2ebb8de6d3d1f3fdc9034cb015a2de Mon Sep 17 00:00:00 2001 From: Jad Dayoub Date: Fri, 7 Aug 2026 14:15:24 +0200 Subject: [PATCH 2/4] Add JSROOT test for types/atomic --- jsroot/types/atomic/read.mjs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 jsroot/types/atomic/read.mjs diff --git a/jsroot/types/atomic/read.mjs b/jsroot/types/atomic/read.mjs new file mode 100644 index 0000000..28f37e5 --- /dev/null +++ b/jsroot/types/atomic/read.mjs @@ -0,0 +1,29 @@ +import { read, floatToHex } from "../../jsroot_reader.mjs"; + +function normalizeValue(value, { marker, field }) { + if (typeof value === "bigint") return `${marker}${value}${marker}`; + if (typeof value === "string") return value.codePointAt(0); + if (field.startsWith("Real")) return floatToHex(value, { field }); + return Number(value); +} + +const fields = [ + "Bit", + "Byte", + "Char", + "Int8", + "UInt8", + "Int16", + "UInt16", + "Int32", + "UInt32", + "Int64", + "UInt64", + "Real32", + "Real64", +]; + +const [input = "types.atomic.root", output = "types.atomic.json"] = + process.argv.slice(2); + +read(input, output, fields, normalizeValue, { marker: "__BIGINT__" }); From 1c58b8ab1c4ee6ca74c92068f92e3c0498eb5e17 Mon Sep 17 00:00:00 2001 From: Jad Dayoub Date: Fri, 7 Aug 2026 14:15:51 +0200 Subject: [PATCH 3/4] Add JSROOT test for types/bitset --- jsroot/types/bitset/read.mjs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 jsroot/types/bitset/read.mjs diff --git a/jsroot/types/bitset/read.mjs b/jsroot/types/bitset/read.mjs new file mode 100644 index 0000000..ef75196 --- /dev/null +++ b/jsroot/types/bitset/read.mjs @@ -0,0 +1,13 @@ +import { read } from "../../jsroot_reader.mjs"; + +function bitsetToBinary(val, field) { + const n = Number(field.field.replace("Bitset", "")); + return BigInt(val).toString(2).padStart(n, "0"); +} + +const fields = ["Bitset1", "Bitset64", "Bitset65"]; + +const [input = "types.bitset.root", output = "types.bitset.json"] = + process.argv.slice(2); + +read(input, output, fields, bitsetToBinary); From 8ce4bfb9debd8fd9cab4d48fa189a0818222b40b Mon Sep 17 00:00:00 2001 From: Jad Dayoub Date: Fri, 7 Aug 2026 14:15:58 +0200 Subject: [PATCH 4/4] Add JSROOT test for types/tuple --- jsroot/types/tuple/read.mjs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 jsroot/types/tuple/read.mjs diff --git a/jsroot/types/tuple/read.mjs b/jsroot/types/tuple/read.mjs new file mode 100644 index 0000000..761314d --- /dev/null +++ b/jsroot/types/tuple/read.mjs @@ -0,0 +1,19 @@ +import { read } from "../../jsroot_reader.mjs"; + +function tupleToArray(obj) { + const listEntries = []; + Object.values(obj).forEach((value) => { + if (typeof value === "object") { + value = tupleToArray(value); + } + listEntries.push(value); + }); + return listEntries; +} + +const fields = ["Int32_String_Vector", "Variant", "Tuple", "VectorTuple"]; + +const [input = "types.tuple.root", output = "types.tuple.json"] = + process.argv.slice(2); + +read(input, output, fields, tupleToArray);