#include "parse-pinyin.h" #include "../PinyinArray.h" #include "../PinyinParser.h" #include "../Const.h" GList * parse_pinyin(const char *preedit_str, const guint max_pinyin, const guint flags) { GList *result = NULL; PyZy::PinyinArray pyar = {0}; Pinyin *thispy = NULL; PyZy::PinyinParser::parse(preedit_str, strlen(preedit_str), flags, pyar, max_pinyin); for (guint i = 0; i < pyar.size(); ++i) { thispy = g_new(Pinyin, 1); thispy->shengmu_i = (int) pyar[i].pinyin->pinyin_id[0].sheng; thispy->yunmu_i = (int) pyar[i].pinyin->pinyin_id[0].yun; thispy->length = pyar[i].len; result = g_list_append(result, thispy); } return result; }