Index: trunk/doc/developer/lihata_board/render.sh
===================================================================
--- trunk/doc/developer/lihata_board/render.sh (revision 16838)
+++ trunk/doc/developer/lihata_board/render.sh (nonexistent)
@@ -1,234 +0,0 @@
-#!/bin/sh
-
-echo '
-
-
-'
-
-for n in *.lht
-do
- lhtflat < $n
-done | tee Flat | awk -F "[\t]" '
-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
-}
-
-function tbl_hdr(node, level)
-{
- print " type:name | value | ver | description"
-}
-
-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 get_valtype(node, vt)
-{
- vt = DATA[node "/valtype"]
- if (vt != "")
- vt = "" vt ""
- else
- vt = " "
- return vt
-}
-
-function tbl_entry(node, level ,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 ,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_sub(root, level, v, n, N, node, dst_children)
-{
- if (!(root in NAME)) {
- print "Error: path not found: " root > "/dev/stderr"
- return
- }
- 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"
- if (NAME[node] ~ "@dup") {
- tbl_entry(DATA[node], level)
- gen_sub(DATA[node], level+1)
- }
- else
- tbl_entry_link(node, DATA[node], level)
- }
- else if ((node "/children") in NAME) {
- tbl_entry(node, level)
- if (TYPE[node "/children"] == "symlink") {
- dst_children = DATA[node "/children"]
- sub("/children$", "", dst_children)
- gen_sub(dst_children, level+1)
- }
- else {
- gen_sub(node, level+1)
- }
- }
- else if (TYPE[node] == "hash")
- tbl_entry(node, level)
- else
- print "Unhandled child (unknown type): " node > "/dev/stderr"
- }
-}
-
-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 " type | description"
-
- v = children(N, path)
- for(n = 1; n <= v; n++) {
- node = N[n]
- print " |
---|
"
- 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 pcb-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")
-}
-
-'
-
-echo '
-
-
-'
Property changes on: trunk/doc/developer/lihata_board/render.sh
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: trunk/doc/developer/lihata_board/Makefile
===================================================================
--- trunk/doc/developer/lihata_board/Makefile (revision 16838)
+++ trunk/doc/developer/lihata_board/Makefile (revision 16839)
@@ -1,7 +1,7 @@
all: tree.html tree.txt
-tree.html: render.sh *.lht
- ./render.sh > tree.html
+tree.html: render/render.sh *.lht
+ cd render && ./render.sh > ../tree.html
tree.txt: tree.html
w3m -cols 256 tree.html > tree.txt
Index: trunk/doc/developer/lihata_board/render/render.sh
===================================================================
--- trunk/doc/developer/lihata_board/render/render.sh (nonexistent)
+++ trunk/doc/developer/lihata_board/render/render.sh (revision 16839)
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+echo '
+
+
+'
+
+for n in ../*.lht
+do
+ lhtflat < $n
+done | tee Flat | awk -F "[\t]" '
+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
+}
+
+function tbl_hdr(node, level)
+{
+ print " |
type:name | value | ver | description"
+}
+
+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 get_valtype(node, vt)
+{
+ vt = DATA[node "/valtype"]
+ if (vt != "")
+ vt = "" vt ""
+ else
+ vt = " "
+ return vt
+}
+
+function tbl_entry(node, level ,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 ,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_sub(root, level, v, n, N, node, dst_children)
+{
+ if (!(root in NAME)) {
+ print "Error: path not found: " root > "/dev/stderr"
+ return
+ }
+ 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"
+ if (NAME[node] ~ "@dup") {
+ tbl_entry(DATA[node], level)
+ gen_sub(DATA[node], level+1)
+ }
+ else
+ tbl_entry_link(node, DATA[node], level)
+ }
+ else if ((node "/children") in NAME) {
+ tbl_entry(node, level)
+ if (TYPE[node "/children"] == "symlink") {
+ dst_children = DATA[node "/children"]
+ sub("/children$", "", dst_children)
+ gen_sub(dst_children, level+1)
+ }
+ else {
+ gen_sub(node, level+1)
+ }
+ }
+ else if (TYPE[node] == "hash")
+ tbl_entry(node, level)
+ else
+ print "Unhandled child (unknown type): " node > "/dev/stderr"
+ }
+}
+
+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 " type | description"
+
+ v = children(N, path)
+ for(n = 1; n <= v; n++) {
+ node = N[n]
+ print " |
---|
"
+ 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 pcb-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")
+}
+
+'
+
+echo '
+
+
+'
Property changes on: trunk/doc/developer/lihata_board/render/render.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
|