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 "general.h" 00032 00033 /*---------------------------------------------------------------------- 00034 T y p e s 00035 ----------------------------------------------------------------------*/ 00036 #define MAX_NUM_CHUNKS 64 /* Limit on pieces */ 00037 00038 typedef struct 00039 { 00040 uinT32 part1; 00041 uinT32 part2; 00042 } STATE; 00043 00045 typedef int *SEARCH_STATE; 00046 00048 typedef uinT8 PIECES_STATE[MAX_NUM_CHUNKS + 2]; 00049 00050 /*---------------------------------------------------------------------- 00051 F u n c t i o n s 00052 ----------------------------------------------------------------------*/ 00053 SEARCH_STATE bin_to_chunks(STATE *state, int num_joints); 00054 00055 void bin_to_pieces(STATE *state, int num_joints, PIECES_STATE pieces); 00056 00057 void insert_new_chunk(register STATE *state, 00058 register int index, 00059 int num_joints); 00060 00061 STATE *new_state(STATE *oldstate); 00062 00063 int ones_in_state(STATE *state, int num_joints); 00064 00065 void print_state(const char *label, STATE *state, int num_joints); 00066 00067 void set_n_ones(STATE *state, int n); 00068 00069 int compare_states(STATE *true_state, STATE *this_state, int *blob_index); 00070 00071 extern void free_state(STATE *); 00072 00073 /* 00074 #if defined(__STDC__) || defined(__cplusplus) 00075 # define _ARGS(s) s 00076 #else 00077 # define _ARGS(s) () 00078 #endif*/ 00079 00080 /* states.c 00081 void insert_new_chunk 00082 _ARGS((STATE *state, 00083 int index)); 00084 00085 SEARCH_STATE bin_to_chunks 00086 _ARGS((STATE *state, 00087 int num_joints)); 00088 00089 STATE *new_state 00090 _ARGS((STATE *oldstate)); 00091 00092 int ones_in_state 00093 _ARGS((STATE *state, 00094 int num_joints)); 00095 00096 void print_state 00097 _ARGS((char *label, 00098 STATE *state, 00099 int num_joints)); 00100 00101 void set_n_ones 00102 _ARGS((STATE *state, 00103 int n)); 00104 int compare_states 00105 _ARGS(( 00106 STATE *true_state, 00107 STATE *this_state, 00108 int* blob_index)); 00109 00110 #undef _ARGS 00111 */ 00112 #endif