Tesseract  3.02
tesseract-ocr/dict/states.h
Go to the documentation of this file.
00001 /* -*-C-*-
00002  ********************************************************************************
00003  *
00004  * File:        states.h  (Formerly states.h)
00005  * Description:  Representations of search states
00006  * Author:       Mark Seaman, OCR Technology
00007  * Created:      Wed May 16 15:52:40 1990
00008  * Modified:     Tue May 21 16:26:21 1991 (Mark Seaman) marks@hpgrlt
00009  * Language:     C
00010  * Package:      N/A
00011  * Status:       Experimental (Do Not Distribute)
00012  *
00013  * (c) Copyright 1990, Hewlett-Packard Company.
00014  ** Licensed under the Apache License, Version 2.0 (the "License");
00015  ** you may not use this file except in compliance with the License.
00016  ** You may obtain a copy of the License at
00017  ** http://www.apache.org/licenses/LICENSE-2.0
00018  ** Unless required by applicable law or agreed to in writing, software
00019  ** distributed under the License is distributed on an "AS IS" BASIS,
00020  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00021  ** See the License for the specific language governing permissions and
00022  ** limitations under the License.
00023  *
00024  *********************************************************************************/
00025 #ifndef STATES_H
00026 #define STATES_H
00027 
00028 /*----------------------------------------------------------------------
00029               I n c l u d e s
00030 ----------------------------------------------------------------------*/
00031 #include "host.h"
00032 #include "strngs.h"
00033 
00034 /*----------------------------------------------------------------------
00035               T y p e s
00036 ----------------------------------------------------------------------*/
00037 #define MAX_NUM_CHUNKS  64       /* Limit on pieces */
00038 
00039 typedef struct
00040 {
00041   uinT32 part1;
00042   uinT32 part2;
00043 } STATE;
00044 
00046 typedef int *SEARCH_STATE;
00047 
00049 typedef uinT8 PIECES_STATE[MAX_NUM_CHUNKS + 2];
00050 
00051 /*----------------------------------------------------------------------
00052               F u n c t i o n s
00053 ----------------------------------------------------------------------*/
00054 SEARCH_STATE bin_to_chunks(STATE *state, int num_joints);
00055 
00056 void bin_to_pieces(STATE *state, int num_joints, PIECES_STATE pieces);
00057 
00058 void insert_new_chunk(register STATE *state,
00059                       register int index,
00060                       int num_joints);
00061 
00062 STATE *new_state(STATE *oldstate);
00063 
00064 int ones_in_state(STATE *state, int num_joints);
00065 
00066 void print_state(const char *label, STATE *state, int num_joints);
00067 
00068 void print_state(STATE *state, int num_joints, STRING *toappend);
00069 
00070 void set_n_ones(STATE *state, int n);
00071 
00072 extern void free_state(STATE *);
00073 
00074 #endif