/*
**      dito.library 2.1
**      ----------------
**
**      (C) Copyright by Dirk Holtwick, 1996
**      All Rights Reserved.
*/

#ifndef LIBRARIES_DITO_H
#define LIBRARIES_DITO_H

#include <exec/types.h>
#include <utility/hooks.h>

/*
**  Library name and minimal required version.
*/

#define DITO_NAME "dito.library"
#define DITO_VMIN 2

/*
**  Fileinfo structure that gives first informations of
**  a file before to be loaded
*/

struct DITO_FileInfo {
	char  Language[32],
			Author[80],
			Title[80],
			Description[80],
			Comment[80];
	UWORD Version,
			Skip;
	ULONG Sum;
	BOOL  Save;
	BOOL  Old;
	int   Filetype;
	ULONG Table;
};

/*
**  Memory handling structures for DITO that allow
**  flexible length of each Puddle, but you will not
**  have to use them.
*/

struct DITO_Puddle;
struct DITO_Pool {
	struct   DITO_Puddle
				*first,
				*act;
};

struct DITO_Array {
	void     **entries;
	ULONG    size,
				used;
};

/*
**  Database and Entry structures of the DITO vovabularies
**  with various informations. DITO_Entry is a black-box, so
**  please use the functions DITO_GetStr and DITO_GetVar
**  to handle the datas.
*/

struct DITO_Entry;
struct DITO_Database {
	char     language[80],        // Language
				sort[256],           // Sorting pattern
				name[200];           // Name of file
	struct   DITO_Pool            // DITO Memory Pool, just an internal
				pool;                //    pointer that you will not need to use
	ULONG    num,                 // Number of actual entry
				sum;                 // Sum of all entries
	BOOL     changed;             // Has a value be changed
	BOOL     save;                // ?
	char     title[80],           // Title of database
				desc[80],            // Description ...
				author[80],          // Author ...
				comment[80];         // Comment ...
	ULONG    SumWeight[3],        // Sum of entries for each weight
				KnownWeight[3],      // Sum of known ...
				AskedWeight[3];      // Sum of asked ...
	struct   DITO_Entry           // Actual question
				*quest;
	struct   DITO_Array
				arr;
};

/*
**  Structure for handling of DICT files
*/

struct DITO_Dict;

/*
**  Structure to specify the data of a new DITO_Entry
*/

struct DITO_EntryInfo {
	ULONG    snum;                // Number of GrammarStrings
	char     *word,               // Word
				*trans,              // Translation
				*note,               // Note
				*phon,               // Phonetics
				*sample,             // Sample
				*gr[50];             // GrammarStrings
	ULONG    val[4],              // GrammarValues
				known,               // Known
				marked,              // Marked
				weight,              // Weight
				type;                // Type
};

/*
**  Structure for the DITO_GetRandom Function that may be
**  used to implement a learn function.
*/

struct DITO_Random {
	BOOL     marked,              // Has to be marked ?
				weight[3],           // Wich weights are allowed ?
				pos[20];             // Wich Part Of Speeches are allowed ?
};

/*
**  Structure that contents informations about the
**  registred user. If not registred nr==0.
*/

struct DITO_UserInfo {
	UWORD    nr;                  // Serialnumber
	char     name[80];            // Name
};

/*
**  Errors
*/

#define DITO_Error_FileNotFound     1
#define DITO_Error_NoDitoDatabase   2
#define DITO_Error_WrongLanguage    3
#define DITO_Error_Memory           4

/*
**  Types of files
*/

#define DITO_Filetype_VOC           1
#define DITO_Filetype_DICT          2

/*
**  Position of actual entry
*/

#define DITO_Act_First           0
#define DITO_Act_Last            (-1)
#define DITO_Act_Next            (-2)
#define DITO_Act_Prev            (-3)
#define DITO_Act_New             (-4)

/*
**  Arguments for DITO_GetStr()
*/

#define DITO_Str_Word            1000
#define DITO_Str_Translation     1001
#define DITO_Str_Note            1002
#define DITO_Str_Phonetics       1003
#define DITO_Str_Sample          1004

/*
**  Arguments for DITO_GetVal()
*/

#define DITO_Val_Weight          1010
#define DITO_Val_Known           1011
#define DITO_Val_Marked          1012
#define DITO_Val_Type            1013
#define DITO_Val_SNum            1014

/*
**  Sorting methods
*/

#define DITO_Sort_Pattern           0
#define DITO_Sort_ASCII             1
#define DITO_Sort_RevPattern        2
#define DITO_Sort_RevASCII          3

/*
**  Comparemethods for DITO_PatternCmp()
*/

#define DITO_Cmp_Pattern            0
#define DITO_Cmp_First              1
#define DITO_Cmp_Word               2
/*
#define DITO_Cmp_PatternASCII       3
#define DITO_Cmp_FirstASCII         4
#define DITO_Cmp_WordASCII          5
*/

/*
**  Savemodes
*/

#define DITO_Save_All               0
#define DITO_Save_Marked            1
#define DITO_Save_NotKnown          2
#define DITO_Save_Dict              3

#endif

