-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_io.h
95 lines (75 loc) · 2.3 KB
/
new_io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* 1999 06 11/20 */
#ifndef NEW_IOBOOK_H
#define NEW_IOBOOK_H
#define MAX_FIELDS 256
#define ZERO ((Byte)0)
#define TEXT_INFO ((Byte)1)
#define DATE_INFO ((Byte)2)
#define SIGNAL_INFO ((Byte)3)
#define DECOMP_INFO ((Byte)4)
typedef unsigned char Byte;
typedef unsigned short Word;
typedef struct {
float energy_percent;
int max_number_of_iterations;
int dictionary_size;
char dictionary_type;
char dummy[3];
} decomposition_info;
#define DECOMP_INFO_SIGNATURE "fddcccc"
typedef struct {
float sampling_freq;
float points_per_microvolt;
int number_of_chanels_in_file;
} signal_info;
#define SIGNAL_INFO_SIGNATURE "ffd"
typedef struct {
Byte code;
Byte size;
void *field;
} TFIELD;
typedef struct {
int numOfFields;
Word HeaderSize;
TFIELD field[MAX_FIELDS];
} FILE_HEADER;
typedef struct {
int channel;
int file_offset;
int book_size;
int signal_size;
float signal_energy;
float book_energy;
} SEG_HEADER;
typedef struct {
float scale;
float frequency;
float position;
float modulus;
float amplitude;
float phase;
} NEW_ATOM;
extern int WriteFileHeader(FILE_HEADER *,FILE *);
extern int WriteSegmentHeader(SEG_HEADER *,FILE *);
extern int ReadFileHeader(FILE_HEADER *,FILE *);
extern int ReadSegmentHeader(SEG_HEADER *,FILE *);
extern int WriteNewAtom(NEW_ATOM *,FILE *);
extern int ReadNewAtom(NEW_ATOM *,FILE *);
extern int checkBookVersion(FILE *);
extern int setBookPosition(int,FILE *);
extern int countBook(char *);
extern int skipHeader(FILE *);
extern void initField(FILE_HEADER *);
extern void *getField(FILE_HEADER *,Byte);
extern int addField(FILE_HEADER *,Byte,void *);
extern void freeAllFields(FILE_HEADER *);
extern void deleteField(FILE_HEADER *,Byte);
extern int addDate(FILE_HEADER *);
#define getDecompPtr(head) ((decomposition_info *)getField(head,DECOMP_INFO))
#define getSignalPtr(head) ((signal_info *)getField(head,SIGNAL_INFO))
#define getTextPtr(head) ((char *)getField(head,TEXT_INFO))
#define getDatePtr(head) ((char *)getField(head,DATE_INFO))
#define addDecompInfo(head,data) addField(head,DECOMP_INFO,(void *)(data))
#define addSignalInfo(head,data) addField(head,SIGNAL_INFO,(void *)(data))
#define addTextInfo(head,data) addField(head,TEXT_INFO,(void *)(data))
#endif