/****************************************************************************

Module: Test1.cpp

Purpose:

   This module displays the API version and date.

****************************************************************************/

/////////////////////////////////////////////////////////////////////////////
// Include files.
/////////////////////////////////////////////////////////////////////////////

#include "afx.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "spectrum.h"

/////////////////////////////////////////////////////////////////////////////
// Local definitions.
/////////////////////////////////////////////////////////////////////////////

// Define a macro for checking the status code returned from the 
// Spectrum API routines.
#define CHECK_STATUS_CODE(StatusCode)                     \
{                                                         \
   if ((StatusCode) != SPC_SC_Success)                    \
   {                                                      \
      char szStatusText[512];                             \
      SPUTL_FormatStatusCode((StatusCode), szStatusText); \
      printf("ERROR: %s\n", szStatusText);                \
      return(StatusCode);                                 \
   }                                                      \
}

/////////////////////////////////////////////////////////////////////////////
// This routine displays the API version and date.
/////////////////////////////////////////////////////////////////////////////

SPT_lStatusCode main()
{
   SPT_lStatusCode lStatusCode;
   char            szBuffer[512];

   // Display the API version.
   lStatusCode = SPAPI_GetApiVersion(szBuffer);
   CHECK_STATUS_CODE(lStatusCode);
   printf("API Version: %s\n", szBuffer);

   // Display the API date.
   lStatusCode = SPAPI_GetApiDate(szBuffer);
   CHECK_STATUS_CODE(lStatusCode);
   printf("API Date:    %s\n", szBuffer);

   return(SPC_SC_Success);
}
