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

  1.  /*
  2.     $Id: refreshtagitemclones.c,v 1.3 1996/10/24 15:51:36 aros Exp $
  3.     $Log: refreshtagitemclones.c,v $
  4.     Revision 1.3  1996/10/24 15:51:36  aros
  5.     Use the official AROS macros over the __AROS versions.
  6.  
  7.     Revision 1.2  1996/10/23 14:08:59  aros
  8.     Formatted
  9.  
  10.     Added parens to all assignments which are used truth expressions
  11.  
  12.     Revision 1.1  1996/10/22 04:46:01  aros
  13.     Some more utility.library functions.
  14.  
  15.     Desc: RefreshTagItemClones()
  16.     Lang: english
  17. */
  18. #include "utility_intern.h"
  19.  
  20. /*****************************************************************************
  21.  
  22.     NAME */
  23.     #include <utility/tagitem.h>
  24.     #include <clib/utility_protos.h>
  25.  
  26.     AROS_LH2(void, RefreshTagItemClones,
  27.  
  28. /*  SYNOPSIS */
  29.     AROS_LHA(struct TagItem *, clone, A0),
  30.     AROS_LHA(struct TagItem *, original, A1),
  31.  
  32. /*  LOCATION */
  33.     struct UtilityBase *, UtilityBase, 14, Utility)
  34.  
  35. /*  FUNCTION
  36.     If (and only if) the Tag list 'clone' was created by calling
  37.     CloneTagItems on the Tag list 'original', and the list original
  38.     has NOT been changed in any way, then this function will change
  39.     the list 'clone' back to its original state.
  40.  
  41.     INPUTS
  42.     original    - The source TagList (unaltered)
  43.     clone        - The destination TagList (MUST be allocated by
  44.             CloneTagItems())
  45.  
  46.     RESULT
  47.     The second TagList now has the same values as the first.
  48.  
  49.     NOTES
  50.     If either of the inputs is NULL, then the function will not do
  51.     anything.
  52.  
  53.     EXAMPLE
  54.     struct TagItem *orig, clone;
  55.  
  56.     \* TagList orig has some values already *\
  57.     clone = CloneTagList( orig );
  58.  
  59.     \* In between here we do something to the TagItems in clone,
  60.         but we need to have them restored.
  61.     *\
  62.  
  63.     RefreshTagItemClones( clone, orig );
  64.  
  65.     BUGS
  66.     None, however if either of the two pre-conditions is not fulfilled
  67.     then this function will probably be unreliable, or trash memory.
  68.  
  69.     We warned you...
  70.  
  71.     SEE ALSO
  72.     <utility/tagitem.h> CloneTagItems()
  73.  
  74.     INTERNALS
  75.  
  76.     HISTORY
  77.     29-10-95    digulla automatically created from
  78.                 utility_lib.fd and clib/utility_protos.h
  79.     11-08-96    iaint   Based on the 3.0/2.04 version.
  80.     05-09-96    iaint   Updated autodoc, and removed another variable.
  81.  
  82. *****************************************************************************/
  83. {
  84.     AROS_LIBFUNC_INIT
  85.  
  86.     struct TagItem *current;
  87.  
  88.     if( !original || !clone )
  89.     return;
  90.  
  91.     /* Remember, the clone list is a straight memory block, however
  92.     the original list may not be.
  93.     */
  94.     while ((current = NextTagItem (&original)))
  95.     {
  96.     *clone = *current; /* Copies both tag and data */
  97.     clone++;
  98.     }
  99.  
  100.     AROS_LIBFUNC_EXIT
  101. } /* RefreshTagItemClones */
  102.