Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions jsroot/types/array/read.mjs
Original file line number Diff line number Diff line change
@@ -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);
29 changes: 29 additions & 0 deletions jsroot/types/atomic/read.mjs
Original file line number Diff line number Diff line change
@@ -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__" });
13 changes: 13 additions & 0 deletions jsroot/types/bitset/read.mjs
Original file line number Diff line number Diff line change
@@ -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);
19 changes: 19 additions & 0 deletions jsroot/types/tuple/read.mjs
Original file line number Diff line number Diff line change
@@ -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);