#include <stdlib.h>
#include <stdio.h>
#include "utrac.h"
#include "debug.h"
Include dependency graph for utrac.c:
Go to the source code of this file.
Defines | |
#define | _UTRAC_C_ |
#define | UT_DEBUG 3 |
Functions | |
UtCode | ut_init () |
Initialize the Utrac library. | |
UtCode | ut_init_noalloc () |
Initialize the Utrac library, without allocating memory for UtSession. Used internally. | |
void | ut_finish () |
Free ressources allocated during initialization of Utrac. | |
void | ut_finish_nofree () |
Free ressources allocated during initialization of Utrac, without freeing UtSession. Used internally. | |
UtText * | ut_init_text_heap () |
Allocates and initalizes an UtText structure. | |
void | ut_init_text (UtText *new_text) |
Initalizes an UtText structure. | |
void | ut_free_text_heap (UtText *text) |
Free an UtText structure. | |
void | ut_free_text (UtText *text) |
Free the contents of an UtText structure, without freeing the structure itself. | |
UtCode | ut_init_progress (UtText *text) |
Initialize an UtText structure before using the 'progress bar' callback feature. | |
UtCode | ut_load (UtText *text, const char *filename) |
Load a file in an UtText structure. | |
UtCode | ut_recognize (UtText *text) |
Recognize charset and EOL of a text. | |
UtCode | ut_convert (UtText *src_text, UtText *dst_text) |
Convert a text. |
Definition in file utrac.c.
|
Convert a text.
Definition at line 470 of file utrac.c. References UtText::charset, UtSession::charset_default, UtText::current_pass, UtText::data, UtText::distribution, UtText::eol, UtText::eol_alt, UtSession::eol_alt_default, UtSession::eol_default, UtText::ext_char, UtExtCharLine::next, UtText::pass_flags, UtText::progress_done, UtSession::progress_function, UtText::progress_todo, UtText::size, ut_conversion_pass(), ut_free_text_heap(), ut_init_progress(), ut_init_text_heap(), UT_UNSET, and ut_update_progress(). |
Here is the call graph for this function:
|
Free ressources allocated during initialization of Utrac. This function frees the structure allocated in ut_session by ut_init(). It must be the last Utrac function called.
Definition at line 154 of file utrac.c. References ut_finish_nofree(). |
Here is the call graph for this function:
|
Free the contents of an UtText structure, without freeing the structure itself.
Definition at line 265 of file utrac.c. References UtText::data, UtText::distribution, UtText::evaluation, UtText::ext_char, and UtExtCharLine::next. Referenced by ut_free_text_heap(). |
|
Free an UtText structure.
Definition at line 253 of file utrac.c. References ut_free_text(). Referenced by ut_convert(). |
Here is the call graph for this function:
|
Initialize the Utrac library. This function must be called before any other Utrac function. It allocates an UtSession struture that is accessible by the ut_session pointer, initalizes it, loads charsets data, and sets default language, charset and end of line type. The memory used is about 630kb for 47 charsets loaded.
Definition at line 56 of file utrac.c. References ut_init_noalloc(). |
Here is the call graph for this function:
|
Initialize an UtText structure before using the 'progress bar' callback feature. Can be used internaly or by the user. The UtText must have member UtText::pass_flag set, or at least UtText::flags (if UtText::pass_flags is unset, it will be set for just a recognition pass and subpasses will be selected upon the value of UtText::flags). Definition at line 289 of file utrac.c. References UtText::flags, UtText::pass_flags, UtText::progress_done, UtText::progress_todo, UT_F_ADD_FINAL_EOL, UT_F_REMOVE_ILLEGAL_CHAR, and UT_F_TRANSFORM_EOL. Referenced by ut_convert(), ut_load(), and ut_recognize(). |
|
Initalizes an UtText structure.
Definition at line 221 of file utrac.c. References UtText::charset, UtText::current_pass, UtText::data, UtText::distribution, UtText::eol, UtText::eol_alt, UtText::evaluation, UtText::ext_char, UtText::flags, UtText::nb_lines, UtText::nb_lines_alt, UtText::pass_flags, UtText::progress_done, UtText::progress_todo, UtText::size, UtText::skip_char, and UtText::user. Referenced by ut_init_text_heap(). |
|
Allocates and initalizes an UtText structure.
Definition at line 206 of file utrac.c. References ut_init_text(). Referenced by ut_convert(). |
Here is the call graph for this function:
|
Load a file in an UtText structure. If filename is null, it will read stdin. text->data and text->size will be set. If ut_session->progress_function is set, it will be called during loading and members of text dealing with this feature will be updated. Definition at line 330 of file utrac.c. References UtText::current_pass, UtText::pass_flags, UtText::progress_done, UtSession::progress_function, UtText::progress_todo, ut_init_progress(), and ut_update_progress(). |
Here is the call graph for this function:
|
Recognize charset and EOL of a text. text->data must be set. If text->size is null, recognition will stop at the first null character. text->flags must also be set to select processes to do (see UtTextFlags). If ut_session->progress_function is set, it will be called during loading and members of text dealing with this feature will be updated. If UT_F_FORCE_BINARY is set, texts with caracters between 0 and 0x19 (space is 0x20, and TAB, CR, LF are excluded of this range) won't produce error. If UT_F_IDENTIFY_EOL is set, text->eol, text->eol_alt, text->nb_lines, text->nb_lines_alt will be updated. If convertion of EOL is planned, UT_F_TRANSFORM_EOL must be set. If UT_F_IDENTIFY_CHARSET is set, text->charset will be updated. text->evaluation also if charset is 8bits and ASCII -erivated. text->distribution will always be set, text->ext_char also (but this is a bug!) If ut_session->progress_function is set, it will be called during loading and members of text dealing with this feature will be updated. Definition at line 387 of file utrac.c. References UtText::charset, UtText::current_pass, UtText::data, UtText::distribution, UtText::flags, UtText::pass_flags, UtText::progress_done, UtSession::progress_function, UtText::progress_todo, UtText::skip_char, ut_distrib_utf_pass(), UT_EOL_ALT_CHAR, ut_eol_pass(), ut_init_progress(), UT_UNSET, ut_update_progress(), and ut_xascii_pass(). |
Here is the call graph for this function: