/****************************************************************************/
/*  FILE: Hnd.h                                                             */
/*  婡擻: HND-SDK偺婎杮僿僢僟                                               */
/*                                                                          */
/*  2004/03/31 Created                                                      */
/*  Modify  : 2006/08/09                                                    */
/*  Copyright (C)SEGA 2004-2006/Creative Center. Graphics Tool Section.     */
/****************************************************************************/

#ifndef __HND_H
#define __HND_H

#ifdef __cplusplus
extern "C" {
#endif

#include "HND_Xpt.h"
#include "HND_Def.h"
#include "HND_Member.h"
#include "HND_Handle.h"
#include "HND_DataType.h"


#define HND_LIB_VER			(1000000)

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

/*-----------------*/
/* API僾儘僩僞僀僾 */
/*-----------------*/
#ifdef WIN32
	#define HNDCALL		__stdcall

	#ifdef HNDDLL_EXPORTS
		#define HNDDLL_API __declspec(dllexport)
	#else 
		#ifdef HNDDLL_USE
			#define HNDDLL_API __declspec(dllimport)
		#else
			#define HNDDLL_API 
		#endif
	#endif

#else	/* for GNU */

	#ifndef __stdcall
		#define __stdcall
	#endif

	#define HNDCALL		

	#ifdef HNDDLL_EXPORTS
		#define HNDDLL_API
	#else 
		#ifdef HNDDLL_USE
			#define HNDDLL_API 
		#else
			#define HNDDLL_API 
		#endif
	#endif

#endif

// HND Member偺宆			// 曄悢偺宆
typedef enum _HnmType {
	HNT_UNKNOWN		= 0,	// 晄柧
	HNT_HANDLE		= 1,	// HNS_HANDLE
	HNT_HANDLEX2	= 2,	// HNS_HANDLE[2]枹巊梡
	HNT_HANDLEX3	= 3,	// HNS_HANDLE[3]
	HNT_HANDLEX4	= 4,	// HNS_HANDLE[4]
	HNT_ID			= 5,	// Sint32
	HNT_IDX2		= 6,	// Sint32[2]枹巊梡
	HNT_IDX3		= 7,	// Sint32[3]枹巊梡
	HNT_IDX4		= 8,	// Sint32[4]枹巊梡
	HNT_UINT32		= 9,	// Uint32
	HNT_UINT32X2	= 10,	// Uint32[2]枹巊梡
	HNT_UINT32X3	= 11,	// Uint32[3]枹巊梡
	HNT_UINT32X4	= 12,	// Uint32[4]枹巊梡
	HNT_SINT32		= 13,	// Sint32
	HNT_SINT32X2	= 14,	// Sint32[2]枹巊梡
	HNT_SINT32X3	= 15,	// Sint32[3]枹巊梡
	HNT_SINT32X4	= 16,	// Sint32[4]枹巊梡
	HNT_FLOAT		= 17,	// Float
	HNT_FLOATX2		= 18,	// Float[2]枹巊梡
	HNT_FLOATX3		= 19,	// Float[3]
	HNT_FLOATX4		= 20,	// Float[4]枹巊梡
	HNT_BOOL		= 21,	// Bool
	HNT_BOOLX2		= 22,	// Bool[2]枹巊梡
	HNT_BOOLX3		= 23,	// Bool[3]枹巊梡
	HNT_BOOLX4		= 24,	// Bool[4]枹巊梡
	HNT_STRING		= 25,	// String
	HNT_STRINGX2	= 26,	// String[2]枹巊梡
	HNT_STRINGX3	= 27,	// String[3]枹巊梡
	HNT_STRINGX4	= 28,	// String[4]枹巊梡
	HNT_I2D			= 29,	// HNS_I2D枹巊梡
	HNT_I3D			= 30,	// HNS_I3D
	HNT_I4D			= 31,	// HNS_I4D枹巊梡
	HNT_F2D			= 32,	// HNS_F2D
	HNT_F3D			= 33,	// HNS_F3D
	HNT_F4D			= 34,	// HNS_F4D
	HNT_TYPE		= 35,	// HnmID
	HNT_TYPEX2		= 36,	// HnmID[2]
	HNT_TYPEX3		= 37,	// HnmID[3]
	HNT_TYPEX4		= 38,	// HnmID[4]
} HnmType;

/* 媽 */
#include "HND_OldFunctions.h"
#include "HND_OldMember.h"

/* System  ******************************************************************/
HNDDLL_API HND_ERROR   HNDCALL hnSysInitSystem    (void);
HNDDLL_API HND_ERROR   HNDCALL hnSysExitSystem    (void);
HNDDLL_API const char* HNDCALL hnSysGetVersion    (void);
HNDDLL_API const char* HNDCALL hnSysGetHnmIDString(HnmID id);
HNDDLL_API const char* HNDCALL hnSysGetErrorString(HND_ERROR err);
/****************************************************************************/

/* HandleControl ************************************************************/
HNDDLL_API void      HNDCALL hnInitHandle           (HNS_HANDLE *handle , HnmID id);
HNDDLL_API HND_ERROR HNDCALL hnCreateHandle         (HNS_HANDLE *Handle , Sint32 Num, HnmID id);
HNDDLL_API HND_ERROR HNDCALL hnDeleteHandle         (HNS_HANDLE *Handle);
HNDDLL_API Bool      HNDCALL hnIsHandle             (HNS_HANDLE *handle);
HNDDLL_API Bool      HNDCALL hnIsHandleMember       (HNS_HANDLE *handle , HnmID id);
HNDDLL_API Bool      HNDCALL hnIsSameHandle         (HNS_HANDLE *src    , HNS_HANDLE *dst);
HNDDLL_API HnmID     HNDCALL hnGetHandleType        (HNS_HANDLE *Handle);
HNDDLL_API HnmType   HNDCALL hnGetHandleMemberType  (HNS_HANDLE *Handle , HnmID id);
HNDDLL_API Sint32    HNDCALL hnGetHandleDataCount   (HNS_HANDLE *Handle);
HNDDLL_API HND_ERROR HNDCALL hnGetIndexFromID       (HNS_HANDLE *Handle , Uint32 id, Sint32 *Num);
HNDDLL_API HND_ERROR HNDCALL hnAddHandle            (HNS_HANDLE *src    , HNS_HANDLE *add);
HNDDLL_API HND_ERROR HNDCALL hnDisconnectHandle     (HNS_HANDLE *Handle);
HNDDLL_API HND_ERROR HNDCALL hnDuplicateHandle      (HNS_HANDLE *Handle , Sint32 Num, HNS_HANDLE *Value, Sint32 Size);
/****************************************************************************/

/* Uniq ID *****************************************************************/
HNDDLL_API	HND_ERROR HNDCALL hnSysSetIDCount  (HnmID id, Sint32 start_id);
HNDDLL_API	HND_ERROR HNDCALL hnSysResetIDCount(void);
/****************************************************************************/

/* Error ********************************************************************/
HNDDLL_API void HNDCALL hnSysGetLastError(HND_ERROR *err, HnmID *HandleID, Sint32 *num, HnmID *id);
HNDDLL_API void HNDCALL hnSysClearError  (void);

typedef void (*HND_ERROR_CALLBACK)(HND_ERROR err, HnmID HandleID, Sint32 num, HnmID id);
HNDDLL_API HND_ERROR HNDCALL hnSysSetErrorCallback(HND_ERROR_CALLBACK callbackfunc);
/****************************************************************************/

/* Get Set Value ************************************************************/
HNDDLL_API HND_ERROR HNDCALL hnGetValueSint32 (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Sint32     *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueSint32 (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Sint32      Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueSint32X(HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Sint32     *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueSint32X(HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Sint32     *Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueUint32 (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Uint32     *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueUint32 (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Uint32      Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueUint32X(HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Uint32     *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueUint32X(HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Uint32     *Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueFloat  (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Float      *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueFloat  (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Float       Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueFloatX (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Float      *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueFloatX (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Float      *Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueBool   (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Bool       *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueBool   (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, Bool        Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueHandle (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, HNS_HANDLE *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueHandle (HNS_HANDLE *Handle, Sint32 Num, HnmID Id, HNS_HANDLE *Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueHandleX(HNS_HANDLE *Handle, Sint32 Num, HnmID Id, HNS_HANDLE *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueHandleX(HNS_HANDLE *Handle, Sint32 Num, HnmID Id, HNS_HANDLE *Value);

/* String */
HNDDLL_API HND_ERROR HNDCALL hnGetValueString2 (HNS_HANDLE *Handle, Sint32 Num, HnmID id, char   *Value, Sint32 Size );
HNDDLL_API HND_ERROR HNDCALL hnGetValueString  (HNS_HANDLE *Handle, Sint32 Num, HnmID id, char   *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValueString  (HNS_HANDLE *handle, Sint32 Num, HnmID id, char   *Value);
HNDDLL_API HND_ERROR HNDCALL hnGetValueNbString(HNS_HANDLE *Handle, Sint32 Num, HnmID id, Sint32 *Size );

/* Find *********************************************************************/
HNDDLL_API HND_ERROR HNDCALL hnFindObject(HNS_HANDLE *Handle, char *strSearchName, HNS_HANDLE *hResult);
/****************************************************************************/

/****************************************************************************/
HNDDLL_API HND_ERROR HNDCALL hnGetValue   (HNS_HANDLE *Handle, Sint32 Num, HnmID id, void   *Value);
HNDDLL_API HND_ERROR HNDCALL hnSetValue   (HNS_HANDLE *Handle, Sint32 Num, HnmID id, void   *Value);
HNDDLL_API HND_ERROR HNDCALL hnGetNbValue (HNS_HANDLE *Handle, Sint32 Num, HnmID id, void   *Value);
/****************************************************************************/

/* Utility  ******************************************************************/
HNDDLL_API void   HNDCALL hnUtilReadAngleUnit(Sint32 AngleUnitID);
/****************************************************************************/

#ifdef __cplusplus
}
#endif

#endif
