| 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 |
// TIGER run options |
| 58 |
#define RUN_SPELLER 1 |
| 59 |
#define FORCE_ONE_COLUMN 2 |
| 60 |
#define NO_FORMATING 4 |
| 61 |
#define FAX100 8 |
| 62 |
#define DOTMATRIX 16 |
| 63 |
#define BCRFLAG 32 |
| 64 |
#define BCRLOUT 64 |
| 65 |
#define CUTLEFT 128 |
| 66 |
#define CUTRIGHT 256 |
| 67 |
#define SPACE_CORRECTION 512 |
| 68 |
|
| 69 |
// Kernel functions |
| 70 |
Bool kernel_init(void); |
| 71 |
Bool bcr_init(void); |
| 72 |
void kernel_run_options(uint16_t options); |
| 73 |
Bool recognize(puchar ed_file_name); |
| 74 |
Bool page_analysis(void); |
| 75 |
Bool final_recognition(puchar ed_file_name); |
| 76 |
Bool spelling_checker(puchar ed_file_name); |
| 77 |
Bool kernel_reset(void); |
| 78 |
Bool kernel_reload_vocs(void); |
| 79 |
Bool kernel_set_temp_dir(uchar *tmp_dir); |
| 80 |
Bool kernel_set_windows_dir(uchar *tmp_dir); |
| 81 |
Bool kernel_valid_version(int16_t, int16_t); |
| 82 |
Bool kernel_set_enable_table_recog(uchar table_recog); |
| 83 |
Bool kernel_set_user_dict(uchar *user_dict); |
| 84 |
|
| 85 |
// Error status functions |
| 86 |
pchar get_message(uint16_t code); |
| 87 |
uint16_t get_error_status(void); |
| 88 |
Bool bool_status(void); |
| 89 |
void set_error_status(uint16_t group, uint16_t element); |
| 90 |
void clear_error_status(void); |
| 91 |
|
| 92 |
// Convetrt to text |
| 93 |
Bool convert_to_text(puchar edfile, puchar textfile, uint16_t options, uint16_t codepage, |
| 94 |
uchar badchar); |
| 95 |
#define SAVE_TEXT_ED 0x01 |
| 96 |
#define SAVE_TEXT_ASCII 0x02 |
| 97 |
#define SAVE_TEXT_SMART_ASCII 0x04 |
| 98 |
#define SAVE_TEXT_RTF 0x08 |
| 99 |
#define SAVE_TEXT_ANSI 0x10 // Pit 8.26.94 |
| 100 |
#define SAVE_TEXT_SMART_ANSI 0x20 // Pit |
| 101 |
#define SAVE_TEXT_APPEND 128 // 0x'80' |
| 102 |
#define SAVE_TEXT_ASCII_APP (SAVE_TEXT_ASCII + SAVE_TEXT_APPEND) |
| 103 |
#define SAVE_TEXT_SMART_ASCII_APP (SAVE_TEXT_SMART_ASCII + SAVE_TEXT_APPEND) |
| 104 |
#define SAVE_TEXT_RTF_APP (SAVE_TEXT_RTF + SAVE_TEXT_APPEND) |
| 105 |
|
| 106 |
#define SAVE_TABLE_TXT 0x0100 |
| 107 |
#define SAVE_TABLE_CSV 0x0200 |
| 108 |
#define SAVE_TABLE_DBF 0x0400 |
| 109 |
#define SAVE_TABLE_ODBC 0x0800 |
| 110 |
#define SAVE_TABLE_WKS 0x1000 |
| 111 |
#define SAVE_HTML 0x2000 |
| 112 |
#define SAVE_HOCR 0x4000 |
| 113 |
|
| 114 |
// wCodePage options... Piter |
| 115 |
#define SAVE_TEXT SAVE_TEXT_ASCII |
| 116 |
#define SAVE_TEXT_SMART SAVE_TEXT_SMART_ASCII |
| 117 |
|
| 118 |
# define TIGER_CODE_UNKNOWN 0x0000 |
| 119 |
# define TIGER_CODE_ASCII 0x0001 |
| 120 |
# define TIGER_CODE_ANSI 0x0002 |
| 121 |
# define TIGER_CODE_KOI8 0x0004 |
| 122 |
# define TIGER_CODE_ISO 0x0008 |
| 123 |
|
| 124 |
void write_text(uchar); |
| 125 |
|
| 126 |
//-------------------- Callback functions ------------------------- |
| 127 |
|
| 128 |
// Image read functions |
| 129 |
|
| 130 |
struct AttrImage { |
| 131 |
uint16_t PixelHeight; |
| 132 |
uint16_t PixelWidth; |
| 133 |
uint16_t ByteWidth; |
| 134 |
uint16_t LeftDisplacement; |
| 135 |
uint16_t Resolution_X; |
| 136 |
uint16_t Resolution_Y; |
| 137 |
uchar FotoMetrics; |
| 138 |
uchar bUnused; |
| 139 |
uint16_t AddX; |
| 140 |
uint16_t AddY; |
| 141 |
}; |
| 142 |
|
| 143 |
Bool Tiger_ImageOpen(struct AttrImage * p); |
| 144 |
Bool Tiger_ImageOpen_xy(struct AttrImage * p, uint16_t x, uint16_t y, uint16_t w, uint16_t h); |
| 145 |
Bool Tiger_ImageClose(void); |
| 146 |
int16_t Tiger_ImageRead(puchar buffer, uint16_t lth); |
| 147 |
uint32_t Tiger_ProcessPictures(puchar buffer, uint32_t lth); |
| 148 |
|
| 149 |
// Immediate error report |
| 150 |
void Tiger_ReportError(uint16_t status, puchar message); |
| 151 |
|
| 152 |
// Progress Monitor |
| 153 |
Bool Tiger_ProgressStart(void); |
| 154 |
Bool Tiger_ProgressFinish(void); |
| 155 |
Bool Tiger_ProgressSetPercentage(uint16_t wPercent); |
| 156 |
Bool Tiger_ProgressSetStage(uint16_t wStageNumber, puchar pStageName, uint16_t wVolume); |