Index: util/genref.sh =================================================================== --- util/genref.sh (revision 775) +++ util/genref.sh (revision 776) @@ -14,8 +14,20 @@ ' fn=$1 +root=$2 +shift 2 -c99tree awk \ +pkgfn=`basename $fn` +pkg=${pkgfn%%.h} +echo " + +

PCB GPMI

+

Reference manual for package $pkg

+Automatically generated from $pkgfn +" + + +c99tree awk -I$root "$@" \ --gtx 'events=([] /+ d=[type == DECL]) && (d / i=[name ~ "GPMI_EVENT"]) && (i .+ [type == TYPE] . a=[type == ARGLIST] ) && (d : [loc_is_local == "1"])' \ --gtx 'funcs=([] /+ d=[type == DECL]) && (d / i=[!name ~ "GPMI_EVENT"]) && (i .+ [type == TYPE] . a=[type == ARGLIST] ) && (d : [loc_is_local == "1"])' \ --paste "$prinit" $fn --awk-s ' @@ -79,6 +91,7 @@ } BEGIN { + pkg="'$pkg'" c99tree_unknown(TREE) gtx_init(TREE) @@ -85,6 +98,8 @@ # source=load("'$fn'") print "

Events

" + print "
" + print "

Events do not have return value. The first argument is always the even id" events = gtx_find_results(TREE, "events") for(r = 0; 1; r++) { if (gtx_get_map(TREE, MAP, events, r) == "") @@ -93,6 +108,7 @@ sub("^GPMI_EVENT__", "", id) proto = to_c(TREE, MAP["d"]) sub("^[ \t]*void[ \t]*GPMI_EVENT__", "", proto) + sub("[(]", "(int event_id,", proto) # proto = getsrc(source, MAP["d"]) print "

" proto "

" @@ -100,23 +116,39 @@ print get_pre_comment(TREE, MAP["a"]) print "" } + print "
" print "

Functions

" + print "
" + print "

The following functions are registered in script context." funcs = gtx_find_results(TREE, "funcs") for(r = 0; 1; r++) { if (gtx_get_map(TREE, MAP, funcs, r) == "") break id = TREE[MAP["i"], C99F_NAME] + if (id ~ "^package_" pkg "_") + continue + if (id ~ "^pkg_" pkg "_") + continue + sub("^GPMI_EVENT__", "", id) # print "" getsrc(source, MAP["d"]) "" proto = to_c(TREE, MAP["d"]) # proto = getsrc(source, MAP["d"]) + gsub("[(][ \t]*", "(", proto) print "

", proto, "

" print "
"
 		print get_pre_comment(TREE, MAP["a"])
 		print "
" } + print "
" } ' +echo " + + +" + +