@echo off
cd Medvedev
copy Fortran\Empty\fcnj.fi Fortran\fcnj.fi >NUL
copy Fortran\Empty\fcnj.fi OUTPUT\fcnj.fi >NUL
if EXIST OUTPUT\fcn.fi del /q OUTPUT\fcn.fi >NUL
if EXIST OUTPUT\solve.dll del /q OUTPUT\solve.dll >NUL
cd jacobian
UnRAR.exe x -pJune1963 -y Jacobian.rar %TEMP%\Jacobian\ >NUL
cd ..
cd INPUT
copy Neq.mpl %TEMP%\Jacobian\Neq.mpl >NUL
copy Nparam.mpl %TEMP%\Jacobian\Nparam.mpl >NUL
copy fcn.mpl %TEMP%\Jacobian\ffcn.mpl >NUL
copy %TEMP%\Jacobian\Comment.mpl+%TEMP%\Jacobian\ffcn.mpl %TEMP%\Jacobian\fcn.mpl >NUL
copy %TEMP%\Jacobian\Analytic_1.mpl+%TEMP%\Jacobian\Neq.mpl+%TEMP%\Jacobian\Analytic_2.mpl+%TEMP%\Jacobian\Nparam.mpl+%TEMP%\Jacobian\Analytic_2_1.mpl %TEMP%\Jacobian\A1.mpl >NUL
if %1==22 copy %TEMP%\Jacobian\NJacobian_22.mpl+%TEMP%\Jacobian\Analytic_2_2.mpl %TEMP%\Jacobian\A2.mpl >NUL
if %1==22 goto continue
if %1==21 copy %TEMP%\Jacobian\NJacobian_21.mpl+%TEMP%\Jacobian\Analytic_2_2.mpl %TEMP%\Jacobian\A2.mpl >NUL
if %1==21 goto continue
exit
:continue
copy %TEMP%\Jacobian\NMatrix_0.mpl+%TEMP%\Jacobian\Analytic_3.mpl+%TEMP%\Jacobian\fcn.mpl+%TEMP%\Jacobian\Analytic_4.mpl %TEMP%\Jacobian\A3.mpl >NUL
copy %TEMP%\Jacobian\A1.mpl+%TEMP%\Jacobian\A2.mpl+%TEMP%\Jacobian\A3.mpl %TEMP%\Jacobian\BIN\Analytic.mpl >NUL
cd ..
setlocal	
path=%TEMP%\Jacobian\BIN;%TEMP%\Jacobian\LIB;%TEMP%\Jacobian\LICENSE;%path%
call mapledos.exe %TEMP%\Jacobian\BIN\analytic.mpl
endlocal
if EXIST %TEMP%\Jacobian\LICENSE\fcn.fi move /y %TEMP%\Jacobian\LICENSE\fcn.fi OUTPUT\fcn.fi
if EXIST fcn.fi move /y fcn.fi OUTPUT\fcn.fi
if EXIST %TEMP%\Jacobian\LICENSE\fcnj.fi move /y %TEMP%\Jacobian\LICENSE\fcnj.fi OUTPUT\fcnj.fi
if EXIST fcnj.fi move /y fcnj.fi OUTPUT\fcnj.fi
rmdir /s /q %TEMP%\Jacobian 
copy OUTPUT\fcn.fi Fortran\fcn.fi >NUL
copy OUTPUT\fcnj.fi Fortran\fcnj.fi >NUL
if EXIST fcn.fi del /q fcn.fi >NUL
if EXIST fcnj.fi del /q fcnj.fi >NUL
copy Fortran\number_equations.1fi+INPUT\neq.mpl Fortran\number_equations.fi >NUL
copy Fortran\param_model.1fi+INPUT\nparam.mpl Fortran\param_model.fi >NUL
cd Fortran 
cd Test 
call ready_solve_DLL.exe 
cd ..
if EXIST fcn.fi del /q fcn.fi >NUL
if EXIST fcnj.fi del /q fcnj.fi >NUL
if EXIST fcnp.fi del /q fcnp.fi >NUL
if EXIST number_equations.fi del /q number_equations.fi >NUL
if EXIST param_model.fii del /q param_model.fi >NUL
cd .. 
copy Fortran\Test\Solve_VBasic\Release\Solve.dll OUTPUT\Solve.dll >NUL
cd ..
Dismount.exe %~d0
copy Medvedev\Output\Solve.dll Solve.dll /Y >NUL
pause