summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex
blob: 1b5d6509d480791e2ead970d099ed865d7cba3f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% !TeX program = LuaTeX
% Copyright (C) 2020 Roberto Giacomelli

\directlua{
local barracuda = require "barracuda"
local c39 = assert(barracuda:barcode():new_encoder("code39"))
print()
print([[Code39: no filter argument:]])
for _, tpar in c39:param_ord_iter() do
    local pid = tpar.pname
    print(pid, [[ = ]], c39[pid])
end

print()
print([[Code39: filter == '*all':]])
for _, tpar in c39:param_ord_iter([[*all]]) do
    local pid = tpar.pname
    print(pid, [[ = ]], c39[pid])
end

print()
print([[Code39: filter == '*super':]])
for _, tpar in c39:param_ord_iter([[*super]]) do
    local pid = tpar.pname
    print(pid, [[ = ]], c39[pid])
end

print()
print([[Code39: filter == '*enc':]])
for _, tpar in c39:param_ord_iter([[*enc]]) do
    local pid = tpar.pname
    print(pid, [[ = ]], c39[pid])
end

print()
local isbn = assert(barracuda:barcode():new_encoder("ean-isbn"))

print([[ISBN: No filter argument:]])
for _, tpar in isbn:param_ord_iter() do
    local pid = tpar.pname
    print(pid, [[ = ]], isbn[pid])
end

print()
print([[ISBN: filter == '*all':]])
for _, tpar in isbn:param_ord_iter([[*all]]) do
    local pid = tpar.pname
    print(pid, [[ = ]], isbn[pid])
end

print()
print([[ISBN: filter == '*super':]])
for _, tpar in isbn:param_ord_iter([[*super]]) do
    local pid = tpar.pname
    print(pid, [[ = ]], isbn[pid])
end

print()
print([[ISBN: filter == '*enc':]])
for _, tpar in isbn:param_ord_iter([[*enc]]) do
    local pid = tpar.pname
    print(pid, [[ = ]], isbn[pid])
end

local c128 = assert(barracuda:barcode():new_encoder([[code128]]))
print()
print([[Code128: filter == '*enc':]])
for _, tpar in c128:param_ord_iter([[*enc]]) do
    local pid = tpar.pname
    print(pid, [[ = ]], c128[pid])
end
}
\bye