|##########|
|#MAGIC   #|CLABLJBI
|#PROJECT #|""
|#PATHS   #|"StdProject"
|#FLAGS   #|xx---x--x---x-x-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|xx---xxxxx-xx---
|##########|
DEFINITION MODULE Utility;
|=========================================================================
|
|  Produkt           :  -
|  Projekt           :  -
|  Paket             :  Amiga Bibliotheken V2.0
|  Komponente        :  Dos
|  Baustein          :  -
|
|  Datum        Version   Autor          Kommentar
|  ------------ --------- -------------- ---------------------------------
|  20.06.1991   01:01     Thomas Rocks   CONST tagUser korrigiert,Kosmetik
|  XX.06.1991   01:00     Ulrich Sigmund File - Erstellung
|=========================================================================


FROM Exec    IMPORT MinNode,LibraryPtr;
FROM System  IMPORT Regs,LONGSET;

CONST
  tagUser         = $80000000;

TYPE
  ClockData       = RECORD
                      sec,
                      min,
                      hour,
                      mday,
                      month,
                      year,
                      wday       :  CARDINAL
                    END;

  HookPtr         = POINTER TO Hook;

  HookCall        = PROCEDURE(hook    : HookPtr;
                              object  : ANYPTR;
                              message : ANYPTR);

  Hook            = RECORD OF MinNode
                      entry    : PROCEDURE(hook    IN A0 : HookPtr;
                                           object  IN A2 : ANYPTR;
                                           message IN A1 : ANYPTR);
                      subEntry : HookCall;
                      data     : ANYPTR
                    END;

  Tag             = LONGCARD;

  TagArrayPtr     = POINTER TO TagArray;  | an array of Tag values
  TagArray        = ARRAY OF Tag;         | without data association

  TagItemPtr      = POINTER TO TagItem;
  TagItem         = RECORD
                      tag  : Tag;
                      data : LONGCARD;
                    END;

  TagAPtr         = POINTER TO TagA;
  TagA            = ARRAY OF TagItem;

  StdTags         = TAGS
                      DONE   = 0;
                      IGNORE      : ANYPTR;
                      MORE        : TagAPtr;
                      MOREA  = 2  : ANYPTR;  | for easy programming
                      SKIP        : INTEGER;
                      USER   = tagUser - 1;
                    END;

  StdTagAPtr      = POINTER TO StdTagA;
  StdTagA         = ARRAY OF StdTags;

  TagListPtr      = POINTER TO TagList;
  TagList         = StdTagA;

VAR
  UtilityBase     : LibraryPtr;


PROCEDURE Dispatcher(hook    IN A0     :  HookPtr;
                     object  IN A2     :  ANYPTR;
                     message IN A1     :  ANYPTR);

PROCEDURE InitHook(VAR hook : Hook;
                       call : HookCall;
                       data : ANYPTR):HookPtr;

LIBRARY UtilityBase BY -30
  PROCEDURE FindTagItem(tagVal  IN D0 : LONGCARD;
                        tagList IN A0 : TagListPtr):TagItemPtr;

LIBRARY UtilityBase BY -36
  PROCEDURE GetTagData(tagVal  IN D0 : LONGCARD;
                       default IN D1 : LONGINT;
                       tagList IN A0 : TagListPtr):LONGINT;

LIBRARY UtilityBase BY -42
  PROCEDURE PackBoolTags(initFlags IN D0 : LONGSET;
                         tagList   IN A0 : TagListPtr;
                         boolMap   IN A1 : TagListPtr):LONGSET;

LIBRARY UtilityBase BY -48
  PROCEDURE NextTagItem(VAR tagItem IN A0 : TagItemPtr):TagItemPtr;

LIBRARY UtilityBase BY -54
  PROCEDURE FilterTagChanges(changeList IN A0,
                             oldValues  IN A1 : TagListPtr;
                             apply      IN D0 : LONGBOOL);

LIBRARY UtilityBase BY -60
  PROCEDURE MapTags(tagList     IN A0 : TagListPtr;
                    mapList     IN A1 : TagListPtr;
                    includeMiss IN D0 : LONGBOOL);

LIBRARY UtilityBase BY -66
  PROCEDURE AllocateTagItems(numItems IN D0 : INTEGER):TagListPtr;

LIBRARY UtilityBase BY -72
  PROCEDURE CloneTagItems(tagList IN A0 : TagListPtr):TagListPtr;

LIBRARY UtilityBase BY -78
  PROCEDURE FreeTagItems(tagList IN A0 : TagListPtr);

LIBRARY UtilityBase BY -84
  PROCEDURE RefreshTagItemClones(cloneList IN A0,
                                 origList  IN A1 : TagListPtr);

LIBRARY UtilityBase BY -90
  PROCEDURE TagInArray(tagVal   IN D0 : LONGCARD;
                       tagArray IN A0 : TagListPtr):LONGBOOL;

LIBRARY UtilityBase BY -96
  PROCEDURE FilterTagItems(tagList     IN A0 : TagListPtr;
                           filterArray IN A1 : TagArrayPtr;
                           logic       IN D0 : LONGINT);

LIBRARY UtilityBase BY -102
  PROCEDURE CallHookPkt(hook   IN A0 : HookPtr;
                        object IN A2 : ANYPTR;
                        params IN A1 : ANYPTR);


LIBRARY UtilityBase BY -120
  PROCEDURE Amiga2Date(    amigaTime IN D0 : LONGCARD;
                       VAR date      IN A0 : ClockData);

LIBRARY UtilityBase BY -126
  PROCEDURE Date2Amiga(VAR date IN A0 : ClockData):LONGCARD;

LIBRARY UtilityBase BY -132
  PROCEDURE CheckDate(VAR date IN A0 : ClockData):LONGCARD;

END Utility.

