Stimfit @PACKAGE_VERSION@
Loading...
Searching...
No Matches
cfs.h
Go to the documentation of this file.
1/*****************************************************************************
2**
3** cfs.h
4** 78 cols --->*
5** Header file for MSC version of CFS functions.
6** Definitions of the structures and routines for the CFS filing *
7** system. This is the include file for standard use, all access *
8** is by means of functions - no access to the internal CFS data. The file *
9** machine.h provides some common definitions across separate platforms, *
10** note that the MS variants are designed to accomodate medium model - far *
11** pointers are explicitly used where necessary.
12**
13** CFSAPI Don't declare this to give a pascal type on the Mac, there is a MPW
14** compiler bug that corrupts floats passed to pascal functions!!!!!!
15**
16*/
17
18#ifndef __CFS__
19#define __CFS__
20
21#include "machine.h"
22
23#if defined(_IS_WINDOWS_) && !defined(__MINGW32__)
24 #include <fcntl.h>
25 #define qDebug 0 /* only used to debug Mac stuff */
26 #define CFSAPI(type) type WINAPI
27 #undef LLIO
28 #undef USEHANDLES
29 #ifdef _MSC_VER
30 #pragma warning( disable : 4251 ) // Disable warning messages
31 #pragma warning( disable : 4996 ) // Disable warning messages
32 #endif
33#else
34 #define qDebug 0 /* only used to debug Mac stuff */
35 #if !defined(__APPLE__) && !defined(__MINGW32)
36 #include <malloc.h>
37 #endif
38 #include <stdio.h> /* MSC I/O function definitions */
39 #include <fcntl.h>
40 #include <errno.h>
41 #define CFSAPI(type) type
42#endif
43
44#define FILEVAR 0 /* Constants to indicate whether variable is */
45#define DSVAR 1 /* file or data section variable. */
46#define INT1 0 /* DATA VARIABLE STORAGE TYPES */
47#define WRD1 1
48#define INT2 2
49#define WRD2 3
50#define INT4 4
51#define RL4 5
52#define RL8 6
53#define LSTR 7
54#define SUBSIDIARY 2 /* Chan Data Storage types */
55#define MATRIX 1
56#define EQUALSPACED 0 /* Chan Data Storage types */
57
58#define noFlags 0 /* Declare a default flag */
59
60/* Definitions of bits for DS flags */
61
62#define FLAG7 1
63#define FLAG6 2
64#define FLAG5 4
65#define FLAG4 8
66#define FLAG3 16
67#define FLAG2 32
68#define FLAG1 64
69#define FLAG0 128
70#define FLAG15 256
71#define FLAG14 512
72#define FLAG13 1024
73#define FLAG12 2048
74#define FLAG11 4096
75#define FLAG10 8192
76#define FLAG9 16384
77#define FLAG8 32768
78
79
80/* define numbers of characters in various string types */
81
82#define DESCCHARS 20
83#define FNAMECHARS 12
84#define COMMENTCHARS 72
85#define UNITCHARS 8
86
87/*character arrays used in data structure */
88
89typedef char TDataType;
90typedef char TCFSKind;
91typedef char TDesc[DESCCHARS+2]; /* Names in descriptions, 20 chars */
92typedef char TFileName[FNAMECHARS+2]; /* File names, 12 chars */
93typedef char TComment[COMMENTCHARS+2]; /* Comment, 72 chars max */
94typedef char TUnits[UNITCHARS+2]; /* For units, 8 chars */
95
96/* other types for users benefit */
97
98typedef WORD TSFlags;
99
100/* for data and data section variables */
101
102typedef struct
103{
104 TDesc varDesc; /* users description of variable */
105 TDataType vType; /* one of 8 types allowed */
106 char zeroByte; /* for MS Pascal compatibility */
107 TUnits varUnits; /* users name for units */
108 short vSize; /* for type lstr gives no. of chars +1 for length byte */
109} TVarDesc;
110
111#if !defined(_IS_WINDOWS_) || defined(__MINGW32__)
112typedef char * TpStr;
113typedef const char * TpCStr;
114typedef short * TpShort;
115typedef float * TpFloat;
116typedef CFSLONG * TpLong;
117typedef void * TpVoid;
118typedef TSFlags * TpFlags;
122typedef const TVarDesc * TpCVDesc;
124typedef signed char * TpSStr;
125typedef WORD * TpUShort;
126
127#else
128typedef char FAR * TpStr;
129typedef const char FAR * TpCStr;
130typedef short FAR * TpShort;
131typedef float FAR * TpFloat;
132typedef CFSLONG FAR * TpLong;
133typedef void FAR * TpVoid;
134typedef TSFlags FAR * TpFlags;
135typedef TDataType FAR * TpDType;
136typedef TCFSKind FAR * TpDKind;
137typedef TVarDesc FAR * TpVDesc;
138typedef const TVarDesc FAR * TpCVDesc;
139typedef THandle FAR * TpHandle;
140typedef signed char FAR * TpSStr;
141typedef WORD FAR * TpUShort;
142#endif
143
144 #if defined(_IS_WINDOWS_) && !defined(__MINGW32__)
145 typedef HANDLE fDef; /* WIN32 file handle */
146 #else
147 #ifdef LLIO
148 typedef short fDef; /* file handle */
149 #else
150 typedef FILE* fDef; /* stream identifier */
151 #endif
152 #endif
153
154
155#ifdef __cplusplus
156extern "C" {
157#endif
158
159/*
160** Now definitions of the functions defined in the code
161*/
162
163CFSAPI(short) CreateCFSFile(TpCStr fname,
166 short channels,
169 short fileVars,
170 short DSVars);
171
172CFSAPI(void) SetFileChan(short handle,
173 short channel,
179 short spacing,
180 short other);
181
182CFSAPI(void) SetDSChan(short handle,
183 short channel,
187 float yScale,
188 float yOffset,
189 float xScale,
190 float xOffset);
191
192CFSAPI(short) WriteData(short handle,
197
198CFSAPI(short) ClearDS(short handle);
199
200CFSAPI(void) SetWriteData(short handle,
202 CFSLONG bytes);
203
204CFSAPI(CFSLONG) CFSFileSize(short handle);
205
206CFSAPI(short) InsertDS(short handle,
209
210CFSAPI(short) AppendDS(short handle,
213
214CFSAPI(void) RemoveDS(short handle,
216
217CFSAPI(void) SetComment(short handle,
219
220CFSAPI(void) SetVarVal(short handle,
221 short varNo,
222 short varKind,
225
226CFSAPI(short) CloseCFSFile(short handle);
227
228
229CFSAPI(short) OpenCFSFile(TpCStr fname,
232
233CFSAPI(void) GetGenInfo(short handle,
236 TpStr comment);
237
238CFSAPI(void) GetFileInfo(short handle,
243
244CFSAPI(void) GetVarDesc(short handle,
245 short varNo,
246 short varKind,
251
252CFSAPI(void) GetVarVal(short handle,
253 short varNo,
254 short varKind,
256 TpVoid varADS);
257
258CFSAPI(void) GetFileChan(short handle,
259 short channel,
266 TpShort other);
267
268CFSAPI(void) GetDSChan(short handle,
269 short channel,
277
278CFSAPI(WORD) GetChanData(short handle,
279 short channel,
285
286CFSAPI(CFSLONG) GetDSSize(short handle,
288
289CFSAPI(short) ReadData(short handle,
292 WORD bytes,
294
295CFSAPI(WORD) DSFlagValue(int nflag);
296
297CFSAPI(void) DSFlags(short handle,
299 short setIt,
301
302CFSAPI(short) FileError(TpShort handleNo,
305
306CFSAPI(short) CommitCFSFile(short handle);
307
308#ifdef __cplusplus
309}
310#endif
311
312#endif /* __CFS__ */
#define CFSAPI(type)
Definition cfs.h:41
short TpCStr TpCStr TpCStr TDataType TCFSKind short short other
Definition cfs.h:180
WORD CFSLONG WORD TpVoid dataADS
Definition cfs.h:196
short short WORD TpVoid varADS
Definition cfs.h:224
WORD TSFlags
Definition cfs.h:98
TpStr TpStr date
Definition cfs.h:235
float * TpFloat
Definition cfs.h:115
TpCStr WORD short channels
Definition cfs.h:166
TCFSKind * TpDKind
Definition cfs.h:120
WORD CFSLONG WORD bytes
Definition cfs.h:195
short WORD CFSLONG CFSLONG float yScale
Definition cfs.h:187
short short varKind
Definition cfs.h:222
TpCStr WORD short TpCVDesc fileArray
Definition cfs.h:167
TpShort TpShort errNo
Definition cfs.h:304
short WORD dataSection
Definition cfs.h:184
TDataType * TpDType
Definition cfs.h:119
short WORD CFSLONG CFSLONG float float float xScale
Definition cfs.h:189
TpStr time
Definition cfs.h:234
short short TpShort varSize
Definition cfs.h:247
short TpCStr TpCStr yUnits
Definition cfs.h:175
TpShort TpShort TpShort TpUShort dataSections
Definition cfs.h:242
TVarDesc * TpVDesc
Definition cfs.h:121
TSFlags * TpFlags
Definition cfs.h:118
short channel
Definition cfs.h:173
#define UNITCHARS
Definition cfs.h:85
TpCStr WORD short TpCVDesc TpCVDesc short fileVars
Definition cfs.h:169
TpCStr WORD short TpCVDesc TpCVDesc DSArray
Definition cfs.h:168
short TpCStr TpCStr TpCStr xUnits
Definition cfs.h:176
WORD TSFlags flagSet
Definition cfs.h:208
short WORD CFSLONG WORD numberElements
Definition cfs.h:282
#define DESCCHARS
Definition cfs.h:82
WORD short setIt
Definition cfs.h:299
short short TpShort TpDType varType
Definition cfs.h:248
char TComment[COMMENTCHARS+2]
Definition cfs.h:93
void * TpVoid
Definition cfs.h:117
WORD * TpUShort
Definition cfs.h:125
WORD CFSLONG startOffest
Definition cfs.h:291
short TpCStr TpCStr TpCStr TDataType TCFSKind dataKind
Definition cfs.h:178
short WORD CFSLONG firstElement
Definition cfs.h:281
const TVarDesc * TpCVDesc
Definition cfs.h:122
TpCStr WORD short TpCVDesc TpCVDesc short short DSVars
Definition cfs.h:170
char TUnits[UNITCHARS+2]
Definition cfs.h:94
short WORD CFSLONG CFSLONG float float yOffset
Definition cfs.h:188
CFSLONG * TpLong
Definition cfs.h:116
short TpCStr channelName
Definition cfs.h:174
char TDesc[DESCCHARS+2]
Definition cfs.h:91
TpCStr comment
Definition cfs.h:164
#define COMMENTCHARS
Definition cfs.h:84
short WORD CFSLONG WORD TpVoid CFSLONG areaSize
Definition cfs.h:284
short short memoryTable
Definition cfs.h:231
char TFileName[FNAMECHARS+2]
Definition cfs.h:92
const char * TpCStr
Definition cfs.h:113
signed char * TpSStr
Definition cfs.h:124
char TDataType
Definition cfs.h:89
CFSLONG lSize
Definition cfs.h:211
short TpCStr TpCStr TpCStr TDataType dataType
Definition cfs.h:177
WORD short TpFlags pflagSet
Definition cfs.h:300
short WORD CFSLONG startOffset
Definition cfs.h:185
short * TpShort
Definition cfs.h:114
TpShort procNo
Definition cfs.h:303
char * TpStr
Definition cfs.h:112
THandle * TpHandle
Definition cfs.h:123
short TpCStr TpCStr TpCStr TDataType TCFSKind short spacing
Definition cfs.h:179
TpCStr WORD blocksize
Definition cfs.h:165
#define FNAMECHARS
Definition cfs.h:83
short varNo
Definition cfs.h:221
short WORD CFSLONG CFSLONG float float float float xOffset
Definition cfs.h:190
FILE * fDef
Definition cfs.h:150
char TCFSKind
Definition cfs.h:90
short WORD CFSLONG CFSLONG points
Definition cfs.h:186
short short TpShort TpDType TpStr TpStr description
Definition cfs.h:250
short short TpShort TpDType TpStr units
Definition cfs.h:249
short enableWrite
Definition cfs.h:230
WORD THandle
Definition machine.h:158
#define CFSLONG
Definition machine.h:70
#define FAR
Definition machine.h:142
TDesc varDesc
Definition cfs.h:104
TUnits varUnits
Definition cfs.h:107
short vSize
Definition cfs.h:108
TDataType vType
Definition cfs.h:105
char zeroByte
Definition cfs.h:106
unsigned short WORD
Definition unix.h:44
void * HANDLE
Definition unix.h:136