Index: render/html.awk =================================================================== --- render/html.awk (revision 4280) +++ render/html.awk (nonexistent) @@ -1,117 +0,0 @@ -BEGIN { - print "" - print "" - print "" - print " sch-rnd developer manual - lihata file formats" - print "" - print "" - print "" -} - -function tbl_hdr(node, level) -{ - print " type:name value ver description" -} - -function get_valtype(node, vt) -{ - vt = DATA[node "/valtype"] - if (vt != "") - vt = "" vt "" - else - vt = " " - return vt -} - -function tbl_entry(node, level, parent ,nm,vt,dsc,ty,vr) -{ - if (!(node in NAME)) { - print "Error: path not found: " node > "/dev/stderr" - return - } - ty = DATA[node "/type"] - nm = get_name(node, ty, level) - vt = get_valtype(node) - vr = DATA[node "/ver"] - if (vr == "") vr = " " - dsc = qstrip(DATA[node "/desc"]) - print " " nm " " vt " " vr " " dsc -} - -function tbl_entry_link(node, dst, level, parent ,nm,vt,dsc,ty,vr) -{ - if (!(node in NAME)) { - print "Error: path not found: " node > "/dev/stderr" - return - } - if (!(dst in NAME)) { - print "Error: path not found: " dst > "/dev/stderr" - return - } - - ty = DATA[dst "/type"] - nm = get_name(node, ty, level) - vt = get_valtype(dst) - vr = DATA[dst "/ver"] - if (vr == "") vr = " " - dsc = qstrip(DATA[dst "/desc"]) - print " " nm " " vt " " vr " " dsc " -> " -} - -function gen_main(path, v, n, N) -{ - print "

" DATA[path "/type"] ":" NAME[path] "

" -# print "

" -# print qstrip(DATA[path "/desc"]) - print "

" - print "" - tbl_hdr() - tbl_entry(path, 0) - gen_sub(path, 1) - print "
" -} - -function gen_roots(rpath, v, n, N) -{ - v = children(N, rpath) - for(n = 1; n <= v; n++) { - if (N[n] "/hide" in NAME) - continue - gen_main(N[n]) - } -} - -function gen_types(path, v, n, N, node) -{ - print "" - print "" - print "
type description" - - v = children(N, path) - for(n = 1; n <= v; n++) { - node = N[n] - print "
" NAME[node] - print " " qstripnl(DATA[node]) - } - print "
" -} - - -END { - print "

File format root nodes

" - print "

Each table below describes the full tree of one of the sch-rnd file formats, from the root." - gen_roots("/lht_tree_doc/roots") - - print "

Common subtrees

" - print "

Each table below describes a subtree that usually does not specify a whole tree (thus they are usually not a valid file on their own). These subtrees are described in a separate table because they are used from multiple other trees." - gen_roots("/lht_tree_doc/comm") - - print "

Types

" - print "

" - gen_types("/lht_tree_doc/types") - - print "

Comments

" - print "

ver column: Format version range the subtree may appear in." - print "" - print "" -} Index: render/dot.awk =================================================================== --- render/dot.awk (revision 4280) +++ render/dot.awk (nonexistent) @@ -1,99 +0,0 @@ -BEGIN { - nl = "\\n" -} - -function tbl_entry(node, level, nparent ,nm,vt,dsc,ty,vr, url, tip,duppar,grp,grp_parent) -{ - ty = DATA[node "/type"] - nm = get_name(node, ty, 0) - vt = DATA[node "/valtype"] - vr = DATA[node "/ver"] - grp_parent = parent(parent(node)) - grp = DATA[grp_parent "/dot_group"] - dsc = qstrip(DATA[node "/desc"]) - gsub("\"", "\\\"", dsc) - tip=" tooltip=" q dsc q - url=" URL=" q "tree.html#" node q - - if (dupd_prefix != "") { - node = dupd_prefix node - DUPD[node] ++ - - if (nparent != "") { - duppar = dupd_prefix nparent - if (duppar in DUPD) - nparent = duppar - } - } - - print " " q node q " [label=" q nm nl vt nl vr q url tip "]" >fn - if (nparent != "") - print " " q nparent q " -> " q node q > fn - if (grp != "") { - if (LAST_GRP_SIBL[nparent] != "") { - print " " q LAST_GRP_SIBL[nparent] q " -> " q node q "[style=invis]" > fn - } - LAST_GRP_SIBL[nparent] = node - } -} - -function tbl_entry_link(node, dst, level, parent ,nm,vt,dsc,ty,vr,contid,url,tip,dr) -{ - ty = DATA[node "/type"] - nm = get_name(node, ty, 0) - vt = DATA[node "/valtype"] - vr = DATA[node "/ver"] - dsc = qstrip(DATA[node "/desc"]) - gsub("\"", "\\\"", dsc) - dr = dst - sub("^.*/", "", dr) - url=" URL=" q dr ".svg" q - tip=" tooltip=" q dsc q - - - if (dupd_prefix != "") { - node = dupd_prefix node - DUPD[node] ++ - - if (parent != "") { - duppar = dupd_prefix parent - if (duppar in DUPD) - parent = duppar - } - } - - - print " " q node q " [label=" q nm " ->" nl vt nl vr nl q url tip " shape=plaintext]" >fn - if (parent != "") - print " " q parent q " -> " q node q > fn -} - -function gen_graph(rpath, v, n, N, name) -{ - name = get_name(rpath, DATA[rpath "/type"]) - fn=name - sub(".*[:/]", "", fn) - gsub("[*]", "", fn) - fn = "../" fn ".dot" - - print "digraph " q name q " {" > fn - tbl_entry(rpath, 0) - gen_sub(rpath, 1) - print "}" > fn - close(fn) -} - -function gen_graphs(rpath, v, n, N, name) -{ - v = children(N, rpath) - for(n = 1; n <= v; n++) { - if (N[n] "/hide" in NAME) - continue - gen_graph(N[n]) - } -} - -END { - gen_graphs("/lht_tree_doc/roots") - gen_graphs("/lht_tree_doc/comm") -} Index: render/lht.awk =================================================================== --- render/lht.awk (revision 4280) +++ render/lht.awk (nonexistent) @@ -1,62 +0,0 @@ -BEGIN { - q="\"" -} - -function parent(path) -{ - sub("/[^/]*$", "", path) - return path -} - -function children(DST, path) -{ - return split(CHILDREN[path], DST, "[|]") -} - -function sy_is_recursive(path, dp) -{ - dp = DATA[path] - gsub("/[0-9]::", "/", path) - if (path ~ dp) - rturn 1 - return 0 -} - -function sy_href(path) -{ - return "#" path -} - -(($1 == "open") || ($1 == "data")) { - path=$3 - gsub("[0-9]+::", "", path) - TYPE[path] = $2 - p = parent(path) - if (CHILDREN[p] == "") - CHILDREN[p] = path - else - CHILDREN[p] = CHILDREN[p] "|" path - data=$4 - gsub("\\\\057", "/", data) - DATA[path] = data - - name=$3 - sub("^.*/", "", name) - sub(".*::", "", name) - NAME[path] = name -} - -function qstrip(s) -{ - gsub("[\\\\]+164", " ", s) - gsub("[\\\\]n", " ", s) - return s -} - -function qstripnl(s) -{ - gsub("[\\\\]+164", " ", s) - gsub("[\\\\]n", "\n", s) - return s -} - Index: render/render.sh =================================================================== --- render/render.sh (revision 4280) +++ render/render.sh (nonexistent) @@ -1,6 +0,0 @@ -#!/bin/sh - -for n in ../*.lht -do - lhtflat < $n -done | tee Flat | awk -F "[\t]" -f lht.awk -f common.awk -f $1.awk Property changes on: render/render.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: render/common.awk =================================================================== --- render/common.awk (revision 4280) +++ render/common.awk (nonexistent) @@ -1,69 +0,0 @@ -function get_name(node, ty, level) -{ - if (node "/name" in DATA) - nm = DATA[node "/name"] - else - nm = qstrip(NAME[node]) - if (ty != "") - nm = ty ":" nm - while(level > 0) { - nm = " " nm - level-- - } - return nm -} - -function dup_begin(DUPSAV) -{ - DUPSAV[1] = dupd_prefix - if (DUPSAV[1] == "") - dupd_prefix = "dup" ++uniq_node_name "_" -} - -function dup_end(DUPSAV) -{ - dupd_prefix = DUPSAV[1] -} - -function gen_sub(root, level, parent, v, n, N, node, dst_children, DUPSAV) -{ - if (!(root in NAME)) { - print "Error: path not found: " root > "/dev/stderr" - return - } - if (parent == "") - parent = root - v = children(N, root "/children") - for(n = 1; n <= v; n++) { - node = N[n] - if (TYPE[node] == "symlink") { - # normal node symlink: generate a link -# print "SY:" node " " DATA[node] "^^^" sy_is_recursive(node) > "/dev/stderr" - dup_begin(DUPSAV) - if (NAME[node] ~ "@dup") { - tbl_entry(DATA[node], level, parent) - gen_sub(DATA[node], level+1) - } - else - tbl_entry_link(node, DATA[node], level, parent) - dup_end(DUPSAV) - } - else if ((node "/children") in NAME) { - tbl_entry(node, level, parent) - if (TYPE[node "/children"] == "symlink") { - dup_begin(DUPSAV) - dst_children = DATA[node "/children"] - sub("/children$", "", dst_children) - gen_sub(dst_children, level+1, node) - dup_end(DUPSAV) - } - else { - gen_sub(node, level+1) - } - } - else if (TYPE[node] == "hash") - tbl_entry(node, level, parent) - else - print "Unhandled child (unknown type): " node > "/dev/stderr" - } -} Index: lihata_format/render/common.awk =================================================================== --- lihata_format/render/common.awk (nonexistent) +++ lihata_format/render/common.awk (revision 4281) @@ -0,0 +1,69 @@ +function get_name(node, ty, level) +{ + if (node "/name" in DATA) + nm = DATA[node "/name"] + else + nm = qstrip(NAME[node]) + if (ty != "") + nm = ty ":" nm + while(level > 0) { + nm = " " nm + level-- + } + return nm +} + +function dup_begin(DUPSAV) +{ + DUPSAV[1] = dupd_prefix + if (DUPSAV[1] == "") + dupd_prefix = "dup" ++uniq_node_name "_" +} + +function dup_end(DUPSAV) +{ + dupd_prefix = DUPSAV[1] +} + +function gen_sub(root, level, parent, v, n, N, node, dst_children, DUPSAV) +{ + if (!(root in NAME)) { + print "Error: path not found: " root > "/dev/stderr" + return + } + if (parent == "") + parent = root + v = children(N, root "/children") + for(n = 1; n <= v; n++) { + node = N[n] + if (TYPE[node] == "symlink") { + # normal node symlink: generate a link +# print "SY:" node " " DATA[node] "^^^" sy_is_recursive(node) > "/dev/stderr" + dup_begin(DUPSAV) + if (NAME[node] ~ "@dup") { + tbl_entry(DATA[node], level, parent) + gen_sub(DATA[node], level+1) + } + else + tbl_entry_link(node, DATA[node], level, parent) + dup_end(DUPSAV) + } + else if ((node "/children") in NAME) { + tbl_entry(node, level, parent) + if (TYPE[node "/children"] == "symlink") { + dup_begin(DUPSAV) + dst_children = DATA[node "/children"] + sub("/children$", "", dst_children) + gen_sub(dst_children, level+1, node) + dup_end(DUPSAV) + } + else { + gen_sub(node, level+1) + } + } + else if (TYPE[node] == "hash") + tbl_entry(node, level, parent) + else + print "Unhandled child (unknown type): " node > "/dev/stderr" + } +} Index: lihata_format/render/dot.awk =================================================================== --- lihata_format/render/dot.awk (nonexistent) +++ lihata_format/render/dot.awk (revision 4281) @@ -0,0 +1,99 @@ +BEGIN { + nl = "\\n" +} + +function tbl_entry(node, level, nparent ,nm,vt,dsc,ty,vr, url, tip,duppar,grp,grp_parent) +{ + ty = DATA[node "/type"] + nm = get_name(node, ty, 0) + vt = DATA[node "/valtype"] + vr = DATA[node "/ver"] + grp_parent = parent(parent(node)) + grp = DATA[grp_parent "/dot_group"] + dsc = qstrip(DATA[node "/desc"]) + gsub("\"", "\\\"", dsc) + tip=" tooltip=" q dsc q + url=" URL=" q "tree.html#" node q + + if (dupd_prefix != "") { + node = dupd_prefix node + DUPD[node] ++ + + if (nparent != "") { + duppar = dupd_prefix nparent + if (duppar in DUPD) + nparent = duppar + } + } + + print " " q node q " [label=" q nm nl vt nl vr q url tip "]" >fn + if (nparent != "") + print " " q nparent q " -> " q node q > fn + if (grp != "") { + if (LAST_GRP_SIBL[nparent] != "") { + print " " q LAST_GRP_SIBL[nparent] q " -> " q node q "[style=invis]" > fn + } + LAST_GRP_SIBL[nparent] = node + } +} + +function tbl_entry_link(node, dst, level, parent ,nm,vt,dsc,ty,vr,contid,url,tip,dr) +{ + ty = DATA[node "/type"] + nm = get_name(node, ty, 0) + vt = DATA[node "/valtype"] + vr = DATA[node "/ver"] + dsc = qstrip(DATA[node "/desc"]) + gsub("\"", "\\\"", dsc) + dr = dst + sub("^.*/", "", dr) + url=" URL=" q dr ".svg" q + tip=" tooltip=" q dsc q + + + if (dupd_prefix != "") { + node = dupd_prefix node + DUPD[node] ++ + + if (parent != "") { + duppar = dupd_prefix parent + if (duppar in DUPD) + parent = duppar + } + } + + + print " " q node q " [label=" q nm " ->" nl vt nl vr nl q url tip " shape=plaintext]" >fn + if (parent != "") + print " " q parent q " -> " q node q > fn +} + +function gen_graph(rpath, v, n, N, name) +{ + name = get_name(rpath, DATA[rpath "/type"]) + fn=name + sub(".*[:/]", "", fn) + gsub("[*]", "", fn) + fn = "../" fn ".dot" + + print "digraph " q name q " {" > fn + tbl_entry(rpath, 0) + gen_sub(rpath, 1) + print "}" > fn + close(fn) +} + +function gen_graphs(rpath, v, n, N, name) +{ + v = children(N, rpath) + for(n = 1; n <= v; n++) { + if (N[n] "/hide" in NAME) + continue + gen_graph(N[n]) + } +} + +END { + gen_graphs("/lht_tree_doc/roots") + gen_graphs("/lht_tree_doc/comm") +} Index: lihata_format/render/html.awk =================================================================== --- lihata_format/render/html.awk (nonexistent) +++ lihata_format/render/html.awk (revision 4281) @@ -0,0 +1,117 @@ +BEGIN { + print "" + print "" + print "" + print " sch-rnd developer manual - lihata file formats" + print "" + print "" + print "" +} + +function tbl_hdr(node, level) +{ + print " type:name value ver description" +} + +function get_valtype(node, vt) +{ + vt = DATA[node "/valtype"] + if (vt != "") + vt = "" vt "" + else + vt = " " + return vt +} + +function tbl_entry(node, level, parent ,nm,vt,dsc,ty,vr) +{ + if (!(node in NAME)) { + print "Error: path not found: " node > "/dev/stderr" + return + } + ty = DATA[node "/type"] + nm = get_name(node, ty, level) + vt = get_valtype(node) + vr = DATA[node "/ver"] + if (vr == "") vr = " " + dsc = qstrip(DATA[node "/desc"]) + print " " nm " " vt " " vr " " dsc +} + +function tbl_entry_link(node, dst, level, parent ,nm,vt,dsc,ty,vr) +{ + if (!(node in NAME)) { + print "Error: path not found: " node > "/dev/stderr" + return + } + if (!(dst in NAME)) { + print "Error: path not found: " dst > "/dev/stderr" + return + } + + ty = DATA[dst "/type"] + nm = get_name(node, ty, level) + vt = get_valtype(dst) + vr = DATA[dst "/ver"] + if (vr == "") vr = " " + dsc = qstrip(DATA[dst "/desc"]) + print " " nm " " vt " " vr " " dsc " -> " +} + +function gen_main(path, v, n, N) +{ + print "

