1 /*
2 **  OSSP uuid - Universally Unique Identifier
3 **  Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
4 **  Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/>
5 **
6 **  This file is part of OSSP uuid, a library for the generation
7 **  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
8 **
9 **  Permission to use, copy, modify, and distribute this software for
10 **  any purpose with or without fee is hereby granted, provided that
11 **  the above copyright notice and this permission notice appear in all
12 **  copies.
13 **
14 **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
15 **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
18 **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
24 **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 **  SUCH DAMAGE.
26 **
27 **  uuid_ac.c: auto-configuration
28 */
29 
30 #ifndef __UUID_AC_H__
31 #define __UUID_AC_H__
32 
33 /* include GNU autoconf results */
34 #include "config.h"           /* HAVE_xxx */
35 
36 /* include standard system headers */
37 #include <stdio.h>            /* NULL, etc. */
38 #include <stdlib.h>           /* malloc, NULL, etc. */
39 #include <stdarg.h>           /* va_list, etc. */
40 #include <string.h>           /* size_t, strlen, etc. */
41 #include <unistd.h>           /* dmalloc pre-loading */
42 
43 /* enable optional "dmalloc" support */
44 #ifdef WITH_DMALLOC
45 #include <dmalloc.h>          /* malloc override, etc */
46 #endif
47 
48 /* define boolean values */
49 #define UUID_FALSE 0
50 #define UUID_TRUE  (/*lint -save -e506*/ !UUID_FALSE /*lint -restore*/)
51 
52 /* determine types of 8-bit size */
53 #if SIZEOF_CHAR == 1
54 typedef char uuid_int8_t;
55 #else
56 #error unexpected: sizeof(char) != 1 !?
57 #endif
58 #if SIZEOF_UNSIGNED_CHAR == 1
59 typedef unsigned char uuid_uint8_t;
60 #else
61 #error unexpected: sizeof(unsigned char) != 1 !?
62 #endif
63 
64 /* determine types of 16-bit size */
65 #if SIZEOF_SHORT == 2
66 typedef short uuid_int16_t;
67 #elif SIZEOF_INT == 2
68 typedef int uuid_int16_t;
69 #elif SIZEOF_LONG == 2
70 typedef long uuid_int16_t;
71 #else
72 #error unexpected: no type found for uuid_int16_t
73 #endif
74 #if SIZEOF_UNSIGNED_SHORT == 2
75 typedef unsigned short uuid_uint16_t;
76 #elif SIZEOF_UNSIGNED_INT == 2
77 typedef unsigned int uuid_uint16_t;
78 #elif SIZEOF_UNSIGNED_LONG == 2
79 typedef unsigned long uuid_uint16_t;
80 #else
81 #error unexpected: no type found for uuid_uint16_t
82 #endif
83 
84 /* determine types of 32-bit size */
85 #if SIZEOF_SHORT == 4
86 typedef short uuid_int32_t;
87 #elif SIZEOF_INT == 4
88 typedef int uuid_int32_t;
89 #elif SIZEOF_LONG == 4
90 typedef long uuid_int32_t;
91 #elif SIZEOF_LONG_LONG == 4
92 typedef long long uuid_int32_t;
93 #else
94 #error unexpected: no type found for uuid_int32_t
95 #endif
96 #if SIZEOF_UNSIGNED_SHORT == 4
97 typedef unsigned short uuid_uint32_t;
98 #elif SIZEOF_UNSIGNED_INT == 4
99 typedef unsigned int uuid_uint32_t;
100 #elif SIZEOF_UNSIGNED_LONG == 4
101 typedef unsigned long uuid_uint32_t;
102 #elif SIZEOF_UNSIGNED_LONG_LONG == 4
103 typedef unsigned long long uuid_uint32_t;
104 #else
105 #error unexpected: no type found for uuid_uint32_t
106 #endif
107 
108 #endif /* __UUID_AC_H__ */
109 
110