home *** CD-ROM | disk | FTP | other *** search
- echo off
-
- if /%1==/ goto HELP
- if /%2==/ goto HELP
- if /%3==/ goto HELP
- if /%4==/ goto HELP
-
- if %1==SMALL goto modelOK
- if %1==small goto modelOK
- if %1==MEDIUM goto modelOK
- if %1==medium goto modelOK
- if %1==COMPACT goto modelOK
- if %1==compact goto modelOK
- if %1==LARGE goto modelOK
- if %1==large goto modelOK
- if %1==HUGE goto modelOK
- if %1==huge goto modelOK
- if %1==ALL goto modelOK
- if %1==all goto modelOK
-
- :HELP
- echo
- echo This batch file will recompile the specified module for the
- echo selected memory model, and replace the resultant object module
- echo in the SMALL, COMPACT, MEDIUM, LARGE, or HUGE library file
- echo in the specified library directory.
- echo
- echo The "model" parameter specifies which memory model should be used.
- echo When ALL is specified, the file is recompiled and replaced for all
- echo memory models.
- echo
- echo Usage: mathrepl model filename extension lib-dir [TCC switches]
- echo
- echo Examples: mathrepl ALL realcvt cas \turboc\lib
- echo mathrepl LARGE ldexp cas \turboc\lib -N
- echo
- echo Note that you should not include the trailing "\" in the destination
- echo library directory specification!
- echo
- goto DONE
-
- :modelOK
-
- if %3==asm goto ASMfile
- if %3==ASM goto ASMfile
-
- if %1==MEDIUM goto DOmd1
- if %1==medium goto DOmd1
- if %1==COMPACT goto DOcp1
- if %1==compact goto DOcp1
- if %1==LARGE goto DOlg1
- if %1==large goto DOlg1
- if %1==HUGE goto DOhg1
- if %1==huge goto DOhg1
-
- :DOsm1
- echo *** Compiling SMALL model version ***
- tcc -ms -c %5 %6 %7 %8 %9 %2.%3
- if errorlevel 1 goto TCerror
- tlib /E /0 %4\MATHS -+%2
- if errorlevel 1 goto TLerror
- if %1==SMALL goto REMOVE
- if %1==small goto REMOVE
-
- :DOmd1
- echo *** Compiling MEDIUM model version ***
- tcc -mm -c %5 %6 %7 %8 %9 %2.%3
- if errorlevel 1 goto TCerror
- tlib /E /0 %4\MATHM -+%2
- if errorlevel 1 goto TLerror
- if %1==MEDIUM goto REMOVE
- if %1==medium goto REMOVE
-
- :DOcp1
- echo *** Compiling COMPACT model version ***
- tcc -mc -c %5 %6 %7 %8 %9 %2.%3
- if errorlevel 1 goto TCerror
- tlib /E /0 %4\MATHC -+%2
- if errorlevel 1 goto TLerror
- if %1==COMPACT goto REMOVE
- if %1==compact goto REMOVE
-
- :DOlg1
- echo *** Compiling LARGE model version ***
- tcc -ml -c %5 %6 %7 %8 %9 %2.%3
- if errorlevel 1 goto TCerror
- tlib /E /0 %4\MATHL -+%2
- if errorlevel 1 goto TLerror
- if %1==LARGE goto REMOVE
- if %1==large goto REMOVE
-
- :DOhg1
- echo *** Compiling HUGE model version ***
- tcc -mh -c %5 %6 %7 %8 %9 %2.%3
- if errorlevel 1 goto TCerror
- tlib /E /0 %4\MATHH -+%2
- if errorlevel 1 goto TLerror
-
- goto REMOVE
-
- :ASMfile
- if %2==flags87 goto ASMind1
- if %2==FLAGS87 goto ASMind1
- if %2==ftol goto ASMind2
- if %2==FTOL goto ASMind2
- if %2==emuvars goto ASMdep
- if %2==EMUVARS goto ASMdep
-
- echo ********************************************************************
- echo Error: unknown source file "%2.%3" !!!
- echo ********************************************************************
- goto DONE
-
- :ASMdep
- if %1==MEDIUM goto DOmd2
- if %1==medium goto DOmd2
- if %1==COMPACT goto DOcp2
- if %1==compact goto DOcp2
- if %1==LARGE goto DOlg2
- if %1==large goto DOlg2
- if %1==HUGE goto DOhg2
- if %1==huge goto DOhg2
-
- :DOsm2
- echo *** Assembling SMALL model version ***
- tasm %2 /D__COMPACT__ /D__BSS__ /E /DLDATA=0 %5 %6 %7 %8 %9
- if errorlevel 1 goto ASMerror
- tlib /E /0 %4\MATHS -+%2
- if errorlevel 1 goto TLerror
- if %1==SMALL goto REMOVE
- if %1==small goto REMOVE
-
- :DOmd2
- echo *** Assembling MEDIUM model version ***
- tasm %2 /D__COMPACT__ /D__BSS__ /E /DLDATA=0 %5 %6 %7 %8 %9
- if errorlevel 1 goto ASMerror
- tlib /E /0 %4\MATHM -+%2
- if errorlevel 1 goto TLerror
- if %1==MEDIUM goto REMOVE
- if %1==medium goto REMOVE
-
- :DOcp2
- echo *** Assembling COMPACT model version ***
- tasm %2 /D__COMPACT__ /D__BSS__ /E /DLDATA=1 %5 %6 %7 %8 %9
- if errorlevel 1 goto ASMerror
- tlib /E /0 %4\MATHC -+%2
- if errorlevel 1 goto TLerror
- if %1==COMPACT goto REMOVE
- if %1==compact goto REMOVE
-
- :DOlg2
- echo *** Assembling LARGE model version ***
- tasm %2 /D__COMPACT__ /D__BSS__ /E /DLDATA=1 %5 %6 %7 %8 %9
- if errorlevel 1 goto ASMerror
- tlib /E /0 %4\MATHL -+%2
- if errorlevel 1 goto TLerror
- if %1==LARGE goto REMOVE
- if %1==large goto REMOVE
-
- :DOhg2
- echo *** Assembling HUGE model version ***
- tasm %2 /D__COMPACT__ /D__BSS__ /E /DLDATA=1 %5 %6 %7 %8 %9
- if errorlevel 1 goto ASMerror
- tlib /E /0 %4\MATHH -+%2
- if errorlevel 1 goto TLerror
-
- goto REMOVE
-
- :ASMind1
- tasm flags87 /i..\include /t /MX /D__COMPACT__ /D__BSS__ %5 %6 %7 %8 %9
- goto ASMind
-
- :ASMind2
- tasm ftol /i..\include /t /MX /D__COMPACT__ /D__BSS__ /DFCall %5 %6 %7 %8 %9, fftol.obj
- tasm ftol /i..\include /t /MX /D__COMPACT__ /D__BSS__ /DNCall %5 %6 %7 %8 %9, nftol.obj
-
- :ASMind
- if errorlevel 1 goto ASMerror
-
- if %1==MEDIUM goto TLmd
- if %1==medium goto TLmd
- if %1==COMPACT goto TLcp
- if %1==compact goto TLcp
- if %1==LARGE goto TLlg
- if %1==large goto TLlg
- if %1==HUGE goto TLhg
- if %1==huge goto TLhg
-
- :TLsm
- if %2==ftol goto SKIPsm1
- if %2==FTOL goto SKIPsm1
- tlib /E /0 %4\MATHS -+%2
- goto SKIPsm2
- :SKIPsm1
- tlib /E /0 %4\MATHS -+n%2
- tlib /E /0 %4\MATHS -+f%2
- :SKIPsm2
- if errorlevel 1 goto TLerror
- if %1==SMALL goto REMOVE
- if %1==small goto REMOVE
- :TLmd
- if %2==ftol goto SKIPmm1
- if %2==FTOL goto SKIPmm1
- tlib /E /0 %4\MATHM -+%2
- goto SKIPmm2
- :SKIPmm1
- tlib /E /0 %4\MATHM -+n%2
- tlib /E /0 %4\MATHM -+f%2
- :SKIPmm2
- if errorlevel 1 goto TLerror
- if %1==MEDIUM goto REMOVE
- if %1==medium goto REMOVE
- :TLcp
- if %2==ftol goto SKIPcm1
- if %2==FTOL goto SKIPcm1
- tlib /E /0 %4\MATHC -+%2
- goto SKIPcm2
- :SKIPcm1
- tlib /E /0 %4\MATHC -+n%2
- tlib /E /0 %4\MATHC -+f%2
- :SKIPcm2
- if errorlevel 1 goto TLerror
- if %1==COMPACT goto REMOVE
- if %1==compact goto REMOVE
- :TLlg
- if %2==ftol goto SKIPlm1
- if %2==FTOL goto SKIPlm1
- tlib /E /0 %4\MATHL -+%2
- goto SKIPlm2
- :SKIPlm1
- tlib /E /0 %4\MATHL -+n%2
- tlib /E /0 %4\MATHL -+f%2
- :SKIPlm2
- if errorlevel 1 goto TLerror
- if %1==LARGE goto REMOVE
- if %1==large goto REMOVE
- :TLhg
- if %2==ftol goto SKIPhm1
- if %2==FTOL goto SKIPhm1
- tlib /E /0 %4\MATHH -+%2
- goto SKIPhm2
- :SKIPhm1
- tlib /E /0 %4\MATHH -+n%2
- tlib /E /0 %4\MATHH -+f%2
- :SKIPhm2
- if errorlevel 1 goto TLerror
- goto REMOVE
-
- :TCerror
- echo ********************************************************************
- echo Compilation errors !!
- echo ********************************************************************
- goto REMOVE
-
- :TLerror
- echo ********************************************************************
- echo Librarian errors !!
- echo ********************************************************************
-
- :ASMerror
- echo ********************************************************************
- echo Assembly errors !!
- echo ********************************************************************
- goto DONE
-
- :REMOVE
- if %2==ftol goto SKIPrm
- if %2==FTOL goto SKIPrm
- if exist %2.obj del %2.obj
- goto DONE
- :SKIPrm
- if exist n%2.obj del n%2.obj
- if exist f%2.obj del f%2.obj
-
- :DONE
-