| 1 |
/* |
| 2 |
Copyright (c) 1993-2008, Cognitive Technologies |
| 3 |
All rights reserved. |
| 4 |
|
| 5 |
Разрешается повторное распространение и использование как в виде исходного кода, |
| 6 |
так и в двоичной форме, с изменениями или без, при соблюдении следующих условий: |
| 7 |
|
| 8 |
* При повторном распространении исходного кода должны оставаться указанное |
| 9 |
выше уведомление об авторском праве, этот список условий и последующий |
| 10 |
отказ от гарантий. |
| 11 |
* При повторном распространении двоичного кода в документации и/или в |
| 12 |
других материалах, поставляемых при распространении, должны сохраняться |
| 13 |
указанная выше информация об авторском праве, этот список условий и |
| 14 |
последующий отказ от гарантий. |
| 15 |
* Ни название Cognitive Technologies, ни имена ее сотрудников не могут |
| 16 |
быть использованы в качестве средства поддержки и/или продвижения |
| 17 |
продуктов, основанных на этом ПО, без предварительного письменного |
| 18 |
разрешения. |
| 19 |
|
| 20 |
ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК |
| 21 |
ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ, |
| 22 |
ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ |
| 23 |
ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ |
| 24 |
МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ |
| 25 |
НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ |
| 26 |
ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ |
| 27 |
НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ, |
| 28 |
СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ |
| 29 |
ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ, |
| 30 |
НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ |
| 31 |
ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ. |
| 32 |
|
| 33 |
Redistribution and use in source and binary forms, with or without modification, |
| 34 |
are permitted provided that the following conditions are met: |
| 35 |
|
| 36 |
* Redistributions of source code must retain the above copyright notice, |
| 37 |
this list of conditions and the following disclaimer. |
| 38 |
* Redistributions in binary form must reproduce the above copyright notice, |
| 39 |
this list of conditions and the following disclaimer in the documentation |
| 40 |
and/or other materials provided with the distribution. |
| 41 |
* Neither the name of the Cognitive Technologies nor the names of its |
| 42 |
contributors may be used to endorse or promote products derived from this |
| 43 |
software without specific prior written permission. |
| 44 |
|
| 45 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 46 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 47 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 48 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 49 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 50 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 51 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 52 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 53 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 54 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 55 |
*/ |
| 56 |
|
| 57 |
|
| 58 |
// |
| 59 |
// 08-14-93 02:46pm, Mike |
| 60 |
// |
| 61 |
// 1. Function TBFOPEN has been added as a temporary (?) solution. |
| 62 |
// This function is needed at the modules SPELABC.C & SPELSPEC.C. |
| 63 |
// |
| 64 |
|
| 65 |
#include "c_types.h" |
| 66 |
|
| 67 |
#define TG_STREAM 1 |
| 68 |
#define TB_STREAM 2 |
| 69 |
#define ED_STREAM 3 |
| 70 |
#define TX_STREAM 4 |
| 71 |
#define DB_STREAM 5 |
| 72 |
#define IM_STREAM 6 |
| 73 |
#define VC_STREAM 7 |
| 74 |
#define WK_STREAM 8 |
| 75 |
|
| 76 |
#ifdef PC_TYPE |
| 77 |
|
| 78 |
#include <stdlib.h> |
| 79 |
/*#include <io.h>*/ |
| 80 |
#include <fcntl.h> |
| 81 |
#include <sys/stat.h> |
| 82 |
#include <sys/types.h> |
| 83 |
//#include <bios.h> |
| 84 |
|
| 85 |
#define BO_CREAT O_CREAT|O_TRUNC|O_BINARY|O_RDWR,S_IREAD|S_IWRITE |
| 86 |
#define BO_READ O_RDONLY|O_BINARY |
| 87 |
#define BO_READ_TEXT O_RDONLY|O_TEXT |
| 88 |
#define BO_RDWR O_RDWR|O_BINARY |
| 89 |
#define BO_CREAT_FL O_CREAT|O_TRUNC|O_BINARY|O_RDWR |
| 90 |
#define BO_READ_FL O_RDONLY|O_BINARY |
| 91 |
#define BO_RDWR_FL O_RDWR|O_BINARY |
| 92 |
#define BO_I_FL S_IREAD|S_IWRITE |
| 93 |
#define BO_WRITE O_WRONLY|O_BINARY |
| 94 |
#define DIRSEP '/' |
| 95 |
|
| 96 |
# else |
| 97 |
|
| 98 |
#include <stdlib.h> |
| 99 |
#include <fcntl.h> |
| 100 |
|
| 101 |
#define BO_CREAT O_CREAT|O_TRUNC|O_BINARY|O_RDWR,0 |
| 102 |
#define BO_READ O_RDONLY|O_BINARY |
| 103 |
#define BO_READ_TEXT O_RDONLY|O_TEXT |
| 104 |
#define BO_RDWR O_RDWR|O_BINARY |
| 105 |
#define BO_CREAT_FL O_CREAT|O_TRUNC|O_BINARY|O_RDWR |
| 106 |
#define BO_READ_FL O_RDONLY|O_BINARY |
| 107 |
#define BO_RDWR_FL O_RDWR|O_BINARY |
| 108 |
#define BO_I_FL 0 |
| 109 |
#define BO_WRITE O_WRONLY|O_BINARY |
| 110 |
#define S_IREAD 0 |
| 111 |
#define S_IWRITE 0 |
| 112 |
#define DIRSEP ':' |
| 113 |
#define O_TEXT 0 |
| 114 |
|
| 115 |
#endif |
| 116 |
|
| 117 |
/* /------------------ I/O prototypes ------------------------------- */ |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
#define TGFILELTH my_filelth |
| 122 |
#define TGOPEN my_open |
| 123 |
#define TGFOPEN my_fopen |
| 124 |
#define TGREAD my_read |
| 125 |
#define TGWRITE my_write |
| 126 |
#define TGCLOSE my_close |
| 127 |
#define TGSEEK my_seek |
| 128 |
#define TGSIZE my_chsize |
| 129 |
#define TBOPEN my_table_op |
| 130 |
#define TGREMOVE my_file_rem |
| 131 |
|
| 132 |
// 08-14-93 02:49pm, Mike |
| 133 |
#define TBFOPEN my_table_fop |
| 134 |
#define TGGETS handle_fgets |
| 135 |
|
| 136 |
#ifdef __cplusplus |
| 137 |
extern "C" { |
| 138 |
#endif |
| 139 |
|
| 140 |
int32_t my_filelth (int16_t); /* / handle */ |
| 141 |
int16_t my_open (int16_t, char *, int16_t, int16_t); /* / stream, name, ... */ |
| 142 |
FILE *my_fopen (int16_t, char *, char *); /* / stream, name, ... */ |
| 143 |
void my_file_rem (int16_t, char *); /* / stream, name */ |
| 144 |
int16_t my_close (int16_t); /* / handle */ |
| 145 |
int32_t my_read (int16_t, char *, int32_t); /* / handle, addr, lth */ |
| 146 |
int32_t my_write (int16_t, char *, int32_t); /* / handle, addr, lth */ |
| 147 |
int32_t my_seek (int16_t, int32_t, int16_t); /* / handle, addr, type*/ |
| 148 |
int16_t my_chsize (int16_t, int32_t); /* / handle, addr */ |
| 149 |
Bool save_dir (int16_t, void * ); /* / stream, name */ |
| 150 |
int16_t is_open (int16_t); /* / stream */ |
| 151 |
void set_name_ext (char *); /* / stream=TX; extention */ |
| 152 |
int16_t my_table_op (int16_t, int16_t, int16_t, int16_t); /* / table #, ... */ |
| 153 |
|
| 154 |
// 08-14-93 02:49pm, Mike |
| 155 |
FILE *my_table_fop (int16_t, int16_t, char *); /* / table #, ... */ |
| 156 |
char *handle_fgets ( int16_t handle, char * s, int16_t len ); |
| 157 |
|
| 158 |
#ifdef __cplusplus |
| 159 |
} |
| 160 |
#endif |