Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. #!/bin/sh
  2. TMP_DOIT=`mktemp`
  3. CPP_FLAG=IMT_BCM_PHY_UNTESTED_CODE
  4. export XX='#ifdef '$CPP_FLAG''
  5. export YY='#else \/* '$CPP_FLAG' *\/\nreturn 0;\n#endif \/* '$CPP_FLAG' *\/'
  6. export ZZ="\s+|^"
  7.  
  8. if true; then
  9. rm -fr gallardo40
  10. cpdir /home/raphya/BLD/broadcom-sdk/libs/phymod/chip/quadra28 gallardo40
  11. for dir in `find gallardo40 -type d `
  12. do
  13. ndir=`echo $dir | sed -e 's/quadra28/gallardo40/g'`
  14. (cd $dir || cd $ndir && ls -A -C1|sed -n -e "/quadra28/p" -e "s/quadra28/gallardo40/p" |xargs -n2 mv )
  15. done
  16. fi
  17.  
  18. # Create function list and source file list
  19. ctags -x --c-kinds=fp -R gallardo40 |awk '{print $1}' |sort |uniq > raw3.txt
  20. FLIST="`find gallardo40 -name "*.c" -o -name "*_c.h" | tr '\n' ' ' ` "
  21.  
  22. # Part2
  23. # Mark function tail
  24. sed -i -e "s/^}$/@@}/" $FLIST
  25. ### init head to script
  26. echo "perl -0777 -i -p \\" > $TMP_DOIT
  27. # Add Generated Function Specific Script
  28. perl -ne ' chomp $_; printf (" -e \" s/((%s)%s[^(]*[(][^{]*[{])([^@]*)[@][@][}]/\\\$1\\n%s\\n\\\$3\\n%s\\n@@}\/ ; \" \\\n", $ENV{ZZ}, $_, $ENV{XX}, $ENV{YY}); ' raw3.txt >> $TMP_DOIT
  29. ### add tail to script
  30. echo "$FLIST" >> $TMP_DOIT
  31. # Execute script
  32. sh $TMP_DOIT
  33. # UnMark function tail
  34. sed -i -e "s/@@}/}/" $FLIST
  35.  
  36.  
  37. # Part3
  38. ### init head to script
  39. echo "perl -0777 -i -p \\" > $TMP_DOIT
  40. # Add Generated Function Specific Script
  41. perl -ne ' chomp $_; next if (/phymod/); next if (/q28_/) ; next if (/quara28_/); unless (/quadra28/) { printf (" -e \" s/%s/_uniq_quadra28_%s/g ; \" \\\n", $_, $_) } ; ' raw3.txt >> $TMP_DOIT
  42. ### add tail to script
  43. # Re-Create header and source file list
  44. FLIST="`find gallardo40 -name "*.c" -o -name "*.h" | tr '\n' ' ' ` "
  45. echo "$FLIST" >> $TMP_DOIT
  46. # Execute script
  47. sh $TMP_DOIT
  48.  
  49.  
  50. # Re-Create header and source file list
  51. FLIST="`find gallardo40 -name "*.c" -o -name "*.h" | tr '\n' ' ' ` "
  52.  
  53. sed -i -e "s/quara28/gallardo40/g" $FLIST
  54.  
  55. sed -i -e "s/quadra28/gallardo40/g" $FLIST
  56. sed -i -e "s/QUADRA28/GALLARDO40/g" $FLIST
  57. sed -i -e "s/Quadra28/Gallardo40/g" $FLIST
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement