.ad 8
.bm 8
.fm 4
.bt $Copyright by   Software AG, 1993$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $NME$Project Distributed Database System$vos02c$
.tt 2 $$$
.tt 3 $R.Roedling$Version and OS-ID$1997-02-18$
***********************************************************
.nf


    ========== licence begin LGPL
    Copyright (C) 2002 SAP AG

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    ========== licence end

.fo
.nf
.sp
Module  : Version_and_OS-ID
=========
.sp
Purpose :
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :

.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :

.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :

.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : R.Roedling
.sp
.cp 3
Created : 1994-09-23
.sp
.cp 3
Version : 1994-09-23
.sp
.cp 3
Release :  6.2 	 Date : 1997-02-18
.br
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:

.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:

.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:

.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
/*PRETTY*/


//
//  INCLUDE FILES
//


//
//  DEFINES
//

#define MOD__  "VOS02C : "
#define MF__   MOD__"UNDEFINED"



//
//  MACROS
//


//
//  LOCAL TYPE AND STRUCT DEFINITIONS
//


//
//  EXTERNAL VARIABLES
//


//
//  EXPORTED VARIABLES
//


//
//  LOCAL VARIABLES
//
static OSVERSIONINFO  VerInfo;

//
//  LOCAL FUNCTION PROTOTYPES
//


//
// ========================== GLOBAL FUNCTIONS ================================
//


PSZ sql02_get_RTE_version_string ( VOID )
  {
  #undef  MF__
  #define MF__ MOD__"sql02_get_RTE_version_string"
  static C40C  szRTEVersion;

  DBGPAS;

  if ( szRTEVersion[0] == '\0' )
    {
    sprintf ( szRTEVersion,
              RTE_VERSION_HEAD,
              MAJOR_VERSION_NO,
              MINOR_VERSION_NO,
              CORRECTION_LEVEL,
              PATCH_LEVEL );

    strcat ( szRTEVersion, "                " );
    szRTEVersion[16] = '\0';

    #if defined(_WIN32)

     if ( sql02_get_platform_id() == VER_PLATFORM_WIN32_NT )
       strcat ( szRTEVersion, VERS_SYS_ID_NT );
     else
       strcat ( szRTEVersion, VERS_SYS_ID_WIN95 );

    #else
     strcat ( szRTEVersion, VERS_SYS_ID_OS2 );
    #endif

    strcat ( szRTEVersion, RTE_VERSION_TAIL );
    }

  return ( szRTEVersion );
  }

/*------------------------------*/

VOID sql02_get_RTE_version ( PRTE_VERSION_ID pRTEVersion )
  {
  #undef  MF__
  #define MF__ MOD__"sql02_get_RTE_version"

  DBGPAS;

  pRTEVersion->ucMajorVersion = MAJOR_VERSION_NO;
  pRTEVersion->ucMinorVersion = MINOR_VERSION_NO;
  pRTEVersion->ucCorrLevel    = CORRECTION_LEVEL;
  pRTEVersion->ucPatchLevel   = PATCH_LEVEL;

  return;
  }

/*------------------------------*/

BOOL sql02_this_RTE_version_is_older ( PRTE_VERSION_ID pCmpRTEVersion )
  {
  #undef  MF__
  #define MF__ MOD__"sql02_this_RTE_version_is_older"

  DBGPAS;

  if ( pCmpRTEVersion->ucMajorVersion  < MAJOR_VERSION_NO )
    return ( TRUE );

  if ( pCmpRTEVersion->ucMajorVersion  > MAJOR_VERSION_NO )
    return ( FALSE );

  // --- Major version is equal
  //
  if ( pCmpRTEVersion->ucMinorVersion  < MINOR_VERSION_NO )
    return ( TRUE );

  if ( pCmpRTEVersion->ucMinorVersion  > MINOR_VERSION_NO )
    return ( FALSE );

  // --- Minor version is equal
  //
  if ( pCmpRTEVersion->ucCorrLevel     < CORRECTION_LEVEL )
    return ( TRUE );

  if ( pCmpRTEVersion->ucCorrLevel     > CORRECTION_LEVEL )
    return ( FALSE );

  // --- Correction level is equal
  //
  if ( pCmpRTEVersion->ucPatchLevel    < PATCH_LEVEL )
    return ( TRUE );

  if ( pCmpRTEVersion->ucPatchLevel    > PATCH_LEVEL )
    return ( FALSE );


  // --- Version is equal
  //

  return ( FALSE );
  }

