check_asm.sh
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:1k
- #!/bin/sh
- case $1 in
- -printf)
- sed -n -e '/^#/d;/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/(unsigned|signed|struct)[ ]*//;s/([|__attribute__).*;[ ]*$//;s/(*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/
- /g' | sed 's/^[ *]*//;s/[ ]*$//;s/^.*$/printf ("#define AOFF_'$2'_ 0x%08x\n", check_asm_data[i++]); printf("#define ASIZ_'$2'_ 0x%08x\n", check_asm_data[i++]);/' >> $4
- echo "printf ("#define ASIZ_$2\t0x%08x\n", check_asm_data[i++]);" >> $4
- ;;
- -data)
- sed -n -e '/^#/d;/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/(unsigned|signed|struct)[ ]*//;s/([|__attribute__).*;[ ]*$//;s/(*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/
- /g' | sed 's/^[ *]*//;s/[ ]*$//;s/^.*$/ ((char *)&((struct '$2'_struct *)0)->