2
2
Copyright (c) 1993-2008, Cognitive Technologies
5
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
6
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
8
* ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
9
���� ����������� �� ��������� �����, ���� ������ ������� � �����������
11
* ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
12
������ ����������, ������������ ��� ���������������, ������ �����������
13
��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
14
����������� ����� �� ��������.
15
* �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
16
���� ������������ � �������� �������� ��������� �/��� �����������
17
���������, ���������� �� ���� ��, ��� ���������������� �����������
20
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
21
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
22
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
23
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
24
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
25
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
26
������������� ������, ��������� � �������������� ��� ���������� ����������
27
������������� ������������� ��������� (������� ������ ������, ��� ������,
28
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
29
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
30
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
31
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
5
Разрешается повторное распространение и использование как в виде исходного кода,
6
так и в двоичной форме, с изменениями или без, при соблюдении следующих условий:
8
* При повторном распространении исходного кода должны оставаться указанное
9
выше уведомление об авторском праве, этот список условий и последующий
11
* При повторном распространении двоичного кода в документации и/или в
12
других материалах, поставляемых при распространении, должны сохраняться
13
указанная выше информация об авторском праве, этот список условий и
14
последующий отказ от гарантий.
15
* Ни название Cognitive Technologies, ни имена ее сотрудников не могут
16
быть использованы в качестве средства поддержки и/или продвижения
17
продуктов, основанных на этом ПО, без предварительного письменного
20
ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК
21
ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ,
22
ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ
23
ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ
24
МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ
25
НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ
26
ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ
27
НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ,
28
СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ
29
ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ,
30
НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ
31
ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ.
33
33
Redistribution and use in source and binary forms, with or without modification,
34
34
are permitted provided that the following conditions are met:
99
99
///////////////////////////////////////////////////////////////////////////////////////////////
101
101
//#define Handle void *
102
// typedef void *Handle, **PHandle;
102
// typedef void *Handle, **Handle*;
106
//#define LPVOID void *
107
typedef void *PVOID, *LPVOID;
106
//#define pvoid void *
107
typedef void *pvoid, *pvoid;
109
109
///////////////////////////////////////////////////////////////////////////////////////////////
110
110
#define CFIO_MAX_PATH 256
111
111
#define CFIO_MAX_OWNER 16
112
112
#define CFIO_MAX_COMMENT 48
113
113
///////////////////////////////////////////////////////////////////////////////////////////////
114
CFIO_FUNC(Bool32) CFIO_Init(Word16 wHeightCode,Handle hStorage);
114
CFIO_FUNC(Bool32) CFIO_Init(uint16_t wHeightCode,Handle hStorage);
115
115
CFIO_FUNC(Bool32) CFIO_Done();
116
CFIO_FUNC(Word32) CFIO_GetReturnCode();
117
CFIO_FUNC(Int8 *) CFIO_GetReturnString(Word32 dwError);
118
CFIO_FUNC(Bool32) CFIO_GetExportData(Word32 dwType, void * pData);
119
CFIO_FUNC(Bool32) CFIO_SetImportData(Word32 dwType, void * pData);
116
CFIO_FUNC(uint32_t) CFIO_GetReturnCode();
117
CFIO_FUNC(char *) CFIO_GetReturnString(uint32_t dwError);
118
CFIO_FUNC(Bool32) CFIO_GetExportData(uint32_t dwType, void * pData);
119
CFIO_FUNC(Bool32) CFIO_SetImportData(uint32_t dwType, void * pData);
120
120
///////////////////////////////////////////////////////////////////////////////////////////////
174
174
#define CS_SAVE 0x08 // Save storage at current state
175
175
#define CS_FILE_SAVE 0x10 // Save all attached files
176
176
#define CS_ALL 0x20 // Close all open storages
177
//typedef Bool32 (*FNCloseStorage)(Handle, Word32);
177
//typedef Bool32 (*FNCloseStorage)(Handle, uint32_t);
178
178
//Bool32 CloseStorage (Handle hStorage,
180
DEC_FUN(Bool32, CloseStorage, (Handle, Word32));
180
DEC_FUN(Bool32, CloseStorage, (Handle, uint32_t));
181
181
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
182
182
//Delete storage from disk (don't need to be opened)
183
183
//typedef Bool32 (*FNDeleteStorage)(char *);
184
184
//Bool32 DeleteStorage (char * lpName);
185
DEC_FUN(Bool32, DeleteStorage, (PInt8));
185
DEC_FUN(Bool32, DeleteStorage, (pchar));
186
186
////////////////////////////////////////////////////////////////////////////////////////////////////////Files
187
187
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
188
188
//Write file to storage
189
//typedef Word32 (*FNWriteFileToStorage)(Handle , Handle, char * );
190
//Word32 WriteFileToStorage (Handle hStorage,
189
//typedef uint32_t (*FNWriteFileToStorage)(Handle , Handle, char * );
190
//uint32_t WriteFileToStorage (Handle hStorage,
192
192
// char * lpName);
193
DEC_FUN(Word32, WriteFileToStorage, (Handle , Handle, PInt8 ));
193
DEC_FUN(uint32_t, WriteFileToStorage, (Handle , Handle, pchar ));
194
194
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
195
195
//Read file from storage
196
196
//typedef Handle (*FNReadFileFromStorage)(Handle , char * );
197
197
//Handle ReadFileFromStorage (Handle hStorage,
198
198
// char * lpName);
199
DEC_FUN(Handle, ReadFileFromStorage, (Handle , PInt8 ));
199
DEC_FUN(Handle, ReadFileFromStorage, (Handle , pchar ));
200
200
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
202
202
#define OSF_CREATE 0x01
206
206
#define OSF_BINARY 0x10
207
207
#define OSF_IN_MEMORY 0x20
208
208
#define OSF_TEMPORARY 0x40
209
//typedef Handle (*FNOpen)(Handle, char *, Word32);
209
//typedef Handle (*FNOpen)(Handle, char *, uint32_t);
210
210
//Handle OpenFreeFile (Handle hFile,
211
211
// char * lpName,
213
DEC_FUN(Handle, OpenFreeFile, (Handle, PInt8, Word32));
213
DEC_FUN(Handle, OpenFreeFile, (Handle, pchar, uint32_t));
214
214
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
216
216
#define CSF_SAVEDISK 0x01
217
217
#define CSF_SAVESTORAGE 0x02
218
218
#define CSF_DELETE 0x04
219
219
#define CSF_WRITE 0x08
220
//typedef Bool32 (*FNClose)(Handle, Word32);
220
//typedef Bool32 (*FNClose)(Handle, uint32_t);
221
221
//Bool32 CloseFreeFile (Handle hFile,
223
DEC_FUN(Bool32, CloseFreeFile, (Handle, Word32));
223
DEC_FUN(Bool32, CloseFreeFile, (Handle, uint32_t));
224
224
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
225
225
//Write data to file
226
//typedef Word32 (*FNWrite)(Handle, char *, Word32);
227
//Word32 WriteToFile (Handle hFile,
226
//typedef uint32_t (*FNWrite)(Handle, char *, uint32_t);
227
//uint32_t WriteToFile (Handle hFile,
228
228
// char * lpData,
230
DEC_FUN(Word32, WriteToFile, (Handle, PInt8, Word32));
230
DEC_FUN(uint32_t, WriteToFile, (Handle, pchar, uint32_t));
231
231
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
232
232
// Read data from file
233
//typedef Word32 (*FNRead)(Handle, char *, Word32);
234
//Word32 ReadFromFile (Handle hFile,
233
//typedef uint32_t (*FNRead)(Handle, char *, uint32_t);
234
//uint32_t ReadFromFile (Handle hFile,
235
235
// char * lpData,
237
DEC_FUN(Word32, ReadFromFile, (Handle, PInt8, Word32));
237
DEC_FUN(uint32_t, ReadFromFile, (Handle, pchar, uint32_t));
238
238
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
240
240
#define FS_END 0x01
241
241
#define FS_BEGIN 0x02
242
242
#define FS_CUR 0x04
243
//typedef Word32 (*FNSeek)(Handle, Word32, Word32);
244
//Word32 SeekFilePointer (Handle hFile,
247
DEC_FUN(Word32, SeekFilePointer, (Handle, Word32, Word32));
243
//typedef uint32_t (*FNSeek)(Handle, uint32_t, uint32_t);
244
//uint32_t SeekFilePointer (Handle hFile,
247
DEC_FUN(uint32_t, SeekFilePointer, (Handle, uint32_t, uint32_t));
248
248
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
250
//typedef Word32 (*FNTell)(Handle);
251
//Word32 TellFilePointer (Handle hFile);
252
DEC_FUN(Word32, TellFilePointer, (Handle));
250
//typedef uint32_t (*FNTell)(Handle);
251
//uint32_t TellFilePointer (Handle hFile);
252
DEC_FUN(uint32_t, TellFilePointer, (Handle));
253
253
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
254
254
//Flash data from buffer
255
255
//typedef Bool32 (*FNFlush)(Handle);
274
274
#define MAF_GALL_GMEM_SHARE 0x2000
275
275
#define MAF_GALL_GMEM_ZEROINIT 0x4000
276
276
#define MAF_GALL_GMEM_RESERVED 0x8000
277
//typedef Handle (*FNAlloc)(Word32, Word32);
278
//Handle AllocMemory (Word32 dwSize,
280
DEC_FUN(Handle, AllocMemory, (Word32, Word32));
281
DEC_FUN(Handle, DAllocMemory, (Word32, Word32, Int8*, Int8*));
277
//typedef Handle (*FNAlloc)(uint32_t, uint32_t);
278
//Handle AllocMemory (uint32_t dwSize,
280
DEC_FUN(Handle, AllocMemory, (uint32_t, uint32_t));
281
DEC_FUN(Handle, DAllocMemory, (uint32_t, uint32_t, char*, char*));
282
282
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
283
283
// ReAlloc memory
284
284
#define MRF_NEW_MEMORY 0x0000
286
286
#define MRF_GALL_GMEM_MOVEABLE 0x0002
287
287
#define MRF_GALL_GMEM_NOCOMPACT 0x0004
288
288
#define MRF_GALL_GMEM_ZEROINIT 0x0008
289
//typedef Handle (*FNReAlloc)(Handle, Word32, Word32);
289
//typedef Handle (*FNReAlloc)(Handle, uint32_t, uint32_t);
290
290
//Handle ReAllocMemory (Handle hMemory,
293
DEC_FUN(Handle, ReAllocMemory, (Handle, Word32, Word32));
293
DEC_FUN(Handle, ReAllocMemory, (Handle, uint32_t, uint32_t));
294
294
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
296
296
//typedef Bool32 (*FNFree);
308
308
DEC_FUN(Bool32, UnlockMemory, (Handle));
309
309
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
310
310
// Write from memory to disk
311
//typedef Word32 (*FNWriteMemToFile)(Handle, char *);
312
//Word32 WriteMemoryToFile (Handle hMem,
311
//typedef uint32_t (*FNWriteMemToFile)(Handle, char *);
312
//uint32_t WriteMemoryToFile (Handle hMem,
313
313
// char * lpName);
314
DEC_FUN(Word32, WriteMemoryToFile, (Handle, PInt8));
314
DEC_FUN(uint32_t, WriteMemoryToFile, (Handle, pchar));
315
315
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
316
316
//Read data from disk to memory
317
//typedef Word32 (*FNReadMemFromFile)(char *, Handle *);
318
//Word32 ReadMemoryFromFile (char * lpName,
317
//typedef uint32_t (*FNReadMemFromFile)(char *, Handle *);
318
//uint32_t ReadMemoryFromFile (char * lpName,
319
319
// Handle * phMem);
320
DEC_FUN(Word32, ReadMemoryFromFile, (PInt8, Handle *));
320
DEC_FUN(uint32_t, ReadMemoryFromFile, (pchar, Handle *));
321
321
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
322
322
//Write data from memory to storage
323
//typedef Word32 (*FNWriteMemToStorage)(Handle, Handle, char *);
324
//Word32 WriteMemoryToStorage (Handle hMem,
323
//typedef uint32_t (*FNWriteMemToStorage)(Handle, Handle, char *);
324
//uint32_t WriteMemoryToStorage (Handle hMem,
325
325
// Handle hStorage,
326
326
// char * lpName);
327
DEC_FUN(Word32, WriteMemoryToStorage, (Handle, Handle, PInt8));
327
DEC_FUN(uint32_t, WriteMemoryToStorage, (Handle, Handle, pchar));
328
328
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
329
329
//Read data from storage to memory
330
//typedef Word32 (*FNReadMemFromStorage)(Handle, char *, Handle *);
331
//Word32 ReadMemoryFromStorage (Handle hStorage,
330
//typedef uint32_t (*FNReadMemFromStorage)(Handle, char *, Handle *);
331
//uint32_t ReadMemoryFromStorage (Handle hStorage,
332
332
// char * lpName,
333
333
// Handle * phMem);
334
DEC_FUN(Word32, ReadMemoryFromStorage, (Handle, PInt8, Handle *));
334
DEC_FUN(uint32_t, ReadMemoryFromStorage, (Handle, pchar, Handle *));
335
335
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
337
337
/////////////////////////////////////////////////////////////////////////////////////////////////////////////