1 /*---------------------------------------------------------------------------* 2 * srec_tokens.h * 3 * * 4 * Copyright 2007, 2008 Nuance Communciations, Inc. * 5 * * 6 * Licensed under the Apache License, Version 2.0 (the 'License'); * 7 * you may not use this file except in compliance with the License. * 8 * * 9 * You may obtain a copy of the License at * 10 * http://www.apache.org/licenses/LICENSE-2.0 * 11 * * 12 * Unless required by applicable law or agreed to in writing, software * 13 * distributed under the License is distributed on an 'AS IS' BASIS, * 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 15 * See the License for the specific language governing permissions and * 16 * limitations under the License. * 17 * * 18 *---------------------------------------------------------------------------*/ 19 20 #ifndef _SREC_TOKENS_H_ 21 #define _SREC_TOKENS_H_ 22 23 #include"srec.h" 24 #include"srec_sizes.h" 25 26 /* miscdata what_to_do_if_fails */ 27 #define EXIT_IF_NO_TOKENS 1 /*for handling allocation failures*/ 28 #define NULL_IF_NO_TOKENS 2 /*for handling allocation failures*/ 29 30 /* 31 * fsmarc_token management 32 */ 33 34 int count_fsmarc_token_list(srec* rec, stokenID token_index); 35 void initialize_free_fsmarc_tokens(srec *rec); 36 stokenID setup_free_fsmarc_token(srec *rec, FSMarc* arc, arcID fsm_arc_index, miscdata what_to_do_if_fails); 37 void free_fsmarc_token(srec *rec, stokenID old_token_index); 38 void sort_fsmarc_token_list(srec* rec, stokenID* ptoken_index); 39 40 /* 41 * word_token management 42 */ 43 44 void initialize_free_word_tokens(srec *rec); 45 wtokenID get_free_word_token(srec *rec, miscdata what_to_do_if_fails); 46 47 /* 48 * fsmnode_token management 49 */ 50 51 int count_fsmnode_token_list(srec* rec, ftokenID token_index); 52 void initialize_free_fsmnode_tokens(srec *rec); 53 ftokenID get_free_fsmnode_token(srec *rec, miscdata what_to_do_if_fails); 54 void free_fsmnode_token(srec *rec, ftokenID old_token_index); 55 56 /* 57 * altword token management 58 */ 59 60 void initialize_free_altword_tokens(srec *rec); 61 int count_altword_token(srec* rec, altword_token* b); 62 altword_token* get_free_altword_token(srec* rec, miscdata what_to_do_if_fails); 63 int free_altword_token(srec* rec, altword_token* old_token); 64 altword_token* free_altword_token_batch(srec* rec, altword_token* old_token); 65 #define print_altword_token_counts(a,b) 66 67 #endif 68