Stimfit
@PACKAGE_VERSION@
Loading...
Searching...
No Matches
src
libstfio
cfs
machine.h
Go to the documentation of this file.
1
/*****************************************************************************
2
**
3
** machine.h
4
**
5
** Copyright (c) Cambridge Electronic Design Limited 1991,1992
6
**
7
** This file is included at the start of 'C' or 'C++' source file to define
8
** things needed to make Macintosh DOS and Windows sources more compatible
9
**
10
** Revision History
11
**
12
** 10/Jun/91 PNC First Version
13
** 3/Mar/92 TDB Added support for non-Windows DOS. Now expects to be
14
** included after windows.h.
15
** 23/Jun/92 GPS Tidied up. SONAPI definitions moved to son.h
16
** 27/Jul/92 GPS Made routines that need to be far in MSDOS as F_xxxxxx
17
** and mapped this to actual name. Also added LPSTR and
18
** DWORD definitions.
19
** 24/Feb/93 PNC Added new defines _IS_MSDOS_ for actual msdos (not for
20
** windows) and _IS_WINDOWS_ for windows (16 or 32 bit)
21
**
22
** 14/Jun/93 KJ Made few changes, enabling it to be used by CFS for DOS,
23
** Windows and Macintosh.
24
**
25
** 01/Oct/93 PNC Defined _near for NT 32 bit compile as this is an invalid
26
** keyword under this compiler.
27
**
28
** 17/Dec/93 PNC DllExport and DllImport added to enable classes to be
29
** exported from dlls more easily in NT 32 bit linker.
30
** Also coord changed to long for 16 bit windows operation.
31
**
32
** 20/Jan/94 PNC Added support for Borland C++ not tested by us, but
33
** tested by a customer.
34
**
35
** 25/Jan/94 MAE Defines added for DOS that should have been there
36
** previously and F_memmove.
37
**
38
** 27/Oct/94 MAE Added FDBL_MAX defines.
39
**
40
** 02/Feb/95 GPS WINNT changed to WIN32 to accomodate Windows 95.
41
**
42
** 08/Jun/95 TDB _fstrrchr defined as strrchr for WIN32 builds.
43
**
44
** 03/May/96 KJ LPCSTR defined as const char* for Mac builds.
45
**
46
** 29/Jul/97 TDB Tweaked for use with Borland C++ Builder
47
**
48
** 03/Dec/98 TDB Added F_malloc and F_free for Windows purposes
49
**
50
*****************************************************************************/
51
52
/*
53
** Borland C++ Builder notes:
54
**
55
** This compiler defines both __MSDOS__ and __WIN32__, I have mapped
56
** __WIN32__ to WIN32 so these defines are used, which work fine.
57
*/
58
59
/*****************************************************************************
60
012345678901234567890123456789012345678901234567890123456789012345678901234567
61
*****************************************************************************/
62
63
#ifndef __MACHINE__
64
#define __MACHINE__
65
66
#include <limits.h>
67
#if ( __WORDSIZE == 64 ) || defined (__APPLE__)
68
#define CFSLONG int
69
#else
70
#define CFSLONG long
71
#endif
72
73
#include <sys/types.h>
/* Needed for various types */
74
#include <sys/stat.h>
/* ditto */
75
76
#include <float.h>
/* for LDBL_DIG */
77
78
#if defined(WIN32) || defined (_MSC_VER)
79
/* if its windows define our windows symbol */
80
#define _IS_WINDOWS_
/* WIN32 is defined for 32-bit at moment */
81
#undef _IS_MSDOS_
/* and we arent doing msdos after all */
82
#endif
83
84
#ifdef _INC_WINDOWS
/* the alternative windows symbolic defn */
85
#ifndef _IS_WINDOWS_
/* as above but _INC_WINDOWS is for 16 bit */
86
#define _IS_WINDOWS_
87
#endif
88
#undef _IS_MSDOS_
/* and we arent doing msdos after all */
89
#endif
90
91
#ifndef TRUE
92
#define TRUE 1
93
#define FALSE 0
94
#endif
95
96
97
#if defined(_IS_WINDOWS_) && !defined(__MINGW32__)
/* Now set up for windows use */
98
#include <Windows.h>
99
#define F_memcpy memcpy
/* Define model-independent routines */
100
#define F_memmove memmove
101
#define F_strlen strlen
102
#define F_strcat strcat
103
#define F_strcpy strcpy
104
#define F_strcmp strcmp
105
#define F_strncat strncat
106
#define F_strncpy strncpy
107
#define F_strncmp strncmp
108
#define F_strchr strchr
109
#define _fstrrchr strrchr
110
#define _near
/* stop compiler errors for 32 bit compile*/
111
#define DllExport __declspec(dllexport)
112
#define DllImport __declspec(dllimport)
113
114
typedef
CFSLONG
Coord
;
/* this is LONG in the MacApp definitions */
115
typedef
double
fdouble
;
116
#define FDBL_DIG DBL_DIG
117
#define FDBL_MAX DBL_MAX
118
typedef
HGLOBAL
THandle
;
119
120
#define F_malloc malloc
121
#define F_free free
122
123
#define M_AllocMem(x) GlobalAlloc(GMEM_MOVEABLE,x)
124
#define M_AllocClear(x) GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT,x)
125
#define M_FreeMem(x) GlobalFree(x)
126
#define M_LockMem(x) GlobalLock(x)
127
#define M_MoveLockMem(x) GlobalLock(x)
128
#define M_UnlockMem(x) (GlobalUnlock(x)==0)
129
#define M_NewMemSize(x,y) (x = GlobalReAlloc(x,y,GMEM_MOVEABLE))
130
#define M_GetMemSize(x) GlobalSize(x)
131
#else
132
#define F_memcpy memcpy
133
#define F_memmove memmove
134
#define F_strlen strlen
135
#define F_strcat strcat
136
#define F_strcpy strcpy
137
#define F_strcmp strcmp
138
#define F_strncat strncat
139
#define F_strncpy strncpy
140
#define F_strncmp strncmp
141
#define F_strchr strchr
142
#define FAR
143
#define PASCAL
144
#define _far
145
#define _near
146
#define DllExport
147
#define DllImport
148
149
#define FDBL_DIG LDBL_DIG
150
#define FDBL_MAX LDBL_MAX
151
typedef
char
*
LPSTR
;
152
typedef
const
char
*
LPCSTR
;
153
typedef
unsigned
short
WORD
;
154
// typedef unsigned CFSLONG DWORD;
155
typedef
unsigned
char
BYTE
;
156
typedef
long
double
fdouble
;
157
typedef
CFSLONG
Coord
;
/* Borrowed from MacApp */
158
typedef
WORD
THandle
;
159
#define F_malloc malloc
160
#define F_free free
161
#define M_AllocMem(x) NewHandle(x)
162
#define M_AllocClear(x) NewHandleClear(x)
163
#define M_FreeMem(x) DisposHandle(x)
164
#define M_LockMem(x) (HLock(x),*x)
165
#define M_MoveLockMem(x) (HLockHi(x),*x)
166
#define M_UnlockMem(x) (HUnlock(x),TRUE)
167
#define M_NewMemSize(x,y) (SetHandleSize(x,y),MemError() == 0)
168
#define M_GetMemSize(x) GetHandleSize(x)
169
#endif
/*UNIX*/
170
#endif
/* not defined __MACHINE__ */
THandle
WORD THandle
Definition
machine.h:158
CFSLONG
#define CFSLONG
Definition
machine.h:70
Coord
CFSLONG Coord
Definition
machine.h:157
fdouble
long double fdouble
Definition
machine.h:156
WORD
unsigned short WORD
Definition
unix.h:44
BYTE
unsigned char BYTE
Definition
unix.h:43
LPSTR
CHAR * LPSTR
Definition
unix.h:93
LPCSTR
const CHAR * LPCSTR
Definition
unix.h:94
Generated by
1.14.0