
#ifndef LIBRARIES_OPENUTIL_H
#define LIBRARIES_OPENUTIL_H TRUE

/*
**
**  $VER: OpenUtil.h 2.0
**
**  Standard C definitions for OpenUtil.library
**
**  (C) Copyright 1998 Oliver "Bloodrock" Lange
**      All Rights Reserved
**
*/

#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif

#ifndef DOS_DOS_H
#include <dos/dos.h>
#endif

#ifndef DEVICES_TIMER_H
#include <devices/timer.h>
#endif

#ifndef GRAPHICS_TEXT_H
#include <graphics/text.h>
#endif

#ifndef PREFS_PREFHDR_H
#include <prefs/prefhdr.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif


/* Basic Library defines */

#define OPENUTILNAME        "OpenUtil.library"

#define OPENUTILVERSION     2


/* (String justification): mode defines */

#define OU_LEFT   0
#define OU_RIGHT  1
#define OU_CENTER 2


/* oCheckSum() calculation Types */

#define oCSTYPE_CRC_32AX366 1
#define oCSTYPE_CRC_16a     2
#define oCSTYPE_CRC_CCITT   3


/* oCreatePath() / oMakePath() Flags */

#define oCPFF_CREATESUBDIRS   (1L << 0) /* create all sub dirs, if necessary */
#define oCPFF_OVERRIDEEXISTS  (1L << 1) /* override OBJECT_EXISTS */


/* oCutList() Flags */

#define oCLSF_EXCLUSIVE (1L << 0)   /* exclude <StartRecord> from being deleted */
#define oCLSF_UP        (1L << 1)   /* cut in upward direction (else downward)  */


/* oFCopyMove() Flags */

#define oFCMF_MOVE      (1L << 0)   /* move instead of copying */
#define oFCMF_KEEPINFO  (1L << 1)   /* keep Source comment & protection bits */
#define oFCMF_REPLACE   (1L << 2)   /* replace existing file/dir */
#define oFCMF_FORCE     (1L << 3)   /* force operation (override source protection bits) */


/* oFileDirHandleA(): Tags */

#define oFDH_Action              (TAG_USER+ 1)
#define oFDH_Recursive           (TAG_USER+ 2)
#define oFDH_Protection          (TAG_USER+ 3)
#define oFDH_DirProtection       (TAG_USER+ 4)
#define oFDH_MaxCopyBuffer       (TAG_USER+ 5)
#define oFDH_ForceDelete         (TAG_USER+ 6)
#define oFDH_DirComments         (TAG_USER+ 7)
#define oFDH_FileCount           (TAG_USER+ 8)
#define oFDH_ByteCount           (TAG_USER+ 9)
#define oFDH_DirCount            (TAG_USER+10)
#define oFDH_MemoryPool          (TAG_USER+11)
#define oFDH_StatusHook          (TAG_USER+12)
#define oFDH_StatusHookUserData  (TAG_USER+13)
#define oFDH_oFCopyMoveFlags     (TAG_USER+14)
#define oFDH_OnError             (TAG_USER+15)
#define oFDH_Pattern             (TAG_USER+16)
#define oFDH_CreateSubDirs       (TAG_USER+17)

/* oFileDirHandleA(): oFDH_Action defines */

#define oFDH_ACTION_COUNT               0L
#define oFDH_ACTION_DELETE              1L
#define oFDH_ACTION_MOVE                2L
#define oFDH_ACTION_COPY                3L
#define oFDH_ACTION_COMMENT             4L
#define oFDH_ACTION_SETPROTECTION       5L
#define oFDH_ACTION_CLEARPROTECTION     6L
#define oFDH_ACTION_SWAPPROTECTION      7L

/* oFileDirHandleA(): possible Results */

#define oFDH_RESULT_SUCCESS             0L
#define oFDH_RESULT_BUFFERALLOCFAIL     1L
#define oFDH_RESULT_DIRLOCKFAIL         2L
#define oFDH_RESULT_EXAMINEFAIL         3L
#define oFDH_RESULT_DESTNOTDIR          4L
#define oFDH_RESULT_SOURCENOTVALID      5L
#define oFDH_RESULT_DESTNOTVALID        6L
#define oFDH_RESULT_NOPROTBITMASK       7L
#define oFDH_RESULT_USERABORTREQUEST    8L
#define oFDH_RESULT_REQUIREDTAGMISSING  9L

/* oFileDirHandleA(): Hook data structure */

