/*******************************************************************

Copyright (c) 2004 Open Mobile Alliance, Ltd.  All Rights Reserved.

This software is made available under the usage and distribution terms 
covered by the Common Public License 1.0 and by using this software you
are bound by the terms and conditions of the same.

EXCEPT AS EXPRESSLY SET FORTH IN THE COMMON PUBLIC LICENSE,
THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, 
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
   
Each recipient is solely responsible for determining the 
appropriateness of using and distributing this program and assumes 
all risks associated with its exercise of rights under the Common 
Public License, including but not limited to the risks and 
costs of program errors, compliance with applicable laws, 
damage to or loss of data, programs or equipment, and 
unavailability or interruption of operations.

********************************************************************/

#ifndef _SCTS_PLATFORMLIB_H
#define _SCTS_PLATFORMLIB_H
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "stdio.h"
/******************************************************************
Version information
******************************************************************/

#define SCTS_INF_MAN	"IBM"
#define SCTS_INF_DEVID	"38622336"
/* DMFINAL */
#define SCTS_INF_SWV	"1.2"
#define SCTS_VERSION	"DM 1.2"
 

/******************************************************************
Platform specific defines
******************************************************************/

#define __SCTS_PLATFORM_WIN32__
#define __SCTS_USING_SCTS__
#define __SCTS_LOG_ERRORS__
#define __SCTS_USING_RTK__

/******************************************************************
Basic Datatypes
******************************************************************/

#ifdef __SCTS_USING_RTK__
#include "smldef.h"
#define MAX_WORKSPACE_SIZE	80000
#define MAX_WORKSPACE		MAX_WSM_BUFFERS
extern bool sctsRTKIntialized;
#else
typedef unsigned int MemSize_t;
/* Win32 Basic Datatypes */
#ifdef __SCTS_PLATFORM_WIN32__

#endif
#endif


/******************************************************************
Memory Functions
******************************************************************/

/* Win32 Memory Functions */
#ifdef __SCTS_PLATFORM_WIN32__

void *sctsRealloc(void *pObject, MemSize_t size);
void sctsFree(void *pObject);
void *sctsMemset(void *pObject, int value, MemSize_t count);
void *sctsMemcpy(void *pTarget, const void *pSource, MemSize_t count);
void *sctsMemmove(void *pTarget, const void *pSource, MemSize_t count);
int	sctsMemcmp(const void *pTarget, const void *pSource, MemSize_t count);
void *sctsMalloc(MemSize_t size);

#endif


/******************************************************************
String Functions
******************************************************************/

/* Win32 String Functions */
#ifdef __SCTS_PLATFORM_WIN32__

char *sctsStrdup (const char *constStringP);
char *sctsStrcpy(const char *pTarget, const char *pSource);
char *sctsStrncpy(const char *pTarget, const char *pSource, int count);
char *sctsStrcat(const char *pTarget, const char *pSource);
char *sctsStrncat(const char *pTarget, const char *pSource, int count);
char *sctsStrchr(const char *pString, char character);
char *sctsStrstr(const char *pTarget, const char *pSource);
char *sctsInt2Str(int i,char *buffer,int radix);
char *sctsLong2Str(long l,char *buffer,int radix);
int sctsStrcspn(const char *pTarget, const char *pSource);
long sctsStr2Long(const char *pString);
int sctsStr2Int(const char *pString);
int sctsStrcmp(const char *pTarget, const char *pSource);
int	sctsStrncmp(const char *pTarget, const char *pSource, int count);
int sctsStrlen(const char *pString);
char *sctsGetTimeStamp(bool local=false,long t=0);
long sctsGetTime();

char *sctsFReadString(FILE *fp);
void sctsFWriteString(const char *str,FILE *fp);

#define SCTSASSERT(EXP) sctsAssert((int)(EXP),__FILE__,__LINE__)
void sctsAssert(int,char *,int);
#endif

typedef enum
{
	WBXML=0,
	XML
} SctsEncoding;

typedef enum
{
	SYNCML_DM_1_1_1,
	SYNCML_DM_1_2,
	SYNCML_UNKNOWN
} SctsSyncMLProto;

#endif
