Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- TMP_DOIT=`mktemp`
- CPP_FLAG=IMT_BCM_PHY_UNTESTED_CODE
- export XX='#ifdef '$CPP_FLAG''
- export YY='#else \/* '$CPP_FLAG' *\/\nreturn 0;\n#endif \/* '$CPP_FLAG' *\/'
- export ZZ="\s+|^"
- if true; then
- rm -fr gallardo40
- cpdir /home/raphya/BLD/broadcom-sdk/libs/phymod/chip/quadra28 gallardo40
- for dir in `find gallardo40 -type d `
- do
- ndir=`echo $dir | sed -e 's/quadra28/gallardo40/g'`
- (cd $dir || cd $ndir && ls -A -C1|sed -n -e "/quadra28/p" -e "s/quadra28/gallardo40/p" |xargs -n2 mv )
- done
- fi
- # Create function list and source file list
- ctags -x --c-kinds=fp -R gallardo40 |awk '{print $1}' |sort |uniq > raw3.txt
- FLIST="`find gallardo40 -name "*.c" -o -name "*_c.h" | tr '\n' ' ' ` "
- # Part2
- # Mark function tail
- sed -i -e "s/^}$/@@}/" $FLIST
- ### init head to script
- echo "perl -0777 -i -p \\" > $TMP_DOIT
- # Add Generated Function Specific Script
- 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
- ### add tail to script
- echo "$FLIST" >> $TMP_DOIT
- # Execute script
- sh $TMP_DOIT
- # UnMark function tail
- sed -i -e "s/@@}/}/" $FLIST
- # Part3
- ### init head to script
- echo "perl -0777 -i -p \\" > $TMP_DOIT
- # Add Generated Function Specific Script
- 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
- ### add tail to script
- # Re-Create header and source file list
- FLIST="`find gallardo40 -name "*.c" -o -name "*.h" | tr '\n' ' ' ` "
- echo "$FLIST" >> $TMP_DOIT
- # Execute script
- sh $TMP_DOIT
- # Re-Create header and source file list
- FLIST="`find gallardo40 -name "*.c" -o -name "*.h" | tr '\n' ' ' ` "
- sed -i -e "s/quara28/gallardo40/g" $FLIST
- sed -i -e "s/quadra28/gallardo40/g" $FLIST
- sed -i -e "s/QUADRA28/GALLARDO40/g" $FLIST
- sed -i -e "s/Quadra28/Gallardo40/g" $FLIST
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement