Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

lingoteach.h File Reference

Go to the source code of this file.

Functions

lingConfig * ling_conf_init_config (void)
lingConfig * ling_conf_set_app_name (lingConfig *settings, lingchar *name)
lingConfig * ling_conf_set_lang_file (lingConfig *settings, lingchar *lfile)
lingMeaning * ling_meaning_get_new (void)
lingMeaning * ling_meaning_get_another_meaning (lingLesson *lesson, Method type, char *language)
lingMeaning * ling_meaning_get_by_word_id (lingLesson *lesson, int id, char *language)
void ling_meaning_free_meaning (lingMeaning *meaning)
lingMeaning * ling_meaning_free_meaning_1 (lingMeaning *tree, lingMeaning *node)
lingbool ling_meaning_save_meanings (lingMeaning *meaning, char *filename, lingConfig *settings)
lingMeaning * ling_meaning_add_meaning (lingMeaning *tree, lingMeaning *meaning)
lingMeaning * ling_meaning_insert_after_meaning (lingMeaning *tree, lingMeaning *parent, lingMeaning *child)
lingMeaning * ling_meaning_modify_meaning (lingMeaning *tree, int id, lingMeaning *meaning)
char * ling_meaning_find_sound (char *soundpath, lingMeaning *meaning)
void * ling_malloc (size_t bytes)
void ling_free (void *ptr)
lingLesson * ling_lesson_add_lesson (lingLesson *lesson, char *filename, lingConfig *settings)
lingLesson * ling_lesson_remove_lesson (lingLesson *lesson, lingLesson *node)
char * ling_lesson_return_path (lingLesson *lesson)
void ling_lesson_use_lesson (lingLesson *lesson, lingbool use)
lingbool ling_lesson_return_used (lingLesson *lesson)
int ling_lesson_get_max_meaning (lingLesson *lesson)
lingbool ling_lesson_save_lesson (lingLesson *lesson, char *filename)
char * ling_lesson_create_new (char *filename, int meanings)
lingMeaning * ling_lesson_create_tree (lingLesson *lesson)
lingLesson * ling_lesson_return_rand_lesson (lingLesson *lesson)
lingchar ** ling_lang_get_languages (lingConfig *settings)
int ling_lang_get_max_languages (lingConfig *settings)
void ling_lang_free_languages (lingchar **languages, int size)


Function Documentation

lingConfig* ling_conf_init_config (  void   ) 
 

Creates a new, empty lingConfig for usage. The lingConfig has to be freed by the user.

Returns:
A new lingConfig.

lingConfig* ling_conf_set_app_name (  lingConfig *  settings,
lingchar *  name
) 
 

Sets the application name in a lingConfig.

Parameters:
settings The settings to modify.
name The name of the application, which uses the library.
Returns:
the modified settings, if the name could be applied to them.

lingConfig* ling_conf_set_lang_file (  lingConfig *  settings,
lingchar *  lfile
) 
 

Sets the full qualified path to the language file in a lingConfig.

Parameters:
settings The settings to modify.
lfile The file, which contains the languages.
Returns:
The modifed settings, if the language file could be applied to them.

void ling_free (  void *  ptr  ) 
 

Frees the memory hold by a pointer, which was previously allocated using ling_malloc().

Parameters:
ptr The pointer to free.

void ling_lang_free_languages (  lingchar **  languages,
int  size
) 
 

Frees a previously allocated array of languages.

Parameters:
languages The array of languages
size The size of the array

lingchar** ling_lang_get_languages (  lingConfig *  settings  ) 
 

Gets a NULL terminated list of available languages (based on the language file set in the lingConfig). The return value should to be freed using ling_lang_free_languages().

Parameters:
settings The lingConfig to use for looking up the languages.
Returns:
a NULL terminated list of the languages

int ling_lang_get_max_languages (  lingConfig *  settings  ) 
 

Gets the count of languages contained in a lingConfig.

Parameters:
settings The lingConfig to use for looking up the languages.
Returns:
An integer showing the maximum count of the languages or -1 on failure.

lingLesson* ling_lesson_add_lesson (  lingLesson *  lesson,
char *  filename,
lingConfig *  settings
) 
 

Prepares and adds a lesson file to an existing list of lessons.

Parameters:
lesson The lesson list, the new lesson should be added to. If lesson is NULL, a new list will be created and returned.
filename The full qualified file path of the file.
settings The settings to use for the lesson.
Returns:
The new lesson list.

char* ling_lesson_create_new (  char *  filename,
int  meanings
) 
 

Creates a new template lesson with optional empty meanings.

Parameters:
filename The lesson file to create.
meanings The amount of meaning templates to create.
Returns:
The filename on success or NULL

lingMeaning* ling_lesson_create_tree (  lingLesson *  lesson  ) 
 

Creates a linked list of meanings, which are available in the given file.

Parameters:
lesson The lesson, from which the tree should be created.
Returns:
A linked list of meanings of the lesson.

int ling_lesson_get_max_meaning (  lingLesson *  lesson  ) 
 

Returns the last meaning id of the given lesson.

Parameters:
lesson The lesson, for which the max. meaning id should be returned.
Returns:
the maximum (last!) meaning id of a lesson file (can be 0, if it fails).

lingLesson* ling_lesson_remove_lesson (  lingLesson *  lesson,
lingLesson *  node
) 
 

Removes a lesson from the list of used ones and frees all its internal references.

Parameters:
lesson The lesson list to look for the lesson.
node The lesson to free.
Returns:
The modified lesson list.

char* ling_lesson_return_path (  lingLesson *  lesson  ) 
 

Returns the full qualified file path of the matching lesson entry.

Parameters:
lesson The lesson for which the path should be returned.
Returns:
The lesson path of the lesson, else NULL.

lingLesson* ling_lesson_return_rand_lesson (  lingLesson *  lesson  ) 
 

Returns a random lesson of the lesson list, which is passed as argument. Lessons which are not used are ignored. The function tries to determine an used lesson twenty times. If none is found, NULL will be returned.

Parameters:
lesson The lesson list to use for the random lesson.
Returns:
A random lesson or NULL if none found after twenty rounds.

lingbool ling_lesson_return_used (  lingLesson *  lesson  ) 
 

Returns the status of the use-flag of a lesson.

Parameters:
lesson The lesson, the usage flag should be returned for.
Returns:
TRUE, if the lesson is currently marked as used in the internal list, else FALSE.

lingbool ling_lesson_save_lesson (  lingLesson *  lesson,
char *  filename
) 
 

Saves a lesson into the passed file. If the file does not exist, it will be automatically created, else its contents will be completely overwritten.

Parameters:
lesson The lesson to save.
filename The lesson file for saving the lesson.
Returns:
TRUE, if the lesson could be saved, else FALSE.

void ling_lesson_use_lesson (  lingLesson *  lesson,
lingbool  use
) 
 

Modifies the usage flag of a lesson, so that it will be automatically used by the different meaning access functions.

Parameters:
lesson The lesson to use
use A boolean statement for usage (TRUE or FALSE).

void* ling_malloc (  size_t  bytes  ) 
 

Allocates a chunk of memory for usage

Parameters:
bytes The count of bytes to allocate
Returns:
A pointer to the newly allocated space

lingMeaning* ling_meaning_add_meaning (  lingMeaning *  tree,
lingMeaning *  meaning
) 
 

Adds a new meaning at the end of the given list.

Parameters:
tree The meaning list to which the meaning should be added.
meaning The meaning to add to the tree.
Returns:
The new, modified tree.

char* ling_meaning_find_sound (  char *  soundpath,
lingMeaning *  meaning
) 
 

Returns the path to the sound snippet for the given meaning.

Parameters:
soundpath The full qualified path to the sound files.
meaning The lingMeaning the sound snippet has to be found for.
Returns:
The full qualified path to the sound snippet of the meaning.

void ling_meaning_free_meaning (  lingMeaning *  meaning  ) 
 

Frees the memory used by a list of lingMeaning and the lingMeanings itself

Parameters:
meaning The meaning list to free.

lingMeaning* ling_meaning_free_meaning_1 (  lingMeaning *  tree,
lingMeaning *  node
) 
 

Frees the memory used by a lingMeaning and the lingMeaning itself

Parameters:
tree The list of meanings, in which the meanings is.
node The meaning, which should be freed. return The new list without the freed meaning.

lingMeaning* ling_meaning_get_another_meaning (  lingLesson *  lesson,
Method  type,
char *  language
) 
 

Gets another lingMeaning from a lesson file. The lingMeaning has to be freed by the user.

Parameters:
lesson The lesson to fetch the meaning from.
type The method to use for getting the lingMeaning.
language The language, which should be used.
Returns:
A meaning pointer, using the method given as argument to the function.

lingMeaning* ling_meaning_get_by_word_id (  lingLesson *  lesson,
int  id,
char *  language
) 
 

Gets a specific lingMeaning from the given lesson. The lingMeaning has to be freed by the user.

Parameters:
lesson The lesson to fetch the meaning from.
id The id, which should be searched for.
language The language, which should be used.
Returns:
a lingMeaning containing the meaning, which has the given id. If none is found with the given language, the function returns NULL.

lingMeaning* ling_meaning_get_new (  void   ) 
 

Creates a new lingMeaning and returns it. The lingMeaning has to be freed by the user.

Returns:
A new, empty lingMeaning.

lingMeaning* ling_meaning_insert_after_meaning (  lingMeaning *  tree,
lingMeaning *  parent,
lingMeaning *  child
) 
 

Inserts a meaning after specific meaning into a meaning list.

Parameters:
tree The meaning list to which the meaning should be added.
parent The parent meaning, after whihc the child should be added.
child The meaning to add.
Returns:
The new, modified tree.

lingMeaning* ling_meaning_modify_meaning (  lingMeaning *  tree,
int  id,
lingMeaning *  meaning
) 
 

Modifies a meaning of the given list of meanings

Parameters:
tree The list of meanings in which the meaning exists.
id The id of the meaning, which should be modified.
meaning The modified meaning .
Returns:
The tree with the modified meaning.

lingbool ling_meaning_save_meanings (  lingMeaning *  meaning,
char *  filename,
lingConfig *  settings
) 
 

Saves a list of meanings into a given lesson file. The format is the standard lingoteach lesson format.

Parameters:
meaning The list of meanings to save.
filename The file the meanings should be saved in.
settings The settings to use for the file.
Returns:
TRUE on succesful saving, else FALSE.


Generated on Sun Nov 23 22:33:44 2003 for liblingoteach by doxygen 1.3.3