ccutil/ocrshell.h

Go to the documentation of this file.
00001 
00023 #ifndef           OCRSHELL_H
00024 #define           OCRSHELL_H
00025 
00026 #include          "ocrclass.h"
00027 
00028 #define EUC_FORMAT_MASK   0xe0
00029 
00041 #ifdef __MAC__
00042 INT16 ocr_open_shm(UINT16 *lang); 
00043 #else
00044 INT16 ocr_open_shm(                       /*open the shm */
00045                    const char *shm_h,     /*handle of shm */
00046                    const char *shm_size,  /*size of shm segment */
00047                    const char *mutex_h,   /*hp mutex */
00048                    const char *ocr_h,     /*ocr semaphore */
00049                    const char *hp_h,      /*hp semaphore */
00050                    const char *lang_str,  /*language */
00051                    UINT16 *lang           /*required language */
00052                   );
00053 #endif
00054 
00055 /*
00056 \brief Initialize one of the font descriptors.
00057 */
00058 INT16 ocr_append_fontinfo(                    /*put info into shm */
00059                           UINT16 language,    /*default language */
00060                           UINT8 font_family,  /*serif/not, fixed/not */
00061                           UINT8 char_set,     /*character set standard */
00062                           UINT8 pitch,        /*fixed or prop */
00063                           const char *name    /*plain ascii name */
00064                          );
00065 
00066 /*
00067 \brief Setup the info on the OCR engine.
00068 
00069 Uses 16 bit chars to name the engine.
00070 */
00071 INT16 ocr_setup_startinfo(                       /*put info into shm */
00072                           UINT32 protocol,       /*interface version */
00073                           UINT16 language,       /*default language */
00074                           const UINT16 *name,    /*name of engine */
00075                           const UINT16 *version  /*version of engine */
00076                          );
00077 
00078 /*
00079 \brief Setup the info on the OCR engine.
00080 
00081 Uses 8 bit chars to name the engine.
00082 */
00083 INT16 ocr_setup_startinfo_ansi(                     /*put info into shm */
00084                                UINT32 protocol,     /*interface version */
00085                                UINT16 language,     /*default language */
00086                                const char *name,    /*name of engine */
00087                                const char *version  /*version of engine */
00088                               );
00089 
00090 /*
00091 \brief Wait for the master to send the first image strip and return a
00092 pointer to it.
00093 
00094 The result is NULL if it is time to exit.
00095 */
00096 ESTRIP_DESC *ocr_get_first_image_strip(); /*get image strip */
00097 
00098 /*
00099 \brief Wait for the master to send the next image strip and return a
00100 pointer to it.
00101 
00102 The result is NULL if it is time to exit.
00103 */
00104 ESTRIP_DESC *ocr_get_next_image_strip(); /*get image strip */
00105 
00106 /*
00107 \brief Setup the progress monitor.
00108 
00109 Call before starting the recognize task.
00110 */
00111 ETEXT_DESC *ocr_setup_monitor();  /*setup monitor */
00112 
00113 /*
00114 \brief Return the number of chars that can be fitted into the buffer.
00115 */
00116 INT32 ocr_char_space();  /*put char into shm */
00117 
00118 /*
00119 \brief Add a character to the output.
00120 
00121 Returns OKAY if successful, HPERR if there was insufficient room in the buffer.
00122 */
00123 INT16 ocr_append_char(                              /*put char into shm */
00124         UINT16 char_code,             /*character itself */
00125         INT16 left,                   /*of char (-1) */
00126         INT16 right,                  /*of char (-1) */
00127         INT16 top,                    /*of char (-1) */
00128         INT16 bottom,                 /*of char (-1) */
00129         INT16 font_index,             /*what font (-1) */
00130         UINT8 confidence,             /*0=perfect, 100=reject (0/100) */
00131         UINT8 point_size,             /*of char, 72=i inch, (10) */
00132         INT8 blanks,                  /*no of spaces before this char (1) */
00133         UINT8 enhancement,            /*char enhancement (0) */
00134         OCR_CHAR_DIRECTION text_dir,  /*rendering direction (OCR_CDIR_RIGHT_LEFT) */
00135         OCR_LINE_DIRECTION line_dir,  /*line rendering direction (OCR_LDIR_DOWN_RIGHT) */
00136         OCR_NEWLINE_TYPE nl_type      /*type of newline (if any) (OCR_NL_NONE) */
00137        );
00138 
00139 /*
00140 \brief Send the text to the host and wait for the ack.
00141 
00142 Use this function after a sequence of ocr_append_text calls to
00143 actually sent the text to the master process.
00144 Set more to come TRUE if there is more text in this page, FALSE
00145 if the OCR engine is now ready to receive another image.
00146 */
00147 INT16 ocr_send_text(                    /*send shm */
00148                     BOOL8 more_to_come  /*any text left */
00149                    );
00150 
00151 /*
00152 \brief Closedown communications with the HP side and free up handles.
00153 */
00154 INT16 ocr_shutdown();  /*closedown */
00155 
00156 /*
00157 \brief Inform the HP side of an error.
00158 
00159 The OCR engine should do any cleanup of its own and exit aferwards.
00160 Uses the current state to determine how to send it and cleanup.
00161 */
00162 void ocr_error(                   /*send an error code */
00163                OCR_ERR_CODE code  /*error code */
00164               );
00165 #endif

Generated on Wed Feb 28 19:49:09 2007 for Tesseract by  doxygen 1.5.1