Moved header generation scripts to utils. Added astyle config.
This commit is contained in:
@@ -7,7 +7,7 @@ echo "* Institution: BFH Bern University of Applied Sciences"
|
|||||||
echo "* File: $1"
|
echo "* File: $1"
|
||||||
echo "*"
|
echo "*"
|
||||||
echo "* Version History:"
|
echo "* Version History:"
|
||||||
echo "* Date Autor Email SHA Changes"
|
echo "* Date Autor Email SHA Changes"
|
||||||
|
|
||||||
git log --pretty=format:"* %ad%x09%ae%x09%h%x09%s" --date=short --date-order --no-merges --reverse $1 | grep -v -i "fileheader"
|
git log --pretty=format:"* %ad%x09%ae%x09%h%x09%s" --date=short --date-order --no-merges --reverse $1 | grep -v -i "fileheader"
|
||||||
|
|
||||||
16
utils/style.astylerc
Normal file
16
utils/style.astylerc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
# general style
|
||||||
|
--style=1tbs
|
||||||
|
--indent=spaces=4 # default
|
||||||
|
--lineend=linux #only \r as line ending
|
||||||
|
|
||||||
|
# alignment
|
||||||
|
--align-pointer=type #put asterisks to the type. eg. char* a
|
||||||
|
--align-reference=type #put references to the type. eg. int& a
|
||||||
|
|
||||||
|
# padding
|
||||||
|
--break-blocks # insert empty lines between header blocks
|
||||||
|
--unpad-paren # remove extra padding around parens
|
||||||
|
--pad-oper # spaces around operators
|
||||||
|
--pad-header # insert space between header blocks and the following paren
|
||||||
|
--add-brackets # add brackets to one line conditionals
|
||||||
@@ -3,14 +3,15 @@
|
|||||||
|
|
||||||
FILES=`find common/ emulator/ discovery/ -name "*.c" -or -name "*.h" -or -name "*.cpp" | grep -v libs | grep -v /pixy/`
|
FILES=`find common/ emulator/ discovery/ -name "*.c" -or -name "*.h" -or -name "*.cpp" | grep -v libs | grep -v /pixy/`
|
||||||
|
|
||||||
|
|
||||||
for FILE in $FILES; do
|
for FILE in $FILES; do
|
||||||
echo "Adding Header to $FILE"
|
echo "Adding Header to $FILE"
|
||||||
|
|
||||||
#remove old header
|
#remove old header, and format file with astyle
|
||||||
CONTENT=$(perl -0777 -pe 's%^/\*.*?discoverpixy.*?\*/%%igs' $FILE)
|
CONTENT=$(perl -0777 -pe 's%^/\*.*?discoverpixy.*?\*/%%igs' $FILE | astyle --options=./utils/style.astylerc)
|
||||||
|
|
||||||
#add new header
|
#add new header
|
||||||
./genheader.sh $FILE > $FILE
|
./utils/genheader.sh $FILE > $FILE
|
||||||
|
|
||||||
#append file content
|
#append file content
|
||||||
echo "$CONTENT" >> $FILE
|
echo "$CONTENT" >> $FILE
|
||||||
Reference in New Issue
Block a user