]>
git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c-lib/inc/asn-list.h
e97db18b834c90218506c7161738658b69bbf335
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
24 * | last |-------------------------------------------|
25 * | curr |--------------------------| |
26 * | first|--------| | |
29 * --------- --------- ---------
30 * |AsnListNode |AsnListNode |AsnListNode
31 * | next |---...->| next |--...-->| next |-----|i.
32 * .i|----| prev |<--...--| prev |<--...--| prev |
33 * | data | | data | | data |
34 * --------- --------- ---------
36 * Originally by Murray Goldberg
37 * Modified for ASN.1 use.
39 * Copyright (C) 1992 the University of British Columbia
41 * This library is free software; you can redistribute it and/or
42 * modify it provided that this copyright/license information is retained
45 * If you modify this file, you must clearly indicate your changes.
47 * This source code is distributed in the hope that it will be
48 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
49 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
51 * $Header: /cvs/root/Security/SecuritySNACCRuntime/c-lib/inc/Attic/asn-list.h,v 1.1.1.1 2001/05/18 23:14:08 mb Exp $
52 * $Log: asn-list.h,v $
53 * Revision 1.1.1.1 2001/05/18 23:14:08 mb
54 * Move from private repository to open source repository
56 * Revision 1.2 2001/05/05 00:59:22 rmurphy
57 * Adding darwin license headers
59 * Revision 1.1.1.1 1999/03/16 18:06:20 aram
60 * Originals from SMIME Free Library.
62 * Revision 1.3 1995/07/24 21:01:14 rj
63 * changed `_' to `-' in file names.
65 * Revision 1.2 1994/10/08 01:40:22 rj
66 * it is unwise to #define unbalanced if()s! (fixed.)
67 * three declarations added.
69 * Revision 1.1 1994/08/28 09:21:30 rj
70 * first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
77 typedef struct AsnListNode
79 struct AsnListNode
*prev
;
80 struct AsnListNode
*next
;
81 void *data
; /* this must be the last field of this structure */
84 typedef struct AsnList
89 int count
; /* number of elements in list */
90 int dataSize
; /* space required in each node for the data */
93 #define FOR_EACH_LIST_ELMT( elmt, al)\
97 for ((al)->curr = (al)->first; (al)->curr && ((elmt) = (void *)(al)->curr->data); (al)->curr = (al)->curr->next)
99 #define FOR_EACH_LIST_ELMT_RVS( elmt, al)\
103 for ((al)->curr = (al)->last; (al)->curr && ((elmt) = (void *)(al)->curr->data); (al)->curr = (al)->curr->prev)
106 #define FOR_REST_LIST_ELMT( elmt, al)\
110 for (; (al)->curr && ((elmt) = (void *)(al)->curr->data); (al)->curr = (al)->curr->next)
112 #define FOR_REST_LIST_ELMT_RVS( elmt, al)\
116 for (; ((al)->curr && ((elmt) = (void *)(al)->curr->data); (al)->curr = (al)->curr->prev)
119 * The following macros return the pointer stored in the
120 * data part of the listNode. The do not change the current
123 #define CURR_LIST_ELMT( al) ((al)->curr->data)
124 #define NEXT_LIST_ELMT( al) ((al)->curr->next->data)
125 #define PREV_LIST_ELMT( al) ((al)->curr->prev->data)
126 #define LAST_LIST_ELMT( al) ((al)->last->data)
127 #define FIRST_LIST_ELMT( al) ((al)->first->data)
128 #define LIST_EMPTY( al) ((al)->count == 0)
129 #define LIST_COUNT( al) ((al)->count)
132 * list nodes are the parts of the list that contain ptrs/data
133 * to/of the list elmts.
135 #define CURR_LIST_NODE( al) ((al)->curr)
136 #define FIRST_LIST_NODE( al) ((al)->first)
137 #define LAST_LIST_NODE( al) ((al)->last)
138 #define PREV_LIST_NODE( al) ((al)->curr->prev)
139 #define NEXT_LIST_NODE( al) ((al)->curr->next)
140 #define SET_CURR_LIST_NODE( al, listNode) ((al)->curr = (listNode))
142 void AsnListRemove
PROTO ((AsnList
*));
143 void *AsnListAdd
PROTO ((AsnList
*));
144 void *AsnListInsert
PROTO ((AsnList
*));
145 void AsnListInit
PROTO ((AsnList
*list
, int dataSize
));
146 AsnList
*AsnListNew
PROTO ((int));
147 void *AsnListPrev
PROTO ((AsnList
*));
148 void *AsnListNext
PROTO ((AsnList
*));
149 void *AsnListLast
PROTO ((AsnList
*));
150 void *AsnListFirst
PROTO ((AsnList
*));
151 void *AsnListPrepend
PROTO ((AsnList
*));
152 void *AsnListAppend
PROTO ((AsnList
*));
153 void *AsnListCurr
PROTO ((AsnList
*));
154 int AsnListCount
PROTO ((AsnList
*));
155 AsnList
*AsnListConcat
PROTO ((AsnList
*, AsnList
*));
156 long int GetAsnListElmtIndex
PROTO ((void *elmt
,AsnList
*list
));
157 void AsnListFree
PROTO (( AsnList
*));
158 void *GetAsnListElmt
PROTO ((AsnList
*list
, unsigned int index
));
160 #endif /* conditional include */