                IFND    LIBRARIES_OPENUTIL_I
LIBRARIES_OPENUTIL_I        SET 1

**
**              $VER: OpenUtil.i 1.0
**
**              Standard asm definitions for OpenUtil.library
**
**              (C) Copyright 1998 Oliver "Bloodrock" Lange
**                  All Rights Reserved
**

        IFND EXEC_LIBRARIES_I
                INCLUDE "exec/libraries.i"
        ENDC
        IFND DOS_DOS_I
                INCLUDE "dos/dos.i"
        ENDC
        IFND UTILITY_TAGITEM_I
                INCLUDE "utility/tagitem.i"
        ENDC
        IFND DEVICES_TIMER_I
                INCLUDE "devices/timer.i"
        ENDC
        IFND GRAPHICS_TEXT_I
                INCLUDE "graphics/text.i"
        ENDC
        IFND LIBRARIES_OPENUTIL_LIB_I
                INCLUDE "libraries/OpenUtil_lib.i"
        ENDC


** Basic Library defines **

OPENUTILNAME    Macro
                        dc.b    "OpenUtil.library",0
                EndM

OPENUTILVERSION EQU     1


** (String Justification): mode defines **

OU_LEFT    EQU 0
OU_RIGHT   EQU 1
OU_CENTER  EQU 2


** oCutList() Flags **

        BITDEF  oCLS,EXCLUSIVE,0 ; exclude <StartRecord> from being deleted
        BITDEF  oCLS,UP,1        ; cut in upward direction (else downward)


** oFCopyMove() Flags **

        BITDEF  oFCM,MOVE,0      ; move instead of copying
        BITDEF  oFCM,KEEPINFO,1  ; keep Source comment & protection bits
        BITDEF  oFCM,REPLACE,2   ; replace existing file/dir
        BITDEF  oFCM,FORCE,3     ; force operation (override source protection bits)


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

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

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

oFVS_KeepVar           EQU (TAG_USER+1)

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


** oFileToList() Tags **

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


** oGetFile() Tags **

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


** oGetFont() Flags **

        BITDEF oGFO,FRONTPEN,0
        BITDEF oGFO,BACKPEN,1
        BITDEF oGFO,DRAWMODE,2
        BITDEF oGFO,STYLES,3


** oListToFile() Tags **

oLTF_Buffer         EQU (TAG_USER+1)
oLTF_BufSize        EQU (TAG_USER+2)
oLTF_MsgWait        EQU (TAG_USER+3)


** 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).

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


** oBuildDirInfoA() Tags **

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

** oBuildDirInfoA() oBDI_SortOrder defines **

oBDISO_Mixed      EQU 0
oBDISO_DirsFirst  EQU 1
oBDISO_FilesFirst EQU 2

** oBuildDirInfoA() oBDI_OnError defines **

oBDION_Abort      EQU 0
oBDION_Break      EQU 1
oBDION_Continue   EQU 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.

        STRUCTURE oDirInfo,0
        ULONG     odi_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     odi_FileCount    ; Number of files stored in this directory.
                                   ; If oBDI_Recursive is set, all files in all
                                   ; sub-directories get added, too.

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

        LONG      odi_ErrorCode    ; AmigaDOS ErrorCode. This is what you get when
                                   ; calling IoErr() after oBuildDirInfoA().

        APTR      odi_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.
                                   ; This pointer is an Exec List Header holding the
                                   ; oDirEntry Nodes.

        APTR      odi_DirTreePool  ; An Exec memory Pool, created by oBuildDirInfoA()
                                   ; if oBDI_BuildDirTree or oBDI_Recursive is set,
                                   ; else NULL.

        STRUCT    odi_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  odi_BuildDirTree
        APTR   odi_Pattern
        APTR   odi_PatternToken    ; (516 bytes) for pattern strings of max. 255+1 bytes
        ULONG  odi_MatchType       ; oMatch() compatible oMATCHMODE_Xxx value for file name matching
        ULONG  odi_MatchCase
        ULONG  odi_Recursive
        APTR   odi_ScanInfoHook
        APTR   odi_ErrorHook
        ULONG  odi_SortOrder
        ULONG  odi_NoDirs
        ULONG  odi_NoFiles
        ULONG  odi_OnError
        BPTR   odi_BaseDirLock
        ULONG  odi_RLevel          ; tmp. recursion count

        LABEL  odi_SIZEOF


** struct oDirEntry: the DirTree structure **

        STRUCTURE oDirEntry,0
        STRUCT    ode_ListNode,LN_SIZE  ; ln_Succ & ln_Pred point to the next/previous
                                        ; directory entries, while ln_Name points to
                                        ; fib_FileName.

        APTR      ode_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.

        APTR      ode_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    ode_FIB,fib_SIZEOF    ; Full FileInfoBlock copy of the current entry
                                        ; providing all available information.

        LABEL     ode_SIZEOF


** oGetMouse() Tags **

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


** Random Seed **

  STRUCTURE oRndSeed,0
    ULONG   ors_RndSeed       ; current RndSeed value
    ULONG   ors_RenewRate     ; RndSeed renew rate (see autodoc description)
    ULONG   ors_RenewCount    ; If RenewCount reaches RenewRate, RenewCount gets
                              ; reset and RndSeed gets renewed by adding the new
                              ; system time (micro seconds).
    ULONG   ors_Add           ; Add Value for oRandom()
    UWORD   ors_Mult          ; Multiply Value for oRandom()
    LABEL   ors_SIZEOF


** oCreateStatusBarA() Tags **

