@echo off
set OLD_PATH=%PATH
set OLD_EIFFEL_SRC=%EIFFEL_SRC
set INIT_DIR=%@EXECSTR[cd]
set TMP_ISE_EIFFEL=%ISE_EIFFEL

call set_aliases.btm
remtrace Set up the environment
on break goto broken
TIMER ON /1 >> NUL
TIMER ON /2 >> NUL
if exist %INSTALL_LOG fullrf %INSTALL_LOG
fullrf %INIT_DIR\examples_errors.log
set ISE_EIFFEL=%STUDIO_DIR

iff not defined ISE_PLATFORM then
	set ISE_PLATFORM=windows
endiff
iff not defined ISE_C_COMPILER then
	remtrace ISE_C_COMPILER not defined
	CANCEL
endiff
set PATH=%PATH;%ISE_EIFFEL\studio\spec\%ISE_PLATFORM\bin

alias compile_ace `^
remtrace Compiling Ace: %@EXECSTR[cd]\%2 &^
remtrace Melting %@EXECSTR[cd]\%2 &^
clean_project &^
freeze %2 &^
wff &^
iff not exist EIFGEN\W_code\*.exe then &^
remtrace *****Error***** %@EXECSTR[cd]\%2 won't freeze. &^
echo *****Error***** %@EXECSTR[cd]\%2 won't freeze. >> %INIT_DIR\examples_errors.log &^
endiff &^
clean_project &^
remtrace Finalizing %@EXECSTR[cd]\%2 &^
finalize %2 &^
iff not exist EIFGEN\F_code\*.exe then &^
remtrace *****Error***** %@EXECSTR[cd]\%2 won't finalize. &^
echo *****Error***** %@EXECSTR[cd]\%2 won't finalize. >> %INIT_DIR\examples_errors.log  &^
endiff &^
cleanup_eiffel *.exe`

alias compile_aces `for %a in (*.ace) do compile_ace %1 %a`

alias test_subdir `^
echo Testing subdir %@EXECSTR[cd] &^
iff isdir %2 then &^
cd %2 &^
compile_aces %1 &^
test_subdirs %1\%2 &^
cd .. &^
endiff`

alias test_subdirs `^
echo Testing subdirs of %@EXECSTR[cd] &^
if exist subdirs.txt fullrf subdirs.txt &^
dir /AD /b >> subdirs.txt &^
for %t in (@subdirs.txt) do test_subdir %1 %t`

cdd %STUDIO_DIR\examples
test_subdirs %STUDIO_DIR\examples

:broken
CANCEL

