Data gaps #8

Open
opened 2025-05-13 09:06:42 +00:00 by q-wertz · 3 comments

It would be nice for longer data-structures when one can omit bits that belong to the same group.

My idea would be to add e.g. gap: 10 to a range and then the middle 10 bits are skipped and "replaced" by dashed/dotted lines at top and bottom.

Would you say this is something achievable or does it require bigger changes? Are you open for PRs? (but not sure if I will be able to get it working)

I started exploring the code and thought starting with removing the bits field and autocalculate it. As far as I understand it the code relies heavily on absolute coordinates respective at least the functions to-real-i(i) and to-bit-i(real-i) need to be adjusted.

It would be nice for longer data-structures when one can omit bits that belong to the same group. My idea would be to add e.g. `gap: 10` to a range and then the middle 10 bits are skipped and "replaced" by dashed/dotted lines at top and bottom. Would you say this is something achievable or does it require bigger changes? Are you open for PRs? (but not sure if I will be able to get it working) I started exploring the code and thought starting with removing the `bits` field and autocalculate it. As far as I understand it the code relies heavily on absolute coordinates respective at least the functions `to-real-i(i)` and `to-bit-i(real-i)` need to be adjusted.
Owner

That is a great idea ! And yes I am open to PRs 👍
It's definitely something achievable, but it does indeed have some implication since - as you've mentioned - many elements are placed absolutely.
I'll also try and take a look. Feel free to ask if some parts of the code are not clear

That is a great idea ! And yes I am open to PRs 👍 It's definitely something achievable, but it does indeed have some implication since - as you've mentioned - many elements are placed absolutely. I'll also try and take a look. Feel free to ask if some parts of the code are not clear
HEL added the
enhancement
label 2025-05-13 09:34:52 +00:00
Klagarge added a new dependency 2025-05-13 10:03:12 +00:00
Klagarge removed a dependency 2025-05-13 10:03:57 +00:00
Author

One general question:

Is it ok for you, when the schema definition is changed by code or should it always stay the original one?

I'm thinking about auto-calculating a few helpernumbers (e.g. the "structure.main.bits" or a new variable "structure.main.total-gaps") and would like to know whether you are fine when I add them to the schema or whether I should use extra variables.

One general question: Is it ok for you, when the schema definition is changed by code or should it always stay the original one? I'm thinking about auto-calculating a few helpernumbers (e.g. the "structure.main.bits" or a new variable "structure.main.total-gaps") and would like to know whether you are fine when I add them to the schema or whether I should use extra variables.
Owner

It's okay for me to modify the schema internally
It is somehow already the case in structure.load for example, where some properties are extracted and formatted from the input data

src/structure.typ Lines 18 to 52 in 3e74ad15ee
#let load(id, data) = {
let struct = (id: id)
let ranges = (:)
for (range-span, range-data) in data.ranges {
let (start, end) = rng.parse-span(str(range-span))
ranges.insert(
rng.key(start, end),
rng.load(start, end, range-data)
)
}
let ranges2 = (:)
for (k, range_) in ranges {
if range_.values != none and range_.depends-on != none {
let depends-key = rng.key(..range_.depends-on)
let depends-range = ranges.at(depends-key)
let bits = rng.bits(depends-range)
let values = (:)
for (v, d) in range_.values {
v = util.z-fill(str(int(v)), bits)
values.insert(v, d)
}
range_.values = values
}
ranges2.insert(k, range_)
}
return make(
id,
int(data.bits),
ranges2,
start: data.at("start", default: 0)
)
}

It's okay for me to modify the schema internally It is somehow already the case in `structure.load` for example, where some properties are extracted and formatted from the input data https://git.kb28.ch/HEL/rivet-typst/src/commit/3e74ad15ee68885b0ac729786418de9a3d6e36e7/src/structure.typ#L18-L52
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: HEL/rivet-typst#8
No description provided.