1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/*
* $Id: thcell.h,v 1.7 2006-07-31 11:07:46 thep Exp $
* thcell.h - Thai string cell custering
* Created: 2001-08-08 (split from thrend.h)
*/
#ifndef THAI_THCELL_H
#define THAI_THCELL_H
#include <thai/thailib.h>
BEGIN_CDECL
/**
* @file thcell.h
* @brief Thai string cell custering
*/
/**
* @brief Thai char cell representation
*/
struct thcell_t {
thchar_t base; /**< base character */
thchar_t hilo; /**< upper/lower vowel/diacritic */
thchar_t top; /**< top-level mark */
};
/**
* @brief Initialize a Thai cell
*
* @param cell : pointer to the cell to initialize
*
* Initializes values in the Thai cell struct.
*/
extern void th_init_cell(struct thcell_t *cell);
/**
* @brief Get first cell from string
*
* @param s : the string
* @param len : the length of string
* @param cell : the output buffer
* @param is_decomp_am : whether SARA AM is to be decomposed into
* NIKHANIT and SARA AA and to be in separate cells
*
* @returns total chars consumed by the cell
*
* Gets first cell from the string bounded by @a s and @a len, and, if @a cell
* is not null, stores the cell data in it.
*/
extern size_t th_next_cell(const thchar_t *s, size_t len,
struct thcell_t *cell, int is_decomp_am);
/**
* @brief Get previous cell from string
*
* @param s : the string
* @param pos : the position in string to get cell previous to
* @param cell : the output buffer
* @param is_decomp_am : whether SARA AM is to be decomposed into
* NIKHANIT and SARA AA and to be in separate cells
*
* @returns total chars consumed by the cell
*
* Gets last cell from the string bounded by @a s and @a pos, and if @a cell
* is not null, stores the cell data in it.
*/
extern size_t th_prev_cell(const thchar_t *s, size_t pos,
struct thcell_t *cell, int is_decomp_am);
/**
* @brief Tokenize string into cells
*
* @param s : the string
* @param len : the length of string
* @param cells : the array of output cells buffer
* @param ncells : the address of integer storing the number of cells
* provided by the buffer, and to keep the number of resulting
* cells on return
* @param is_decomp_am : whether SARA AM is to be decomposed into
* NIKHANIT and SARA AA and to be in separate cells
*
* @returns total characters consumed
*
* Tokenizes the string bounded by @a s and @a len into cells, and stores
* at most @a *ncells resulting cells in the @a cells buffer. On return,
* @a *ncells is also set to the total cells stored in @a cells[].
*/
extern size_t th_make_cells(const thchar_t *s, size_t len,
struct thcell_t cells[], size_t *ncells,
int is_decomp_am);
END_CDECL
#endif /* THAI_THCELL_H */
|