---
name: "th_prev_cell"
section: "3"
platform: "linux"
package: "libthai-dev"
version: "0.1.6-1+etch1"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/thcell.h"
---

# th\_prev\_cell(3)

Part of [thcell.h(3)](/thcell.h/3.md).

## NAME

thai/thcell.h -

## Detailed Description

Thai string cell custering.

## SYNOPSIS

### Data Structures

struct **thcell\_t**\
 *Thai char cell representation.*

### Functions

void **th\_init\_cell** (struct **thcell\_t** \*cell)\
 *Initialize a Thai cell.*  size\_t **th\_next\_cell** (const **thchar\_t** \*s, size\_t len, struct **thcell\_t** \*cell, int is\_decomp\_am)\
 *Get first cell from string.*  size\_t **th\_prev\_cell** (const **thchar\_t** \*s, size\_t pos, struct **thcell\_t** \*cell, int is\_decomp\_am)\
 *Get previous cell from string.*  size\_t **th\_make\_cells** (const **thchar\_t** \*s, size\_t len, struct **thcell\_t** cells\[\], size\_t \*ncells, int is\_decomp\_am)\
 *Tokenize string into cells.*

## Function Documentation

### void th\_init\_cell (struct thcell\_t \* cell)

Initialize a Thai cell.

**Parameters:**

*cell* : pointer to the cell to initialize

Initializes values in the Thai cell struct.

### size\_t th\_make\_cells (const thchar\_t \* s, size\_t len, struct thcell\_t cells\[\], size\_t \* ncells, int is\_decomp\_am)

Tokenize string into cells.

**Parameters:**

*s* : the string \
 *len* : the length of string \
 *cells* : the array of output cells buffer \
 *ncells* : the address of integer storing the number of cells provided by the buffer, and to keep the number of resulting cells on return \
 *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 *s* and *len* into cells, and stores at most *\*ncells* resulting cells in the *cells* buffer. On return, *\*ncells* is also set to the total cells stored in *cells*\[\].

### size\_t th\_next\_cell (const thchar\_t \* s, size\_t len, struct thcell\_t \* cell, int is\_decomp\_am)

Get first cell from string.

**Parameters:**

*s* : the string \
 *len* : the length of string \
 *cell* : the output buffer \
 *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 *s* and *len*, and, if *cell* is not null, stores the cell data in it.

### size\_t th\_prev\_cell (const thchar\_t \* s, size\_t pos, struct thcell\_t \* cell, int is\_decomp\_am)

Get previous cell from string.

**Parameters:**

*s* : the string \
 *pos* : the position in string to get cell previous to \
 *cell* : the output buffer \
 *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 *s* and *pos*, and if *cell* is not null, stores the cell data in it.

## Author

Generated automatically by Doxygen for libthai from the source code.
