rename: src/Formats -> src/Rosetta, @formats -> @rosetta requires, build/luajit/rosetta + rosetta._compat, build/roblox/Rosetta, ROSETTA_* env/globals, writer vendor strings

This commit is contained in:
4DBug committed 2026-11-01 01:19:16 -05:00
1 parent 2956576d7f
commit 22ddcd78fa
941 files changed
+3364 -3364

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@
# tests/gen/3ds_xcheck.luau { name, case? | gltf?, assimp }
import importlib.util, os
INPUTS = ["src/Formats/model/3ds", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
INPUTS = ["src/Rosetta/model/3ds", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
"tools/fixtures/_3ds_encode.luau"]
+1 -1
View File
@@ -9,7 +9,7 @@
# lib3mf / assimp / trimesh: { name, case, lib3mf, assimp, trimesh }
import importlib.util, json, os, subprocess, sys
INPUTS = ["src/Formats/model/3mf", "src/Formats/codecs/text/Xml", "src/Formats/containers/Zip",
INPUTS = ["src/Rosetta/model/3mf", "src/Rosetta/codecs/text/Xml", "src/Rosetta/containers/Zip",
"tools/fixtures/_3mf_reference.py", "tools/fixtures/_3mf_encode.luau", "tools/fixtures/_model_ref.py"]
MAX_SIZE = 500_000
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_3ds_encode: run by tools/fixtures/3ds.py (luau CLI, repo root): decodes every 3DS case and every
-- glTF sample model with our readers and writes them with our 3DS writer, printing "<file>\t<hex>" lines for assimp
-- to read back. Files: case_<i>.3ds, gltf_<i>.3ds.
local ThreeDs = require("@formats/model/3ds")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local ThreeDs = require("@rosetta/model/3ds")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/3ds_cases")
local Picks = require("@tests/gen/3ds_gltf")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_3mf_encode: run by tools/fixtures/3mf.py (luau CLI, repo root): decodes every 3MF case that lib3mf
-- reads with our reader and encodes it with our writer, printing "rt_<case>.3mf\t<hex>" lines for the reference tools
-- (lib3mf, assimp, trimesh) to read back.
local ThreeMf = require("@formats/model/3mf")
local Bytes = require("@formats/core/Bytes")
local ThreeMf = require("@rosetta/model/3mf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/3mf_cases")
local HEX = {}
+1 -1
View File
@@ -130,7 +130,7 @@ def psx_encode(samples, loop=None):
return bytes(out)
def vag(samples, rate, name=b"formats-luau", loop=None):
def vag(samples, rate, name=b"rosetta", loop=None):
data = psx_encode(s16(samples), loop)
head = b"VAGp" + struct.pack(">IIII", 0x20, 0, len(data), rate) + b"\0" * 12 + name[:16].ljust(16, b"\0")
return head + data
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_arch2_ours.luau: our archive writers' output for the reference tools to read (run by the ws-arch2
-- fixture generators through `luau tools/fixtures/_arch2_ours.luau -a <format> [<options as k=v,k=v>]`). Writes the
-- standard file set (the same names and bytes as _arch2.FILES) with the format's encoder and prints the file as hex.
local F = require("@formats")
local F = require("@rosetta")
local which, optstr = ...
local function content(n: number, seed: number): buffer
+6 -6
View File
@@ -218,13 +218,13 @@ def emit_signal(ctx, name, samples, rate, ch):
def encode_luau(ctx, module, sigmod, opts_lua="nil", source="audio"):
"""encode the emitted signal module `sigmod` with require("@formats/<module>").encode(audio, opts) in Luau; returns
"""encode the emitted signal module `sigmod` with require("@rosetta/<module>").encode(audio, opts) in Luau; returns
the encoded bytes. source = "decoder" feeds a streaming Decoder (codecs/audio/Pcm.audioDecoder) instead of the Audio."""
code = """
local S = require("@tests/gen/%s")
local Types = require("@formats/Types")
local Pcm = require("@formats/codecs/audio/Pcm")
local M = require("@formats/%s")
local Types = require("@rosetta/Types")
local Pcm = require("@rosetta/codecs/audio/Pcm")
local M = require("@rosetta/%s")
local a = Types.Audio.new(S.rate, S.channels, S.frames)
buffer.writestring(a.samples, 0, S.data)
local src: any = a
@@ -297,8 +297,8 @@ def encode_luau_many(ctx, module, jobs, sigmod):
-> [bytes]: one Luau run encodes them all (length-prefixed on stdout)"""
body = ['job("%s", %s)' % (name, opts) for name, opts in jobs]
code = """
local Types = require("@formats/Types")
local M = require("@formats/%s")
local Types = require("@rosetta/Types")
local M = require("@rosetta/%s")
local S = require("@tests/gen/%s")
local outs = {}
local function job(name, opts)
+3 -3
View File
@@ -2,9 +2,9 @@
-- tools/fixtures/bitmapfonts.py / psf.py after they wrote the source fonts to tests/gen/<src>.luau:
-- `luau _bitmapfonts_ours.luau -a <src> <format> [version]`): decodes each source font with its format, encodes it
-- with <format> (default bdf) and prints "<case> <hex>" lines.
local F = require("@formats")
local Bytes = require("@formats/core/Bytes")
local Deflate = require("@formats/codecs/compress/Deflate")
local F = require("@rosetta")
local Bytes = require("@rosetta/core/Bytes")
local Deflate = require("@rosetta/codecs/compress/Deflate")
local srcName, outFormat, version = ...
local Src = if srcName == "psf_src" then require("@tests/gen/psf_src") else require("@tests/gen/bitmapfonts_src")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_dae_encode: run by tools/fixtures/dae.py (luau CLI, repo root): decodes every Collada case with our
-- reader and encodes it with our writer (rt_<case>.dae + its image files, and rt_<case>.zae for the first cases),
-- printing "<file>\t<hex>" lines for assimp to read back.
local Dae = require("@formats/model/dae")
local Bytes = require("@formats/core/Bytes")
local Dae = require("@rosetta/model/dae")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/dae_cases")
local HEX = {}
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_fbx_encode: run by tools/fixtures/fbx.py (luau CLI, repo root): decodes every FBX case with our
-- reader and writes it back with our writer (binary 7.4, and ASCII for every third case), printing "<file>\t<hex>"
-- lines for assimp and Blender to read back. Files: rt_<case>.fbx (binary), rt_<case>.a.fbx (ASCII).
local Fbx = require("@formats/model/fbx")
local Bytes = require("@formats/core/Bytes")
local Fbx = require("@rosetta/model/fbx")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/fbx_cases")
local HEX = {}
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_flv_encode: run by tools/fixtures/flv.py (luau, from the repo root) so ffprobe / ffmpeg can check our
-- FLV writer: remuxes FLV fixtures (tests/gen/flv_cases) and the MP4 / Matroska / MPEG-TS sources (tests/gen/flv_src)
-- and prints "<name> <source> <hex>" lines (or "<name> <source> ERR <message>").
local F = require("@formats")
local F = require("@rosetta")
local Cases = require("@tests/gen/flv_cases")
local Src = require("@tests/gen/flv_src")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_gltf_encode: run by tools/fixtures/gltf.py (luau CLI, repo root): decodes every glTF case with our
-- reader and encodes it with our writer as .glb and as .gltf with an external .bin and image files, printing
-- "<file>\t<hex>" lines for the reference tools (assimp, trimesh) to read back. Files: rt_<case>.glb, rt_<case>.gltf.
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/gltf_cases")
local HEX = {}
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_iqm_encode: run by tools/fixtures/iqm.py (luau CLI, repo root): writes mrfixit.iqm back through our
-- reader and writer, and every glTF pick through our writer, printing "<file>\t<hex>" lines for assimp and the
-- Python IQM reader. Files: rt_mrfixit.iqm, gltf_<name>.iqm.
local Iqm = require("@formats/model/iqm")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Iqm = require("@rosetta/model/iqm")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/iqm_cases")
local Picks = require("@tests/gen/iqm_gltf")
+1 -1
View File
@@ -1,6 +1,6 @@
-- tools/fixtures/_lz4_encode.luau: run by tools/fixtures/lz4.py under the luau CLI: compresses every corpus of
-- tests/gen/lz4_corpora with codecs/compress/Lz4 and prints "<name> <hex>" lines for the reference to decompress.
local Lz4 = require("@formats/codecs/compress/Lz4")
local Lz4 = require("@rosetta/codecs/compress/Lz4")
local C = require("@tests/gen/lz4_corpora")
for name, data in C do
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_lz4frame_encode.luau: run by tools/fixtures/lz4frame.py under the luau CLI: writes every corpus of
-- tests/gen/lz4frame_corpora as LZ4 frames with archive/lz4 (several option sets) and prints "<name> <hex>" lines for
-- the lz4 tool to decompress.
local Lz4F = require("@formats/archive/lz4")
local Lz4F = require("@rosetta/archive/lz4")
local C = require("@tests/gen/lz4frame_corpora")
local sets = {
+2 -2
View File
@@ -2,8 +2,8 @@
-- our writers: encodes the test signal (tests/audio/_signal) to ALAC M4A (audio/m4a) and ALAC / PCM CAF (audio/caf)
-- and prints "<name> <hex>" lines. The tests re-encode and compare the CRC with the file ffmpeg validated.
local Signal = require("@tests/audio/_signal")
local M4a = require("@formats/audio/m4a")
local Caf = require("@formats/audio/caf")
local M4a = require("@rosetta/audio/m4a")
local Caf = require("@rosetta/audio/caf")
local function hex(b: buffer): string
local t = table.create(buffer.len(b))
+2 -2
View File
@@ -1,14 +1,14 @@
# MIDI reference cases (run by tools/fixtures/midi.py through ctx.python(["mido"], ...); not a generator itself).
# Builds Standard MIDI Files with python mido (formats 0 / 1 / 2, tempo changes, time / key signatures, running
# status, sysex, pitch bend, every channel message, a random stress file), saves them with mido, and prints JSON:
# per file the bytes, mido's parse in formats-luau's event shape and mido's lengths / message times.
# per file the bytes, mido's parse in rosetta's event shape and mido's lengths / message times.
import io, json, random, sys
import mido
from mido import Message, MetaMessage, MidiFile, MidiTrack
def ours(msg):
"""a mido message -> [type, channel, data, meta] in formats-luau's shape (data = raw bytes)"""
"""a mido message -> [type, channel, data, meta] in rosetta's shape (data = raw bytes)"""
t = msg.type
if msg.is_meta:
b = msg.bytes()
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_ms3d_encode: run by tools/fixtures/ms3d.py (luau CLI, repo root): decodes every MS3D case and every
-- glTF sample model with our readers and writes them with our MS3D writer, printing "<file>\t<hex>" lines for assimp
-- to read back. Files: case_<i>.ms3d, gltf_<i>.ms3d.
local Ms3d = require("@formats/model/ms3d")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Ms3d = require("@rosetta/model/ms3d")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/ms3d_cases")
local Picks = require("@tests/gen/ms3d_gltf")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_obj_encode: run by tools/fixtures/obj.py (luau CLI, repo root): decodes every OBJ case with our
-- reader, encodes it again with our writer and prints "<file>\t<hex>" lines (the OBJ, its .mtl, textures) for the
-- reference tools (assimp, trimesh) to read back.
local Obj = require("@formats/model/obj")
local Bytes = require("@formats/core/Bytes")
local Obj = require("@rosetta/model/obj")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/obj_cases")
local HEX = {}
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_off_encode.luau: run by tools/fixtures/off.py under the luau CLI (no file I/O): encodes the scenes of
-- tests/gen/off_scenes with each listed option set ("default" = {}, "plain" = no colours / normals / texcoords) and
-- prints "<scene>/<encoding> <hex>" lines, which the fixture step hands to trimesh, assimp and its own reader.
local Off = require("@formats/model/off")
local Types = require("@formats/Types")
local Off = require("@rosetta/model/off")
local Types = require("@rosetta/Types")
local Scenes = require("@tests/gen/off_scenes")
local function build(spec: any): Types.Scene
+1 -1
View File
@@ -1,6 +1,6 @@
-- tools/fixtures/_opus_encode: run by tools/fixtures/opus_celt.py (luau, from the repo root): encodes
-- tests/audio/_opus_cases with audio/opus's CELT encoder and prints "<name> <hex>" lines for opusdec / ffmpeg.
local Opus = require("@formats/audio/opus")
local Opus = require("@rosetta/audio/opus")
local Cases = require("@tests/audio/_opus_cases")
for _, c in Cases.list do
+8 -8
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_ours.luau: our encoders' output for the reference tools to read (run by tools/fixtures/*.py through
-- `luau tools/fixtures/_ours.luau -a <format>`). Prints one JSON object: { "data": hex of the encoded file, ... the
-- facts the python side checks the reference's reading against }.
local Types = require("@formats/Types")
local Crc32 = require("@formats/core/Crc32")
local LayerOps = require("@formats/ops/LayerOps")
local Types = require("@rosetta/Types")
local Crc32 = require("@rosetta/core/Crc32")
local LayerOps = require("@rosetta/ops/LayerOps")
local function hex(b: buffer): string
local t = table.create(buffer.len(b))
@@ -145,7 +145,7 @@ end
local which, arg = ...
if which == "psd" then
local Psd = require("@formats/layered/psd")
local Psd = require("@rosetta/layered/psd")
local doc = psdDoc()
local data = Psd.encode(doc) :: buffer
local flat = LayerOps.flatten(doc) :: Types.Image
@@ -156,7 +156,7 @@ if which == "psd" then
end
print(json({ data = hex(data), composite = Crc32.of(flat.pixels), layers = layers }))
elseif which == "aseprite" then
local Ase = require("@formats/layered/aseprite")
local Ase = require("@rosetta/layered/aseprite")
local doc = aseDoc()
local data = Ase.encode(doc) :: buffer
local frames = {}
@@ -165,15 +165,15 @@ elseif which == "aseprite" then
end
print(json({ data = hex(data), nframes = 3, frames = frames }))
elseif which == "tiled" then
local Tiled = require("@formats/vector/tiled")
local Tiled = require("@rosetta/vector/tiled")
local m = tiledMap()
local tmx = Tiled.encode(m, { format = "tmx" }) :: buffer
local tmj = Tiled.encode(m, { format = "tmj" }) :: buffer
print(json({ tmx = hex(tmx), tmj = hex(tmj) }))
elseif which == "svg" then
-- the SVG text given on the command line, decoded and written back by our encoder
local Svg = require("@formats/vector/svg")
local Bytes = require("@formats/core/Bytes")
local Svg = require("@rosetta/vector/svg")
local Bytes = require("@rosetta/core/Bytes")
local v = Svg.decode(Bytes.reader(buffer.fromstring(arg)))
local out = if v then Svg.encode(v) else nil
print(json({ svg = if out then buffer.tostring(out) else "" }))
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_ply_encode.luau: run by tools/fixtures/ply.py under the luau CLI (no file I/O): encodes the scenes of
-- tests/gen/ply_scenes in the three encodings and prints "<scene>/<encoding> <hex>" lines, which the fixture step
-- hands to plyfile and assimp.
local Ply = require("@formats/model/ply")
local Types = require("@formats/Types")
local Ply = require("@rosetta/model/ply")
local Types = require("@rosetta/Types")
local Scenes = require("@tests/gen/ply_scenes")
local function build(spec: any): Types.Scene
+3 -3
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/qb.py helper: our model/qb encoder's output for the reference reader there. Prints "<name>\t<hex>".
local Qb = require("@formats/model/qb")
local Bytes = require("@formats/core/Bytes")
local Types = require("@formats/Types")
local Qb = require("@rosetta/model/qb")
local Bytes = require("@rosetta/core/Bytes")
local Types = require("@rosetta/Types")
local Fx = require("@tests/gen/qb")
local function hex(b: buffer): string
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_rbx_encode.luau: run by tools/fixtures/rbxmx.py under the luau CLI: decodes every file of
-- tests/gen/rbx_files (model/rbxm or model/rbxmx) and writes it back with both encoders; prints
-- "<file>/rbxm <hex>" and "<file>/rbxmx <hex>" lines for lune to read.
local Rbxm = require("@formats/model/rbxm")
local Rbxmx = require("@formats/model/rbxmx")
local Bytes = require("@formats/core/Bytes")
local Rbxm = require("@rosetta/model/rbxm")
local Rbxmx = require("@rosetta/model/rbxmx")
local Bytes = require("@rosetta/core/Bytes")
local Fx = require("@tests/gen/rbx_files")
local function hex(b: buffer): string
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_robloxmesh_encode.luau: run by tools/fixtures/robloxmesh.py under the luau CLI: decodes every case of
-- tests/gen/robloxmesh and writes it back as versions 2.00 and 4.00; prints "<case>/<version> <hex>" lines for the
-- fixture's own reader.
local RobloxMesh = require("@formats/model/robloxmesh")
local Bytes = require("@formats/core/Bytes")
local RobloxMesh = require("@rosetta/model/robloxmesh")
local Bytes = require("@rosetta/core/Bytes")
local Fx = require("@tests/gen/robloxmesh")
local function hex(b: buffer): string
+3 -3
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/schematic.py helper: our model/schematic encoder's output for the reference readers (litemapy,
-- nbtlib). Prints "<name>\t<hex>" lines. Inputs: the decoded fixtures of tests/gen/schematic, plus grids built here.
local Schematic = require("@formats/model/schematic")
local Bytes = require("@formats/core/Bytes")
local Types = require("@formats/Types")
local Schematic = require("@rosetta/model/schematic")
local Bytes = require("@rosetta/core/Bytes")
local Types = require("@rosetta/Types")
local Fx = require("@tests/gen/schematic")
local function hex(b: buffer): string
+1 -1
View File
@@ -1,5 +1,5 @@
# Audio features of a WAV on stdin (run by tools/fixtures/sf2.py through ctx.python(["numpy"], ...); not a generator).
# tests/music/sf2.luau computes the same features from formats-luau's render and compares them:
# tests/music/sf2.luau computes the same features from rosetta's render and compares them:
# env RMS of the mono mix per 50 ms window (2205 frames)
# bands per 2 s segment: mean power in 24 log-spaced bands (60 Hz .. 16 kHz) of 2048-point Hann frames (hop 1024),
# in dB
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_smd_encode.luau: run by tools/fixtures/smd.py under the luau CLI: decodes the reference SMDs of
-- tests/gen/smd_src and writes them back with our encoder (bind pose; links; and the animation as an animation SMD),
-- printing "<name>\t<hex>" lines for assimp to read back.
local Smd = require("@formats/model/smd")
local Bytes = require("@formats/core/Bytes")
local Smd = require("@rosetta/model/smd")
local Bytes = require("@rosetta/core/Bytes")
local Src = require("@tests/gen/smd_src")
local function hex(b: buffer): string
+2 -2
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_step_encode: run by tools/fixtures/step.py (luau CLI, repo root): decodes every STEP case with our
-- reader and writes it back with our writer, printing "case_<i>.step\t<hex>" lines for OCCT (through gmsh) to read.
local Step = require("@formats/cad/step")
local Bytes = require("@formats/core/Bytes")
local Step = require("@rosetta/cad/step")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/step_cases")
local HEX = {}
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_stl_encode.luau: run by tools/fixtures/stl.py under the luau CLI (no file I/O): encodes the scenes of
-- tests/gen/stl_scenes with every encoding they list and prints "<scene>/<encoding> <hex>" lines, which the fixture
-- step hands to trimesh and assimp.
local Stl = require("@formats/model/stl")
local Types = require("@formats/Types")
local Stl = require("@rosetta/model/stl")
local Types = require("@rosetta/Types")
local Scenes = require("@tests/gen/stl_scenes")
local function acc(s: string, t: string, comps: number, count: number): Types.Accessor
+13 -13
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_tex_encode.luau: our texture encoders' output for the reference tools to read (run by
-- tools/fixtures/{dds,ktx,exr}.py as `luau tools/fixtures/_tex_encode.luau -a <format>`). Prints "name\thex" lines.
-- The source images are generated here (tools/fixtures/_tex_reference.py makes the same ones: source()).
local Types = require("@formats/Types")
local Types = require("@rosetta/Types")
local which = ({ ... } :: { string })[1] or "dds"
@@ -53,7 +53,7 @@ local function emit(name: string, b: buffer?, err: any?)
end
if which == "dds" then
local Dds = require("@formats/image/dds")
local Dds = require("@rosetta/image/dds")
local img = image(37, 23, "rgba8", 0)
for _, f in { "rgba8", "bgra8", "bc1", "bc3", "bc4", "bc5" } do
emit("ours_" .. f .. ".dds", Dds.encode(img, { pixelFormat = f :: any }))
@@ -75,7 +75,7 @@ if which == "dds" then
end
if which == "ktx" then
local Ktx = require("@formats/image/ktx")
local Ktx = require("@rosetta/image/ktx")
local img = image(37, 23, "rgba8", 0)
emit("ours_rgba8.ktx2", Ktx.encode(img))
emit("ours_rgba8_mips.ktx2", Ktx.encode(img, { mips = true }))
@@ -95,7 +95,7 @@ if which == "ktx" then
end
if which == "exr" then
local Exr = require("@formats/image/exr")
local Exr = require("@rosetta/image/exr")
local f = image(37, 23, "rgbaf32", 0, 4)
for _, c in { "none", "zips", "zip" } do
emit("ours_half_" .. c .. ".exr", Exr.encode(f, { compression = c :: any }))
@@ -131,17 +131,17 @@ local function few(): Types.Image
end
local function simple(): any
if which == "pcx" then
return require("@formats/image/pcx")
return require("@rosetta/image/pcx")
elseif which == "sgi" then
return require("@formats/image/sgi")
return require("@rosetta/image/sgi")
elseif which == "sunras" then
return require("@formats/image/sunras")
return require("@rosetta/image/sunras")
elseif which == "xbm" then
return require("@formats/image/xbm")
return require("@rosetta/image/xbm")
elseif which == "xpm" then
return require("@formats/image/xpm")
return require("@rosetta/image/xpm")
elseif which == "ilbm" then
return require("@formats/image/ilbm")
return require("@rosetta/image/ilbm")
end
return nil
end
@@ -159,7 +159,7 @@ end
if which == "icns" then
-- square icons 16 / 32 / 48 / 128 as RLE entries (no encodeImage hook here)
local Icns = require("@formats/image/icns")
local Icns = require("@rosetta/image/icns")
local base = image(128, 128, "rgba8", 1)
base.frames = {}
for i, s in { 16, 32, 48, 128 } do
@@ -171,8 +171,8 @@ end
if which == "ora" then
-- a layered document: background, an offset half-opaque multiply layer, a hidden one, a group with a screen layer
local Ora = require("@formats/layered/ora")
local Png = require("@formats/image/png")
local Ora = require("@rosetta/layered/ora")
local Png = require("@rosetta/image/png")
local doc = Types.Layered.new(40, 30)
local bg = Types.Layered.layer("background", image(40, 30, "rgba8", 0))
for i = 0, 40 * 30 - 1 do
+1 -1
View File
@@ -199,7 +199,7 @@ def write_xm(title, instruments, orders, patterns, channels, speed=6, tempo=125,
loop: (start, length, type 1|2) | None}], keymap: [96 sample indexes] | None, volenv: {points, sustain, loop:
(s, e)} | None, panenv: ..., fadeout, vib: (type, sweep, depth, rate)}];
patterns: [[row: [(note, ins, vol, fx, param)] * channels]] (note 97 = key off; vol = raw volume byte)"""
out = bytearray(b"Extended Module: " + name(title, 20) + b"\x1a" + name("formats-luau fixtures", 20))
out = bytearray(b"Extended Module: " + name(title, 20) + b"\x1a" + name("rosetta fixtures", 20))
out += struct.pack("<HIHHHHHHHH", 0x0104, 276, len(orders), restart, channels, len(patterns), len(instruments),
1 if linear else 0, speed, tempo)
out += bytes(orders) + b"\0" * (256 - len(orders))
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_usda_encode: run by tools/fixtures/usda.py (luau CLI, repo root): decodes every USDA case with our
-- reader and writes it back with our writer, printing "<file>\t<hex>" lines (case_<n>.usda + the texture files it
-- references) for OpenUSD (pxr) to read back.
local Usda = require("@formats/model/usda")
local Bytes = require("@formats/core/Bytes")
local Usda = require("@rosetta/model/usda")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/usda_cases")
local HEX = {}
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_video_encode: run by tools/fixtures/videoenc.py (luau, from the repo root) so ffprobe / ffmpeg can
-- check our video writers: remuxes and re-encodes the container fixtures (tests/gen/mkv_cases, avi_cases, mp4_cases) and the
-- animated GIF of tests/gen/videoenc_src, and prints "<name> <hex>" lines (or "<name> ERR <message>").
local F = require("@formats")
local F = require("@rosetta")
local Mkv = require("@tests/gen/mkv_cases")
local Avi = require("@tests/gen/avi_cases")
local Mp4 = require("@tests/gen/mp4_cases")
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_vpk_encode.luau: run by tools/fixtures/vpk.py under the luau CLI: writes the files of
-- tests/gen/vpk_src as VPK version 1 and 2 with our encoder and prints "<name>\t<hex>" lines for Python's vpk
-- package to read back (and verify the version 2 MD5s).
local Vpk = require("@formats/archive/vpk")
local Vpk = require("@rosetta/archive/vpk")
local Src = require("@tests/gen/vpk_src")
local function hex(b: buffer): string
+4 -4
View File
@@ -1,10 +1,10 @@
-- tools/fixtures/_vrml_encode: run by tools/fixtures/vrml.py and x3d.py (luau CLI, repo root): decodes every VRML /
-- X3D case and glTF sample with our readers and writes it back with our writers, printing "<file>\t<hex>" lines for
-- VTK (.wrl) and assimp (.x3d) to read back. Files: case_<i>.wrl, gltf_<i>.wrl, xcase_<i>.x3d, xgltf_<i>.x3d.
local Vrml = require("@formats/model/vrml")
local X3d = require("@formats/model/x3d")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Vrml = require("@rosetta/model/vrml")
local X3d = require("@rosetta/model/x3d")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/vrml_cases")
local GltfCases = require("@tests/gen/vrml_gltf")
local ok, X3dCases = pcall(require, "@tests/gen/x3d_cases")
+1 -1
View File
@@ -214,7 +214,7 @@ Transform { translation 6 0 0 children Shape { geometry Extrusion {
crossSection [ 1 1, 1 -1, -1 -1, -1 1, 1 1 ] spine [ 0 0 0, 0 1 0, 1 2 0, 2 2 0 ] scale [ 1 1, 0.5 0.5, 0.5 0.5, 1 1 ] } } }
""",
"feat_scene.wrl": """#VRML V2.0 utf8
WorldInfo { title "feature scene" info [ "made for formats-luau" ] }
WorldInfo { title "feature scene" info [ "made for rosetta" ] }
DEF Cam Viewpoint { position 0 1 8 orientation 0 1 0 0.3 fieldOfView 0.9 description "front" }
DEF Sun DirectionalLight { direction 0 -1 -1 intensity 0.8 color 1 1 0.9 }
DEF Bulb PointLight { location 1 2 3 radius 10 }
+4 -4
View File
@@ -2,10 +2,10 @@
-- (tests/gen/webp_src) with image/webp at several efforts and two animations, and prints one line per file:
-- "<name> <hex>" (stills: <source>_e<effort>_<exact|loose>) or "anim<k>:<crc>,<crc>,... <hex>" with the CRC-32 of each
-- canvas the input frames composite to (image/webp/Anim.composite), for dwebp / Pillow to check.
local Webp = require("@formats/image/webp")
local Anim = require("@formats/image/webp/Anim")
local Types = require("@formats/Types")
local Crc32 = require("@formats/core/Crc32")
local Webp = require("@rosetta/image/webp")
local Anim = require("@rosetta/image/webp/Anim")
local Types = require("@rosetta/Types")
local Crc32 = require("@rosetta/core/Crc32")
local Src = require("@tests/gen/webp_src")
local HEX = {}
+2 -2
View File
@@ -18,7 +18,7 @@ _spec = importlib.util.spec_from_file_location("_audio", os.path.join(os.path.di
A = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(A)
INPUTS = ["tools/fixtures/_audio.py", "src/Formats/codecs/audio/Ac3"]
INPUTS = ["tools/fixtures/_audio.py", "src/Rosetta/codecs/audio/Ac3"]
SECONDS = 0.15
DITHERED = ("stereo_44k", "aften_5.1_blksw")
NFCHANS = [2, 1, 2, 3, 3, 4, 4, 5]
@@ -72,7 +72,7 @@ def fix_crcs(f):
def undither(ctx, data):
"""clear every dithflag (after the blksw flags at each audio block's start) and fix the CRCs"""
code = """
local Ac3 = require("@formats/codecs/audio/Ac3")
local Ac3 = require("@rosetta/codecs/audio/Ac3")
local b = buffer.fromstring(%s)
local dec = Ac3.decoder()
local o, n = 0, buffer.len(b)
+1 -1
View File
@@ -27,7 +27,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tools/fixtures/_adpcm.py", "src/Formats/codecs/audio/Adpcm", "src/Formats/audio/adpcm"]
INPUTS = ["tools/fixtures/_adpcm.py", "src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/adpcm"]
RATE = 22050
+1 -1
View File
@@ -20,7 +20,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tools/fixtures/_adpcm.py", "src/Formats/codecs/audio/Adpcm", "src/Formats/audio/adx"]
INPUTS = ["tools/fixtures/_adpcm.py", "src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/adx"]
def loops(info):
+1 -1
View File
@@ -10,7 +10,7 @@ _spec = importlib.util.spec_from_file_location("_audio", os.path.join(os.path.di
A = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(A)
INPUTS = ["src/Formats/audio/aiff", "src/Formats/codecs/audio/Pcm", "src/Formats/codecs/audio/Adpcm"]
INPUTS = ["src/Rosetta/audio/aiff", "src/Rosetta/codecs/audio/Pcm", "src/Rosetta/codecs/audio/Adpcm"]
def ff(codec, src="{in}", extra=()):
+1 -1
View File
@@ -132,6 +132,6 @@ def generate(ctx):
case("seven_frames", 3000, frames=7, ch=1)
case("odd_len", 2000, frames=300001, rate=48000, seed=7, note="300001 frames: two APE frames")
case("rate37000", 2000, rate=37000, secs=0.2)
case("tags", 2000, tags={"Title": "Lossless Tone", "Artist": "formats-luau", "Year": "2026", "Track": "3"})
case("tags", 2000, tags={"Title": "Lossless Tone", "Artist": "rosetta", "Year": "2026", "Track": "3"})
fate("fate_lucky", "luckynight-partial.ape", cut=2)
ctx.emit("ape_cases", CASES)
+1 -1
View File
@@ -8,7 +8,7 @@
# rendered by LibreSprite, with our flatten of the same frames
import json, os, shutil, struct, subprocess, tempfile, zlib
INPUTS = ["src/Formats/layered/aseprite", "src/Formats/codecs/image/Blend.luau", "tools/fixtures/_ours.luau"]
INPUTS = ["src/Rosetta/layered/aseprite", "src/Rosetta/codecs/image/Blend.luau", "tools/fixtures/_ours.luau"]
def s(text):
+1 -1
View File
@@ -10,7 +10,7 @@ _spec = importlib.util.spec_from_file_location("_audio", os.path.join(os.path.di
A = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(A)
INPUTS = ["src/Formats/audio/au", "src/Formats/codecs/audio/Pcm"]
INPUTS = ["src/Rosetta/audio/au", "src/Rosetta/codecs/audio/Pcm"]
def ff(codec, src="{in}", extra=()):
+2 -2
View File
@@ -13,8 +13,8 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_bitmapfonts_ref.py", "tools/fixtures/_bitmapfonts_ours.luau", "src/Formats/font/bdf", "src/Formats/font/pcf",
"src/Formats/font/fon"]
INPUTS = ["tools/fixtures/_bitmapfonts_ref.py", "tools/fixtures/_bitmapfonts_ours.luau", "src/Rosetta/font/bdf", "src/Rosetta/font/pcf",
"src/Rosetta/font/fon"]
CHARS = [32, 33, 48, 64, 65, 87, 103, 106, 113, 126, 0xE9, 0xF1, 0x416, 0x2588, 0x2192]
+1 -1
View File
@@ -17,7 +17,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tools/fixtures/_adpcm.py", "src/Formats/codecs/audio/Adpcm", "src/Formats/audio/brstm"]
INPUTS = ["tools/fixtures/_adpcm.py", "src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/brstm"]
def generate(ctx):
+1 -1
View File
@@ -15,7 +15,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["src/Formats/codecs/audio/Adpcm", "src/Formats/audio/caf"]
INPUTS = ["src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/caf"]
def generate(ctx):
+1 -1
View File
@@ -10,7 +10,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/archive/d64"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/archive/d64"]
PKG = ["vice"]
+1 -1
View File
@@ -8,7 +8,7 @@
# { name, case, assimp }
import importlib.util, os, re, subprocess
INPUTS = ["src/Formats/model/dae", "src/Formats/codecs/text/Xml", "tools/fixtures/_model_ref.py", "tools/fixtures/_dae_encode.luau",
INPUTS = ["src/Rosetta/model/dae", "src/Rosetta/codecs/text/Xml", "tools/fixtures/_model_ref.py", "tools/fixtures/_dae_encode.luau",
"tests/fixtures/gltf"]
+1 -1
View File
@@ -15,7 +15,7 @@ _spec = importlib.util.spec_from_file_location("_tex_reference", os.path.join(os
R = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(R)
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/dds", "src/Formats/codecs/image/Bcn", "src/Formats/codecs/image/Texture.luau"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/dds", "src/Rosetta/codecs/image/Bcn", "src/Rosetta/codecs/image/Texture.luau"]
BLOCK = {"bc1": 8, "bc2": 16, "bc3": 16, "bc4": 8, "bc5": 16, "bc6h": 16, "bc7": 16}
DXGI_BC = {70: "bc1", 71: "bc1", 72: "bc1", 73: "bc2", 74: "bc2", 75: "bc2", 76: "bc3", 77: "bc3", 78: "bc3", 79: "bc4",
+1 -1
View File
@@ -42,7 +42,7 @@ Ns 32
STEP = """ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('a point and a direction'),'2;1');
FILE_NAME('part.step','2026-10-31T12:00:00',('docs'),(''),'formats-luau docs','','');
FILE_NAME('part.step','2026-10-31T12:00:00',('docs'),(''),'rosetta docs','','');
FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));
ENDSEC;
DATA;
+1 -1
View File
@@ -32,7 +32,7 @@ def generate(ctx):
files = {}
tmp = A.tmpdir()
try:
tree = [("readme.txt", b"formats-luau retro archives\n"), ("src/main.c", b"int main(void) { return 0; }\n")]
tree = [("readme.txt", b"rosetta retro archives\n"), ("src/main.c", b"int main(void) { return 0; }\n")]
A.tree(tree, tmp)
files["notes.uu"] = A.tool(["sharutils"], ["uuencode", "readme.txt", "readme.txt"], cwd=tmp)
A.tool([], ["env", "NIXPKGS_ALLOW_UNFREE=1", "nix", "shell", "--impure", "nixpkgs#lha", "-c", "lha", "-a2o5q", "tree.lzh", "readme.txt", "src"], cwd=tmp)
+1 -1
View File
@@ -20,7 +20,7 @@ def generate(ctx):
files = {}
with tempfile.TemporaryDirectory() as d:
os.makedirs(os.path.join(d, "bin"))
for n, data in (("readme.txt", b"formats-luau cabinet\n" * 20), ("bin/tool.dll", bytes(range(256)) * 64)):
for n, data in (("readme.txt", b"rosetta cabinet\n" * 20), ("bin/tool.dll", bytes(range(256)) * 64)):
with open(os.path.join(d, n), "wb") as f:
f.write(data)
os.utime(os.path.join(d, n), (MTIME, MTIME))
+2 -2
View File
@@ -44,7 +44,7 @@ def generate(ctx):
tree = os.path.join(d, "tree")
os.makedirs(os.path.join(tree, "bin"))
with open(os.path.join(tree, "readme.txt"), "wb") as f:
f.write(b"formats-luau unix archives\n")
f.write(b"rosetta unix archives\n")
with open(os.path.join(tree, "bin", "run.sh"), "wb") as f:
f.write(b"#!/bin/sh\necho hi\n")
os.chmod(os.path.join(tree, "bin", "run.sh"), 0o755)
@@ -62,7 +62,7 @@ def generate(ctx):
t.add(os.path.join(tree, n), arcname=n)
files["src.tar.Z"] = subprocess.run(["nix", "shell", "nixpkgs#ncompress", "-c", "compress", "-c", "-f"], input=b.getvalue(),
capture_output=True, check=True).stdout
files["notes.txt.lz4"] = subprocess.run(["nix", "shell", "nixpkgs#lz4", "-c", "lz4", "-c"], input=b"formats-luau unix archives\n" * 8,
files["notes.txt.lz4"] = subprocess.run(["nix", "shell", "nixpkgs#lz4", "-c", "lz4", "-c"], input=b"rosetta unix archives\n" * 8,
capture_output=True, check=True).stdout
pkg = os.path.join(d, "pkg")
os.makedirs(os.path.join(pkg, "DEBIAN"))
+1 -1
View File
@@ -7,7 +7,7 @@ import importlib.util, io, os, plistlib, tarfile, tempfile, zipfile, datetime
INPUTS = ["tools/docs_check.py"]
MTIME = 1767225600 # 2026-01-01T00:00:00Z
README = b"formats-luau archive example\n" * 4
README = b"rosetta archive example\n" * 4
SCORES = "name,score,level\nada,1200,3\nbob,950,2\n\"lee, jr\",400,1\n"
CODE = r"""
import sys, json, msgpack, cbor2, datetime
+1 -1
View File
@@ -71,7 +71,7 @@ def generate(ctx):
wav = os.path.join(d, "tone.wav")
with open(wav, "wb") as f:
f.write(files["tone.wav"])
tags = ["-metadata", "title=Docs Tone", "-metadata", "artist=formats-luau", "-metadata", "album=Guide",
tags = ["-metadata", "title=Docs Tone", "-metadata", "artist=rosetta", "-metadata", "album=Guide",
"-metadata", "date=2026"]
for name, codec in (("tone.flac", ["-c:a", "flac"]), ("tone.mp3", ["-c:a", "libmp3lame", "-b:a", "128k"]),
("tone.ogg", ["-c:a", "libvorbis", "-q:a", "3"])):
+2 -2
View File
@@ -24,10 +24,10 @@ def generate(ctx):
wav = os.path.join(d, "tone.wav")
with open(wav, "wb") as f:
f.write(di.tone(44100, 1.0))
tags = ["-w", "Title=Docs Tone", "-w", "Artist=formats-luau"]
tags = ["-w", "Title=Docs Tone", "-w", "Artist=rosetta"]
ctx.nix("wavpack", ["wavpack", "-q", "-y", "-h"] + tags + [wav, "-o", os.path.join(d, "tone.wv")])
ctx.nix("wavpack", ["wavpack", "-q", "-y", "-b3", "-c"] + tags + [wav, "-o", os.path.join(d, "tone_hybrid.wv")])
ctx.nix("monkeys-audio", ["mac", wav, os.path.join(d, "tone.ape"), "-c2000", "-t", "Title=Docs Tone|Artist=formats-luau"])
ctx.nix("monkeys-audio", ["mac", wav, os.path.join(d, "tone.ape"), "-c2000", "-t", "Title=Docs Tone|Artist=rosetta"])
ctx.nix("ttaenc", ["ttaenc", "-e", wav, "-o", os.path.join(d, "tone.tta")])
for name in ("tone.wv", "tone_hybrid.wv", "tone_hybrid.wvc", "tone.ape", "tone.tta"):
files[name] = open(os.path.join(d, name), "rb").read()
+1 -1
View File
@@ -23,7 +23,7 @@ def generate(ctx):
with open(os.path.join(d, "tone.wav"), "wb") as f:
f.write(mpc.A.wav(st, rate, 2))
subprocess.run([os.path.join(mpc.tools(), "mpcenc"), "--silent", "--overwrite", "--quality", "4",
"--tag", "Title=Docs Tone", "--artist", "formats-luau", os.path.join(d, "tone.wav"),
"--tag", "Title=Docs Tone", "--artist", "rosetta", os.path.join(d, "tone.wav"),
os.path.join(d, "tone.mpc")], capture_output=True, check=True)
six = [0.2 * math.sin(2 * math.pi * (200 + 100 * c) * i / 48000) for i in range(24000) for c in range(6)]
with open(os.path.join(d, "six.raw"), "wb") as f:
+1 -1
View File
@@ -9,7 +9,7 @@
# tests/gen/exr_bench.luau a 512 x 256 half RGBA image in ZIP and PIZ
import os, shutil, subprocess, tempfile
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/exr"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/exr"]
WRITE = r'''
import OpenEXR, numpy as np, os, sys, json
+1 -1
View File
@@ -11,7 +11,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/containers/Fat.luau", "src/Formats/archive/fat"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/containers/Fat.luau", "src/Rosetta/archive/fat"]
PKGS = ["dosfstools", "mtools"]
+1 -1
View File
@@ -10,7 +10,7 @@
# tests/gen/fbx_gltf.luau glTF sample models (tests/fixtures/gltf) for the writer round trips: { name, data, files }
import importlib.util, json, os, shutil, subprocess
INPUTS = ["src/Formats/model/fbx", "tests/fixtures/gltf", "src/Formats/codecs/compress/Deflate", "tools/fixtures/_model_ref.py",
INPUTS = ["src/Rosetta/model/fbx", "tests/fixtures/gltf", "src/Rosetta/codecs/compress/Deflate", "tools/fixtures/_model_ref.py",
"tools/fixtures/_fbx_blender.py", "tools/fixtures/_fbx_blender_stats.py", "tools/fixtures/_fbx_encode.luau"]
+1 -1
View File
@@ -10,7 +10,7 @@ _spec = importlib.util.spec_from_file_location("_audio", os.path.join(os.path.di
A = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(A)
INPUTS = ["src/Formats/audio/flac", "src/Formats/codecs/audio/Pcm", "src/Formats/core/Md5.luau"]
INPUTS = ["src/Rosetta/audio/flac", "src/Rosetta/codecs/audio/Pcm", "src/Rosetta/core/Md5.luau"]
def pcm_bytes(samples, bits):
+1 -1
View File
@@ -12,7 +12,7 @@ _spec = importlib.util.spec_from_file_location("_video_helpers", os.path.join(os
V = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(V)
INPUTS = ["tools/fixtures/_video.py", "tools/fixtures/_flv_encode.luau", "src/Formats/video/flv", "src/Formats/codecs/video/Video"]
INPUTS = ["tools/fixtures/_video.py", "tools/fixtures/_flv_encode.luau", "src/Rosetta/video/flv", "src/Rosetta/codecs/video/Video"]
SRC = ["-f", "lavfi", "-i", "testsrc2=size=160x120:rate=12"]
+1 -1
View File
@@ -8,7 +8,7 @@
# by assimp and trimesh: { name, case, assimp, trimesh }
import importlib.util, json, os, struct
INPUTS = ["tests/fixtures/gltf", "src/Formats/model/gltf", "src/Formats/codecs/text/Json", "src/Formats/core/Base64",
INPUTS = ["tests/fixtures/gltf", "src/Rosetta/model/gltf", "src/Rosetta/codecs/text/Json", "src/Rosetta/core/Base64",
"tools/fixtures/_model_ref.py", "tools/fixtures/_gltf_encode.luau"]
+1 -1
View File
@@ -12,7 +12,7 @@ def _load(n):
return m
R, S, T = _load("_raster_ref"), _load("_simple"), _load("_tex_reference")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/icns"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/icns"]
def extract(ctx, w, name):
+1 -1
View File
@@ -13,7 +13,7 @@ def _load(n):
return m
R, S = _load("_raster_ref"), _load("_simple")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/ilbm"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/ilbm"]
def chunk(cid, data):
+1 -1
View File
@@ -8,7 +8,7 @@
# tests/gen/iqm_xcheck.luau { name, assimp, ref }
import importlib.util, os
INPUTS = ["src/Formats/model/iqm", "src/Formats/codecs/model", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
INPUTS = ["src/Rosetta/model/iqm", "src/Rosetta/codecs/model", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
"tools/fixtures/_iqm_reference.py", "tools/fixtures/_iqm_encode.luau", "tests/fixtures/gltf"]
+1 -1
View File
@@ -19,7 +19,7 @@ _spec2 = importlib.util.spec_from_file_location("_dds_fixture", os.path.join(_di
D = importlib.util.module_from_spec(_spec2)
_spec2.loader.exec_module(D)
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/ktx", "tools/fixtures/dds.py"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/ktx", "tools/fixtures/dds.py"]
def q8(v):
+1 -1
View File
@@ -258,7 +258,7 @@ TRI = """0 an uncertified triangle
# a brick: an outer box, an inner box turned inside out (INVERTNEXT), a mirrored stud box, an uncertified triangle
BRICK = """0 Test Brick 1 x 2
0 Name: testbrick.dat
0 Author: formats-luau
0 Author: rosetta
0 !LDRAW_ORG Unofficial_Part
0 BFC CERTIFY CCW
1 16 0 12 0 20 0 0 0 12 0 0 0 10 box.dat
+1 -1
View File
@@ -12,7 +12,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/archive/lha"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/archive/lha"]
DIRS = ["lharc113", "larc333", "lha213", "lha255e", "lha_amiga_122", "lha_amiga_212", "lha_os9_211c", "lha_osk_201",
"lha_unix114i", "explzh_723", "lengths", "generated/lzs", "lha_x68k_213", "lh2_222", "lhmelt_16536"]
+1 -1
View File
@@ -12,7 +12,7 @@ def module(ctx, name):
return m
INPUTS = ["src/Formats/model/lwo", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py"]
INPUTS = ["src/Rosetta/model/lwo", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py"]
def generate(ctx):
+1 -1
View File
@@ -5,7 +5,7 @@
# tests/gen/lz4_bench.luau { size, crc, data (lz4 HC 9 block), raw }
import json, os, random, shutil, subprocess, zlib
INPUTS = ["src/Formats/codecs/compress/Lz4.luau", "tools/fixtures/_lz4_encode.luau"]
INPUTS = ["src/Rosetta/codecs/compress/Lz4.luau", "tools/fixtures/_lz4_encode.luau"]
REF = r"""
import json, sys, lz4.block
+1 -1
View File
@@ -6,7 +6,7 @@
# tests/gen/lz4frame_corpora.luau { [name] = bytes }
import os, shutil, struct, subprocess, tempfile
INPUTS = ["src/Formats/archive/lz4/init.luau", "src/Formats/codecs/compress/Lz4.luau", "src/Formats/codecs/compress/Xxh32.luau",
INPUTS = ["src/Rosetta/archive/lz4/init.luau", "src/Rosetta/codecs/compress/Lz4.luau", "src/Rosetta/codecs/compress/Xxh32.luau",
"tools/fixtures/_lz4frame_encode.luau"]
+1 -1
View File
@@ -16,7 +16,7 @@ _sig = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_sig)
signal, pack, wav = _sig.signal, _sig.pack, _sig.wav
INPUTS = ["src/Formats/audio/m4a", "src/Formats/audio/caf", "src/Formats/codecs/audio/Alac", "src/Formats/containers/IsoBmff",
INPUTS = ["src/Rosetta/audio/m4a", "src/Rosetta/audio/caf", "src/Rosetta/codecs/audio/Alac", "src/Rosetta/containers/IsoBmff",
"tests/audio/_signal.luau", "tests/audio/_encode_cases.luau", "tools/fixtures/_m4a_encode.luau",
"tools/fixtures/_m4a_signal.py"]
PKGS = ["ffmpeg", "fdk-aac-encoder", "gpac"]
+2 -2
View File
@@ -12,8 +12,8 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/archive/binhex",
"src/Formats/archive/macbinary", "src/Formats/archive/applesingle", "src/Formats/containers/MacFile.luau"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/archive/binhex",
"src/Rosetta/archive/macbinary", "src/Rosetta/archive/applesingle", "src/Rosetta/containers/MacFile.luau"]
PKGS = ["hfsutils", "unar"]
MAC_EPOCH = 2082844800
+1 -1
View File
@@ -11,7 +11,7 @@ _spec = importlib.util.spec_from_file_location("_audio", os.path.join(os.path.di
A = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(A)
INPUTS = ["src/Formats/audio/mp3", "src/Formats/codecs/audio/Pcm"]
INPUTS = ["src/Rosetta/audio/mp3", "src/Rosetta/codecs/audio/Pcm"]
def generate(ctx):
+1 -1
View File
@@ -9,7 +9,7 @@
# tests/gen/ms3d_xcheck.luau { name, case? | gltf?, assimp }
import importlib.util, os
INPUTS = ["src/Formats/model/ms3d", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
INPUTS = ["src/Rosetta/model/ms3d", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
"tools/fixtures/3ds.py", "tools/fixtures/_ms3d_encode.luau"]
+1 -1
View File
@@ -7,7 +7,7 @@
# and trimesh: { name, assimp, trimesh, want = the original's values }
import importlib.util, math, os, struct
INPUTS = ["src/Formats/model/obj", "tools/fixtures/_model_ref.py", "tools/fixtures/_obj_encode.luau"]
INPUTS = ["src/Rosetta/model/obj", "tools/fixtures/_model_ref.py", "tools/fixtures/_obj_encode.luau"]
def ref_module(ctx):
+1 -1
View File
@@ -9,7 +9,7 @@
# trimesh, assimp and a small reader here, as verdicts
import json, math, os, shutil, struct, subprocess, tempfile, zlib
INPUTS = ["src/Formats/model/off", "tools/fixtures/_off_reference.py", "tools/fixtures/_off_encode.luau"]
INPUTS = ["src/Rosetta/model/off", "tools/fixtures/_off_reference.py", "tools/fixtures/_off_encode.luau"]
def f32(x):
+1 -1
View File
@@ -5,7 +5,7 @@
# ffmpeg (decoded), ffmpegFrames, comments (opusinfo's user comments) } }
import os, re, shutil, subprocess, tempfile, zlib
INPUTS = ["src/Formats/audio/opus", "src/Formats/codecs/audio/Mdct", "src/Formats/containers/Ogg",
INPUTS = ["src/Rosetta/audio/opus", "src/Rosetta/codecs/audio/Mdct", "src/Rosetta/containers/Ogg",
"tests/audio/_opus_cases.luau", "tools/fixtures/_opus_encode.luau"]
+1 -1
View File
@@ -14,7 +14,7 @@ def _load(n):
return m
R, S, T = _load("_raster_ref"), _load("_simple"), _load("_tex_reference")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/layered/ora"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/layered/ora"]
OPS = {"svg:src-over": "normal", "svg:multiply": "multiply", "svg:screen": "screen", "svg:overlay": "overlay", "svg:color-dodge": "colorDodge"}
+1 -1
View File
@@ -8,7 +8,7 @@ _spec = importlib.util.spec_from_file_location("_raster_ref", os.path.join(os.pa
R = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(R)
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/pcx"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/pcx"]
def ours(ctx, which):
+1 -1
View File
@@ -11,7 +11,7 @@
# plyfile and assimp, as verdicts
import json, math, os, shutil, struct, subprocess, tempfile
INPUTS = ["src/Formats/model/ply", "tools/fixtures/_ply_reference.py", "tools/fixtures/_ply_encode.luau"]
INPUTS = ["src/Rosetta/model/ply", "tools/fixtures/_ply_reference.py", "tools/fixtures/_ply_encode.luau"]
def f32(x):
+1 -1
View File
@@ -64,7 +64,7 @@ def encode(w, h, ct, depth, px, interlace, rng, plte=None, trns=None, filters=No
prev = row
z = zlib.compress(bytes(raw), level)
out = b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", w, h, depth, ct, 0, 0, interlace))
out += chunk(b"tEXt", b"Comment\0made by formats-luau tools/fixtures/png.py")
out += chunk(b"tEXt", b"Comment\0made by rosetta tools/fixtures/png.py")
if plte:
out += chunk(b"PLTE", b"".join(bytes(c[:3]) for c in plte))
if trns is not None:
+1 -1
View File
@@ -8,7 +8,7 @@
# luau) read by psd-tools, compared with the layers and the flattened image we wrote.
import json, os, random, shutil, struct, subprocess, tempfile, zlib
INPUTS = ["src/Formats/layered/psd", "src/Formats/codecs/image/Blend.luau", "src/Formats/ops/LayerOps.luau", "tools/fixtures/_ours.luau"]
INPUTS = ["src/Rosetta/layered/psd", "src/Rosetta/codecs/image/Blend.luau", "src/Rosetta/ops/LayerOps.luau", "tools/fixtures/_ours.luau"]
BLEND = ["norm", "diss", "dark", "mul ", "idiv", "lbrn", "dkCl", "lite", "scrn", "div ", "lddg", "lgCl", "over", "sLit",
"hLit", "vLit", "lLit", "pLit", "hMix", "diff", "smud", "fsub", "fdiv", "hue ", "sat ", "colr", "lum "]
+1 -1
View File
@@ -11,7 +11,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_bitmapfonts_ours.luau", "src/Formats/font/psf"]
INPUTS = ["tools/fixtures/_bitmapfonts_ours.luau", "src/Rosetta/font/psf"]
def store(pkg):
+1 -1
View File
@@ -7,7 +7,7 @@
# ours = { [name] = { same fields as cases } } }
import importlib.util, os, pickle, struct, subprocess, zlib, random
INPUTS = ["src/Formats/model/qb", "tools/fixtures/_qb_encode.luau"]
INPUTS = ["src/Rosetta/model/qb", "tools/fixtures/_qb_encode.luau"]
_spec = importlib.util.spec_from_file_location("_model_ref", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_model_ref.py"))
R = importlib.util.module_from_spec(_spec)
+1 -1
View File
@@ -18,7 +18,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tests/fixtures/qoa", "src/Formats/codecs/audio/Qoa"]
INPUTS = ["tests/fixtures/qoa", "src/Rosetta/codecs/audio/Qoa"]
def generate(ctx):
+1 -1
View File
@@ -15,7 +15,7 @@
import json, math, os, random, shutil, struct, subprocess, tempfile
import xml.etree.ElementTree as ET
INPUTS = ["src/Formats/model/rbxm", "src/Formats/model/rbxmx", "src/Formats/codecs/model/Rbx", "tools/fixtures/_rbx_encode.luau"]
INPUTS = ["src/Rosetta/model/rbxm", "src/Rosetta/model/rbxmx", "src/Rosetta/codecs/model/Rbx", "tools/fixtures/_rbx_encode.luau"]
# ---------------------------------------------------------------------------------------------------- rojo projects
def cframe(pos, rows):
+1 -1
View File
@@ -9,7 +9,7 @@
# unsupported? } }, ours = { { name, ok, detail } } }
import json, math, os, random, shutil, struct, subprocess, zlib
INPUTS = ["src/Formats/model/robloxmesh", "tools/fixtures/_robloxmesh_encode.luau"]
INPUTS = ["src/Rosetta/model/robloxmesh", "tools/fixtures/_robloxmesh_encode.luau"]
def f32(x):
+2 -2
View File
@@ -10,7 +10,7 @@
# (tools/fixtures/_schematic_encode.luau) read back by litemapy / nbtlib
import importlib.util, os, pickle, subprocess, sys
INPUTS = ["src/Formats/model/schematic", "src/Formats/codecs/model/Minecraft", "src/Formats/codecs/text/Nbt", "tools/fixtures/_schematic_encode.luau"]
INPUTS = ["src/Rosetta/model/schematic", "src/Rosetta/codecs/model/Minecraft", "src/Rosetta/codecs/text/Nbt", "tools/fixtures/_schematic_encode.luau"]
_spec = importlib.util.spec_from_file_location("_model_ref", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_model_ref.py"))
R = importlib.util.module_from_spec(_spec)
@@ -92,7 +92,7 @@ tmp = tempfile.mkdtemp()
main = Region(0, 0, 0, 6, 5, 4); fill(main, STATES)
neg = Region(10, 2, -3, -4, 3, -5); fill(neg, STATES[:6])
big = Region(-20, 0, 0, 7, 3, 5); fill(big, BIG)
sch = Schematic(name="Test", author="formats-luau", description="fixture", regions={"main": main, "neg": neg, "big": big})
sch = Schematic(name="Test", author="rosetta", description="fixture", regions={"main": main, "neg": neg, "big": big})
path = os.path.join(tmp, "t.litematic")
sch.save(path)
f = nbtlib.load(path)
+2 -2
View File
@@ -78,7 +78,7 @@ def build_sf2(with24):
if len(pcm24) % 2:
pcm24 += b"\x00"
info = lst(b"INFO", [chunk(b"ifil", struct.pack("<HH", 2, 4)), chunk(b"isng", zstr("EMU8000")),
chunk(b"INAM", zstr("formats-luau test bank")), chunk(b"ICMT", zstr("generated by tools/fixtures/sf2.py"))])
chunk(b"INAM", zstr("rosetta test bank")), chunk(b"ICMT", zstr("generated by tools/fixtures/sf2.py"))])
sd = [chunk(b"smpl", bytes(pcm))] + ([chunk(b"sm24", bytes(pcm24))] if with24 else [])
sdta = lst(b"sdta", sd)
@@ -143,7 +143,7 @@ def build_sf2(with24):
"samples": [{"name": h[0], "start": h[1], "stop": h[2], "loopStart": h[3], "loopEnd": h[4], "sampleRate": h[5],
"originalPitch": h[6], "pitchCorrection": h[7]} for h in headers],
"instruments": [n for n, _ in insts],
"info": {"name": "formats-luau test bank", "engine": "EMU8000", "version": "2.04"},
"info": {"name": "rosetta test bank", "engine": "EMU8000", "version": "2.04"},
# a few raw sample values (16-bit and 24-bit) for the sample decoding check
"values": [[i, struct.unpack_from("<h", pcm, i * 2)[0], pcm24[i]] for i in (0, 1, 25, 77, 5000 + 46 + 13, 20000)],
}
+1 -1
View File
@@ -11,7 +11,7 @@ def _load(n):
return m
R, S = _load("_raster_ref"), _load("_simple")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/sgi"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/sgi"]
def generate(ctx):
+1 -1
View File
@@ -7,7 +7,7 @@
# tests/gen/smd.luau { cases = { { name, data, bones, frames, tris, materials, verts, assimp } }, ours = { [name] = assimp info } }
import importlib.util, json, math, os, shutil, struct, subprocess, tempfile
INPUTS = ["tools/fixtures/_quake_ref.py", "tools/fixtures/_smd_encode.luau", "src/Formats/model/smd"]
INPUTS = ["tools/fixtures/_quake_ref.py", "tools/fixtures/_smd_encode.luau", "src/Rosetta/model/smd"]
def mod(ctx, name):
+1 -1
View File
@@ -10,7 +10,7 @@
# tests/gen/.luaurc alias "brep" (only when ~/dev/luau/brep-luau, or $BREP_LUAU, exists; luau CLI only)
import json, os, re, shutil, subprocess, tempfile, urllib.request
INPUTS = ["src/Formats/cad/step", "tools/fixtures/_step_encode.luau"]
INPUTS = ["src/Rosetta/cad/step", "tools/fixtures/_step_encode.luau"]
GEO = {
"plate": """Box(1) = {0,0,0, 40,30,5};
+1 -1
View File
@@ -11,7 +11,7 @@
# assimp, as verdicts
import json, math, os, shutil, struct, subprocess, tempfile, zlib
INPUTS = ["src/Formats/model/stl", "tools/fixtures/_stl_reference.py", "tools/fixtures/_stl_encode.luau"]
INPUTS = ["src/Rosetta/model/stl", "tools/fixtures/_stl_reference.py", "tools/fixtures/_stl_encode.luau"]
def f32(x):
+1 -1
View File
@@ -11,7 +11,7 @@ def _load(n):
return m
R, S = _load("_raster_ref"), _load("_simple")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/sunras"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/sunras"]
def generate(ctx):
+1 -1
View File
@@ -5,7 +5,7 @@
# (resvg's RGBA of our SVG) } } }
import json, os, shutil, subprocess, tempfile
INPUTS = ["src/Formats/vector/svg", "tools/fixtures/_ours.luau"]
INPUTS = ["src/Rosetta/vector/svg", "tools/fixtures/_ours.luau"]
def svg(w, h, body, extra=""):
return '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="%d" height="%d"%s>\n%s\n</svg>\n' % (w, h, extra, body)
Loaded 100 of 941 files, more files were not shown because too many files have changed in this diff. Show more