#pragma once

#include "Pascal.h"

const wchar_t JASS_API_DLL_NAME[] = L"JassApi.dll";

typedef void *PJassString;
typedef longword TJassStringHandle;
typedef longword TJassObjectHandle;
typedef longword TJassFunctionHandle;

typedef longword TJassHandle;

struct TSingle {
	Single Value;
};
enum TJassEventType { jeMainBeingCalled = 0, jeMainThreadDestruction = 1, jeMainThreadDestroyed = 2 };

typedef procedure TJassEventCallback (Pointer Parameter);
typedef longword TEventRegistrationHandle;

typedef PJassString (__stdcall *pGetJassString) (PChar Value);
typedef LongBool (__stdcall *pRegisterJassNative) (PChar Name, PChar Signature, Pointer Address);

typedef LongBool (__stdcall *pUnregisterJassNative)(PChar Name);
typedef Pointer (__stdcall *pGetJassNative)(PChar Name);

//typedef longword TJassStringHandle;
typedef TJassStringHandle (__stdcall *pGetStringHandle) (PChar Value);

//typedef PJassString (__stdcall *pGetStringFromHandle)(TJassStringHandle StringHandle);
typedef PChar (__stdcall *pGetStringFromHandle)(TJassStringHandle StringHandle);
typedef PJassString (__stdcall *pCreateJassString)(PChar AContent);
typedef procedure (__stdcall *pDestroyJassString)(PJassString AString);
typedef procedure (__stdcall *pSetJassStringContent)(PJassString AString, PChar AContent);
typedef PChar (__stdcall *pGetJassStringContent)(PJassString JassString);
typedef procedure (__stdcall *pIncrementStringReferences)(TJassStringHandle StringHandle);
typedef procedure (__stdcall *pDecrementStringReferences)(TJassStringHandle StringHandle);

typedef procedure (__stdcall *pIncrementHandleReferences)(TJassObjectHandle ObjectHandle);
typedef procedure (__stdcall *pDecrementHandleReferences)(TJassObjectHandle ObjectHandle);

typedef TEventRegistrationHandle (__stdcall *pAddEventHandler)(TJassEventType EventType, TJassEventCallback Callback, Pointer Parameter);
typedef LongBool (__stdcall *pRemoveEventHandler)(TEventRegistrationHandle ID);
typedef procedure (__stdcall *pPostEvent)(TJassEventType EventType);