struct oFDHHookData
{
  struct OpenUtilLibrary * OpenUtilBase;
  struct FileInfoBlock   * CurrentFIB;
  struct TagItem         * TagList;
  BPTR                     SourceLock;
  STRPTR                   Source;
  STRPTR                   Destination;
  STRPTR                   FiFile;
  STRPTR                   SeFile;
  STRPTR                   PatternBuffer;
  long                     StatusCode;
  APTR                     UserData;
};

/* oFileDirHandleA(): status codes, as set in oFDHHookData->StatusCode */

#define oFDH_HOOKSTAT_EXAMINEFAIL   -3L
#define oFDH_HOOKSTAT_DIRLOCKFAIL   -2L
#define oFDH_HOOKSTAT_OUTOFMEMORY   -1L
#define oFDH_HOOKSTAT_UPDATE         0L
#define oFDH_HOOKSTAT_BYTECOUNTFAIL  1L
#define oFDH_HOOKSTAT_GETPROTECTFAIL 2L
#define oFDH_HOOKSTAT_SETPROTECTFAIL 3L
#define oFDH_HOOKSTAT_DELETEFAIL     4L
#define oFDH_HOOKSTAT_ADDPARTFAIL    5L
#define oFDH_HOOKSTAT_oFCOPYMOVEFAIL 6L
#define oFDH_HOOKSTAT_SETCOMMENTFAIL 7L
#define oFDH_HOOKSTAT_CREATEDIRFAIL  8L
#define oFDH_HOOKSTAT_PATTERNFAIL    9L

/* oFileDirHandleA() StatusHook: possible return codes */

#define oFDH_HOOK_RETURN_OK          0L
#define oFDH_HOOK_RETURN_SKIP        1L
#define oFDH_HOOK_RETURN_ABORT       2L


/* oFormatVarStrA() Tags; not for use with oFormatVarStrRDFA() */

#define oFVS_VarBuffer_0    (TAG_USER+48)
#define oFVS_VarBuffer_1    (TAG_USER+49)
#define oFVS_VarBuffer_2    (TAG_USER+50)
#define oFVS_VarBuffer_3    (TAG_USER+51)
#define oFVS_VarBuffer_4    (TAG_USER+52)
#define oFVS_VarBuffer_5    (TAG_USER+53)
#define oFVS_VarBuffer_6    (TAG_USER+54)
#define oFVS_VarBuffer_7    (TAG_USER+55)
#define oFVS_VarBuffer_8    (TAG_USER+56)
#define oFVS_VarBuffer_9    (TAG_USER+57)

/* oFormatVarStrA() & oFormatVarStrRDFA() Tags */

#define oFVS_KeepVar           (TAG_USER+256)

