-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
run_astyle.bat
51 lines (40 loc) · 1.23 KB
/
run_astyle.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@ECHO OFF
SETLOCAL
PUSHD %~dp0
SET "AStyleVerMin=3.0.1"
astyle --ascii --version 2>NUL || (ECHO. & ECHO ERROR: AStyle not found & GOTO End)
CALL :SubCheckVer || GOTO End
rem http://astyle.sourceforge.net/astyle.html
SET ASTYLE_OPTIONS=--indent=spaces=4 --style=kr^
--indent-switches --indent-namespaces --indent-col1-comments^
--attach-inlines --pad-header --pad-oper --unpad-paren^
--align-pointer=type --align-reference=type^
--close-templates^
--add-brackets^
--keep-one-line-blocks^
--convert-tabs^
--lineend=windows --preserve-date^
--suffix=none^
--recursive^
--ignore-exclude-errors --ignore-exclude-errors-x^
--formatted^
--exclude=bin
:Start
astyle --ascii %ASTYLE_OPTIONS% --exclude=PerfmonBar_i.h --exclude=resource.h --exclude=Version.h src\*.h src\*.cpp
IF %ERRORLEVEL% NEQ 0 (ECHO. & ECHO ERROR: Something went wrong!)
:END
POPD
ECHO. & ECHO Press any key to close this window...
PAUSE >NUL
ENDLOCAL
EXIT /B
:SubCheckVer
TITLE Checking astyle version
FOR /F "tokens=4 delims= " %%A IN ('astyle --ascii --version 2^>^&1 NUL') DO (
SET "AStyleVer=%%A"
)
IF %AStyleVer% LSS %AStyleVerMin% (
ECHO. & ECHO ERROR: AStyle v%AStyleVer% is too old, please update AStyle to v%AStyleVerMin% or newer.
EXIT /B 1
)
EXIT /B