asmsparc64.sh
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:1k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. #!/bin/sh
  2. # Translate the assembler syntax of sparc64 assembler programs
  3. # Usage: asmsparc < sparclinux-asm-file > portable-asm-file
  4. # The portable-asm-file has to be
  5. #   1. preprocessed,
  6. #   2. grep -v '^ *#line' | grep -v '^#'
  7. #   3. sed -e 's,% ,%,g' -e 's,//.*$,,' -e 's,$,#,g'
  8. tmpscript1=sed$$tmp1
  9. tmpscript2=sed$$tmp2
  10. tmpremove='rm -f $tmpscript1 $tmpscript2'
  11. trap "$tmpremove" 1 2 15
  12. cat > $tmpscript1 << EOF
  13. # ----------- Remove gcc self-identification
  14. /gcc2_compiled/d
  15. /gnu_compiled_c/d
  16. EOF
  17. cat > $tmpscript2 << EOF
  18. # ----------- Turn # into $, to avoid trouble in preprocessing
  19. s,#,$,g
  20. # ----------- Declare global symbols as functions (we have no variables)
  21. s/.global ([A-Za-z0-9_]*)$/.global 1
  22. DECLARE_FUNCTION(1)/
  23. EOF
  24. sed -f $tmpscript1 | 
  25. sed -f $tmpscript2
  26. eval "$tmpremove"