Added indent.bat file for single files on Windows and moved former indent.bat to indent-all.bat file. Added unix2dos and svn prop-set to the indent.bat file.

This commit is contained in:
skarg
2016-04-20 16:34:28 +00:00
parent 2a89f5bc42
commit 2616efda30
2 changed files with 50 additions and 20 deletions
+41
View File
@@ -0,0 +1,41 @@
rem Indent the C and H files with specific coding standard
rem requires 'indent.exe' from MSYS (MinGW).
rem See http://www.gnu.org/software/indent/manual/indent.pdf
set OPTIONS=-kr -nut -nlp -ip4 -cli4 -bfda -nbc -nbbo -c0 -cd0 -cp0 -di0 -l79 -nhnl
rem -kr The Kernighan & Ritchie style, corresponds to the following options:
rem -nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0
rem -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs
rem -nprs -npsl -saf -sai -saw -nsc -nsob -nss
rem -nut Use spaces instead of tabs.
rem -nlp Do not line up parentheses.
rem -ip4 Indent parameter types in old-style function definitions by n spaces.
rem -cli4 Case label indent of n spaces.
rem -bfda Break the line before all arguments in a declaration.
rem -nbc Do not force newlines after commas in declarations.
rem -nbbo Do not prefer to break long lines before boolean operators.
rem -c0 Put comments to the right of code in column n.
rem -cd0 Put comments to the right of the declarations in column n.
rem -cp0 Put comments to the right of #else and #endif statements in column n.
rem -di0 Put variables in column n.
rem -l79 Set maximum line length for non-comment lines to n.
rem -nhnl Do not prefer to break long lines at the position of newlines in the input.
call :treeProcess
goto :eof
:treeProcess
rem perform the indent on all the files of this subdirectory:
for %%f in (*.c) do (
indent.exe "%%f" -o "%%f" %OPTIONS%
)
for %%f in (*.h) do (
indent.exe "%%f" -o "%%f" %OPTIONS%
)
rem loop over all directories and sub directories
for /D %%d in (*) do (
cd %%d
call :treeProcess
cd ..
)
exit /b
+9 -20
View File
@@ -1,7 +1,7 @@
@echo off
rem Indent the C and H files with specific coding standard
rem requires 'indent.exe' from MSYS (MinGW).
rem See http://www.gnu.org/software/indent/manual/indent.pdf
set OPTIONS=-kr -nut -nlp -ip4 -cli4 -bfda -nbc -nbbo -c0 -cd0 -cp0 -di0 -l79 -nhnl
rem -kr The Kernighan & Ritchie style, corresponds to the following options:
rem -nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0
rem -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs
@@ -20,22 +20,11 @@ rem -di0 Put variables in column n.
rem -l79 Set maximum line length for non-comment lines to n.
rem -nhnl Do not prefer to break long lines at the position of newlines in the input.
call :treeProcess
goto :eof
:treeProcess
rem perform the indent on all the files of this subdirectory:
for %%f in (*.c) do (
indent.exe "%%f" -o "%%f" %OPTIONS%
)
for %%f in (*.h) do (
indent.exe "%%f" -o "%%f" %OPTIONS%
)
rem loop over all directories and sub directories
for /D %%d in (*) do (
cd %%d
call :treeProcess
cd ..
)
exit /b
echo Fixing Unix/DOS line endings for "%1"
unix2dos.exe "%1"
echo Setting Subversion EOL Style for "%1"
svn.exe propset svn:eol-style native "%1"
svn.exe propset svn:mime-type text/plain "%1"
echo Indenting "%1"
set OPTIONS=-kr -nut -nlp -ip4 -cli4 -bfda -nbc -nbbo -c0 -cd0 -cp0 -di0 -l79 -nhnl
indent.exe "%1" -o "%1" %OPTIONS%