Skip to content

Add STC - #10

Merged
timj merged 10 commits into
u/timj/phase7-regionsfrom
u/timj/phase8-stc
Dec 3, 2026
Merged

timj merged 10 commits into
u/timj/phase7-regionsfrom
u/timj/phase8-stc

Conversation

@timj

@timj timj commented Nov 20, 2026

Copy link
Copy Markdown
Member

No description provided.

@timj
timj added this pull request to stack #4 November 20, 2026 05:16
timj and others added 10 commits December 3, 2026 09:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Add C's astRemoveRegions as a package-private removeRegions() on Mapping
(mapping.c: the Mapping itself), overridden in Region (a copy of the
current Frame), Frame (narrowed return type), CmpMap, TranMap, RateMap,
SwitchMap, CmpFrame and FrameSet, each following its C file's
RemoveRegions, with unchanged components shared as C's clones are.

Convert the remove_regions oracle (9 of 11 cases; the NormMap cases are
skipped) and add remove_regions_extra_probe.c for the nesting it does not
cover; translate remove_regions_from_frameset,
remove_regions_unit_passthrough and check_remove_regions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Port jniast's SelectorMap from selectormap.c, with Rust selectormap.rs as
the guide: copies of the Regions, C's Transform (each Region negated and
its Closed reversed in place, both put back and so left set), Equal
(Invert not compared), MapMerge (a simplified Region found by identity;
the neighbour inverted, compared with Equal and inverted back), Copy, Dump
(later Regions written without their Frame) and the loader (later Regions
given the first Region's FrameSet), with C's constructor messages.

selectormap_probe.c pins the indices for overlapping, negated, unbounded
and open Regions, the dump after a transformation, simplification, the
pairs in series (two equal 1-D SelectorMaps both forward merge into a
UnitMap in C), the loads and the constructor's errors. Translate
test_selectormap.rs, the SelectorMap tests of test_switchmap.rs
(testswitchmap.c section 3 included), the SelectorMap cases of the equal,
rate and object ID oracles, a_selectormap_needs_regions_in_one_frame,
jniast's AstTest.testSwitchMap and the two SelectorMap cases of
remove_regions_extra_probe.c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Remove from the deferred lists the entries whose only missing class was
SelectorMap: 10 each of full-dumps, read-warnings and serialisation, 8 each
of simplify and simplify-cases, and the 25 Rust tests now translated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
region.c's Dump writes Negate, Fill, MeshSz, Closed and Adapt from the
Region class's own fields where they are set, through its static Test
and Get functions, and asks the class's accessor only for an unset
value. Region.dump now does the same, so a PointList with Closed set
writes the value set rather than the opposite of Negated, and a class
that reads these attributes from elsewhere writes its own settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Port stc.c and stcresourceprofile.c with Rust's stc.rs as the guide:
an abstract Stc that encapsulates a copy of a Region (or, given an Stc,
its encapsulated Region mapped into the Frame it represents), forwards
its geometry, Negated, Closed, MeshSize and FillFactor to it, holds
copies of its AstroCoords KeyMaps mapped into its Frame, and dumps,
loads, copies, compares and simplifies as C's does; jniast's plain
AstroCoords class and its package-private converters; and
StcResourceProfile.

As C's Transform and GetBounded do, an Stc sets its encapsulated
Region's Negated to the value it has around the call, leaving it set.
A dump without the Region or a Coord<n> item, where C stores a null and
crashes later, and a "Begin Stc" of the abstract class, which C reads,
are AST__LDERR.

The region_stc oracle runs its StcResourceProfile cases; the fitted
Error Ellipse's axis ends are left out of the comparison and its
half-lengths compared instead. stc_probe.c pins the rest against C.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Remove from the deferred lists the entries whose only missing class was
StcResourceProfile: cap_timemap_02 from full-dumps, read-warnings,
serialisation and simplify (2 each) and simplify-cases (1); and the
three Rust tests of test_region_stc_oracle.rs now translated in full.
stc_matches_c, whose StcResourceProfile cases now run, stays listed for
the other Stc classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
StcSearchLocation, StcCatalogEntryLocation and StcObsDataLocation,
with StcObsDataLocation's observatory position (written as ObsLoc only
when present, copied in a copy, shared by the package-private setObs,
not compared). Region.cast copies a Region into the class of any
Region it is an instance of. RegionStcOracleTest runs every oracle
case, the Full = 1 dumps and C's dumps read back; stc_probe gains
checkStcObsDump, the observatory position and Stcs of different
classes; jniast's StcTest.testConstructors is translated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
docs/c-library-bugs.md lists the bugs found while porting that are still
present at the pinned C (3d3f255f) and at the tip of PR #104 (1d0714fb),
each with its C location at both, what happens, the consequence for a
caller, what Java does and a reproducer in docs/c-library-bugs/, which
build.sh compiles with ASan and UBSan against a C build.

rust-c-differences.md now says which PR #104 commits fix the PermMap and
CmpMap simplification bugs, the phase 7 and 8 reports point at the new
file, and CLAUDE.md says where a C library bug goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DidLSPfwbAELCxqtcAbPhR
@timj
timj force-pushed the u/timj/phase8-stc branch from 8ae43ff to aaccb32 Compare December 3, 2026 17:26
@timj
timj merged commit ea94bcc into main Dec 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant