00001 // Callback for returning words list 00002 void words_list_cb(GArray* list, 00003 gchar* pattern, 00004 gpointer user_data, 00005 EngineStatus error) 00006 { 00007 if ( ENGINE_NO_ERROR == error ) 00008 { 00009 printf("Word matching to pattern: %s\n",pattern); 00010 int i = 0; 00011 while(g_array_index(list, gchar*, i) != NULL) 00012 { 00013 printf("%d.: %s\n", i, g_array_index(list, gchar*, i)); 00014 i++; 00015 } 00016 } 00017 } 00018 00019 // Callback for returning translation of word 00020 void translation_cb(gchar* translation, 00021 gchar* word, 00022 gpointer user_data, 00023 EngineStatus error) 00024 { 00025 if ( ENGINE_NO_ERROR == error ) 00026 { 00027 printf("Translation for word %s:\n",word); 00028 printf("%s\n",translation); 00029 } 00030 }
00001 getting_additional_t get_functions; 00002 GModule *library = g_module_open(library_to_path, G_MODULE_BIND_LAZY); 00003 g_module_symbol(library, GLOBAL_FUNCTIONS_NAME, (gpointer)&get_functions);
00001 EngineModule module = get_functions();
00001 gchar* dictionary = "/path/to/dictionary/file" 00002 gboolean compatible = dict_eng_module_check(module, dictionary); 00003 if ( TRUE == compatible ) 00004 { 00005 // we can use this engine to work with dictionary 00006 ... 00007 } 00008 else { 00009 // we must use other engine to work with this dictionary 00010 }
00001 Engine* xdxf; 00002 xdxf = dict_eng_module_create(module, dictionary, ENGINE_CREATE); 00003 dict_eng_set_callback(xdxf, ENGINE_WORD_LIST_SIGNAL, words_list_cb, NULL); 00004 dict_eng_set_callback(xdxf, 00005 ENGINE_WORD_TRANSLATION_SIGNAL, 00006 translation_cb, 00007 NULL);
00001 dict_eng_search_word_list(xdxf, "pol");
00001 dict_eng_search_word_translation(xdxf, "car");