/*------------------------------*/

BOOL sql02_RTE_versions_are_equal ( PRTE_VERSION_ID pCmpRTEVersion )
  {
  #undef  MF__
  #define MF__ MOD__"sql02_RTE_versions_are_equal"

  DBGPAS;

  if (( pCmpRTEVersion->ucMajorVersion  == MAJOR_VERSION_NO ) &&
      ( pCmpRTEVersion->ucMinorVersion  == MINOR_VERSION_NO ) &&
      ( pCmpRTEVersion->ucCorrLevel     == CORRECTION_LEVEL ) &&
      ( pCmpRTEVersion->ucPatchLevel    == PATCH_LEVEL ))
    {
    return ( TRUE );
    }

  return ( FALSE );
  }

/*------------------------------*/

BOOL sql02_this_RTE_version_is_newer ( PRTE_VERSION_ID pCmpRTEVersion )
  {
  #undef  MF__
  #define MF__ MOD__"sql02_this_RTE_version_is_newer"

  DBGPAS;

  if ( pCmpRTEVersion->ucMajorVersion  > MAJOR_VERSION_NO )
    return ( TRUE );

  if ( pCmpRTEVersion->ucMajorVersion  < MAJOR_VERSION_NO )
    return ( FALSE );

  // --- Major version is equal
  //
  if ( pCmpRTEVersion->ucMinorVersion  > MINOR_VERSION_NO )
    return ( TRUE );

  if ( pCmpRTEVersion->ucMinorVersion  < MINOR_VERSION_NO )
    return ( FALSE );

  // --- Minor version is equal
  //
  if ( pCmpRTEVersion->ucCorrLevel     > CORRECTION_LEVEL )
    return ( TRUE );

  if ( pCmpRTEVersion->ucCorrLevel     < CORRECTION_LEVEL )
    return ( FALSE );

  // --- Correction level is equal
  //
  if ( pCmpRTEVersion->ucPatchLevel    > PATCH_LEVEL )
    return ( TRUE );

  if ( pCmpRTEVersion->ucPatchLevel    < PATCH_LEVEL )
    return ( FALSE );


  // --- Version is equal
  //

  return ( FALSE );
  }

/*------------------------------*/

VOID sql02_build_version_id_string ( PRTE_VERSION_ID pRTEVersion,
                                     C40C            szVersion )
  {
  #undef  MF__
  #define MF__ MOD__"sql02_build_version_id_string"

  DBGPAS;

  sprintf ( szVersion,
            VERSION_HEAD,
            pRTEVersion->ucMajorVersion,
            pRTEVersion->ucMinorVersion,
            pRTEVersion->ucCorrLevel,
            pRTEVersion->ucPatchLevel );

  return;
  }

/*------------------------------*/

#if defined(_WIN32)
 ULONG sql02_get_platform_id ( VOID )
   {
   #undef  MF__
   #define MF__ MOD__"sql02_get_platform_id"

   DBGPAS;

   if ( VerInfo.dwOSVersionInfoSize != sizeof(VerInfo))
     {
     memset ( &VerInfo, 0, sizeof(VerInfo) );
     VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);

     if ( !GetVersionEx (&VerInfo))
       memset ( &VerInfo, 0, sizeof(VerInfo) );
     }

   return ( (ULONG)VerInfo.dwPlatformId );
   }

/*------------------------------*/

 VOID sql02_get_os_version ( PULONG pulMajorVersion,
                             PULONG pulMinorVersion )
   {
   #undef  MF__
   #define MF__ MOD__"sql02_get_os_version"

   DBGPAS;

   if ( VerInfo.dwOSVersionInfoSize != sizeof(VerInfo))
     {
     memset ( &VerInfo, 0, sizeof(VerInfo) );
     VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);

     if ( !GetVersionEx (&VerInfo))
       memset ( &VerInfo, 0, sizeof(VerInfo) );
     }

   *pulMajorVersion = VerInfo.dwMajorVersion;
   *pulMinorVersion = VerInfo.dwMinorVersion;

   return;
   }


#endif

//
// ========================== LOCAL FUNCTIONS =================================
//


//
// =============================== END ========================================
//
.CM *-END-* code ----------------------------------------
.SP 2
***********************************************************
.PA
