Welcome, Guest. Please login or register.

Author Topic: Repetition of Tags in a TagItem array and AmigaOS functions...  (Read 1779 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Code: [Select]
;/*
gcc -noixemul -Wall -O2 tagtest.c -o tagtest
quit
*/

#include <utility/tagitem.h>

#include <proto/utility.h>
#include <proto/dos.h>


#define MYTAG_Base (TAG_USER + 0xbad000)

#define MYTAG_FOO  (MYTAG_Base + 0)
#define MYTAG_BAR  (MYTAG_Base + 1)


void myfunc(struct TagItem *taglist);


int main(void)
{
  struct TagItem tags[] =
  {
    {MYTAG_FOO, 1},
    {MYTAG_FOO, 2},
    {MYTAG_BAR, 666},
    {MYTAG_BAR, 0},
    {TAG_DONE,}
  };

  myfunc(tags);

  return 0;
}

void myfunc(struct TagItem *taglist)
{
  struct TagItem *tstate = taglist;
  struct TagItem *tag;

  while ((tag = NextTagItem(&tstate)))
  {
    switch (tag->ti_Tag)
    {
      case MYTAG_FOO:
        Printf(&quot;MYTAG_FOO %ld\n&quot;, tag->ti_Data);
        break;

      case MYTAG_BAR:
        Printf(&quot;MYTAG_BAR %ld\n&quot;, tag->ti_Data);
        break;
    }
  }
}