oSTB_MaxValue    EQU     (TAG_USER+1)
oSTB_DrawBorder  EQU     (TAG_USER+2)


** oDeleteStatusBar() Erase values **

oSTB_ERASEBAR    EQU  1
oSTB_ERASEALL    EQU  2


** oStatusBar structure (read only) **

  STRUCTURE  oStatusBar,0
       APTR  osb_RPort       ; Window RastPort
       APTR  osb_VisualInfo  ; Screen VisualInfo
       WORD  osb_Left        ; Left edge in RastPort
       WORD  osb_Top         ; Top edge in RastPort
       WORD  osb_Width       ; Width
       WORD  osb_Height      ; Height
       ULONG osb_MaxValue    ; Maximum value (for 100%)
       ULONG osb_LastWidth   ; Last (current) value
       WORD  osb_HasBorder   ; TRUE or FALSE
      LABEL  osb_SIZEOF               


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

        BITDEF  oNTS,HEX,0           ; (-) Output hex string
        BITDEF  oNTS,BIN,1           ; (-) Output binary string
        BITDEF  oNTS,WORD,2          ; (-) Output size WORD
        BITDEF  oNTS,BYTE,3          ; (-) Output size BYTE
        BITDEF  oNTS,LEADINGZEROES,4 ; (+) Output leading zeroes
        BITDEF  oNTS,LEADINGSIGN,5   ; (+) Add leading numeric system sign
        BITDEF  oNTS,RIGHTFORMAT,6   ; (+) Right formatted output
        BITDEF  oNTS,LEFTFORMAT,7    ; (+) Left formatted output
        BITDEF  oNTS,CENTERFORMAT,8  ; (+) Center formatted output
        BITDEF  oNTS,TENDLEFT,9      ; (+) Left tendence center formatting
        BITDEF  oNTS,LOWERCASE,10    ; (-) Hex characters lowercase
        BITDEF  oNTS,GROUPING,11     ; (+) Separate digit groups
        BITDEF  oNTS,NUMLOCALE,12    ; (+) Use numeric Locale group separator
        BITDEF  oNTS,MONLOCALE,13    ; (+) Use monetary Locale group separator
        BITDEF  oNTS,SIGNED,14       ; (+) Handle value as signed number
        BITDEF  oNTS,PLUSSIGN,15     ; (+) Use "+" char for signed pos. values
        BITDEF  oNTS,SWAPSIGNS,16    ; (+) Swap "-/+/ " and "#/$/%" positions


** oSearchRecordA() Tags **

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


** oSetFileExtension() Flags **

        BITDEF oSFE,REPLACELAST,0    ; replace rightmost extension with new extension
        BITDEF oSFE,REPLACEALL,1     ; replace all extensions with new extension
        BITDEF oSFE,RENAME,2         ; rename file on disk


** oSortList() **

** Size for oSL_Buffer **

oSORTBUFFER_SIZE  EQU  2048

** oSortList() Modes **

oSORTMODE_STRING  EQU 1
oSORTMODE_BYTE    EQU 2
oSORTMODE_WORD    EQU 3
oSORTMODE_LONG    EQU 4
oSORTMODE_QUAD    EQU 5

** oSortList() Tags **

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


** oSuggestWindowPos() Tags **

oSWP_MouseGadget EQU (TAG_USER+1)


** oMsgWait structure (read only) **

      STRUCTURE oMsgWait,0
       APTR     omw_Window
       APTR     omw_VisualInfo
       APTR     omw_GList
       APTR     omw_StatusBar
       APTR     omw_BodyText
       STRUCT   omw_GadgetFont,ta_SIZEOF
       UWORD    omw_IECode
      LABEL     omw_SIZEOF


** oLockWindow() Window Lock structure **

      STRUCTURE oWindowLock,0
       APTR     owl_Window
       ULONG    owl_OldIDCMPFlags
       LONG     owl_MinWidth
       LONG     owl_MinHeight
       LONG     owl_MaxWidth
       LONG     owl_MaxHeight
       UBYTE    owl_SizeFix
      LABEL     owl_SIZEOF


** Library base **

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

 STRUCTURE OpenUtilLibrary,LIB_SIZE

   * 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

   APTR    OU_SysBase           ; exec.library Base          V39+
   APTR    OU_DOSBase           ; dos.library Base           V39+
   APTR    OU_GfxBase           ; graphics.library Base      V39+
   APTR    OU_LocaleBase        ; locale.library Base        V38+
   APTR    OU_AslBase           ; asl.library Base           V38+
   APTR    OU_TimerBase         ; timer.device Library Base (V39+)
   APTR    OU_IconBase          ; icon.library Base          V39+
   APTR    OU_InputBase         ; input.device Library Base (V39+)
   APTR    OU_IntuitionBase     ; intuition.library Base     V39+
   APTR    OU_UtilityBase       ; utility.library Base       V39+
   APTR    OU_GadToolsBase      ; gadtools.library Base      V39+
   APTR    OU_LowerCaseTable    ; standard string to lower-case translation table
   APTR    OU_UpperCaseTable    ; standard string to upper-case translation table
   APTR    OU_PutChProc         ; PutChProc() for RawDoFmt()
   APTR    OU_Topaz8            ; Standard TextAttr structure for topaz.font 8

   * PRIVATE FIELDS *

   STRUCT  OU_InputIO,IOTV_SIZE ; unused IORequest for input.library functions
   STRUCT  OU_TimerIO,IOTV_SIZE ; unused IORequest for timer.library functions

   LABEL   OU_SIZEOF

 ENDC    ; LIBRARIES_OPENUTIL_I
