1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * Copyright by the Board of Trustees of the University of Illinois.         *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  * This file is part of HDF.  The full HDF copyright notice, including       *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the COPYING file, which can be found at the root of the source code       *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/.  *
10  * If you do not have access to either file, you may request a copy from     *
11  * help@hdfgroup.org.                                                        *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /* $Id$ */
15 
16 /*+ hnt.h
17    *** This file contains all the number-type definitions for HDF
18    + */
19 
20 #ifndef _HNT_H
21 #define _HNT_H
22 
23 /* masks for types */
24 #define DFNT_HDF      0x00000000    /* standard HDF format  */
25 #define DFNT_NATIVE   0x00001000    /* native format        */
26 #define DFNT_CUSTOM   0x00002000    /* custom format        */
27 #define DFNT_LITEND   0x00004000    /* Little Endian format */
28 #define DFNT_MASK     0x00000fff    /* format mask */
29 
30 /* type info codes */
31 
32 #define DFNT_NONE        0  /* indicates that number type not set */
33 #define DFNT_QUERY       0  /* use this code to find the current type */
34 #define DFNT_VERSION     1  /* current version of NT info */
35 
36 #define DFNT_FLOAT32     5
37 #define DFNT_FLOAT       5  /* For backward compat; don't use */
38 #define DFNT_FLOAT64     6
39 #define DFNT_DOUBLE      6  /* For backward compat; don't use */
40 #define DFNT_FLOAT128    7  /* No current plans for support */
41 
42 #define DFNT_INT8       20
43 #define DFNT_UINT8      21
44 
45 #define DFNT_INT16      22
46 #define DFNT_UINT16     23
47 #define DFNT_INT32      24
48 #define DFNT_UINT32     25
49 #define DFNT_INT64      26
50 #define DFNT_UINT64     27
51 #define DFNT_INT128     28  /* No current plans for support */
52 #define DFNT_UINT128    30  /* No current plans for support */
53 
54 #define DFNT_UCHAR8      3  /* 3 chosen for backward compatibility */
55 #define DFNT_UCHAR       3  /* uchar=uchar8 for backward combatibility */
56 #define DFNT_CHAR8       4  /* 4 chosen for backward compatibility */
57 #define DFNT_CHAR        4  /* char=char8 for backward combatibility */
58 #define DFNT_CHAR16     42  /* No current plans for support */
59 #define DFNT_UCHAR16    43  /* No current plans for support */
60 
61 /* Type info codes for Native Mode datasets */
62 #define DFNT_NFLOAT32   (DFNT_NATIVE | DFNT_FLOAT32)
63 #define DFNT_NFLOAT64   (DFNT_NATIVE | DFNT_FLOAT64)
64 #define DFNT_NFLOAT128  (DFNT_NATIVE | DFNT_FLOAT128)   /* Unsupported */
65 
66 #define DFNT_NINT8      (DFNT_NATIVE | DFNT_INT8)
67 #define DFNT_NUINT8     (DFNT_NATIVE | DFNT_UINT8)
68 #define DFNT_NINT16     (DFNT_NATIVE | DFNT_INT16)
69 #define DFNT_NUINT16    (DFNT_NATIVE | DFNT_UINT16)
70 #define DFNT_NINT32     (DFNT_NATIVE | DFNT_INT32)
71 #define DFNT_NUINT32    (DFNT_NATIVE | DFNT_UINT32)
72 #define DFNT_NINT64     (DFNT_NATIVE | DFNT_INT64)
73 #define DFNT_NUINT64    (DFNT_NATIVE | DFNT_UINT64)
74 #define DFNT_NINT128    (DFNT_NATIVE | DFNT_INT128)     /* Unsupported */
75 #define DFNT_NUINT128   (DFNT_NATIVE | DFNT_UINT128)    /* Unsupported */
76 
77 #define DFNT_NCHAR8     (DFNT_NATIVE | DFNT_CHAR8)
78 #define DFNT_NCHAR      (DFNT_NATIVE | DFNT_CHAR8)  /* backward compat */
79 #define DFNT_NUCHAR8    (DFNT_NATIVE | DFNT_UCHAR8)
80 #define DFNT_NUCHAR     (DFNT_NATIVE | DFNT_UCHAR8)     /* backward compat */
81 #define DFNT_NCHAR16    (DFNT_NATIVE | DFNT_CHAR16)     /* Unsupported */
82 #define DFNT_NUCHAR16   (DFNT_NATIVE | DFNT_UCHAR16)    /* Unsupported */
83 
84 /* Type info codes for Little Endian data */
85 #define DFNT_LFLOAT32   (DFNT_LITEND | DFNT_FLOAT32)
86 #define DFNT_LFLOAT64   (DFNT_LITEND | DFNT_FLOAT64)
87 #define DFNT_LFLOAT128  (DFNT_LITEND | DFNT_FLOAT128)   /* Unsupported */
88 
89 #define DFNT_LINT8      (DFNT_LITEND | DFNT_INT8)
90 #define DFNT_LUINT8     (DFNT_LITEND | DFNT_UINT8)
91 #define DFNT_LINT16     (DFNT_LITEND | DFNT_INT16)
92 #define DFNT_LUINT16    (DFNT_LITEND | DFNT_UINT16)
93 #define DFNT_LINT32     (DFNT_LITEND | DFNT_INT32)
94 #define DFNT_LUINT32    (DFNT_LITEND | DFNT_UINT32)
95 #define DFNT_LINT64     (DFNT_LITEND | DFNT_INT64)
96 #define DFNT_LUINT64    (DFNT_LITEND | DFNT_UINT64)
97 #define DFNT_LINT128    (DFNT_LITEND | DFNT_INT128)     /* Unsupported */
98 #define DFNT_LUINT128   (DFNT_LITEND | DFNT_UINT128)    /* Unsupported */
99 
100 #define DFNT_LCHAR8     (DFNT_LITEND | DFNT_CHAR8)
101 #define DFNT_LCHAR      (DFNT_LITEND | DFNT_CHAR8)  /* backward compat */
102 #define DFNT_LUCHAR8    (DFNT_LITEND | DFNT_UCHAR8)
103 #define DFNT_LUCHAR     (DFNT_LITEND | DFNT_UCHAR8)     /* backward compat */
104 #define DFNT_LCHAR16    (DFNT_LITEND | DFNT_CHAR16)     /* Unsupported */
105 #define DFNT_LUCHAR16   (DFNT_LITEND | DFNT_UCHAR16)    /* Unsupported */
106 
107 /* class info codes for int */
108 #define        DFNTI_MBO       1    /* Motorola byte order 2's compl */
109 #define        DFNTI_VBO       2    /* Vax byte order 2's compl */
110 #define        DFNTI_IBO       4    /* Intel byte order 2's compl */
111 
112 /* class info codes for float */
113 #define        DFNTF_NONE      0    /* indicates subclass is not set */
114 #define        DFNTF_HDFDEFAULT 1   /* hdf default float format is ieee */
115 #define        DFNTF_IEEE      1    /* IEEE format */
116 #define        DFNTF_VAX       2    /* Vax format */
117 #define        DFNTF_CRAY      3    /* Cray format */
118 #define        DFNTF_PC        4    /* PC floats - flipped IEEE */
119 #define        DFNTF_CONVEX    5    /* CONVEX native format */
120 #define        DFNTF_VP        6    /* Fujitsu VP native format */
121 
122 /* class info codes for char */
123 #define        DFNTC_BYTE      0    /* bitwise/numeric field */
124 #define        DFNTC_ASCII     1    /* ASCII */
125 #define        DFNTC_EBCDIC    5    /* EBCDIC */
126 
127 /* array order */
128 #define        DFO_FORTRAN     1    /* column major order */
129 #define        DFO_C           2    /* row major order */
130 
131 /*******************************************************************/
132 /* Sizes of number types                                            */
133 /*******************************************************************/
134 
135 /* first the standard sizes of number types */
136 
137 #    define SIZE_FLOAT32    4
138 #    define SIZE_FLOAT64    8
139 #    define SIZE_FLOAT128  16   /* No current plans for support */
140 
141 #    define SIZE_INT8       1
142 #    define SIZE_UINT8      1
143 #    define SIZE_INT16      2
144 #    define SIZE_UINT16     2
145 #    define SIZE_INT32      4
146 #    define SIZE_UINT32     4
147 #    define SIZE_INT64      8
148 #    define SIZE_UINT64     8
149 #    define SIZE_INT128    16   /* No current plans for support */
150 #    define SIZE_UINT128   16   /* No current plans for support */
151 
152 #    define SIZE_CHAR8      1
153 #    define SIZE_CHAR       1   /* For backward compat char8 == char */
154 #    define SIZE_UCHAR8     1
155 #    define SIZE_UCHAR      1   /* For backward compat uchar8 == uchar */
156 #    define SIZE_CHAR16     2   /* No current plans for support */
157 #    define SIZE_UCHAR16    2   /* No current plans for support */
158 
159 /* then the native sizes of number types */
160 
161 /* Unusual number sizes */
162 /* IA64 (IA64) native number sizes:
163 	Char = 8 bits, signed
164 	Short=16 int=32 long=64 float=32 double=64 bits
165 	Long double=64 bits
166 	Char pointers = 64 bits
167 	Int pointers = 64 bits
168 	Little endian, IEEE floating point
169 */
170 
171 #    define SIZE_NFLOAT32    4
172 #    define SIZE_NFLOAT64    8
173 #    define SIZE_NFLOAT128  16  /* No current plans for support */
174 
175 #    define SIZE_NINT8       1
176 #    define SIZE_NUINT8      1
177 #    define SIZE_NINT16      2
178 #    define SIZE_NUINT16     2
179 #    define SIZE_NINT32      4
180 #    define SIZE_NUINT32     4
181 #    define SIZE_NINT64      8
182 #    define SIZE_NUINT64     8
183 #    define SIZE_NINT128    16  /* No current plans for support */
184 #    define SIZE_NUINT128   16  /* No current plans for support */
185 
186 #    define SIZE_NCHAR8      1
187 #    define SIZE_NCHAR       1  /* For backward compat char8 == char */
188 #    define SIZE_NUCHAR8     1
189 #    define SIZE_NUCHAR      1  /* For backward compat uchar8 == uchar */
190 #    define SIZE_NCHAR16     2  /* No current plans for support */
191 #    define SIZE_NUCHAR16    2  /* No current plans for support */
192 
193 /* then the sizes of little-endian number types */
194 #    define SIZE_LFLOAT32    4
195 #    define SIZE_LFLOAT64    8
196 #    define SIZE_LFLOAT128  16  /* No current plans for support */
197 
198 #    define SIZE_LINT8       1
199 #    define SIZE_LUINT8      1
200 #    define SIZE_LINT16      2
201 #    define SIZE_LUINT16     2
202 #    define SIZE_LINT32      4
203 #    define SIZE_LUINT32     4
204 #    define SIZE_LINT64      8
205 #    define SIZE_LUINT64     8
206 #    define SIZE_LINT128    16  /* No current plans for support */
207 #    define SIZE_LUINT128   16  /* No current plans for support */
208 
209 #    define SIZE_LCHAR8      1
210 #    define SIZE_LCHAR       1  /* For backward compat char8 == char */
211 #    define SIZE_LUCHAR8     1
212 #    define SIZE_LUCHAR      1  /* For backward compat uchar8 == uchar */
213 #    define SIZE_LCHAR16     2  /* No current plans for support */
214 #    define SIZE_LUCHAR16    2  /* No current plans for support */
215 
216     /* sizes of different number types */
217 #       define MACHINE_I8_SIZE     1
218 #       define MACHINE_I16_SIZE    2
219 #       define MACHINE_I32_SIZE    4
220 #       define MACHINE_F32_SIZE    4
221 #       define MACHINE_F64_SIZE    8
222 
223     /* maximum size of the atomic data types */
224 #       define MAX_NT_SIZE      16
225 #endif /* _HNT_H */
226 
227