home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / exec / addtail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  2.1 KB  |  96 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: addtail.c,v 1.9 1997/01/01 03:46:04 ldp Exp $
  4.     $Log: addtail.c,v $
  5.     Revision 1.9  1997/01/01 03:46:04  ldp
  6.     Committed Amiga native (support) code
  7.  
  8.     Changed clib to proto
  9.  
  10.     Revision 1.8  1996/12/10 13:51:36  aros
  11.     Moved all #include's in the first column so makedepend can see it.
  12.  
  13.     Revision 1.7  1996/10/24 15:50:42  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.6  1996/10/21 20:46:42  aros
  17.     Changed struct SysBase to struct ExecBase
  18.  
  19.     Revision 1.5  1996/08/13 13:55:56  digulla
  20.     Replaced AROS_LA by AROS_LHA
  21.     Replaced some AROS_LH*I by AROS_LH*
  22.     Sorted and added includes
  23.  
  24.     Revision 1.4  1996/08/01 17:41:03  digulla
  25.     Added standard header for all files
  26.  
  27.     Desc:
  28.     Lang: english
  29. */
  30. #include "exec_intern.h"
  31. #include <exec/lists.h>
  32. #include <proto/exec.h>
  33.  
  34. /*****************************************************************************
  35.  
  36.     NAME */
  37.  
  38.     AROS_LH2I(void, AddTail,
  39.  
  40. /*  SYNOPSIS */
  41.     AROS_LHA(struct List *, list, A0),
  42.     AROS_LHA(struct Node *, node, A1),
  43.  
  44. /*  LOCATION */
  45.     struct ExecBase *, SysBase, 41, Exec)
  46.  
  47. /*  FUNCTION
  48.     Insert Node node at the end of a list.
  49.  
  50.     INPUTS
  51.     list - The list to insert the node into
  52.     node - This node is to be inserted
  53.  
  54.     RESULT
  55.  
  56.     NOTES
  57.  
  58.     EXAMPLE
  59.     struct List * list;
  60.     struct Node * pred;
  61.  
  62.     // Insert Node at end of the list
  63.     AddTail (list, node);
  64.  
  65.     BUGS
  66.  
  67.     SEE ALSO
  68.  
  69.     INTERNALS
  70.  
  71.     HISTORY
  72.     26-08-95    digulla created after EXEC-Routine
  73.     26-10-95    digulla adjusted to new calling scheme
  74.  
  75. ******************************************************************************/
  76. {
  77.     AROS_LIBFUNC_INIT
  78.     assert (node);
  79.     assert (list);
  80.  
  81.     /*
  82.     Make the node point to the head of the list. Our predecessor is the
  83.     previous last node of the list.
  84.     */
  85.     node->ln_Succ           = (struct Node *)&list->lh_Tail;
  86.     node->ln_Pred           = list->lh_TailPred;
  87.  
  88.     /*
  89.     Now we are the last now. Make the old last node point to us
  90.     and the pointer to the last node, too.
  91.     */
  92.     list->lh_TailPred->ln_Succ = node;
  93.     list->lh_TailPred           = node;
  94.     AROS_LIBFUNC_EXIT
  95. } /* AddTail */
  96.