mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-07-06 17:40:24 +02:00
Add FPGA strings for translation
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
local S = minetest.get_translator("mesecons_fpga")
|
||||
|
||||
local lg = {}
|
||||
|
||||
-- (de)serialize
|
||||
@ -111,34 +113,34 @@ lg.validate_single = function(t, i)
|
||||
local elem = t[i]
|
||||
-- check for completeness
|
||||
if elem.action == nil then
|
||||
return {i = i, msg = "Gate type required"}
|
||||
return {i = i, msg = S("Gate type required")}
|
||||
elseif elem.action == "not" or elem.action == "buf" then
|
||||
if elem.op1 ~= nil or elem.op2 == nil or elem.dst == nil then
|
||||
return {i = i, msg = "Second operand (only) and destination required"}
|
||||
return {i = i, msg = S("Second operand (only) and destination required")}
|
||||
end
|
||||
else
|
||||
if elem.op1 == nil or elem.op2 == nil or elem.dst == nil then
|
||||
return {i = i, msg = "Operands and destination required"}
|
||||
return {i = i, msg = S("Operands and destination required")}
|
||||
end
|
||||
end
|
||||
-- check whether operands/destination are identical
|
||||
if compare_op(elem.op1, elem.op2) then
|
||||
return {i = i, msg = "Operands cannot be identical"}
|
||||
return {i = i, msg = S("Operands cannot be identical")}
|
||||
end
|
||||
if compare_op(elem.op1, elem.dst, true) or compare_op(elem.op2, elem.dst, true) then
|
||||
return {i = i, msg = "Destination and operands must be different"}
|
||||
return {i = i, msg = S("Destination and operands must be different")}
|
||||
end
|
||||
-- check whether operands point to defined registers
|
||||
if elem.op1 ~= nil and elem.op1.type == "reg"
|
||||
and not is_reg_written_to(t, elem.op1.n, i) then
|
||||
return {i = i, msg = "First operand is undefined register"}
|
||||
return {i = i, msg = S("First operand is undefined register")}
|
||||
end
|
||||
if elem.op2.type == "reg" and not is_reg_written_to(t, elem.op2.n, i) then
|
||||
return {i = i, msg = "Second operand is undefined register"}
|
||||
return {i = i, msg = S("Second operand is undefined register")}
|
||||
end
|
||||
-- check whether destination points to undefined register
|
||||
if elem.dst.type == "reg" and is_reg_written_to(t, elem.dst.n, i) then
|
||||
return {i = i, msg = "Destination is already used register"}
|
||||
return {i = i, msg = S("Destination is already used register")}
|
||||
end
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user