IMPLEMENTATION MODULE TagItem;

FROM SYSTEM IMPORT ADR;

(*
**   $Filename: utility/tagitem.i $
**   $Release: 1.0 $
**
**   Clone of 2.0 include file 'utility/tagitem.h'
*)

(*********************************************************************)
(* Various routines used for creating Workbench 2.0 tag lists        *)

(* Static declaration for the tag lists *)
VAR
  TagVar : ARRAY [0..16] OF TagItem;


PROCEDURE TagIs1(Tag1 : Tag; Data1 : LONGCARD) : TagItemPtr;
(* Pass a single tag and associated data to a routine. The tag is
   automatically terminated with TAGEND. *)
BEGIN
  TagVar[0].tiTag := Tag1;  TagVar[0].tiData := Data1;
  TagVar[1].tiTag := TAGEND;
  RETURN ADR(TagVar);
END TagIs1;


PROCEDURE TagIs4(Tag1 : Tag; Data1 : LONGCARD;
                 Tag2 : Tag; Data2 : LONGCARD;
                 Tag3 : Tag; Data3 : LONGCARD;
                 Tag4 : Tag; Data4 : LONGCARD) : TagItemPtr;
(* Pass up to 4 tags and associated data to a routine. If you have less
   than 4 tags, place a TAGEND on all unused tags and pass anything you
   want for the data. If all tags are used, a TAGEND is added as a fifth
   tag. *)
BEGIN
  TagVar[0].tiTag := Tag1;  TagVar[0].tiData := Data1;
  TagVar[1].tiTag := Tag2;  TagVar[1].tiData := Data2;
  TagVar[2].tiTag := Tag3;  TagVar[2].tiData := Data3;
  TagVar[3].tiTag := Tag4;  TagVar[3].tiData := Data4;
  TagVar[4].tiTag := TAGEND;
  RETURN ADR(TagVar);
END TagIs4;


PROCEDURE TagIs8(Tag1 : Tag; Data1 : LONGCARD;
                 Tag2 : Tag; Data2 : LONGCARD;
                 Tag3 : Tag; Data3 : LONGCARD;
                 Tag4 : Tag; Data4 : LONGCARD;
                 Tag5 : Tag; Data5 : LONGCARD;
                 Tag6 : Tag; Data6 : LONGCARD;
                 Tag7 : Tag; Data7 : LONGCARD;
                 Tag8 : Tag; Data8 : LONGCARD) : TagItemPtr;
(* Pass up to 8 tags and associated data to a routine. If you have less
   than 8 tags, place a TAGEND on all unused tags and pass anything you
   want for the data. If all tags are used, a TAGEND is added as a ninth
   tag. *)
VAR
  ptr : TagItemPtr;
BEGIN
  ptr := TagIs4(Tag1, Data1, Tag2, Data2, Tag3, Data3, Tag4, Data4);
  TagVar[4].tiTag := Tag5;  TagVar[4].tiData := Data5;
  TagVar[5].tiTag := Tag6;  TagVar[5].tiData := Data6;
  TagVar[6].tiTag := Tag7;  TagVar[6].tiData := Data7;
  TagVar[7].tiTag := Tag8;  TagVar[7].tiData := Data8;
  TagVar[8].tiTag := TAGEND;
  RETURN ptr;
END TagIs8;


PROCEDURE TagIs16(Tag1 : Tag; Data1 : LONGCARD;
                  Tag2 : Tag; Data2 : LONGCARD;
                  Tag3 : Tag; Data3 : LONGCARD;
                  Tag4 : Tag; Data4 : LONGCARD;
                  Tag5 : Tag; Data5 : LONGCARD;
                  Tag6 : Tag; Data6 : LONGCARD;
                  Tag7 : Tag; Data7 : LONGCARD;
                  Tag8 : Tag; Data8 : LONGCARD;
                  Tag9 : Tag; Data9 : LONGCARD;
                  Tag10: Tag; Data10: LONGCARD;
                  Tag11: Tag; Data11: LONGCARD;
                  Tag12: Tag; Data12: LONGCARD;
                  Tag13: Tag; Data13: LONGCARD;
                  Tag14: Tag; Data14: LONGCARD;
                  Tag15: Tag; Data15: LONGCARD;
                  Tag16: Tag; Data16: LONGCARD) : TagItemPtr;
(* Pass up to 16 tags and associated data to a routine. If you have less
   than 16 tags, place a TAGEND on all unused tags and pass anything you
   want for the data. If all tags are used, a TAGEND is added as a seventeenth
   tag. *)
VAR
  ptr : TagItemPtr;
BEGIN
  ptr := TagIs8(Tag1, Data1, Tag2, Data2, Tag3, Data3, Tag4, Data4,
                Tag5, Data5, Tag6, Data6, Tag7, Data7, Tag8, Data8);
  TagVar[8].tiTag  := Tag9;  TagVar[8].tiData  := Data9;
  TagVar[9].tiTag  := Tag10; TagVar[9].tiData  := Data10;
  TagVar[10].tiTag := Tag11; TagVar[10].tiData := Data11;
  TagVar[11].tiTag := Tag12; TagVar[11].tiData := Data12;
  TagVar[12].tiTag := Tag13; TagVar[12].tiData := Data13;
  TagVar[13].tiTag := Tag14; TagVar[13].tiData := Data14;
  TagVar[14].tiTag := Tag15; TagVar[14].tiData := Data15;
  TagVar[15].tiTag := Tag16; TagVar[15].tiData := Data16;
  TagVar[16].tiTag := TAGEND;
  RETURN ptr;
END TagIs16;



END TagItem.
