|
The mchartable() function creates a new chartable object with symbol key and the default value default_value. If key is a managing key, the elements of the table (including the default value) are managed objects or NULL.
- Return value:
- If the operation was successful, mchartable() returns a pointer to the created chartable. Otherwise it returns
NULL and assigns an error code to the external variable merror_code.
|
void* mchartable_lookup |
( |
MCharTable * |
table, |
|
|
int |
c | |
|
) |
| | |
|
The mchartable_lookup() function returns the value assigned to character c in chartable table. If no value has been set for c explicitly, the default value of table is returned. If c is not a valid character, mchartable_lookup() returns NULL and assigns an error code to the external variable merror_code.
- Errors:
MERROR_CHAR
- See Also:
- mchartable_set()
|
void mchartable_range |
( |
MCharTable * |
table, |
|
|
int * |
from, |
|
|
int * |
to | |
|
) |
| | |
|
The mchartable_range() function searches chartable table for the first and the last character codes that do not have the default value of table, and set from and to to them, respectively. If all characters have the default value, both from and to are set to -1. |
int mchartable_map |
( |
MCharTable * |
table, |
|
|
void * |
ignore, |
|
|
void(*)(int, int, void *, void *) |
func, |
|
|
void * |
func_arg | |
|
) |
| | |
|
The mchartable_map() function calls function func for characters in chartable table. No function call occurs for characters that have value ignore in table. Comparison of ignore and character value is done with the operator == . Be careful when you use string literals or pointers.
Instead of calling func for each character, mchartable_map() tries to optimize the number of function calls, i.e. it makes a single function call for a chunk of characters when those consecutive characters have the same value.
No matter how long the character chunk is, func is called with four arguments; from, to, val, and arg. from and to (both inclusive) defines the range of characters that have value val. arg is the same as func_arg.
- Return value:
- This function always returns 0.
|
|