モジュール変数sample:modvar_sample_01.hsp

#module data_module mem_ID_data, mem_name_data, mem_data_basic, mem_data_pow, mem_data_real
#modinit
	mem_ID_data = -1
	sdim mem_name_data,20
	mem_name_data = "name null -3"
	mem_data_basic = 0
	mem_data_pow   = 0.0
	mem_data_real  = 0.0
	return
#modfunc  set_mem_ID_data int __p
	mem_ID_data = __p
	return
#modcfunc get_mem_ID_data
	return mem_ID_data
#modfunc  set_mem_name_data str __p_str
	mem_name_data = __p_str
	return
#modcfunc get_mem_name_data
	return mem_name_data
#modfunc  set_mem_data_basic int __p
	mem_data_basic == __p
	return
#modfunc  calc_mem_pow_and_real
	mem_data_real = double(mem_data_basic) * double(mem_data_basic)*10.0
	mem_data_pow  = double(mem_data_real) / 2.0
	return
#modcfunc get_mem_data_basic
	return mem_data_basic
#modcfunc get_mem_data_pow
	return mem_data_pow
#modcfunc get_mem_data_real
	return mem_data_real
#modcfunc get_mem_data_real_div2
	return mem_data_real / 2.0
#modcfunc get_mem_data_real_div4
	return mem_data_real / 4.0
#global
repeat 110
newmod obj_data,data_module
if cnt != 0:set_mem_ID_data obj_data.cnt,cnt
loop
set_mem_name_data obj_data.1, "1st data"
set_mem_name_data obj_data.2, "2nd data"
set_mem_name_data obj_data.3, "3rd data"
set_mem_name_data obj_data.4, "4th data"
set_mem_name_data obj_data.5, "5th data"
repeat 100,6
set_mem_name_data obj_data.cnt, "" + cnt + "th data"
loop
repeat 105
set_mem_data_basic obj_data.cnt, cnt
loop
set_mem_data_basic obj_data.31,32
set_mem_data_basic obj_data.32,34
set_mem_data_basic obj_data.33,36
set_mem_data_basic obj_data.34,38
set_mem_data_basic obj_data.35,40
repeat 75
tmp_i  = 32 + cnt
tmp_ii = 30 + (tmp_i - 30) * 2
set_mem_data_basic obj_data.tmp_i,tmp_ii
loop
set_mem_data_basic obj_data.61,94
set_mem_data_basic obj_data.62,98
set_mem_data_basic obj_data.63,102
set_mem_data_basic obj_data.64,106
set_mem_data_basic obj_data.65,110
repeat 45
tmp_j  = 62 + cnt
tmp_jj = 30 + 60 + (tmp_j - 60) * 4
set_mem_data_basic obj_data.tmp_j,tmp_jj
loop
repeat 105
calc_mem_pow_and_real obj_data.cnt
loop
#if 0
repeat 105
logmes "ID   : " + get_mem_ID_data(obj_data.cnt)  + " name : " + get_mem_name_data(obj_data.cnt)
logmes "basic: " + get_mem_data_basic(obj_data.cnt)
logmes "pow  : " + get_mem_data_pow(obj_data.cnt)
logmes "real : " + get_mem_data_real(obj_data.cnt) + " div2 : " + get_mem_data_real_div2(obj_data.cnt) + " next div4 : " + get_mem_data_real_div4(obj_data.cnt)
loop
#endif