Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*max@home*/
Toshihiro Shimizu 890ddd
#ifndef __GLOBAL_DEF_H__
Toshihiro Shimizu 890ddd
#define __GLOBAL_DEF_H__
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
#define GLOBAL_LOCK(P) GlobalLock(P)
Toshihiro Shimizu 890ddd
#define GLOBAL_ALLOC(T, S) GlobalAlloc(T, S)
Toshihiro Shimizu 890ddd
#define GLOBAL_FREE(P) GlobalFree(P)
Toshihiro Shimizu 890ddd
#define GLOBAL_UNLOCK(P) GlobalUnlock(P)
Toshihiro Shimizu 890ddd
#else
Campbell Barton deffae
#ifdef __APPLE__
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
#define GLOBAL_LOCK(P)      *(P)
Toshihiro Shimizu 890ddd
//#define GLOBAL_ALLOC(T, S)  NewHandle(S)
Toshihiro Shimizu 890ddd
//#define GLOBAL_FREE(P)      DisposeHandle( (char**)P)
Toshihiro Shimizu 890ddd
#define GLOBAL_ALLOC(T, S)  (TW_HANDLE)NewPtr(S)
Toshihiro Shimizu 890ddd
#define GLOBAL_FREE(S)      DisposePtr(S)
Toshihiro Shimizu 890ddd
#define GLOBAL_UNLOCK(P)    {}
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define GLOBAL_ALLOC(T, S) NewHandle(S)
Toshihiro Shimizu 890ddd
#define GLOBAL_FREE(P) DisposeHandle(P)
Toshihiro Shimizu 890ddd
//#define GLOBAL_ALLOC(T, S)  (TW_HANDLE)NewPtr(S)
Toshihiro Shimizu 890ddd
//#define GLOBAL_FREE(S)      DisposePtr((char*)S)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TW_HANDLE GLOBAL_LOCK(TW_HANDLE S);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define GLOBAL_UNLOCK(P) HUnlock((TW_HANDLE)P)
Campbell Barton deffae
Campbell Barton deffae
#else /* UNIX */
Campbell Barton deffae
Campbell Barton deffae
#include <stdlib.h></stdlib.h>
Campbell Barton deffae
/* just some hack to get it built */
Campbell Barton deffae
typedef void *TW_HANDLE;
Campbell Barton deffae
#define GLOBAL_LOCK(P) (P)
Campbell Barton deffae
#define GLOBAL_ALLOC(T, S) malloc(S)
Campbell Barton deffae
#define GLOBAL_FREE(P) free(P)
Rozhuk Ivan 823a31
#define GLOBAL_UNLOCK(P)
Campbell Barton deffae
Campbell Barton deffae
#endif
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
#endif /*__GLOBAL_DEF_H__*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void TTWAIN_ErrorBox(const char *msg);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif