@setlocal
@REM 20100113 - add in projects/VC90/*.vcpoj - NO, this should be SEPARATE
@REM 20091111 - get cleandiff.pl to do more
@REM 20090711 - add the date and time of the diff, and add data\Input\Joysticks
@REM 20081107 - added some more 'separation' lines; 20080915 - Removed OpenAL
@set TEMP1=tempdiff.txt
@set TEMP2=C:\FGCVS
@set TEMPOPTS=diff -ur
@REM set TEMPOPTS=diff -urN - NO, this 'N' pulls in TOO MANY THINGS!!!
@REM TEMPOPTS=diff -ur -x *.dsp -x *.vcproj -x *.obj -x *.lib
@if "%1x" == "x" goto DNOPTS
@set TEMP2=%1
:DNOPTS
@if NOT EXIST %TEMP2%\. goto ERR1
@echo Prepare a DIFF of MOST folders, with OUTPUT to %TEMP1% file
@echo Using sources from %TEMP2% ...
@pause
@REM Do a CHECK of what is available
@REM if EXIST chgdiff.txt del chgdiff.txt > nul
@if EXIST tempchgdiff.txt del tempchgdiff.txt > nul

@REM start diff/patch file
@echo # Prepare a DIFF of MOST folders, with OUTPUT to %TEMP1% file > %TEMP1%
@echo # Date: %DATE% Time: %TIME% >> %TEMP1%
@echo # Using sources from %TEMP2% ... >> %TEMP1%

@echo #BEGIN FlightGear >> %TEMP1%
@if NOT EXIST %TEMP2%\FlightGear\source\. goto ERR3
@echo %TEMPOPTS% %TEMP2%\FlightGear\source FlightGear >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\FlightGear\source FlightGear >> %TEMP1%
@goto DN1
:ERR3_VCP1
:ERR3_VCP2
@echo FILE DOES NOT EXIST!!!
@echo %TEMP2%\FlightGear\source\projects\VC90\FlightGear\FlightGear.vcproj, or
@echo FlightGear\projects\VC90\FlightGear\FlightGear.vcproj, or
@echo %TEMP2%\FlightGear\source\projects\VC90\fgviewer\fgviewer.vcproj, or
@echo FlightGear\projects\VC90\fgviewer\fgviewer.vcproj!
@echo ABORTING DIFF UNFINISHED...
@pause
@goto END

:ERR3
@echo WARNING: Can NOT locate %TEMP2%\FlightGear\source\. ...
@echo WARNING: Can NOT locate %TEMP2%\FlightGear\source\. ... >> %TEMP1%
:DN1
@echo #END ==================================================================== >> %TEMP1%

@echo #BEGIN freeglut >> %TEMP1%
@if NOT EXIST %TEMP2%\freeglut\. goto ERR4
@echo %TEMPOPTS% %TEMP2%\freeglut freeglut >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\freeglut freeglut >> %TEMP1%
@goto DN2
:ERR4
@echo WARNING: Can NOT locate %TEMP2%\freeglut\.
@echo WARNING: Can NOT locate %TEMP2%\freeglut\. >> %TEMP1%
:DN2
@echo #END ==================================================================== >> %TEMP1%

@REM if NOT EXIST %TEMP2%\OpenAL\. goto ERR5

@echo #BEGIN OpenSceneGraph >> %TEMP1%
@if NOT EXIST %TEMP2%\OpenSceneGraph\. goto ERR6
@echo %TEMPOPTS% %TEMP2%\OpenSceneGraph OpenSceneGraph >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\OpenSceneGraph OpenSceneGraph >> %TEMP1%
@goto DN4
:ERR6
@echo WARNING: Can NOT locate %TEMP2%\OpenSceneGraph\.
@echo WARNING: Can NOT locate %TEMP2%\OpenSceneGraph\. >> %TEMP1%
:DN4
@echo #END ==================================================================== >> %TEMP1%

@REM if NOT EXIST %TEMP2%\OpenThreads\. goto ERR7

@echo #BEGIN PLIB >> %TEMP1%
@if NOT EXIST %TEMP2%\PLIB\. goto ERR8
@ECHO %TEMPOPTS% %TEMP2%\PLIB PLIB >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\PLIB PLIB >> %TEMP1%
@goto DN5
:ERR8
@echo WARNING: Can NOT locate %TEMP2%\PLIB\.
@echo WARNING: Can NOT locate %TEMP2%\PLIB\. >> %TEMP1%
:DN5
@echo #END ==================================================================== >> %TEMP1%

@echo #BEGIN pthreads >> %TEMP1%
@if NOT EXIST %TEMP2%\pthreads\. goto ERR10
@echo %TEMPOPTS% %TEMP2%\pthreads pthreads >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\pthreads pthreads >> %TEMP1%
@goto DN6
:ERR10
@echo WARNING: Can NOT locate %TEMP2%\pthreads\.
@echo WARNING: Can NOT locate %TEMP2%\pthreads\. >> %TEMP1%
:DN6
@echo #END ==================================================================== >> %TEMP1%

@echo #BEGIN Simgear >> %TEMP1%
@if NOT EXIST %TEMP2%\SimGear\source\. goto ERR11
@echo %TEMPOPTS% %TEMP2%\SimGear\source Simgear >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\SimGear\source Simgear >> %TEMP1%
@goto DN7
:ERR11
@echo WARNING: Can NOT locate %TEMP2%\SimGear\source\.
@echo WARNING: Can NOT locate %TEMP2%\SimGear\source\. >> %TEMP1%
:DN7
@echo #END ==================================================================== >> %TEMP1%

@REM if NOT EXIST %TEMP2%\zlib-1.2.3\. goto ERR12
@REM if NOT EXIST %TEMP2%\FlightGear\data\. goto ERR2

@set TEMPS=freealut-1.1.0-src
@echo #BEGIN alut >> %TEMP1%
@if NOT EXIST %TEMP2%\%TEMPS%\. goto ERR14
@echo %TEMPOPTS% %TEMP2%\%TEMPS% alut >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\%TEMPS% alut >> %TEMP1%
@goto DN14
:ERR14
@echo WARNING: Can NOT locate %TEMP2%\%TEMPS%\.
@echo WARNING: Can NOT locate %TEMP2%\%TEMPS%\. >> %TEMP1%
:DN14
@echo #END ==================================================================== >> %TEMP1%

@set TEMPS=lpng1232
@echo #BEGIN lpng >> %TEMP1%
@if NOT EXIST %TEMP2%\%TEMPS%\. goto ERR14
@echo %TEMPOPTS% %TEMP2%\%TEMPS% lpng >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\%TEMPS% lpng >> %TEMP1%
@goto DN14
:ERR14
@echo WARNING: Can NOT locate %TEMP2%\%TEMPS%\.
@echo WARNING: Can NOT locate %TEMP2%\%TEMPS%\. >> %TEMP1%
:DN14
@echo #END ==================================================================== >> %TEMP1%

@set TEMPS=data\Input\Joysticks
@echo #BEGIN %TEMPS% >> %TEMP1%
@if NOT EXIST %TEMP2%\FlightGear\%TEMPS%\. goto ERR15
@echo %TEMPOPTS% %TEMP2%\FlightGear\%TEMPS% %TEMPS% >> %TEMP1%
@echo #DIFF ==================================================================== >> %TEMP1%
%TEMPOPTS% %TEMP2%\FlightGear\%TEMPS% %TEMPS% >> %TEMP1%
@goto DN15
:ERR15
@echo WARNING: Can NOT locate %TEMP2%\FlightGear\%TEMPS%\.
@echo WARNING: Can NOT locate %TEMP2%\FlightGear\%TEMPS%\. >> %TEMP1%
:DN15
@echo #END ==================================================================== >> %TEMP1%

@if NOT EXIST cleandiff.pl goto TRYFF
perl cleandiff.pl -in:%TEMP1% -out:tempchgdiff.txt
@if NOT EXIST tempchgdiff.txt goto ERR3
@echo Also see FULL output in %TEMP1%, and cleaned output in tempchgdiff.txt ...
@echo tempchgdiff.txt MUST BE CAREFULLY CHECKED FOR OTHER SOURCE CHANGES!!!
@echo And if any FOUND, must be 'blended' into the new file ...
@start notepad tempchgdiff.txt
@goto END

:TRYFF
FixF32 %TEMP1% "-R[Only in]" -n -o-tempchgdiff.txt -l9999
@if NOT EXIST tempchgdiff.txt goto ERR2
start notepad tempchgdiff.txt
@goto END

:ERR1
@echo ERROR: Can NOT locate source at [%TEMP2%] ... check name, location ...
@goto END

:ERR2
@echo ERROR: Can NOT create tempchgdiff.txt ... maybe you do NOT have fixf32.exe in the PATH ...
@echo This can be done without this utility, but if you want to try it ...
@echo go to http://geoffair.net/ms/fixf32.htm#downloads
@goto END

:ERR3
@echo ERROR: Can NOT create tempchgdiff.txt ... maybe you do NOT have perl in the PATH ...
@goto END

:END
@endlocal
