@echo off
rem Purpose:  To run QAC analysis and produce output. 

rem This batch file is supplied only as an example of
rem how to perform QAC analysis and generate annotated
rem source code from the command line.

rem Argument 1 should specify the name of a source file
rem Subsequent arguments may specify options or option files

rem The standard QAC environmnet variables QACBIN, QACTEMP
rem and QACOUTPATH are required for correct operation. 
rem These may be initialised using the batch file qacconf.bat.


if %1"dummy" == "dummy" goto qachelp

if not exist "%QACBIN%\QAC.EXE" goto problem

echo.
echo Running QAC...
echo.

"%QACBIN%\QAC.EXE" %1 %2 %3 %4 %5 %6 %7 %8 %9
if ERRORLEVEL 2 goto explain

if not exist "%QACBIN%\qacuser.exe" goto annotatesource
"%QACBIN%\QACUSER.EXE" %1

:annotatesource
"%QACBIN%\ERRDSP.EXE" QAC %1 %2 %3 %4 %5 %6 %7 %8 %9 -file "%1.txt"

goto exit

:explain
echo.
echo QAC did not run. Please make sure you have specified
echo the full source filename, including path and suffix.

goto exit

:problem
echo Cannot find QAC.EXE
echo.
echo Please make sure that you run qacconf.bat to
echo configure the QAC Command Line environment.

goto exit

:qachelp
echo Command Line usage:
echo.
echo QACRUN file [options]
echo.
echo file     : C source file to be analysed 
echo options  : Analysis options
echo.

:exit

echo.
echo Finished...