#define oFVS_VarBuffer_A    (TAG_USER+65)
#define oFVS_VarBuffer_B    (TAG_USER+66)
#define oFVS_VarBuffer_C    (TAG_USER+67)
#define oFVS_VarBuffer_D    (TAG_USER+68)
#define oFVS_VarBuffer_E    (TAG_USER+69)
#define oFVS_VarBuffer_F    (TAG_USER+70)
#define oFVS_VarBuffer_G    (TAG_USER+71)
#define oFVS_VarBuffer_H    (TAG_USER+72)
#define oFVS_VarBuffer_I    (TAG_USER+73)
#define oFVS_VarBuffer_J    (TAG_USER+74)
#define oFVS_VarBuffer_K    (TAG_USER+75)
#define oFVS_VarBuffer_L    (TAG_USER+76)
#define oFVS_VarBuffer_M    (TAG_USER+77)
#define oFVS_VarBuffer_N    (TAG_USER+78)
#define oFVS_VarBuffer_O    (TAG_USER+79)
#define oFVS_VarBuffer_P    (TAG_USER+80)
#define oFVS_VarBuffer_Q    (TAG_USER+81)
#define oFVS_VarBuffer_R    (TAG_USER+82)
#define oFVS_VarBuffer_S    (TAG_USER+83)
#define oFVS_VarBuffer_T    (TAG_USER+84)
#define oFVS_VarBuffer_U    (TAG_USER+85)
#define oFVS_VarBuffer_V    (TAG_USER+86)
#define oFVS_VarBuffer_W    (TAG_USER+87)
#define oFVS_VarBuffer_X    (TAG_USER+88)
#define oFVS_VarBuffer_Y    (TAG_USER+89)
#define oFVS_VarBuffer_Z    (TAG_USER+90)
#define oFVS_VarBuffer_a    (TAG_USER+97)
#define oFVS_VarBuffer_b    (TAG_USER+98)
#define oFVS_VarBuffer_c    (TAG_USER+99)
#define oFVS_VarBuffer_d    (TAG_USER+100)
#define oFVS_VarBuffer_e    (TAG_USER+101)
#define oFVS_VarBuffer_f    (TAG_USER+102)
#define oFVS_VarBuffer_g    (TAG_USER+103)
#define oFVS_VarBuffer_h    (TAG_USER+104)
#define oFVS_VarBuffer_i    (TAG_USER+105)
#define oFVS_VarBuffer_j    (TAG_USER+106)
#define oFVS_VarBuffer_k    (TAG_USER+107)
#define oFVS_VarBuffer_l    (TAG_USER+108)
#define oFVS_VarBuffer_m    (TAG_USER+109)
#define oFVS_VarBuffer_n    (TAG_USER+110)
#define oFVS_VarBuffer_o    (TAG_USER+111)
#define oFVS_VarBuffer_p    (TAG_USER+112)
#define oFVS_VarBuffer_q    (TAG_USER+113)
#define oFVS_VarBuffer_r    (TAG_USER+114)
#define oFVS_VarBuffer_s    (TAG_USER+115)
#define oFVS_VarBuffer_t    (TAG_USER+116)
#define oFVS_VarBuffer_u    (TAG_USER+117)
#define oFVS_VarBuffer_v    (TAG_USER+118)
#define oFVS_VarBuffer_w    (TAG_USER+119)
#define oFVS_VarBuffer_x    (TAG_USER+120)
#define oFVS_VarBuffer_y    (TAG_USER+121)
#define oFVS_VarBuffer_z    (TAG_USER+122)


/* oFileToList() Tags */

#define oFTL_Buffer         (TAG_USER+1)
#define oFTL_BufSize        (TAG_USER+2)
#define oFTL_MsgWait        (TAG_USER+3)
#define oFTL_NodeNameOffset (TAG_USER+4)


/* oGetFile() Tags */

#define oGFI_Pattern        (TAG_USER+1)
#define oGFI_PubScreenName  (TAG_USER+2)
#define oGFI_NoIcons        (TAG_USER+3)
#define oGFI_DirsOnly       (TAG_USER+4)


/* oGetFont() Flags */

#define oGFO_FRONTPEN       (1L<<0)
#define oGFO_BACKPEN        (1L<<1)
#define oGFO_DRAWMODE       (1L<<2)
#define oGFO_STYLES         (1L<<3)


/* oListToFile() Tags */

#define oLTF_Buffer         (TAG_USER+1)
#define oLTF_BufSize        (TAG_USER+2)
#define oLTF_MsgWait        (TAG_USER+3)


/* oLoadFileA() Tags */

#define oLF_MemPool   (TAG_USER+1)
#define oLF_MemAttrs  (TAG_USER+2)
#define oLF_KeepLock  (TAG_USER+3)
#define oLF_KeepFH    (TAG_USER+4)
#define oLF_Force     (TAG_USER+5)


/* oSaveFileA() Tags */

#define oSF_KeepFH    (TAG_USER+1)
#define oSF_Overwrite (TAG_USER+2)
#define oSF_Force     (TAG_USER+3)


/* oMemFile structure, as returned by oLoadFileA() */

struct oMemFile
{
  BPTR    Lock;               /* shared Lock if oLF_KeepLock was used, else NULL.*/
  BPTR    FH;                 /* read FileHandle if oLF_KeepFH was used, else NULL. */
  struct  FileInfoBlock FIB;  /* contains all file information as loaded. */
  ULONG   Pad;                /* currently only used to QuadWord-align Body */
  ULONG   Size;               /* file size (equals oMemFile->FIB.fib_Size) */
  UBYTE * Body;               /* the memory address of the file image, which equals */
};                            /* ((UBYTE *)((ULONG)(&MemFile->Body)))+sizeof(UBYTE *). */


/* oMatch() defines, as used with:

     oBuildDirInfoA()
     oSearchRecordA()

   If you're going to call a function which uses oMatch(), please also read the
   documentation of that function. It states which of the following match modes 
   and other defines are supported by the desired function, and about how to
   use it (maybe using special Tag defines).
*/

#define oMATCHMODE_Byte       1
#define oMATCHMODE_Word       2
#define oMATCHMODE_Long       3
#define oMATCHMODE_QuadPtr    4
#define oMATCHMODE_StrBegin   5
#define oMATCHMODE_StrEnd     6
#define oMATCHMODE_StrAny     7
#define oMATCHMODE_StrExact   8
#define oMATCHMODE_StrPattern 9


/* oBuildDirInfoA() Tags */

#define oBDI_BuildDirTree  (TAG_USER+1)
#define oBDI_MatchAny      (TAG_USER+1000+oMATCHMODE_StrAny)
#define oBDI_MatchBegin    (TAG_USER+1000+oMATCHMODE_StrBegin)
#define oBDI_MatchEnd      (TAG_USER+1000+oMATCHMODE_StrEnd)
#define oBDI_MatchExact    (TAG_USER+1000+oMATCHMODE_StrExact)
#define oBDI_MatchPattern  (TAG_USER+1000+oMATCHMODE_StrPattern)
#define oBDI_CaseSensitive (TAG_USER+7)
#define oBDI_Recursive     (TAG_USER+8)
#define oBDI_ScanInfoHook  (TAG_USER+9)
#define oBDI_ErrorHook     (TAG_USER+10)
#define oBDI_SortOrder     (TAG_USER+11)
#define oBDI_NoDirs        (TAG_USER+12)
#define oBDI_NoFiles       (TAG_USER+13)
#define oBDI_OnError       (TAG_USER+14)

/* oBuildDirInfoA() oBDI_SortOrder defines */

#define oBDISO_Mixed       0
#define oBDISO_DirsFirst   1
#define oBDISO_FilesFirst  2

/* oBuildDirInfoA() oBDI_OnError defines */

#define oBDION_Abort       0
#define oBDION_Break       1
#define oBDION_Continue    2

/*
  struct oDirInfo & struct oDirEntry, as created by oBuildDirInfoA(); this
  structure comes filled with information which depends on the passed Tags.
  For example, if you specify a file pattern, ByteCount holds the overall
  byte count of all matching files instead of the whole path.
*/

struct oDirInfo
{
  ULONG  ByteCount;           /* Overall byte size of all files stored in this
                                 directory. If oBDI_Recursive is set, all files
                                 in all sub-directories get added, too. */

  ULONG  FileCount;           /* Number of files stored in this directory.
                                 If oBDI_Recursive is set, all files in all
                                 sub-directories get added, too. */

  ULONG  DirCount;            /* Number of directories in this directory.
                                 If oBDI_Recursive is set, all directories in
                                 all sub-directories get added, too. */

  long   ErrorCode;           /* AmigaDOS ErrorCode. This is what you get when
                                 calling IoErr() after oBuildDirInfoA(). */

  struct oDirEntry * DirTree; /* If oBDI_BuildDirTree is set, oBuildDirInfoA()
                                 builds up a directory tree using Nodes of
                                 struct oDirEntry type.
                                 If oBDI_Recursive is set, this List comes back
                                 in two dimensions, as explained below. Else,
                                 this field will be NULL. If you have specified
                                 a pattern, DirTree only contains matching entries. */

  void * DirTreePool;         /* An Exec memory Pool, created by oBuildDirInfoA()
                                 if oBDI_BuildDirTree or oBDI_Recursive is set,
                                 else NULL. */

  char   ActualDir[256];      /* This string contains the path which is currently
                                 being examined. If you're using a ScanInfo and/or
                                 Error Hook, it'll receive this string in A2. */

  /* The following fields hold copies of the passed Tag data and other internal
     data used to save some Stack space when scanning recursively. You may refer
     to these fields after calling oBuildDirInfoA(), if you want.
  */

  ULONG  BuildDirTree;
  STRPTR Pattern;
  STRPTR PatternToken;        /* (516 bytes) for pattern strings of max. 255+1 bytes */
  ULONG  MatchType;           /* oMatch() compatible oMATCHMODE_Xxx value for file name matching */
  ULONG  MatchCase;
  ULONG  Recursive;
  struct Hook * ScanInfoHook;
  struct Hook * ErrorHook;
  ULONG  SortOrder;
  ULONG  NoDirs;
  ULONG  NoFiles;
  ULONG  OnError;
  BPTR   BaseDirLock;
  ULONG  RLevel;              /* tmp. recursion count */
};

/* struct oDirEntry: the DirTree structure */

