¤Þ¤¿¤¤¤é¤Ì¥â¥¸¥å¡¼¥ë¤ò¤Ä¤¯¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£(¡¡¦¦Ø¡¦¡®)
¤³¤¦¤¤¤¦°ì¸«ÉÔ²Äǽ¤½¤¦¤Ê¤³¤È¤Û¤É¡¢Ç³¤¨¤ë¤ó¤Ç¤¹¤è¤Í¡£
//===================================================================
// ÊÑ¿ô̾¤òÍøÍѤ·¤ÆÊÑ¿ô¤Ë¥¢¥¯¥»¥¹¤¹¤ë¥â¥¸¥å¡¼¥ë
//===================================================================
//
// name = getvn(v1)
// ÊÑ¿ô¤Î̾Á°¤ò¼èÆÀ¤¹¤ë
// v1 : ÊÑ¿ô
//
// ÊÑ¿ôv1¤Î¥¹¥¯¥ê¥×¥È¾å¤Ç¤Î̾Á°¤ò¼èÆÀ¤·¤Þ¤¹¡£
// Âçʸ»ú¤ÏÁ´¤Æ¾®Ê¸»ú¤ËÊÑ´¹¤µ¤ì¤Þ¤¹¡Ê¸À¸ì»ÅÍÍ¡Ë¡£
//
//-------------------------------------------------------------------
//
// dupptr_byname v1, name
// »ØÄꤷ¤¿Ì¾Á°¤ÎÊÑ¿ô¤Î¡¢¥¯¥í¡¼¥óÊÑ¿ô¤òºîÀ®¤¹¤ë
// v1 : ¥¯¥í¡¼¥ó¤Ë¤¹¤ëÊÑ¿ô
// name: ¥¯¥í¡¼¥óÂоݤÎÊÑ¿ô̾
//
// name¤Ç»ØÄꤷ¤¿Ì¾Á°¤ÎÊÑ¿ô¤Î¡¢¥¯¥í¡¼¥óÊÑ¿ô¤òºîÀ®¤·¤Þ¤¹¡£
// »ØÄꤷ¤¿Ì¾Á°¤ÎÊÑ¿ô¤¬¡¢¥¹¥¯¥ê¥×¥ÈÆâ¤Ç
// ͽ¤áÄêµÁ¤µ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
//
// Ìá¤êÃÍ
// 0 : À®¸ù
// 1 : ¼ºÇÔ
//
//===================================================================
//¥â¥¸¥å¡¼¥ë¤³¤³¤«¤é¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§¢§
#uselib "user32"
#func global CharLowerA "CharLowerA" sptr
#module VNGetter
#deffunc local init_getvn
if f_init : return 0
f_init = 1
logmes "======================================"
logmes "³°Éô¤«¤é¤ÎÆâÉôÊÑ¿ô¥¢¥¯¥»¥¹Íѥ⥸¥å¡¼¥ë"
logmes "¡¡VNGetter"
logmes "--------------------------------------"
logmes "Date: 2012/09/24"
logmes "Author: ¤Æ¤ó"
logmes "======================================"
exist "obj"
if strsize < 0 {
logmes "obj¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤é¤Ê¤¤¤Ç¤¹¡£"
logmes "²òÀϤòÃÇÇ°¤·¤Þ¤¹¡£(¡¡¦¦Ø¡¦¡®)Ž¼Ž®ŽÎŽÞŽ°ŽÝ¡Ä"
f_init = 0
return 1
}
sdim buf, strsize : bload "obj", buf
max_val = lpeek(buf, 8)
pt_ds = lpeek(buf, 24)
max_ds = lpeek(buf, 28)
pt_dinfo = lpeek(buf, 40)
max_dinfo = lpeek(buf, 44)
sdim DebugInfo, max_dinfo
memcpy DebugInfo, buf, max_dinfo, 0, pt_dinfo
sdim DataSection, max_ds
memcpy DataSection, buf, max_ds, 0, pt_ds
logmes "DataSection: "+strf("$%04X", pt_ds)+" - "+strf("$%04X", pt_ds+max_ds)
logmes ""+max_val+"¸Ä¤ÎÊÑ¿ô¤ò»ÈÍÑ"
logmes "--------------------------------------"
sdim varnames, 64, max_val
i = 0
repeat max_dinfo
char = peek(DebugInfo, cnt)
if char = 255 : break
if char = 254 : continue cnt+1+3+2
if char = 253 {
offset = lpeek(DebugInfo, cnt+1) & 0x00FFFFFF
getstr varnames(i), DataSection, offset, $00
i++
continue cnt+1+3+2
}
if char == 252 : continue cnt+1+2
loop
repeat max_val
logmes "ID:"+strf("%03d", cnt)+" "+varnames(cnt)
loop
return 0
#defcfunc local getvid var v1
v1_pt = varptr(v1)
mref HSPCTX, 68
sdim Mem_var, 29
dupptr Mem_var, lpeek(HSPCTX, 44), max_val*48
res = -1
repeat max_val
v2_pt = lpeek(Mem_var, cnt*48+28)
if v1_pt = v2_pt : res=cnt : break
loop
return res
#defcfunc getvn var v1
id = getvid(v1)
if id = -1 : return "NOT FOUND"
return varnames(id)
#deffunc dupptr_byname var v1, str s1
s2 = s1 : CharLowerA varptr(s2)
id = -1
repeat max_val
if varnames(cnt) = s2 : id = cnt : break
loop
if id = -1 : dialog "NOT FOUND" : return 1
mref HSPCTX, 68
sdim Mem_var, 29
dupptr Mem_var, lpeek(HSPCTX, 44), max_val*48
dupptr v1, lpeek(Mem_var, id*48+28), lpeek(Mem_var, id*48+24), wpeek(Mem_var, id*48)
return 0
#global
init_getvn@VNGetter
//¥â¥¸¥å¡¼¥ë¤³¤³¤Þ¤Ç¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥¢¥
//--------------------°Ê²¼¡¢¥µ¥ó¥×¥ë----------------------------------------------------
#const BASE_X 400
#const BASE_Y 320
screen 0, BASE_X, BASE_Y
title "ÊÑ¿ô̾¤ò»È¤Ã¤¿ÊÑ¿ô¤Î´ÉÍý"
font "¥á¥¤¥ê¥ª", 12
color $F0, $F0, $F0 : boxf
color
pos 20, 15 : mes "ÂåÆþ¼°( [ÊÑ¿ô̾]=[ÃÍ] ¤Î·Á¼°¡¡¶õÇò¡¦¿ô¼°ÉÔ²Ä )"
objsize 70, 25
pos BASE_X-90, 10 : button gosub "ÂåÆþ", *parse
sdim txt, 64 : txt = "a=30" : pos 20, 40 : input txt, BASE_X-40, 20
pos 20, 75 : mes "Ãͤò³Îǧ¤·¤¿¤¤ÊÑ¿ô¤Î̾Á°"
sdim v_name, 64 : v_name="a" : pos ginfo_mesx+30, 75 : input v_name, BASE_X-(ginfo_mesx+50), 20
objsize BASE_X-40, 50
pos 20, 130 : button gosub "Ãͤò³Îǧ", *push
color $60, $60, $60 : boxf 20, 190, BASE_X-20, BASE_Y-20
color $C0, $F0, $FF : pos 30, 200
mes "¥¹¥¯¥ê¥×¥ÈÆâ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ëÊÑ¿ô¤Ë¤·¤«»ÈÍѤǤ¤Þ¤»¤ó¡£"
mes "Îã¤È¤·¤Æ a, b, c, d, e, f ¤Î6¤Ä¤ÎÊÑ¿ô¤òÄêµÁ¤·¤Æ¤ª¤¤Þ¤·¤¿¡£"
mes "\ta=30"
mes "\tb=20
mes "¤Ê¤É¡¢»î¤·¤Æ¤ß¤Æ²¼¤µ¤¤¡Ê½é´üÃͤÏÁ´¤Æ10¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡Ë¡£"
a=10 : b=10 : c=10
d=10 : e=10 : f=10
stop
*parse
split txt, "=", args
//args(0)¤ËÊÑ¿ô̾¡¢args(1)¤ËÃͤ¬Æþ¤Ã¤Æ¤¤¤ë¡£
//ÊÑ¿ôv¤ò¡¢¡Öargs(0)¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤ÎÊÑ¿ô¡×¤Î¡¢¥¯¥í¡¼¥óÊÑ¿ô¤Ë¤¹¤ë
dupptr_byname v, args(0)
//v¤ØÂåÆþ¡£¤³¤ì¤Ç¡Öargs(0)¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤ÎÊÑ¿ô¡×¤ËÃͤ¬ÂåÆþ¤µ¤ì¤¿¤³¤È¤Ë¤Ê¤ë¡£
v = int(args(1))
//¼°¤Îºï½ü
txt = "" : objprm 1, txt
return
*push
//ÊÑ¿ôv¤ò¡¢¡Öv_name¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤ÎÊÑ¿ô¡×¤Î¡¢¥¯¥í¡¼¥óÊÑ¿ô¤Ë¤¹¤ë
dupptr_byname v, v_name
if stat : return //¼ºÇԡʤª¤½¤é¤¯¡¢»ØÄꤷ¤¿Ì¾Á°¤ÎÊÑ¿ô¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¤³¤È¤Ëµ¯°ø¡Ë
dialog v_name+"¤ÎÃͤÏ"+v
return