2008年7月29日火曜日

ラベル格納用変数の管理モジュール:ver02

今まで書きためていたものを読んで思いました
命令の名前が安易で競合の可能性がある!

適当にsetとかつけるもんだから
これ絶対、後でsetとかいう名前の命令を作るだろう。とか思いました

やったことは命令の後ろに_at_モジュール名 をつけただけ
でもこれだけで、かなり命令の名前の競合が減るんですよね
ちなみにglobalキーワードをつけていないマクロは
@モジュール名をつける必要があるんで変更していません

FILE名:FILE_set_get_label_0_2.hsp
#module set_get_label
*null
stop
#define ctype def_l(%1,%2):\
l_%1_%2_0=*null:l_%1_%2_1=*null:l_%1_%2_2=*null:l_%1_%2_3=*null:\
l_%1_%2_4=*null:l_%1_%2_5=*null:l_%1_%2_6=*null:l_%1_%2_7=*null:\
l_%1_%2_8=*null:l_%1_%2_9=*null
#define ctype def_l_b(%1):\
def_l(%1,0):def_l(%1,1):def_l(%1,2):def_l(%1,3):def_l(%1,4):\
def_l(%1,5):def_l(%1,6):def_l(%1,7):def_l(%1,8):def_l(%1,9)

#deffunc init_at_set_get_label
tmp_l=*null
tmp_r=*null
def_l_b(0):def_l_b(1):def_l_b(2):def_l_b(3):def_l_b(4)
def_l_b(5):def_l_b(6):def_l_b(7):def_l_b(8):def_l_b(9)
return
#define ctype set_c(%1,%2):\
if c==0{l_%1_%2_0=tmp_l}:\
if c==1{l_%1_%2_1=tmp_l}:\
if c==2{l_%1_%2_2=tmp_l}:\
if c==3{l_%1_%2_3=tmp_l}:\
if c==4{l_%1_%2_4=tmp_l}:\
if c==5{l_%1_%2_5=tmp_l}:\
if c==6{l_%1_%2_6=tmp_l}:\
if c==7{l_%1_%2_7=tmp_l}:\
if c==8{l_%1_%2_8=tmp_l}:\
if c==9{l_%1_%2_9=tmp_l}
#define ctype set_b(%1):\
if b==0{set_c(%1,0)}:\
if b==1{set_c(%1,1)}:\
if b==2{set_c(%1,2)}:\
if b==3{set_c(%1,3)}:\
if b==4{set_c(%1,4)}:\
if b==5{set_c(%1,5)}:\
if b==6{set_c(%1,6)}:\
if b==7{set_c(%1,7)}:\
if b==8{set_c(%1,8)}:\
if b==9{set_c(%1,9)}
#define ctype set_a_1:\
if a==0{set_b(0)}:\
if a==1{set_b(1)}:\
if a==2{set_b(2)}:\
if a==3{set_b(3)}:\
if a==4{set_b(4)}
#define ctype set_a_2:\
if a==5{set_b(5)}:\
if a==6{set_b(6)}:\
if a==7{set_b(7)}:\
if a==8{set_b(8)}:\
if a==9{set_b(9)}
#deffunc set_label_at_set_get_label int index
if index<0: dialog "error ネストが浅すぎます",1:stop
if index>999: dialog "error ネストが深すぎます",1:stop
a=index/100
b=(index\100)/10
c=index\10
set_a_1()
set_a_2()
return
#define ctype get_c(%1,%2):\
if c==0{tmp_r=l_%1_%2_0}:\
if c==1{tmp_r=l_%1_%2_1}:\
if c==2{tmp_r=l_%1_%2_2}:\
if c==3{tmp_r=l_%1_%2_3}:\
if c==4{tmp_r=l_%1_%2_4}:\
if c==5{tmp_r=l_%1_%2_5}:\
if c==6{tmp_r=l_%1_%2_6}:\
if c==7{tmp_r=l_%1_%2_7}:\
if c==8{tmp_r=l_%1_%2_8}:\
if c==9{tmp_r=l_%1_%2_9}
#define ctype get_b(%1):\
if b==0{get_c(%1,0)}:\
if b==1{get_c(%1,1)}:\
if b==2{get_c(%1,2)}:\
if b==3{get_c(%1,3)}:\
if b==4{get_c(%1,4)}:\
if b==5{get_c(%1,5)}:\
if b==6{get_c(%1,6)}:\
if b==7{get_c(%1,7)}:\
if b==8{get_c(%1,8)}:\
if b==9{get_c(%1,9)}
#define ctype get_a_1:\
if a==0{get_b(0)}:\
if a==1{get_b(1)}:\
if a==2{get_b(2)}:\
if a==3{get_b(3)}:\
if a==4{get_b(4)}
#define ctype get_a_2:\
if a==5{get_b(5)}:\
if a==6{get_b(6)}:\
if a==7{get_b(7)}:\
if a==8{get_b(8)}:\
if a==9{get_b(9)}
#deffunc get_label_at_set_get_label int index
if index<0: dialog "error ネストが浅すぎます",1:stop
if index>999: dialog "error ネストが深すぎます",1:stop
a=index/100
b=(index\100)/10
c=index\10
get_a_1()
get_a_2()
return
#global

0 件のコメント: