00001 /* 00002 * Copyright 2007 Doxological Ltd. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __FAXPP__TOKENIZER_H 00018 #define __FAXPP__TOKENIZER_H 00019 00020 #include "error.h" 00021 #include "transcode.h" 00022 #include "token.h" 00023 00031 00032 typedef struct FAXPP_TokenizerEnv_s FAXPP_Tokenizer; 00033 00042 FAXPP_Tokenizer *FAXPP_create_tokenizer(FAXPP_Transcoder encode); 00043 00051 void FAXPP_free_tokenizer(FAXPP_Tokenizer *tokenizer); 00052 00061 FAXPP_DecodeFunction FAXPP_get_tokenizer_decode(const FAXPP_Tokenizer *tokenizer); 00062 00073 void FAXPP_set_tokenizer_decode(FAXPP_Tokenizer *tokenizer, FAXPP_DecodeFunction decode); 00074 00090 FAXPP_Error FAXPP_init_tokenize(FAXPP_Tokenizer *tokenizer, void *buffer, 00091 unsigned int length, unsigned int done); 00092 00110 FAXPP_Error FAXPP_tokenizer_release_buffer(FAXPP_Tokenizer *tokenizer, void **buffer_position); 00111 00127 FAXPP_Error FAXPP_continue_tokenize(FAXPP_Tokenizer *tokenizer, void *buffer, 00128 unsigned int length, unsigned int done); 00129 00163 FAXPP_Error FAXPP_next_token(FAXPP_Tokenizer *tokenizer); 00164 00173 const FAXPP_Token *FAXPP_get_current_token(const FAXPP_Tokenizer *tokenizer); 00174 00183 unsigned int FAXPP_get_tokenizer_nesting_level(const FAXPP_Tokenizer *tokenizer); 00184 00193 unsigned int FAXPP_get_tokenizer_error_line(const FAXPP_Tokenizer *tokenizer); 00194 00203 unsigned int FAXPP_get_tokenizer_error_column(const FAXPP_Tokenizer *tokenizer); 00204 00205 #endif