]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/snacc.h
Security-28.tar.gz
[apple/security.git] / SecuritySNACCRuntime / snacc.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
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
8 * using this file.
9 *
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.
16 */
17
18
19 /*
20 * file: snacc.h
21 *
22 * INSERT_VDA_COMMENTS
23 *
24 * $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/snacc.h,v 1.1.1.1 2001/05/18 23:14:04 mb Exp $
25 * $Log: snacc.h,v $
26 * Revision 1.1.1.1 2001/05/18 23:14:04 mb
27 * Move from private repository to open source repository
28 *
29 * Revision 1.2 2001/05/05 00:59:16 rmurphy
30 * Adding darwin license headers
31 *
32 * Revision 1.1.1.1 1999/03/16 18:05:50 aram
33 * Originals from SMIME Free Library.
34 *
35 * Revision 1.7 1997/04/07 13:13:18 wan
36 * Made more C++ readable (credits to Steve Walker)
37 *
38 * Revision 1.6 1997/02/28 13:39:35 wan
39 * Modifications collected for new version 1.3: Bug fixes, tk4.2.
40 *
41 * Revision 1.5 1997/02/15 20:38:48 rj
42 * In member functions, return *this after calling abort() for stupid compilers that don't seem to know about volatile abort() (they would otherwise abort with an error).
43 *
44 * Revision 1.4 1995/07/24 15:06:52 rj
45 * configure checks for mem* functions. define replacements using b* functions, if necessary.
46 *
47 */
48
49 #ifndef _SNACC_H_
50 #define _SNACC_H_
51
52 #define GLASS 1
53 #define KHO 1
54
55 #include "config.h"
56
57 #if STDC_HEADERS
58 #include <stdlib.h>
59 #endif
60
61 #ifndef NULL
62 #define NULL 0
63 #endif
64
65 #if HAVE_MEMCMP /* memcmp(3) returns <0, 0 and 0, bcmp(3) returns only 0 and !0 */
66 #define memcmpeq( a, b, len) memcmp (a, b, len)
67 #else
68 #define memcmpeq( a, b, len) bcmp (a, b, len)
69 #endif
70 #if HAVE_MEMSET
71 #define memzero( p, len) memset (p, 0, len)
72 #else
73 #define memzero( p, len) bzero (p, len)
74 #endif
75 #if !HAVE_MEMCPY
76 #define memcpy( dst, src, len) bcopy (src, dst, len)
77 #endif
78
79 #ifdef __cplusplus
80
81 #ifdef VOLATILE_RETRUN
82 # define RETURN_THIS_FOR_COMPILERS_WITHOUT_VOLATILE_FUNCTIONS return *this;
83 #else
84 # define RETURN_THIS_FOR_COMPILERS_WITHOUT_VOLATILE_FUNCTIONS
85 #endif
86
87 #if !BOOL_BUILTIN
88 #ifndef true
89 // enum bool { false, true };
90 // the above looks elegant, but leads to anachronisms (<, ==, !=, ... return value of type int, not enum bool), therefore:
91 typedef int bool;
92 enum { false, true };
93 #endif
94 #endif
95
96 #else /* !__cplusplus */
97
98 #ifndef FALSE
99 #define FALSE 0
100 #endif
101 #ifndef TRUE
102 #define TRUE 1
103 #endif
104
105 #endif /* __cplusplus */
106
107 /*
108 * Inspired by gdb 4.0, for better or worse...
109 * (grabbed from Barry Brachman - MS)
110 *
111 * These macros munge C routine declarations such
112 * that they work for ANSI or non-ANSI C compilers
113 */
114 #ifdef __USE_ANSI_C__
115
116 #define PROTO( X) X
117 #define PARAMS( arglist, args) (args)
118 #define NOPARAMS() (void)
119 #define _AND_ ,
120 #define DOTS , ...
121
122 #else /* !__USE_ANSI_C__ */
123
124 #define PROTO( X) ()
125 #define PARAMS( arglist, args) arglist args;
126 #define NOPARAMS() ()
127 #define _AND_ ;
128 #define DOTS
129 #define void char
130
131 #endif /* __USE_ANSI_C__ */
132
133 #include "policy.h"
134
135 #if COMPILER
136 #define TCL (HAVE_TCL && !NO_TCL)
137 #define META (TCL && !NO_META)
138 #endif
139
140 #if MAKEDEPEND
141 #if !NO_META
142 #ifdef META
143 #undef META
144 #endif
145 #define META 1
146 #endif
147 #if !NO_TCL
148 #ifdef TCL
149 #undef TCL
150 #endif
151 #define TCL 1
152 #endif
153 #endif
154
155 #if TCL
156 #ifdef META
157 #undef META
158 #endif
159 #define META 1
160 #endif
161
162 #define COMMA ,
163
164 #ifdef _IBM_ENC_
165 #define if_IBM_ENC( code) code
166 #else
167 #define if_IBM_ENC( code)
168 #endif
169
170 #if META
171 #define if_META( code) code
172 #else
173 #define if_META( code)
174 #endif
175
176 #if TCL && META
177 #define if_TCL( code) code
178 #else
179 #define if_TCL( code)
180 #endif
181
182 #ifndef _gVDADER_RULES
183 extern int gVDADER_RULES;
184 #endif
185
186 #endif /* _SNACC_H_ */