@echo off
rem ExtractHeader.bat 0.00           UTF-8                    dh:2006-11-28
ECHO **   Extractheader.bat 0.00 EXTRACT NATIVE METHOD HEADER
ECHO **       Obtain the C/C++ declarations of the odmjni100 native methods.

IF NOT EXIST OdmJava.bat GOTO :FAIL0
CALL OdmJava.bat
IF NOT ERRORLEVEL 2 GOTO :Compile
ECHO **   Extractheader.bat ABORTED.  SEE OdmJava.bat ERROR MESSAGES.
ECHO:
EXIT /B %ERRORLEVEL%

:Compile
IF NOT EXIST OdmJniBind.class GOTO :FAIL1

SET ERRORLEVEL=
rem     Use all ODMJNI packages and compile everything needed for
rem     OdmJniBind.java
javah -classpath "%OdmClasses%" -o odmjni100.h info.odma.odmjni100.OdmJniBind
if ERRORLEVEL 1 GOTO :FAIL2

echo:
echo **   odmjni100.h HEADER EXTRACTED
ECHO **   ****************************
echo:
echo:     There are no errors or warnings.  The header file can be used
echo:     as the basis for definitions to be used in programming and
echo:     compiling the odmjni100.dll file.
echo:
EXIT /B 0


:FAIL0
ECHO:
ECHO **   EXECUTE ExtractHeader.bat IN THE DIRECTORY THAT HOLDS IT.
ECHO **       The OdmJava.bat script must be available in that location.
ECHO **       Verify your odmjni100 configuration and ensure that the
ECHO **       directory holding ExtractHeader.bat is the current working
ECHO **       directory before the script is invoked.
ECHO:
EXIT /B 2


:FAIL1
ECHO:
ECHO **   THE OdmJniBind.class FILE IS NOT PRESENT IN THE CURRENT DIRECTORY
ECHO **       The file should be in the same directory as this ExtractHeader
ECHO **       script.  ExtractHeader.bat has aborted.
ECHO:
EXIT /B 2


:FAIL2
echo:
echo **   ERRORS OR WARNINGS IN JAVAH USAGE, ERRORLEVEL = %ERRORLEVEL% ****
echo **       To capture a log, run with redirection to a file or pipe the
echo **       result of ExtractHeader.bat into a program like "more."
echo:
EXIT /B %ERRORLEVEL%


rem -----1---------2---------3---------4---------5---------6---------7----*

rem EXTRACT THE odmjni100.h HEADER FILE FOR THE NATIVE IMPLEMENTATIONS.
rem      All of the native methods of odmjni100 are assumed to be
rem      implemented as methods on OdmJniBind.  This procedure creates
rem      C/C++ header file that provides prototypes for all of the
rem      implementations to be created.

rem 0.00 2006-11-28-16:29 customized from the odmjni100 BuildClasses.bat
rem      0.00 and information provided by running javah -help.

rem $Header: /ODMdev/info/odma/odmjni100/ExtractHeader.bat 1     06-11-28 16:32 Orcmid $

rem                     *** end of ExtractHeader.bat ***