(**************************************************************************)
(*                                                                        *)
(* Definition Module (C) Copyright 1994 Marcel Timmermans.                *)
(* Date     : 06 Feb 1994                                                 *)
(* Language : Modula-2                                                    *)
(*                                                                        *)
(**************************************************************************)

DEFINITION MODULE UtilityL {"utility.library",36};

FROM SYSTEM IMPORT ADDRESS, LONGSET;

IMPORT ExecD,Reg,UtilityD;

VAR
 utilityBase:ExecD.LibraryPtr;

(* *** TagItem FUNCTIONS *** *)

PROCEDURE FindTagItem(
           tagVal{Reg.D0}:UtilityD.Tag;
           tagList{Reg.A0}:UtilityD.TagItemPtr):UtilityD.TagItemPtr; CODE -30;

PROCEDURE GetTagData(
           tagVal{Reg.D0}:UtilityD.Tag;
           defaultVal{Reg.D1}:LONGCARD;
           tagList{Reg.A0}:UtilityD.TagItemPtr):LONGCARD; CODE -36;

PROCEDURE PackBoolTags(
           initialFlags{Reg.D0}:LONGSET;
           tagList{Reg.A0}:UtilityD.TagItemPtr;
           boolMap{Reg.A1}:UtilityD.TagItemPtr):LONGSET; CODE -42;

PROCEDURE NextTagItem(
           VAR tagListPtr{Reg.A0}:UtilityD.TagItemPtr):UtilityD.TagItemPtr; CODE -48;

PROCEDURE FilterTagChanges(
           newTagList{Reg.A0},oldTagList{Reg.A1}:UtilityD.TagItemPtr;
           apply{Reg.D0}:BOOLEAN); CODE -54;

PROCEDURE MapTags(
           tagList{Reg.A0},mapList{Reg.A1}:UtilityD.TagItemPtr;
           includeMiss{Reg.D0}:LONGCARD); CODE -60;

PROCEDURE AllocateTagItems(
           numItems{Reg.D0}:LONGCARD):UtilityD.TagItemPtr; CODE -66;

PROCEDURE CloneTagItems(
           tagList{Reg.A0}:UtilityD.TagItemPtr):UtilityD.TagItemPtr; CODE -72;

PROCEDURE FreeTagItems(tagList{Reg.A0}:UtilityD.TagItemPtr); CODE -78;

PROCEDURE RefreshTagItemClones(
           cloneList{Reg.A0},origList{Reg.A1}:UtilityD.TagItemPtr); CODE -84;

PROCEDURE TagInArray(
           tagVal{Reg.D0}:UtilityD.Tag;
           tagArray{Reg.A0}:UtilityD.TagPtr):BOOLEAN; CODE -90;

PROCEDURE FilterTagItems(
           tagList{Reg.A0}:UtilityD.TagItemPtr;
           filterArray{Reg.A1}:UtilityD.TagPtr;
           logic{Reg.D0}:LONGINT):LONGCARD; CODE -96;

(* *** HOOK FUNCTIONS *** * *)
PROCEDURE CallHookPkt(
           hook{Reg.A0}:UtilityD.HookPtr;
           object{Reg.A2},paramPacket{Reg.A1}:ADDRESS):LONGCARD; CODE -102;

(* *** DATE FUNCTIONS *** * *)
PROCEDURE Amiga2Date(
           amigaTime{Reg.D0}:LONGCARD;
           VAR date{Reg.A0}:UtilityD.ClockData); CODE -120;

PROCEDURE Date2Amiga(VAR date{Reg.A0}:UtilityD.ClockData):LONGCARD; CODE -126;

PROCEDURE CheckDate(VAR date{Reg.A0}:UtilityD.ClockData):LONGCARD; CODE -132;

(* *** 32 BIT MATH FUNCTIONS *** * *)
PROCEDURE SMult32(
           factor1{Reg.D0},factor2{Reg.D1}:LONGINT):LONGINT; CODE -138;

PROCEDURE UMult32(
           factor1{Reg.D0},factor2{Reg.D1}:LONGCARD):LONGCARD; CODE -144;

(* NOTE: Quotient:Remainder returned in d0:d1 *)

PROCEDURE SDivMod32(
           dividend{Reg.D0},divisor{Reg.D1}:LONGINT):LONGINT; CODE -150;

PROCEDURE UDivMod32(
           dividend{Reg.D0},divisor{Reg.D1}:LONGCARD):LONGCARD; CODE -156;

(* *** International string routines *** *)
PROCEDURE Stricmp(string1{Reg.A0}:ADDRESS;
                  string2{Reg.A1}:ADDRESS):LONGINT; CODE -162;

PROCEDURE Strnicmp(string1{Reg.A0}:ADDRESS;
                   string2{Reg.A1}:ADDRESS;
                   length{Reg.D0}:LONGINT):LONGINT; CODE -168;

PROCEDURE ToUpper(character{Reg.D0}:CHAR):CHAR; CODE -174;

PROCEDURE ToLower(character{Reg.D0}:CHAR):CHAR; CODE -180;

END UtilityL.