" DATA[path "/type"] ":" NAME[path] "

" +# print "

" +# print qstrip(DATA[path "/desc"]) + print "

" + print "" + tbl_hdr() + tbl_entry(path, 0) + gen_sub(path, 1) + print "
" +} + +function gen_roots(rpath, v, n, N) +{ + v = children(N, rpath) + for(n = 1; n <= v; n++) { + if (N[n] "/hide" in NAME) + continue + gen_main(N[n]) + } +} + +function gen_types(path, v, n, N, node) +{ + print "" + print "" + print "
type description" + + v = children(N, path) + for(n = 1; n <= v; n++) { + node = N[n] + print "
" NAME[node] + print " " qstripnl(DATA[node]) + } + print "
" +} + + +END { + print "

File format root nodes

" + print "

Each table below describes the full tree of one of the sch-rnd file formats, from the root." + gen_roots("/lht_tree_doc/roots") + + print "

Common subtrees

" + print "

Each table below describes a subtree that usually does not specify a whole tree (thus they are usually not a valid file on their own). These subtrees are described in a separate table because they are used from multiple other trees." + gen_roots("/lht_tree_doc/comm") + + print "

Types

" + print "

" + gen_types("/lht_tree_doc/types") + + print "

Comments

" + print "

ver column: Format version range the subtree may appear in." + print "" + print "" +} Index: lihata_format/render/lht.awk =================================================================== --- lihata_format/render/lht.awk (nonexistent) +++ lihata_format/render/lht.awk (revision 4281) @@ -0,0 +1,62 @@ +BEGIN { + q="\"" +} + +function parent(path) +{ + sub("/[^/]*$", "", path) + return path +} + +function children(DST, path) +{ + return split(CHILDREN[path], DST, "[|]") +} + +function sy_is_recursive(path, dp) +{ + dp = DATA[path] + gsub("/[0-9]::", "/", path) + if (path ~ dp) + rturn 1 + return 0 +} + +function sy_href(path) +{ + return "#" path +} + +(($1 == "open") || ($1 == "data")) { + path=$3 + gsub("[0-9]+::", "", path) + TYPE[path] = $2 + p = parent(path) + if (CHILDREN[p] == "") + CHILDREN[p] = path + else + CHILDREN[p] = CHILDREN[p] "|" path + data=$4 + gsub("\\\\057", "/", data) + DATA[path] = data + + name=$3 + sub("^.*/", "", name) + sub(".*::", "", name) + NAME[path] = name +} + +function qstrip(s) +{ + gsub("[\\\\]+164", " ", s) + gsub("[\\\\]n", " ", s) + return s +} + +function qstripnl(s) +{ + gsub("[\\\\]+164", " ", s) + gsub("[\\\\]n", "\n", s) + return s +} + Index: lihata_format/render/render.sh =================================================================== --- lihata_format/render/render.sh (nonexistent) +++ lihata_format/render/render.sh (revision 4281) @@ -0,0 +1,6 @@ +#!/bin/sh + +for n in ../*.lht +do + lhtflat < $n +done | tee Flat | awk -F "[\t]" -f lht.awk -f common.awk -f $1.awk Property changes on: lihata_format/render/render.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property