/*
**      $VER: ixex.h 1.0
**
**      structures, definitions etc.
**
**      Copyright (c) 1997 by Ivan Sturlic
*/

#ifndef IXEX_IXEX_H
#define IXEX_IXEX_H

#include <graphics/text.h>

/*
** NOTE: Use exec.library/AllocVec() for allocation of these structures
** and their fields
*/

struct iX_ChunkInfo {
                      char  *ci_data;         // pointer to text chunk 
                      ULONG ci_datalen;       // length of chunk
                      ULONG ci_entrynum;      // number of entries
                      UBYTE *ci_entry;        // pointer to entry array
                      ULONG *cie_position;    // entry positions in chunk
                      UWORD *cie_length;      // entry lengths
                    };

struct iX_Node {
                 struct iX_Node *Next;
                 long node_begin;  // node start position
                 long node_end;    // node end position
                 char *name;
                 char *title;
                 char *toc;
                 char *prev;
                 char *next;
                 char *background;                              
               };

struct Alias {
                char *alias;
                char *realname;
                struct Alias *Next;
             };

struct iX_Database {
            /*** GLOBAL DATABASE DATA **/
            struct iX_DataBase *        Next;
	    STRPTR			ixd_DatabasePath;							// database path+filename
	    STRPTR			ixd_FilePath;
	    STRPTR			ixd_FilePart;								// ptr to filename offset
            STRPTR			DatabaseName,Author,Copyright;	// Real
            STRPTR			Version,Master,Index;
            STRPTR			Help,Console,Background;
            ULONG			VSpacing;
            ULONG			MaxLineWidth,MO_MaxLineWidth;
            UWORD			WTop,WLeft,WWidth,WHeight;
            struct TextFont *           Font; // copy
            UBYTE 			TextStyle;
	    BOOL                        WordWrap,IndexRead;
            ULONG			LOh,LOv;
            ULONG 			fg,bg,shade;
            UWORD			Tab;
	    struct iX_ChunkInfo       	*HeaderPool;
	    BPTR			FileHandle; // handle to file

            /*** CURRENT NODE SPECIFIC DATA ***/      
            struct iX_Node *            c_Node; // pointer to current node
            char *                      c_Console;
            ULONG                       c_VSpacing;
            ULONG                       c_WTop,c_WLeft,c_WWidth,c_WHeight;
            struct TextFont *           c_Font;			// copy
            UBYTE                       c_TextStyle;
            ULONG                       c_LOh,c_LOv;
            ULONG                       c_fg,c_bg,c_shade;
            UWORD                       c_Tab;
            UWORD                       c_ulLevel;
                      
            /*** LISTS ***/
            struct Alias   *            AliasList;
            struct Alias   *            MacroList;
            struct Alias   *            UIList;
            struct iX_Node *            NodeList;
                
            // new fields
            STRPTR indexname;
 /*GLOBAL*/ APTR HeadProgLaunchQueue; // progs to launch when database is loaded
                };

/*
** Entry types recognized by iX-Guide
*/

#define ET_ATTR      1     // tag attribute
#define ET_WORD      2     // simple word
#define ET_RTRN      3     // return character
#define ET_SPC       4     // space character(s)
#define ET_TAG       5     // begining of multi tag (@{)
#define ET_STAG      6     // begining of single tag (@)
#define ET_END       255   // end of entry array

#define ET_DATABASE   21
#define ET_AUTHOR     22
#define ET_C          23
#define ET_VER        24
#define ET_MASTER     25
#define ET_FONT       26
#define ET_INDEX      27
#define ET_HELP       28
#define ET_WORDWRAP   29
#define ET_NODE       30
#define ET_DNODE      31 // *** same as NODE for now
#define ET_REMARK     32
#define ET_TITLE      33
#define ET_TOC        34
#define ET_PREV       35
#define ET_NEXT       36
#define ET_KEYWORDS   37 // ***
#define ET_ENDNODE    38
#define ET_WIDTH      39
#define ET_HEIGHT     40
#define ET_BACKGROUND 41 // NEW !!!
#define ET_REXX       42 // !!!!!!!!!!!!!!!!!!!!! AREXX : Launch arexx program
#define ET_VSPACING   43 // NEW !!!
#define ET_TOP        44 // NEW !!!
#define ET_LEFT       45 // NEW !!!
#define ET_CONSOLE    46 // NEW !!!
#define ET_USERINFO   47 // NEW !!!!!!! USERINFO string 
#define ET_ALIAS      48 // NEW !!!   some label as alias to some string (e.g. filenames, fonts...)
#define ET_IXF        49 // NEW !!!   turn on ix-guide formatting
#define ET_MACRO      50 // NEW !!!   macro definition
#define ET_TAB        51 // NEW !!!   tab size
#define ET_BODY       52 // NEW !!!   specify global textstyle, colors and alignement
#define ET_SYS        53 // NEW !!!   launch external program
#define ET_FG         101
#define ET_BG         102
#define ET_B          103
#define ET_UB         104
#define ET_I          105
#define ET_UI         106
#define ET_U          107
#define ET_UU         108
#define ET_D          109 // NEW !!! - distance object
#define ET_A          110 // NEW !!! - align
#define ET_LINK       111
#define ET_SYSTEM     112
#define ET_BEEP       113
#define ET_CLOSE      114
#define ET_PIC        115 // NEW !!!
#define ET_ALINK      116
#define ET_RX         117
#define ET_QUIT       118
#define ET_SC         119 // NEW !!!    text shadow color
#define ET_S          120 // NEW !!!    shadow text style
#define ET_US         121 // NEW !!!    end of shadow text
#define ET_BEGINML    122 // NEW !!!    begining of multiline object
#define ET_ENDML      123 // NEW !!!    end of multiline object
#define ET_HR         124 // NEW !!!    horizontal rule
#define ET_N          125 // return
#define ET_CL         126 // compact line
#define ET_UCL        127 // end of compact line
#define ET_RR         128 // real return means new line
#define ET_URR        129 // real return off 
#define ET_RECT       130 // !!!!!!!!!!!!!!!!!!!!!!!!! AREXX: Rectangle object
#define ET_UL         131 
#define ET_LI         132
#define ET_UUL        133
#define ET_IB         134 // image border on
#define ET_UIB        135
#define ET_PICT       136 // transparent image
#define ET_SAFF       137 // Simple Animation File Format
#define ET_MFONT      138 // new font multi tag
#define	ET_CODESET	  139 // NEW!!!! 3.12.not yet {codeset SJIS} etc. valid ISO1 JIS0 UNI2 SJIS UC2J

#endif
