7 # shift remaining arguments up
8 for (i = ARGC; i > ARGIND; i--)
11 # make sure gawk knows to keep going
14 # make current file next to get done
15 ARGV[ARGIND+1] = FILENAME
20 if (x ~ /^static\s*(int|gint)\s*hf_(.*)=\s*-1/) {
21 hf = gensub(/^static\s*(int|gint)\s*(\S*).*/, "\\2", "g", x)
26 if (x ~ /\{\s*&hf_(.*)/) {
27 hf = gensub(/\s*\{\s*\&(.*),(.*)/, "\\1", "g", x)
30 hf_descr = gensub(/\s*\{\s*\&(.*),(.*)/, "\\2", "g", x)
34 hf_descr = hf_descr "\n" x
35 # XXX, below regex should check if we have { hf description }},
36 } while (!(hf_descr ~ /[^{}]*}[^{}]*}[^{}]*,/))
39 hf_descr = gensub(/}\S*},/, "}", "g", hf_descr);
46 print "#define NEW_PROTO_TREE_API"
47 print "converted " length(HFS) > "/dev/stderr"
56 if (x ~ /^static\s*(int|gint)\s*hf_(.*)=\s*-1/) {
57 hf = gensub(/^static\s*(int|gint)\s*(\S*).*/, "\\2", "g", x)
58 ## XXX, it can have some comment or smth, copy?
60 if (hf in HFS && HFS[hf] != "") {
61 print "static header_field_info " gensub("^hf_", "hfi_", "g", hf) " THIS_HF_INIT =" HFS[hf] ";"
67 else if (x ~ /\{\s*&hf_(.*)/) {
68 hf = gensub(/\s*\{\s*\&(.*),(.*)/, "\\1", "g", x)
72 new_x = gensub(/(\s*)\{\s*\&hf_(.*),(.*)/, "\\1\\&" "hfi_" "\\2" ",", "g", x)
74 hf_descr = gensub(/\s*\{\s*\&(.*),(.*)/, "\\2", "g", x)
78 hf_descr = hf_descr "\n" x
79 } while (!(hf_descr ~ /}/))
86 print gensub("hf_", "\\&hfi_", "g", x)