% !TeX program = LuaTeX
% Copyright (C) 2019-2022 Roberto Giacomelli

\directlua{
local barracuda = require "barracuda"
local barcode = barracuda:barcode()
local c128 = assert(barcode:new_encoder("code128"))
print()
print(c128._NAME)
print(c128._VERSION)

local info = c128:info()
print("encoder name = ", info.name)
print("description = ", info.description)
for k, tp in ipairs(info.param) do
    print(k, tp.name, tp.value)
end

local symb = c128:new("123")
print("Symbol char list:")
for _, c in ipairs(symb:get_code()) do
    print(c)
end
print("Symbol hri char list:")
for _, c in ipairs(symb:get_hri()) do
    print(c)
end


local canvas = barracuda:new_canvas()

symb:draw(canvas)

% driver library
local drv = barracuda:get_driver()
drv:save("svg", canvas, "c128-123")
}
\bye

