home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / TCL / BLT / BLT1.7L1 / BLT1 / blt-1.7 / src / bltList.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-01  |  3.2 KB  |  74 lines

  1. /*
  2.  * bltList.h --
  3.  *
  4.  * Copyright 1993-1994 by AT&T Bell Laboratories.
  5.  * Permission to use, copy, modify, and distribute this software
  6.  * and its documentation for any purpose and without fee is hereby
  7.  * granted, provided that the above copyright notice appear in all
  8.  * copies and that both that the copyright notice and warranty
  9.  * disclaimer appear in supporting documentation, and that the
  10.  * names of AT&T Bell Laboratories any of their entities not be used
  11.  * in advertising or publicity pertaining to distribution of the
  12.  * software without specific, written prior permission.
  13.  *
  14.  * AT&T disclaims all warranties with regard to this software, including
  15.  * all implied warranties of merchantability and fitness.  In no event
  16.  * shall AT&T be liable for any special, indirect or consequential
  17.  * damages or any damages whatsoever resulting from loss of use, data
  18.  * or profits, whether in an action of contract, negligence or other
  19.  * tortuous action, arising out of or in connection with the use or
  20.  * performance of this software.
  21.  *
  22.  */
  23. #ifndef _BLT_LIST_H
  24. #define _BLT_LIST_H
  25.  
  26. /*
  27.  * A Blt_ListEntry is the container structure for the Blt_LinkedList.
  28.  */
  29. typedef struct Blt_ListEntry {
  30.     struct Blt_ListEntry *prevPtr;    /* Link to the previous entry */
  31.     struct Blt_ListEntry *nextPtr;    /* Link to the next entry */
  32.     Tk_Uid keyPtr;        /* Pointer to the (character string) key */
  33.     ClientData clientData;    /* Pointer to the data object */
  34. } Blt_ListEntry;
  35.  
  36. /*
  37.  * A Blt_LinkedList is a doubly chained list structure.
  38.  */
  39. typedef struct Blt_LinkedList {
  40.     Blt_ListEntry *headPtr;    /* Pointer to first element in list */
  41.     Blt_ListEntry *tailPtr;    /* Pointer to last element in list */
  42.     int numEntries;        /* Number of elements in list */
  43.     int type;            /* Type of keys in list */
  44. } Blt_LinkedList;
  45.  
  46. EXTERN void Blt_InitLinkedList _ANSI_ARGS_((Blt_LinkedList *listPtr, int type));
  47. EXTERN Blt_LinkedList *Blt_CreateLinkedList _ANSI_ARGS_((int type));
  48. EXTERN void Blt_DeleteLinkedList _ANSI_ARGS_((Blt_LinkedList *listPtr));
  49. EXTERN Blt_ListEntry *Blt_CreateListEntry _ANSI_ARGS_((char *key));
  50. EXTERN void Blt_DestroyListEntry _ANSI_ARGS_((Blt_ListEntry *entryPtr));
  51. EXTERN void Blt_ClearList _ANSI_ARGS_((Blt_LinkedList *listPtr));
  52. EXTERN void Blt_LinkListAfter _ANSI_ARGS_((Blt_LinkedList *listPtr,
  53.     Blt_ListEntry *entryPtr, Blt_ListEntry *afterPtr));
  54. EXTERN void Blt_LinkListBefore _ANSI_ARGS_((Blt_LinkedList *listPtr,
  55.     Blt_ListEntry *entryPtr, Blt_ListEntry *beforePtr));
  56. EXTERN void Blt_UnlinkListEntry _ANSI_ARGS_((Blt_LinkedList *listPtr,
  57.     Blt_ListEntry *entryPtr));
  58. EXTERN Blt_ListEntry *Blt_FindListEntry _ANSI_ARGS_((Blt_LinkedList *listPtr,
  59.     char *name));
  60. EXTERN void Blt_DeleteListEntry _ANSI_ARGS_((Blt_LinkedList *listPtr,
  61.     Blt_ListEntry *entryPtr));
  62.  
  63. #define Blt_FirstListEntry(listPtr) ((listPtr)->headPtr)
  64. #define Blt_LastListEntry(listPtr)  ((listPtr)->tailPtr)
  65. #define Blt_PrevListEntry(entryPtr) ((entryPtr)->prevPtr)
  66. #define Blt_NextListEntry(entryPtr) ((entryPtr)->nextPtr)
  67. #define Blt_GetListKey(entryPtr)    ((entryPtr)->keyPtr)
  68. #define Blt_GetListLength(listPtr)  ((listPtr)->numEntries)
  69. #define Blt_GetListValue(entryPtr)  ((entryPtr)->clientData)
  70. #define Blt_SetListValue(entryPtr, valuePtr) \
  71.     ((entryPtr)->clientData = (ClientData)(valuePtr))
  72.  
  73. #endif /* _BLT_LIST_H */
  74.