Home | History | Annotate | Download | only in strace
      1 #!/bin/sh
      2 
      3 convert() {
      4 	sed -n '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/{
      5 		s/^[[:space:]]*XLAT(\([^)]\+\)).*/\1/p
      6 		s/^[[:space:]]*{[[:space:]]*(\?\(1<<[^),[:space:]]\+\).*/\1/p
      7 		s/.*not NULL-terminated.*/#unterminated/p
      8 		s/^\([[:space:]]*{.*\)/\1/p
      9 		s/^\t*\( *[/*].*\)/\1/p}' "$f" >> xlat/"$n".in
     10 	sed -i '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/c #include "xlat/'"$n"'.h"' "$f"
     11 }
     12 
     13 for f; do
     14 	for n in $(sed -n 's/^\(static \)\?const struct xlat \([a-z0-9_]\+\)\[\] = {$/\2/p' "$f"); do
     15 		case "$n" in
     16 			cacheflush_flags|struct_user_offsets) # skip
     17 				;;
     18 			ioprio_class|ioprio_who|mtd_mode_options|personality_options|syslog_action_type|ubi_volume_props|ubi_volume_types)
     19 				echo '#unconditional' > xlat/"$n".in
     20 				convert
     21 				;;
     22 			*)
     23 				> xlat/"$n".in
     24 				convert
     25 				;;
     26 		esac
     27 	done
     28 done
     29