Index: trunk/scconfig/gen_conf.sh =================================================================== --- trunk/scconfig/gen_conf.sh (revision 33456) +++ trunk/scconfig/gen_conf.sh (nonexistent) @@ -1,206 +0,0 @@ -#!/bin/sh - -# TODO: rewrite this in C for better portability - -if test -z "$AWK" -then - AWK="awk" -fi - -# Trickery: the name (for path) of the current struct is learned only at -# the end, when the struct is closed because struct type names would be -# global and pollute the namespace while variable names are local. So to -# pick up trailing variable names: -# - each struct gets an integer uid, 0 being the root; structs remember -# their ancestry using PARENT[uid]. -# - each entry is remembered in an SRC[uid, n], where n is between 0 -# and LEN[uid] -# - the output is build in END{} after loading everything into those arrays - - -$AWK -v "docdir=$1" ' - BEGIN { - level = -1 - q = "\"" - cm = "," - uids = 0 - stderr = "/dev/stderr" - } - - function doc_head(fn, path) - { - if (fn in DOCS) - return - DOCS[fn]++ - print "" > fn - print "

pcb-rnd conf tree

" > fn - print "

subtree: " path "

" > fn - print "" > fn - print "
node name type flags description" > fn - - } - - function doc_foot(fn) - { - print "
" > fn - } - - function gen(path, src_line,state_tags, id, name, type, array, desc, flags,path_tmp,type2,fn) - { - name=src_line - sub("^.*CFT_", "RND_CFN_", name) - sub(";.*", "", name) - type=name - sub("[ \t]*[^ \t]*$", "", type) - sub("[^ \t]*[ \t]*", "", name) - array = (name ~ "[[]") - if (array) - sub("[[].*$", "", name) - id = path - sub("^/", "", id) - gsub("/", ".", id) - id = id "." name - - desc = src_line - if (desc ~ "/[*]") { - sub("^.*/[*]", "", desc) - sub("[*]/.*$", "", desc) - sub("^[ \t]*", "", desc) - sub("[ \t]*$", "", desc) - } - else - desc = "" - if (desc == "") - desc = "<" name ">" - - flags = ""; - while(match(desc, "@[a-zA-Z_]+")) { - flag=substr(desc, RSTART, RLENGTH) - sub("[ \t]*" flag "[ \t]*", " ", desc) - sub("^@", "",flag) - flag="RND_CFF_" toupper(flag) - if (flags == "") - flags = flag - else - flags = flags " | " flag - } - if (flags == "") - flags = 0; - sub("^[ \t]*", "", desc) - sub("[ \t]*$", "", desc) - - path_tmp=path - sub("^/", "", path_tmp) - printf("conf_reg(%-36s %s %-16s %-25s %-25s %s, %s)\n", id cm, (array ? "array, " : "scalar,"), type cm, q path_tmp q cm, q name q cm, q desc q, flags) - if (docdir != "") { - path_tmp2 = path_tmp - gsub("/", "_", path_tmp2) - fn = docdir "/" path_tmp2 ".html" - doc_head(fn, path_tmp) - type2 = tolower(type) - sub("^cfn_", "", type2) - - print "", name, "", type2, "", flags, "", state_tags desc > fn - } - } - - function push_uid() - { - level++ - UID_STACK[level] = uid - } - - function pop_uid() - { - level-- - uid = UID_STACK[level] - } - - function gen_path(uid ,path) { - path = "" - while(LEVEL[uid] > 0) { - path = NAME[uid] "/" path - uid = PARENT[uid] - } - sub("/$", "", path) - return path - } - - # structs on the first level must be const - /struct/ && (level == 0) { - if (!($0 ~ "struct *[a-z_]*temp_s")) { # special case for core/librnd temp storage - tmp=$0 - sub("struct.*$", "", tmp) - if (!(tmp ~ "const")) { - print "First level structs must be const in line", NR > stderr - exit 1 - } - } - } - - /[{]/ { - uid = uids++ - LEN[uid] = 0 - push_uid() - } - - /^[ \t]*[\/][\/]/ { next } - - /CFT_/ { - SRC[uid, LEN[uid]] = $0 - - state_tags = "" - for(st in STATE) - if (STATE[st]) state_tags=state_tags "," st - if (state_tags != "") { - sub("^,", "[", state_tags) - state_tags = state_tags "] " - } - SRC_STATE[uid, LEN[uid]] = state_tags - LEN[uid]++ - } - - /[}]/ { - name = $0 - sub(".*}[ \t]*", "", name) - sub("[ \t{].*", "", name) - sub(";.*", "", name); - - PARENT[uid] = UID_STACK[level-1] - NAME[uid] = name - LEVEL[uid] = level - - pop_uid() - } - - /@conf_gen.sh:/ { - sub(".*@conf_gen.sh: *", "", $0) - sub("[*]/", "", $0) - if ($1 == "begin") - STATE[$2] = 1 - else if ($1 == "end") - STATE[$2] = 0 - else - print "Unknown @conf_gen.sh directive:", $0 > stderr - } - - - END { - if (level != -1) - print "Error: unbalanced braces" > "/dev/stderr" - - if (LEN[0] != 0) { - for(n = 0; n < LEN[0]; n++) - print "gen_conf ERROR: ignoring line \"" SRC[0, n] "\" in root - needs to be within a struct" > stderr - } - - for(uid = 0; uid < uids; uid++) { - path = gen_path(uid) - for(n = 0; n < LEN[uid]; n++) - gen(path, SRC[uid, n], SRC_STATE[uid, n]) - } - - for(fn in DOCS) - doc_foot(fn) - } -' Property changes on: trunk/scconfig/gen_conf.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 33456) +++ trunk/src/Makefile.in (revision 33457) @@ -236,6 +236,7 @@ SPHASH_PATH=$(ROOT)/src_3rd/librnd-local/src_3rd/sphash SPHASH=$(SPHASH_PATH)/sphash PUPLUG=$(ROOT)/src_3rd/librnd-local/src_3rd/puplug/util/puplug +GENCONF=$(ROOT)/src_3rd/librnd-local/src/librnd/scconfig/gen_conf.sh LIBMINUID_CFLAGS=@/local/pcb/CFLAGS_GENERIC@ LIBMINUID_LDFLAGS=@cc/ldflags@ GENLIST_CFLAGS=@/local/pcb/CFLAGS_GENERIC@ @@ -332,13 +333,13 @@ all-local: pcbtest.sh conf_core_fields.h: conf_core.h $(ROOT)/doc/conf/tree/rc.html - AWK=@/host/fstools/awk@ $(ROOT)/scconfig/gen_conf.sh < conf_core.h > conf_core_fields.h + AWK=@/host/fstools/awk@ $(GENCONF) < conf_core.h > conf_core_fields.h $(LIBRND)/core/hidlib_conf_fields.h: $(LIBRND)/core/hidlib_conf.h $(ROOT)/doc/conf/tree/rc.html - AWK=@/host/fstools/awk@ $(ROOT)/scconfig/gen_conf.sh < $(LIBRND)/core/hidlib_conf.h > $(LIBRND)/core/hidlib_conf_fields.h + AWK=@/host/fstools/awk@ $(GENCONF) < $(LIBRND)/core/hidlib_conf.h > $(LIBRND)/core/hidlib_conf_fields.h $(ROOT)/doc/conf/tree/rc.html: $(LIBRND)/core/hidlib_conf.h conf_core.h - cat conf_core.h $(LIBRND)/core/hidlib_conf.h | AWK=@/host/fstools/awk@ $(ROOT)/scconfig/gen_conf.sh $(ROOT)/doc/conf/tree > /dev/null + cat conf_core.h $(LIBRND)/core/hidlib_conf.h | AWK=@/host/fstools/awk@ $(GENCONF) $(ROOT)/doc/conf/tree > /dev/null conf_internal.c: pcb-conf.lht $(CQUOTE) $(CQUOTE) -n pcb_conf_internal < pcb-conf.lht > conf_internal.c Index: trunk/tests/conf/Makefile =================================================================== --- trunk/tests/conf/Makefile (revision 33456) +++ trunk/tests/conf/Makefile (revision 33457) @@ -24,8 +24,8 @@ all: conftest -conftest: $(OBJS) $(LIB_HIDLIB) $(LIB_PCBRND_OBJS) $(LIBGENHT) - $(CC) $(LDFLAGS) $(OBJS) $(LIB_PCBRND_OBJS) $(LIB_HIDLIB) $(LIBGENHT) $(LDLIBS) -o conftest +conftest: $(OBJS) $(LIB_HIDLIB) $(LIB_PCBRND_OBJS) + $(CC) $(LDFLAGS) $(OBJS) $(LIB_PCBRND_OBJS) $(LIB_HIDLIB) $(LDLIBS) -o conftest conftest.o: conftest.c $(DEPH) $(CC) $(CFLAGS) -c conftest.c -o conftest.o Index: trunk/util/gsch2pcb-rnd/Makefile.in =================================================================== --- trunk/util/gsch2pcb-rnd/Makefile.in (revision 33456) +++ trunk/util/gsch2pcb-rnd/Makefile.in (revision 33457) @@ -9,6 +9,7 @@ ROOT=../.. PLUGDIR=../../src_plugins LIBRND=../../@/local/pcb/librnd_root@/librnd +GENCONF=$(LIBRND)/scconfig/gen_conf.sh include $(LIBRND)/core/librnd.mak @@ -93,7 +94,7 @@ gsch2pcb.o: gsch2pcb_rnd_conf_fields.h gsch2pcb_rnd_conf_fields.h: gsch2pcb_rnd_conf.h - AWK=@/host/fstools/awk@ ../../scconfig/gen_conf.sh < gsch2pcb_rnd_conf.h > gsch2pcb_rnd_conf_fields.h + AWK=@/host/fstools/awk@ $(GENCONF) < gsch2pcb_rnd_conf.h > gsch2pcb_rnd_conf_fields.h install_all: $(SCCBOX) mkdir -p "$(BINDIR)" "$(LIBDIR)"