struct oDirEntry
{
  struct Node ListNode;        /* ln_Succ & ln_Pred point to the next/previous
                                  directory entries, while ln_Name points to
                                  fib_FileName. */

  struct oDirEntry * Contents; /* This will be NULL if the current entry is a
                                  file. If it's a directory, Contents points one
                                  level down to it's contents. If the directory
                                  is empty, Contents is set to NULL.
                                  If oBDI_Recursive isn't set, Contents is
                                  always NULL. */

  struct oDirEntry * Parent;   /* This pointer is the counterpart to the Contents
                                  pointer, which holds the parent directory entry.
                                  If Parent is NULL, you have reached the topmost
                                  instance of the whole directory tree.
                                  If oBDI_Recursive isn't set, this field is
                                  always NULL. */

  struct FileInfoBlock FIB;    /* Full FileInfoBlock copy of the current entry
                                  providing all available information. */
};


/* oGetMouse() Tags */

#define oGetMouse_X        (TAG_USER+1)
#define oGetMouse_Y        (TAG_USER+2)
#define oGetMouse_Screen   (TAG_USER+3)
#define oGetMouse_Window   (TAG_USER+4)
#define oGetMouse_LMB      (TAG_USER+5)
#define oGetMouse_RMB      (TAG_USER+6)
#define oGetMouse_MMB      (TAG_USER+7)


/*
   oLoadPrefs() / oSavePrefs() file structure

   The following struct explains the contents of files created by oSavePrefs().
   Your application won't need this anyway, but if you like details, here
   they are. Note that things may change in the future, so do not handle
   the files yourself if your application shall stay future compatible.
*/

struct oPRFHeader                /* Prefs file header as created by oSavePrefs() */
{
  ULONG   FORMID;                /* "FORM" IFF identifier */
  ULONG   FORMSize;              /* == (file size - 8) */
  ULONG   PREFID;                /* "PREF" Amiga Prefs file identifier */
  ULONG   PRHDID;                /* "PRHD" PrefHeader Chunk ID */
  ULONG   PRHDSize;              /* "PRHD" Chunk size == sizeof(struct PrefHeader) */
  struct  PrefHeader PrefHeader; /* struct PrefHeader */

  ULONG   OUID;           /* "oPRF" declares this file as created using oSavePrefs() */
  ULONG   ChunkSize;      /* currently 146 bytes + body size; body is always LONG-aligned */
  UWORD   oPRFVersion;    /* oPRF file version number for internal use; currently == 1. */
  char    ObjectName[32]; /* Object name as passed to oSavePrefs() */
  ULONG   ObjectVersion;  /* Object version number as passed to oSavePrefs() */
  ULONG   ObjectRevision; /* Object revision number as passed to oSavePrefs() */
  char    VerString[80];  /* Standard Amiga version string */
  ULONG   GroupID;        /* GroupID as declared by the application */
  ULONG   SubID;          /* SubID as declared by the application */
  ULONG   SubSize;        /* Size of the application data part (body) which */
                          /* begins directly behind the oPRFHeader. */
  ULONG   SubRealSize;    /* Real body size after decompression; if there's no */
                          /* compression, SubRealSize equals SubSize. */
  ULONG   Compression;    /* Used compression method. Currently there's none, so this */
                          /* is currently NULL (no compression). */
  ULONG   CRC32;          /* 32-bit CRC checksum of the body which follows the oPRFHeader (after decompression) */
};

#define oPRF_OBJNAME_MAXLEN 79  /* 79 chars + null-byte, as defined in the structure above */
#define oPRF_VERSTR_MAXLEN  31  /* 31 chars + null-byte, as defined in the structure above */


/* oRequestLibA() Tags */

#define oRL_TitleText      (TAG_USER+1)
#define oRL_DefaultName    (TAG_USER+2)
#define oRL_FilePattern    (TAG_USER+3)


/* Random Seed */

struct oRndSeed
  {
    ULONG RndSeed;      /* current RndSeed value */
    ULONG RenewRate;    /* RndSeed renew rate (see autodoc description) */
    ULONG RenewCount;   /* If RenewCount reaches RenewRate, RenewCount gets */
                        /* reset and RndSeed gets renewed by adding the new */
                        /* system time (micro seconds). */
    ULONG Add;          /* Random Seed Add Value */
    UWORD Mult;         /* Random Seed Multiply Value */
  };


/* oCreateStatusBarA() Tags */

