sanskrit-iast/transliteration.h

36 lines
785 B
C
Raw Normal View History

2018-04-25 19:30:49 +02:00
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __TRANSLITERATION_H
#define __TRANSLITERATION_H
2018-04-25 18:54:47 +02:00
#include "syllable.h"
2018-04-25 18:11:56 +02:00
2018-04-27 18:58:07 +02:00
#define FLAG_REGULAR 1 << 0
#define FLAG_MODIFIER 1 << 1
2018-04-25 18:54:47 +02:00
2018-04-30 18:14:39 +02:00
typedef void (*transliteration_filter_t)(struct syllable *syllable_chain);
2018-04-27 18:58:07 +02:00
struct transliteration_letter {
unsigned int code;
2018-04-27 18:58:07 +02:00
unsigned int flags;
const char *data;
2018-04-25 18:54:47 +02:00
};
2018-04-25 18:11:56 +02:00
struct transliteration_context {
2018-04-27 18:58:07 +02:00
const struct transliteration_letter *table;
2018-04-30 18:14:39 +02:00
const transliteration_filter_t *filters;
2018-04-25 18:11:56 +02:00
};
char *transliterate_devanagari_to_latin(const char *text,
struct transliteration_context *context);
void transliteration_context_drop(struct transliteration_context *context);
static inline int is_devanagari(unsigned int code)
{
return code >= 0x0900 && code <= 0x097f;
}
#endif /* __TRANSLITERATION_H */