MOD ざざん
#module step_2byte_num o_string,o_dim,o_index,o_length
#modinit int p_length
o_string=""
o_length=p_length
o_index=0
dim o_dim,o_length
o_dim(o_length-1)=-1
return
#modfunc local set str value
o_string=value
return
#modfunc local set_index int p
o_index=p
return
#modfunc local multi_set
o_length=strlen(o_string)
repeat o_length
o_dim.cnt=one_get(thismod)
if o_dim.cnt==-1:o_length=cnt+1:break
loop
return
#modcfunc local get int p
return o_dim.p
#modcfunc local indexed_get local loc_r
loc_r = o_dim.o_index
o_index++
return loc_r
#modcfunc local get_index
return o_index
#modcfunc local get_length
return o_length
// 数値を一文字返す
#modcfunc local one_get
if o_length>o_index{
n=peek(o_string,o_index)
if ((n>=129)&(n<=159) )|( (n>=224)&(n<=252)){
o_index++
n2=peek(o_string,o_index)
o_index++
num=n*256+n2
return num
}else{
o_index++
return n
}
}
return -1
#modcfunc each_with_index var p_c,var p_i,local loc_len
loc_len=get_length@step_2byte_num(thismod)
p_i=o_index
p_c=indexed_get@step_2byte_num(thismod)
if get_index@step_2byte_num(thismod) >= loc_len:return -1
return 1
#global
/* TEST COE
newmod sa,step_2byte_num,16
set@step_2byte_num sa,"abcあいうdefアイウ"
multi_set@step_2byte_num sa
i=0
do
r= get@step_2byte_num(sa,i):i++:mes r
if r==-1:_break
await 1
until 0
repeat 48
logmes multi_get@step_s_can_2byte(sa,"str")
loop
set_index@step_s_can_2byte sa,0
repeat 48
logmes str(multi_get@step_s_can_2byte(sa,"int"))
loop
//*/
|