Error Handling and Messages from the BCX Translator

The BCX translator returns a 1 when a successful translation has been completed. If a problem has occured during translation and BCX aborts, 0 is returned. This return value can be determined by a batch file and a conditional jump can be made based on whether or not the compilation was successful. Here is a sample PCALL.BAT the jumps to an error message if 0 is returned.

 IF NOT EXIST %1.bas GOTO usage
 C:\bin\bc.exe %1 -p
 IF errorlevel = 0 GOTO errormsg
 CALL C:\dev\PellesC\Bin\povars32.bat
 IF EXIST %1.res GOTO res
 IF NOT EXIST "res\%~1.rc" GOTO nores
 ECHO Compiling resources.....
 C:\dev\PellesC\Bin\porc.exe "res\%~1.rc" /i res /fo "%~1.res"
 IF EXIST %1.res SET PRES="%~1.res"
 ECHO Compiling "%~1.c"..........
 C:\dev\PellesC\Bin\pocc.exe /W1 /Ot /MT /Go /Gd /Ze /Zx /Tx86-coff -D_WIN32_WINNT=0x501 "%~1.c"
 ECHO Linking ................
 C:\dev\PellesC\Bin\polink.exe /release /MACHINE:X86 /SUBSYSTEM:CONSOLE,5.01 "%~1.obj" %PRES% %2 %3 %4 %5 %6 %7 %8 %9 /out:"%~1.exe"
 ECHO Finished!
 IF EXIST "%~1.obj" del "%~1.obj"
 GOTO done
 echo translation aborted
 GOTO done
 ECHO **************************************************************
 ECHO  Usage:  PCALL.BAT MainFile  ExtraFile1 ExtraFile2 ExtraFile3
 ECHO  Note:   ExtraFiles can be .libs, .res , .obj
 ECHO  Use this batch file to create console mode program
 ECHO **************************************************************