Sfall-ScriptEditor
74 строки · 2.0 Кб
1@echo off
2rem *** Example user config for compiling script file ***
3
4if not exist %1 goto NOFILE
5set namescript=%~n1
6
7rem Include files path
8set ipath=%2
9
10rem Path to compile scripts
11set pathcompile=%3
12
13rem Preprocessor definition for conditional compilation option
14set def=
15if not %4 == 0 (
16echo Build type: %4
17set def=-d%4%
18) else (echo Build type: None)
19
20rem Compiling with optimization level option
21set optimize=%5
22
23rem Compiling with Short-Circuit Evaluation option (last)
24set shortCircuit=%7
25
26rem Set name and path for preprocessing file
27set prefile=..\scrTemp\%namescript%_[pre].ssl
28if exist %prefile% del %prefile%
29if exist %namescript%.ssl del /q %namescript%.ssl
30
31echo -------------------------------------------------------------------------------
32echo Compilation script:
33echo %~6\%namescript%.ssl
34echo -------------------------------------------------------------------------------
35wcc386.exe %1 -p -fo=%namescript%.i -w -i=%ipath% %def%
36if not exist %namescript%.i goto ERROR
37echo Preprocessing script: OK.
38
39ren %namescript%.i %namescript%.ssl
40if exist %namescript%.int del %namescript%.int
41
42rem compiling script sfall compiler with BIS compatible mode
43compile.exe -b -O%optimize% %namescript%.ssl
44
45if exist %namescript%.int (
46echo [BIS] Script compilation is completed.
47goto COMPILE
48)
49echo [BIS] Compilation script error.
50echo Try sfall compiler.
51echo -------------------------------------------------------------------------------
52compile.exe -O%optimize% %shortCircuit% %namescript%.ssl
53echo -------------------------------------------------------------------------------
54if not exist %namescript%.int goto ERROR
55echo [SFALL] Script compilation is completed.
56
57:COMPILE
58move %namescript%.int %pathcompile%\%namescript%.int
59del %namescript%.ssl
60echo Script file is compiled into: %pathcompile:~1,-1%\%namescript%.int
61goto DONE
62
63:NOFILE
64echo File script %1 is not found.
65Exit 1
66goto DONE
67
68:ERROR
69echo Compilation of script %namescript%.ssl error.
70echo Look for an error in preprocessing file: %prefile%
71move %namescript%.ssl %prefile%
72Exit 1
73
74:DONE