5 # shift remaining arguments up
6 for (i = ARGC; i > ARGIND; i--)
9 # make sure gawk knows to keep going
12 # make current file next to get done
13 ARGV[ARGIND+1] = FILENAME
18 if (x ~ /^static\s*(int|gint)\s*hf_(.*)=\s*-1/) {
19 hf = gensub(/^static\s*(int|gint)\s*(\S*).*/, "\\2", "g", x)
24 if (x ~ /\{\s*&hf_(.*)/) {
25 hf = gensub(/\s*\{\s*\&(.*),(.*)/, "\\1", "g", x)
28 hf_descr = gensub(/\s*\{\s*\&(.*),(.*)/, "\\2", "g", x)
32 hf_descr = hf_descr "\n" x
33 # XXX, below regex should check if we have { hf description }},
34 } while (!(hf_descr ~ /[^{}]*}[^{}]*}[^{}]*,/))
37 hf_descr = gensub(/}\S*},/, "}", "g", hf_descr);
44 print "#define NEW_PROTO_TREE_API"
45 print "converted " length(HFS) > "/dev/stderr"
54 if (x ~ /^static\s*(int|gint)\s*hf_(.*)=\s*-1/) {
55 hf = gensub(/^static\s*(int|gint)\s*(\S*).*/, "\\2", "g", x)
56 ## XXX, it can have some comment or smth, copy?
58 if (hf in HFS && HFS[hf] != "") {
59 print "static header_field_info " gensub("^hf_", "hfi_", "g", hf) " THIS_HF_INIT =" HFS[hf] ";"
65 else if (x ~ /\{\s*&hf_(.*)/) {
66 hf = gensub(/\s*\{\s*\&(.*),(.*)/, "\\1", "g", x)
70 new_x = gensub(/(\s*)\{\s*\&hf_(.*),(.*)/, "\\1\\&" "hfi_" "\\2" ",", "g", x)
72 hf_descr = gensub(/\s*\{\s*\&(.*),(.*)/, "\\2", "g", x)
76 hf_descr = hf_descr "\n" x
77 } while (!(hf_descr ~ /}/))
84 print gensub("hf_", "\\&hfi_", "g", x)