#ifndef TCI_CALLBACKS_C
#define TCI_CALLBACKS_C

#include <stdlib.h>
#include <string.h>
#include "TciCallbacks.h"

TCallbacks callbacks;
#ifdef _WIN32
#define DLLEXP __declspec(dllexport)
#else
#define DLLEXP
#endif

#define TCI_FUNCION_NAME(param) FTci##param
#define TCI_VAR_NAME(param) fn##param
#define INIT_CALLBACK_DECL(param) TCI_FUNCION_NAME(param) TCI_VAR_NAME(param) = NULL; \
	DLLEXP void InitTci##param##Callback(TCI_FUNCION_NAME(param) f) \
	{ \
		TCI_VAR_NAME(param) = f; \
	}

DLLEXP void InitCallback(TCallbacks val)
{
	callbacks = val;
	initTci();
}

INIT_CALLBACK_DECL(SetNull)
INIT_CALLBACK_DECL(IsNull)
INIT_CALLBACK_DECL(GetRecordOfOffset)
INIT_CALLBACK_DECL(IsOmit)
INIT_CALLBACK_DECL(IsAny)
INIT_CALLBACK_DECL(IsAnyOrOmit)
INIT_CALLBACK_DECL(GetTemplateDef)
INIT_CALLBACK_DECL(IsAnyNonValue)
INIT_CALLBACK_DECL(IsAllNonValue)
INIT_CALLBACK_DECL(GetTemplateDefNonValue)
INIT_CALLBACK_DECL(GetValueListSize)
INIT_CALLBACK_DECL(IsValueListEmpty)
INIT_CALLBACK_DECL(GetValueListItem)
INIT_CALLBACK_DECL(GetUCStringValueWchar)
INIT_CALLBACK_DECL(SetUCStringValueWchar)
INIT_CALLBACK_DECL(SIWriteToTCLog)
INIT_CALLBACK_DECL(SIInternalDecode)
INIT_CALLBACK_DECL(SIInternalEncode)
INIT_CALLBACK_DECL(ReleaseBinaryStringManaged)
INIT_CALLBACK_DECL(GetEnumInt)
INIT_CALLBACK_DECL(SetEnumInt)

DLLEXP void Dispose()
{
	disposeTci();
}

DLLEXP int32_t GetSizeOfLongInt()
{
	return (int32_t)sizeof(long int);
}

DLLEXP int32_t GetSizeOfWChar()
{
	return (int32_t)sizeof(wchar_t);
}

#endif
