fujidig #5557(2008/01/29 14:23 GMT) [ HSP ] Rating0/0=0.00
see: モジュール変数でツリー ( Fuji Diablog )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
#module m_tree children, content #modinit str _content #define global new_tree( %1, %2 = "" ) newmod %1, m_tree, %2 content = _content dimtype children, 5, 1 return #defcfunc get_tree_content modvar m_tree@ return content #modfunc get_tree_child str _content, var result f = -1 foreach children if get_tree_content( children.cnt ) != _content : continue f = cnt break loop if f >= 0 : result = children.f : return new_tree children, _content result = children( length(children) - 1 ) return #modfunc _show_tree str indent #define global show_tree( %1, %2 = "" ) _show_tree %1, %2 if indent == "" { mes content } else { mes indent + "┗" + content } foreach children show_tree children.cnt, indent + " " loop return #global paths = {" abc\\def abc\\def\\gh abc\\def\\ij abc\\jk\\lm de"} new_tree tree, "ROOT" paths_index = 0 repeat getstr path, paths, paths_index if strsize == 0 : break paths_index += strsize t = tree path_index = 0 repeat getstr v, path, path_index, '\\' if strsize == 0 : break path_index += strsize get_tree_child t, v, t loop loop show_tree tree
Rating0/0=0.00-0+
[ reply ]
fujidig
#5557()
[
HSP
]
Rating0/0=0.00
see: モジュール変数でツリー ( Fuji Diablog )
#module m_tree children, content #modinit str _content #define global new_tree( %1, %2 = "" ) newmod %1, m_tree, %2 content = _content dimtype children, 5, 1 return #defcfunc get_tree_content modvar m_tree@ return content #modfunc get_tree_child str _content, var result f = -1 foreach children if get_tree_content( children.cnt ) != _content : continue f = cnt break loop if f >= 0 : result = children.f : return new_tree children, _content result = children( length(children) - 1 ) return #modfunc _show_tree str indent #define global show_tree( %1, %2 = "" ) _show_tree %1, %2 if indent == "" { mes content } else { mes indent + "┗" + content } foreach children show_tree children.cnt, indent + " " loop return #global paths = {" abc\\def abc\\def\\gh abc\\def\\ij abc\\jk\\lm de"} new_tree tree, "ROOT" paths_index = 0 repeat getstr path, paths, paths_index if strsize == 0 : break paths_index += strsize t = tree path_index = 0 repeat getstr v, path, path_index, '\\' if strsize == 0 : break path_index += strsize get_tree_child t, v, t loop loop show_tree treeRating0/0=0.00-0+
[ reply ]