#ifndef LIBRARIES_INI_LIB_H
#define LIBRARIES_INI_LIB_H
/*
**  $VER: ini_lib.h 31.00 (31.10.98)
**
**  Standard C header for ini.library
**
**  (C) Copyright 1996-98 by Basty/Seasons
**      All Rights Reserved
**
*/

#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif

#ifndef EXEC_LISTS_H
#include "exec/lists.h"
#endif

#ifndef EXEC_LIBRARIES_H
#include "exec/libraries.h"
#endif

#ifndef EXEC_EXECBASE_H
#include "exec/execbase.h"
#endif

#ifndef EXEC_DOS_H
#include "dos/dos.h"
#endif

/* iniLibBase */
struct iniLibBase {
  struct Library LibNode;

  BPTR   SegList;                    /* Segment list */
  struct ExecBase *ExecBase;         /* ExecBase */
  struct DOSBase *DOSBase;           /* DOSBase */
  APTR   MemPool;                    /* Memory pool for iniAllocPMem() */
  struct SignalSemaphore *MemSigSem; /* Memory pool signal semaphore */
}; /* iniLibBase */

/* Flags passable to iniReadxxx(), iniGetxxx() and iniFindxxx() */
#define INIB_ContextCase       0L     /* If set, use case sensitive scan for
                                         context names */
#define INIB_ContextItemCase   1L     /* If set, use case sentitive scan for
                                         context item name */

#define INIF_ContextCase       (1L<<INIB_ContextCase)
#define INIF_ContextItemCase   (1L<<INIB_ContextItemCase)

/* Format parameter of iniIntToStr() */

#define INI_FORMAT_DEC         0L     /* Use decimal with no precedor */
#define INI_FORMAT_DEC_CHAR    1L     /* Use decimal with # precedor */
#define INI_FORMAT_HEX         2L     /* Use hexadical with $ precedor */
#define INI_FORMAT_HEX_0X      3L     /* Use hexadical with 0x precedor */
#define INI_FORMAT_BIN         4L     /* Use binary with % precedor */
#define INI_FORMAT_OCT         5L     /* Use octal with & precedor */
#define INI_FORMAT_YESNO       6L     /* Use No for zero, Yes for others */
#define INI_FORMAT_YN          7L     /* Use N for zero, Y for others */
#define INI_FORMAT_TRUEFALSE   8L     /* Use False for zero, True others */
#define INI_FORMAT_ONOFF       9L     /* Use Off for zero, On for others */
#define INI_UNSIGNED    0x80000000    /* Add this to the others to get
                                         unsigned values */

/* Floating point format of iniStrToFloat() and iniFloatToStr()
   Upper word: Integer part.
   Lower word: 1/65536 of value.
   Example:
   0x00048000 means 4.5 (0x8000/0x10000 = 0.5)
   0xfffc0000 means -4.0 (if treated as signed)
   0xfffc8000 means -3.5 (if treated as signed) */

/* Format parameter of iniFloatToStr() */

#define INI_FLOAT_FORMAT_DEC   0L     /* Use decimal with point separator */
#define INI_FLOAT_UNSIGNED     0x80000000 /* Add this to the others to get
                                             unsigned values */

/* The following structure is for each file opened by iniOpenFile() or
   iniOpenMem(). */

struct iniFile {
  struct MinList Context;             /* Linked list of the contexts. */
  struct MinList PreLines;            /* Lines before the first context. */
};

/* The following structure is for each context in the .INI file. */

struct iniContext {
  struct MinNode Node;                /* ini.library context chunk */
  struct MinList Lines;               /* Lines belonging to this context */
  STRPTR ContextLine;                 /* Context line */
};

/* The following structure is for each line in the .INI file. */

struct iniContextItemLine {
  struct MinNode Node;                /* ini.library config line chunk */
  STRPTR Line;                        /* Line contents (incl. CR/LF) */
};

#define ININame "ini.library"

#endif /* LIBRARIES_INI_LIB_H */