#define oSTB_MaxValue    (TAG_USER+1)
#define oSTB_DrawBorder  (TAG_USER+2)

/* oDeleteStatusBar() Erase values */

#define oSTB_ERASEBAR 1
#define oSTB_ERASEALL 2

/* oStatusBar structure (read only) */

struct oStatusBar
  {
    struct RastPort * RPort;        /* Window RastPort          */
               void * VisualInfo;   /* Screen VisualInfo        */
               WORD   Left;         /* Left edge in RastPort    */
               WORD   Top;          /* Top edge in RastPort     */
               WORD   Width;        /* Width                    */
               WORD   Height;       /* Height                   */
               ULONG  MaxValue;     /* Maximum value (for 100%) */
               ULONG  LastWidth;    /* Last (current) value     */
               WORD   HasBorder;    /* TRUE or FALSE            */
  };


/* Flags for oNumToStr() and oNum64ToStr() */
/* Note: flags marked with "(-)" are not available for oNum64ToStr(). */

#define oNTSF_HEX           (1L<<0)  /* (-) Output hex string */
#define oNTSF_BIN           (1L<<1)  /* (-) Output binary string */
#define oNTSF_WORD          (1L<<2)  /* (-) Output size WORD */
#define oNTSF_BYTE          (1L<<3)  /* (-) Output size BYTE */
#define oNTSF_LEADINGZEROES (1L<<4)  /* (+) Output leading zeros */
#define oNTSF_LEADINGSIGN   (1L<<5)  /* (+) Add leading numeric system sign */
#define oNTSF_RIGHTFORMAT   (1L<<6)  /* (+) Right formatted output */
#define oNTSF_LEFTFORMAT    (1L<<7)  /* (+) Left formatted output */
#define oNTSF_CENTERFORMAT  (1L<<8)  /* (+) Center formatted output */
#define oNTSF_TENDLEFT      (1L<<9)  /* (+) Left tendence center formatting */
#define oNTSF_LOWERCASE     (1L<<10) /* (-) Hex characters lowercase */
#define oNTSF_GROUPING      (1L<<11) /* (+) Separate digit groups */
#define oNTSF_NUMLOCALE     (1L<<12) /* (+) Use numeric Locale group separator */
#define oNTSF_MONLOCALE     (1L<<13) /* (+) Use monetary Locale group separator */
#define oNTSF_SIGNED        (1L<<14) /* (+) Handle value as signed number */
#define oNTSF_PLUSSIGN      (1L<<15) /* (+) Use "+" char for signed pos. values */
#define oNTSF_SWAPSIGNS     (1L<<16) /* (+) Swap "-/+/ " and "#/$/%" positions */


/* oSearchRecordA() Tags */

#define oSR_CaseSensitive  (TAG_USER+1)
#define oSR_Pointer        (TAG_USER+2)
#define oSR_StartNode      (TAG_USER+3)
#define oSR_Exclusive      (TAG_USER+4)
#define oSR_Up             (TAG_USER+5)


/* oSetFileExtension() Flags */

#define oSFEF_REPLACELAST (1L << 0)  /* replace rightmost extension with new extension */
#define oSFEF_REPLACEALL  (1L << 1)  /* replace all extensions with new extension */
#define oSFEF_RENAME      (1L << 2)  /* rename file on disk */


/* oSortList() */

/* Size for oSL_Buffer */

#define oSORTBUFFER_SIZE 2048

/* oSortList() Modes */

#define oSORTMODE_STRING   1
#define oSORTMODE_BYTE     2
#define oSORTMODE_WORD     3
#define oSORTMODE_LONG     4
#define oSORTMODE_QUAD     5

/* oSortList() Tags */

#define oSL_Padout   (TAG_USER+1)
#define oSL_Table    (TAG_USER+2)
#define oSL_Signed   (TAG_USER+3)
#define oSL_Downward (TAG_USER+4)
#define oSL_Pointer  (TAG_USER+5)
#define oSL_Buffer   (TAG_USER+6)


/* oSuggestWindowPos() Tags */

#define oSWP_MouseGadget (TAG_USER+1)


/* oMsgWait structure (read only) */

struct oMsgWait
{
  struct Window *     Window;
  void *              VisualInfo;
  struct Gadget *     GList;
  struct oStatusBar * StatusBar;
  struct IntuiText *  BodyText;
  struct TextAttr     GadgetFont;
  UWORD               IECode;
};


