-function luatexja.ext_get_parameter_binary(k,c)
- if type(c)~='number' then
- ltjb.package_error('luatexja',
- 'invalid the second argument (' .. tostring(c) .. ')',
- 'I changed this one to zero.')
- c=0
- end
- if k == 'jacharrange' then
- if c<0 or c>216 then
- ltjb.package_error('luatexja',
- 'invalid character range number (' .. c .. ')',
- 'A character range number should be in the range 0..216,\n'..
- 'So I changed this one to zero.')
- c=0
- end
- tex.write(ltjc.get_range_setting(c))
- else
- if c<0 or c>0x10FFFF then
- ltjb.package_error('luatexja',
- 'bad character code (' .. c .. ')',
- 'A character number must be between -1 and 0x10ffff.\n'..
- "(-1 is used for denoting `math boundary')\n"..
- 'So I changed this one to zero.')
- c=0
- end
- if k == 'prebreakpenalty' then
- tex.write(ltjs.get_penalty_table('pre', c, 0, tex.getcount('ltj@@stack')))
- elseif k == 'postbreakpenalty' then
- tex.write(ltjs.get_penalty_table('post', c, 0, tex.getcount('ltj@@stack')))
- elseif k == 'kcatcode' then
- tex.write(ltjs.get_penalty_table('kcat', c, 0, tex.getcount('ltj@@stack')))
- elseif k == 'chartorange' then
- tex.write(ltjc.char_to_range(c))
- elseif k == 'jaxspmode' or k == 'alxspmode' then
- tex.write(ltjs.get_penalty_table('xsp', c, 3, tex.getcount('ltj@@stack')))
+do
+ luatexja.binary_pars = {
+ jacharrange = function(c, t)
+ if type(c)~='number' or c<0 or c>31*ltjc.ATTR_RANGE then
+ -- 0 はエラーにしない(隠し)
+ ltjb.package_error('luatexja',
+ 'invalid character range number (' .. tostring(c) .. ')',
+ 'A character range number should be in the range 1..'
+ .. 31*ltjc.ATTR_RANGE .. ",\n"..
+ 'So I changed this one to ' .. 31*ltjc.ATTR_RANGE .. ".")
+ c=0 -- external range 217 == internal range 0
+ elseif c==31*ltjc.ATTR_RANGE then c=0
+ end
+ -- 負の値は <U+0080 の文字の文字範囲,として出てくる.この時はいつも欧文文字なので 1 を返す
+ return (c<0) and 1 or ltjc.get_range_setting(c)
+ end,
+ prebreakpenalty = function(c, t)
+ return ltjs.get_stack_table(stack_table_index.PRE
+ + ltjb.in_unicode(c, true), 0, t)
+ end,
+ postbreakpenalty = function(c, t)
+ return ltjs.get_stack_table(stack_table_index.POST
+ + ltjb.in_unicode(c, true), 0, t)
+ end,
+ kcatcode = function(c, t)
+ return ltjs.get_stack_table(stack_table_index.KCAT
+ + ltjb.in_unicode(c, false), 0, t)
+ end,
+ chartorange = function(c, t)
+ return ltjc.char_to_range(ltjb.in_unicode(c, false))
+ end,
+ jaxspmode = function(c, t)
+ return ltjs.get_stack_table(stack_table_index.XSP
+ + ltjb.in_unicode(c, true), 3, t)
+ end,
+ boxdir = function(c, t)
+ if type(c)~='number' or c<0 or c>65535 then
+ ltjb.package_error('luatexja',
+ 'Bad register code (' .. tostring(c) .. ')',
+ 'A register must be between 0 and 65535.\n'..
+ 'I changed this one to zero.')
+ c=0
+ end
+ return ltjd.get_register_dir(c)
+ end,
+ }
+ local binary_pars = luatexja.binary_pars
+
+ binary_pars.alxspmode = binary_pars.jaxspmode
+ function luatexja.ext_get_parameter_binary(k,c)
+ if binary_pars[k] then
+ tex.write(tostring(binary_pars[k](c,tex.getcount('ltj@@stack'))))