Skip to content

Commit

Permalink
port to Lua; small safety catch in Perl version
Browse files Browse the repository at this point in the history
  • Loading branch information
aitap committed May 7, 2019
1 parent 567062d commit 3f69814
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions decode.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
for i = 1, #arg do
local rf = assert(arg[i])
local rfh = assert(io.open(rf, 'rb'))

local wf = rf:gsub("%.[sS][pP][dD]$", ".txt", 1)
assert(rf ~= wf)
local wfh = assert(io.open(wf, 'w'))

assert(rfh:seek("set", 1029))
for pair in rfh:lines(16) do
wl, A = string.unpack("<dd", pair)
wfh:write(wl, "\t", A, "\n")
end
end
1 change: 1 addition & 0 deletions decode.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
open my $rfh, "<:raw", $src;

(my $dest = $src) =~ s/\.spd$/.txt/;
die "$src doesn't look like spd file" if $src eq $dest;
open my $wfh, ">", $dest;

# 1024 looks like a fine header size, but there is
Expand Down

0 comments on commit 3f69814

Please sign in to comment.