@echo off @rem If you would like to compile DLP programs without using CygWin, @rem Linux or Solaris, you may use this Win-2000 script ... @rem This old-style batch script (goto's) has been tested for the @rem Win2000 command shell. @rem Check the following environment variables: @rem @rem DLPROOT DLP distribution directory @rem JDKROOT Java SDK directory @rem SWIROOT SWI-Prolog directory, note that @rem (1) downloading the pre-compiled Win32 SWI binaries requires @rem the use of plcon.exe (con stands for 'console') and @rem (2) using a cygwin version of SWI-Prolog requires the pl.exe @rem executable. @rem @rem In addition : @rem (1) one or more spaces in a path requires the name to be quoted, @rem as shown below ("Program Files"). @rem (2) environment variables will become global when using the @rem Win2000 command shell. This default behavior is different @rem from some other configurations: change the dlp.bat accordingly @rem with respect to the required environment variables in dlp.bat @rem (3) remove the CLASSPATH examples\classes line in case you don't @rem use the examples for "testing" or other purposes. @rem set DLPROOT=H:\dlp\dlp1r18K set JDKROOT=D:\jdk1.2.2 set SWICOMP="D:\prolog\bin\plcon.exe" set CLASSPATH=%DLPROOT%\classes\dlpsys.jar set CLASSPATH=%CLASSPATH%;%DLPROOT%\examples\classes @rem set CLASSPATH=%CLASSPATH%;"OtherEntries" if NOT "%PATH%" == "" goto update_path echo updating empty PATH environment variable set OLD_BIN_PATH=%DLPROOT%\bin set PATH=%OLD_BIN_PATH% @rem the first time you execute dlpc.bat use a fully @rem qualified path, for example : @rem c:\dlp\dlp1r18K\bin\dlpc.bat filename.pl @rem this will update all the required environment @rem variables under Win-2000. @rem Alternative: remove the 4 lines below and set the @rem PATH environment variable manually at the beginning @rem of a Win-2000 session, for example : @rem set PATH=C:\dlp\dlp1r18K\bin;%PATH% :update_path if NOT "%OLD_BIN_PATH%" == "" goto path_ok echo updating PATH environment variable set OLD_BIN_PATH=%PATH% set PATH=%DLPROOT%\bin;%PATH% :path_ok @rem Following environment variables should be ok: set EXECOMP=%DLPROOT%\lib\execomp.qlf set JDKCOMP=%JDKROOT%\bin\javac.exe if "%1" == "" goto input_error if NOT EXIST %EXECOMP% goto execomp_error if NOT EXIST %JDKCOMP% goto jdkcomp_error if NOT EXIST %SWICOMP% goto swicomp_error if EXIST classes goto classes_dir_ok echo creating directory classes mkdir classes :classes_dir_ok @rem Win-2000: get basename and extension: for %%I IN (%1) DO set SRCBASE=%%~nI for %%I IN (%1) DO set SRCTYPE=%%~xI @rem Win98: remove the above-mentioned 2 "for" lines and @rem use the next two "set" lines instead. In this case, @rem a "dlpc filename" invocation compiles filename.pl @rem set SRCBASE=%1 @rem set SRCTYPE=.pl if "%SRCTYPE%" == "" set SRCTYPE=.pl if NOT "%SRCTYPE%" == ".pl" goto extension_error if NOT EXIST %SRCBASE%.pl goto file_error %SWICOMP% -f %EXECOMP% -g "(comp('%SRCBASE%.pl','classes/%SRCBASE%.java'),halt)" if ERRORLEVEL 1 goto syntax_error rem echo CLASSPATH %CLASSPATH% %JDKCOMP% -d classes classes/%SRCBASE%.java if ERRORLEVEL 1 goto syntax_error echo %0: compilation done exit /b 0 @rem Error summary : :input_error echo %0: DLP input file argument missing exit /b 1 :execomp_error echo %0: no execomp.qlf found: %EXECOMP% exit /b 1 :jdkcomp_error echo %0: no javac found: %JDKCOMP% exit /b 1 :swicomp_error echo %0: no prolog found: %SWICOMP% exit /b 1 :extension_error echo %0: unknown file extension %SRCTYPE% exit /b 1 :file_error echo %0: file %SRCBASE%.pl doesnt exist exit /b 1 :syntax_error echo %0: compilation errors exit /b 1