#author("2018-01-05T14:42:32+09:00","","")
[[簡単言語]]

**NO_510 [#hb965b9e]

編集ノルマ一つ完了っすw~
30〜40個かたまりあるから微妙にめんどくさんですがw~
DQXはもっとめんどくさいぞーって勢いですw~
 #module mod_label i_name,i_ID,i_l_value
 #modinit str p_name,int p_ID,int p_l_value
 	i_name=p_name
 	i_ID=p_ID
 	i_l_value=p_l_value
 	o_num++
 	return
 #deffunc local first_set
 		fv_ID=0
 		o_num=0
 	return
 #modcfunc local get_i_name
 	return i_name
 #modcfunc local get_i_ID
 	return i_ID
 #modcfunc local get_i_l_value
 	return i_l_value
 #deffunc local x_label_init str _p_name,int _p_l_value
 	newmod o_label,mod_label,_p_name,fv_ID,_p_l_value
 	fv_ID++
 	return fv_ID-1
 #defcfunc local get_x_label_l_value str __p_name,int __p_ID,local r_name
 	r_name=get_i_name@mod_label(o_label.__p_ID)
 	if r_name!=__p_name:return -1
 	return get_i_l_value@mod_label(o_label.__p_ID)
 #global
 
 first_set@mod_label
 #module mod_free_label i_name,i_ID,i_l_value
 #modinit str p_name,int p_ID,int p_l_value
 	i_name=p_name
 	i_ID=p_ID
 	i_l_value=p_l_value
 	o_num++
 	return
 #deffunc local first_set int p_dim_length
 	dim many_id_dim,p_dim_length
 		fv_ID=0
 		o_num=0
 	return
 #modcfunc local get_i_name
 	return i_name
 #modcfunc local get_i_ID
 	return i_ID
 #modcfunc local get_i_l_value
 	return i_l_value
 #modcfunc local get_i_dim_length
 	return length(i_dim)
 #deffunc local x_label_init str _p_name,int _p_l_value,int p_index
 	many_id_dim.p_index=fv_ID
 	newmod o_label,mod_free_label,_p_name,fv_ID,_p_l_value
 	fv_ID++
 	return fv_ID-1
 #defcfunc local get_x_label_l_value str __p_name,int p_index,local r_name,local r_index
 ;__p_IDを使わなくして、p_indexを使うようになった
 	r_index=many_id_dim.p_index
 	r_name=get_i_name@mod_free_label(o_label.r_index)
 	if r_name!=__p_name:return -1
 	return get_i_l_value@mod_free_label(o_label.r_index)
 #deffunc local dump
 	repeat o_num
 	logmes "name "+cnt+":"+get_i_name@mod_free_label(o_label.cnt)
 	logmes "ID "+cnt+":"+get_i_ID@mod_free_label(o_label.cnt)
 	logmes "value "+cnt+":"+get_i_l_value@mod_free_label(o_label.cnt)
 	loop
 	return
 #global
 
 first_set@mod_free_label 256
 
 dim pc_stack,1000
 n_pc_stack=0
 hoge_pc=1
 
 dim num_stack,1000
 repeat length(num_stack)
 num_stack.cnt=-1
 loop
 
 ldim label_stack,100
 label_stack_index=0
 
 //	line search のみ有効
 flag_on_do=0
 flag_on_line_search=1
 flag_on_label_search=0
 
 #define ctype l_avoid(%1) goto *l_a_%1
 #define ctype catch_l_avoid(%1)*l_a_%1
 #define ctype l_def(%1)*l_def_%1
 #define ctype l_def_go(%1) *l_def_%1
 ;goto *l_def_A
 ;goto l_def(A)
 ;l_def(E):
 ;*l_def_B
 ;x_label_init 1,"a",1 ;0
 ;x_label_init 0,"aa1",11 ;1
 ;x_label_init 0,"ab1",13 ;2
 ;x_label_init 0,"ax1a",15 ;3
 dim one_code,1000
 x=0
 f_stop=0
 //	ボタンによって選択される選択肢のID
 selected_btnext="a"
 
 #enum nop=0
 #enum en_get_my_label
 #enum en_get_my_free_label
 #enum en_button_A
 #enum en_button_B
 #enum en_button_C
 #enum en_button_D
 #enum en_button_E
 #enum en_button_F
 #enum en_cls0
 #enum en_objsize
 #enum en_pos
 #enum en_mes
 #enum en_stop
 #enum en_goto
 #enum en_calc
 
 #define mac_def %ttype_ll *%i
 #define mac_print %ttype_ll *%p
 #define mac_set_print %ttype_ll *%o
 #define mac_call %ttype_ll *%o
 
 my_pc=1
 my_pc_B=1
 flag_on_l_search=1 
 goto *@f
 *search_l_end
 flag_on_l_search=0
 	goto *sw_begin
 *@
 	flag_on_line_search=1
 if 0{
 	*count_b
 	flag_on_line_search=0
 	flag_on_label_search=1
 	flag_on_do=0
 	label_pc=1
 }
 if 0{
 	*count_c
 	flag_on_line_search=0
 	flag_on_label_search=0
 	flag_on_do=1
 	cmd_pc=1
 	dump@mod_free_label
 	repeat 32
 	logmes ""+cnt+":"+many_id_dim@mod_free_label.cnt
 	loop
 }
 if 0{
 *line_flag
 	if flag_on_line_search==1{
 		pc_stack.hoge_pc=my_line:hoge_pc++
 	}
 	return
 #define line_flag_and_ldim_set :\
 	if flag_on_line_search==1{		pc_stack.hoge_pc=my_line:hoge_pc++:\
 		label_stack.label_stack_index=mac_set_print:\
 		label_stack_index++:\
 	}
 *null_label_flag_chk	
 	if flag_on_label_search==1{
 		if label_pc==num_stack.my_line{
 			if my_pc_B==1{my_pc_B=1:label_pc++:goto *sw_begin	}
 		}
 	}
 	return
 #define mac_null_label_flag_chk:\
 	if flag_on_label_search==1{	if label_pc==num_stack.my_line{	if my_pc_B==1{my_pc_B=1:label_pc++:goto *sw_begin:\
 	}	}	}
 
 *null_do_flag_chk
 	if flag_on_do==1{
 		if cmd_pc==num_stack.my_line{
 			my_pc_B=1:cmd_pc++:goto *sw_begin
 		}
 	}
 	return
 #define mac_null_do_flag_chk:\
 	if flag_on_do==1{	if cmd_pc==num_stack.my_line{	my_pc_B=1:cmd_pc++:goto *sw_begin:\
 	}	}
 #define ctype mac_regst_label(%1):\
 	if flag_on_label_search==1{	if label_pc==num_stack.my_line{		if my_pc_B==1{my_pc_B++:cp1=%1:\
 		}	if my_pc_B==2{my_pc_B++:cp2=label_pc:logmes "label:"+label_pc:\
 		}	if my_pc_B==3{my_pc_B++:x_label_init@mod_label cp1,cp2:logmes ""+cp2+":label_no:"+stat:\
 		}	if my_pc_B==4{my_pc_B=1:label_pc++:goto *sw_begin:\
 		}	}	}
 #define ctype mac_regst_free_label(%1,%2):\
 	if flag_on_label_search==1{	if label_pc==num_stack.my_line{		if my_pc_B==1{my_pc_B++:cp1=%1:\
 	}	if my_pc_B==2{my_pc_B++:cp2=label_pc:logmes "label:"+label_pc:\
 	}	if my_pc_B==3{my_pc_B++:cp3=%2:\
 	}	if my_pc_B==4{my_pc_B++:x_label_init@mod_free_label cp1,cp2,cp3:logmes ""+cp2+":label_no:"+stat:\
 	}	if my_pc_B==5{my_pc_B=1:label_pc++:goto *sw_begin:\
 	}	}	}
 ;	label:1
 ;	label_no:1
 ;	label:11
 ;	label_no:2
 ;	label:15
 ;	label_no:3
 ;	label:19
 ;	label_no:4
 }
 
 cmd_pc=1
 *sw_begin
 	await 1
 	if cmd_pc>1{
 		c=cmd_pc-1
 		goto label_stack.c
 	}
 #define def_head mac_def:my_line=int(__LINE__):line_flag_and_ldim_set:mac_null_label_flag_chk	
 #define def_label_auto(%1):mac_def:my_line=int(__LINE__):line_flag_and_ldim_set:mac_regst_label(%1):mac_null_do_flag_chk
 #define def_label_free(%1,%2):mac_def:my_line=int(__LINE__):line_flag_and_ldim_set:mac_regst_free_label(%1,%2):mac_null_do_flag_chk
 ;#define command_mac_def       %tcommand_mac *%i
 ;#define command_mac_print     %tcommand_mac *%p
 ;#define command_mac_set       %tcommand_mac *%o
 ;#define command_mac_call      %tcommand_mac *%o
 
 ;#define end_mac_def       %tend_mac *%i
 ;#define end_mac_print     %tend_mac *%p
 ;#define end_mac_set       %tend_mac *%o
 ;#define end_mac_call      %tend_mac *%o
 
 ;#define sub_r_inside if flag_on_do==1{	if cmd_pc==num_stack.my_line{	avoid=0:\
 ;		goto command_mac_def:end_mac_def:my_pc_B=1:cmd_pc++:goto *com_sw: goto *sw_begin	}	}	
 ;#define sub_r_old:def_head:sub_r_inside:if 0{	command_mac_set:
 ;#define sub_r_old_end:goto end_mac_set }
 #define sub_r def_head:	if flag_on_do==1{	if cmd_pc==num_stack.my_line{	
 #define sub_r_end	my_pc_B=1:cmd_pc++:goto *com_sw: goto *sw_begin	}	}
 //case 1:	
 def_label_auto "a"
 
 sub_r	//case 2:
 	if my_pc_B==1{cr_com=en_cls0}
 	sub_r_end
 sub_r	//case 3:
 	if my_pc_B==1{my_pc_B++:cp1=120	}
 	if my_pc_B==2{my_pc_B++:cp2=24	}
 	if my_pc_B==3{cr_com=en_objsize}
 	sub_r_end
 sub_r	//case 4:
 	if my_pc_B==1{my_pc_B++:cp1="aa1"	}
 	if my_pc_B==2{my_pc_B++:cp2=1	}
 	if my_pc_B==3{cr_com=en_get_my_label}
 	sub_r_end
 sub_r	//case 5:
 	if my_pc_B==1{my_pc_B++:cp1="X足す1"	}
 	if my_pc_B==2{my_pc_B++:bt_pc_1=my_label	}
 	if my_pc_B==3{cr_com=en_button_A}
 	sub_r_end
 sub_r	//case 6:
 	if my_pc_B==1{my_pc_B++:cp1="ab1"	}
 	if my_pc_B==2{my_pc_B++:cp2=2	}
 	if my_pc_B==3{cr_com=en_get_my_label}
 	sub_r_end
 sub_r	//case 7:
 	if my_pc_B==1{my_pc_B++:cp1="X引く1"	}
 	if my_pc_B==2{my_pc_B++:bt_pc_2=my_label	}
 	if my_pc_B==3{cr_com=en_button_B}
 	sub_r_end
 sub_r	//case B1:
 	if my_pc_B==1{my_pc_B++:cp1="ac1"	}
 	if my_pc_B==2{my_pc_B++:cp2=3	}
 	if my_pc_B==3{cr_com=en_get_my_free_label}
 	sub_r_end
 sub_r	//case B2:
 	if my_pc_B==1{my_pc_B++:cp1="X足す2"	}
 	if my_pc_B==2{my_pc_B++:bt_pc_3=my_label	}
 	if my_pc_B==3{cr_com=en_button_C}
 	sub_r_end
 sub_r	//case B3:
 	if my_pc_B==1{my_pc_B++:cp1="ad1"	}
 	if my_pc_B==2{my_pc_B++:cp2=5	}
 	if my_pc_B==3{cr_com=en_get_my_free_label}
 	sub_r_end
 sub_r	//case B4:
 	if my_pc_B==1{my_pc_B++:cp1="X引く2"	}
 	if my_pc_B==2{my_pc_B++:bt_pc_4=my_label	}
 	if my_pc_B==3{cr_com=en_button_D}
 	sub_r_end	
 sub_r	//case 8:
 	if my_pc_B==1{my_pc_B++:cp1=150	}
 	if my_pc_B==2{my_pc_B++:cp=0	}
 	if my_pc_B==3{cr_com=en_pos}
 	sub_r_end
 sub_r	//case 9:
 	if my_pc_B==1{my_pc_B++:cp1="ボタンを押してください"	}
 	if my_pc_B==2{cr_com=en_mes}
 	sub_r_end
 sub_r	//case 10:
 	if my_pc_B==1{cr_com=en_stop}
 	sub_r_end
 
 //case 11:"aa1"
 def_label_auto "aa1"
 
 sub_r	//case 12:
 	if my_pc_B==1{x+=1:cr_com=en_calc}
 	sub_r_end
 sub_r	//case 13:
 	if my_pc_B==1{my_pc_B++:cp1="ax1a"	}
 	if my_pc_B==2{my_pc_B++:cp2=3	}
 	if my_pc_B==3{cr_com=en_get_my_label}
 	sub_r_end
 sub_r	//case 14:
 	if my_pc_B==1{cp1=my_label:cr_com=en_goto}
 	sub_r_end
 	
 //case 15:"ab1"
 def_label_auto "ab1"
 
 sub_r	//case 16:
 	if my_pc_B==1{x-=1:cr_com=en_calc}
 	sub_r_end
 sub_r	//case 17:
 	if my_pc_B==1{my_pc_B++:cp1="ax1a"	}
 	if my_pc_B==2{my_pc_B++:cp2=3	}
 	if my_pc_B==3{cr_com=en_get_my_label}
 	sub_r_end
 sub_r	//case 18:
 	if my_pc_B==1{cp1=my_label:cr_com=en_goto}
 	sub_r_end
 	
 //case C1:"ac1"
 def_label_free "ac1",3
 
 sub_r	//case C2:
 	if my_pc_B==1{x+=2:cr_com=en_calc}
 	sub_r_end
 sub_r	//case C3:
 	if my_pc_B==1{my_pc_B++:cp1="ax1a"}
 	if my_pc_B==2{my_pc_B++:cp2=3	}
 	if my_pc_B==3{cr_com=en_get_my_label}
 	sub_r_end
 sub_r	//case C4:
 	if my_pc_B==1{cp1=my_label:cr_com=en_goto}
 	sub_r_end
 	
 //case C5:"ad1"
 def_label_free "ad1",5
 
 sub_r	//case C6:
 	if my_pc_B==1{x-=2:cr_com=en_calc}
 	sub_r_end
 sub_r	//case C7:
 	if my_pc_B==1{my_pc_B++:cp1="ax1a"	}
 	if my_pc_B==2{my_pc_B++:cp2=3	}
 	if my_pc_B==3{cr_com=en_get_my_label}
 	sub_r_end
 sub_r	//case C8:
 	if my_pc_B==1{cp1=my_label:cr_com=en_goto}
 	sub_r_end
 	
 //case 19:"ax1a"
 def_label_auto "ax1a"
 
 sub_r	//case 20:
 	if my_pc_B==1{cr_com=en_cls0}
 	sub_r_end
 sub_r	//case 21:
 	if my_pc_B==1{my_pc_B++:cp1=120	}
 	if my_pc_B==2{my_pc_B++:cp2=24	}
 	if my_pc_B==3{cr_com=en_objsize:}
 	sub_r_end
 sub_r	//case 22:
 	if my_pc_B==1{my_pc_B++:cp1="a"	}
 	if my_pc_B==2{my_pc_B++:cp2=0	}
 	if my_pc_B==3{cr_com=en_get_my_label}
 	sub_r_end	
 sub_r	//case 23:
 	if my_pc_B==1{my_pc_B++:cp1="NEXT"	}
 	if my_pc_B==2{my_pc_B++:bt_pc_1=my_label	}
 	if my_pc_B==3{cr_com=en_button_A}
 	sub_r_end	
 sub_r	//case 24:
 	if my_pc_B==1{my_pc_B++:cp1=150	}
 	if my_pc_B==2{my_pc_B++:cp=0	}
 	if my_pc_B==3{cr_com=en_pos}
 	sub_r_end	
 sub_r	//case 25:
 	if my_pc_B==1{my_pc_B++:cp1="Xの値は"+x+"です"	}
 	if my_pc_B==2{cr_com=en_mes}
 	sub_r_end	
 sub_r	//case 26:
 	if my_pc_B==1{cr_com=en_stop}
 	sub_r_end	
 //if flag_on_label_search==1:mes 6:goto *_2do
 //	pc_stack dump	
 if flag_on_line_search==1{
 	mes "dump"
 	repeat 100
 	logmes ""+cnt+" "+pc_stack.cnt
 	loop
 
 	repeat 100
 	if pc_stack.cnt!=0{
 		num_stack(pc_stack.cnt)=cnt
 	}
 	loop
 
 	repeat 500
 	logmes ""+cnt+":"+num_stack.cnt
 	loop
 }
 ;mes 6
 ;	goto *sw_begin	
 ;}
 if flag_on_line_search==1{
 	goto *count_b
 }
 if flag_on_label_search==1{
 	goto *count_c
 }
 mes "stop"
 stop
 *com_sw
 switch cr_com
 case en_get_my_label:	my_label=get_x_label_l_value@mod_label(cp1,cp2):swbreak
 case en_get_my_free_label:	my_label=get_x_label_l_value@mod_free_label(cp1,cp2):swbreak
 case en_button_A:	button cp1,*bt_hoge_1:swbreak
 case en_button_B:	button cp1,*bt_hoge_2:swbreak
 case en_button_C:	button cp1,*bt_hoge_3:swbreak
 case en_button_D:	button cp1,*bt_hoge_4:swbreak
 case en_button_E:	button cp1,*bt_hoge_5:swbreak
 case en_button_F:	button cp1,*bt_hoge_6:swbreak
 case en_cls0:	cls 0:swbreak
 case en_objsize:objsize cp1,cp2:swbreak
 case en_pos:	pos cp1,cp2:swbreak
 case en_mes:	mes ""+cp1:swbreak
 case en_stop:	f_stop=1:swbreak
 case en_calc:	swbreak
 case en_goto:	cmd_pc=cp1:goto *sw_begin
 swend
 if f_stop==1:f_stop=0:stop
 goto *sw_begin
 
 *get_my_label
 	my_label=get_x_label_l_value(cp1,cp2)
 ;	my_label=get_x_label_l_value("a",0)
 	goto *sw_begin
 *bt_hoge_1
 ;	mes my_pc
 ;	mes bt_pc_1
 	cmd_pc=bt_pc_1
 	goto *sw_begin
 *bt_hoge_2
 	cmd_pc=bt_pc_2
 	goto *sw_begin
 *bt_hoge_3
 	cmd_pc=bt_pc_3
 	goto *sw_begin
 *bt_hoge_4
 	mes "hoge4"+bt_pc_4
 	cmd_pc=bt_pc_4
 	goto *sw_begin
 *bt_hoge_5
 	cmd_pc=bt_pc_5
 	goto *sw_begin
 *bt_hoge_6
 	cmd_pc=bt_pc_6
 	goto *sw_begin
 *sw_end
 	stop