/* oLockWindow() Window Lock structure */

struct oWindowLock
{
  struct Window * Window;
  ULONG  OldIDCMPFlags;
  long   MinWidth;
  long   MinHeight;
  long   MaxWidth;
  long   MaxHeight;
  UBYTE  SizeFix;
};


/* Library base */

/* Fields declared as private ARE private. Do not use 'em. */

struct OpenUtilLibrary
{
  struct Library         OU_LibNode;       /* Standard library node */

  /* LIBRARY PRIVATE */

  UBYTE  OU_Flags;       /* see also: */
  UBYTE  OU_pad;         /* "sample.library.asm", documented in the */
  BPTR   OU_SegList;     /* Amiga ROM Kernel Reference Manual: Libraries */

  /* PUBLIC FIELDS */    /* may be READ from your program */

  struct ExecBase *      OU_SysBase;        /* exec.library Base            V39+  */
  struct DosLibrary *    OU_DOSBase;        /* dos.library Base             V39+  */
  struct GfxBase *       OU_GfxBase;        /* graphics.library Base        V39+  */
  struct Library *       OU_LocaleBase;     /* locale.library Base          V39+  */
  struct Library *       OU_AslBase;        /* asl.library Base             V39+  */
  struct Library *       OU_TimerBase;      /* timer.device Library Base   (V39+) */
  struct Library *       OU_IconBase;       /* icon.library Base            V39+  */
  struct Library *       OU_InputBase;      /* input.device Library Base   (V39+) */
  struct IntuitionBase * OU_IntuitionBase;  /* intuition.library Base       V39+  */
  struct Library *       OU_UtilityBase;    /* utility.library Base         V39+  */
  struct Library *       OU_GadToolsBase;   /* gadtools.library Base        V39+  */

  UBYTE *                OU_LowerCaseTable; /* standard string to lower-case translation table */
  UBYTE *                OU_UpperCaseTable; /* standard string to upper-case translation table */
  void                 (*OU_PutChProc)();   /* PutChProc() for RawDoFmt() */
  struct TextAttr *      OU_Topaz8;         /* Standard TextAttr structure for topaz.font 8 */

  /* PRIVATE FIELDS */

  struct IOStdReq        OU_InputIO;        /* unused IORequest for input.library functions */
  struct timerequest     OU_TimerIO;        /* unused IORequest for timer.library functions */

  /* PUBLIC FIELDS (V2) */

  struct Library *       OU_ConsoleBase;    /* console.device Library Base (V39+) */
  struct Library *       OU_CxBase;         /* commodities.library Base     V39+  */
  struct Library *       OU_DiskfontBase;   /* diskfont.library Base        V39+  */
  struct Library *       OU_ExpansionBase;  /* expansion.library Base       V39+  */
  struct Library *       OU_IFFParseBase;   /* iffparse.library Base        V39+  */
  struct Library *       OU_KeymapBase;     /* keymap.library Base          V37+  */
  struct Library *       OU_LayersBase;     /* layers.library Base          V39+  */

  struct IOStdReq        OU_ConsoleIO;      /* unused IORequest for console.library functions */

  STRPTR                 OU_IntuitionName;  /* intuition.library name   */
  STRPTR                 OU_AslName;        /* asl.library name         */
  STRPTR                 OU_CxName;         /* commodities.library name */
  STRPTR                 OU_DiskfontName;   /* diskfont.library name    */
  STRPTR                 OU_DOSName;        /* dos.library name         */
  STRPTR                 OU_ExpansionName;  /* expansion.library name   */
  STRPTR                 OU_GadToolsName;   /* gadtools.library name    */
  STRPTR                 OU_GfxName;        /* graphics.library name    */
  STRPTR                 OU_IconName;       /* icon.library name        */
  STRPTR                 OU_IFFParseName;   /* iffparse.library name    */
  STRPTR                 OU_KeymapName;     /* keymap.library name      */
  STRPTR                 OU_LayersName;     /* layers.library name      */
  STRPTR                 OU_LocaleName;     /* locale.library name      */
  STRPTR                 OU_SysName;        /* exec.library name        */
  STRPTR                 OU_UtilityName;    /* utility.library name     */
  STRPTR                 OU_ConsoleName;    /* console.library name     */
  STRPTR                 OU_InputName;      /* input.library name       */
  STRPTR                 OU_TimerName;      /* timer.library name       */
};

#endif /* LIBRARIES_OPENUTIL_H */
