home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / utility / allocatetagitems.c < prev    next >
Encoding:
C/C++ Source or Header  |  1978-03-06  |  2.2 KB  |  92 lines

  1. /*
  2.     $Id: allocatetagitems.c,v 1.5 1996/10/24 22:51:46 aros Exp $
  3.     $Log: allocatetagitems.c,v $
  4.     Revision 1.5  1996/10/24 22:51:46  aros
  5.     Use proper Amiga datatypes (eg: ULONG not unsigned long)
  6.  
  7.     Revision 1.4  1996/10/24 15:51:34  aros
  8.     Use the official AROS macros over the __AROS versions.
  9.  
  10.     Revision 1.3  1996/09/13 17:36:37  digulla
  11.     Use IPTR
  12.  
  13.     Revision 1.2  1996/09/12 14:52:47  digulla
  14.     Better way to separate public and private parts of the library base
  15.  
  16.     Revision 1.1  1996/08/31 12:58:11  aros
  17.     Merged in/modified for FreeBSD.
  18.  
  19.     Desc: AllocateTagItems()
  20.     Lang: english
  21. */
  22. #include "utility_intern.h"
  23.  
  24. /*****************************************************************************
  25.  
  26.     NAME */
  27.     #include <utility/tagitem.h>
  28.     #include <clib/utility_protos.h>
  29.  
  30.     AROS_LH1(struct TagItem *, AllocateTagItems,
  31.  
  32. /*  SYNOPSIS */
  33.     AROS_LHA(ULONG, numTags, D0),
  34.  
  35. /*  LOCATION */
  36.     struct UtilityBase *, UtilityBase, 11, Utility)
  37.  
  38. /*  FUNCTION
  39.     Allocate a number of TagItems in an array for whatever you like.
  40.     The memory allocated will be cleared.
  41.  
  42.     INPUTS
  43.     numTags     - The number of TagItems to allocate.
  44.  
  45.     RESULT
  46.     A pointer to an array of struct TagItem containing numTags tags.
  47.  
  48.     NOTES
  49.     The number you supply must include the terminating tag (ie TAG_DONE)
  50.     There is no provision for extra TagItems at the end of the list.
  51.  
  52.     If the number of tags to allocate is zero, then none will be.
  53.  
  54.     EXAMPLE
  55.     struct TagItem *tagList;
  56.  
  57.     tagList =  AllocateTagItems( 4 );
  58.  
  59.     tagList[0].ti_Tag  = NA_Name;
  60.     tagList[0].ti_Data = (IPTR)"A list of tags";
  61.     tagList[3].ti_Tag  = TAG_DONE;
  62.  
  63.     \* Do what you want with your TagList here ... *\
  64.  
  65.     FreeTagItems( tagList );
  66.  
  67.     BUGS
  68.  
  69.     SEE ALSO
  70.     FreeTagsItems()
  71.  
  72.     INTERNALS
  73.  
  74.     HISTORY
  75.     29-10-95    digulla automatically created from
  76.                 utility_lib.fd and clib/utility_protos.h
  77.     11-08-96    iaint   Moved code into the AROS source.
  78.  
  79. *****************************************************************************/
  80. {
  81.     AROS_LIBFUNC_INIT
  82.     struct TagItem *tags = NULL;
  83.  
  84.     if( numTags )
  85.     tags = AllocVec( numTags << 3, MEMF_CLEAR | MEMF_PUBLIC );
  86.  
  87.     return tags;
  88.  
  89.     AROS_LIBFUNC_EXIT
  90.  
  91. } /* AllocateTagItems */
  92.